linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: + spin_lock_irq-enable-interrupts-while-spinning-i386-implementation.patch added to -mm tree
       [not found] <200701032112.l03LCnVb031386@shell0.pdx.osdl.net>
@ 2007-01-06 22:35 ` Daniel Walker
  2007-01-07  7:26   ` Andrew Morton
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Walker @ 2007-01-06 22:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: mm-commits, kiran, ak, md, mingo, pravin.shelar, shai

On Wed, 2007-01-03 at 13:12 -0800, akpm@osdl.org 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: + spin_lock_irq-enable-interrupts-while-spinning-i386-implementation.patch added to -mm tree
  2007-01-06 22:35 ` + spin_lock_irq-enable-interrupts-while-spinning-i386-implementation.patch added to -mm tree Daniel Walker
@ 2007-01-07  7:26   ` Andrew Morton
  2007-01-07 13:24     ` Daniel Walker
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2007-01-07  7:26 UTC (permalink / raw)
  To: Daniel Walker
  Cc: linux-kernel, mm-commits, kiran, ak, md, mingo, pravin.shelar, shai

On Sat, 06 Jan 2007 14:35:53 -0800
Daniel Walker <dwalker@mvista.com> wrote:

> On Wed, 2007-01-03 at 13:12 -0800, akpm@osdl.org 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__ */
 
_


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: + spin_lock_irq-enable-interrupts-while-spinning-i386-implementation.patch added to -mm tree
  2007-01-07  7:26   ` Andrew Morton
@ 2007-01-07 13:24     ` Daniel Walker
  2007-01-07 14:39       ` Zachary Amsden
  2007-01-07 20:05       ` Andrew Morton
  0 siblings, 2 replies; 8+ messages in thread
From: Daniel Walker @ 2007-01-07 13:24 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, mm-commits, kiran, ak, md, mingo, pravin.shelar, shai

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: + spin_lock_irq-enable-interrupts-while-spinning-i386-implementation.patch added to -mm tree
  2007-01-07 13:24     ` Daniel Walker
@ 2007-01-07 14:39       ` Zachary Amsden
  2007-01-07 15:17         ` Zachary Amsden
  2007-01-07 20:05       ` Andrew Morton
  1 sibling, 1 reply; 8+ messages in thread
From: Zachary Amsden @ 2007-01-07 14:39 UTC (permalink / raw)
  To: Daniel Walker
  Cc: linux-kernel, mm-commits, kiran, ak, md, mingo, pravin.shelar, shai

[-- Attachment #1: Type: text/plain, Size: 1193 bytes --]

Daniel Walker wrote:
> 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 .
>   

Now it compiles both ways.  Or at least asm-offsets.c does.  Testing 
full build...

Zach

[-- Attachment #2: paravirt-assembler-fix --]
[-- Type: text/plain, Size: 781 bytes --]

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
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: + spin_lock_irq-enable-interrupts-while-spinning-i386-implementation.patch added to -mm tree
  2007-01-07 14:39       ` Zachary Amsden
@ 2007-01-07 15:17         ` Zachary Amsden
  0 siblings, 0 replies; 8+ messages in thread
From: Zachary Amsden @ 2007-01-07 15:17 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Daniel Walker, linux-kernel, mm-commits, kiran, ak, md, mingo,
	pravin.shelar, shai

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: + spin_lock_irq-enable-interrupts-while-spinning-i386-implementation.patch added to -mm tree
  2007-01-07 13:24     ` Daniel Walker
  2007-01-07 14:39       ` Zachary Amsden
@ 2007-01-07 20:05       ` Andrew Morton
  2007-01-07 21:06         ` Ravikiran G Thirumalai
  1 sibling, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2007-01-07 20:05 UTC (permalink / raw)
  To: Daniel Walker; +Cc: linux-kernel, kiran, ak, md, mingo, pravin.shelar, shai

On Sun, 07 Jan 2007 05:24:45 -0800
Daniel Walker <dwalker@mvista.com> 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 */
 
 /*
_


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: + spin_lock_irq-enable-interrupts-while-spinning-i386-implementation.patch added to -mm tree
  2007-01-07 20:05       ` Andrew Morton
@ 2007-01-07 21:06         ` Ravikiran G Thirumalai
  2007-01-07 21:27           ` Ravikiran G Thirumalai
  0 siblings, 1 reply; 8+ messages in thread
From: Ravikiran G Thirumalai @ 2007-01-07 21:06 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Daniel Walker, linux-kernel, ak, md, mingo, pravin.shelar, shai

On Sun, Jan 07, 2007 at 12:05:03PM -0800, Andrew Morton wrote:
> On Sun, 07 Jan 2007 05:24:45 -0800
> Daniel Walker <dwalker@mvista.com> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: + spin_lock_irq-enable-interrupts-while-spinning-i386-implementation.patch added to -mm tree
  2007-01-07 21:06         ` Ravikiran G Thirumalai
@ 2007-01-07 21:27           ` Ravikiran G Thirumalai
  0 siblings, 0 replies; 8+ messages in thread
From: Ravikiran G Thirumalai @ 2007-01-07 21:27 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Daniel Walker, linux-kernel, ak, md, mingo, pravin.shelar, shai

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-01-07 21:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200701032112.l03LCnVb031386@shell0.pdx.osdl.net>
2007-01-06 22:35 ` + spin_lock_irq-enable-interrupts-while-spinning-i386-implementation.patch added to -mm tree Daniel Walker
2007-01-07  7:26   ` Andrew Morton
2007-01-07 13:24     ` Daniel Walker
2007-01-07 14:39       ` Zachary Amsden
2007-01-07 15:17         ` Zachary Amsden
2007-01-07 20:05       ` Andrew Morton
2007-01-07 21:06         ` Ravikiran G Thirumalai
2007-01-07 21:27           ` Ravikiran G Thirumalai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).