All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kvm <kvm@vger.kernel.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@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: [PATCH v2 1/2] KVM: VMX: FIXED+PHYSICAL mode single target IPI fastpath
Date: Tue, 19 Nov 2019 13:26:51 +0100	[thread overview]
Message-ID: <87lfscgigk.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <CANRm+CzcWDvRA0+iaQZ6hd2HGRKyZpRnurghQXdagDCffKaSPg@mail.gmail.com>

Wanpeng Li <kernellwp@gmail.com> writes:

> On Tue, 19 Nov 2019 at 19:54, Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
>>
>> Wanpeng Li <kernellwp@gmail.com> writes:
>>
>> > From: Wanpeng Li <wanpengli@tencent.com>
>> >
>> > +     if (lapic_in_kernel(vcpu) && apic_x2apic_mode(vcpu->arch.apic)) {
>> > +             /*
>> > +              * fastpath to IPI target, FIXED+PHYSICAL which is popular
>> > +              */
>> > +             index = kvm_rcx_read(vcpu);
>> > +             data = kvm_read_edx_eax(vcpu);
>> > +
>> > +             if (((index - APIC_BASE_MSR) << 4 == APIC_ICR) &&
>>
>> What if index (RCX) is < APIC_BASE_MSR?
>
> How about if (index == (APIC_BASE_MSR + 0x300) &&
>

What about ' << 4', don't we still need it? :-) And better APIC_ICR
instead of 0x300...

Personally, I'd write something like

if (index > APIC_BASE_MSR && (index - APIC_BASE_MSR) == APIC_ICR >> 4)

and let compiler optimize this, I bet it's going to be equally good.

-- 
Vitaly


  reply	other threads:[~2019-11-19 12:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19  6:36 [PATCH v2 1/2] KVM: VMX: FIXED+PHYSICAL mode single target IPI fastpath Wanpeng Li
2019-11-19 11:54 ` Vitaly Kuznetsov
2019-11-19 11:59   ` Wanpeng Li
2019-11-19 12:26     ` Vitaly Kuznetsov [this message]
2019-11-20 17:43       ` Paolo Bonzini
2019-11-21  3:19         ` Wanpeng Li
2019-11-19 12:11 ` Liran Alon
2019-11-20  3:49   ` Wanpeng Li
2019-11-20 17:02     ` Sean Christopherson
2019-11-21  1:34       ` Wanpeng Li
2019-11-19 18:36 ` Sean Christopherson
2019-11-19 18:58   ` Liran Alon
2019-11-20  0:34     ` Wanpeng Li
2019-11-20  0:24   ` 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=87lfscgigk.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.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=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=sean.j.christopherson@intel.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 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.