public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Andy Lutomirski <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, dvlasenk@redhat.com, mingo@kernel.org,
	luto@amacapital.net, bp@alien8.de, oleg@redhat.com,
	torvalds@linux-foundation.org, tglx@linutronix.de,
	linux-kernel@vger.kernel.org
Subject: [tip:x86/asm] x86/asm/entry: Remove INIT_TSS and fold the definitions into 'cpu_tss'
Date: Fri, 6 Mar 2015 00:39:01 -0800	[thread overview]
Message-ID: <tip-d0a0de21f82bbc1737ea3c831f018d0c2bc6b9c2@git.kernel.org> (raw)
In-Reply-To: <8fc39fa3f6c5d635e93afbdd1a0fe0678a6d7913.1425611534.git.luto@amacapital.net>

Commit-ID:  d0a0de21f82bbc1737ea3c831f018d0c2bc6b9c2
Gitweb:     http://git.kernel.org/tip/d0a0de21f82bbc1737ea3c831f018d0c2bc6b9c2
Author:     Andy Lutomirski <luto@amacapital.net>
AuthorDate: Thu, 5 Mar 2015 19:19:06 -0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 6 Mar 2015 08:32:58 +0100

x86/asm/entry: Remove INIT_TSS and fold the definitions into 'cpu_tss'

The INIT_TSS is unnecessary.  Just define the initial TSS where
'cpu_tss' is defined.

While we're at it, merge the 32-bit and 64-bit definitions.  The
only syntactic change is that 32-bit kernels were computing sp0
as long, but now they compute it as unsigned long.

Verified by objdump: the contents and relocations of
.data..percpu..shared_aligned are unchanged on 32-bit and 64-bit
kernels.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/8fc39fa3f6c5d635e93afbdd1a0fe0678a6d7913.1425611534.git.luto@amacapital.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/processor.h | 20 --------------------
 arch/x86/kernel/process.c        | 20 +++++++++++++++++++-
 2 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 117ee65..f5e3ec6 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -818,22 +818,6 @@ static inline void spin_lock_prefetch(const void *x)
 	.io_bitmap_ptr		= NULL,					  \
 }
 
-/*
- * Note that the .io_bitmap member must be extra-big. This is because
- * the CPU will access an additional byte beyond the end of the IO
- * permission bitmap. The extra byte must be all 1 bits, and must
- * be within the limit.
- */
-#define INIT_TSS  {							  \
-	.x86_tss = {							  \
-		.sp0		= sizeof(init_stack) + (long)&init_stack, \
-		.ss0		= __KERNEL_DS,				  \
-		.ss1		= __KERNEL_CS,				  \
-		.io_bitmap_base	= INVALID_IO_BITMAP_OFFSET,		  \
-	 },								  \
-	.io_bitmap		= { [0 ... IO_BITMAP_LONGS] = ~0 },	  \
-}
-
 extern unsigned long thread_saved_pc(struct task_struct *tsk);
 
 #define THREAD_SIZE_LONGS      (THREAD_SIZE/sizeof(unsigned long))
@@ -892,10 +876,6 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
 	.sp0 = (unsigned long)&init_stack + sizeof(init_stack) \
 }
 
-#define INIT_TSS  { \
-	.x86_tss.sp0 = (unsigned long)&init_stack + sizeof(init_stack) \
-}
-
 /*
  * Return saved PC of a blocked thread.
  * What is this good for? it will be always the scheduler or ret_from_fork.
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 6f60873..f4c0af7 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -37,7 +37,25 @@
  * section. Since TSS's are completely CPU-local, we want them
  * on exact cacheline boundaries, to eliminate cacheline ping-pong.
  */
-__visible DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, cpu_tss) = INIT_TSS;
+__visible DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, cpu_tss) = {
+	.x86_tss = {
+		.sp0 = (unsigned long)&init_stack + sizeof(init_stack),
+#ifdef CONFIG_X86_32
+		.ss0 = __KERNEL_DS,
+		.ss1 = __KERNEL_CS,
+		.io_bitmap_base	= INVALID_IO_BITMAP_OFFSET,
+#endif
+	 },
+#ifdef CONFIG_X86_32
+	 /*
+	  * Note that the .io_bitmap member must be extra-big. This is because
+	  * the CPU will access an additional byte beyond the end of the IO
+	  * permission bitmap. The extra byte must be all 1 bits, and must
+	  * be within the limit.
+	  */
+	.io_bitmap		= { [0 ... IO_BITMAP_LONGS] = ~0 },
+#endif
+};
 EXPORT_PER_CPU_SYMBOL_GPL(cpu_tss);
 
 #ifdef CONFIG_X86_64

  reply	other threads:[~2015-03-06  8:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06  3:19 [PATCH v2 0/6] Baby steps toward cleaning up KERNEL_STACK_OFFSET Andy Lutomirski
2015-03-06  3:19 ` [PATCH v2 1/6] x86: Add this_cpu_sp0() to read sp0 for the current cpu Andy Lutomirski
2015-03-06  8:37   ` [tip:x86/asm] x86/asm/entry: " tip-bot for Andy Lutomirski
2015-03-06  3:19 ` [PATCH v2 2/6] x86: Switch all C consumers of kernel_stack to this_cpu_sp0 Andy Lutomirski
2015-03-06  8:38   ` [tip:x86/asm] x86/asm/entry: Switch all C consumers of kernel_stack to this_cpu_sp0() tip-bot for Andy Lutomirski
2015-03-06  3:19 ` [PATCH v2 3/6] x86, asm: Change the 32-bit sysenter code to use sp0 Andy Lutomirski
2015-03-06  8:38   ` [tip:x86/asm] x86/asm/entry/64/compat: " tip-bot for Andy Lutomirski
2015-03-06  3:19 ` [PATCH v2 4/6] x86: Rename init_tss to cpu_tss Andy Lutomirski
2015-03-06  8:38   ` [tip:x86/asm] x86/asm/entry: Rename 'init_tss' to 'cpu_tss' tip-bot for Andy Lutomirski
2015-03-06  3:19 ` [PATCH v2 5/6] x86: Remove INIT_TSS and fold the definitions into cpu_tss Andy Lutomirski
2015-03-06  8:39   ` tip-bot for Andy Lutomirski [this message]
2015-03-06  3:19 ` [PATCH v2 6/6] x86, asm: Rename INIT_TSS_IST to TSS_IST Andy Lutomirski
2015-03-06  7:30   ` Ingo Molnar
2015-03-06  8:39   ` [tip:x86/asm] x86/asm/entry: Rename 'INIT_TSS_IST' to ' CPU_TSS_IST' tip-bot for Andy Lutomirski

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=tip-d0a0de21f82bbc1737ea3c831f018d0c2bc6b9c2@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=bp@alien8.de \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox