This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

spinlocks



The PA architecture requires us to align all locks at 16 bytes.  Also,
the only atomic operation we have is load-and-clear-word (some of you
may prefer to think of this as test-and-clear).

An earlier attempt at getting linuxthreads working on PA by John Marvin
replaced the `int' often used by an _lt_spinlock_t, which was defined as:

typedef int _lt_spinlock_t __attribute__((aligned(16)));

on PA and just

typedef int _lt_spinlock_t;

on other architectures.  Unfortunately, this allows the abuse of spinlocks
because it provides no typesafety.  So for this revised patch, I did
the following:

typedef struct {
    int lock;
} _lt_spinlock_t __attribute__((aligned (16)));

on PA and omitted the attribute for other architectures.

This catches a lot of places where the spinlock was being initialised to
`0' rather than __LT_SPINLOCK_INIT.  It also catches some other places
which just read the value (i added a `test' function to cope with this.)

The patch is over 750 lines, so rather than include it inline, I have
placed it at ftp://puffin.external.hp.com/pub/parisc/src/libc-lock.diff
Since I haven't tested it on other architectures, I have surely missed
something.  I'm not asking for this to be applied, I'm just asking for
comment on whether this is an acceptable approach to the problem.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]