Linux KVM/arm64 development list
 help / color / mirror / Atom feed
From: Aneesh Kumar K.V <aneesh.kumar@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: media-ci@linuxtv.org, kvmarm@lists.linux.dev,
	Oliver Upton <oupton@kernel.org>, Marc Zyngier <maz@kernel.org>,
	dri-devel@lists.freedesktop.org
Subject: Re: [RFC PATCH v8 03/14] irqchip/gic-v3-its: Resolve the default NUMA node explicitly
Date: Tue, 13 Oct 2026 11:16:32 +0530	[thread overview]
Message-ID: <yq5awlrmqhjb.fsf@kernel.org> (raw)
In-Reply-To: <20260924101929.815D81F00893@smtp.kernel.org>

sashiko-bot@kernel.org writes:

> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] irqchip/gic-v3-its: incomplete NUMA_NO_NODE resolution exposes allocations to task mempolicy
> --
>
> commit 6d762ab83972132164ae57c1422f1916decb2fe3
> Author: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>
>
>     irqchip/gic-v3-its: Resolve the default NUMA node explicitly
>     
>     alloc_pages_node() resolves NUMA_NO_NODE to numa_mem_id() internally. In
>     preparation for switching ITS allocations to the CoCo shared memory
>     allocator, resolve the default node explicitly in its_alloc_pages().
>     
>     The CoCo shared memory allocator interprets NUMA_NO_NODE as a request to
>     apply the current task's memory policy. Passing numa_mem_id() instead
>     preserves the existing nearest-memory-node placement across the
>     allocator switch. This patch does not change the current allocation
>     behavior.
>
>> diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
>> --- a/drivers/irqchip/irq-gic-v3-its.c
>> +++ b/drivers/irqchip/irq-gic-v3-its.c
>> @@ -236,7 +237,7 @@ static struct page *its_alloc_pages_node(int node, gfp_t gfp,
>>  
>>  static struct page *its_alloc_pages(gfp_t gfp, unsigned int order)
>>  {
>> -	return its_alloc_pages_node(NUMA_NO_NODE, gfp, order);
>> +	return its_alloc_pages_node(numa_mem_id(), gfp, order);
>>  }
>
> [Severity: Medium]
> Will this leave other callers of its_alloc_pages_node() exposed to the
> task memory policy change?
>
> When a device probe or ITT allocation occurs with its->numa_node ==
> NUMA_NO_NODE (which is common when firmware lacks NUMA info), callers pass
> NUMA_NO_NODE directly to its_alloc_pages_node():
>
> drivers/irqchip/irq-gic-v3-its.c:its_alloc_pages_node() {
> 	...
> 	page = alloc_pages_node(node, gfp | gfp_flags_quirk, order);
> 	...
> }
>
> If node is NUMA_NO_NODE, it passes it directly to the underlying allocator.
> When the underlying allocator interprets NUMA_NO_NODE as a request to apply
> task mempolicy, these direct callers will be subjected to the current task's
> memory policy instead of bypassing it and using the local node. 
>
> If a user binds the driver via sysfs under a restrictive task mempolicy,
> the allocations could land on suboptimal distant nodes or fail entirely.
>
> Should the NUMA_NO_NODE resolution logic be moved inside its_alloc_pages_node()
> to ensure all callers are protected?

Yes, updated the patch to perform the mapping in its_alloc_pages_node(),
so all callers are handled.

@@ -216,6 +217,9 @@ static struct page *its_alloc_pages_node(int node, gfp_t gfp,
 	struct page *page;
 	int ret = 0;
 
+	if (node == NUMA_NO_NODE)
+		node = numa_mem_id();
+
 	page = alloc_pages_node(node, gfp | gfp_flags_quirk, order);
 
 	if (!page)

  reply	other threads:[~2026-10-13  5:46 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 10:05 [RFC PATCH v8 00/14] coco: guest: Add a shared-granule allocator for host-shared memory Aneesh Kumar K.V (Arm)
2026-09-24 10:05 ` [RFC PATCH v8 01/14] mm: Add an allocator for CoCo shared memory Aneesh Kumar K.V (Arm)
2026-09-24 10:19   ` sashiko-bot
2026-09-24 14:22     ` Aneesh Kumar K.V
2026-09-24 18:26       ` Jason Gunthorpe
2026-10-13  5:02         ` Aneesh Kumar K.V
2026-10-13 12:14           ` Jason Gunthorpe
2026-09-24 10:05 ` [RFC PATCH v8 02/14] mm: Zero memory during shared memory transitions Aneesh Kumar K.V (Arm)
2026-09-24 10:22   ` sashiko-bot
2026-09-25 12:08   ` Kiryl Shutsemau
2026-10-13  5:12     ` Aneesh Kumar K.V
2026-10-13 13:47       ` Kiryl Shutsemau
2026-09-24 10:05 ` [RFC PATCH v8 03/14] irqchip/gic-v3-its: Resolve the default NUMA node explicitly Aneesh Kumar K.V (Arm)
2026-09-24 10:19   ` sashiko-bot
2026-10-13  5:46     ` Aneesh Kumar K.V [this message]
2026-09-24 10:05 ` [RFC PATCH v8 04/14] irqchip/gic-v3-its: Allocate shared tables using CoCo shared memory allocator Aneesh Kumar K.V (Arm)
2026-09-24 10:19   ` sashiko-bot
2026-10-13  6:04     ` Aneesh Kumar K.V
2026-09-24 10:05 ` [RFC PATCH v8 05/14] dma-contiguous: Derive shared alignment from DMA attributes Aneesh Kumar K.V (Arm)
2026-09-24 10:05 ` [RFC PATCH v8 06/14] dma-pool: Allocate CoCo atomic pools using CoCo shared memory allocator Aneesh Kumar K.V (Arm)
2026-09-24 10:19   ` sashiko-bot
2026-10-13  6:11     ` Aneesh Kumar K.V
2026-09-24 10:05 ` [RFC PATCH v8 07/14] dma-direct: Align CoCo shared DMA allocations to the shared granule size Aneesh Kumar K.V (Arm)
2026-09-24 10:05 ` [RFC PATCH v8 08/14] swiotlb: Align shared IO TLB pools " Aneesh Kumar K.V (Arm)
2026-09-24 10:22   ` sashiko-bot
2026-10-13  6:46     ` Aneesh Kumar K.V
2026-09-24 10:05 ` [RFC PATCH v8 09/14] swiotlb: Reject misaligned restricted DMA pools for CoCo guests Aneesh Kumar K.V (Arm)
2026-09-24 10:05 ` [RFC PATCH v8 10/14] dma-buf: system_heap: Limit scatterlist entries to the buffer size Aneesh Kumar K.V (Arm)
2026-09-24 10:05 ` [RFC PATCH v8 11/14] dma-buf: system_heap: Allocate shared buffers using CoCo shared memory allocator Aneesh Kumar K.V (Arm)
2026-09-24 10:05 ` [RFC PATCH v8 12/14] swiotlb: Make rounded shared pool capacity allocatable Aneesh Kumar K.V (Arm)
2026-09-24 10:05 ` [RFC PATCH v8 13/14] mm: Assert CoCo shared allocations may sleep Aneesh Kumar K.V (Arm)
2026-09-24 10:05 ` [RFC PATCH v8 14/14] irqchip/gic-v3-its: Preallocate VPE L1 tables Aneesh Kumar K.V (Arm)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yq5awlrmqhjb.fsf@kernel.org \
    --to=aneesh.kumar@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=media-ci@linuxtv.org \
    --cc=oupton@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox