linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Use NUMA node cpu mask in irq affinity
@ 2012-02-08 20:48 Prarit Bhargava
  2012-02-08 23:51 ` Yinghai Lu
  2012-02-09 10:36 ` Thomas Gleixner
  0 siblings, 2 replies; 4+ messages in thread
From: Prarit Bhargava @ 2012-02-08 20:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Prarit Bhargava

The irq affinity files (/proc/irq/.../smp_affinity) contain a mask that is used
to "pin" an irq to a set of cpus.  On boot this set is currently all cpus.
This can be incorrect as ACPI SRAT may tell us that a specific device or
bus is attached to a particular node and it's cpus.

When setting up the irq affinity we should take into account the NUMA node
cpu mask by and'ing it into the irq's affinity mask.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
---
 kernel/irq/manage.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index a9a9dbe..2fb3469 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -301,6 +301,8 @@ setup_affinity(unsigned int irq, struct irq_desc *desc, struct cpumask *mask)
 	}
 
 	cpumask_and(mask, cpu_online_mask, set);
+	if (desc->irq_data.node != -1)
+		cpumask_and(mask, mask, cpumask_of_node(desc->irq_data.node));
 	ret = chip->irq_set_affinity(&desc->irq_data, mask, false);
 	switch (ret) {
 	case IRQ_SET_MASK_OK:
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Use NUMA node cpu mask in irq affinity
  2012-02-08 20:48 [PATCH] Use NUMA node cpu mask in irq affinity Prarit Bhargava
@ 2012-02-08 23:51 ` Yinghai Lu
  2012-02-09 13:52   ` Prarit Bhargava
  2012-02-09 10:36 ` Thomas Gleixner
  1 sibling, 1 reply; 4+ messages in thread
From: Yinghai Lu @ 2012-02-08 23:51 UTC (permalink / raw)
  To: Prarit Bhargava; +Cc: linux-kernel

On Wed, Feb 8, 2012 at 12:48 PM, Prarit Bhargava <prarit@redhat.com> wrote:
> The irq affinity files (/proc/irq/.../smp_affinity) contain a mask that is used
> to "pin" an irq to a set of cpus.  On boot this set is currently all cpus.
> This can be incorrect as ACPI SRAT may tell us that a specific device or
> bus is attached to a particular node and it's cpus.
>
> When setting up the irq affinity we should take into account the NUMA node
> cpu mask by and'ing it into the irq's affinity mask.
>
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> Acked-by: Neil Horman <nhorman@tuxdriver.com>
> ---
>  kernel/irq/manage.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index a9a9dbe..2fb3469 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -301,6 +301,8 @@ setup_affinity(unsigned int irq, struct irq_desc *desc, struct cpumask *mask)
>        }
>
>        cpumask_and(mask, cpu_online_mask, set);
> +       if (desc->irq_data.node != -1)
> +               cpumask_and(mask, mask, cpumask_of_node(desc->irq_data.node));
>        ret = chip->irq_set_affinity(&desc->irq_data, mask, false);
>        switch (ret) {
>        case IRQ_SET_MASK_OK:
> --

How about all cpus on that node get offlined?

Yinghai

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Use NUMA node cpu mask in irq affinity
  2012-02-08 20:48 [PATCH] Use NUMA node cpu mask in irq affinity Prarit Bhargava
  2012-02-08 23:51 ` Yinghai Lu
@ 2012-02-09 10:36 ` Thomas Gleixner
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2012-02-09 10:36 UTC (permalink / raw)
  To: Prarit Bhargava; +Cc: linux-kernel

On Wed, 8 Feb 2012, Prarit Bhargava wrote:

Could you please CC the relevant maintainers ?

> The irq affinity files (/proc/irq/.../smp_affinity) contain a mask that is used
> to "pin" an irq to a set of cpus.  On boot this set is currently all cpus.
> This can be incorrect as ACPI SRAT may tell us that a specific device or
> bus is attached to a particular node and it's cpus.
> 
> When setting up the irq affinity we should take into account the NUMA node
> cpu mask by and'ing it into the irq's affinity mask.
> 
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> Acked-by: Neil Horman <nhorman@tuxdriver.com>
> ---
>  kernel/irq/manage.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index a9a9dbe..2fb3469 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -301,6 +301,8 @@ setup_affinity(unsigned int irq, struct irq_desc *desc, struct cpumask *mask)
>  	}
>  
>  	cpumask_and(mask, cpu_online_mask, set);
> +	if (desc->irq_data.node != -1)
> +		cpumask_and(mask, mask, cpumask_of_node(desc->irq_data.node));

What prevents mask from becoming empty if mask does not intersect with
the node mask?

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Use NUMA node cpu mask in irq affinity
  2012-02-08 23:51 ` Yinghai Lu
@ 2012-02-09 13:52   ` Prarit Bhargava
  0 siblings, 0 replies; 4+ messages in thread
From: Prarit Bhargava @ 2012-02-09 13:52 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: linux-kernel, Thomas Gleixner



On 02/08/2012 06:51 PM, Yinghai Lu wrote:
> On Wed, Feb 8, 2012 at 12:48 PM, Prarit Bhargava <prarit@redhat.com> wrote:
>> The irq affinity files (/proc/irq/.../smp_affinity) contain a mask that is used
>> to "pin" an irq to a set of cpus.  On boot this set is currently all cpus.
>> This can be incorrect as ACPI SRAT may tell us that a specific device or
>> bus is attached to a particular node and it's cpus.
>>
>> When setting up the irq affinity we should take into account the NUMA node
>> cpu mask by and'ing it into the irq's affinity mask.
>>
>> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
>> Acked-by: Neil Horman <nhorman@tuxdriver.com>
>> ---
>>  kernel/irq/manage.c |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
>> index a9a9dbe..2fb3469 100644
>> --- a/kernel/irq/manage.c
>> +++ b/kernel/irq/manage.c
>> @@ -301,6 +301,8 @@ setup_affinity(unsigned int irq, struct irq_desc *desc, struct cpumask *mask)
>>        }
>>
>>        cpumask_and(mask, cpu_online_mask, set);
>> +       if (desc->irq_data.node != -1)
>> +               cpumask_and(mask, mask, cpumask_of_node(desc->irq_data.node));
>>        ret = chip->irq_set_affinity(&desc->irq_data, mask, false);
>>        switch (ret) {
>>        case IRQ_SET_MASK_OK:
>> --
> 
> How about all cpus on that node get offlined?

Good point.  I guess that also goes to tglx's comments wondering what happens if the mask ends up being zero.

I'll think about that and send out a new patch shortly.

P.
> 
> Yinghai

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-02-09 13:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-08 20:48 [PATCH] Use NUMA node cpu mask in irq affinity Prarit Bhargava
2012-02-08 23:51 ` Yinghai Lu
2012-02-09 13:52   ` Prarit Bhargava
2012-02-09 10:36 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).