On Mon, Aug 18, 2025 at 01:51:28PM +0200, Arnd Bergmann wrote: > On Thu, Aug 14, 2025, at 15:00, Catalin Marinas wrote: > > On Wed, Aug 13, 2025 at 06:29:37PM +0200, Arnd Bergmann wrote: > >> On Wed, Aug 13, 2025, at 18:09, Catalin Marinas wrote: > >> and virtual machines with CPU overcommit. > > > > Not sure it helps here. With vCPU overcommit, KVM enables WFE trapping > > and the event stream no longer has any effect (it's not like it > > interrupts the host). > > I would expect a similar overhead for the WFE trapping as for the > bare-metal hardware case: When the WFE traps, the host has to > reschedule all guests that are in WFE periodically, while WFET > with event stream disabled means this can be driven by an accurate > host timer. For WFIT, yes, this works as the hypervisor either gets an interrupt or schedules a timer. It can tell what WFI* is going to be woken by. With WFET, the hypervisor cannot tell if an event was generated by another vCPU (e.g. clearing of the exclusive monitor) unless it does a WFE itself. So it can't put the vCPU to sleep based on the WFET timeout. IIUC, from kvm_handle_wfx(), the only difference is whether it returns immediately to the vCPU if it timed out or tells the core KVM to reschedule other vCPUs. > > That said, my worry is that either broken hardware or software rely on > > the event stream unknowingly, e.g. someone using WFE in a busy loop. And > > for hardware errata, we've had a few where the wakeup events don't > > propagate between clusters, though these we can toggle on a case by case > > basis. > > Don't we already support hardware without a functional architected > timer even with? Those don't use the event stream today even when > CONFIG_ARM_ARCH_TIMER_EVTSTREAM is enabled. Maybe we still have such hardware around (e.g. errata) but it shouldn't be the norm, especially if vendors try to follow the *BSA specs. -- Catalin