Re: enhanced spinlock debugging code for intel

Brent Baccala (baccala@freesoft.org)
Thu, 02 Aug 2001 16:52:48 -0400


> Brent Baccala wrote:
> >
> > I've had to add some hideous code to get the processor ID:
> >
> > #define my_processor_id (((int *)current)[13])
> >
> > since sched.h includes spinlock.h, so task_struct isn't defined when
> > this file is parsed, so we can't just dereference current to find the
> > processor ID. Any better suggestions would be welcome.

I've been thinking more about my own problem here.

I think it could be solved by splitting the spinlock include file in
two:

spinlockdef.h - the structure definitions for spinlocks and their
initializers
spinlock.h - includes spinlockdef.h and defines the functions to
manipulate spinlocks

This would have to been done in include/linux, as well as all the
include/asm* directories.

Most stuff would include spinlock.h, get both files, and see no change.

sched.h would be changed to include spinlockdef.h, since that's all it
needs.

asm-i386/spinlock.h could then include sched.h and spinlockdef.h without
creating a self-referential loop, so smp_processor_id would work in this
file.

Comments? a new include file in all the asm dirs? think Linus would
take it?

-- 
                                        -bwb

Brent Baccala baccala@freesoft.org

============================================================================== For news from freesoft.org, subscribe to announce@freesoft.org: mailto:announce-request@freesoft.org?subject=subscribe&body=subscribe ============================================================================== - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/