xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [patch 4/5] xen: Validate online cpus in set_affinity
       [not found] <20140304202425.102779779@linutronix.de>
@ 2014-03-04 20:43 ` Thomas Gleixner
  2014-03-05 10:36   ` David Vrabel
  2014-03-12 12:15   ` [tip:irq/core] " tip-bot for Thomas Gleixner
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Gleixner @ 2014-03-04 20:43 UTC (permalink / raw)
  To: LKML; +Cc: Peter Zijlstra, Xen, Ingo Molnar, David Vrabel

[-- Attachment #1: xen-validate-online-cpus-in-set-affinity.patch --]
[-- Type: text/plain, Size: 1175 bytes --]

The user space interface does not filter out offline cpus. It merily
verifies that the mask contains at least one online cpu. So the
selector in the irq chip implementation needs to make sure to pick
only an online cpu because otherwise:

     Offline Core 1
     Set affinity to 0xe
     Selector will pick first set bit, i.e. core 1

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Xen <xen-devel@lists.xenproject.org>
---
 drivers/xen/events/events_base.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: tip/drivers/xen/events/events_base.c
===================================================================
--- tip.orig/drivers/xen/events/events_base.c
+++ tip/drivers/xen/events/events_base.c
@@ -1324,7 +1324,7 @@ static int rebind_irq_to_cpu(unsigned ir
 static int set_affinity_irq(struct irq_data *data, const struct cpumask *dest,
 			    bool force)
 {
-	unsigned tcpu = cpumask_first(dest);
+	unsigned tcpu = cpumask_first_and(dest, cpu_online_mask);
 
 	return rebind_irq_to_cpu(data->irq, tcpu);
 }

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

* Re: [patch 4/5] xen: Validate online cpus in set_affinity
  2014-03-04 20:43 ` [patch 4/5] xen: Validate online cpus in set_affinity Thomas Gleixner
@ 2014-03-05 10:36   ` David Vrabel
  2014-03-12 12:15   ` [tip:irq/core] " tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 3+ messages in thread
From: David Vrabel @ 2014-03-05 10:36 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Peter Zijlstra, Xen, Ingo Molnar, LKML

On 04/03/14 20:43, Thomas Gleixner wrote:
> The user space interface does not filter out offline cpus. It merily
> verifies that the mask contains at least one online cpu. So the
> selector in the irq chip implementation needs to make sure to pick
> only an online cpu because otherwise:
> 
>      Offline Core 1
>      Set affinity to 0xe
>      Selector will pick first set bit, i.e. core 1

Reviewed-by: David Vrabel <david.vrabel@citrix.com>

Thanks.

David

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

* [tip:irq/core] xen: Validate online cpus in set_affinity
  2014-03-04 20:43 ` [patch 4/5] xen: Validate online cpus in set_affinity Thomas Gleixner
  2014-03-05 10:36   ` David Vrabel
@ 2014-03-12 12:15   ` tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Thomas Gleixner @ 2014-03-12 12:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, linux-kernel, david.vrabel, hpa, xen-devel, tglx, mingo

Commit-ID:  753fbd23f5e59ea9dc0cabe0a684d32100a4af02
Gitweb:     http://git.kernel.org/tip/753fbd23f5e59ea9dc0cabe0a684d32100a4af02
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 4 Mar 2014 20:43:40 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 12 Mar 2014 13:07:41 +0100

xen: Validate online cpus in set_affinity

The user space interface does not filter out offline cpus. It merily
verifies that the mask contains at least one online cpu. So the
selector in the irq chip implementation needs to make sure to pick
only an online cpu because otherwise:

     Offline Core 1
     Set affinity to 0xe
     Selector will pick first set bit, i.e. core 1

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Xen <xen-devel@lists.xenproject.org>
Link: http://lkml.kernel.org/r/20140304203100.978031089@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/xen/events/events_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index 8b91c256..c3458f5 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -1324,7 +1324,7 @@ static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
 static int set_affinity_irq(struct irq_data *data, const struct cpumask *dest,
 			    bool force)
 {
-	unsigned tcpu = cpumask_first(dest);
+	unsigned tcpu = cpumask_first_and(dest, cpu_online_mask);
 
 	return rebind_irq_to_cpu(data->irq, tcpu);
 }

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

end of thread, other threads:[~2014-03-12 12:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20140304202425.102779779@linutronix.de>
2014-03-04 20:43 ` [patch 4/5] xen: Validate online cpus in set_affinity Thomas Gleixner
2014-03-05 10:36   ` David Vrabel
2014-03-12 12:15   ` [tip:irq/core] " tip-bot for 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).