Hi Warner,

On 31/1/26 01:08, Warner Losh wrote:
OK. I've updated bsd-user fork from last year to yesterday. I had one question.

I see that we've gone from tb_flush() to queue_tb_flush(). Why was that?

This fixed a race where a vCPU kept a ref to a flushed TB.

And is it a drop in?
FreeBSD's fork has this in the thread creation:

     /*
      * If this is our first additional thread, we need to ensure we
      * generate code for parallel execution and flush old translations.
      * Do this now so that the copy gets CF_PARALLEL too.
      */
     if (!(cpu->tcg_cflags & CF_PARALLEL)) {
         cpu->tcg_cflags |= CF_PARALLEL;
         tb_flush(cpu);
     }

I think the right thing to do is to just change this to queue_tb_flush(cpu), and that compiles. I'd like to get some confirmation, though. Did I parse the changes right?

You should change these 4 lines by:

    begin_parallel_context(cpu);

which calls tb_flush__exclusive_or_serial(), itself described as:

 * Used to flush all the translation blocks in the system.  Mostly this
 * is used to empty the code generation buffer after it is full.
 * Sometimes it is used when it is simpler to flush everything than work
 * out which individual translations are now invalid.
 *
 * Must be called from an exclusive or serial context, e.g.
 * start_exclusive, vm_stop, or when there is only one vcpu.  Note that
 * start_exclusive cannot be called from within the cpu run loop, so
 * this cannot be called from within target code.

See equivalent commit 430014bee7a ("linux-user: Split out
begin_parallel_context").


Everything else is mundane changes that were more annoying than difficult :)

This is reassuring :)


Warner





Reply via email to