linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] genirq: Make sure the affinity to be set is not empty
@ 2018-12-20 13:35 Srinivas Ramana
  2019-01-02  6:59 ` Srinivas Ramana
  2019-01-15 10:27 ` [tip:irq/urgent] genirq: Make sure the initial affinity " tip-bot for Srinivas Ramana
  0 siblings, 2 replies; 3+ messages in thread
From: Srinivas Ramana @ 2018-12-20 13:35 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel, linux-arm-msm, Srinivas Ramana

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);
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., 
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


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

* Re: [PATCH] genirq: Make sure the affinity to be set is not empty
  2018-12-20 13:35 [PATCH] genirq: Make sure the affinity to be set is not empty Srinivas Ramana
@ 2019-01-02  6:59 ` Srinivas Ramana
  2019-01-15 10:27 ` [tip:irq/urgent] genirq: Make sure the initial affinity " tip-bot for Srinivas Ramana
  1 sibling, 0 replies; 3+ messages in thread
From: Srinivas Ramana @ 2019-01-02  6:59 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel, linux-arm-msm

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

-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation
Center, Inc., is a member of Code Aurora Forum, a Linux Foundation
Collaborative Project

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

* [tip:irq/urgent] genirq: Make sure the initial affinity is not empty
  2018-12-20 13:35 [PATCH] genirq: Make sure the affinity to be set is not empty Srinivas Ramana
  2019-01-02  6:59 ` Srinivas Ramana
@ 2019-01-15 10:27 ` tip-bot for Srinivas Ramana
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Srinivas Ramana @ 2019-01-15 10:27 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: mingo, tglx, hpa, linux-kernel, sramana

Commit-ID:  bddda606ec76550dd63592e32a6e87e7d32583f7
Gitweb:     https://git.kernel.org/tip/bddda606ec76550dd63592e32a6e87e7d32583f7
Author:     Srinivas Ramana <sramana@codeaurora.org>
AuthorDate: Thu, 20 Dec 2018 19:05:57 +0530
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 15 Jan 2019 11:23:27 +0100

genirq: Make sure the initial affinity is not empty

If all CPUs in the irq_default_affinity mask are offline when an interrupt
is initialized then irq_setup_affinity() can set an empty affinity mask for
a newly allocated interrupt.

Fix this by falling back to cpu_online_mask in case the resulting affinity
mask is zero.

Signed-off-by: Srinivas Ramana <sramana@codeaurora.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-arm-msm@vger.kernel.org
Link: https://lkml.kernel.org/r/1545312957-8504-1-git-send-email-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 a4888ce4667a..84b54a17b95d 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);
 

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

end of thread, other threads:[~2019-01-15 10:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-20 13:35 [PATCH] genirq: Make sure the affinity to be set is not empty Srinivas Ramana
2019-01-02  6:59 ` Srinivas Ramana
2019-01-15 10:27 ` [tip:irq/urgent] genirq: Make sure the initial affinity " tip-bot for Srinivas Ramana

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).