[Top] [All Lists]

semaphore woes in 2.6, 32bit

Subject: semaphore woes in 2.6, 32bit
From: Jun Sun <>
Date: Fri, 7 May 2004 18:10:31 -0700
Original-recipient: rfc822;
User-agent: Mutt/1.2.5i
I got a bunch of segfaults which are due to HAS_LLSCD cpu operating
on a semaphore which is aligned along 4-byte boundary instead of the
desired 8-byte boundary.

I traced down one such place at serial/serial_core.c:

int uart_register_driver(struct uart_driver *drv)
        struct tty_driver *normal = NULL;
        int i, retval;


         * Maybe we should be using a slab cache for this, especially if
         * we have a large number of ports to handle.
        drv->state = kmalloc(sizeof(struct uart_state) * drv->nr, GFP_KERNEL);

where drv->state contains a semaphore variable, but apparently kmalloc() only
give 4-byte boundary alignment.

There are many other faults, which I did not bother to trace down.
Simply removing CPU_HAS_LLSCD makes the problem go away, which probably 
they are all of the same nature.

I wonder why this problem only shows up now while it did not show up
earlier when we introduced the new up().  Perhaps kmalloc() always
returns 8-byte aligned blocks?

I can't think of an immediate and good fix.  Hopefully someone else smarter
than me can find a solution before I come back to it on Monday.  :)


<Prev in Thread] Current Thread [Next in Thread>