public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	Wanpeng Li <wanpeng.li@linux.intel.com>
Subject: Re: [PATCH] KVM: cpuid: mask more bits in leaf 0xd and subleaves
Date: Wed, 3 Dec 2014 13:07:40 +0100	[thread overview]
Message-ID: <20141203120739.GA26617@potion.brq.redhat.com> (raw)
In-Reply-To: <547EC40E.5010506@redhat.com>

2014-12-03 09:04+0100, Paolo Bonzini:
> On 03/12/2014 00:05, Radim Krčmář wrote:
> > 2014-12-02 14:09+0100, Paolo Bonzini:
> >> +			} else {
> >> +				if (entry[i].eax == 0 || !(supported & mask))
> >> +					continue;
> >> +				WARN_ON_ONCE(entry[i].ecx & 1);
> >> +				entry[i].ecx &= 1;
> > 
> >  ECX  Bit 0 is set if the sub-leaf index, n, maps to a valid bit in the
> >       IA32_XSS MSR and bit 0 is clear if n maps to a valid bit in XCR0.
> > 
> > ECX should be set to 0 instead, we definitely don't map to a valid bit
> > in IA32_XSS now.
> 
> Well, there is a WARN just above. :)  But I can change it to zero instead.

Yeah, I wasn't sure about the WARN ... I can only see it trigger after
host xcr0 changes and we are much more screwed in that case anyway :)
(But it has a chance of catching a bug, so it isn't only bad.)

The guest expects 0 here, so I'd rather have it ...

> > (Having only one part of cpuid ready for it is weird ...)
> > 
> >> +			}
> >> +			entry[i].edx = 0;
> >>  			entry[i].flags |=
> >>  			       KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
> > 
> > (Unrelated, I have yet to understand how this flag translates
> >  * If ECX contains an invalid sub-leaf index, EAX/EBX/ECX/EDX return 0.)
> 
> If the index is invalid, entry[i].eax is zero and we do not return
> anything at all.

I see, the field is sparse and "++*nent; ++i;", not the flag, does it,
thanks.

  reply	other threads:[~2014-12-03 12:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02 13:09 [PATCH] KVM: cpuid: mask more bits in leaf 0xd and subleaves Paolo Bonzini
2014-12-02 23:05 ` Radim Krčmář
2014-12-03  8:04   ` Paolo Bonzini
2014-12-03 12:07     ` Radim Krčmář [this message]
2014-12-03 12:10       ` Paolo Bonzini

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=20141203120739.GA26617@potion.brq.redhat.com \
    --to=rkrcmar@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=wanpeng.li@linux.intel.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