stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: David Matlack <dmatlack@google.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kvm list" <kvm@vger.kernel.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Jiří Olša" <jolsa@redhat.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: disable PEBS before a guest entry
Date: Fri, 4 Mar 2016 14:27:03 +0100	[thread overview]
Message-ID: <20160304132702.GE2294@potion.brq.redhat.com> (raw)
In-Reply-To: <CALzav=d2xPiQOKzc7y3gnjc992fZrysFJPoAf8cyyuVBpZ4Caw@mail.gmail.com>

2016-03-03 13:32-0800, David Matlack:
> On Thu, Mar 3, 2016 at 10:53 AM, Radim Krčmář <rkrcmar@redhat.com> wrote:
>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>> @@ -1767,6 +1767,13 @@ static void clear_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr)
>>                         return;
>>                 }
>>                 break;
>> +       case MSR_IA32_PEBS_ENABLE:
>> +               /* PEBS needs a quiescent period after being disabled (to write
>> +                * a record).  Disabling PEBS through VMX MSR swapping doesn't
>> +                * provide that period, so a CPU could write host's record into
>> +                * guest's memory.
>> +                */
>> +               wrmsrl(MSR_IA32_PEBS_ENABLE, 0);
> 
> Should this go in add_atomic_switch_msr instead of clear_atomic_switch_msr?

Yes, it could be cleared in both (in case guest PEBS can be non-zero),
but I wanted to have it only in add_atomic_switch_msr().

Thank you!

v2 underway.

(In case it makes you wonder how it was tested:
 I have a bad habit of trying whether a patch can be improved before
 posting and this one went awry, because I already returned the machine
 with reproducer and the change seemed simple enough.)

      reply	other threads:[~2016-03-04 13:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03 18:53 [PATCH] KVM: x86: disable PEBS before a guest entry Radim Krčmář
2016-03-03 21:32 ` David Matlack
2016-03-04 13:27   ` Radim Krčmář [this message]

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=20160304132702.GE2294@potion.brq.redhat.com \
    --to=rkrcmar@redhat.com \
    --cc=dmatlack@google.com \
    --cc=jolsa@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=stable@vger.kernel.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).