From patchwork Wed Jun 6 02:40:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 10449549 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 173FB60375 for ; Wed, 6 Jun 2018 02:41:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBB7F299E4 for ; Wed, 6 Jun 2018 02:41:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD7D4299FD; Wed, 6 Jun 2018 02:41:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 40B9A299E4 for ; Wed, 6 Jun 2018 02:41:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=/Qz4ZzVAoqXDFFnPfRfgN53zgcT+0zw4ymKk5MyVyy0=; b=mO28j3xZr/Uar0 ReVvpv555wAOODvmDK6wWjnqg9+MnHHCDTf4HAUxZ2uBEOHzsnEX4ViA6ET6QrBE6X/Y3Aq4Pw9lj YOtF8MFXrzbRDG/nV4p4yuP66wmKtZv+OFpZt+CTB6F04/m5LAa4cn+Zbz+xdpsPNnKPgz5+K6Wqy cqhD4lZPewCHzPcvapvX5SVGs34BdqUpf2TnnvzIgYKAei9oKIZa10cB4HIywStCPfEfbp1NW9h4m UcSIsTgcLT61yRnnAXbD+q0OGKvD68eVO6SQAYnx3fkbJpcFn0TVLYVqJYORwCHP5CLHJ9ivtUOzb EhBGd7rpqlj7Zs8GgHOw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQONi-0002ul-NH; Wed, 06 Jun 2018 02:41:02 +0000 Received: from [45.249.212.32] (helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQONT-0002u5-0e for linux-arm-kernel@lists.infradead.org; Wed, 06 Jun 2018 02:40:48 +0000 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: , 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 X-Originating-IP: [10.177.19.219] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180605_194047_225935_0CD40AF7 X-CRM114-Status: GOOD ( 10.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, yangyingliang@huawei.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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