mirror of https://lore.kernel.org/lkml/
 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>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Suresh Siddha <suresh.b.siddha@intel.com>,
	linux-kernel@vger.kernel.org,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	linux-arch@vger.kernel.org
Subject: Re: [PATCH -v2 2/2] genericirq: change ack/mask in irq_chip to take irq_desc instead of irq
Date: Wed, 24 Feb 2010 13:36:49 -0800	[thread overview]
Message-ID: <m1ljei5n9q.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <4B837930.2050907@kernel.org>

Yinghai Lu <yinghai@kernel.org> writes:

> will have
> void            (*ack)(struct irq_desc *desc);
> void            (*mask)(struct irq_desc *desc);
> void            (*mask_ack)(struct irq_desc *desc);
> void            (*unmask)(struct irq_desc *desc);
> void            (*eoi)(struct irq_desc *desc);
>
> so for sparseirq with raidix tree, we don't call extra irq_to_desc, and could use desc directly

Overall this looks pretty decent.  This look pretty complete.
How many platforms did you manage to compile test this on?

I have found a couple of issues (see below).

A few times you change a bit more than is necessary which is a bit
spooky in a patch this far ranging.

Reading through this patch to review it took an uncomfortably long
time.


> -v2: change all member of irq_chip to use desc only.
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>

> Index: linux-2.6/arch/alpha/kernel/sys_rx164.c
> ===================================================================
> --- linux-2.6.orig/arch/alpha/kernel/sys_rx164.c
> +++ linux-2.6/arch/alpha/kernel/sys_rx164.c
>  static void
> -rx164_end_irq(unsigned int irq)
> +rx164_end_irq(struct irq_desc *desc)
>  {
> -	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
> -		rx164_enable_irq(irq);
> +	if (!(desc_.status & (IRQ_DISABLED|IRQ_INPROGRESS)))
> +		rx164_enable_irq(desc);
>  }

You have mispelled desc-> here.

> Index: linux-2.6/arch/arm/mach-s3c2410/bast-irq.c
> ===================================================================
> --- linux-2.6.orig/arch/arm/mach-s3c2410/bast-irq.c
> +++ linux-2.6/arch/arm/mach-s3c2410/bast-irq.c
> @@ -75,31 +75,31 @@ static unsigned char bast_pc104_irqmasks
>  
>  static void
> -bast_pc104_maskack(unsigned int irqno)
> +bast_pc104_maskack(struct irq_desc *desc)
>  {
> -	struct irq_desc *desc = irq_desc + IRQ_ISA;
> -
> -	bast_pc104_mask(irqno);
> -	desc->chip->ack(IRQ_ISA);
> +	bast_pc104_mask(desc);
> +	desc->chip->ack(desc);
>  }

This is not a trivial 1 to 1 conversion.  IRQ_ISA != irqno.
I don't know if the original code is broken here or
just very peculiar.

