Linux Tegra architecture development
 help / color / mirror / Atom feed
From: Pedro Falcato <pfalcato@suse.de>
To: Lorenzo Stoakes <ljs@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	 Russell King <linux@armlinux.org.uk>,
	Dinh Nguyen <dinguyen@kernel.org>,
	 Simon Schuster <schuster.simon@siemens-energy.com>,
	 "James E . J . Bottomley"
	<James.Bottomley@hansenpartnership.com>,
	Helge Deller <deller@gmx.de>,
	 Jarkko Sakkinen <jarkko@kernel.org>,
	Thomas Gleixner <tglx@kernel.org>,
	 Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	 Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, Ian Abbott <abbotti@mev.co.uk>,
	 H Hartley Sweeten <hsweeten@visionengravers.com>,
	Lucas Stach <l.stach@pengutronix.de>,
	 David Airlie <airlied@gmail.com>,
	Simona Vetter <simona@ffwll.ch>,
	 Patrik Jakobsson <patrik.r.jakobsson@gmail.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	 Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	 Rob Clark <robin.clark@oss.qualcomm.com>,
	Dmitry Baryshkov <lumag@kernel.org>,
	 Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
	Thierry Reding <thierry.reding@kernel.org>,
	 Mikko Perttunen <mperttunen@nvidia.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	 Christian Koenig <christian.koenig@amd.com>,
	Huang Rui <ray.huang@amd.com>, Ankit Agrawal <ankita@nvidia.com>,
	 Alex Williamson <alex@shazbot.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	 Christian Brauner <brauner@kernel.org>,
	Dan Williams <djbw@kernel.org>,
	 Muchun Song <muchun.song@linux.dev>,
	Oscar Salvador <osalvador@suse.de>,
	 David Hildenbrand <david@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	 "Liam R . Howlett" <liam@infradead.org>,
	Matthew Wilcox <willy@infradead.org>,
	 Marek Szyprowski <m.szyprowski@samsung.com>,
	Peter Zijlstra <peterz@infradead.org>,
	 Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	 Masami Hiramatsu <mhiramat@kernel.org>,
	Oleg Nesterov <oleg@redhat.com>,
	 Steven Rostedt <rostedt@goodmis.org>,
	SeongJae Park <sj@kernel.org>, Miaohe Lin <linmiaohe@huawei.com>,
	 Hugh Dickins <hughd@google.com>, Mike Rapoport <rppt@kernel.org>,
	Kees Cook <kees@kernel.org>,  Paolo Bonzini <pbonzini@redhat.com>,
	linux-kernel@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-parisc@vger.kernel.org, linux-sgx@vger.kernel.org,
	 etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-arm-msm@vger.kernel.org,  freedreno@lists.freedesktop.org,
	linux-tegra@vger.kernel.org, kvm@vger.kernel.org,
	 linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev,
	linux-mm@kvack.org,  iommu@lists.linux.dev,
	linux-perf-users@vger.kernel.org,
	 linux-trace-kernel@vger.kernel.org, kasan-dev@googlegroups.com,
	damon@lists.linux.dev,  Rik van Riel <riel@surriel.com>,
	Harry Yoo <harry@kernel.org>, Jann Horn <jannh@google.com>
Subject: Re: [PATCH 27/30] mm/vma: correct incorrect vma.h inclusion
Date: Thu, 2 Jul 2026 12:40:30 +0100	[thread overview]
Message-ID: <akZNiN5Y9fPk8bZH@pedro-suse.lan> (raw)
In-Reply-To: <22d0f4e3fe11f6fd1312734e242d008267ad142c.1782735110.git.ljs@kernel.org>

On Mon, Jun 29, 2026 at 01:23:38PM +0100, Lorenzo Stoakes wrote:
> The only files which should be including vma.h are the implementation files
> for the core VMA logic - vma.c, vma_init.c, and vma_exec.c.
> 
> This is in order to allow for userland testing of core VMA logic. In this
> cases, vma_internal.h and vma.h are included, providing both the
> dependencies upon which the core VMA logic requires and its declarations.
> 
> Userland testable VMA logic is achieved by having separate vma_internal.h
> implementations for userland and kernel.
> 
> Callers other than the core VMA implementation should include internal.h
> instead. This header does not need to include vma_internal.h as it only
> contains the vma.h declarations, for which the includes already present
> suffice.
> 
> Update code to reflect this, update comments to reflect the fact there are
> 3 VMA implementation files and document things more clearly.
> 
> While we're here, slightly improve the language of the comment describing
> vma_exec.c.

Two random thoughts:
1) perhaps vma.h -> vma_private.h
2) https://lore.kernel.org/all/CAHk-=wghMm2c+AYEcwYY7drSVXB27DYqc-ZXpFiq=XFs-w59wA@mail.gmail.com/
   mm/vma/whatever.c :) would PROBABLY solve the issue of people snooping vma.h

> 
> No functional change intended.
> 
> Signed-off-by: Lorenzo Stoakes <ljs@kernel.org>

Reviewed-by: Pedro Falcato <pfalcato@suse.de>

> ---
>  mm/mmu_notifier.c | 2 +-
>  mm/nommu.c        | 1 -
>  mm/vma.c          | 4 ++++
>  mm/vma.h          | 9 ++++++++-
>  mm/vma_exec.c     | 8 ++++++--
>  mm/vma_init.c     | 4 ++++
>  mm/vma_internal.h | 4 ++--
>  7 files changed, 25 insertions(+), 7 deletions(-)
> 
> diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c
> index 245b74f39f91..df69ba6e797f 100644
> --- a/mm/mmu_notifier.c
> +++ b/mm/mmu_notifier.c
> @@ -19,7 +19,7 @@
>  #include <linux/sched/mm.h>
>  #include <linux/slab.h>
>  
> -#include "vma.h"
> +#include "internal.h"
>  
>  /* global SRCU for all MMs */
>  DEFINE_STATIC_SRCU(srcu);
> diff --git a/mm/nommu.c b/mm/nommu.c
> index ba1c923c0942..4fef6fbbd6e9 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -41,7 +41,6 @@
>  #include <asm/tlbflush.h>
>  #include <asm/mmu_context.h>
>  #include "internal.h"
> -#include "vma.h"
>  
>  unsigned long highest_memmap_pfn;
>  int heap_stack_gap = 0;
> diff --git a/mm/vma.c b/mm/vma.c
> index d727150e377a..5c3062e0e706 100644
> --- a/mm/vma.c
> +++ b/mm/vma.c
> @@ -4,6 +4,10 @@
>   * VMA-specific functions.
>   */
>  
> +/*
> + * To allow for userland testing we place internal dependencies in
> + * vma_internal.h and external VMA API declarations in vma.h.
> + */
>  #include "vma_internal.h"
>  #include "vma.h"
>  
> diff --git a/mm/vma.h b/mm/vma.h
> index 155eadda47aa..f4f885615a92 100644
> --- a/mm/vma.h
> +++ b/mm/vma.h
> @@ -2,7 +2,14 @@
>  /*
>   * vma.h
>   *
> - * Core VMA manipulation API implemented in vma.c.
> + * Core VMA manipulation API implemented in vma.c, vma_init.c and vma_exec.c.
> + *
> + * Note that, in order for VMA logic to be userland testable, this header
> + * intentionally includes no dependencies.
> + *
> + * This is specifically scoped to mm-only. Users of this functionality (other
> + * than the core VMA implementation itself) should not include this header
> + * directly, but rather include internal.h.
>   */
>  #ifndef __MM_VMA_H
>  #define __MM_VMA_H
> diff --git a/mm/vma_exec.c b/mm/vma_exec.c
> index 0107a6e3918c..c0f7ba2cfb27 100644
> --- a/mm/vma_exec.c
> +++ b/mm/vma_exec.c
> @@ -1,10 +1,14 @@
>  // SPDX-License-Identifier: GPL-2.0-only
>  
>  /*
> - * Functions explicitly implemented for exec functionality which however are
> - * explicitly VMA-only logic.
> + * Functions provided for exec functionality which however are
> + * specifically VMA-only logic.
>   */
>  
> +/*
> + * To allow for userland testing we place internal dependencies in
> + * vma_internal.h and external VMA API declarations in vma.h.
> + */
>  #include "vma_internal.h"
>  #include "vma.h"
>  
> diff --git a/mm/vma_init.c b/mm/vma_init.c
> index a459669a1654..715feee283f0 100644
> --- a/mm/vma_init.c
> +++ b/mm/vma_init.c
> @@ -5,6 +5,10 @@
>   * between CONFIG_MMU and non-CONFIG_MMU kernel configurations.
>   */
>  
> +/*
> + * To allow for userland testing we place internal dependencies in
> + * vma_internal.h and external VMA API declarations in vma.h.
> + */
>  #include "vma_internal.h"
>  #include "vma.h"
>  
> diff --git a/mm/vma_internal.h b/mm/vma_internal.h
> index 2da6d224c1a8..4d300e7bbaf4 100644
> --- a/mm/vma_internal.h
> +++ b/mm/vma_internal.h
> @@ -2,8 +2,8 @@
>  /*
>   * vma_internal.h
>   *
> - * Headers required by vma.c, which can be substituted accordingly when testing
> - * VMA functionality.
> + * Headers required by vma.c, vma_init.c and vma_exec.c, which can be
> + * substituted accordingly when testing VMA functionality.
>   */
>  
>  #ifndef __MM_VMA_INTERNAL_H
> -- 
> 2.54.0
> 

