linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* spinlock_t typedef visibility and uninitialized spinlock
@ 2004-11-01 11:05 Carlos Vidal
  2004-11-01 14:04 ` Zwane Mwaikambo
  0 siblings, 1 reply; 2+ messages in thread
From: Carlos Vidal @ 2004-11-01 11:05 UTC (permalink / raw)
  To: linux-kernel

I'm porting CIPE 1.6.0 kernel module to Kernel 2.6.8 and had problems
with "spin_is_locked on uninitialized spinlock".

After tracing the problem I found that the spinlock_t structure is not
visible to the module code. A 'gcc -E' yields:
     typedef struct { } spinlock_t;

In spinlock.h, this declaration is inside a #ifdef
CONFIG_DEBUG_SPINLOCK block, so it becomes visible only
CONFIG_DEBUG_SPINLOCK is 'y'.

If I turn CONFIG_DEBUG_SPINLOCK on, the module loads nicely. Otherwise
I get a nasty error in syslog and sometimes a system crash, as if in
CIPE the struct was not allocated (what is the case if the compiler
uses the typedef as it is above).

The question is: is this a bug or a feature? ;-)

Should the declaration be out of the #ifdef CONFIG_DEBUG_SPINLOCK? Or
should I use a special compiler flag?

Carlos

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

* Re: spinlock_t typedef visibility and uninitialized spinlock
  2004-11-01 11:05 spinlock_t typedef visibility and uninitialized spinlock Carlos Vidal
@ 2004-11-01 14:04 ` Zwane Mwaikambo
  0 siblings, 0 replies; 2+ messages in thread
From: Zwane Mwaikambo @ 2004-11-01 14:04 UTC (permalink / raw)
  To: carlos; +Cc: linux-kernel

On Mon, 1 Nov 2004, Carlos Vidal wrote:

> I'm porting CIPE 1.6.0 kernel module to Kernel 2.6.8 and had problems
> with "spin_is_locked on uninitialized spinlock".
> 
> After tracing the problem I found that the spinlock_t structure is not
> visible to the module code. A 'gcc -E' yields:
>      typedef struct { } spinlock_t;
> 
> In spinlock.h, this declaration is inside a #ifdef
> CONFIG_DEBUG_SPINLOCK block, so it becomes visible only
> CONFIG_DEBUG_SPINLOCK is 'y'.
> 
> If I turn CONFIG_DEBUG_SPINLOCK on, the module loads nicely. Otherwise
> I get a nasty error in syslog and sometimes a system crash, as if in
> CIPE the struct was not allocated (what is the case if the compiler
> uses the typedef as it is above).
> 
> The question is: is this a bug or a feature? ;-)
> 
> Should the declaration be out of the #ifdef CONFIG_DEBUG_SPINLOCK? Or
> should I use a special compiler flag?

Try including <linux/config.h> at the top of the compilation unit and run 
through the preprocessor again. By the way, spinlock code got shuffled 
around in 2.6.9...

	Zwane


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

end of thread, other threads:[~2004-11-01 14:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-01 11:05 spinlock_t typedef visibility and uninitialized spinlock Carlos Vidal
2004-11-01 14:04 ` Zwane Mwaikambo

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).