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]
Message-ID: <00000141c7de3c3e-51b4dd7b-901e-466e-829a-b1f7c4b9ec90-000000@email.amazonses.com>
Date:	Thu, 17 Oct 2013 19:22:12 +0000
From:	Christoph Lameter <cl@...ux.com>
To:	Peter Zijlstra <peterz@...radead.org>
cc:	Tejun Heo <tj@...nel.org>, akpm@...uxfoundation.org,
	rostedt@...dmis.org, linux-kernel@...r.kernel.org,
	Ingo Molnar <mingo@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 6/6] percpu: Add preemption checks to __this_cpu ops

On Wed, 16 Oct 2013, Peter Zijlstra wrote:

> On Wed, Oct 16, 2013 at 06:25:37PM +0200, Peter Zijlstra wrote:
> > To rename __this_cpu to raw_cpu; it would then need a little manual
> > fixup and generic __this_cpu -> raW_cpu map, which can add the
> > preemption check.
>
> Something like so perhaps... only lightly compile tested
> (x86_64-defconfig).

First portion looks good to me on first glance.

> diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h
> index 8729723..95e3532 100644
> --- a/arch/x86/include/asm/preempt.h
> +++ b/arch/x86/include/asm/preempt.h
> @@ -13,12 +13,12 @@ DECLARE_PER_CPU(int, __preempt_count);
>   */
>  static __always_inline int preempt_count(void)
>  {
> -	return __this_cpu_read_4(__preempt_count) & ~PREEMPT_NEED_RESCHED;
> +	return raw_cpu_read_4(__preempt_count) & ~PREEMPT_NEED_RESCHED;
>  }
>
>  static __always_inline void preempt_count_set(int pc)
>  {
> -	__this_cpu_write_4(__preempt_count, pc);
> +	raw_cpu_write_4(__preempt_count, pc);
>  }

Huh? What happened here? Why do we use the __this_cpu_read_4 here?
This should be just raw_cpu_write()

And more following

> diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
> index d17784e..b5aca54 100644
> --- a/include/asm-generic/percpu.h
> +++ b/include/asm-generic/percpu.h
> @@ -56,17 +56,18 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
>  #define per_cpu(var, cpu) \
>  	(*SHIFT_PERCPU_PTR(&(var), per_cpu_offset(cpu)))
>
> -#ifndef __this_cpu_ptr
> -#define __this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
> +#ifndef raw_cpu_ptr
> +#define raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
>  #endif


Got another patch here that gets rid of __this_cpu_ptr and uses
raw_cpu_ptr everywhere instead. Would be good to make this all symmetric.


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