From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Nadav Amit <namit@vmware.com>
Cc: Wanpeng Li <kernellwp@gmail.com>,
Paolo Bonzini <pbonzini@redhat.com>,
LKML <linux-kernel@vger.kernel.org>, kvm <kvm@vger.kernel.org>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>
Subject: Re: [PATCH v2 2/2] KVM: LAPIC: Don't need to clear IPI delivery status in x2apic mode
Date: Wed, 1 Apr 2020 16:01:00 -0700 [thread overview]
Message-ID: <20200401230100.GE9603@linux.intel.com> (raw)
In-Reply-To: <CE34AD16-64A7-4AA0-9928-507C6F3FF6CD@vmware.com>
On Wed, Apr 01, 2020 at 05:40:03PM +0000, Nadav Amit wrote:
> > On Mar 31, 2020, at 11:46 PM, Wanpeng Li <kernellwp@gmail.com> wrote:
> >
> > Cc more people,
> > On Wed, 1 Apr 2020 at 08:35, Paolo Bonzini <pbonzini@redhat.com> wrote:
> >> On 01/04/20 02:19, Wanpeng Li wrote:
> >>> - /* No delay here, so we always clear the pending bit */
> >>> - val &= ~(1 << 12);
> >>> + /* Immediately clear Delivery Status in xAPIC mode */
> >>> + if (!apic_x2apic_mode(apic))
> >>> + val &= ~(1 << 12);
> >>
> >> This adds a conditional, and the old behavior was valid according to the
> >> SDM: "software should not assume the value returned by reading the ICR
> >> is the last written value".
> >
> > Nadav, Sean, what do you think?
>
> I do not know. But if you write a KVM unit-test, I can run it on bare-metal
> and give you feedback about how it behaves.
I agree with Paolo, clearing the bit doesn't violate the SDM. The
conditional is just as costly as the AND, if not more so, even for x2APIC.
I would play it safe and clear the bit even in the x2APIC only path to
avoid tripping up guest kernels that loop on the delivery status even when
using x2APIC.
next prev parent reply other threads:[~2020-04-01 23:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-01 0:19 [PATCH v2 1/2] KVM: X86: Filter out the broadcast dest for IPI fastpath Wanpeng Li
2020-04-01 0:19 ` [PATCH v2 2/2] KVM: LAPIC: Don't need to clear IPI delivery status in x2apic mode Wanpeng Li
2020-04-01 0:35 ` Paolo Bonzini
2020-04-01 6:46 ` Wanpeng Li
2020-04-01 17:40 ` Nadav Amit
2020-04-01 23:01 ` Sean Christopherson [this message]
2020-04-02 0:14 ` Wanpeng Li
2020-04-01 10:17 ` Wanpeng Li
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=20200401230100.GE9603@linux.intel.com \
--to=sean.j.christopherson@intel.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=namit@vmware.com \
--cc=pbonzini@redhat.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).