possible deadlock in pipes
Olaf Hering
olh at suse.de
Tue Sep 30 17:39:29 EST 2003
On Fri, Aug 22, Anton Blanchard wrote:
>
> Hi Olaf,
>
> > I see random dead locks in pipe_wait() on power4 (p630, p650).
> > I dont have a simple testcase to trigger it. The userland code its
> > either 32bit or 64bit, new or (very) old.
> > It happens with 2.4.19 and with 2.4.21.
> >
> > This patch seems to fix it, maybe it is only a workaround. Is the 2.4
> > pipe code supposed to work on power4 (enough sync accross cpus etc.)?
>
> How hard is it to hit? I think we should be using set_task_state()
> which includes a memory barrier. I also updated the other open coded
> statements to use __set_task_state. Finally I got rid of some redundant
> wmb()s and added unlikely() to force the slow path out of line
>
> Note in 2.5 we have each way barriers on our atomics that return values
> (like atomic_dec_and_test). It doesnt look like we have that in 2.4.
>
> Anton
>
> ===== arch/ppc64/kernel/semaphore.c 1.2 vs edited =====
> --- 1.2/arch/ppc64/kernel/semaphore.c Mon Apr 8 15:56:10 2002
> +++ edited/arch/ppc64/kernel/semaphore.c Fri Aug 22 07:11:26 2003
> @@ -122,10 +120,11 @@
> break;
> }
> schedule();
> - tsk->state = TASK_INTERRUPTIBLE;
> + set_task_state(tsk, TASK_INTERRUPTIBLE);
> }
> - tsk->state = TASK_RUNNING;
> remove_wait_queue(&sem->wait, &wait);
> + __set_task_state(tsk, TASK_RUNNING);
> +
> wake_up(&sem->wait);
> return retval;
> }
why did you move the set task state?
--
USB is for mice, FireWire is for men!
sUse lINUX ag, nÜRNBERG
** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc64-dev
mailing list