diff mbox

[v5,10/33] iommu, irq: Allocate irq_desc for dmar_msi with local node

Message ID 1388707565-16535-11-git-send-email-yinghai@kernel.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Yinghai Lu Jan. 3, 2014, 12:05 a.m. UTC
iommu irq's irq_desc should be on local node ram.

Fix the return value checking problem.
  create_irq() will return -1 when fail to allocate.
  create_irq_nr() will return 0 when fail to allocate.
here only check !irq, so need to change it to use create_irq_nr instead.

-v2: According to Sebastian, add cc to stable.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Donald Dutile <ddutile@redhat.com>
Acked-by: Donald Dutile <ddutile@redhat.com>
Cc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Cc: stable@vger.kernel.org
---
 drivers/iommu/dmar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jiang Liu Feb. 21, 2014, 7:43 a.m. UTC | #1
On 2014/1/3 8:05, Yinghai Lu wrote:
> iommu irq's irq_desc should be on local node ram.
> 
> Fix the return value checking problem.
>   create_irq() will return -1 when fail to allocate.
>   create_irq_nr() will return 0 when fail to allocate.
> here only check !irq, so need to change it to use create_irq_nr instead.
> 
> -v2: According to Sebastian, add cc to stable.
> 
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> Cc: Joerg Roedel <joro@8bytes.org>
> Cc: Donald Dutile <ddutile@redhat.com>
> Acked-by: Donald Dutile <ddutile@redhat.com>
> Cc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
> Cc: stable@vger.kernel.org
> ---
>  drivers/iommu/dmar.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
> index 8b452c9..f4eaa50 100644
> --- a/drivers/iommu/dmar.c
> +++ b/drivers/iommu/dmar.c
> @@ -1277,7 +1277,7 @@ int dmar_set_interrupt(struct intel_iommu *iommu)
>  	if (iommu->irq)
>  		return 0;
>  
> -	irq = create_irq();
> +	irq = create_irq_nr(0, iommu->node);
Hi Yinghai,
	How about create_irq_nrq(1, iommu->node) here to clearly state
that 0 is not a valid irq number for dmar here?
Thanks!
Gerry

