diff mbox series

genirq: Make sure the affinity to be set is not empty

Message ID 1545312957-8504-1-git-send-email-sramana@codeaurora.org (mailing list archive)
State New, archived
Headers show
Series genirq: Make sure the affinity to be set is not empty | expand

Commit Message

Srinivas Ramana Dec. 20, 2018, 1:35 p.m. UTC
If the default_affinity is managed/initialized by a system and
all the cpus present in irq_default_affinity are hotplugged out
we may end up passing a cpumask of 0 to irq_do_set_affinity().

Fix this by falling back to cpu_online_mask in case the
calculated affinity becomes zero.

Signed-off-by: Srinivas Ramana <sramana@codeaurora.org>
---
 kernel/irq/manage.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Srinivas Ramana Jan. 2, 2019, 6:59 a.m. UTC | #1
On 12/20/2018 7:05 PM, Srinivas Ramana wrote:
> If the default_affinity is managed/initialized by a system and
> all the cpus present in irq_default_affinity are hotplugged out
> we may end up passing a cpumask of 0 to irq_do_set_affinity().
> 
> Fix this by falling back to cpu_online_mask in case the
> calculated affinity becomes zero.
> 
> Signed-off-by: Srinivas Ramana <sramana@codeaurora.org>
> ---
>   kernel/irq/manage.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index 9dbdccab3b6a..5c0ba5ca5930 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -393,6 +393,9 @@ int irq_setup_affinity(struct irq_desc *desc)
>   	}
>   
>   	cpumask_and(&mask, cpu_online_mask, set);
> +	if (cpumask_empty(&mask))
> +		cpumask_copy(&mask, cpu_online_mask);
> +
>   	if (node != NUMA_NO_NODE) {
>   		const struct cpumask *nodemask = cpumask_of_node(node);
>   
> 

Hi,

Can you provide your feedback on this?

Thanks,
-- Srinivas R
diff mbox series

Patch

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 9dbdccab3b6a..5c0ba5ca5930 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -393,6 +393,9 @@  int irq_setup_affinity(struct irq_desc *desc)
 	}
 
 	cpumask_and(&mask, cpu_online_mask, set);
+	if (cpumask_empty(&mask))
+		cpumask_copy(&mask, cpu_online_mask);
+
 	if (node != NUMA_NO_NODE) {
 		const struct cpumask *nodemask = cpumask_of_node(node);