dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Aneesh Kumar K.V (Arm)" <aneesh.kumar@kernel.org>
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: Thu, 24 Sep 2026 10:19:28 +0000	[thread overview]
Message-ID: <20260924101929.815D81F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260924100529.1398790-4-aneesh.kumar@kernel.org>

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?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260924100529.1398790-1-aneesh.kumar@kernel.org?part=3

  reply	other threads:[~2026-09-24 10:19 UTC|newest]

Thread overview: 24+ 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-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-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 [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-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-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-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=20260924101929.815D81F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=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