From patchwork Tue Jun 5 06:30:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 10447713 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 EF81860284 for ; Tue, 5 Jun 2018 06:31:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFC3328D3E for ; Tue, 5 Jun 2018 06:31:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D406728D88; Tue, 5 Jun 2018 06:31:17 +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 7F36E28D4B for ; Tue, 5 Jun 2018 06:31:17 +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=RsuUMPp7W54eiDOhCrOTstgsb3Mp1fg5XUZ7718jxUc=; b=uHDcssOORCgvvS 4iqhU8CplJnXps1auzpYiE2R7CFyN8XZVWUPgM965LAyV/ReGnryymK/ETZaMzMeC5yqtNWfYbIm6 QlwpLxh8XuBwhjp2GadMup4BaATF6qe0hpZ2AzhSPGxSWYdH6MfZ/cFzEZ7q+1rmHgLixHPgYyPiM uQ8OD2NXcqPMQ0Q4ddNmXbJnJfjQlzYAkUfkA2CKmy1mNWZRCG1UVH2rewnl788+byPDOC01YN/Z9 g2Juvg0qFX4gdJVbkJU6f46FLpuHacCmKnceA4vJnd7VsmTTIopqrip5tcrxXa2qGOXdD1HPSDUJO occMa6G/TFiV5kytpwYA==; 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 1fQ5Uo-0001uJ-Tn; Tue, 05 Jun 2018 06:31:06 +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 1fQ5Uk-0001qv-NQ for linux-arm-kernel@lists.infradead.org; Tue, 05 Jun 2018 06:31:04 +0000 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id F2237E27799A3; Tue, 5 Jun 2018 14:30:46 +0800 (CST) Received: from localhost (10.177.19.219) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.382.0; Tue, 5 Jun 2018 14:30:37 +0800 From: Yang Yingliang To: Subject: [PATCH] irqchip/gic-v3-its: fix ITS queue timeout Date: Tue, 5 Jun 2018 14:30:25 +0800 Message-ID: <1528180225-16144-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-20180604_233102_940483_E33021CC X-CRM114-Status: GOOD ( 10.51 ) 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..edd92a9 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_online(cpu)) + 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_online(cpu)) + cpu = cpumask_first(cpu_online_mask); /* * Changing affinity is mega expensive, so let's be as lazy as