Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3463280pxb; Mon, 24 Jan 2022 10:04:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/V7k5CbwRzSsK299MkwZkJn81SkNJeh9ME+Fb4DZhinrHkFaAG/vEEFmLoi5uOjM+NoRC X-Received: by 2002:a05:6a00:70d:b0:4c0:1cbf:2394 with SMTP id 13-20020a056a00070d00b004c01cbf2394mr14890531pfl.69.1643047474955; Mon, 24 Jan 2022 10:04:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643047474; cv=none; d=google.com; s=arc-20160816; b=gkSDJCtlBvtINEFJLrk6F2H5dcNvIySFIGbi0ILAnLmtuePDzqQnkeA8mOTwQjjIdb 9QuXlQinTi2RfBnxNp2QpyyD+6YcjzV9LTDtPee4dn+TUfVHBqXa2nAvBR+w3fcMHH4x LvDVZU3guj3lH2QRpJpjsPvRvPfIUL+fdxdcO3Nb3/6lS93XTxLTjsCNyhS321vKr6Pr VAl+LUydRVsf/BEPRyLAVJvcICcD6KqREIXxQrCTrq5vzPbqK/F4wLuu6L/JKUABcY/u FVy0s+0repOWHVtfKX5hSkTn9O+LjUCNrj6FV1q6MliQJRqadt/jLLW3Tbu0aT1PV+OF L9Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=s/JbKXkfiKeOJGcpQoBeDo43t9vTFOJiKLttx8FaiaI=; b=ru7L2Fiol4UW2KOY5zDbOV1blHM4wMQkS0V1YMolI4BYmxALlJCn0MTpVOU/QxR6c3 arE0EQUmIpc4XgM9wqUQUz8uOTh/P2BfqEsg9wpdMECabAbjsfjP3QyD/BN8Aj1UYDYb g1GZ2fWZm0sc7iD2epf0KwcKGPsxoUQLKJqXJgxunyiNxbrUczqQGTEQBctZsvKE5JsW 1XPBPNumbOTlBXfJB55hniMg3ASfc8JYW2L73XVfw6Fpg6BEyJy7V7Z9uCaiGJDq7Tk0 jo/igUYT13PedXorRFIgjYUg4urtEhY04eoGm2Q0jKSJPnheW7lcNV28Pxu1L0RcRDrV 5pug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n186si14928075pga.115.2022.01.24.10.04.22; Mon, 24 Jan 2022 10:04:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241748AbiAXHSp (ORCPT + 99 others); Mon, 24 Jan 2022 02:18:45 -0500 Received: from szxga08-in.huawei.com ([45.249.212.255]:31117 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236113AbiAXHSo (ORCPT ); Mon, 24 Jan 2022 02:18:44 -0500 Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Jj1T66vJwz1FCqD; Mon, 24 Jan 2022 15:14:50 +0800 (CST) Received: from dggpemm500002.china.huawei.com (7.185.36.229) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Mon, 24 Jan 2022 15:18:42 +0800 Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500002.china.huawei.com (7.185.36.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Mon, 24 Jan 2022 15:18:42 +0800 From: Xiongfeng Wang To: , CC: , , Subject: [PATCH] irqchip/gic-v3-its: Select housekeeping CPUs preferentially for managed IRQs Date: Mon, 24 Jan 2022 15:34:40 +0800 Message-ID: <20220124073440.88598-1-wangxiongfeng2@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500002.china.huawei.com (7.185.36.229) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When using kernel parameter 'isolcpus=managed_irq,xxxx' to bind the managed IRQs to housekeeping CPUs, the effective_affinity sometimes still contains the non-housekeeping CPUs. irq_do_set_affinity() passes the housekeeping cpumask to chip->irq_set_affinity(), but ITS driver select CPU according to irq_common_data->affinity. While 'irq_common_data->affinity' is updated after chip->irq_set_affinity() is called in irq_do_set_affinity(). Also 'irq_common_data->affinity' may contains non-housekeeping CPUs. I found the below link explaining the reason. https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg2267032.html To modify CPU selecting logic to prefer housekeeping CPUs, select CPU from the input cpumask parameter first. If none of it is online, then select CPU from 'irq_common_data->affinity'. Signed-off-by: Xiongfeng Wang --- drivers/irqchip/irq-gic-v3-its.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index d25b7a864bbb..17c15d3b2784 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -1624,7 +1624,10 @@ static int its_select_cpu(struct irq_data *d, cpu = cpumask_pick_least_loaded(d, tmpmask); } else { - cpumask_and(tmpmask, irq_data_get_affinity_mask(d), cpu_online_mask); + cpumask_and(tmpmask, aff_mask, cpu_online_mask); + if (cpumask_empty(tmpmask)) + cpumask_and(tmpmask, irq_data_get_affinity_mask(d), + cpu_online_mask); /* If we cannot cross sockets, limit the search to that node */ if ((its_dev->its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_23144) && -- 2.20.1