>  static struct irq_chip s3c_irq_cam = {
> Index: linux-2.6/arch/arm/plat-s3c64xx/irq-eint.c
> ===================================================================
> --- linux-2.6.orig/arch/arm/plat-s3c64xx/irq-eint.c
> +++ linux-2.6/arch/arm/plat-s3c64xx/irq-eint.c

> -static void s3c_irq_eint_maskack(unsigned int irq)
> +static void s3c_irq_eint_maskack(struct irq_desc *desc)
>  {
> +	unsigned int irq = desc->irq;
>  	/* compiler should in-line these */
> -	s3c_irq_eint_mask(irq);
> -	s3c_irq_eint_ack(irq);
> +	s3c_irq_eint_mask(irq, desc);
> +	s3c_irq_eint_ack(irq, desc);
>  }

It appears this function has the wrong conversion.

> Index: linux-2.6/arch/blackfin/mach-common/ints-priority.c
> ===================================================================
> --- linux-2.6.orig/arch/blackfin/mach-common/ints-priority.c
> +++ linux-2.6/arch/blackfin/mach-common/ints-priority.c
> @@ -925,7 +938,7 @@ static void bfin_demux_gpio_irq(unsigned
>  static struct irq_chip bfin_gpio_irqchip = {
>  	.name = "GPIO",
>  	.ack = bfin_gpio_ack_irq,
> -	.mask = bfin_gpio_mask_irq,
> +	.mask = bfin_gpio_mask_irq_desc,

You have not introduced bfin_gpio_mask_irq_desc ...

>  	.mask_ack = bfin_gpio_mask_ack_irq,
>  	.unmask = bfin_gpio_unmask_irq,
>  	.disable = bfin_gpio_mask_irq,

> Index: linux-2.6/arch/ia64/kernel/iosapic.c
> ===================================================================
> --- linux-2.6.orig/arch/ia64/kernel/iosapic.c
> +++ linux-2.6/arch/ia64/kernel/iosapic.c
> @@ -267,6 +267,10 @@ static void
>  nop (unsigned int irq)
>  {
>  	/* do nothing... */
> +static void
> +nop_desc(struct irq_desc *desc)
> +{
> +	/* do nothing... */
>  }

Two things here.  
- nop has no closing brace.
- You should just be able to convert nop here, and not
  need to introduce nop_desc.

>  #define iosapic_shutdown_level_irq	mask_irq
>  #define iosapic_enable_level_irq	unmask_irq
>  #define iosapic_disable_level_irq	mask_irq
> -#define iosapic_ack_level_irq		nop
> +#define iosapic_ack_level_irq		nop_desc

Making this change unnecessary.

>  #define iosapic_enable_edge_irq		unmask_irq
>  #define iosapic_disable_edge_irq	nop
> -#define iosapic_end_edge_irq		nop
> +#define iosapic_end_edge_irq		nop_desc

and this change unnecessary.

>  
>  static struct irq_chip irq_type_iosapic_edge = {
>  	.name =		"IO-SAPIC-edge",

> Index: linux-2.6/arch/m68knommu/platform/coldfire/intc-simr.c
> ===================================================================
> --- linux-2.6.orig/arch/m68knommu/platform/coldfire/intc-simr.c
> +++ linux-2.6/arch/m68knommu/platform/coldfire/intc-simr.c
> @@ -40,6 +42,7 @@ static void intc_irq_unmask(unsigned int
>  
>  static int intc_irq_set_type(unsigned int irq, unsigned int type)
>  {
> +	unsigned int irq = desc->irq;

This function does not take a desc argument.

>  	if (irq >= MCFINT_VECBASE) {
>  		if (irq < MCFINT_VECBASE + 64)
>  			__raw_writeb(5, MCFINTC0_ICR0 + irq - MCFINT_VECBASE);

> Index: linux-2.6/arch/mips/alchemy/common/irq.c
> ===================================================================
> --- linux-2.6.orig/arch/mips/alchemy/common/irq.c
> +++ linux-2.6/arch/mips/alchemy/common/irq.c
> @@ -288,17 +288,19 @@ void restore_au1xxx_intctl(void)
>  #endif /* CONFIG_PM */
>  
>  
> -static void au1x_ic0_unmask(unsigned int irq_nr)
> +static void au1x_ic0_unmask(struct irq_desc *desc)
>  {
> -	unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE;
> +	unsigned int irq = desc->irq;
> +	unsigned int bit = irq_ - AU1000_INTC0_INT_BASE;

You misspelled irq there.

>  	au_writel(1 << bit, IC0_MASKSET);
>  	au_writel(1 << bit, IC0_WAKESET);
>  	au_sync();
>  }
>  

> Index: linux-2.6/arch/mips/bcm63xx/irq.c
> ===================================================================
> --- linux-2.6.orig/arch/mips/bcm63xx/irq.c
> +++ linux-2.6/arch/mips/bcm63xx/irq.c
> @@ -75,8 +75,9 @@ asmlinkage void plat_irq_dispatch(void)
>   * internal IRQs operations: only mask/unmask on PERF irq mask
>   * register.
>   */
> -static inline void bcm63xx_internal_irq_mask(unsigned int irq)
> +static inline void bcm63xx_internal_irq_mask(struct irq_desc *desc)
>  {
> +	unsigned int irq = desc->irq;
>  	u32 mask;
>  
>  	irq -= IRQ_INTERNAL_BASE;
> @@ -84,9 +85,15 @@ static inline void bcm63xx_internal_irq_
>  	mask &= ~(1 << irq);
>  	bcm_perf_writel(mask, PERF_IRQMASK_REG);
>  }
> +static void
> +bcm63xx_internal_irq_mask_desc(struct irq_desc *desc)
> +{
> +	bcm63xx_internal_irq_mask(desc);
> +}

You have converted bcm63xx_internal_irq_mask making bcm63xx_internal_irq_mask_desc
unnecessary.

> @@ -213,8 +225,8 @@ static struct irq_chip bcm63xx_internal_
>  	.startup	= bcm63xx_internal_irq_startup,
>  	.shutdown	= bcm63xx_internal_irq_mask,
>  
> -	.mask		= bcm63xx_internal_irq_mask,
> -	.mask_ack	= bcm63xx_internal_irq_mask,
> +	.mask		= bcm63xx_internal_irq_mask_desc,
> +	.mask_ack	= bcm63xx_internal_irq_mask_desc,
>  	.unmask		= bcm63xx_internal_irq_unmask,
>  };

These changes are also unnecessary.

> Index: linux-2.6/arch/mips/sni/pcimt.c
> ===================================================================
> --- linux-2.6.orig/arch/mips/sni/pcimt.c
> +++ linux-2.6/arch/mips/sni/pcimt.c

> -static void end_pcimt_irq(unsigned int irq)
> -{
> -	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
> -		enable_pcimt_irq(irq);
> +static void end_pcimt_irq(struct irq_desc *desc)
> +
> +	if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
> +		enable_pcimt_irq(desc);
>  }

You have deleted the starting brace of the function....

> Index: linux-2.6/arch/powerpc/platforms/cell/axon_msi.c
> ===================================================================
> --- linux-2.6.orig/arch/powerpc/platforms/cell/axon_msi.c
> +++ linux-2.6/arch/powerpc/platforms/cell/axon_msi.c
> @@ -308,10 +308,15 @@ static void axon_msi_teardown_msi_irqs(s
>  	}
>  }
>  
> +static void axon_unmask_msi_irq(struct irq_desc *desc)
> +{
> +	unmask_msi_irq(desc);
> +}
> +
>  static struct irq_chip msic_irq_chip = {
>  	.mask		= mask_msi_irq,
>  	.unmask		= unmask_msi_irq,
> -	.shutdown	= unmask_msi_irq,
> +	.shutdown	= axon_unmask_msi_irq,
>  	.name		= "AXON-MSI",
>  };

This pair of changes is unnecessary.


> Index: linux-2.6/arch/powerpc/sysdev/mpic_u3msi.c
> ===================================================================
> --- linux-2.6.orig/arch/powerpc/sysdev/mpic_u3msi.c
> +++ linux-2.6/arch/powerpc/sysdev/mpic_u3msi.c
> @@ -23,20 +23,25 @@
>  /* A bit ugly, can we get this from the pci_dev somehow? */
>  static struct mpic *msi_mpic;
>  
> -static void mpic_u3msi_mask_irq(unsigned int irq)
> +static void mpic_u3msi_mask_irq(struct irq_desc *desc)
>  {
> -	mask_msi_irq(irq);
> -	mpic_mask_irq(irq);
> +	mask_msi_irq(desc);
> +	mpic_mask_irq(desc);
>  }
>  
> -static void mpic_u3msi_unmask_irq(unsigned int irq)
> +static void mpic_u3msi_shutdown_irq(struct irq_desc *desc)
>  {
> -	mpic_unmask_irq(irq);
> -	unmask_msi_irq(irq);
> +	mpic_u3msi_mask_irq(desc);
> +}
> +
> +static void mpic_u3msi_unmask_irq(struct irq_desc *desc)
> +{
> +	mpic_unmask_irq(desc);
> +	unmask_msi_irq(desc);
>  }
>  
>  static struct irq_chip mpic_u3msi_chip = {
> -	.shutdown	= mpic_u3msi_mask_irq,
> +	.shutdown	= mpic_u3msi_shutdown_irq,
>  	.mask		= mpic_u3msi_mask_irq,
>  	.unmask		= mpic_u3msi_unmask_irq,
>  	.eoi		= mpic_end_irq,

This change to add a new mpic_u3msi_shutdow_irq appears harmless, but
it is confusing and unnecessary.


> Index: linux-2.6/arch/sparc/kernel/pci_msi.c
> ===================================================================
> --- linux-2.6.orig/arch/sparc/kernel/pci_msi.c
> +++ linux-2.6/arch/sparc/kernel/pci_msi.c
> @@ -111,12 +111,21 @@ static void free_msi(struct pci_pbm_info
>  	clear_bit(msi_num, pbm->msi_bitmap);
>  }
>  
> +static void sparc64_enable_msi_irq(struct irq_desc *desc)
> +{
> +	unmask_msi_irq(desc);
> +}
> +static void sparc64_diable_msi_irq(struct irq_desc *desc)
> +{
> +	mask_msi_irq(desc);
> +}
> +
>  static struct irq_chip msi_irq = {
>  	.name		= "PCI-MSI",
>  	.mask		= mask_msi_irq,
>  	.unmask		= unmask_msi_irq,
> -	.enable		= unmask_msi_irq,
> -	.disable	= mask_msi_irq,
> +	.enable		= sparc64_enable_msi_irq,
> +	.disable	= sparc64_disable_msi_irq,
>  	/* XXX affinity XXX */
>  };

Ouch! this hunk is unnecessary.

> Index: linux-2.6/drivers/xen/events.c
> ===================================================================
> --- linux-2.6.orig/drivers/xen/events.c
> +++ linux-2.6/drivers/xen/events.c
> @@ -748,35 +748,46 @@ int resend_irq_on_evtchn(unsigned int ir
>  	return 1;
>  }
>  
> -static void enable_dynirq(unsigned int irq)
> +static void enable_dynirq(struct irq_desc *desc)
>  {
> -	int evtchn = evtchn_from_irq(irq);
> +	int evtchn = evtchn_from_irq(desc->irq);
>  
>  	if (VALID_EVTCHN(evtchn))
>  		unmask_evtchn(evtchn);
>  }
>  
> -static void disable_dynirq(unsigned int irq)
> +static void unmask_dynirq(struct irq_desc *desc)
>  {
> -	int evtchn = evtchn_from_irq(irq);
> +	enable_dynirq(desc);
> +}
> +

Introducing disable_dynirq, and  mask_dynirq for xen is unnecessary.

> +static void disable_dynirq(struct irq_desc *desc)
> +{
> +	int evtchn = evtchn_from_irq(desc->irq);
>  
>  	if (VALID_EVTCHN(evtchn))
>  		mask_evtchn(evtchn);
>  }
>  
> -static void ack_dynirq(unsigned int irq)
> +static void mask_dynirq(struct irq_desc *desc)
>  {
> -	int evtchn = evtchn_from_irq(irq);
> +	disable_dynirq(desc);
> +}
> +
> +static void ack_dynirq(struct irq_desc *desc)
> +{
> +	int evtchn = evtchn_from_irq(desc->irq);
>  
> -	move_native_irq(irq);
> +	move_native_irq(desc);
>  
>  	if (VALID_EVTCHN(evtchn))
>  		clear_evtchn(evtchn);
>  }
>  
> -static int retrigger_dynirq(unsigned int irq)
> +static int retrigger_dynirq(struct irq_desc *desc)
>  {
> -	int evtchn = evtchn_from_irq(irq);
> +	int evtchn = evtchn_from_irq(desc->irq);
>  	struct shared_info *sh = HYPERVISOR_shared_info;
>  	int ret = 0;
>  
> @@ -924,10 +935,11 @@ static struct irq_chip xen_dynamic_chip
>  	.name		= "xen-dyn",
>  
>  	.disable	= disable_dynirq,
> -	.mask		= disable_dynirq,
> -	.unmask		= enable_dynirq,
>  
> +	.mask		= mask_dynirq,
> +	.unmask		= unmask_dynirq,
>  	.ack		= ack_dynirq,
> +
>  	.set_affinity	= set_affinity_irq,
>  	.retrigger	= retrigger_dynirq,
>  };


> Index: linux-2.6/include/linux/htirq.h
> ===================================================================
> --- linux-2.6.orig/include/linux/htirq.h
> +++ linux-2.6/include/linux/htirq.h
> @@ -7,16 +7,17 @@ struct ht_irq_msg {
>  };
>  
>  /* Helper functions.. */
> -void fetch_ht_irq_msg(unsigned int irq, struct ht_irq_msg *msg);
> -void write_ht_irq_msg(unsigned int irq, struct ht_irq_msg *msg);
> -void mask_ht_irq(unsigned int irq);
> -void unmask_ht_irq(unsigned int irq);
> +struct irq_desc;
> +void fetch_ht_irq_msg(struct irq_desc *desc, struct ht_irq_msg *msg);
> +void write_ht_irq_msg(struct irq_desc *desc, struct ht_irq_msg *msg);
> +void mask_ht_irq(struct irq_desc *);
> +void unmask_ht_irq(struct irq_desc *);
>  
>  /* The arch hook for getting things started */
>  int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev);
>  
>  /* For drivers of buggy hardware */
> -typedef void (ht_irq_update_t)(struct pci_dev *dev, int irq,
> +typedef void (ht_irq_update_t)(struct pci_dev *dev, struct irq_desc *desc,
>  			       struct ht_irq_msg *msg);

The corresponding update to drivers/infiniband/hw/ipath/ipath_iba6110.c
is missing from your patch.

>  int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update);

> Index: linux-2.6/kernel/irq/chip.c
> ===================================================================
> --- linux-2.6.orig/kernel/irq/chip.c
> +++ linux-2.6/kernel/irq/chip.c
> @@ -131,7 +131,7 @@ int set_irq_chip(unsigned int irq, struc
>  	unsigned long flags;
>  
>  	if (!desc) {
> -		WARN(1, KERN_ERR "Trying to install chip for IRQ%d\n", irq);
> +		WARN(1, KERN_ERR "Trying to install chip for IRQ\n");
>  		return -EINVAL;

We still have an irq value here so this change is wrong.

> @@ -657,7 +651,7 @@ __set_irq_handler(unsigned int irq, irq_
>  
>  	if (!desc) {
>  		printk(KERN_ERR
> -		       "Trying to install type control for IRQ%d\n", irq);
> +		       "Trying to install type control for IRQ\n");

Again we still have an irq value here, so we should not remove it from
the printk.


  reply	other threads:[~2010-02-24 21:38 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 [this message]
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     ` [PATCH 0/8] tip related: radix tree for spareseirq and logical flat clean up Eric W. Biederman
2010-02-13 22:36       ` 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=m1ljei5n9q.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=jeremy@goop.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rusty@rustcorp.com.au \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®