[Top] [All Lists]

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

To: Jun Sun <>
Subject: Re: Preemption in do_cpu (Re: [PATCH]Preemption patch for 2.6)
From: Manish Lachwani <>
Date: Mon, 18 Apr 2005 14:35:16 -0700
Cc: Pavel Kiryukhin <>,
In-reply-to: <>
Original-recipient: rfc822;
References: <> <> <>
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:
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

The sequence looks like

| 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.

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.

Manish Lachwani

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