linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@suse.de>
To: Dave Hansen <dave.hansen@intel.com>
Cc: "Chang S. Bae" <chang.seok.bae@intel.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, luto@kernel.org, mingo@kernel.org,
	tglx@linutronix.de, len.brown@intel.com,
	ravi.v.shankar@intel.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/fpu: Use consistent test for X86_FEATURE_XSAVES
Date: Wed, 3 Feb 2021 16:54:08 +0100	[thread overview]
Message-ID: <20210203155408.GC11823@zn.tnic> (raw)
In-Reply-To: <87e436d0-d2ca-8c28-442b-1b45111b6081@intel.com>

On Wed, Feb 03, 2021 at 07:40:07AM -0800, Dave Hansen wrote:
> On 2/3/21 3:23 AM, Borislav Petkov wrote:
> >> -/*
> >> - * 'XSAVES' implies two different things:
> >> - * 1. saving of supervisor/system state
> >> - * 2. using the compacted format
> >> - *
> >> - * Use this function when dealing with the compacted format so
> >> - * that it is obvious which aspect of 'XSAVES' is being handled
> >> - * by the calling code.
> > @dhansen, are you still hung up on that "obvious aspect" or can we kill
> > this?
> 
> I still want the compacted-format handling code to be marked.  You can
> do that with new comments:
> 
> 	/* Note: XSAVES always uses compacted format: */
> 	if (boot_cpu_has(X86_FEATURE_XSAVES)) {
> 
> or, leave it as-is:
> 
> 	if (using_compacted_format()) {
> 	...
> 
> Otherwise, we assume that every human being that looks at this code
> *KNOWS* that XSAVES==compacted.  That's not a great assumption.

Well, the reason why I reacted to this is because I was looking at
using_compacted_format() - aha this, checks X86_FEATURE_XSAVES - but
then other code paths in fpu/ check X86_FEATURE_XSAVES directly. And
this is confusing, making me wonder why is that special oneliner there.
Sure, the comment above it says why...

I guess if you wanna keep it, then we need another oneliner for 1. or
really do comments at each call site.

Hmm.

-- 
Regards/Gruss,
    Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg

      reply	other threads:[~2021-02-03 16:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03  2:40 [PATCH] x86/fpu: Use consistent test for X86_FEATURE_XSAVES Chang S. Bae
2021-02-03 11:23 ` Borislav Petkov
2021-02-03 15:40   ` Dave Hansen
2021-02-03 15:54     ` Borislav Petkov [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=20210203155408.GC11823@zn.tnic \
    --to=bp@suse.de \
    --cc=chang.seok.bae@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=ravi.v.shankar@intel.com \
    --cc=tglx@linutronix.de \
    --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).