* [PATCH v4 1/6] irqchip/gic-v3-its: Fix memleak in its_probe_one()
2026-07-02 3:30 [PATCH v4 0/6] Some Minor fixes and cleanups to irqchip/gic-v3-its Kemeng Shi
@ 2026-07-02 3:30 ` Kemeng Shi
2026-07-02 3:30 ` [PATCH v4 2/6] irqchip/gic-v3-its: Fix its node leak in gic_acpi_parse_madt_its() Kemeng Shi
` (4 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Kemeng Shi @ 2026-07-02 3:30 UTC (permalink / raw)
To: maz, tglx, jason, lpieralisi; +Cc: linux-arm-kernel, linux-kernel, Kemeng Shi
Fix collection leak when its_init_domain() failed in its_probe_one().
Fixes: 4c21f3c26ecc2 ("irqchip: GICv3: ITS: DT probing and initialization")
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
drivers/irqchip/irq-gic-v3-its.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 291d7668cc8d..d721b6101e0a 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -5326,7 +5326,7 @@ static int __init its_probe_one(struct its_node *its)
err = its_init_domain(its);
if (err)
- goto out_free_tables;
+ goto out_free_col;
raw_spin_lock(&its_lock);
list_add(&its->entry, &its_nodes);
@@ -5334,6 +5334,8 @@ static int __init its_probe_one(struct its_node *its)
return 0;
+out_free_col:
+ kfree(its->collections);
out_free_tables:
its_free_tables(its);
out_free_cmd:
--
2.36.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v4 2/6] irqchip/gic-v3-its: Fix its node leak in gic_acpi_parse_madt_its()
2026-07-02 3:30 [PATCH v4 0/6] Some Minor fixes and cleanups to irqchip/gic-v3-its Kemeng Shi
2026-07-02 3:30 ` [PATCH v4 1/6] irqchip/gic-v3-its: Fix memleak in its_probe_one() Kemeng Shi
@ 2026-07-02 3:30 ` Kemeng Shi
2026-07-02 3:30 ` [PATCH v4 3/6] irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc() Kemeng Shi
` (3 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Kemeng Shi @ 2026-07-02 3:30 UTC (permalink / raw)
To: maz, tglx, jason, lpieralisi; +Cc: linux-arm-kernel, linux-kernel, Kemeng Shi
Fix its node leak when its_probe_one() failed in
gic_acpi_parse_madt_its().
Fixes: 9585a495ac936 ("irqchip/gic-v3-its: Split allocation from initialisation of its_node")
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
drivers/irqchip/irq-gic-v3-its.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index d721b6101e0a..3e4edcb64065 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -5747,9 +5747,13 @@ static int __init gic_acpi_parse_madt_its(union acpi_subtable_headers *header,
its->flags |= ITS_FLAGS_FORCE_NON_SHAREABLE;
err = its_probe_one(its);
- if (!err)
- return 0;
+ if (err)
+ goto probe_err;
+
+ return 0;
+probe_err:
+ its_node_destroy(its);
node_err:
iort_deregister_domain_token(its_entry->translation_id);
dom_err:
--
2.36.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v4 3/6] irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc()
2026-07-02 3:30 [PATCH v4 0/6] Some Minor fixes and cleanups to irqchip/gic-v3-its Kemeng Shi
2026-07-02 3:30 ` [PATCH v4 1/6] irqchip/gic-v3-its: Fix memleak in its_probe_one() Kemeng Shi
2026-07-02 3:30 ` [PATCH v4 2/6] irqchip/gic-v3-its: Fix its node leak in gic_acpi_parse_madt_its() Kemeng Shi
@ 2026-07-02 3:30 ` Kemeng Shi
2026-07-02 22:12 ` Marc Zyngier
2026-07-02 3:30 ` [PATCH v4 4/6] irqchip/gic-v3-its: Add ITS address info in more error logs Kemeng Shi
` (2 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Kemeng Shi @ 2026-07-02 3:30 UTC (permalink / raw)
To: maz, tglx, jason, lpieralisi; +Cc: linux-arm-kernel, linux-kernel, Kemeng Shi
When its_irq_gic_domain_alloc() fails, the following
its_vpe_irq_domain_free() skips calling its_vep_teardown() for the
corresponding irq. Call its_vpe_teardown() when its_irq_gic_domain_alloc()
is failedto avoid the leak issue.
Fixes: 7d75bbb4bc1ad ("irqchip/gic-v3-its: Add VPE irq domain allocation/teardown")
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
drivers/irqchip/irq-gic-v3-its.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 3e4edcb64065..8968bedefdba 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -4666,8 +4666,10 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq
break;
err = its_irq_gic_domain_alloc(domain, virq + i,
vm->vpes[i]->vpe_db_lpi);
- if (err)
+ if (err) {
+ its_vpe_teardown(vm->vpes[i]);
break;
+ }
irq_domain_set_hwirq_and_chip(domain, virq + i, i,
irqchip, vm->vpes[i]);
set_bit(i, bitmap);
--
2.36.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v4 3/6] irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc()
2026-07-02 3:30 ` [PATCH v4 3/6] irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc() Kemeng Shi
@ 2026-07-02 22:12 ` Marc Zyngier
2026-07-03 1:44 ` Kemeng Shi
0 siblings, 1 reply; 11+ messages in thread
From: Marc Zyngier @ 2026-07-02 22:12 UTC (permalink / raw)
To: Kemeng Shi; +Cc: tglx, jason, lpieralisi, linux-arm-kernel, linux-kernel
On Thu, 02 Jul 2026 04:30:47 +0100,
Kemeng Shi <shikemeng@huaweicloud.com> wrote:
>
> When its_irq_gic_domain_alloc() fails, the following
> its_vpe_irq_domain_free() skips calling its_vep_teardown() for the
> corresponding irq. Call its_vpe_teardown() when its_irq_gic_domain_alloc()
> is failedto avoid the leak issue.
>
> Fixes: 7d75bbb4bc1ad ("irqchip/gic-v3-its: Add VPE irq domain allocation/teardown")
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
> ---
> drivers/irqchip/irq-gic-v3-its.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
> index 3e4edcb64065..8968bedefdba 100644
> --- a/drivers/irqchip/irq-gic-v3-its.c
> +++ b/drivers/irqchip/irq-gic-v3-its.c
> @@ -4666,8 +4666,10 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq
> break;
> err = its_irq_gic_domain_alloc(domain, virq + i,
> vm->vpes[i]->vpe_db_lpi);
> - if (err)
> + if (err) {
> + its_vpe_teardown(vm->vpes[i]);
> break;
> + }
There is already a spot for error handling in this function, we don't
need a second one.
M.
--
Jazz isn't dead. It just smells funny.
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH v4 3/6] irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc()
2026-07-02 22:12 ` Marc Zyngier
@ 2026-07-03 1:44 ` Kemeng Shi
0 siblings, 0 replies; 11+ messages in thread
From: Kemeng Shi @ 2026-07-03 1:44 UTC (permalink / raw)
To: Marc Zyngier; +Cc: tglx, jason, lpieralisi, linux-arm-kernel, linux-kernel
在 2026/7/3 6:12:57, Marc Zyngier 写道:
>> When its_irq_gic_domain_alloc() fails, the following
>> its_vpe_irq_domain_free() skips calling its_vep_teardown() for the
>> corresponding irq. Call its_vpe_teardown() when its_irq_gic_domain_alloc()
>> is failedto avoid the leak issue.
>>
>> Fixes: 7d75bbb4bc1ad ("irqchip/gic-v3-its: Add VPE irq domain allocation/teardown")
>> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
>> ---
>> drivers/irqchip/irq-gic-v3-its.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
>> index 3e4edcb64065..8968bedefdba 100644
>> --- a/drivers/irqchip/irq-gic-v3-its.c
>> +++ b/drivers/irqchip/irq-gic-v3-its.c
>> @@ -4666,8 +4666,10 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq
>> break;
>> err = its_irq_gic_domain_alloc(domain, virq + i,
>> vm->vpes[i]->vpe_db_lpi);
>> - if (err)
>> + if (err) {
>> + its_vpe_teardown(vm->vpes[i]);
>> break;
>> + }
> There is already a spot for error handling in this function, we don't
> need a second one.
When its_irq_gic_domain_alloc() fails at index i, its_vpe_init(vpes[i])
has already succeeded but the exisiting its_vpe_irq_domain_free(domain, virq, i)
only tears down VPEs with index [0, i - 1], so its_vpe_teardown(vpes[i]) is still
needed.
So I guess you mean we can increase index when its_irq_gic_domain_alloc() fails to
free the resource with existing error handling?
Please correct me if I'm miss anything.
Thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v4 4/6] irqchip/gic-v3-its: Add ITS address info in more error logs
2026-07-02 3:30 [PATCH v4 0/6] Some Minor fixes and cleanups to irqchip/gic-v3-its Kemeng Shi
` (2 preceding siblings ...)
2026-07-02 3:30 ` [PATCH v4 3/6] irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc() Kemeng Shi
@ 2026-07-02 3:30 ` Kemeng Shi
2026-07-02 22:10 ` Marc Zyngier
2026-07-02 3:30 ` [PATCH v4 5/6] irqchip/gic-v3-its: Fix grammar and replace a bit number with its symbol Kemeng Shi
2026-07-02 3:30 ` [PATCH v4 6/6] irqchip/gic-v3-its: Remove redundant check in its_vpe_db_proxy_unmap_locked() Kemeng Shi
5 siblings, 1 reply; 11+ messages in thread
From: Kemeng Shi @ 2026-07-02 3:30 UTC (permalink / raw)
To: maz, tglx, jason, lpieralisi; +Cc: linux-arm-kernel, linux-kernel, Kemeng Shi
Multiple ITS units may exist in a system. When an error occurs, it is
difficult to identify which ITS triggered it because most error logs
lack the ITS address. Some logs already include this information and
is useful for debugging. Add the ITS address to the remaining error
logs so that all ITS-related errors can be consistently attributed to
a specific ITS instance.
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
drivers/irqchip/irq-gic-v3-its.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 8968bedefdba..244509701070 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -1120,7 +1120,7 @@ static struct its_cmd_block *its_allocate_entry(struct its_node *its)
while (its_queue_full(its)) {
count--;
if (!count) {
- pr_err_ratelimited("ITS queue not draining\n");
+ pr_err_ratelimited("ITS@%pa queue not draining\n", &its->phys_base);
return NULL;
}
cpu_relax();
@@ -1196,8 +1196,8 @@ static int its_wait_for_range_completion(struct its_node *its,
count--;
if (!count) {
- pr_err_ratelimited("ITS queue timeout (%llu %llu)\n",
- to_idx, linear_idx);
+ pr_err_ratelimited("ITS@%pa queue timeout (%llu %llu)\n",
+ &its->phys_base, to_idx, linear_idx);
return -1;
}
prev_idx = rd_idx;
@@ -1244,7 +1244,7 @@ post: \
raw_spin_unlock_irqrestore(&its->lock, flags); \
\
if (its_wait_for_range_completion(its, rd_idx, next_cmd)) \
- pr_err_ratelimited("ITS cmd %ps failed\n", builder); \
+ pr_err_ratelimited("ITS@%pa cmd %ps failed\n", &its->phys_base, &builder); \
}
static void its_build_sync_cmd(struct its_node *its,
@@ -2411,7 +2411,8 @@ static int its_setup_baser(struct its_node *its, struct its_baser *baser,
/* 52bit PA is supported only when PageSize=64K */
if (psz != SZ_64K) {
- pr_err("ITS: no 52bit PA support when psz=%d\n", psz);
+ pr_err("ITS@%pa: no 52bit PA support when psz=%d\n",
+ &its->phys_base, psz);
its_free_pages(base, order);
return -ENXIO;
}
@@ -5183,7 +5184,7 @@ static int its_init_vpe_domain(void)
vpe_proxy.dev = its_create_device(its, devid, entries, false);
if (!vpe_proxy.dev) {
kfree(vpe_proxy.vpes);
- pr_err("ITS: Can't allocate GICv4 proxy device\n");
+ pr_err("ITS@%pa: Can't allocate GICv4 proxy device\n", &its->phys_base);
return -ENOMEM;
}
--
2.36.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v4 4/6] irqchip/gic-v3-its: Add ITS address info in more error logs
2026-07-02 3:30 ` [PATCH v4 4/6] irqchip/gic-v3-its: Add ITS address info in more error logs Kemeng Shi
@ 2026-07-02 22:10 ` Marc Zyngier
2026-07-03 1:45 ` Kemeng Shi
0 siblings, 1 reply; 11+ messages in thread
From: Marc Zyngier @ 2026-07-02 22:10 UTC (permalink / raw)
To: Kemeng Shi; +Cc: tglx, lpieralisi, linux-arm-kernel, linux-kernel
On Thu, 02 Jul 2026 04:30:48 +0100,
Kemeng Shi <shikemeng@huaweicloud.com> wrote:
>
> Multiple ITS units may exist in a system. When an error occurs, it is
> difficult to identify which ITS triggered it because most error logs
> lack the ITS address. Some logs already include this information and
> is useful for debugging. Add the ITS address to the remaining error
> logs so that all ITS-related errors can be consistently attributed to
> a specific ITS instance.
I already said *no* to this.
If you want to log errors, implement a PMU or RAS driver that reports
errors on a per ITS basis, in a way that is collectable by existing
tooling.
The kernel log is not the place for your sorry debug hacks, which is
in general not readable by normal users. And I'd rather remove the
other instances as a matter of consistency.
M.
--
Jazz isn't dead. It just smells funny.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v4 4/6] irqchip/gic-v3-its: Add ITS address info in more error logs
2026-07-02 22:10 ` Marc Zyngier
@ 2026-07-03 1:45 ` Kemeng Shi
0 siblings, 0 replies; 11+ messages in thread
From: Kemeng Shi @ 2026-07-03 1:45 UTC (permalink / raw)
To: Marc Zyngier; +Cc: tglx, lpieralisi, linux-arm-kernel, linux-kernel
在 2026/7/3 6:10:09, Marc Zyngier 写道:
> On Thu, 02 Jul 2026 04:30:48 +0100,
> Kemeng Shi <shikemeng@huaweicloud.com> wrote:
>>
>> Multiple ITS units may exist in a system. When an error occurs, it is
>> difficult to identify which ITS triggered it because most error logs
>> lack the ITS address. Some logs already include this information and
>> is useful for debugging. Add the ITS address to the remaining error
>> logs so that all ITS-related errors can be consistently attributed to
>> a specific ITS instance.
>
> I already said *no* to this.
>
> If you want to log errors, implement a PMU or RAS driver that reports
> errors on a per ITS basis, in a way that is collectable by existing
> tooling.
>
> The kernel log is not the place for your sorry debug hacks, which is
> in general not readable by normal users. And I'd rather remove the
> other instances as a matter of consistency.
>
Will drop this in next version...> M.
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v4 5/6] irqchip/gic-v3-its: Fix grammar and replace a bit number with its symbol
2026-07-02 3:30 [PATCH v4 0/6] Some Minor fixes and cleanups to irqchip/gic-v3-its Kemeng Shi
` (3 preceding siblings ...)
2026-07-02 3:30 ` [PATCH v4 4/6] irqchip/gic-v3-its: Add ITS address info in more error logs Kemeng Shi
@ 2026-07-02 3:30 ` Kemeng Shi
2026-07-02 3:30 ` [PATCH v4 6/6] irqchip/gic-v3-its: Remove redundant check in its_vpe_db_proxy_unmap_locked() Kemeng Shi
5 siblings, 0 replies; 11+ messages in thread
From: Kemeng Shi @ 2026-07-02 3:30 UTC (permalink / raw)
To: maz, tglx, jason, lpieralisi; +Cc: linux-arm-kernel, linux-kernel, Kemeng Shi
Fix grammatical errors in comments and replace the bit offset '62'
with GITS_BASER_INDIRECT for better readability.
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
drivers/irqchip/irq-gic-v3-its.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 244509701070..120f6f29e978 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -163,7 +163,7 @@ struct event_lpi_map {
/*
* The ITS view of a device - belongs to an ITS, owns an interrupt
- * translation table, and a list of interrupts. If it some of its
+ * translation table, and a list of interrupts. If some of its
* LPIs are injected into a guest (GICv4), the event_map.vm field
* indicates which one.
*/
@@ -2504,7 +2504,7 @@ static bool its_parse_indirect_baser(struct its_node *its,
if ((esz << ids) > (psz * 2)) {
/*
* Find out whether hw supports a single or two-level table by
- * table by reading bit at offset '62' after writing '1' to it.
+ * reading GITS_BASER_INDIRECT after writing '1' to it.
*/
its_write_baser(its, baser, val | GITS_BASER_INDIRECT);
indirect = !!(baser->val & GITS_BASER_INDIRECT);
--
2.36.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v4 6/6] irqchip/gic-v3-its: Remove redundant check in its_vpe_db_proxy_unmap_locked()
2026-07-02 3:30 [PATCH v4 0/6] Some Minor fixes and cleanups to irqchip/gic-v3-its Kemeng Shi
` (4 preceding siblings ...)
2026-07-02 3:30 ` [PATCH v4 5/6] irqchip/gic-v3-its: Fix grammar and replace a bit number with its symbol Kemeng Shi
@ 2026-07-02 3:30 ` Kemeng Shi
5 siblings, 0 replies; 11+ messages in thread
From: Kemeng Shi @ 2026-07-02 3:30 UTC (permalink / raw)
To: maz, tglx, jason, lpieralisi; +Cc: linux-arm-kernel, linux-kernel, Kemeng Shi
The high level functions already ensure that gic_rdists->has_rvpeid
is false before calling its_vpe_db_proxy_unmap_locked(), so we can
remove the redundant check in its_vpe_db_proxy_unmap_locked()
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
drivers/irqchip/irq-gic-v3-its.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 120f6f29e978..b0069fbe1e69 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -3801,10 +3801,6 @@ static const struct irq_domain_ops its_domain_ops = {
*/
static void its_vpe_db_proxy_unmap_locked(struct its_vpe *vpe)
{
- /* GICv4.1 doesn't use a proxy, so nothing to do here */
- if (gic_rdists->has_rvpeid)
- return;
-
/* Already unmapped? */
if (vpe->vpe_proxy_event == -1)
return;
--
2.36.1
^ permalink raw reply related [flat|nested] 11+ messages in thread