Re: [PATCH] asm-generic: hard_irqs: handle NR_IRQS > 256 automatically
From: Arnd Bergmann
Date: Sat Jun 13 2009 - 17:20:08 EST
On Saturday 13 June 2009, H. Peter Anvin wrote:
> Mike Frysinger wrote:
> > If we're going to automatically set HARDIRQ_BITS for the arch, might as
> > well be a little bit smart about it and set it to 9 automatically if
> > NR_IRQS is larger than 8 bits.
> >
>
> Why would the only possible values be 8 or 9?
All architectures that define this either set it to 8 or 9, I chose
8 because it is the more common constant, but I now realized that
we also have (in include/linux/hardirq.h, last touched by Steven):
#define MAX_HARDIRQ_BITS 10
#ifndef HARDIRQ_BITS
# define HARDIRQ_BITS MAX_HARDIRQ_BITS
#endif
#if HARDIRQ_BITS > MAX_HARDIRQ_BITS
#error HARDIRQ_BITS too high!
#endif
Not sure why we even need to make this overridable from the architecture,
10 still seems like a reasonable default that should always work.
I'd suggest we either drop the definition for HARDIRQ_BITS from
asm-generic/hardirq.h, or we use
#ifndef HARDIRQ_BITS
-#define HARDIRQ_BITS 8
+# if NR_IRQS > 255
+# define HARDIRQ_BITS 9
+# elif NR_IRQS > 511
+# define HARDIRQ_BITS 10
+# elif NR_IRQS > 1023
+# warning too many interrupts for HARDIRQ_BITS
+# endif
#endif
Arnd <><
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/