linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Nadav Amit <namit@cs.technion.ac.il>,
	Ingo Molnar <mingo@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
	Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	the arch/x86 maintainers <x86@kernel.org>,
	kvm <kvm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [RESEND PATCH 1/3] x86: Adding structs to reflect cpuid fields
Date: Thu, 18 Sep 2014 15:36:43 +0200	[thread overview]
Message-ID: <541ADFEB.6030801@redhat.com> (raw)
In-Reply-To: <20140918132635.GB27008@nazgul.tnic>

Il 18/09/2014 15:26, Borislav Petkov ha scritto:
> On Thu, Sep 18, 2014 at 03:06:59PM +0200, Paolo Bonzini wrote:
>> The extra bit used to be reserved and thus will be zero on older
>> families.  So, nothing?
> 
> "thus will be zero" is unfortunately simply not true.
> 
> From the SDM:
> 
> "1.3.2 Reserved Bits and Software Compatibility
> 
> In many register and memory layout descriptions, certain bits are marked
> as reserved. When bits are marked as reserved, it is essential for
> compatibility with future processors that software treat these bits as
> having a future, though unknown, effect. The behavior of reserved bits
> should be regarded as not only undefined, but unpredict- able. Software
> should follow these guidelines in dealing with reserved bits:

We're talking about the case where the field is not reserved anymore and
we _know_ that the vendor has just decided to grow the bitfield that
precedes it.

As soon as we know that the field is not reserved anymore, we obviously
rely on reserved bits being zero in older processors, and in future
processors from other vendors.  The trivial example is feature bits like
XSAVE.  We query them all the time without checking the family when they
were first introduced, don't we?

> * Do not depend on the states of any reserved bits when testing the values of registers that contain such bits.
> Mask out the reserved bits before testing.

Done by the bitfields.

> *  Do not depend on the states of any reserved bits when storing to memory or to a register.

Doesn't apply to CPUID.

> * Do not depend on the ability to retain information written into any reserved bits.

Doesn't apply to CPUID.

> * When loading a register, always load the reserved bits with the values indicated in the documentation, if any,
> or reload them with values previously read from the same register."

Only applies to KVM, where it can be done with the bitfields too.

> And so on and so on.
> 
> Aaanyway, I see kvm folks are strongly determined to do this so I'll
> propose you do it for kvm only and not touch the rest of arch/x86/.
> 
> I really really disagree with casting CPUID words in stone and with
> touching code which is perfectly fine.

It's not really the KVM folks.  I actually kinda agree with you about
"touching code that works", which is why I hadn't yet commented on the
series.  But Ingo and Peter like it, so I can accept the patch as well.

> But this is just me and the final word lies with x86 people so it'll
> happen whatever they say.

Yep, same with me---KVM will just follow suit.

Paolo

  reply	other threads:[~2014-09-18 13:37 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1410870160-28845-1-git-send-email-namit@cs.technion.ac.il>
2014-09-16 13:22 ` [PATCH 0/3] x86: structs for cpuid info in x86 Ingo Molnar
2014-09-16 20:19   ` Nadav Amit
2014-09-17 12:37     ` Ingo Molnar
2014-09-17 12:45       ` Borislav Petkov
2014-09-17 12:54         ` [RESEND PATCH " Nadav Amit
2014-09-17 12:54           ` [RESEND PATCH 1/3] x86: Adding structs to reflect cpuid fields Nadav Amit
2014-09-17 13:21             ` Borislav Petkov
2014-09-17 13:53               ` Nadav Amit
2014-09-17 14:06                 ` Borislav Petkov
2014-09-17 15:04                   ` Radim Krčmář
2014-09-17 15:22                     ` Borislav Petkov
2014-09-18  0:29                       ` Radim Krčmář
2014-09-18  7:19                         ` Borislav Petkov
2014-09-18 10:00                           ` Radim Krčmář
2014-09-18 13:06                   ` Paolo Bonzini
2014-09-18 13:26                     ` Borislav Petkov
2014-09-18 13:36                       ` Paolo Bonzini [this message]
2014-09-19  7:58                         ` Borislav Petkov
2014-09-19  8:59                           ` Nadav Amit
2014-09-19 10:32                             ` Borislav Petkov
2014-09-19 13:40                           ` Paolo Bonzini
2014-09-19 14:44                             ` Borislav Petkov
2014-09-17 14:10             ` Peter Zijlstra
2014-09-17 12:54           ` [RESEND PATCH 2/3] x86: Use new cpuid structs in cpuid functions Nadav Amit
2014-09-17 12:54           ` [RESEND PATCH 3/3] KVM: x86: Using cpuid structs in KVM Nadav Amit
2014-09-17 14:12       ` [PATCH 0/3] x86: structs for cpuid info in x86 Peter Zijlstra

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=541ADFEB.6030801@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namit@cs.technion.ac.il \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --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).