Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/6] Some Minor fixes and cleanups to
@ 2026-06-23  2:01 Kemeng Shi
  2026-06-23  2:01 ` [PATCH v3 1/6] irqchip/gic-v3-its: Fix memleak in its_probe_one() Kemeng Shi
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Kemeng Shi @ 2026-06-23  2:01 UTC (permalink / raw)
  To: maz, tglx; +Cc: linux-arm-kernel, linux-kernel, shikemeng

There are some random fixes and cleanups to irqchip/gic-v3-its. More
details can be found in respective patches.
Thanks.

v1->v2:
- Drop unneeded patches and some minor improvement.
v2->v3:
- Fix an extra leak issue in its_vpe_irq_domain_alloc().
- Remove redundant check in its_vpe_db_proxy_unmap_locked()

Kemeng Shi (6):
  irqchip/gic-v3-its: Fix memleak in its_probe_one()
  irqchip/gic-v3-its: Fix its node leak in gic_acpi_parse_madt_its()
  irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc()
  irqchip/gic-v3-its: Add ITS address info in more error logs
  irqchip/gic-v3-its: some minor improvement in comments
  irqchip/gic-v3-its: Remove redundant check in
    its_vpe_db_proxy_unmap_locked()

 drivers/irqchip/irq-gic-v3-its.c | 37 ++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 16 deletions(-)

-- 
2.36.1



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3 1/6] irqchip/gic-v3-its: Fix memleak in its_probe_one()
  2026-06-23  2:01 [PATCH v3 0/6] Some Minor fixes and cleanups to Kemeng Shi
@ 2026-06-23  2:01 ` Kemeng Shi
  2026-06-30 16:40   ` Thomas Gleixner
  2026-06-23  2:01 ` [PATCH v3 2/6] irqchip/gic-v3-its: Fix its node leak in gic_acpi_parse_madt_its() Kemeng Shi
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Kemeng Shi @ 2026-06-23  2:01 UTC (permalink / raw)
  To: maz, tglx; +Cc: linux-arm-kernel, linux-kernel, shikemeng

Fix collection leak when its_init_domain() failed in its_probe_one().

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] 13+ messages in thread

* [PATCH v3 2/6] irqchip/gic-v3-its: Fix its node leak in gic_acpi_parse_madt_its()
  2026-06-23  2:01 [PATCH v3 0/6] Some Minor fixes and cleanups to Kemeng Shi
  2026-06-23  2:01 ` [PATCH v3 1/6] irqchip/gic-v3-its: Fix memleak in its_probe_one() Kemeng Shi
@ 2026-06-23  2:01 ` Kemeng Shi
  2026-06-30 16:40   ` Thomas Gleixner
  2026-06-23  2:01 ` [PATCH v3 3/6] irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc() Kemeng Shi
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Kemeng Shi @ 2026-06-23  2:01 UTC (permalink / raw)
  To: maz, tglx; +Cc: linux-arm-kernel, linux-kernel, shikemeng

Fix its node leak when its_probe_one() failed in
gic_acpi_parse_madt_its().

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] 13+ messages in thread

* [PATCH v3 3/6] irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc()
  2026-06-23  2:01 [PATCH v3 0/6] Some Minor fixes and cleanups to Kemeng Shi
  2026-06-23  2:01 ` [PATCH v3 1/6] irqchip/gic-v3-its: Fix memleak in its_probe_one() Kemeng Shi
  2026-06-23  2:01 ` [PATCH v3 2/6] irqchip/gic-v3-its: Fix its node leak in gic_acpi_parse_madt_its() Kemeng Shi
