Re: [tip:core/locking] locking: Check spinlock_t/rwlock_t argumenttype on non-SMP builds too

From: Ingo Molnar
Date: Mon Aug 03 2009 - 07:39:52 EST



* tip-bot for David Kilroy <kilroyd@xxxxxxxxxxxxxx> wrote:

> Commit-ID: 8d19bd347e1073e7f1ef9f8057c560a5f6be63d7
> Gitweb: http://git.kernel.org/tip/8d19bd347e1073e7f1ef9f8057c560a5f6be63d7
> Author: David Kilroy <kilroyd@xxxxxxxxxxxxxx>
> AuthorDate: Sun, 2 Aug 2009 19:41:05 +0100
> Committer: Ingo Molnar <mingo@xxxxxxx>
> CommitDate: Sun, 2 Aug 2009 21:29:07 +0200
>
> locking: Check spinlock_t/rwlock_t argument type on non-SMP builds too
>
> When writing code for UP without CONFIG_DEBUG_SPINLOCK it's
> easy to get the first argument to the spinlock/rwlock functions
> wrong. This is because the parameter is not actually used in
> this configuration.
>
> Typically you will only find out it's wrong:
>
> * by rebuilding with CONFIG_SMP or CONFIG_DEBUG_SPINLOCK
> * after you've submitted your beautiful patch series
>
> The first means a long wait, and the latter is a bit late.
>
> Change the intermediate macros into inline functions.
>
> -v2: Use C inlines instead of in-macro type-checks
> -v3: Correct bug in _spin_trylock_bh

x86 works fine now - but this patch broke architecture builds, such
as the build on Alpha:

In file included from
/home/mingo/tip/arch/alpha/kernel/sys_sable.c:25:
/home/mingo/tip/arch/alpha/include/asm/core_t2.h: In function
't2_readb':
/home/mingo/tip/arch/alpha/include/asm/core_t2.h:451: error:
'_spin_lock_irqsave' is static but used in inline function
't2_readb' which is not static
/home/mingo/tip/arch/alpha/include/asm/core_t2.h:456: error:
'_spin_unlock_irqrestore' is static but used in inline function
't2_readb' which is not static
/home/mingo/tip/arch/alpha/include/asm/core_t2.h: In function
't2_readw':
/home/mingo/tip/arch/alpha/include/asm/core_t2.h:465: error:
'_spin_lock_irqsave' is static but used in inline function
't2_readw' which is not static
/home/mingo/tip/arch/alpha/include/asm/core_t2.h:470: error:
'_spin_unlock_irqrestore' is static but used in inline function
't2_readw' which is not static
/home/mingo/tip/arch/alpha/include/asm/core_t2.h: In function
't2_readl':
/home/mingo/tip/arch/alpha/include/asm/core_t2.h:483: error:
'_spin_lock_irqsave' is static but used in inline function
't2_readl' which is not static
/home/mingo/tip/arch/alpha/include/asm/core_t2.h:488: error:
'_spin_unlock_irqrestore' is static but used in inline function
't2_readl' which is not static
/home/mingo/tip/arch/alpha/include/asm/core_t2.h: In function
't2_readq':
/home/mingo/tip/arch/alpha/include/asm/core_t2.h:497: error:
'_spin_lock_irqsave' is static but used in inline function
't2_readq' which is not static
/home/mingo/tip/arch/alpha/include/asm/core_t2.h:504: error:
'_spin_unlock_irqrestore' is static but used in inline function
't2_readq' which is not static
/home/mingo/tip/arch/alpha/include/asm/core_t2.h: In function
't2_writeb':
/home/mingo/tip/arch/alpha/include/asm/core_t2.h:513: error:
'_spin_lock_irqsave' is static but used in inline function
't2_writeb' which is not static
/home/mingo/tip/arch/alpha/include/asm/core_t2.h:519: error:
'_spin_unlock_irqrestore' is static but used in inline function
't2_writeb' which is not static
/home/mingo/tip/arch/alpha/include/asm/core_t2.h: In function
't2_writew':
/home/mingo/tip/arch/alpha/include/asm/core_t2.h:527: error:
'_spin_lock_irqsave' is static but used in inline function
't2_writew' which is not static
/home/mingo/tip/arch/alpha/include/asm/core_t2.h:533: error:
'_spin_unlock_irqrestore' is static but used in inline function
't2_writew' which is not static
/home/mingo/tip/arch/alpha/include/asm/core_t2.h: In function
't2_writel':
/home/mingo/tip/arch/alpha/include/asm/core_t2.h:545: error:
'_spin_lock_irqsave' is static but used in inline function
't2_writel' which is not static

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