All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: filter guest NX capability for cpuid2
Date: Mon, 5 Oct 2020 09:37:44 -0700	[thread overview]
Message-ID: <20201005163743.GE11938@linux.intel.com> (raw)
In-Reply-To: <87ft6s8zdg.fsf@vitty.brq.redhat.com>

On Mon, Oct 05, 2020 at 05:29:47PM +0200, Vitaly Kuznetsov wrote:
> Tianjia Zhang <tianjia.zhang@linux.alibaba.com> writes:
> 
> > Original KVM_SET_CPUID has removed NX on non-NX hosts as it did
> > before. but KVM_SET_CPUID2 does not. The two should be consistent.
> >
> > Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> > ---
> >  arch/x86/kvm/cpuid.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> > index 3fd6eec202d7..3e7ba2b11acb 100644
> > --- a/arch/x86/kvm/cpuid.c
> > +++ b/arch/x86/kvm/cpuid.c
> > @@ -257,6 +257,7 @@ int kvm_vcpu_ioctl_set_cpuid2(struct kvm_vcpu *vcpu,
> >  		goto out;
> >  	}
> >  
> > +	cpuid_fix_nx_cap(vcpu);
> >  	kvm_update_cpuid_runtime(vcpu);
> >  	kvm_vcpu_after_set_cpuid(vcpu);
> >  out:
> 
> I stumbled upon this too and came to the conclusion this is
> intentional, e.g. see this:
> 
> commit 0771671749b59a507b6da4efb931c44d9691e248
> Author: Dan Kenigsberg <danken@qumranet.com>
> Date:   Wed Nov 21 17:10:04 2007 +0200
> 
>     KVM: Enhance guest cpuid management
> 
> ...
> 
>     [avi: fix original KVM_SET_CPUID not removing nx on non-nx hosts as it did
>           before]
> 
> but this is a very, very old story.

Doesn't mean it's bogus though :-)  _If_ we want to extend this behavior to
KVM_SET_CPUID2, there should be a justified need.

  reply	other threads:[~2020-10-05 18:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-05 14:59 [PATCH] KVM: x86: filter guest NX capability for cpuid2 Tianjia Zhang
2020-10-05 15:29 ` Vitaly Kuznetsov
2020-10-05 16:37   ` Sean Christopherson [this message]
2020-10-06  7:54     ` Vitaly Kuznetsov

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=20201005163743.GE11938@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tianjia.zhang@linux.alibaba.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.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 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.