@ 2026-06-23  2:01 ` Kemeng Shi
  2026-06-30 16:42   ` Thomas Gleixner
  2026-06-23  2:01 ` [PATCH v3 4/6] irqchip/gic-v3-its: Add ITS address info in more error logs Kemeng Shi
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Kemeng Shi @ 2026-06-23  2:01 UTC (permalink / raw)
  To: maz, tglx; +Cc: linux-arm-kernel, linux-kernel, shikemeng

We miss to teardown the vpe when its_irq_gic_domain_alloc() is failed.
Just fix this.

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] 13+ messages in thread

* [PATCH v3 4/6] irqchip/gic-v3-its: Add ITS address info in more error logs
  2026-06-23  2:01 [PATCH v3 0/6] Some Minor fixes and cleanups to Kemeng Shi
                   ` (2 preceding siblings ...)
  2026-06-23  2:01 ` [PATCH v3 3/6] irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc() Kemeng Shi
@ 2026-06-23  2:01 ` Kemeng Shi
  2026-06-30 16:43   ` Thomas Gleixner
  2026-06-23  2:01 ` [PATCH v3 5/6] irqchip/gic-v3-its: some minor improvement in comments Kemeng Shi
  2026-06-23  2:01 ` [PATCH v3 6/6] irqchip/gic-v3-its: Remove redundant check in its_vpe_db_proxy_unmap_locked() Kemeng Shi
  5 siblings, 1 reply; 13+ messages in thread
From: Kemeng Shi @ 2026-06-23  2:01 UTC (permalink / raw)
  To: maz, tglx; +Cc: linux-arm-kernel, linux-kernel, shikemeng

We have a lot of logs containing ITS address info which is helpful to
distiguish which ITS occurs error. Just add ITS address info into more
exsiting error logs.

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] 13+ messages in thread

* [PATCH v3 5/6] irqchip/gic-v3-its: some minor improvement in comments
  2026-06-23  2:01 [PATCH v3 0/6] Some Minor fixes and cleanups to Kemeng Shi
                   ` (3 preceding siblings ...)
  2026-06-23  2:01 ` [PATCH v3 4/6] irqchip/gic-v3-its: Add ITS address info in more error logs Kemeng Shi
@ 2026-06-23  2:01 ` Kemeng Shi
  2026-06-30 16:46   ` Thomas Gleixner
  2026-06-23  2:01 ` [PATCH v3 6/6] irqchip/gic-v3-its: Remove redundant check in its_vpe_db_proxy_unmap_locked() Kemeng Shi
  5 siblings, 1 reply; 13+ messages in thread
From: Kemeng Shi @ 2026-06-23  2:01 UTC (permalink / raw)
  To: maz, tglx; +Cc: linux-arm-kernel, linux-kernel, shikemeng

1. "If it some" -> "If some"
2. "by table by reading" -> by reading"
3. "reading bit at offset '62'" -> "reading GITS_BASER_INDIRECT"

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] 13+ messages in thread

* [PATCH v3 6/6] irqchip/gic-v3-its: Remove redundant check in its_vpe_db_proxy_unmap_locked()
  2026-06-23  2:01 [PATCH v3 0/6] Some Minor fixes and cleanups to Kemeng Shi
                   ` (4 preceding siblings ...)
  2026-06-23  2:01 ` [PATCH v3 5/6] irqchip/gic-v3-its: some minor improvement in comments Kemeng Shi
@ 2026-06-23  2:01 ` Kemeng Shi
  5 siblings, 0 replies; 13+ messages in thread
From: Kemeng Shi @ 2026-06-23  2:01 UTC (permalink / raw)
  To: maz, tglx; +Cc: linux-arm-kernel, linux-kernel, shikemeng

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] 13+ messages in thread

* Re: [PATCH v3 1/6] irqchip/gic-v3-its: Fix memleak in its_probe_one()
  2026-06-23  2:01 ` [PATCH v3 1/6] irqchip/gic-v3-its: Fix memleak in its_probe_one() Kemeng Shi
@ 2026-06-30 16:40   ` Thomas Gleixner
  0 siblings, 0 replies; 13+ messages in thread
From: Thomas Gleixner @ 2026-06-30 16:40 UTC (permalink / raw)
  To: Kemeng Shi, maz; +Cc: linux-arm-kernel, linux-kernel, shikemeng

On Tue, Jun 23 2026 at 10:01, Kemeng Shi wrote:
> Fix collection leak when its_init_domain() failed in its_probe_one().
>

Lacks a Fixes: tag


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 2/6] irqchip/gic-v3-its: Fix its node leak in gic_acpi_parse_madt_its()
  2026-06-23  2:01 ` [PATCH v3 2/6] irqchip/gic-v3-its: Fix its node leak in gic_acpi_parse_madt_its() Kemeng Shi
@ 2026-06-30 16:40   ` Thomas Gleixner
  0 siblings, 0 replies; 13+ messages in thread
From: Thomas Gleixner @ 2026-06-30 16:40 UTC (permalink / raw)
  To: Kemeng Shi, maz; +Cc: linux-arm-kernel, linux-kernel, shikemeng

On Tue, Jun 23 2026 at 10:01, Kemeng Shi wrote:

> Fix its node leak when its_probe_one() failed in
> gic_acpi_parse_madt_its().

Lacks a Fixes: tag as well


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 3/6] irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc()
  2026-06-23  2:01 ` [PATCH v3 3/6] irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc() Kemeng Shi
