From: Suresh Siddha <suresh.b.siddha@intel.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>,
Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: PATCH? process_32.c:__switch_to() calls __math_state_restore() before updating current_task
Date: Thu, 04 Feb 2010 09:40:53 -0800 [thread overview]
Message-ID: <1265305253.2768.7.camel@sbs-t61.sc.intel.com> (raw)
In-Reply-To: <20100204165105.GA5905@redhat.com>
On Thu, 2010-02-04 at 08:51 -0800, Oleg Nesterov wrote:
> I didn't try to verify __switch_to()->__math_state_restore() is really
> wrong, this is more the question than the patch. But at least the code
> looks wrong, it calls __math_state_restore() which uses curent before
> current_task was updated.
>
> Uncompiled/untested.
>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
>
> --- a/arch/x86/kernel/process_32.c
> +++ b/arch/x86/kernel/process_32.c
> @@ -377,9 +377,6 @@ __switch_to(struct task_struct *prev_p,
> */
> arch_end_context_switch(next_p);
>
> - if (preload_fpu)
> - __math_state_restore();
> -
> /*
> * Restore %gs if needed (which is common)
> */
> @@ -388,6 +385,9 @@ __switch_to(struct task_struct *prev_p,
>
> percpu_write(current_task, next_p);
>
> + if (preload_fpu)
> + __math_state_restore();
> +
> return prev_p;
> }
Oleg, __math_state_restore() uses current_thread_info() which at that
point already has the right esp and as such uses the correct thread
struct etc.
After saying that, in the past I have also ran into this question and
got satisfied by looking deeper. Best is to make the 32bit and 64bit
code similar as much as possible and as such your patch is acceptable.
Can you please re-post with a proper changelog (and ofcourse testing
etc)? You can add my Ack to that.
thanks,
suresh
next prev parent reply other threads:[~2010-02-04 17:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-04 16:51 Oleg Nesterov
2010-02-04 17:40 ` Suresh Siddha [this message]
2010-02-05 12:44 ` Oleg Nesterov
2010-02-06 12:06 ` Oleg Nesterov
2010-02-06 12:08 ` Oleg Nesterov
2010-02-08 18:48 ` Suresh Siddha
2010-02-08 20:26 ` Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1265305253.2768.7.camel@sbs-t61.sc.intel.com \
--to=suresh.b.siddha@intel.com \
--cc=arjan@linux.intel.com \
--cc=jeremy.fitzhardinge@citrix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®