Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp272384imm; Tue, 5 Jun 2018 19:41:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLDHWCu4T55fUY0oX2FMsIgisLkbpMRd30oJEJzPwj2GBKhx2/lrII4edk+Xby/4HawKUrr X-Received: by 2002:a62:9385:: with SMTP id r5-v6mr572104pfk.59.1528252877334; Tue, 05 Jun 2018 19:41:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528252877; cv=none; d=google.com; s=arc-20160816; b=im3WSLR8Rw09a4BkoP/KlpijAMVuilE4uPr4P9/reYEiPW+V9p6f6ypEbkMxLiUQV8 vwlFK4GVzQmF6InkP0r6+s0djpji6T+VUZd7iLUs+JxF98pHQ0eMkPlDN75lohx8U2JY 7mkhKvWknfiMFvZsi04KPj6TWtLlEtUPWl7C2Mhr6LhLIpn07zrLHmv4nkjMY0uBoKyR 3vWBewOGqLGbrj8Ev/4NTwKrMtv08HojPGkdUZheHP3WAot/xBi7OSIRkfGE1Z2ulkaC Nr3STr2nNt86G1VeYlkrU5aNv1nMdMjSKkcAz6vgKqYF8ViZ3m964CFzwK11fR/xpvro 16LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=P0ciyID9jJXMmwA8xHuwuf13bJ3MYt1nyb4LWi/NLTE=; b=oaiXPrRLOI5+9WSwQbkl1psIhf5oJI0ifvcwI/b9f/iOmyRnrIJcccqVoIUS1ZMG8p RMTNB72U7/HUYWLvAH++PFv+pjdjK4NB4UE8KgHwxDu5EOk5At8nKSbIAMZHQh6XYww4 jdzR4x7fBovHNLrviGilhYLzh499AkS6RfPTqUtV1K0UKTVp/HwSELRYqPlMJcMXQM7h TI76EA0vMcVQznMprR9KzXlcHFI8fnhElX8NEfnlfopqaspOTDJ9qZU57z1eEMBSCgEs wobGmiqkx/7d/eWlJL7oAbqwbwW53kA6CW5vwbDbtM+2F2+k9whiIl4BM5aTinORL5YG A0lQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 88-v6si49509286pla.315.2018.06.05.19.41.01; Tue, 05 Jun 2018 19:41:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932078AbeFFCkh (ORCPT + 99 others); Tue, 5 Jun 2018 22:40:37 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:52704 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752731AbeFFCkg (ORCPT ); Tue, 5 Jun 2018 22:40:36 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 600852BDB6EE8; Wed, 6 Jun 2018 10:40:31 +0800 (CST) Received: from localhost (10.177.19.219) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.382.0; Wed, 6 Jun 2018 10:40:25 +0800 From: Yang Yingliang To: , CC: , , Subject: [PATCH v2] irqchip/gic-v3-its: fix ITS queue timeout Date: Wed, 6 Jun 2018 10:40:24 +0800 Message-ID: <1528252824-15144-1-git-send-email-yangyingliang@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.177.19.219] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the kernel booted with maxcpus=x, 'x' is smaller than actual cpu numbers, the TAs of offline cpus won't be set to its->collection. If LPI is bind to offline cpu, sync cmd will use zero TA, it leads to ITS queue timeout. Fix this by choosing a online cpu, if there is no online cpu in cpu_mask. Signed-off-by: Yang Yingliang --- drivers/irqchip/irq-gic-v3-its.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 5416f2b..d8b9539 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -2309,7 +2309,9 @@ static int its_irq_domain_activate(struct irq_domain *domain, cpu_mask = cpumask_of_node(its_dev->its->numa_node); /* Bind the LPI to the first possible CPU */ - cpu = cpumask_first(cpu_mask); + cpu = cpumask_first_and(cpu_mask, cpu_online_mask); + if (cpu >= nr_cpu_ids) + cpu = cpumask_first(cpu_online_mask); its_dev->event_map.col_map[event] = cpu; irq_data_update_effective_affinity(d, cpumask_of(cpu)); @@ -2466,7 +2468,10 @@ static int its_vpe_set_affinity(struct irq_data *d, bool force) { struct its_vpe *vpe = irq_data_get_irq_chip_data(d); - int cpu = cpumask_first(mask_val); + int cpu = cpumask_first_and(mask_val, cpu_online_mask); + + if (cpu >= nr_cpu_ids) + cpu = cpumask_first(cpu_online_mask); /* * Changing affinity is mega expensive, so let's be as lazy as -- 1.8.3