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:	Tue, 11 Oct 2011 09:13:14 -0500 (CDT)
From:	Christoph Lameter <cl@...two.org>
To:	"Alex,Shi" <alex.shi@...el.com>
cc:	"tj@...nel.org" <tj@...nel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"eric.dumazet@...il.com" <eric.dumazet@...il.com>,
	"Huang, Ying" <ying.huang@...el.com>
Subject: Re: [PATCH] Code clean up for percpu_xxx() functions

On Tue, 11 Oct 2011, Alex,Shi wrote:

> percpu_read() used in asm/percpu.h yet. Anyway, I removed definitions
> here and do a work around for the function as following:
>
> @@ -551,7 +544,11 @@ static __always_inline int x86_this_cpu_constant_test_bit(unsigned int nr,
>  {
>         unsigned long __percpu *a = (unsigned long *)addr + nr / BITS_PER_LONG;
>
> -       return ((1UL << (nr % BITS_PER_LONG)) & percpu_read(*a)) != 0;
> +#ifdef CONFIG_X86_64
> +       return ((1UL << (nr % BITS_PER_LONG)) & this_cpu_read_8(*a)) != 0;
> +#else
> +       return ((1UL << (nr % BITS_PER_LONG)) & this_cpu_read_4(*a)) != 0;
> +#endif

OK that looks okay.

> Signed-off-by: Alex Shi <alex.shi@...el.com>

Is this a revised patch? I do not see a use of the __this_cpu_xx ops.

> -#define percpu_write(var, val)		percpu_to_op("mov", var, val)
> -#define percpu_add(var, val)		percpu_add_op(var, val)
> -#define percpu_sub(var, val)		percpu_add_op(var, -(val))
> -#define percpu_and(var, val)		percpu_to_op("and", var, val)
> -#define percpu_or(var, val)		percpu_to_op("or", var, val)
> -#define percpu_xor(var, val)		percpu_to_op("xor", var, val)
> -#define percpu_inc(var)		percpu_unary_op("inc", var)
> +#define this_cpu_read_stable(var)	percpu_from_op("mov", var, "p" (&(var)))
> +#define this_cpu_inc(var)		percpu_unary_op("inc", var)

Why redefine this_cpu_inc? include/linux/percpu.h already defines it.

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