lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 14 Mar 2009 14:20:04 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Sam Ravnborg <sam@...nborg.org>
Cc:	Jaswinder Singh Rajput <jaswinder@...nel.org>,
	x86 maintainers <x86@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -tip] x86: cpu/intel.c cleanup


* Sam Ravnborg <sam@...nborg.org> wrote:

> >  
> >  #include <asm/processor.h>
> > +#include <asm/topology.h>
> >  #include <asm/pgtable.h>
> > -#include <asm/msr.h>
> > -#include <asm/uaccess.h>
> > -#include <asm/ds.h>
> > +#ifdef CONFIG_X86_LOCAL_APIC
> > +#include <asm/mpspec.h>
> > +#include <asm/apic.h>
> > +#endif
> 
> If these header files are only relevant for 
> CONFIG_X86_LOCAL_APIC then we should move the ifdef down into 
> the header file, so users do not forget it.

apic.h can be included unconditionally - and the mpspec.h 
inclusion can be removed because it's included by apic.h.

> > +			pr_info("CPU: C0 stepping P4 Xeon detected.\n");
> > +			pr_info("CPU: Disabling hardware prefetching (Errata 037)\n");
> >  			lo |= MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE;
> > -			wrmsr (MSR_IA32_MISC_ENABLE, lo, hi);
> > +			wrmsr(MSR_IA32_MISC_ENABLE, lo, hi);
> >  		}
> >  	}
> >  
> > @@ -217,7 +241,7 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
> >  	 * integrated APIC (see 11AP erratum in "Pentium Processor
> >  	 * Specification Update").
> >  	 */
> > -	if (cpu_has_apic && (c->x86<<8 | c->x86_model<<4) == 0x520 &&
> > +	if (cpu_has_apic && (c->x86 << 8 | c->x86_model << 4) == 0x520 &&
> >  	    (c->x86_mask < 0x6 || c->x86_mask == 0xb))
> >  		set_cpu_cap(c, X86_FEATURE_11AP);
> >  
> > @@ -245,28 +269,26 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
> >  #endif
> >  
> >  	intel_smp_check(c);
> > -}
> > -#else
> > -static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
> > -{
> > -}
> >  #endif
> > +}
> 
> To me it is more obvious with the old style.
> Having ifdef's inside the block is less obvious.
> 
> But I have not checked what is the common pattern.

agreed, this one was probably cleaner with the #ifdef block 
outside.

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