All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] irq: sparseirq enabling v3
Date: Fri, 28 Nov 2008 17:34:56 +0100	[thread overview]
Message-ID: <20081128163456.GB10487@elte.hu> (raw)
In-Reply-To: <492E0540.9010009@kernel.org>


* Yinghai Lu <yinghai@kernel.org> wrote:

> +void __init arch_early_irq_init(void)
>  {
> -	return irq < nr_irqs ? irq_cfgx + irq : NULL;
> +	struct irq_cfg *cfg;
> +	struct irq_desc *desc;
> +	int count;
> +	int i;
> +#ifdef CONFIG_SPARSE_IRQ
> +	int count_desc = NR_IRQS_LEGACY;
> +#else
> +	int count_desc = NR_IRQS;
> +#endif

could this be hidden in a .h file by creating some sort of nr_boot_irqs() 
inline, or a NR_BOOT_IRQS define?

> Index: linux-2.6/drivers/char/random.c
> ===================================================================
> --- linux-2.6.orig/drivers/char/random.c
> +++ linux-2.6/drivers/char/random.c
> @@ -558,6 +558,8 @@ struct timer_rand_state {
>  	unsigned dont_count_entropy:1;
>  };
>  
> +#ifndef CONFIG_SPARSE_IRQ
> +
>  static struct timer_rand_state *irq_timer_state[NR_IRQS];
>  
>  static struct timer_rand_state *get_timer_rand_state(unsigned int irq)
> @@ -576,6 +578,33 @@ static void set_timer_rand_state(unsigne
>  	irq_timer_state[irq] = state;
>  }
>  
> +#else
> +
> +static struct timer_rand_state *get_timer_rand_state(unsigned int irq)
> +{
> +	struct irq_desc *desc;
> +
> +	desc = irq_to_desc(irq);
> +
> +	if (!desc)
> +		return NULL;
> +
> +	return desc->timer_rand_state;
> +}
> +
> +static void set_timer_rand_state(unsigned int irq, struct timer_rand_state *state)
> +{
> +	struct irq_desc *desc;
> +
> +	desc = irq_to_desc(irq);
> +
> +	if (!desc)
> +		return;
> +
> +	desc->timer_rand_state = state;
> +}
> +#endif

i'd suggest to move this into a .h file.

> +++ linux-2.6/fs/proc/stat.c
> @@ -27,6 +27,9 @@ static int show_stat(struct seq_file *p,
>  	u64 sum = 0;
>  	struct timespec boottime;
>  	unsigned int per_irq_sum;
> +#ifdef CONFIG_GENERIC_HARDIRQS
> +	struct irq_desc *desc;
> +#endif

Why is this define needed? If it's about a build warning, you can add 
something like this to defines:

 (void)(param)

to make unused parameters used as well.

> +#ifdef CONFIG_SPARSE_IRQ
> +		seq_printf(p, " %d:%u", j, per_irq_sum);
> +#else
>  		seq_printf(p, " %u", per_irq_sum);
> -	}
> +#endif

doesnt this change the /proc ABI ? A couple of tools would break. I think 
the right approach is to go from 0 to NR_IRQS-1 and print zeroes for NULL 
descs. I.e. a natural extension of the current scheme.

> +++ linux-2.6/fs/proc/interrupts.c
> @@ -8,6 +8,23 @@
>  /*
>   * /proc/interrupts
>   */
> +#ifdef CONFIG_SPARSE_IRQ
> +static void *int_seq_start(struct seq_file *f, loff_t *pos)
> +{
> +	rcu_read_lock();
> +	return seq_list_start(&sparse_irqs_head, *pos);

is this rcu-safe approach still needed?

> ===================================================================
> --- linux-2.6.orig/include/linux/interrupt.h
> +++ linux-2.6/include/linux/interrupt.h
> @@ -18,6 +18,8 @@
>  #include <asm/ptrace.h>
>  #include <asm/system.h>
>  
> +extern int nr_irqs;

isnt this obsolete now?

> Index: linux-2.6/arch/x86/kernel/irq.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/irq.c
> +++ linux-2.6/arch/x86/kernel/irq.c
> @@ -99,25 +99,37 @@ static int show_other_interrupts(struct
>  int show_interrupts(struct seq_file *p, void *v)
>  {
>  	unsigned long flags, any_count = 0;
> -	int i = *(loff_t *) v, j;
> +	int i, j;
>  	struct irqaction *action;
>  	struct irq_desc *desc;
> +	int head = 0;
>  
> +#ifdef CONFIG_SPARSE_IRQ
> +	desc = list_entry(v, struct irq_desc, list);
> +	i = desc->irq;
> +	if (&desc->list == sparse_irqs_head.next)
> +		head = 1;
> +#else
> +	i = *(loff_t *) v;
>  	if (i > nr_irqs)
>  		return 0;
>  
>  	if (i == nr_irqs)
>  		return show_other_interrupts(p);
> +	if (i == 0)
> +		head = 1;
> +
> +	desc = irq_to_desc(i);
> +#endif

i dont think this has to change? We have an array of pointers, and we 
should extend the current loops by skipping over NULL entries.

	Ingo

  parent reply	other threads:[~2008-11-28 16:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-24  2:59 [PATCH 1/2] irq: sparseirq enabling Yinghai Lu
2008-11-24 14:40 ` Ingo Molnar
2008-11-24 19:22   ` Yinghai Lu
2008-11-24 22:26     ` Thomas Gleixner
2008-11-25  3:57   ` [PATCH 1/2] irq: sparseirq enabling v2 Yinghai Lu
2008-11-25  3:58     ` [PATCH 2/2] irq: move irq_desc according to smp_affinity v2 Yinghai Lu
2008-11-26  7:48     ` [PATCH 1/2] irq: sparseirq enabling v2 Ingo Molnar
2008-11-26  8:02       ` Yinghai Lu
2008-11-26  8:17         ` Ingo Molnar
2008-11-26 18:33           ` Yinghai Lu
2008-11-27  2:26           ` [PATCH 1/2] irq: sparseirq enabling v3 Yinghai Lu
2008-11-27  2:26             ` [PATCH 2/2] irq: move irq_desc according to smp_affinity v3 Yinghai Lu
2008-11-28 16:34             ` Ingo Molnar [this message]
2008-11-29  7:13               ` [PATCH] irq: sparseirq enabling v4 Yinghai Lu
2008-11-29 10:02                 ` Ingo Molnar
2008-11-29 10:26                   ` Ingo Molnar
2008-12-01  4:44                     ` [PATCH] irq: sparse irq_desc[] support - fix Yinghai Lu
2008-11-29 10:57                   ` [PATCH] irq: sparseirq enabling v4 Sam Ravnborg
2008-11-29 14:33                     ` Ingo Molnar
2008-11-29 17:54                       ` Sam Ravnborg

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=20081128163456.GB10487@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --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.