All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Andy Lutomirski <luto@amacapital.net>,
	Brian Gerst <brgerst@gmail.com>, X86 ML <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/5] x86/cpufeature: Remove static_cpu_has()
Date: Thu, 21 Jan 2016 11:05:26 -0800	[thread overview]
Message-ID: <56A12BF6.6070508@zytor.com> (raw)
In-Reply-To: <1453401286-26966-3-git-send-email-bp@alien8.de>

On 01/21/16 10:34, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
> 
> Well, this one doesn't work properly before alternatives have run. And
> it was supposed to provide an optimized JMP because the assumption was
> that the offset it is jumping to is within a signed byte and thus a
> two-byte JMP.
> 
> So I did an x86_64 allyesconfig build and dumped all possible sites
> where static_cpu_has() was used. The optimization amounted to all in all
> 12(!) places where static_cpu_has() had generated a 2-byte JMP. Which
> has saved us a whopping 36 bytes!
> 
> This clearly is not worth the trouble so we can remove it. The only
> place where the optimization might count - in __switch_to() - we will
> handle differently. But that's not subject of this patch.
> 
> diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
> index 3cce9f3c5cb1..2b0abb241205 100644
> --- a/arch/x86/include/asm/cpufeature.h
> +++ b/arch/x86/include/asm/cpufeature.h
> @@ -125,103 +125,20 @@ extern const char * const x86_bug_flags[NBUGINTS*32];
>  #define cpu_has_osxsave		boot_cpu_has(X86_FEATURE_OSXSAVE)
>  #define cpu_has_hypervisor	boot_cpu_has(X86_FEATURE_HYPERVISOR)
>  /*
> - * Do not add any more of those clumsy macros - use static_cpu_has_safe() for
> + * Do not add any more of those clumsy macros - use static_cpu_has() for
>   * fast paths and boot_cpu_has() otherwise!
>   */
>  
>  #if __GNUC__ >= 4 && defined(CONFIG_X86_FAST_FEATURE_TESTS)

Just replace the __GNUC__ >= 4 with CC_HACE_ASM_GOTO in this test and
get rid of the tests of CC_HAVE_ASM_GOTO in the rest of the code.

>  /*
>   * gcc 3.x is too stupid to do the static test; fall back to dynamic.
>   */

... and modify this comment accordingly.

	-hpa

  parent reply	other threads:[~2016-01-21 19:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-21 18:34 [RFC PATCH 0/5] x86/cpufeature: Cleanups and improvements Borislav Petkov
2016-01-21 18:34 ` [PATCH 1/5] x86/cpufeature: Carve out X86_FEATURE_* Borislav Petkov
2016-01-21 18:57   ` H. Peter Anvin
2016-01-21 19:03     ` Borislav Petkov
2016-01-22 11:19       ` Borislav Petkov
2016-02-03 14:36         ` David Howells
2016-01-21 18:34 ` [PATCH 2/5] x86/cpufeature: Remove static_cpu_has() Borislav Petkov
2016-01-21 19:04   ` Andy Lutomirski
2016-01-21 19:39     ` Borislav Petkov
2016-01-21 19:41       ` H. Peter Anvin
2016-01-21 19:51         ` Borislav Petkov
2016-01-21 19:05   ` H. Peter Anvin [this message]
2016-01-21 18:34 ` [PATCH 3/5] x86/cpufeature: Get rid of the non-asm goto variant Borislav Petkov
2016-01-21 18:59   ` H. Peter Anvin
2016-01-21 18:34 ` [PATCH 4/5] x86/alternatives: Add an auxilary section Borislav Petkov
2016-01-21 19:00   ` H. Peter Anvin
2016-01-21 19:07     ` Borislav Petkov
2016-01-21 19:10       ` H. Peter Anvin
2016-01-21 18:34 ` [PATCH 5/5] x86/alternatives: Discard dynamic check after init Borislav Petkov
2016-01-21 19:03   ` H. Peter Anvin
2016-01-21 21:53 ` [RFC PATCH 0/5] x86/cpufeature: Cleanups and improvements Brian Gerst
2016-01-21 22:20   ` Borislav Petkov

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=56A12BF6.6070508@zytor.com \
    --to=hpa@zytor.com \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --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.