Re: [PATCH 10/19] Add Kconfig option ARCH_HAVE_NMI_SAFE_CMPXCHG

From: David Howells
Date: Wed Aug 03 2011 - 04:47:15 EST


Len Brown <lenb@xxxxxxxxxx> wrote:

> From: Huang Ying <ying.huang@xxxxxxxxx>
>
> cmpxchg() is widely used by lockless code, including NMI-safe lockless
> code. But on some architectures, the cmpxchg() implementation is not
> NMI-safe, on these architectures the lockless code may need a
> spin_trylock_irqsave() based implementation.
>
> This patch adds a Kconfig option: ARCH_HAVE_NMI_SAFE_CMPXCHG, so that
> NMI-safe lockless code can depend on it or provide different
> implementation according to it.
>
> On many architectures, cmpxchg is only NMI-safe for several specific
> operand sizes. So, ARCH_HAVE_NMI_SAFE_CMPXCHG define in this patch
> only guarantees cmpxchg is NMI-safe for sizeof(unsigned long).
>
> Signed-off-by: Huang Ying <ying.huang@xxxxxxxxx>
> Acked-by: Mike Frysinger <vapier@xxxxxxxxxx>
> Acked-by: Paul Mundt <lethal@xxxxxxxxxxxx>
> Acked-by: Hans-Christian Egtvedt <hans-christian.egtvedt@xxxxxxxxx>
> Acked-by: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
> Acked-by: Chris Metcalf <cmetcalf@xxxxxxxxxx>
> CC: Richard Henderson <rth@xxxxxxxxxxx>
> CC: Mikael Starvik <starvik@xxxxxxxx>
> CC: David Howells <dhowells@xxxxxxxxxx>
> CC: Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>
> CC: Tony Luck <tony.luck@xxxxxxxxx>
> CC: Hirokazu Takata <takata@xxxxxxxxxxxxxx>
> CC: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> CC: Michal Simek <monstr@xxxxxxxxx>
> CC: Ralf Baechle <ralf@xxxxxxxxxxxxxx>
> CC: Kyle McMartin <kyle@xxxxxxxxxxx>
> CC: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
> CC: Chen Liqin <liqin.chen@xxxxxxxxxxxxx>
> CC: "David S. Miller" <davem@xxxxxxxxxxxxx>
> CC: Ingo Molnar <mingo@xxxxxxxxxx>
> CC: Chris Zankel <chris@xxxxxxxxxx>
> Signed-off-by: Len Brown <len.brown@xxxxxxxxx>

Acked-by: David Howells <dhowells@xxxxxxxxxx> [FRV]
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/