Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1460547 > unrolled thread

[PATCH for-4.8] irq/affinity: use get/put_online_cpus

Started byChristoph Hellwig <hch@lst.de>
First post2016-08-11 16:10 +0200
Last post2016-08-22 11:30 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH for-4.8] irq/affinity: use get/put_online_cpus Christoph Hellwig <hch@lst.de> - 2016-08-11 16:10 +0200
    Re: [PATCH for-4.8] irq/affinity: use get/put_online_cpus Christoph Hellwig <hch@infradead.org> - 2016-08-14 18:10 +0200
      Re: [PATCH for-4.8] irq/affinity: use get/put_online_cpus Thomas Gleixner <tglx@linutronix.de> - 2016-08-22 11:10 +0200
    [tip:irq/urgent] genirq/affinity: Use get/put_online_cpus around  cpumask operations tip-bot for Christoph Hellwig <tipbot@zytor.com> - 2016-08-22 11:30 +0200

#1460547 — [PATCH for-4.8] irq/affinity: use get/put_online_cpus

FromChristoph Hellwig <hch@lst.de>
Date2016-08-11 16:10 +0200
Subject[PATCH for-4.8] irq/affinity: use get/put_online_cpus
Message-ID<s4YQi-4R3-25@gated-at.bofh.it>
Without locking out CPU mask operations we might end up with an inconsistent
view of the cpumask in the function.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 kernel/irq/affinity.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index f689593..32f6cfc 100644
--- a/kernel/irq/affinity.c
+++ b/kernel/irq/affinity.c
@@ -39,6 +39,7 @@ struct cpumask *irq_create_affinity_mask(unsigned int *nr_vecs)
 		return NULL;
 	}
 
+	get_online_cpus();
 	if (max_vecs >= num_online_cpus()) {
 		cpumask_copy(affinity_mask, cpu_online_mask);
 		*nr_vecs = num_online_cpus();
@@ -56,6 +57,7 @@ struct cpumask *irq_create_affinity_mask(unsigned int *nr_vecs)
 		}
 		*nr_vecs = vecs;
 	}
+	put_online_cpus();
 
 	return affinity_mask;
 }
-- 
2.1.4

[toc] | [next] | [standalone]


#1462162

FromChristoph Hellwig <hch@infradead.org>
Date2016-08-14 18:10 +0200
Message-ID<s6693-1O5-3@gated-at.bofh.it>
In reply to#1460547
Any chance to get a quick review for this and get it off to Linus?
Without this fix the function is unusable in 4.8+ on my test systems
because we seem to always get a inconsistent view of the cpu online
bitmap - something that didn't happen before this merge window oddly
enough.

[toc] | [prev] | [next] | [standalone]


#1467489

FromThomas Gleixner <tglx@linutronix.de>
Date2016-08-22 11:10 +0200
Message-ID<s8ToZ-4l2-11@gated-at.bofh.it>
In reply to#1462162
On Sun, 14 Aug 2016, Christoph Hellwig wrote:
> Any chance to get a quick review for this and get it off to Linus?
> Without this fix the function is unusable in 4.8+ on my test systems
> because we seem to always get a inconsistent view of the cpu online
> bitmap - something that didn't happen before this merge window oddly
> enough.

That only happens if you have concurrent cpu hotplug operations, but yes this
needs to be fixed anyway.

Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1467499 — [tip:irq/urgent] genirq/affinity: Use get/put_online_cpus around cpumask operations

Fromtip-bot for Christoph Hellwig <tipbot@zytor.com>
Date2016-08-22 11:30 +0200
Subject[tip:irq/urgent] genirq/affinity: Use get/put_online_cpus around cpumask operations
Message-ID<s8TIl-4sY-17@gated-at.bofh.it>
In reply to#1460547
Commit-ID:  3ee0ce2a54dff07d09440723594df89bc1a12e79
Gitweb:     http://git.kernel.org/tip/3ee0ce2a54dff07d09440723594df89bc1a12e79
Author:     Christoph Hellwig <hch@lst.de>
AuthorDate: Thu, 11 Aug 2016 07:06:45 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 22 Aug 2016 11:22:44 +0200

genirq/affinity: Use get/put_online_cpus around cpumask operations

Without locking out CPU mask operations we might end up with an inconsistent
view of the cpumask in the function.

Fixes: 5e385a6ef31f: "genirq: Add a helper to spread an affinity mask for MSI/MSI-X vectors"
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: http://lkml.kernel.org/r/1470924405-25728-1-git-send-email-hch@lst.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 kernel/irq/affinity.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index f689593..32f6cfc 100644
--- a/kernel/irq/affinity.c
+++ b/kernel/irq/affinity.c
@@ -39,6 +39,7 @@ struct cpumask *irq_create_affinity_mask(unsigned int *nr_vecs)
 		return NULL;
 	}
 
+	get_online_cpus();
 	if (max_vecs >= num_online_cpus()) {
 		cpumask_copy(affinity_mask, cpu_online_mask);
 		*nr_vecs = num_online_cpus();
@@ -56,6 +57,7 @@ struct cpumask *irq_create_affinity_mask(unsigned int *nr_vecs)
 		}
 		*nr_vecs = vecs;
 	}
+	put_online_cpus();
 
 	return affinity_mask;
 }

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web