On Wed, Oct 16, 2024 at 2:59 AM Anthony Yznaga <anthony.yznaga@xxxxxxxxxx> wrote: > On 10/14/24 1:07 PM, Jann Horn wrote: > > Second, there is a newer mode for IOMMUv2 stuff (using the > > mmu_notifier_ops::invalidate_range callback), where the idea is that > > you have secondary MMUs that share the normal page tables, and so you > > basically send them invalidations at the same time you invalidate the > > primary MMU for the process. I think that's the right fit for this > > usecase; however, last I looked, this code was extremely broken (see > > https://lore.kernel.org/lkml/CAG48ez2NQKVbv=yG_fq_jtZjf8Q=+Wy54FxcFrK_OujFg5BwSQ@xxxxxxxxxxxxxx/ > > for context). Unless that's changed in the meantime, I think someone > > would have to fix that code before it can be relied on for new > > usecases. > > Thank you for this background! Looks like there have since been some > changes to the mmu notifiers, and the invalidate_range callback became > arch_invalidate_secondary_tlbs. I'm currently looking into using it to > flush all TLBs. Ah, nice, that looks much better now. With the caveat that, from what I can tell, the notifiers only work on x86/arm64/powerpc - I guess maybe that infrastructure should be gated on a HAVE_... arch config flag...