From: "Alexander van Heukelum" <heukelum@fastmail.fm>
To: "Ingo Molnar" <mingo@elte.hu>,
mingo@redhat.com, "H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org, hch@lst.de,
"Thomas Gleixner" <tglx@linutronix.de>
Cc: linux-tip-commits@vger.kernel.org
Subject: Re: [tip:x86/irq] x86: Always use irq stacks
Date: Mon, 06 Sep 2010 20:53:42 +0200 [thread overview]
Message-ID: <1283799222.15941.1393621887@webmail.messagingengine.com> (raw)
In-Reply-To: <20100903150041.GA30573@elte.hu>
[-- Attachment #1: Type: text/plain, Size: 1265 bytes --]
On Fri, 03 Sep 2010 17:00 +0200, "Ingo Molnar" <mingo@elte.hu> wrote:
>
> * tip-bot for Christoph Hellwig <hch@lst.de> wrote:
>
> > Commit-ID: 7974891db234467eaf1fec613ec0129cb4ac2332
> > Gitweb: http://git.kernel.org/tip/7974891db234467eaf1fec613ec0129cb4ac2332
> > Author: Christoph Hellwig <hch@lst.de>
> > AuthorDate: Mon, 28 Jun 2010 14:15:54 +0200
> > Committer: Thomas Gleixner <tglx@linutronix.de>
> > CommitDate: Tue, 29 Jun 2010 12:12:59 +0200
> >
> > x86: Always use irq stacks
>
> [...]
>
> Checking out 7974891db2 and building+booting a kernel with this config
> causes shows the crash.
>
> Checking out 7974891db2~1 and building+booting a kernel with this config
> gives a working system.
>
> Note that tip:x86/irq has these commits currently:
>
> 1813a68: x86: Move alloc_desk_mask variables inside ifdef
> 2589737: x86-32: Align IRQ stacks properly
> dcfa726: x86: Remove CONFIG_4KSTACKS
> 7974891: x86: Always use irq stacks
Hello Ingo, Christoph, ...
There is still a problem with the alignment of the irq stacks. Maybe it's only
theoretical, but I think the attached patch is necessary. (Attached because
I'm sending it via a web interface.)
Please test and apply :).
Greetings,
Alexander
> Thanks,
>
> Ingo
>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-i386-Align-percpu-area-and-irq-stacks-to-THREAD_SIZE.patch --]
[-- Type: text/x-patch; name="0001-i386-Align-percpu-area-and-irq-stacks-to-THREAD_SIZE.patch", Size: 2648 bytes --]
From 1031da48a89aa437199af581169c65268f9bdbaa Mon Sep 17 00:00:00 2001
From: Alexander van Heukelum <heukelum@fastmail.fm>
Date: Mon, 6 Sep 2010 20:15:05 +0200
Subject: [PATCH] i386: Align percpu area and irq stacks to THREAD_SIZE
The irq stacks, located in the percpu-area, need to be THREAD_SIZE aligned. Add
the infrastucture to align percpu variables to larger-than-pagesize amounts within
the percpu area, and use it to specify the alignment for the irq stacks. Also
align the percpu area itself to THREAD_SIZE.
This should make irq stacks work with 8K THREAD_SIZE.
Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
---
arch/x86/kernel/irq_32.c | 6 ++++--
arch/x86/kernel/vmlinux.lds.S | 2 +-
include/linux/percpu-defs.h | 12 ++++++++++++
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 3b5609f..db7ebe6 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -60,8 +60,10 @@ union irq_ctx {
static DEFINE_PER_CPU(union irq_ctx *, hardirq_ctx);
static DEFINE_PER_CPU(union irq_ctx *, softirq_ctx);
-static DEFINE_PER_CPU_PAGE_ALIGNED(union irq_ctx, hardirq_stack);
-static DEFINE_PER_CPU_PAGE_ALIGNED(union irq_ctx, softirq_stack);
+static DEFINE_PER_CPU_MULTIPAGE_ALIGNED(union irq_ctx,
+ hardirq_stack, THREAD_SIZE);
+static DEFINE_PER_CPU_MULTIPAGE_ALIGNED(union irq_ctx,
+ softirq_stack, THREAD_SIZE);
static void call_on_stack(void *func, void *stack)
{
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index d0bb522..bb89947 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -273,7 +273,7 @@ SECTIONS
}
#if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP)
- PERCPU(PAGE_SIZE)
+ PERCPU(THREAD_SIZE)
#endif
. = ALIGN(PAGE_SIZE);
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index ce2dc65..ab20d11 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -139,6 +139,18 @@
__aligned(PAGE_SIZE)
/*
+ * Declaration/definition used for large per-CPU variables that must be
+ * aligned to something larger than the pagesize.
+ */
+#define DECLARE_PER_CPU_MULTIPAGE_ALIGNED(type, name, size) \
+ DECLARE_PER_CPU_SECTION(type, name, "..page_aligned") \
+ __aligned(size)
+
+#define DEFINE_PER_CPU_MULTIPAGE_ALIGNED(type, name, size) \
+ DEFINE_PER_CPU_SECTION(type, name, "..page_aligned") \
+ __aligned(size)
+
+/*
* Intermodule exports for per-CPU variables. sparse forgets about
* address space across EXPORT_SYMBOL(), change EXPORT_SYMBOL() to
* noop if __CHECKER__.
--
1.7.1
next prev parent reply other threads:[~2010-09-06 18:53 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-28 12:15 [PATCH 1/2] x86: always use irq stacks Christoph Hellwig
2010-06-29 10:21 ` [tip:x86/irq] x86: Always " tip-bot for Christoph Hellwig
2010-06-30 7:44 ` Ingo Molnar
2010-06-30 7:52 ` Christoph Hellwig
2010-06-30 7:58 ` Ingo Molnar
2010-06-30 8:04 ` Ingo Molnar
2010-07-08 20:42 ` Ingo Molnar
2010-07-08 20:53 ` Christoph Hellwig
2010-07-14 15:12 ` Christoph Hellwig
2010-07-14 15:27 ` Thomas Gleixner
2010-07-14 15:47 ` Christoph Hellwig
2010-07-14 18:21 ` Steven Rostedt
2010-07-27 12:13 ` Christoph Hellwig
2010-07-27 16:29 ` H. Peter Anvin
2010-07-27 18:36 ` [tip:x86/irq] x86-32: Align IRQ stacks properly tip-bot for Christoph Hellwig
2010-07-23 14:15 ` [tip:x86/irq] x86: Always use irq stacks Steven Rostedt
2010-07-23 14:24 ` Steven Rostedt
2010-07-23 16:39 ` Christoph Hellwig
2010-07-14 19:02 ` David Miller
2010-09-03 15:00 ` Ingo Molnar
2010-09-06 18:53 ` Alexander van Heukelum [this message]
2010-09-07 4:06 ` [tip:x86/irq] x86, 32-bit: Align percpu area and irq stacks to THREAD_SIZE tip-bot for Alexander van Heukelum
2010-09-07 4:55 ` [tip:x86/irq] x86: Always use irq stacks Ingo Molnar
2010-09-07 8:21 ` Alexander van Heukelum
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=1283799222.15941.1393621887@webmail.messagingengine.com \
--to=heukelum@fastmail.fm \
--cc=hch@lst.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/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