All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Yinghai Lu <yinghai@kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Suresh Siddha <suresh.b.siddha@intel.com>,
	linux-kernel@vger.kernel.org,
	Jeremy Fitzhardinge <jeremy@goop.org>
Subject: Re: [PATCH  0/8] tip related: radix tree for spareseirq and logical flat clean up
Date: Sat, 13 Feb 2010 04:26:01 -0800	[thread overview]
Message-ID: <m16361pbja.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <4B7676BB.8030608@kernel.org> (Yinghai Lu's message of "Sat\, 13 Feb 2010 01\:54\:03 -0800")

Yinghai Lu <yinghai@kernel.org> writes:

> On 02/12/2010 07:44 PM, Eric W. Biederman wrote:
>> Yinghai Lu <yinghai@kernel.org> writes:
>> 
>>> ---------spareirq radix tree related ----------------
>>> 94007e8: irq: remove not need bootmem code
>>> 4b0d3fa: radix: move radix init early
>>> 56af1a9: sparseirq: change irq_desc_ptrs to static
>>> b236235: sparseirq: use radix_tree instead of ptrs array
>>> 5918787: x86: remove arch_probe_nr_irqs
>>>
>>> so could reduce nr_irqs limitation for bunch ixgbe...
>>>
>>> ---------------x86 logical flat related -----------
>>> f5954c4: use nr_cpus= to set nr_cpu_ids early
>>> 7b8d6a9: x86: use num_processors for possible cpus
>>> d79d1de: x86: make 32bit apic flat to physflat switch like 64bit
>> 
>> Thanks for keeping this work alive.
>> 
>> I just skimmed through do_IRQ and I happened to notice that
>> we have an unnecessary inefficiency that using a radix tree for
>> irq_to_desc will magnify.
>> 
>> handle_irq should take an struct irq_desc * instead of a unsigned int irq.
>> 
>> and the per cpu vector_irq array should become a per cpu vector_desc array.
>> 
>> As soon as irq_to_desc is more than &irq_desc[irq] this saves us work
>> and cache line misses  at the cost of a simple code cleanup.
>> 
>
> please check
>
> Subject: [PATCH] x86: use vector_desc instead of vector_irq
>
> Eric pointed out that radix tree version of irq_to_desc will magnify delay on the path
> of handle_irq.
> use vector_desc to reduce the calling of irq_to_desc.
>
> next step: need to change all ack, mask, umask, eoi for all irq_chip to take irq_desc

Overall this looks good, and your next step sounds good.

Thanks,
Eric


> Index: linux-2.6/arch/x86/kernel/irq_32.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/irq_32.c
> +++ linux-2.6/arch/x86/kernel/irq_32.c
> @@ -192,17 +192,17 @@ static inline int
>  execute_on_irq_stack(int overflow, struct irq_desc *desc, int irq) { return 0; }
>  #endif
>  
> -bool handle_irq(unsigned irq, struct pt_regs *regs)
> +bool handle_irq(struct irq_desc *desc, struct pt_regs *regs)
>  {
> -	struct irq_desc *desc;
>  	int overflow;
> +	int irq;

This should be:
	unsigned irq;

irq numbers are unsigned, and with sparse allocation we might even see irq
numbers large enough for that to matter.

>  	overflow = check_stack_overflow();
>  
> -	desc = irq_to_desc(irq);
>  	if (unlikely(!desc))
>  		return false;
>  
> +	irq = desc->irq;
>  	if (!execute_on_irq_stack(overflow, desc, irq)) {
>  		if (unlikely(overflow))
>  			print_stack_overflow();

> Index: linux-2.6/arch/x86/kernel/irqinit.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/irqinit.c
> +++ linux-2.6/arch/x86/kernel/irqinit.c
> @@ -83,16 +83,14 @@ static struct irqaction irq2 = {
>  	.name = "cascade",
>  };
>  
> -DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
> -	[0 ... NR_VECTORS - 1] = -1,
> -};
> +DEFINE_PER_CPU(vector_desc_t, vector_desc);
>  
>  int vector_used_by_percpu_irq(unsigned int vector)
>  {
>  	int cpu;
>  
>  	for_each_online_cpu(cpu) {
> -		if (per_cpu(vector_irq, cpu)[vector] != -1)
> +		if (per_cpu(vector_desc, cpu)[vector] != NULL)
>  			return 1;
>  	}
>  
> @@ -139,7 +137,7 @@ void __init init_IRQ(void)
>  	 * irq's migrate etc.
>  	 */
>  	for (i = 0; i < nr_legacy_irqs; i++)
> -		per_cpu(vector_irq, 0)[IRQ0_VECTOR + i] = i;
> +		per_cpu(vector_desc, 0)[IRQ0_VECTOR + i] = irq_to_desc(i);

I am not familiar with this hunk (it must be in the x86 tree).
Are you certain we have allocated the legacy irq desc here?

>  	x86_init.irqs.intr_init();
>  }

  parent reply	other threads:[~2010-02-13 12:26 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-13  2:49 [PATCH 0/8] tip related: radix tree for spareseirq and logical flat clean up Yinghai Lu
2010-02-13  2:49 ` [PATCH 1/8] irq: remove not need bootmem code Yinghai Lu
2010-02-13  2:49 ` [PATCH 2/8] radix: move radix init early Yinghai Lu
2010-02-13  2:49 ` [PATCH 3/8] sparseirq: change irq_desc_ptrs to static Yinghai Lu
2010-02-13  2:49 ` [PATCH 4/8] sparseirq: use radix_tree instead of ptrs array Yinghai Lu
2010-02-13  2:49 ` [PATCH 5/8] x86: remove arch_probe_nr_irqs Yinghai Lu
2010-02-13  2:49 ` [PATCH 6/8] use nr_cpus= to set nr_cpu_ids early Yinghai Lu
2010-02-13  2:49 ` [PATCH 7/8] x86: use num_processors for possible cpus Yinghai Lu
2010-02-13  2:49 ` [PATCH 8/8] x86: make 32bit apic flat to physflat switch like 64bit Yinghai Lu
2010-02-13  3:44 ` [PATCH 0/8] tip related: radix tree for spareseirq and logical flat clean up Eric W. Biederman
2010-02-13  3:49   ` H. Peter Anvin
2010-02-13  4:17     ` Eric W. Biederman
2010-02-13 22:12       ` Jeremy Fitzhardinge
2010-02-13 22:26         ` Eric W. Biederman
2010-02-13  9:54   ` Yinghai Lu
2010-02-13 11:39     ` Eric W. Biederman
2010-02-13 12:04     ` Eric W. Biederman
2010-02-13 22:40       ` Yinghai Lu
2010-02-13 23:14         ` Eric W. Biederman
2010-02-13 23:59           ` Yinghai Lu
2010-02-14  0:30             ` Eric W. Biederman
2010-02-14  0:49               ` Yinghai Lu
2010-02-18  2:49               ` [PATCH 1/3] xen: Remove unnecessary arch specific xen irq functions Yinghai Lu
2010-02-19  1:36                 ` [tip:x86/irq] " tip-bot for Eric W. Biederman
     [not found]               ` <4B7CA9A1.3020806@kernel.org>
2010-02-18  2:49                 ` [PATCH 0/3] radix tree spareirq addon cleanup Yinghai Lu
2010-02-18  2:50                 ` [PATCH 2/3] x86: use vector_desc instead of vector_irq Yinghai Lu
2010-02-18 17:22                   ` Eric W. Biederman
2010-02-23  6:39                     ` [PATCH -v3 1/2] " Yinghai Lu
2010-02-23  6:44                       ` [PATCH -v2 2/2] genericirq: change ack/mask in irq_chip to take irq_desc instead of irq Yinghai Lu
2010-02-24 21:36                         ` Eric W. Biederman
2010-02-24 22:07                           ` Yinghai Lu
2010-02-25  0:22                             ` Stephen Rothwell
2010-03-02 14:58                           ` Thomas Gleixner
2010-03-03  8:49                             ` Yinghai Lu
2010-03-03 10:26                               ` Thomas Gleixner
     [not found]                       ` <4B84F013.9040708@kernel.org>
2010-02-24  9:26                         ` [PATCH -v3 " Yinghai Lu
2010-02-24  9:27                       ` [PATCH -v4 1/2] x86: use vector_desc instead of vector_irq Yinghai Lu
2010-02-18  2:50                 ` [RFC PATCH 3/3] genericirq: change ack/mask in irq_chip to take irq_desc in addition to irq Yinghai Lu
2010-02-18 17:04                   ` Eric W. Biederman
2010-02-18 17:13                     ` H. Peter Anvin
2010-02-18 19:51                       ` Yinghai Lu
2010-02-13 12:26     ` Eric W. Biederman [this message]
2010-02-13 22:36       ` [PATCH 0/8] tip related: radix tree for spareseirq and logical flat clean up Yinghai Lu

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=m16361pbja.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=yinghai@kernel.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.