All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@kernel.org>
To: Ian Campbell <ian.campbell@citrix.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>, Brian Gerst <brgerst@gmail.com>,
	Jan Beulich <JBeulich@novell.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	x86@kernel.org, Andi Kleen <ak@linux.intel.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 1/3] x86: drop unnecessary kernel_eflags variable from 64 bit.
Date: Wed, 6 Jul 2011 12:39:56 +0300	[thread overview]
Message-ID: <CAOJsxLFjdrrnx4gZjDJQuf3GBHeKvKb91TajYBkMu+PgSWtM5A@mail.gmail.com> (raw)
In-Reply-To: <1309870814-14181-1-git-send-email-ian.campbell@citrix.com>

On Tue, Jul 5, 2011 at 4:00 PM, Ian Campbell <ian.campbell@citrix.com> wrote:
> For no reason that I can determine 64 bit x86 saves the current eflags
> in cpu_init purely for use in ret_from_fork. The equivalent 32 bit
> code simply hard codes 0x0202 as the new EFLAGS which seems safer than
> relying on a potentially arbitrary EFLAGS saved during cpu_init.
>
> Original i386 changeset
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=47a5c6fa0e204a2b63309c648bb2fde36836c826
> Original x86_64 changset
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=658fdbef66e5e9be79b457edc2cbbb3add840aa9
>
> The only comment in the later indicates that it is following the
> former, but not why it differs in this way.

Well lets ask Linus and Andi?

> This change makes 64 bit use the same mechanism to setup the initial
> EFLAGS on fork. Note that 64 bit resets EFLAGS before calling
> schedule_tail() as opposed to 32 bit which calls schedule_tail()
> first. Therefore the correct value for EFLAGS has opposite IF
> bit. This will be fixed in a subsequent patch.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: x86@kernel.org
> ---
>  arch/x86/kernel/cpu/common.c |    4 ----
>  arch/x86/kernel/entry_64.S   |    2 +-
>  2 files changed, 1 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> index 22a073d..178c3b4 100644
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -1077,8 +1077,6 @@ void syscall_init(void)
>               X86_EFLAGS_TF|X86_EFLAGS_DF|X86_EFLAGS_IF|X86_EFLAGS_IOPL);
>  }
>
> -unsigned long kernel_eflags;
> -
>  /*
>  * Copies of the original ist values from the tss are only accessed during
>  * debugging, no special alignment required.
> @@ -1231,8 +1229,6 @@ void __cpuinit cpu_init(void)
>        fpu_init();
>        xsave_init();
>
> -       raw_local_save_flags(kernel_eflags);
> -
>        if (is_uv_system())
>                uv_cpu_init();
>  }
> diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
> index e13329d..b50d142 100644
> --- a/arch/x86/kernel/entry_64.S
> +++ b/arch/x86/kernel/entry_64.S
> @@ -396,7 +396,7 @@ ENTRY(ret_from_fork)
>
>        LOCK ; btr $TIF_FORK,TI_flags(%r8)
>
> -       pushq_cfi kernel_eflags(%rip)
> +       pushq_cfi $0x0002
>        popfq_cfi                               # reset kernel eflags
>
>        call schedule_tail                      # rdi: 'prev' task parameter

  parent reply	other threads:[~2011-07-06  9:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-05 10:47 [Q x86-64] on kernel_eflags Cyrill Gorcunov
2011-07-05 11:00 ` Ian Campbell
2011-07-05 11:15   ` Cyrill Gorcunov
2011-07-05 13:00     ` [PATCH 1/3] x86: drop unnecessary kernel_eflags variable from 64 bit Ian Campbell
2011-07-05 13:28       ` Cyrill Gorcunov
2011-07-06  9:25         ` Ian Campbell
2011-07-06  9:46           ` Cyrill Gorcunov
2011-07-06  9:57             ` Ian Campbell
2011-07-06 10:12               ` Cyrill Gorcunov
2011-07-06  9:39       ` Pekka Enberg [this message]
2011-07-06 23:17         ` Andi Kleen
2011-07-07  0:00           ` H. Peter Anvin
2011-07-05 13:00     ` [PATCH 2/3] x86: make 64 bit ret_from_fork a little more similar to 32 bit Ian Campbell
2011-07-06  9:41       ` Pekka Enberg
2011-07-05 13:00     ` [PATCH 3/3] x86: ret_from_fork: use symbolic contants for bits in EFLAGS Ian Campbell
2011-07-06  9:36       ` Pekka Enberg
2011-07-05 17:47 ` [Q x86-64] on kernel_eflags H. Peter Anvin
2011-07-05 17:56   ` Cyrill Gorcunov
2011-07-06  9:25   ` Ian Campbell
  -- strict thread matches above, loose matches on Subject: below --
2011-07-25  9:58 [PATCH 0/3] minor cleanups to EFLAGS initialisation in ret_from_fork Ian Campbell
2011-07-25 10:03 ` [PATCH 1/3] x86: drop unnecessary kernel_eflags variable from 64 bit Ian Campbell
2010-02-09 15:56 [PATCH 0/3] x86: slightly unify ret_from_fork Ian Campbell
2010-02-09 15:56 ` [PATCH 1/3] x86: drop unnecessary kernel_eflags variable from 64 bit Ian Campbell

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=CAOJsxLFjdrrnx4gZjDJQuf3GBHeKvKb91TajYBkMu+PgSWtM5A@mail.gmail.com \
    --to=penberg@kernel.org \
    --cc=JBeulich@novell.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=ak@linux.intel.com \
    --cc=brgerst@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=hpa@zytor.com \
    --cc=ian.campbell@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.