xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: Ian Jackson <iwj@xenproject.org>, Wei Liu <wl@xen.org>,
	Anthony PERARD <anthony.perard@citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	Kevin Tian <kevin.tian@intel.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 for-4.15] x86/msr: introduce an option for HVM relaxed rdmsr behavior
Date: Fri, 5 Mar 2021 12:06:28 +0100	[thread overview]
Message-ID: <94338621-9068-8376-c810-0fe1a9c8f3e0@suse.com> (raw)
In-Reply-To: <fc2e724b-bada-ded3-97b4-26e9a0f3ff4a@suse.com>

On 05.03.2021 11:56, Jan Beulich wrote:
> On 04.03.2021 15:47, Roger Pau Monne wrote:
>> --- a/xen/arch/x86/hvm/svm/svm.c
>> +++ b/xen/arch/x86/hvm/svm/svm.c
>> @@ -1795,6 +1795,7 @@ static int svm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
>>      const struct domain *d = v->domain;
>>      struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
>>      const struct nestedsvm *nsvm = &vcpu_nestedsvm(v);
>> +    uint64_t tmp;
>>  
>>      switch ( msr )
>>      {
>> @@ -1965,6 +1966,11 @@ static int svm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
>>          break;
>>  
>>      default:
>> +        if ( d->arch.hvm.rdmsr_relaxed && !rdmsr_safe(msr, tmp) )
>> +        {
>> +            *msr_content = 0;
>> +            break;
>> +        }
> 
> You don't really need "tmp" here, do you? You could as well read
> into *msr_content, as you're zapping the value afterwards anyway.

Actually, while perhaps indeed not strictly needed, it allows the
compiler to produce better code, as it'll be able to recognize
the value doesn't need writing to memory on any path. I guess I'll
change the logic in my related patch along these lines then.

Jan


  reply	other threads:[~2021-03-05 11:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 14:47 [PATCH v2 for-4.15] x86/msr: introduce an option for HVM relaxed rdmsr behavior Roger Pau Monne
2021-03-04 14:59 ` Ian Jackson
2021-03-04 15:13   ` Roger Pau Monné
2021-03-04 15:20     ` Ian Jackson
2021-03-04 16:55       ` Roger Pau Monné
2021-03-04 17:13         ` Ian Jackson
2021-03-04 17:43           ` Roger Pau Monné
2021-03-04 18:21             ` Ian Jackson
2021-03-05 10:26             ` Jan Beulich
2021-03-04 23:09 ` Boris Ostrovsky
2021-03-04 23:28   ` Andrew Cooper
2021-03-05  8:26     ` Roger Pau Monné
2021-03-05  0:06 ` Andrew Cooper
2021-03-05  9:15   ` Roger Pau Monné
2021-03-05 10:35     ` Jan Beulich
2021-03-05 10:56 ` Jan Beulich
2021-03-05 11:06   ` Jan Beulich [this message]
2021-03-08 14:30   ` Roger Pau Monné

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=94338621-9068-8376-c810-0fe1a9c8f3e0@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=iwj@xenproject.org \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /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).