From patchwork Tue Jun 25 01:40:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tangnianyao X-Patchwork-Id: 13710428 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D009C2BD09 for ; Tue, 25 Jun 2024 01:41:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC: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=bKXqqpI/VgtHRj0U1cCSadS8nAgWy7xr4tcd8mWS2cs=; b=S1P/2TDlqkiQ/mm3hv29IMcDss i5Dp6vpYVxvhP+cHMgz9I1G1klkmYjRQh8fU1dl6+rj5Dmyub2bL8d5RMmQ2ny/M5P8geS0PT7h41 Gs19eIwGfP66rERT0S4U4I0BI3/KNlxSr+LoriaXeqXxvA/IQyolmL5ZEJ0mNU+T10/MCqBrxlyxf bmrpbxNFQ+Ph1hA8VrqTxc0rMeoV2A45L55NGgGpAaOD9Lv+r1+tDNQXR350uLg81PdXOzP/eewr6 0kv6GBWz2WPxdpTAgMdyo/6Q+uwcxgx13IkFtV8o90MGjD0Z75ISFlX2sz0s6lb6ZzUx8AaCSEx/p CuMbftIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLvB3-00000001FDB-0t5e; Tue, 25 Jun 2024 01:40:57 +0000 Received: from szxga05-in.huawei.com ([45.249.212.191]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLvAw-00000001FBw-41gB for linux-arm-kernel@lists.infradead.org; Tue, 25 Jun 2024 01:40:52 +0000 Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4W7S9Q59RZz1j5m3; Tue, 25 Jun 2024 09:36:42 +0800 (CST) Received: from kwepemd500014.china.huawei.com (unknown [7.221.188.63]) by mail.maildlp.com (Postfix) with ESMTPS id 4B971140109; Tue, 25 Jun 2024 09:40:41 +0800 (CST) Received: from 228-1616.huawei.com (10.67.246.68) by kwepemd500014.china.huawei.com (7.221.188.63) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Tue, 25 Jun 2024 09:40:40 +0800 From: Nianyao Tang To: , , , CC: , , Subject: [RESEND PATCH] irqchip/gic-v4.1: Use the ITS of the NUMA node where current cpu is located Date: Tue, 25 Jun 2024 01:40:19 +0000 Message-ID: <20240625014019.3914240-1-tangnianyao@huawei.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 X-Originating-IP: [10.67.246.68] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemd500014.china.huawei.com (7.221.188.63) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240624_184051_187608_A37A4902 X-CRM114-Status: GOOD ( 13.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When GICv4.1 enabled, guest sending IPI use the last ITS reported. On multi-NUMA environment with more than one ITS, it makes IPI performance various from VM to VM, depending on which NUMA the VM is deployed on. We can use closer ITS instead of the last ITS reported. Modify find_4_1_its to find the ITS of the NUMA node where current cpu is located and save it with per cpu variable. (There's format issues with the previous patch, resend it) Signed-off-by: Nianyao Tang --- drivers/irqchip/irq-gic-v3-its.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 3c755d5dad6e..d35b42f3b2af 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -193,6 +193,8 @@ static DEFINE_RAW_SPINLOCK(vmovp_lock); static DEFINE_IDA(its_vpeid_ida); +static DEFINE_PER_CPU(struct its_node *, its_on_cpu); + #define gic_data_rdist() (raw_cpu_ptr(gic_rdists->rdist)) #define gic_data_rdist_cpu(cpu) (per_cpu_ptr(gic_rdists->rdist, cpu)) #define gic_data_rdist_rd_base() (gic_data_rdist()->rd_base) @@ -4058,19 +4060,25 @@ static struct irq_chip its_vpe_irq_chip = { static struct its_node *find_4_1_its(void) { - static struct its_node *its = NULL; + struct its_node *its = NULL; + struct its_node *its_non_cpu_node = NULL; + int cpu = smp_processor_id(); - if (!its) { - list_for_each_entry(its, &its_nodes, entry) { - if (is_v4_1(its)) - return its; - } + if (per_cpu(its_on_cpu, cpu)) + return per_cpu(its_on_cpu, cpu); - /* Oops? */ - its = NULL; - } + list_for_each_entry(its, &its_nodes, entry) { + if (is_v4_1(its) && its->numa_node == cpu_to_node(cpu)) { + per_cpu(its_on_cpu, cpu) = its; + return its; + } else if (is_v4_1(its)) + its_non_cpu_node = its; + } - return its; + if (!per_cpu(its_on_cpu, cpu) && its_non_cpu_node) + per_cpu(its_on_cpu, cpu) = its_non_cpu_node; + + return its_non_cpu_node; } static void its_vpe_4_1_send_inv(struct irq_data *d)