[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANRm+CzX4UcYLKC16=kONa5HGQeWejCvwbW_hFL_9o=p0-ktsA@mail.gmail.com>
Date: Thu, 2 Apr 2020 08:14:34 +0800
From: Wanpeng Li <kernellwp@...il.com>
To: Sean Christopherson <sean.j.christopherson@...el.com>
Cc: Nadav Amit <namit@...are.com>, Paolo Bonzini <pbonzini@...hat.com>,
LKML <linux-kernel@...r.kernel.org>, kvm <kvm@...r.kernel.org>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>
Subject: Re: [PATCH v2 2/2] KVM: LAPIC: Don't need to clear IPI delivery
status in x2apic mode
On Thu, 2 Apr 2020 at 07:01, Sean Christopherson
<sean.j.christopherson@...el.com> wrote:
>
> On Wed, Apr 01, 2020 at 05:40:03PM +0000, Nadav Amit wrote:
> > > On Mar 31, 2020, at 11:46 PM, Wanpeng Li <kernellwp@...il.com> wrote:
> > >
> > > Cc more people,
> > > On Wed, 1 Apr 2020 at 08:35, Paolo Bonzini <pbonzini@...hat.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.
Fair enough.
Wanpeng
Powered by blists - more mailing lists