@ 2026-06-30 16:42   ` Thomas Gleixner
  0 siblings, 0 replies; 13+ messages in thread
From: Thomas Gleixner @ 2026-06-30 16:42 UTC (permalink / raw)
  To: Kemeng Shi, maz; +Cc: linux-arm-kernel, linux-kernel, shikemeng

On Tue, Jun 23 2026 at 10:01, Kemeng Shi wrote:
> We miss to teardown the vpe when its_irq_gic_domain_alloc() is failed.

We miss nothing. Change logs want to be written in passive voice. It's documented.

> Just fix this.

'Just fix this' tells nothing and is just a sloppy pointless phrase.

Lacks a Fixes: tag as well


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 4/6] irqchip/gic-v3-its: Add ITS address info in more error logs
  2026-06-23  2:01 ` [PATCH v3 4/6] irqchip/gic-v3-its: Add ITS address info in more error logs Kemeng Shi
@ 2026-06-30 16:43   ` Thomas Gleixner
  0 siblings, 0 replies; 13+ messages in thread
From: Thomas Gleixner @ 2026-06-30 16:43 UTC (permalink / raw)
  To: Kemeng Shi, maz; +Cc: linux-arm-kernel, linux-kernel, shikemeng

On Tue, Jun 23 2026 at 10:01, Kemeng Shi wrote:
> We have a lot of logs containing ITS address info which is helpful to

We have nothing ...

> distiguish which ITS occurs error. Just add ITS address info into more
> exsiting error logs.

existing

'Just add ITS ...' does tell WHAT the patch does but does not explian
WHY this is required, useful or whatever reason you have.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 5/6] irqchip/gic-v3-its: some minor improvement in comments
  2026-06-23  2:01 ` [PATCH v3 5/6] irqchip/gic-v3-its: some minor improvement in comments Kemeng Shi
@ 2026-06-30 16:46   ` Thomas Gleixner
  2026-07-02  2:46     ` Kemeng Shi
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas Gleixner @ 2026-06-30 16:46 UTC (permalink / raw)
  To: Kemeng Shi, maz; +Cc: linux-arm-kernel, linux-kernel, shikemeng

On Tue, Jun 23 2026 at 10:01, Kemeng Shi wrote:

> 1. "If it some" -> "If some"
> 2. "by table by reading" -> by reading"
> 3. "reading bit at offset '62'" -> "reading GITS_BASER_INDIRECT"

Please don't enumerate WHAT the patch is doing. We all can see that from
the patch itself.

Something like that is sufficient and clear enough:

  'Fix grammar and replace a bit number with the symbol for better
   readability'



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 5/6] irqchip/gic-v3-its: some minor improvement in comments
  2026-06-30 16:46   ` Thomas Gleixner
@ 2026-07-02  2:46     ` Kemeng Shi
  0 siblings, 0 replies; 13+ messages in thread
From: Kemeng Shi @ 2026-07-02  2:46 UTC (permalink / raw)
  To: Thomas Gleixner, maz; +Cc: linux-arm-kernel, linux-kernel

在 2026/7/1 0:46:40, Thomas Gleixner 写道:
> On Tue, Jun 23 2026 at 10:01, Kemeng Shi wrote:
> 
>> 1. "If it some" -> "If some"
>> 2. "by table by reading" -> by reading"
>> 3. "reading bit at offset '62'" -> "reading GITS_BASER_INDIRECT"
> 
> Please don't enumerate WHAT the patch is doing. We all can see that from
> the patch itself.
> 
> Something like that is sufficient and clear enough:
> 
>   'Fix grammar and replace a bit number with the symbol for better
>    readability'
Thanks for all the review and corrections to this patchset. I'm sorry
for these sloppy mistakes and will fix them in the next version.



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-07-02  2:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-23  2:01 [PATCH v3 0/6] Some Minor fixes and cleanups to Kemeng Shi
2026-06-23  2:01 ` [PATCH v3 1/6] irqchip/gic-v3-its: Fix memleak in its_probe_one() Kemeng Shi
2026-06-30 16:40   ` Thomas Gleixner
2026-06-23  2:01 ` [PATCH v3 2/6] irqchip/gic-v3-its: Fix its node leak in gic_acpi_parse_madt_its() Kemeng Shi
2026-06-30 16:40   ` Thomas Gleixner
2026-06-23  2:01 ` [PATCH v3 3/6] irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc() Kemeng Shi
2026-06-30 16:42   ` Thomas Gleixner
2026-06-23  2:01 ` [PATCH v3 4/6] irqchip/gic-v3-its: Add ITS address info in more error logs Kemeng Shi
2026-06-30 16:43   ` Thomas Gleixner
2026-06-23  2:01 ` [PATCH v3 5/6] irqchip/gic-v3-its: some minor improvement in comments Kemeng Shi
2026-06-30 16:46   ` Thomas Gleixner
2026-07-02  2:46     ` Kemeng Shi
2026-06-23  2:01 ` [PATCH v3 6/6] irqchip/gic-v3-its: Remove redundant check in its_vpe_db_proxy_unmap_locked() Kemeng Shi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox