qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/4] cputlb: introduce tlb_flush_other_cpu for reset use


From: Richard Henderson
Subject: Re: [PATCH 3/4] cputlb: introduce tlb_flush_other_cpu for reset use
Date: Wed, 26 Feb 2025 09:59:29 -0800
User-agent: Mozilla Thunderbird

On 2/26/25 06:29, Alex Bennée wrote:
I guess we want something like:


/* tlb_reset() - reset the TLB when the CPU is not running
  * cs: the cpu
  *
  * Only to be used when the CPU is definitely not running
  */

void tlb_reset(CPUState *cs) {
      g_assert(cs->cpu_stopped);

     for (i = 0; i < NB_MMU_MODES; i++) {
         tlb_mmu_flush_locked(&cpu->neg.tlb.d[i], &cpu->neg.tlb.f[i]);
     }
}

?

I like the name, and the separate assert.
I'm not convinced skipping the tlb resize and (especially) accounting is a good 
idea.

I suspect that the tlb_flush_by_mmuidx_async_work should be split vs its assert_cpu_is_self, and you just should use that. I'll note that tcg_cpu_reset_hold and tlb_flush_by_mmuidx_async_work both call tcg_flush_jmp_cache, so we've got a double-flush in there.

If you don't want to use tlb_flush_by_mmuidx_async_work, I think you need at 
minimum

- take the lock
- tlb_window_reset()
- honor and update cpu->neg.tlb.c.dirty


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]