From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Xiaoyao Li <xiaoyao.li@intel.com>, Chenyi Qiang <chenyi.qiang@intel.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <sean.j.christopherson@intel.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>
Subject: Re: [RFC 2/2] KVM: VMX: Enable bus lock VM exit
Date: Wed, 01 Jul 2020 16:49:49 +0200 [thread overview]
Message-ID: <87zh8j9to2.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <adad61e8-8252-0491-7feb-992a52c1b4f3@intel.com>
Xiaoyao Li <xiaoyao.li@intel.com> writes:
> On 7/1/2020 8:44 PM, Vitaly Kuznetsov wrote:
>> Xiaoyao Li <xiaoyao.li@intel.com> writes:
>>
>>> On 7/1/2020 5:04 PM, Vitaly Kuznetsov wrote:
>>>> Chenyi Qiang <chenyi.qiang@intel.com> writes:
>>> [...]
>>>>> static const int kvm_vmx_max_exit_handlers =
>>>>> @@ -6830,6 +6838,13 @@ static fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu)
>>>>> if (unlikely(vmx->exit_reason.failed_vmentry))
>>>>> return EXIT_FASTPATH_NONE;
>>>>>
>>>>> + /*
>>>>> + * check the exit_reason to see if there is a bus lock
>>>>> + * happened in guest.
>>>>> + */
>>>>> + if (vmx->exit_reason.bus_lock_detected)
>>>>> + handle_bus_lock(vcpu);
>>>>
>>>> In case the ultimate goal is to have an exit to userspace on bus lock,
>>>
>>> I don't think we will need an exit to userspace on bus lock. See below.
>>>
>>>> the two ways to reach handle_bus_lock() are very different: in case
>>>> we're handling EXIT_REASON_BUS_LOCK we can easily drop to userspace by
>>>> returning 0 but what are we going to do in case of
>>>> exit_reason.bus_lock_detected? The 'higher priority VM exit' may require
>>>> exit to userspace too. So what's the plan? Maybe we can ignore the case
>>>> when we're exiting to userspace for some other reason as this is slow
>>>> already and force the exit otherwise?
>>>
>>>> And should we actually introduce
>>>> the KVM_EXIT_BUS_LOCK and a capability to enable it here?
>>>>
>>>
>>> Introducing KVM_EXIT_BUS_LOCK maybe help nothing. No matter
>>> EXIT_REASON_BUS_LOCK or exit_reason.bus_lock_detected, the bus lock has
>>> already happened. Exit to userspace cannot prevent bus lock, so what
>>> userspace can do is recording and counting as what this patch does in
>>> vcpu->stat.bus_locks.
>>
>> Exiting to userspace would allow to implement custom 'throttling'
>> policies to mitigate the 'noisy neighbour' problem. The simplest would
>> be to just inject some sleep time.
>>
>
> So you want an exit to userspace for every bus lock and leave it all to
> userspace. Yes, it's doable.
>
In some cases we may not even want to have a VM exit: think
e.g. real-time/partitioning case when even in case of bus lock we may
not want to add additional latency just to count such events. I'd
suggest we make the new capability tri-state:
- disabled (no vmexit, default)
- stats only (what this patch does)
- userspace exit
But maybe this is an overkill, I'd like to hear what others think.
> As you said, the exit_reason.bus_lock_detected case is the tricky one.
> We cannot do the similar to extend vcpu->run->exit_reason, this breaks
> ABI. Maybe we can extend the vcpu->run->flags to indicate bus lock
> detected for the other exit reason?
This is likely the easiest solution.
--
Vitaly
next prev parent reply other threads:[~2020-07-01 14:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-28 8:53 [RFC 0/2] Add support for bus lock VM exit Chenyi Qiang
2020-06-28 8:53 ` [RFC 1/2] KVM: VMX: Convert vcpu_vmx.exit_reason to a union Chenyi Qiang
2020-06-28 8:53 ` [RFC 2/2] KVM: VMX: Enable bus lock VM exit Chenyi Qiang
2020-07-01 9:04 ` Vitaly Kuznetsov
2020-07-01 9:32 ` Xiaoyao Li
2020-07-01 12:44 ` Vitaly Kuznetsov
2020-07-01 14:12 ` Xiaoyao Li
2020-07-01 14:49 ` Vitaly Kuznetsov [this message]
2020-07-02 9:15 ` Xiaoyao Li
2020-07-23 1:21 ` Sean Christopherson
2020-07-27 4:38 ` Xiaoyao Li
2020-07-28 16:25 ` Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zh8j9to2.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=chenyi.qiang@intel.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=wanpengli@tencent.com \
--cc=xiaoyao.li@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.