From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Gleixner Subject: [patch 4/5] xen: Validate online cpus in set_affinity Date: Tue, 04 Mar 2014 20:43:40 -0000 Message-ID: <20140304203100.978031089@linutronix.de> References: <20140304202425.102779779@linutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WKwBm-0007p7-KU for xen-devel@lists.xenproject.org; Tue, 04 Mar 2014 20:43:46 +0000 Content-Disposition: inline; filename=xen-validate-online-cpus-in-set-affinity.patch List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: LKML Cc: Peter Zijlstra , Xen , Ingo Molnar , David Vrabel List-Id: xen-devel@lists.xenproject.org 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 Cc: David Vrabel Cc: Peter Zijlstra Cc: Konrad Rzeszutek Wilk Cc: Xen --- 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); }