Re: [PATCH] asm-generic: hard_irqs: handle NR_IRQS > 256 automatically

From: Mike Frysinger
Date: Sat Jun 13 2009 - 20:26:23 EST


On Sat, Jun 13, 2009 at 17:18, Arnd Bergmann wrote:
> 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

right, i was going by what was in use -- there are no requirements
here, just defaults

> 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

is there any downsides to using a "too large" value ? i.e. if my
system has less than 256, does it make any difference at all if it's
set to 10 ?
-mike
--
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/