Re: IDE spin_lock bug

From: Pete Zaitcev (zaitcev@metabyte.com)
Date: Wed May 03 2000 - 19:22:43 EST


> From: Jens Axboe (axboe@suse.de)
> Date: Wed May 03 2000 - 18:00:11 EDT
>
> After browsing through Rusty's locking guide today, it occured to
> me that IDE violates the _irqsave rule of passing flags
> to a different function which does the restoring. The easy solution
> is to inline ide_spin_wait_hwgroup.

This is precisely the reason why IDE does not work on sparc(32).
save_flags() on sparc saves a stack position (CWP register).
If flags are passed into a function, then restore_flags() is done,
CWP gets restored, stack frame shifted, and all local variables
instantly corrupted with an Oops or lockup.

I must admit it is fixable with a longer version of restore_flags(),
but DaveM rejected my patch to that. See this:

----- begin ----------
Date: Tue, 3 Aug 1999 20:57:13 -0700
From: "David S. Miller" <davem@redhat.com>
Subject: Re: You what I am going to whine about :)

   From: Pete Zaitcev <zaitcev@metabyte.com>
   Date: Tue, 3 Aug 1999 10:54:15 -0700 (PDT)

   What do you think if I implement restore_flags() which does not
   touch CWP? This sounds simple enough...

I think a better idea is to consult with Linus. Last time this issue
came up (SLAB did this same thing for a while) he totally agreed with
me that x_flags() around function call levels was not allowed.

I'm just thinking about how the kernel will bloat up on Sparc, size
wise, with this change and only one silly piece of code requires it,
which is really dumb. Let's fix the broken code.

Later,
David S. Miller
davem@redhat.com
----- end ------------

I certainly would welcome a change to IDE that removes passing of
flags as an argument.

--Pete

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun May 07 2000 - 21:00:13 EST