linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Q x86-64] on kernel_eflags
@ 2011-07-05 10:47 Cyrill Gorcunov
  2011-07-05 11:00 ` Ian Campbell
  2011-07-05 17:47 ` [Q x86-64] on kernel_eflags H. Peter Anvin
  0 siblings, 2 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2011-07-05 10:47 UTC (permalink / raw)
  To: LKML
  Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Brian Gerst,
	Jan Beulich, Peter Zijlstra, Frederic Weisbecker

While were looking into ret_from_fork code I somehow wondered
about the global kernel_eflags variable here.

arch/x86/cpu/common.c
---------------------
unsigned long kernel_eflags;

void __cpuinit cpu_init(void)
{
	...
	raw_local_save_flags(kernel_eflags);
}

arch/x86/kernel/entry_64.S
--------------------------
ENTRY(ret_from_fork)
	DEFAULT_FRAME
	LOCK ; btr $TIF_FORK,TI_flags(%r8)
	pushq_cfi kernel_eflags(%rip)
	popfq_cfi                               # reset kernel eflags

Every call to cpu_init renew global kernel_eflags
and every task switching does use this variable in a
sake of cleaning carry bit of flags register as far as
I can tell.

Should not every cpu has own copy of kernel_eflags? Just
to be consistent in style? Or this would be space waisting
and an optimization is done here?

	Cyrill

^ permalink raw reply	[flat|nested] 21+ messages in thread
* [PATCH 0/3] minor cleanups to EFLAGS initialisation in ret_from_fork
@ 2011-07-25  9:58 Ian Campbell
  2011-07-25 10:03 ` [PATCH 1/3] x86: drop unnecessary kernel_eflags variable from 64 bit Ian Campbell
  0 siblings, 1 reply; 21+ messages in thread
From: Ian Campbell @ 2011-07-25  9:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pekka Enberg, Cyrill Gorcunov, H. Peter Anvin, Andi Kleen

The following series removes the use of a global kernel_eflags variable
from the x86_64 ret_from_fork path and (very slightly) merges the 32 and
64 bit version of that code path.

kernel_eflags could be made a __read_mostly but actually there is no
reason to prefer the value at cpu_init() time to a compile time constant
value for the initial eflags after a fork.

Ian.


^ permalink raw reply	[flat|nested] 21+ messages in thread
* [PATCH 0/3] x86: slightly unify ret_from_fork
@ 2010-02-09 15:56 Ian Campbell
  2010-02-09 15:56 ` [PATCH 1/3] x86: drop unnecessary kernel_eflags variable from 64 bit Ian Campbell
  0 siblings, 1 reply; 21+ messages in thread
From: Ian Campbell @ 2010-02-09 15:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ian Campbell, x86

I came across some minor differences between the 32 and 64 bit
implementations of ret_from_fork. Although I don't expect this is code
which can realistically be completely unified there seemed to be some
value in making the two look a bit more similar.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: x86@kernel.org

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2011-07-25 10:03 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).