All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	"grant.likely@linaro.org" <grant.likely@linaro.org>,
	Yingjoe Chen <yingjoe.chen@mediatek.com>,
	Yijing Wang <wangyijing@huawei.com>
Subject: Re: [patch 07/16] genirq: Introduce helper irq_domain_set_info() to reduce duplicated code
Date: Fri, 14 Nov 2014 17:35:56 +0000	[thread overview]
Message-ID: <54663D7C.7020104@arm.com> (raw)
In-Reply-To: <546622A1.1030308@linux.intel.com>

On 14/11/14 15:41, Jiang Liu wrote:
> On 2014/11/14 23:31, Marc Zyngier wrote:
>> On 12/11/14 13:43, Thomas Gleixner wrote:
>>> From: Jiang Liu <jiang.liu@linux.intel.com>
>>>
>>> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
>>> Cc: Bjorn Helgaas <bhelgaas@google.com>
>>> Cc: Grant Likely <grant.likely@linaro.org>
>>> Cc: Marc Zyngier <marc.zyngier@arm.com>
>>> Cc: Yingjoe Chen <yingjoe.chen@mediatek.com>
>>> Cc: Yijing Wang <wangyijing@huawei.com>
>>> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
>>> ---
>>>  include/linux/irqdomain.h |    5 +++++
>>>  kernel/irq/irqdomain.c    |   10 ++++++++++
>>>  2 files changed, 15 insertions(+)
>>>
>>> Index: tip/include/linux/irqdomain.h
>>> ===================================================================
>>> --- tip.orig/include/linux/irqdomain.h
>>> +++ tip/include/linux/irqdomain.h
>>> @@ -33,6 +33,7 @@
>>>  #define _LINUX_IRQDOMAIN_H
>>>  
>>>  #include <linux/types.h>
>>> +#include <linux/irqhandler.h>
>>>  #include <linux/radix-tree.h>
>>>  
>>>  struct device_node;
>>> @@ -263,6 +264,10 @@ extern int irq_domain_set_hwirq_and_chip
>>>  					 irq_hw_number_t hwirq,
>>>  					 struct irq_chip *chip,
>>>  					 void *chip_data);
>>> +extern void irq_domain_set_info(struct irq_domain *domain, unsigned int virq,
>>> +				irq_hw_number_t hwirq, struct irq_chip *chip,
>>> +				void *chip_data, irq_flow_handler_t handler,
>>> +				void *handler_data, const char *handler_name);
>>>  extern void irq_domain_reset_irq_data(struct irq_data *irq_data);
>>>  extern void irq_domain_free_irqs_common(struct irq_domain *domain,
>>>  					int virq, int nr_irqs);
>>> Index: tip/kernel/irq/irqdomain.c
>>> ===================================================================
>>> --- tip.orig/kernel/irq/irqdomain.c
>>> +++ tip/kernel/irq/irqdomain.c
>>> @@ -882,6 +882,16 @@ int irq_domain_set_hwirq_and_chip(struct
>>>  	return 0;
>>>  }
>>>  
>>> +void irq_domain_set_info(struct irq_domain *domain, unsigned int virq,
>>> +			 irq_hw_number_t hwirq, struct irq_chip *chip,
>>> +			 void *chip_data, irq_flow_handler_t handler,
>>> +			 void *handler_data, const char *handler_name)
>>> +{
>>> +	irq_domain_set_hwirq_and_chip(domain, virq, hwirq, chip, chip_data);
>>> +	__irq_set_handler(virq, handler, 0, handler_name);
>>> +	irq_set_handler_data(virq, handler_data);
>>> +}
>>> +
>>
>> We still have the issue that, depending on where in the stack this is
>>  called, this will succeed or fail: If this is called from the inner
>> irqchip, __irq_set_handler() will fail, as it will look at the outer
>> domain as the (desc->irq_data.chip == &no_irq_chip) test fails (we
>> haven't set the top level yet).
>>
>> I have this very imperfect workaround in my tree:
>>
>> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
>> index d028b34..91e6515 100644
>> --- a/kernel/irq/chip.c
>> +++ b/kernel/irq/chip.c
>> @@ -731,7 +731,16 @@ __irq_set_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
>>  	if (!handle) {
>>  		handle = handle_bad_irq;
>>  	} else {
>> -		if (WARN_ON(desc->irq_data.chip == &no_irq_chip))
>> +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
>> +		struct irq_data *irq_data = &desc->irq_data;
>> +		while (irq_data) {
>> +			if (irq_data->chip != &no_irq_chip)
>> +				break;
>> +			irq_data = irq_data->parent_data;
>> +		}
>> +#endif
>> +
>> +		if (WARN_ON(!irq_data || irq_data->chip == &no_irq_chip))
>>  			goto out;
>>  	}
>>  
>> Which translate into: If there is at least one irqchip in the domain,
>> it will probably sort itself out. Not ideal. Any real solution to
>> this problem?
>>
>> GICv2 faces this exact problem, as some of its interrupts are used
>> directly, and some others are used through the MSI domain. In the
>> GIC driver, it is almost impossible to find out...
> Hi Marc,
> 	I prefer the above solution to relax the warning conditions.
> Changing the calling order in irq_domain_ops->alloc() looks a little
> strange, and other interrupt drivers may still run into the same issue.

OK. Where do we from from there? Do you want a proper patch, or will you
fold this into the existing code?

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...


  reply	other threads:[~2014-11-14 17:36 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-12 13:42 [patch 00/16] genirq: Hierarchical irq domains and generic MSI interrupt code Thomas Gleixner
2014-11-12 13:42 ` [patch 01/16] irqdomain: Introduce new interfaces to support hierarchy irqdomains Thomas Gleixner
2014-11-18  9:24   ` Yun Wu (Abel)
2014-11-18  9:54     ` Thomas Gleixner
2014-11-18 11:48       ` Yun Wu (Abel)
2014-11-24 12:33   ` Yun Wu (Abel)
2014-11-24 13:13     ` Thomas Gleixner
2014-11-24 14:01       ` Yun Wu (Abel)
2014-11-24 14:11         ` Jiang Liu
2014-11-24 14:19           ` Yun Wu (Abel)
2014-11-24 14:33             ` Jiang Liu
2014-11-24 14:46               ` Yun Wu (Abel)
2014-11-24 14:32         ` Thomas Gleixner
2014-11-24 14:45           ` Yun Wu (Abel)
2014-11-12 13:42 ` [patch 02/16] irqdomain: Do irq_find_mapping and set_type for hierarchy irqdomain in case OF Thomas Gleixner
2014-11-12 13:42 ` [patch 03/16] genirq: Introduce helper functions to support stacked irq_chip Thomas Gleixner
2014-11-12 13:42 ` [patch 04/16] genirq: Introduce irq_chip.irq_compose_msi_msg() to support stacked irqchip Thomas Gleixner
2014-11-18  9:26   ` Yun Wu (Abel)
2014-11-18 10:02     ` Thomas Gleixner
2014-11-18 11:47       ` Yun Wu (Abel)
2014-11-18 12:43         ` Jiang Liu
2014-11-18 13:16           ` Yun Wu (Abel)
2014-11-18 13:25             ` Jiang Liu
2014-11-18 13:48               ` Yun Wu (Abel)
2014-11-18 13:55                 ` Jiang Liu
2014-11-18 14:03                   ` Yun Wu (Abel)
2014-11-18 14:06                     ` Jiang Liu
2014-11-12 13:42 ` [patch 05/16] genirq: Add IRQ_SET_MASK_OK_DONE " Thomas Gleixner
2014-11-12 13:43 ` [patch 06/16] genirq: Split out flow handler typedefs into seperate header file Thomas Gleixner
2014-11-12 13:43 ` [patch 07/16] genirq: Introduce helper irq_domain_set_info() to reduce duplicated code Thomas Gleixner
2014-11-13  9:57   ` Yingjoe Chen
2014-11-13 10:00     ` Jiang Liu
2014-11-13 10:48       ` Marc Zyngier
2014-11-14 15:31   ` Marc Zyngier
2014-11-14 15:41     ` Jiang Liu
2014-11-14 17:35       ` Marc Zyngier [this message]
2014-11-15  1:26         ` Jiang Liu
2014-11-18  9:26   ` Yun Wu (Abel)
2014-11-18 10:03     ` Thomas Gleixner
2014-11-18 11:47       ` Yun Wu (Abel)
2014-11-18 12:38         ` Jiang Liu
2014-11-18 13:28           ` Yun Wu (Abel)
2014-11-18 13:37             ` Jiang Liu
2014-11-12 13:43 ` [patch 08/16] genirq: Introduce callback irq_chip.irq_write_msi_msg Thomas Gleixner
2014-11-18  9:26   ` Yun Wu (Abel)
2014-11-18 10:19     ` Thomas Gleixner
2014-11-18 13:33       ` Yun Wu (Abel)
2014-11-18 13:43         ` Jiang Liu
2014-11-18 13:52           ` Yun Wu (Abel)
2014-11-18 14:03             ` Jiang Liu
2014-11-18 14:15               ` Jiang Liu
2014-11-18 14:22               ` Yun Wu (Abel)
2014-11-18 14:29                 ` Jiang Liu
2014-11-18 14:46                   ` Yun Wu (Abel)
2014-11-18 17:14                     ` Marc Zyngier
2014-11-19  3:38                       ` Yun Wu (Abel)
2014-11-19  8:55                         ` Marc Zyngier
2014-11-18 14:32                 ` Thomas Gleixner
2014-11-19  6:57                   ` Yun Wu (Abel)
2014-11-19  8:02                     ` Jiang Liu
2014-11-19  9:20                     ` Marc Zyngier
2014-12-10  9:26                       ` Yun Wu (Abel)
2014-11-18 14:19             ` Thomas Gleixner
2014-11-18 14:34               ` Yun Wu (Abel)
2014-11-18 14:52                 ` Jiang Liu
2014-11-19  3:47                   ` Yun Wu (Abel)
2014-11-19 11:09                     ` Thomas Gleixner
2014-11-18 17:21                 ` Marc Zyngier
2014-11-19  3:40                   ` Yun Wu (Abel)
2014-11-19 11:11                     ` Thomas Gleixner
2014-12-10  9:11                       ` Yun Wu (Abel)
2014-12-10 10:25                         ` Thomas Gleixner
2014-12-11  3:01                           ` Yun Wu (Abel)
2014-11-18 13:51         ` Jiang Liu
2014-11-12 13:43 ` [patch 09/16] genirq: Add generic msi irq domain support Thomas Gleixner
2014-11-18 12:07   ` Yun Wu (Abel)
2014-11-18 12:49     ` Jiang Liu
2014-11-18 13:55       ` Yun Wu (Abel)
2014-11-18 14:24         ` Thomas Gleixner
2014-11-18 14:39           ` Yun Wu (Abel)
2014-11-20  2:29           ` Jiang Liu
2014-11-12 13:43 ` [patch 10/16] PCI/MSI: Move cached entry functions to irq core Thomas Gleixner
2014-11-12 13:43 ` [patch 11/16] PCI/MSI: Remove unnecessary braces around single statements Thomas Gleixner
2014-11-12 13:43 ` [patch 12/16] PCI/MSI: Simplify PCI MSI code by initializing msi_desc.nvec_used earlier Thomas Gleixner
2014-11-12 13:43 ` [patch 13/16] PCI/MSI: Kill redundant call of irq_set_msi_desc() for MSI-X interrupts Thomas Gleixner
2014-11-12 13:43 ` [patch 14/16] PCI/MSI: Rename __read_msi_msg() to __pci_read_msi_msg() Thomas Gleixner
2014-11-12 13:43 ` [patch 15/16] PCI/MSI: Rename write_msi_msg() to pci_write_msi_msg() Thomas Gleixner
2014-11-12 16:50   ` Jiang Liu
2014-11-12 13:43 ` [patch 16/16] PCI/MSI: Enhance core to support hierarchy irqdomain Thomas Gleixner
2014-11-12 15:29   ` Marc Zyngier
2014-11-12 16:43     ` Thomas Gleixner
2014-11-12 14:13 ` [patch 00/16] genirq: Hierarchical irq domains and generic MSI interrupt code Yingjoe Chen
2014-11-12 14:48   ` Thomas Gleixner
2014-11-18  9:24 ` Yun Wu (Abel)

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=54663D7C.7020104@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=bhelgaas@google.com \
    --cc=grant.likely@linaro.org \
    --cc=jiang.liu@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=wangyijing@huawei.com \
    --cc=yingjoe.chen@mediatek.com \
    /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.