-- 
Pedro

  reply	other threads:[~2026-07-02 11:40 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29 12:23 [PATCH 00/30] mm: make VMA page offset handling more consistent Lorenzo Stoakes
2026-06-29 12:23 ` [PATCH 01/30] mm: move vma_start_pgoff() into mm.h and clean up Lorenzo Stoakes
2026-06-29 15:27   ` Gregory Price
2026-06-30 16:10   ` Pedro Falcato
2026-07-01  9:42     ` Lorenzo Stoakes
2026-06-29 12:23 ` [PATCH 02/30] mm: add kdoc comments for vma_start/last_pgoff() Lorenzo Stoakes
2026-06-29 15:31   ` Gregory Price
2026-06-30 16:11   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 03/30] tools/testing/vma: use vma_start_pgoff() in merge tests Lorenzo Stoakes
2026-06-29 15:40   ` Gregory Price
2026-06-29 16:35     ` Lorenzo Stoakes
2026-06-30 16:12   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 04/30] mm: introduce and use vma_end_pgoff() Lorenzo Stoakes
2026-06-29 15:54   ` Gregory Price
2026-06-30 16:13   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 05/30] mm/rmap: update mm/interval_tree.c comments Lorenzo Stoakes
2026-06-29 16:01   ` Gregory Price
2026-06-29 16:41     ` Lorenzo Stoakes
2026-06-29 17:11       ` Gregory Price
2026-06-29 17:40         ` Lorenzo Stoakes
2026-06-30 16:16   ` Pedro Falcato
2026-07-01  9:55     ` Lorenzo Stoakes
2026-06-29 12:23 ` [PATCH 06/30] mm/rmap: parameterise vma_interval_tree_*() by address_space Lorenzo Stoakes
2026-06-30 16:19   ` Pedro Falcato
2026-07-01  9:56     ` Lorenzo Stoakes
2026-06-29 12:23 ` [PATCH 07/30] mm/rmap: elide unnecessary static inline's in interval_tree.c Lorenzo Stoakes
2026-06-30 15:30   ` Gregory Price
2026-06-30 16:22   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 08/30] mm/rmap: rename vma_interval_tree_*() to mapping_interval_tree_*() Lorenzo Stoakes
2026-06-30 15:42   ` Gregory Price
2026-06-30 16:28   ` Pedro Falcato
2026-07-01 10:14     ` Lorenzo Stoakes
2026-06-29 12:23 ` [PATCH 09/30] mm/rmap: parameterise anon_vma_interval_tree_*() by anon_vma Lorenzo Stoakes
2026-06-30 15:46   ` Gregory Price
2026-06-30 15:49     ` Lorenzo Stoakes
2026-06-30 15:55       ` Gregory Price
2026-06-30 15:59         ` Lorenzo Stoakes
2026-06-30 16:32   ` Pedro Falcato
2026-07-01 10:18     ` Lorenzo Stoakes
2026-06-29 12:23 ` [PATCH 10/30] MAINTAINERS: Move mm/interval_tree.c to rmap section Lorenzo Stoakes
2026-06-30 16:33   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 11/30] mm/vma: introduce and use vmg_pages(), vmg_[start, end]_pgoff() Lorenzo Stoakes
2026-06-30 16:35   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 12/30] mm/vma: clean up anon_vma_compatible() Lorenzo Stoakes
2026-06-30 16:36   ` Pedro Falcato
2026-07-01 10:20     ` Lorenzo Stoakes
2026-06-29 12:23 ` [PATCH 13/30] mm/vma: refactor vmg_adjust_set_range() for clarity Lorenzo Stoakes
2026-07-02 10:37   ` Pedro Falcato
2026-07-02 10:50     ` Lorenzo Stoakes
2026-06-29 12:23 ` [PATCH 14/30] mm/vma: minor cleanup of expand_[upwards, downwards]() Lorenzo Stoakes
2026-07-02 10:41   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 15/30] mm: introduce and use linear_page_delta() Lorenzo Stoakes
2026-07-02 10:42   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 16/30] mm/vma: use vma_start_pgoff(), linear_page_index() in mm code Lorenzo Stoakes
2026-06-30  0:11   ` SJ Park
2026-07-02 10:47   ` Pedro Falcato
2026-07-02 10:49     ` Lorenzo Stoakes
2026-06-29 12:23 ` [PATCH 17/30] mm: prefer vma_[start,end]_pgoff() to vma->vm_pgoff in kernel/ Lorenzo Stoakes
2026-07-02 11:01   ` Pedro Falcato
2026-07-02 11:30     ` Lorenzo Stoakes
2026-06-29 12:23 ` [PATCH 18/30] mm/vma: remove duplicative vma_pgoff_offset() helper Lorenzo Stoakes
2026-07-02 11:02   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 19/30] mm: use linear_page_[index, delta]() consistently Lorenzo Stoakes
2026-06-29 13:56   ` Thomas Zimmermann
2026-06-29 14:56     ` Lorenzo Stoakes
2026-07-02 11:04   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 20/30] mm/vma: introduce vma_assert_can_modify() Lorenzo Stoakes
2026-07-02 11:16   ` Pedro Falcato
2026-07-02 12:16     ` Lorenzo Stoakes
2026-06-29 12:23 ` [PATCH 21/30] mm/vma: add and use vma_[add/sub]_pgoff() Lorenzo Stoakes
2026-07-02 11:20   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 22/30] mm/vma: move __install_special_mapping() to vma.c Lorenzo Stoakes
2026-07-02 11:22   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 23/30] mm/vma: make vma_set_range() static, drop insert_vm_struct() decl Lorenzo Stoakes
2026-07-02 11:25   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 24/30] mm/vma: update vma_shrink() to not pass unnecessary pgoff parameter Lorenzo Stoakes
2026-07-02 11:27   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 25/30] mm/vma: update vmg_adjust_set_range() to offset pgoff instead Lorenzo Stoakes
2026-07-02 11:29   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 26/30] mm/vma: introduce and use vma_set_pgoff() Lorenzo Stoakes
2026-07-02 11:34   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 27/30] mm/vma: correct incorrect vma.h inclusion Lorenzo Stoakes
2026-07-02 11:40   ` Pedro Falcato [this message]
2026-06-29 12:23 ` [PATCH 28/30] mm/vma: use guard clauses in can_vma_merge_[before, after]() Lorenzo Stoakes
2026-07-02 11:41   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 29/30] tools/testing/vma: default VMA flag bits to 64-bit Lorenzo Stoakes
2026-07-02 11:44   ` Pedro Falcato
2026-06-29 12:23 ` [PATCH 30/30] tools/testing/vma: output compared expression on ASSERT_[EQ, NE]() Lorenzo Stoakes
2026-07-02 11:53   ` Pedro Falcato

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=akZNiN5Y9fPk8bZH@pedro-suse.lan \
    --to=pfalcato@suse.de \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=abbotti@mev.co.uk \
    --cc=acme@kernel.org \
    --cc=airlied@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex@shazbot.org \
    --cc=ankita@nvidia.com \
    --cc=bp@alien8.de \
    --cc=brauner@kernel.org \
    --cc=christian.koenig@amd.com \
    --cc=damon@lists.linux.dev \
    --cc=dave.hansen@linux.intel.com \
    --cc=david@kernel.org \
    --cc=deller@gmx.de \
    --cc=dinguyen@kernel.org \
    --cc=djbw@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=etnaviv@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=harry@kernel.org \
    --cc=hsweeten@visionengravers.com \
    --cc=hughd@google.com \
    --cc=iommu@lists.linux.dev \
    --cc=jannh@google.com \
    --cc=jarkko@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kees@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=l.stach@pengutronix.de \
    --cc=liam@infradead.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=ljs@kernel.org \
    --cc=lumag@kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=mperttunen@nvidia.com \
    --cc=mripard@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=namhyung@kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=oleg@redhat.com \
    --cc=osalvador@suse.de \
    --cc=patrik.r.jakobsson@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=ray.huang@amd.com \
    --cc=riel@surriel.com \
    --cc=robin.clark@oss.qualcomm.com \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=schuster.simon@siemens-energy.com \
    --cc=simona@ffwll.ch \
    --cc=sj@kernel.org \
    --cc=surenb@google.com \
    --cc=tglx@kernel.org \
    --cc=thierry.reding@kernel.org \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=tzimmermann@suse.de \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    --cc=x86@kernel.org \
    /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