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:	Fri, 21 Jan 2011 12:20:12 -0600 (CST)
From:	Christoph Lameter <cl@...ux.com>
To:	Tejun Heo <tj@...nel.org>
cc:	"H. Peter Anvin" <hpa@...or.com>,
	Pekka Enbeerg <penberg@...helsinki.fi>,
	linux-kernel@...r.kernel.org,
	Eric Dumazet <eric.dumazet@...il.com>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	akpm@...ux-foundation.org
Subject: Re: x86: A fast way to check capabilities of the current cpu



On Fri, 21 Jan 2011, Tejun Heo wrote:

> On Fri, Jan 21, 2011 at 11:57:09AM -0600, Christoph Lameter wrote:
> > > Hmm?  asm/percpu.h gets included by linux/percpu.h, so it would end up
> > > in most .c files.
> >
> > The function is defined in arch/x86/include/asm/percpu.h. At least my
> > patches here are that way.
> >
> > #include "asm/percpu.h" will get you include/asm-generic/percpu.h on
> > other arches.
>
> Yeah, I was referring to generic code having visibility to the x86
> specific this_cpu op which isn't available on other archs.  I don't
> feel too strong about it so if you don't like it, just add a comment.

The code segments in generic code that use this function are in #ifdef
CONFIG_X86 sections.

Where do you want me to add a comment?

In include/x86/include/asm/percpu.h saying that the operations defined
there are x86 specific? Or in the #ifdef CONFIG_X86 sections saying that
the this_cpu_has operations are x86 specific?



Code snippet from drivers/acpi/processor_throttling.c

...

#ifdef CONFIG_X86
static int acpi_throttling_rdmsr(u64 *value)
{
        u64 msr_high, msr_low;
        u64 msr = 0;
        int ret = -1;

        if ((this_cpu_read(cpu_info.x86_vendor) != X86_VENDOR_INTEL) ||
                !this_cpu_has(X86_FEATURE_ACPI)) {
                printk(KERN_ERR PREFIX
                        "HARDWARE addr space,NOT supported yet\n");
        } else {
                msr_low = 0;
                msr_high = 0;
                rdmsr_safe(MSR_IA32_THERM_CONTROL,
                        (u32 *)&msr_low , (u32 *) &msr_high);
                msr = (msr_high << 32) | msr_low;
                *value = (u64) msr;
                ret = 0;
        }
        return ret;
}


--
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