linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Tom Lendacky <thomas.lendacky@amd.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	x86@kernel.org, tglx@linutronix.de, andrew.cooper3@citrix.com,
	"Ingo Molnar" <mingo@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Joerg Roedel" <joro@8bytes.org>, "Borislav Petkov" <bp@suse.de>,
	"David Woodhouse" <dwmw@amazon.co.uk>,
	"Janakarajan Natarajan" <Janakarajan.Natarajan@amd.com>,
	"Kees Cook" <keescook@chromium.org>,
	"KarimAllah Ahmed" <karahmed@amazon.de>,
	"Andy Lutomirski" <luto@kernel.org>
Subject: Re: [PATCH v1 2/3] x86/bugs: Add AMD's SPEC_CTRL MSR usage
Date: Mon, 4 Jun 2018 16:54:47 -0400	[thread overview]
Message-ID: <20180604205447.GO5867@char.us.oracle.com> (raw)
In-Reply-To: <2f325eea-5ffc-70f5-43d8-59ceef73d04d@amd.com>

On Mon, Jun 04, 2018 at 03:43:17PM -0500, Tom Lendacky wrote:
> On 6/4/2018 3:20 PM, Konrad Rzeszutek Wilk wrote:
> >>> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> >>> index 26110c202b19..950ec50f77c3 100644
> >>> --- a/arch/x86/kvm/svm.c
> >>> +++ b/arch/x86/kvm/svm.c
> >>> @@ -4115,7 +4115,8 @@ static int svm_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
> >>>  		break;
> >>>  	case MSR_IA32_SPEC_CTRL:
> >>>  		if (!msr_info->host_initiated &&
> >>> -		    !guest_cpuid_has(vcpu, X86_FEATURE_AMD_IBRS))
> >>> +		    !guest_cpuid_has(vcpu, X86_FEATURE_AMD_IBRS) &&
> >>> +		    !guest_cpuid_has(vcpu, X86_FEATURE_AMD_SSBD))
> >>
> >> Shouldn't the IBRS/SSBD check be an "or" check?  I don't think it's
> >> necessarily true that IBRS and SSBD have to both be set.  Maybe something
> >> like:
> >>
> >> 	if (!msr_info->host_initiated &&
> >> 	    !(guest_cpuid_has(vcpu, X86_FEATURE_AMD_IBRS) ||
> >> 	      guest_cpuid_has(vcpu, X86_FEATURE_AMD_SSBD))
> >>
> >> Does that make sense?
> > 
> > The '!' on each of the CPUID and '&&' make this the same. See:
> 
> Doh!  Yes, I don't know what I was thinking.  Just the end of a long
> week I guess.

<grins> I can imagine!
> 
> > 
> > 
> >  AMD_IBRS set	|  AMD_SSBD set	| !AMD_IBRS && !AMD_SSBD | !(AMD_IBRS || AMD_SSBD)
> > 	0	|	0	| 1 && 1 -> return 1	 | !(0) -> 1 -> return 1
> > 	1	|	0	| 0 && 1, continue	 | !(1 || 0) -> continue
> > 	1	|	1	| 0 && 0, continue	 | !(1 || 1) -> continue
> > 	0	|	1	| 1 && 0, continue	 | !(0 || 1) -> continue
> > 
> > Meaning we will return 1 if:
> >  the host has not initiator it or,
> >  the guest CPUID does not have AMD_IBRS flag or,
> >  the guest CPUID does not have AMD SSBD flag
> > 
> > I am fine modifying it the way you had in mind, but in the past the logic
> > was to use ! and &&, hence stuck to that.
> 
> No reason to change, it's fine the way you have it.

Excellent. Would you be OK giving it an Acked by or such?

Thanks.

  reply	other threads:[~2018-06-04 20:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 14:59 [PATCH v1] AMD SSB bits Konrad Rzeszutek Wilk
2018-06-01 14:59 ` [PATCH v1 1/3] x86/bugs: Add AMD's variant of SSB_NO Konrad Rzeszutek Wilk
2018-06-06 12:15   ` [tip:x86/pti] " tip-bot for Konrad Rzeszutek Wilk
2018-06-01 14:59 ` [PATCH v1 2/3] x86/bugs: Add AMD's SPEC_CTRL MSR usage Konrad Rzeszutek Wilk
2018-06-02  1:04   ` Tom Lendacky
2018-06-04 20:20     ` Konrad Rzeszutek Wilk
2018-06-04 20:43       ` Tom Lendacky
2018-06-04 20:54         ` Konrad Rzeszutek Wilk [this message]
2018-06-06 12:16   ` [tip:x86/pti] " tip-bot for Konrad Rzeszutek Wilk
2018-06-01 14:59 ` [PATCH v1 3/3] x86/bugs: Switch the selection of mitigation from CPU vendor to CPU features Konrad Rzeszutek Wilk
2018-06-06 12:16   ` [tip:x86/pti] " tip-bot for Konrad Rzeszutek Wilk
2018-06-08 21:30   ` [PATCH v1 3/3] " Tom Lendacky
2018-06-11 14:01     ` Konrad Rzeszutek Wilk
2018-06-12 14:38       ` Tom Lendacky
2018-06-15 18:57         ` Thomas Gleixner
2018-06-15 19:38           ` Konrad Rzeszutek Wilk
2018-06-05 13:23 ` [PATCH v1] AMD SSB bits Tom Lendacky
2018-06-05 20:56   ` Konrad Rzeszutek Wilk

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=20180604205447.GO5867@char.us.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=Janakarajan.Natarajan@amd.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bp@suse.de \
    --cc=dwmw@amazon.co.uk \
    --cc=hpa@zytor.com \
    --cc=joro@8bytes.org \
    --cc=karahmed@amazon.de \
    --cc=keescook@chromium.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@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).