>  	if (!irq) {
>  		pr_err("IOMMU: no free vectors\n");
>  		return -EINVAL;
> 
--
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
Yinghai Lu Feb. 21, 2014, 11:18 p.m. UTC | #2
On Thu, Feb 20, 2014 at 11:43 PM, Jiang Liu <jiang.liu@linux.intel.com> wrote:
>
>
> On 2014/1/3 8:05, Yinghai Lu wrote:
>> iommu irq's irq_desc should be on local node ram.
>>
>> Fix the return value checking problem.
>>   create_irq() will return -1 when fail to allocate.
>>   create_irq_nr() will return 0 when fail to allocate.
>> here only check !irq, so need to change it to use create_irq_nr instead.
>>
>> -v2: According to Sebastian, add cc to stable.
>>
>> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>> Cc: Joerg Roedel <joro@8bytes.org>
>> Cc: Donald Dutile <ddutile@redhat.com>
>> Acked-by: Donald Dutile <ddutile@redhat.com>
>> Cc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
>> Cc: stable@vger.kernel.org
>> ---
>>  drivers/iommu/dmar.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
>> index 8b452c9..f4eaa50 100644
>> --- a/drivers/iommu/dmar.c
>> +++ b/drivers/iommu/dmar.c
>> @@ -1277,7 +1277,7 @@ int dmar_set_interrupt(struct intel_iommu *iommu)
>>       if (iommu->irq)
>>               return 0;
>>
>> -     irq = create_irq();
>> +     irq = create_irq_nr(0, iommu->node);
> Hi Yinghai,
>         How about create_irq_nrq(1, iommu->node) here to clearly state
> that 0 is not a valid irq number for dmar here?

Should be the same. that 0 or 1 will be from in __create_irqs().

And we have
        if (from < nr_irqs_gsi)
                from = nr_irqs_gsi;
in __create_irqs().

Thanks

Yinghai
--
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
Jiang Liu Feb. 22, 2014, 3:14 a.m. UTC | #3
On 2014/2/22 7:18, Yinghai Lu wrote:
> On Thu, Feb 20, 2014 at 11:43 PM, Jiang Liu <jiang.liu@linux.intel.com> wrote:
>>
>>
>> On 2014/1/3 8:05, Yinghai Lu wrote:
>>> iommu irq's irq_desc should be on local node ram.
>>>
>>> Fix the return value checking problem.
>>>   create_irq() will return -1 when fail to allocate.
>>>   create_irq_nr() will return 0 when fail to allocate.
>>> here only check !irq, so need to change it to use create_irq_nr instead.
>>>
>>> -v2: According to Sebastian, add cc to stable.
>>>
>>> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>>> Cc: Joerg Roedel <joro@8bytes.org>
>>> Cc: Donald Dutile <ddutile@redhat.com>
>>> Acked-by: Donald Dutile <ddutile@redhat.com>
>>> Cc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
>>> Cc: stable@vger.kernel.org
>>> ---
>>>  drivers/iommu/dmar.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
>>> index 8b452c9..f4eaa50 100644
>>> --- a/drivers/iommu/dmar.c
>>> +++ b/drivers/iommu/dmar.c
>>> @@ -1277,7 +1277,7 @@ int dmar_set_interrupt(struct intel_iommu *iommu)
>>>       if (iommu->irq)
>>>               return 0;
>>>
>>> -     irq = create_irq();
>>> +     irq = create_irq_nr(0, iommu->node);
>> Hi Yinghai,
>>         How about create_irq_nrq(1, iommu->node) here to clearly state
>> that 0 is not a valid irq number for dmar here?
> 
> Should be the same. that 0 or 1 will be from in __create_irqs().
> 
> And we have
>         if (from < nr_irqs_gsi)
>                 from = nr_irqs_gsi;
> in __create_irqs().
Hi Yinghai,
	Seems there is no such protection on IA64 side. I feel create_irq_nr()
returns 0 for error is a little risky, 0 may be
a valid IRQ number on other platforms(no sure about this).
Thanks!
> 
> Thanks
> 
> Yinghai
> 
--
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
Yinghai Lu Feb. 22, 2014, 7:44 a.m. UTC | #4
On Fri, Feb 21, 2014 at 7:14 PM, Jiang Liu <jiang.liu@linux.intel.com> wrote:

>         Seems there is no such protection on IA64 side. I feel create_irq_nr()
> returns 0 for error is a little risky, 0 may be
> a valid IRQ number on other platforms(no sure about this).
> Thanks!

in [PATCH] ia64, irq: Add dummy create_irq_nr()

+unsigned int create_irq_nr(unsigned int from, int node)
+{
+       int irq = create_irq();
+
+       if (irq < 0)
+               irq = 0;
+
+       return irq;
+}
+

so that from is ignored.

create_irq_nr() is only with x86 and ia64.

Thanks

Yinghai
--
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
Jiang Liu Feb. 22, 2014, 3:33 p.m. UTC | #5
Hi Yinghai,
	I have a plan to test this patch set once I have reviewed
all patches in coming weeks. Do you have a plan to update to latest
kernel or is it ok to test this version?
Thanks!
Gerry

On 2014/2/22 15:44, Yinghai Lu wrote:
> On Fri, Feb 21, 2014 at 7:14 PM, Jiang Liu <jiang.liu@linux.intel.com> wrote:
> 
>>         Seems there is no such protection on IA64 side. I feel create_irq_nr()
>> returns 0 for error is a little risky, 0 may be
>> a valid IRQ number on other platforms(no sure about this).
>> Thanks!
> 
> in [PATCH] ia64, irq: Add dummy create_irq_nr()
> 
> +unsigned int create_irq_nr(unsigned int from, int node)
> +{
> +       int irq = create_irq();
> +
> +       if (irq < 0)
> +               irq = 0;
> +
> +       return irq;
> +}
> +
> 
> so that from is ignored.
> 
> create_irq_nr() is only with x86 and ia64.
> 
> Thanks
> 
> Yinghai
> 
--
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
Yinghai Lu Feb. 22, 2014, 5:30 p.m. UTC | #6
On Sat, Feb 22, 2014 at 7:33 AM, Jiang Liu <jiang.liu@linux.intel.com> wrote:
> Hi Yinghai,
>         I have a plan to test this patch set once I have reviewed
> all patches in coming weeks. Do you have a plan to update to latest
> kernel or is it ok to test this version?

That will be great. I will refresh the branch on top of
linus/tip/pci/acpi next week.

Thanks

Yinghai
--
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
diff mbox

Patch

diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 8b452c9..f4eaa50 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -1277,7 +1277,7 @@  int dmar_set_interrupt(struct intel_iommu *iommu)
 	if (iommu->irq)
 		return 0;
 
-	irq = create_irq();
+	irq = create_irq_nr(0, iommu->node);
 	if (!irq) {
 		pr_err("IOMMU: no free vectors\n");
 		return -EINVAL;