From patchwork Tue Sep 2 10:35:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 36448 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f199.google.com (mail-qc0-f199.google.com [209.85.216.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 349DE2032B for ; Tue, 2 Sep 2014 10:35:19 +0000 (UTC) Received: by mail-qc0-f199.google.com with SMTP id x3sf21980808qcv.10 for ; Tue, 02 Sep 2014 03:35:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=Y2nZjOR4543XxD9j860oMLxOoddiHqhjdjUyzEHaGpQ=; b=JxQHSNjw7rQMZHEm+3NKai73fwqqPAHRALZNs9f2NiOEOId4X/nOBuJfe02F6FxWCY B5oY5Bcew8gV/Zq25PtqiImv1fTgeIEHeFil+AoLAwQIG37s4MggeM/yz9PFDHHdKbET nLfsQYPXDsqL82VM5JNZEg2Vz6qNLxiWTvmBAqafuMp+BQZ9+OvnIJ+p+dBwVfq0kTRU GltKih3SZD7KvEsSCUyxIp53vJ7AxQW6xRalYPzakjfOXf+B0SzrNQKwq/zDJv4bdAah AR6A+lnQmxzWjk5h2ePRVRYtJ94YpDCWKGsqmQ/rFM4HUUJu10JN2l6U9nzHBE99iehj 0wAA== X-Gm-Message-State: ALoCoQlQLccWlJ5VYqZCJ6pzW5JwoaMmlsLecl7itkFld6DX/DmyndoLYf3/VGVs3PyeeLZ8YITO X-Received: by 10.236.28.228 with SMTP id g64mr18513380yha.40.1409654119034; Tue, 02 Sep 2014 03:35:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.22.229 with SMTP id 92ls2085411qgn.98.gmail; Tue, 02 Sep 2014 03:35:18 -0700 (PDT) X-Received: by 10.52.83.227 with SMTP id t3mr25018295vdy.20.1409654118930; Tue, 02 Sep 2014 03:35:18 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id qw8si2053407vcb.89.2014.09.02.03.35.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 02 Sep 2014 03:35:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id ij19so6843424vcb.3 for ; Tue, 02 Sep 2014 03:35:18 -0700 (PDT) X-Received: by 10.221.21.201 with SMTP id qt9mr274067vcb.39.1409654118791; Tue, 02 Sep 2014 03:35:18 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp505583vcb; Tue, 2 Sep 2014 03:35:18 -0700 (PDT) X-Received: by 10.68.65.9 with SMTP id t9mr46540541pbs.77.1409654117892; Tue, 02 Sep 2014 03:35:17 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id te6si5009515pbc.227.2014.09.02.03.35.17 for ; Tue, 02 Sep 2014 03:35:17 -0700 (PDT) Received-SPF: none (google.com: stable-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752738AbaIBKfQ (ORCPT + 1 other); Tue, 2 Sep 2014 06:35:16 -0400 Received: from fw-tnat.cambridge.arm.com ([217.140.96.21]:51542 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752518AbaIBKfQ (ORCPT ); Tue, 2 Sep 2014 06:35:16 -0400 Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.207.61]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id s82AYjHV016851; Tue, 2 Sep 2014 11:34:45 +0100 From: Sudeep Holla To: Will Deacon , linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , Mark Rutland , Catalin Marinas , Subject: [PATCH] arm64: use irq_set_affinity with force=false when migrating irqs Date: Tue, 2 Sep 2014 11:35:24 +0100 Message-Id: <1409654124-7358-1-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 1.8.3.2 Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sudeep.holla@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Sudeep Holla The arm64 interrupt migration code on cpu offline calls irqchip.irq_set_affinity() with the argument force=true. Originally this argument had no effect because it was not used by any interrupt chip driver and there was no semantics defined. This changed with commit 01f8fa4f01d8 ("genirq: Allow forcing cpu affinity of interrupts") which made the force argument useful to route interrupts to not yet online cpus without checking the target cpu against the cpu online mask. The following commit ffde1de64012 ("irqchip: gic: Support forced affinity setting") implemented this for the GIC interrupt controller. As a consequence the cpu offline irq migration fails if CPU0 is offlined, because CPU0 is still set in the affinity mask and the validation against cpu online mask is skipped to the force argument being true. The following first_cpu(mask) selection always selects CPU0 as the target. Commit 601c942176d8("arm64: use cpu_online_mask when using forced irq_set_affinity") intended to fix the above mentioned issue but introduced another issue where affinity can be migrated to a wrong CPU due to unconditional copy of cpu_online_mask. As with for arm, solve the issue by calling irq_set_affinity() with force=false from the CPU offline irq migration code so the GIC driver validates the affinity mask against CPU online mask and therefore removes CPU0 from the possible target candidates. Also revert the changes done in the commit 601c942176d8 as it's no longer needed. Tested on Juno platform. Fixes: 601c942176d8("arm64: use cpu_online_mask when using forced irq_set_affinity") Signed-off-by: Sudeep Holla Acked-by: Mark Rutland Cc: Catalin Marinas Cc: Will Deacon Cc: # 3.10.x --- arch/arm64/kernel/irq.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) Hi Will, After both Russell and Thomas agreed on the fix for ARM[0][1], I have similar fix for ARM64 with change log giving background as suggested by Thomas. It would be good if you can take this for next -rc fix. Regards, Sudeep [0] http://www.spinics.net/lists/arm-kernel/msg358336.html [1] http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=8133/1 diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c index 0f08dfd69ebc..dfa6e3e74fdd 100644 --- a/arch/arm64/kernel/irq.c +++ b/arch/arm64/kernel/irq.c @@ -97,19 +97,15 @@ static bool migrate_one_irq(struct irq_desc *desc) if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity)) return false; - if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) + if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { + affinity = cpu_online_mask; ret = true; + } - /* - * when using forced irq_set_affinity we must ensure that the cpu - * being offlined is not present in the affinity mask, it may be - * selected as the target CPU otherwise - */ - affinity = cpu_online_mask; c = irq_data_get_irq_chip(d); if (!c->irq_set_affinity) pr_debug("IRQ%u: unable to set affinity\n", d->irq); - else if (c->irq_set_affinity(d, affinity, true) == IRQ_SET_MASK_OK && ret) + else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret) cpumask_copy(d->affinity, affinity); return ret;