linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] KVM: VMX: Replace MSR_IA32_RTIT_OUTPUT_BASE_MASK with helper function
Date: Thu, 24 Sep 2020 11:01:20 -0700	[thread overview]
Message-ID: <20200924180120.GA9649@linux.intel.com> (raw)
In-Reply-To: <0a215e25-798d-3f17-0fcb-885806f2351b@redhat.com>

On Wed, Sep 23, 2020 at 07:07:22PM +0200, Paolo Bonzini wrote:
> On 23/09/20 18:36, Sean Christopherson wrote:
> > +static inline bool pt_output_base_valid(struct kvm_vcpu *vcpu, u64 base)
> > +{
> > +	/* The base must be 128-byte aligned and a legal physical address. */
> > +	return !(base & (~((1UL << cpuid_maxphyaddr(vcpu)) - 1) | 0x7f));
> > +}
> 
> The fact that you deemed a comment necessary says something already. :)
> What about:
> 
>         return !kvm_mmu_is_illegal_gpa(vcpu, base) && !(base & 0x7f);
> 
> (where this new usage makes it obvious that mmu should have been vcpu).

Ya.  I think it was a sort of sunk cost fallacy.  Dammit, I spent all that
time figuring out what this code does, I'm keeping it!!!

v3 incoming...

  reply	other threads:[~2020-09-24 18:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 16:36 [PATCH v2 0/3] KVM: VMX: Clean up RTIT MAXPHYADDR usage Sean Christopherson
2020-09-23 16:36 ` [PATCH v2 1/3] KVM: VMX: Use precomputed MAXPHYADDR for RTIT base MSR check Sean Christopherson
2020-09-23 16:36 ` [PATCH v2 2/3] KVM: VMX: Replace MSR_IA32_RTIT_OUTPUT_BASE_MASK with helper function Sean Christopherson
2020-09-23 17:07   ` Paolo Bonzini
2020-09-24 18:01     ` Sean Christopherson [this message]
2020-09-23 16:36 ` [PATCH v2 3/3] KVM: x86: Unexport cpuid_query_maxphyaddr() 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=20200924180120.GA9649@linux.intel.com \
    --to=sean.j.christopherson@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=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).