[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240625014019.3914240-1-tangnianyao@huawei.com>
Date: Tue, 25 Jun 2024 01:40:19 +0000
From: Nianyao Tang <tangnianyao@...wei.com>
To: <maz@...nel.org>, <tglx@...utronix.de>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
CC: <guoyang2@...wei.com>, <wangwudi@...ilicon.com>, <tangnianyao@...wei.com>
Subject: [RESEND PATCH] irqchip/gic-v4.1: Use the ITS of the NUMA node where current cpu is located
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 <tangnianyao@...wei.com>
---
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)
--
2.30.0
Powered by blists - more mailing lists