Re: [RFC PATCH 3/3] x86/cpufeature: Remove unused and seldomly used cpu_has_xx macros
From: Josh Triplett
Date: Fri Nov 27 2015 - 15:14:14 EST
On Fri, Nov 27, 2015 at 07:04:33PM +0100, Borislav Petkov wrote:
> On Fri, Nov 27, 2015 at 02:52:57PM +0100, Borislav Petkov wrote:
> > commit .TEXT .DATA .BSS
> > rc2+ 650055 127948 1189128
> > 0a53df8a1a3a ("x86/cpufeature: Move some of the...") 649863 127948 1189384
> > ed03a85e6575 ("x86/cpufeature: Cleanup get_cpu_cap()") 649831 127948 1189384
> > acde56aeda14 ("x86/cpufeature: Remove unused and...") 649831 127948 1189384
> >
> > I'll look at doing the macro thing now, hopefully it doesn't get too ugly.
>
> Yeah, we do save us some ~1.6K text (cf numbers above) for the price
> of a bit slower feature bit testing. Don't know if it matters at all,
> though:
>
> commit .TEXT .DATA .BSS
> CONFIG_X86_FAST_FEATURE_TESTS 648209 127948 1189384
>
> and diff looks pretty simple:
Given an appropriate long description for that config option, that seems
worthwhile. Something like this:
Some fast-paths in the kernel depend on the capabilities of the CPU.
Say Y here for the kernel to patch in the appropriate code at runtime
based on the capabilities of the CPU. The infrastructure for patching
code at runtime takes up some additional space; space-constrained
embedded systems may wish to say N here to produce smaller, slightly
slower code.
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 4a9b9a9a1a64..ff64585ea0bf 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -350,6 +350,10 @@ config X86_FEATURE_NAMES
>
> If in doubt, say Y.
>
> +config X86_FAST_FEATURE_TESTS
> + bool "Fast feature tests" if EMBEDDED
> + default y
> +
> config X86_X2APIC
> bool "Support x2apic"
> depends on X86_LOCAL_APIC && X86_64 && (IRQ_REMAP || HYPERVISOR_GUEST)
> diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
> index cbe390044a7c..7ad8c9464297 100644
> --- a/arch/x86/include/asm/cpufeature.h
> +++ b/arch/x86/include/asm/cpufeature.h
> @@ -410,7 +410,7 @@ extern const char * const x86_bug_flags[NBUGINTS*32];
> * fast paths and boot_cpu_has() otherwise!
> */
>
> -#if __GNUC__ >= 4
> +#if __GNUC__ >= 4 && defined(CONFIG_X86_FAST_FEATURE_TESTS)
> extern void warn_pre_alternatives(void);
> extern bool __static_cpu_has_safe(u16 bit);
>
> --
> Regards/Gruss,
> Boris.
>
> ECO tip #101: Trim your mails when you reply.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/