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:	Wed, 08 Feb 2012 10:30:51 +0100
From:	"Michal Nazarewicz" <mina86@...a86.com>
To:	linux-kernel@...r.kernel.org,
	"Gilad Ben-Yossef" <gilad@...yossef.com>
Cc:	"Chris Metcalf" <cmetcalf@...era.com>,
	"Christoph Lameter" <cl@...ux-foundation.org>,
	"Frederic Weisbecker" <fweisbec@...il.com>,
	"Russell King" <linux@....linux.org.uk>, linux-mm@...ck.org,
	"Pekka Enberg" <penberg@...nel.org>,
	"Matt Mackall" <mpm@...enic.com>,
	"Sasha Levin" <levinsasha928@...il.com>,
	"Rik van Riel" <riel@...hat.com>,
	"Andi Kleen" <andi@...stfloor.org>,
	"Alexander Viro" <viro@...iv.linux.org.uk>,
	linux-fsdevel@...r.kernel.org, "Avi Kivity" <avi@...hat.com>,
	"Kosaki Motohiro" <kosaki.motohiro@...il.com>,
	"Andrew Morton" <akpm@...ux-foundation.org>,
	"Milton Miller" <miltonm@....com>
Subject: Re: [PATCH v8 4/8] smp: add func to IPI cpus based on parameter func

On Sun, 05 Feb 2012 14:48:38 +0100, Gilad Ben-Yossef <gilad@...yossef.com> wrote:

> Add the on_each_cpu_cond() function that wraps on_each_cpu_mask()
> and calculates the cpumask of cpus to IPI by calling a function supplied
> as a parameter in order to determine whether to IPI each specific cpu.
>
> The function works around allocation failure of cpumask variable in
> CONFIG_CPUMASK_OFFSTACK=y by itereating over cpus sending an IPI a
> time via smp_call_function_single().
>
> The function is useful since it allows to seperate the specific
> code that decided in each case whether to IPI a specific cpu for
> a specific request from the common boilerplate code of handling
> creating the mask, handling failures etc.
>
> Signed-off-by: Gilad Ben-Yossef <gilad@...yossef.com>
> Acked-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> CC: Chris Metcalf <cmetcalf@...era.com>
> CC: Christoph Lameter <cl@...ux-foundation.org>
> CC: Frederic Weisbecker <fweisbec@...il.com>
> CC: Russell King <linux@....linux.org.uk>
> CC: linux-mm@...ck.org
> CC: Pekka Enberg <penberg@...nel.org>
> CC: Matt Mackall <mpm@...enic.com>
> CC: Sasha Levin <levinsasha928@...il.com>
> CC: Rik van Riel <riel@...hat.com>
> CC: Andi Kleen <andi@...stfloor.org>
> CC: Alexander Viro <viro@...iv.linux.org.uk>
> CC: linux-fsdevel@...r.kernel.org
> CC: Avi Kivity <avi@...hat.com>
> CC: Michal Nazarewicz <mina86@...a86.com>
> CC: Kosaki Motohiro <kosaki.motohiro@...il.com>
> CC: Andrew Morton <akpm@...ux-foundation.org>
> CC: Milton Miller <miltonm@....com>
> ---
>  include/linux/smp.h |   24 ++++++++++++++++++++
>  kernel/smp.c        |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 84 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/smp.h b/include/linux/smp.h
> index d0adb78..da4d034 100644
> --- a/include/linux/smp.h
> +++ b/include/linux/smp.h
> @@ -153,6 +162,21 @@ static inline int up_smp_call_function(smp_call_func_t func, void *info)
>  			local_irq_enable();		\
>  		}					\
>  	} while (0)
> +/*
> + * Preemption is disabled here to make sure the
> + * cond_func is called under the same condtions in UP
> + * and SMP.
> + */
> +#define on_each_cpu_cond(cond_func, func, info, wait, gfp_flags) \
> +	do {						\

How about:

		void *__info = (info);

as to avoid double execution.

> +		preempt_disable();			\
> +		if (cond_func(0, info)) {		\
> +			local_irq_disable();		\
> +			(func)(info);			\
> +			local_irq_enable();		\
> +		}					\
> +		preempt_enable();			\
> +	} while (0)
> static inline void smp_send_reschedule(int cpu) { }
>  #define num_booting_cpus()			1

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +----<email/xmpp: mpn@...gle.com>--------------ooO--(_)--Ooo--
--
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