linux-mips
[Top] [All Lists]

Re: [PATCH] rewrite restore_fp_context/save_fp_context

To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Subject: Re: [PATCH] rewrite restore_fp_context/save_fp_context
From: Ralf Baechle <ralf@linux-mips.org>
Date: Tue, 14 Nov 2006 17:46:08 +0000
Cc: linux-mips@linux-mips.org
In-reply-to: <20060829.225631.41630441.anemo@mba.ocn.ne.jp>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20060208.015250.130239257.anemo@mba.ocn.ne.jp> <20060411.185449.126141341.nemoto@toshiba-tops.co.jp> <20060620.003746.78731943.anemo@mba.ocn.ne.jp> <20060829.225631.41630441.anemo@mba.ocn.ne.jp>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.4.2.2i
On Tue, Aug 29, 2006 at 10:56:31PM +0900, Atsushi Nemoto wrote:

> The setup_sigcontect()/restore_sigcontext() might sleep on
> put_user()/get_user() with preemption disabled (i.e. atomic context).
> Sleeping in atomic context is not allowed.  This patch fixes this
> problem by rewriting restore_fp_context()/save_fp_context().

So with this patch applied the context will be copied around twice, first
save the fp registers to memory then copied from memory to userspace and
as the result the non-preemptible kernel will suffer from fixing the
preemptible ...

To me it looks like the real problem that setup_sigcontext and
restore_sigcontext need to disable preemption.  And the reason for that
is probably that 87d54649f67d8ffe0a8d8176de8c210a6c4bb4a7 around 2.6.9
took the wrong.  The better fix would probably have been to allow
at least some fp instructions from kernel mode.  The sole reason for
the die_if_kernel() call is to tell people attempting to put FPU code
into the kernel that they're screwing up.

  Ralf

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