linux-mips
[Top] [All Lists]

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

To: Pavel Kiryukhin <vksavl@cityline.ru>
Subject: Re: Preemption in do_cpu (Re: [PATCH]Preemption patch for 2.6)
From: Jun Sun <jsun@junsun.net>
Date: Mon, 18 Apr 2005 14:20:21 -0700
Cc: linux-mips@linux-mips.org, Manish Lachwani <mlachwani@mvista.com>
In-reply-to: <1807918959.20050418133246@cityline.ru>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1098468403.4266.42.camel@prometheus.mvista.com> <1807918959.20050418133246@cityline.ru>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.4.1i
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

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