diff mbox

[Part2,v4,20/31] PCI/MSI: Kill redundant calling for irq_set_msi_desc() for MSIx interrupts

Message ID 1415102525-9898-21-git-send-email-jiang.liu@linux.intel.com
State Not Applicable
Headers show

Commit Message

Jiang Liu Nov. 4, 2014, 12:01 p.m. UTC
It's arch_setup_msi_irq()/arch_setup_msi_irqs()'s responsibility to call
irq_set_msi_desc() to associate IRQ descriptors and MSI descriptors,
so kill the redundant call of irq_set_msi_desc() for MSIx interrupts
in PCI MSI core.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
 drivers/pci/msi.c |    1 -
 1 file changed, 1 deletion(-)

Comments

Bjorn Helgaas Nov. 5, 2014, 10:45 p.m. UTC | #1
On Tue, Nov 04, 2014 at 08:01:54PM +0800, Jiang Liu wrote:
> It's arch_setup_msi_irq()/arch_setup_msi_irqs()'s responsibility to call
> irq_set_msi_desc() to associate IRQ descriptors and MSI descriptors,
> so kill the redundant call of irq_set_msi_desc() for MSIx interrupts
> in PCI MSI core.

"MSI-X" in English text, "msix" in code.

The default arch_setup_msi_irq() in drivers/pci/msi.c doesn't call
irq_set_msi_desc().  Does it happen somewhere inside chip->setup_irq()?

I don't know how to verify that there are calls in all the places needed.
That makes me wonder if the factoring is wrong -- maybe irq_set_msi_desc()
could be done in some common place.

> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
> ---
>  drivers/pci/msi.c |    1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index afe974600c7d..da181c59394b 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -685,7 +685,6 @@ static void msix_program_entries(struct pci_dev *dev,
>  						PCI_MSIX_ENTRY_VECTOR_CTRL;
>  
>  		entries[i].vector = entry->irq;
> -		irq_set_msi_desc(entry->irq, entry);
>  		entry->masked = readl(entry->mask_base + offset);
>  		msix_mask_irq(entry, 1);
>  		i++;
> -- 
> 1.7.10.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yijing Wang Nov. 6, 2014, 1:32 a.m. UTC | #2
On 2014/11/6 6:45, Bjorn Helgaas wrote:
> On Tue, Nov 04, 2014 at 08:01:54PM +0800, Jiang Liu wrote:
>> It's arch_setup_msi_irq()/arch_setup_msi_irqs()'s responsibility to call
>> irq_set_msi_desc() to associate IRQ descriptors and MSI descriptors,
>> so kill the redundant call of irq_set_msi_desc() for MSIx interrupts
>> in PCI MSI core.
> 
> "MSI-X" in English text, "msix" in code.
> 
> The default arch_setup_msi_irq() in drivers/pci/msi.c doesn't call
> irq_set_msi_desc().  Does it happen somewhere inside chip->setup_irq()?

Yes.

I also found this.
http://www.spinics.net/lists/linux-pci/msg34256.html

> 
> I don't know how to verify that there are calls in all the places needed.
> That makes me wonder if the factoring is wrong -- maybe irq_set_msi_desc()
> could be done in some common place.

In my idea, place the irq_set_msi_desc() in common MSI core is ok, but currently almost
all MSI arch code call irq_set_msi_desc() in arch code. So a lot of code need to change.
And arch code setup MSI and MSI-X in the same way, so if MSI work happy without irq_set_msi_desc(entry->irq, entry)
in common MSI code, MSI-X should be the same.

> 
>> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
>> ---
>>  drivers/pci/msi.c |    1 -
>>  1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
>> index afe974600c7d..da181c59394b 100644
>> --- a/drivers/pci/msi.c
>> +++ b/drivers/pci/msi.c
>> @@ -685,7 +685,6 @@ static void msix_program_entries(struct pci_dev *dev,
>>  						PCI_MSIX_ENTRY_VECTOR_CTRL;
>>  
>>  		entries[i].vector = entry->irq;
>> -		irq_set_msi_desc(entry->irq, entry);
>>  		entry->masked = readl(entry->mask_base + offset);
>>  		msix_mask_irq(entry, 1);
>>  		i++;
>> -- 
>> 1.7.10.4
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> .
>
Bjorn Helgaas Nov. 6, 2014, 4:04 a.m. UTC | #3
On Wed, Nov 5, 2014 at 6:32 PM, Yijing Wang <wangyijing@huawei.com> wrote:
> On 2014/11/6 6:45, Bjorn Helgaas wrote:
>> On Tue, Nov 04, 2014 at 08:01:54PM +0800, Jiang Liu wrote:
>>> It's arch_setup_msi_irq()/arch_setup_msi_irqs()'s responsibility to call
>>> irq_set_msi_desc() to associate IRQ descriptors and MSI descriptors,
>>> so kill the redundant call of irq_set_msi_desc() for MSIx interrupts
>>> in PCI MSI core.
>>
>> "MSI-X" in English text, "msix" in code.
>>
>> The default arch_setup_msi_irq() in drivers/pci/msi.c doesn't call
>> irq_set_msi_desc().  Does it happen somewhere inside chip->setup_irq()?
>
> Yes.
>
> I also found this.
> http://www.spinics.net/lists/linux-pci/msg34256.html

Yes, and I asked the same question then :)

It's just impractical to review things like this that make assumptions
about lots of code scattered all over the place with no direct linkage
to the change.

Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiang Liu Nov. 6, 2014, 4:31 a.m. UTC | #4
On 2014/11/6 9:32, Yijing Wang wrote:
> On 2014/11/6 6:45, Bjorn Helgaas wrote:
>> On Tue, Nov 04, 2014 at 08:01:54PM +0800, Jiang Liu wrote:
>>> It's arch_setup_msi_irq()/arch_setup_msi_irqs()'s responsibility to call
>>> irq_set_msi_desc() to associate IRQ descriptors and MSI descriptors,
>>> so kill the redundant call of irq_set_msi_desc() for MSIx interrupts
>>> in PCI MSI core.
>>
>> "MSI-X" in English text, "msix" in code.
>>
>> The default arch_setup_msi_irq() in drivers/pci/msi.c doesn't call
>> irq_set_msi_desc().  Does it happen somewhere inside chip->setup_irq()?
> 
> Yes.
> 
> I also found this.
> http://www.spinics.net/lists/linux-pci/msg34256.html
> 
>>
>> I don't know how to verify that there are calls in all the places needed.
>> That makes me wonder if the factoring is wrong -- maybe irq_set_msi_desc()
>> could be done in some common place.
> 
> In my idea, place the irq_set_msi_desc() in common MSI core is ok, but currently almost
> all MSI arch code call irq_set_msi_desc() in arch code. So a lot of code need to change.
> And arch code setup MSI and MSI-X in the same way, so if MSI work happy without irq_set_msi_desc(entry->irq, entry)
> in common MSI code, MSI-X should be the same.
Hi Bjorn and Yijing,
	I originally plan was to move irq_set_msi_desc() into common
PCI MSI code. But when implementing this, I found every
arch_setup_msi_irq()/arch_setup_msi_irqs() needs to set msidesc->irq,
thus need to lock the irq descriptor. So I realized we should
rely on arch_setup_msi_irq() to call irq_set_msi_desc():)
Regards!
Gerry

> 
>>
>>> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
>>> ---
>>>  drivers/pci/msi.c |    1 -
>>>  1 file changed, 1 deletion(-)
>>>
>>> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
>>> index afe974600c7d..da181c59394b 100644
>>> --- a/drivers/pci/msi.c
>>> +++ b/drivers/pci/msi.c
>>> @@ -685,7 +685,6 @@ static void msix_program_entries(struct pci_dev *dev,
>>>  						PCI_MSIX_ENTRY_VECTOR_CTRL;
>>>  
>>>  		entries[i].vector = entry->irq;
>>> -		irq_set_msi_desc(entry->irq, entry);
>>>  		entry->masked = readl(entry->mask_base + offset);
>>>  		msix_mask_irq(entry, 1);
>>>  		i++;
>>> -- 
>>> 1.7.10.4
>>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>> .
>>
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index afe974600c7d..da181c59394b 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -685,7 +685,6 @@  static void msix_program_entries(struct pci_dev *dev,
 						PCI_MSIX_ENTRY_VECTOR_CTRL;
 
 		entries[i].vector = entry->irq;
-		irq_set_msi_desc(entry->irq, entry);
 		entry->masked = readl(entry->mask_base + offset);
 		msix_mask_irq(entry, 1);
 		i++;