Linux MIPS Architecture development
 help / color / mirror / Atom feed
* semaphore woes in 2.6, 32bit
@ 2004-05-08  1:10 Jun Sun
  2004-05-08  7:18 ` Ralf Baechle
  0 siblings, 1 reply; 11+ messages in thread
From: Jun Sun @ 2004-05-08  1:10 UTC (permalink / raw)
  To: linux-mips; +Cc: jsun


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;

        BUG_ON(drv->state);

        /*
         * 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 indicates
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.  :)

Jun

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

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

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-08  1:10 semaphore woes in 2.6, 32bit Jun Sun
2004-05-08  7:18 ` Ralf Baechle
2004-05-09  5:48   ` Jun Sun
2004-05-09  9:09     ` Geert Uytterhoeven
2004-05-09 12:57       ` Ralf Baechle
2004-05-09 13:56         ` Atsushi Nemoto
2004-05-09 16:48           ` Ralf Baechle
2004-05-10 13:28             ` Atsushi Nemoto
2004-05-10 14:06               ` Ralf Baechle
2004-05-11 13:53                 ` Atsushi Nemoto
2004-05-11 14:05                   ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox