All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: adeos-main <adeos-main@gna.org>
Subject: [Adeos-main] [RFC][PATCH] x86-64: catch too large NR_CPUS
Date: Thu, 20 Dec 2007 12:31:39 +0100	[thread overview]
Message-ID: <476A529B.1040006@domain.hid> (raw)

[-- Attachment #1: Type: text/plain, Size: 703 bytes --]

Hi,

building Xenomai for an 8-way box and deriving its setup from an
existing .config, I fortunately noticed some warning in ipipe.c. It
pointed out an overflow in IPIPE_IRQMASK_VIRT when NR_CPUS gets too
large. This causes NR_IRQS to explode, which then lets the virtual IRQ
mask overflow.

I bet no one currently wants to run Xenomai on such large systems, but
the problem is that the dependency above may nevertheless slip through
some setups unnoticed. Therefore, the attached patch catches this
invalid setup and bails out at compile time (does anyone have a nicer
idea for a config-time safety bag?).

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux

[-- Attachment #2: catch-too-many-cpus.patch --]
[-- Type: text/x-patch, Size: 728 bytes --]

---
 arch/x86_64/kernel/ipipe.c |    6 ++++++
 1 file changed, 6 insertions(+)

Index: linux-2.6.23.12-xeno/arch/x86_64/kernel/ipipe.c
===================================================================
--- linux-2.6.23.12-xeno.orig/arch/x86_64/kernel/ipipe.c
+++ linux-2.6.23.12-xeno/arch/x86_64/kernel/ipipe.c
@@ -44,6 +44,12 @@
 #include <asm/ipi.h>
 #include <asm/mach_apic.h>
 
+/* Sanity check: IPIPE_VIRQ_BASE depends on CONFIG_NR_CPUS, and if this
+   gets too large, we run into troubles with the ipipe IRQ log. */
+#if IPIPE_VIRQ_BASE / BITS_PER_LONG > BITS_PER_LONG
+# error CONFIG_NR_CPUS is too large, please lower it.
+#endif
+
 asmlinkage void preempt_schedule_irq(void);
 
 int __ipipe_tick_irq;		/* =0: 8254 */

             reply	other threads:[~2007-12-20 11:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-20 11:31 Jan Kiszka [this message]
2007-12-20 11:37 ` [Adeos-main] [RFC][PATCH] x86-64: catch too large NR_CPUS Jan Kiszka

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=476A529B.1040006@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=adeos-main@gna.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.