lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 10 Jan 2009 18:00:17 -0800
From:	Mike Travis <travis@....com>
To:	Ingo Molnar <mingo@...e.hu>
CC:	Ingo Molnar <mingo@...hat.com>,
	Rusty Russell <rusty@...tcorp.com.au>,
	Yinghai Lu <yinghai@...nel.org>,
	Jack Steiner <steiner@....com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] irq: initialize nr_irqs based on nr_cpu_ids

Ingo Molnar wrote:
> * Mike Travis <travis@....com> wrote:
> 
>> Impact: Reduce memory usage.
>>
>> This is the second half of the changes to make the irq_desc_ptrs be
>> variable sized based on nr_cpu_ids.  The algorithm is the same as the
>> setting of NR_IRQS except use nr_cpu_ids instead of NR_CPUS.  This is
>> only when CONFIG_SPARSE_IRQS=y.
>>
>> Signed-off-by: Mike Travis <travis@....com>
>> ---
>>  kernel/irq/handle.c |    5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> Files linux-2.6-for-ingo.orig/kernel/irq/.handle.c.swp and linux-2.6-for-ingo/kernel/irq/.handle.c.swp differ
>> --- linux-2.6-for-ingo.orig/kernel/irq/handle.c
>> +++ linux-2.6-for-ingo/kernel/irq/handle.c
>> @@ -133,6 +133,11 @@ int __init early_irq_init(void)
>>  	int legacy_count;
>>  	int i;
>>  
>> +	/* initialize nr_irqs based on nr_cpu_ids */
>> + 	nr_irqs =  (8 * nr_cpu_ids) > (32 * MAX_IO_APICS) ?
>> + 			NR_VECTORS + (8 * nr_cpu_ids) :
>> + 			NR_VECTORS + (32 * MAX_IO_APICS);
>> +
> 
> this will break non-x86. Please move this to the x86 early-irq-init 
> function instead, and also sync it up with the current NR_IRQS sizing 
> macro.
> 
> I.e. do not duplicate the numbers but introduce some sort of 
> max_nr_irqs(nr_cpus) define that is used to initialize NR_IRQS and also 
> used later on to narrow down nr_irqs later on.

The way it is laid out is:

kernel/softirq.c:

	int __init __weak early_irq_init(void)
	{
        	return 0;
	}

kernel/irq/handle.c:

	#ifdef CONFIG_SPARSE_IRQ
	:
	struct irq_desc **irq_desc_ptrs __read_mostly;
	:
	int __init early_irq_init(void)
	{
		:
		nr_irqs = ...

	#else
	:
	struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
	:
	int __init early_irq_init(void)
	{
		<don't set nr_irqs>

So I don't see an x86 specific early_irq_init.

Since NR_IRQS is defined in a lot of different ways (in different places),
I think I'll have to do something like;

arch/x86/include/asm/irq_vectors.h:
	
	#define max_nr_irqs(nr_cpus)	\

include/linux/irqnr.h:

	#ifndef max_nr_irqs
	#define max_nr_irqs(unused)	NR_IRQS
	#endif

Would that work for you?

Thanks,
Mike

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists