linux-mips
[Top] [All Lists]

Re: Preemption in do_cpu (Re: [PATCH]Preemption patch for 2.6)

To: Jun Sun <jsun@junsun.net>
Subject: Re: Preemption in do_cpu (Re: [PATCH]Preemption patch for 2.6)
From: Manish Lachwani <mlachwani@mvista.com>
Date: Mon, 18 Apr 2005 14:35:16 -0700
Cc: Pavel Kiryukhin <vksavl@cityline.ru>, linux-mips@linux-mips.org
In-reply-to: <20050418212021.GA12996@gw.junsun.net>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1098468403.4266.42.camel@prometheus.mvista.com> <1807918959.20050418133246@cityline.ru> <20050418212021.GA12996@gw.junsun.net>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040308
Jun Sun wrote:

On Mon, Apr 18, 2005 at 01:32:46PM +0400, Pavel Kiryukhin wrote:
Hi,
the preempt_disable/preempt_enable sequence in do_cpu() [traps.c]
exists quite long (patch submitted in Oct. 2004), so it should be nothing
wrong there.

Can somebody please comment why use of preempt_disable/enable in do_cpu
will not result in "scheduling while atomic" for fpu-less cpu (with enabled
preemption).

The sequence looks like

do_cpu()
| preempt_disable()
| fpu_emulator_cop1Handler()
| | cond_reshed()
| | | schedule()  <------ scheduling while atomic


The proposed patch was tested for Sibyte, but it has fpu (AFAIK) and has no
fpu_emulator_cop1Handler called.


fpu_emulator maintains global variables and in general is dangerous
to be preempted in the middle of processing.

The quick fix for this problem is probably to move preemption disabling/
enabling inside fpu_emulator_cop1Handler().

Better fix is probably to modify fpu emulator so that it is preemption
safe overall.

Jun
Missed this one ! I had a patch that enables preemption before the cond_resched and disables right after it. I forgot to send it to linux-mips though. But, I needed it to work on fpu-less CPU. My bad.

Thanks
Manish Lachwani


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