From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Borntraeger Date: Wed, 29 Sep 2021 06:56:50 +0000 Subject: Re: disabling halt polling broken? (was Re: [PATCH 00/14] KVM: Halt-polling fixes, cleanups and a ne Message-Id: List-Id: References: <20210925005528.1145584-1-seanjc@google.com> <03f2f5ab-e809-2ba5-bd98-3393c3b843d2@de.ibm.com> <43e42f5c-9d9f-9e8b-3a61-9a053a818250@de.ibm.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: David Matlack Cc: Wanpeng Li , kvm list , David Hildenbrand , LKML , Paul Mackerras , Claudio Imbrenda , KVMARM , Janosch Frank , Marc Zyngier , Joerg Roedel , Huacai Chen , Aleksandar Markovic , Jon Cargille , KVMPPC , linux-arm-kernel@lists.infradead.org, Jim Mattson , Cornelia Huck , LinuxMIPS , Paolo Bonzini , Vitaly Kuznetsov Am 27.09.21 um 18:58 schrieb David Matlack: > On Mon, Sep 27, 2021 at 8:17 AM Christian Borntraeger > wrote: >> >> >> >> Am 27.09.21 um 17:03 schrieb Paolo Bonzini: >>> On 27/09/21 16:59, Sean Christopherson wrote: >>>>> commit acd05785e48c01edb2c4f4d014d28478b5f19fb5 >>>>> Author: David Matlack >>>>> AuthorDate: Fri Apr 17 15:14:46 2020 -0700 >>>>> Commit: Paolo Bonzini >>>>> CommitDate: Fri Apr 24 12:53:17 2020 -0400 >>>>> >>>>> kvm: add capability for halt polling >>>>> >>>>> broke the possibility for an admin to disable halt polling for already running KVM guests. >>>>> In past times doing >>>>> echo 0 > /sys/module/kvm/parameters/halt_poll_ns >>>>> >>>>> stopped polling system wide. >>>>> Now all KVM guests will use the halt_poll_ns value that was active during >>>>> startup - even those that do not use KVM_CAP_HALT_POLL. >>>>> >>>>> I guess this was not intended? >>> >>> No, but... >>> >>>> I would go so far as to say that halt_poll_ns should be a hard limit on >>>> the capability >>> >>> ... this would not be a good idea I think. Anything that wants to do a lot of polling can just do "for (;;)". > > I agree. It would also be a maintenance burden and subtle "gotcha" to > have to increase halt_poll_ns anytime one wants to increase > KVM_CAP_HALT_POLL. I think the idea of the upper bound is not about preventing wasting CPUs but to reconfigure existing poll intervals on a global level. So I think this idea is a bad idea in itself. Especially as the admin might not have access to the monitor of user QEMUs. >>> >>> So I think there are two possibilities that makes sense: >>> >>> * track what is using KVM_CAP_HALT_POLL, and make writes to halt_poll_ns follow that >> >> what about using halt_poll_ns for those VMs that did not uses KVM_CAP_HALT_POLL and the private number for those that did. > > None of these options would cover Christian's original use-case > though. (Write to module to disable halt-polling system-wide.) > > What about adding a writable "enable_halt_polling" module parameter that would then affect both classes with and without KVM_CAP_HALT_POLL. > that affects all VMs? Once that is in place we could also consider > getting rid of halt_poll_ns entirely. As far as I can tell QEMU does not yet use KVM_CAP_HALT_POLL. So having a system wide halt_poll_ns makes sense. And I think for all processes not using KVM_CAP_HALT_POLL we should really follow what halt_poll_ns is NOW and not what it used to be.