On Wed, 2007-01-03 at 13:12 -0800, [email protected] wrote:
> -# define __raw_spin_lock_irq(lock) __raw_spin_lock(lock)
> +
> +static inline void __raw_spin_lock_irq(raw_spinlock_t *lock)
> +{
> + asm volatile("\n1:\t"
> + LOCK_PREFIX " ; decb %0\n\t"
> + "jns 3f\n"
> + STI_STRING "\n"
> + "2:\t"
> + "rep;nop\n\t"
> + "cmpb $0,%0\n\t"
> + "jle 2b\n\t"
> + CLI_STRING "\n"
> + "jmp 1b\n"
> + "3:\n\t"
> + : "+m" (lock->slock) : : "memory");
> +}
> #endif
>
This doesn't compile when CONFIG_PARAVIRT is enabled. It changes the
CLI_STRING and STI_STRING values.
Daniel
On Sat, 06 Jan 2007 14:35:53 -0800
Daniel Walker <[email protected]> wrote:
> On Wed, 2007-01-03 at 13:12 -0800, [email protected] wrote:
> > -# define __raw_spin_lock_irq(lock) __raw_spin_lock(lock)
> > +
> > +static inline void __raw_spin_lock_irq(raw_spinlock_t *lock)
> > +{
> > + asm volatile("\n1:\t"
> > + LOCK_PREFIX " ; decb %0\n\t"
> > + "jns 3f\n"
> > + STI_STRING "\n"
> > + "2:\t"
> > + "rep;nop\n\t"
> > + "cmpb $0,%0\n\t"
> > + "jle 2b\n\t"
> > + CLI_STRING "\n"
> > + "jmp 1b\n"
> > + "3:\n\t"
> > + : "+m" (lock->slock) : : "memory");
> > +}
> > #endif
> >
>
> This doesn't compile when CONFIG_PARAVIRT is enabled. It changes the
> CLI_STRING and STI_STRING values.
>
diff -puN include/asm-i386/spinlock.h~spin_lock_irq-enable-interrupts-while-spinning-i386-implementation-fix include/asm-i386/spinlock.h
--- a/include/asm-i386/spinlock.h~spin_lock_irq-enable-interrupts-while-spinning-i386-implementation-fix
+++ a/include/asm-i386/spinlock.h
@@ -86,17 +86,19 @@ static inline void __raw_spin_lock_flags
static inline void __raw_spin_lock_irq(raw_spinlock_t *lock)
{
asm volatile("\n1:\t"
- LOCK_PREFIX " ; decb %0\n\t"
+ LOCK_PREFIX " ; decb %[slock]\n\t"
"jns 3f\n"
STI_STRING "\n"
"2:\t"
"rep;nop\n\t"
- "cmpb $0,%0\n\t"
+ "cmpb $0,%[slock]\n\t"
"jle 2b\n\t"
CLI_STRING "\n"
"jmp 1b\n"
"3:\n\t"
- : "+m" (lock->slock) : : "memory");
+ : [slock] "+m" (lock->slock)
+ : __CLI_STI_INPUT_ARGS
+ : "memory" CLI_STI_CLOBBERS);
}
#endif
diff -puN include/asm-i386/paravirt.h~spin_lock_irq-enable-interrupts-while-spinning-i386-implementation-fix include/asm-i386/paravirt.h
--- a/include/asm-i386/paravirt.h~spin_lock_irq-enable-interrupts-while-spinning-i386-implementation-fix
+++ a/include/asm-i386/paravirt.h
@@ -509,10 +509,10 @@ static inline unsigned long __raw_local_
"popl %%edx; popl %%ecx", \
PARAVIRT_IRQ_ENABLE, CLBR_EAX)
#define CLI_STI_CLOBBERS , "%eax"
-#define CLI_STI_INPUT_ARGS \
- , \
+#define __CLI_STI_INPUT_ARGS \
[irq_disable] "i" (offsetof(struct paravirt_ops, irq_disable)), \
[irq_enable] "i" (offsetof(struct paravirt_ops, irq_enable))
+#define CLI_STI_INPUT_ARGS , __CLI_STI_INPUT_ARGS
#else /* __ASSEMBLY__ */
_
On Sat, 2007-01-06 at 23:26 -0800, Andrew Morton wrote:
> diff -puN include/asm-i386/spinlock.h~spin_lock_irq-enable-interrupts-while-spinning-i386-implementation-fix include/asm-i386/spinlock.h
> --- a/include/asm-i386/spinlock.h~spin_lock_irq-enable-interrupts-while-spinning-i386-implementation-fix
> +++ a/include/asm-i386/spinlock.h
> @@ -86,17 +86,19 @@ static inline void __raw_spin_lock_flags
> static inline void __raw_spin_lock_irq(raw_spinlock_t *lock)
> {
> asm volatile("\n1:\t"
> - LOCK_PREFIX " ; decb %0\n\t"
> + LOCK_PREFIX " ; decb %[slock]\n\t"
> "jns 3f\n"
> STI_STRING "\n"
> "2:\t"
> "rep;nop\n\t"
> - "cmpb $0,%0\n\t"
> + "cmpb $0,%[slock]\n\t"
> "jle 2b\n\t"
> CLI_STRING "\n"
> "jmp 1b\n"
> "3:\n\t"
> - : "+m" (lock->slock) : : "memory");
> + : [slock] "+m" (lock->slock)
> + : __CLI_STI_INPUT_ARGS
> + : "memory" CLI_STI_CLOBBERS);
> }
> #endif
Now it fails with CONFIG_PARAVIRT off .
scripts/kconfig/conf -s arch/i386/Kconfig
CHK include/linux/version.h
CHK include/linux/compile.h
CHK include/linux/utsrelease.h
UPD include/linux/compile.h
CC arch/i386/kernel/asm-offsets.s
In file included from include/linux/spinlock.h:88,
from include/linux/module.h:10,
from include/linux/crypto.h:22,
from arch/i386/kernel/asm-offsets.c:8:
include/asm/spinlock.h: In function '__raw_spin_lock_irq':
include/asm/spinlock.h:100: error: expected string literal before '__CLI_STI_INPUT_ARGS'
distcc[2386] ERROR: compile arch/i386/kernel/asm-offsets.c on dwalker2/140 failed
make[1]: *** [arch/i386/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2
And I get this same error when compiling
arch/i386/boot/compressed/misc.c when CONFIG_PARAVIRT is on. misc.c has
an undef CONFIG_PARAVIRT at the top so I think they are the same issue.
Daniel
diff -r 94a7e766e5ea include/asm-i386/spinlock.h
--- a/include/asm-i386/spinlock.h Sun Jan 07 06:17:42 2007 -0800
+++ b/include/asm-i386/spinlock.h Sun Jan 07 06:28:51 2007 -0800
@@ -86,7 +86,7 @@ static inline void __raw_spin_lock_irq(r
static inline void __raw_spin_lock_irq(raw_spinlock_t *lock)
{
asm volatile("\n1:\t"
- LOCK_PREFIX " ; decb %0\n\t"
+ LOCK_PREFIX " ; decb %[slock]\n\t"
"jns 3f\n"
STI_STRING "\n"
"2:\t"
@@ -96,7 +96,10 @@ static inline void __raw_spin_lock_irq(r
CLI_STRING "\n"
"jmp 1b\n"
"3:\n\t"
- : "+m" (lock->slock) : : "memory");
+ : [slock] "+m" (lock->slock)
+ : [dummy] "i" (0xdeadbeaf)
+ CLI_STI_INPUT_ARGS
+ : "memory" CLI_STI_CLOBBERS);
}
#endif
Zachary Amsden wrote:
>
>>
>> Now it fails with CONFIG_PARAVIRT off .
>>
>
> Now it compiles both ways. Or at least asm-offsets.c does. Testing
> full build...
>
> Zach
Yep, that lipstick makes the cat shine.
Zach
On Sun, 07 Jan 2007 05:24:45 -0800
Daniel Walker <[email protected]> wrote:
> Now it fails with CONFIG_PARAVIRT off .
>
> scripts/kconfig/conf -s arch/i386/Kconfig
> CHK include/linux/version.h
> CHK include/linux/compile.h
> CHK include/linux/utsrelease.h
> UPD include/linux/compile.h
> CC arch/i386/kernel/asm-offsets.s
> In file included from include/linux/spinlock.h:88,
> from include/linux/module.h:10,
> from include/linux/crypto.h:22,
> from arch/i386/kernel/asm-offsets.c:8:
> include/asm/spinlock.h: In function '__raw_spin_lock_irq':
> include/asm/spinlock.h:100: error: expected string literal before '__CLI_STI_INPUT_ARGS'
bah.
--- a/include/asm-i386/spinlock.h~spin_lock_irq-enable-interrupts-while-spinning-i386-implementation-fix-fix
+++ a/include/asm-i386/spinlock.h
@@ -14,6 +14,7 @@
#define STI_STRING "sti"
#define CLI_STI_CLOBBERS
#define CLI_STI_INPUT_ARGS
+#define __CLI_STI_INPUT_ARGS
#endif /* CONFIG_PARAVIRT */
/*
_
On Sun, Jan 07, 2007 at 12:05:03PM -0800, Andrew Morton wrote:
> On Sun, 07 Jan 2007 05:24:45 -0800
> Daniel Walker <[email protected]> wrote:
>
> > Now it fails with CONFIG_PARAVIRT off .
> >
> > scripts/kconfig/conf -s arch/i386/Kconfig
> > CHK include/linux/version.h
> > CHK include/linux/compile.h
> > CHK include/linux/utsrelease.h
> > UPD include/linux/compile.h
> > CC arch/i386/kernel/asm-offsets.s
> > In file included from include/linux/spinlock.h:88,
> > from include/linux/module.h:10,
> > from include/linux/crypto.h:22,
> > from arch/i386/kernel/asm-offsets.c:8:
> > include/asm/spinlock.h: In function '__raw_spin_lock_irq':
> > include/asm/spinlock.h:100: error: expected string literal before '__CLI_STI_INPUT_ARGS'
>
> bah.
>
> --- a/include/asm-i386/spinlock.h~spin_lock_irq-enable-interrupts-while-spinning-i386-implementation-fix-fix
> +++ a/include/asm-i386/spinlock.h
> @@ -14,6 +14,7 @@
> #define STI_STRING "sti"
> #define CLI_STI_CLOBBERS
> #define CLI_STI_INPUT_ARGS
> +#define __CLI_STI_INPUT_ARGS
> #endif /* CONFIG_PARAVIRT */
Apologies for the broken patch and thanks for the fix,
But, the above is needed to fix the build even with CONFIG_PARAVIRT!!!
Apparently because arch/i386/mm/boot_ioremap.c undefs CONFIG_PARAVIRT.
Question is, now we have 2 versions of spin_locks_irq implementation
with CONFIG_PARAVIRT -- one with regular cli sti and other with virtualized
CLI/STI -- sounds odd!
Thanks,
Kiran
On Sun, Jan 07, 2007 at 01:06:58PM -0800, Ravikiran G Thirumalai wrote:
>
>
> Question is, now we have 2 versions of spin_locks_irq implementation
> with CONFIG_PARAVIRT -- one with regular cli sti and other with virtualized
> CLI/STI -- sounds odd!
Sunday morning hangovers !! spin_lock_irq is not inlined so there is just one
version even with CONFIG_PARAVIRT.
Thanks,
Kiran