All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harry Yoo <harry.yoo@oracle.com>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: kernel test robot <lkp@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Andy Lutomirski <luto@kernel.org>,
	Andrey Ryabinin <ryabinin.a.a@gmail.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dennis Zhou <dennis@kernel.org>, Tejun Heo <tj@kernel.org>,
	Christoph Lameter <cl@linux-foundation.org>,
	oe-kbuild-all@lists.linux.dev,
	Linux Memory Management List <linux-mm@kvack.org>,
	"H . Peter Anvin" <hpa@zytor.com>,
	Alexander Potapenko <glider@google.com>,
	Andrey Konovalov <andreyknvl@gmail.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Juergen Gross <jgross@suse.com>,
	Kevin Brodsky <kevin.brodsky@arm.com>,
	Muchun Song <muchun.song@linux.dev>,
	Oscar Salvador <osalvador@suse.de>,
	Joao Martins <joao.m.martins@oracle.com>,
	Jane Chu <jane.chu@oracle.com>,
	Alistair Popple <apopple@nvidia.com>,
	Mike Rapoport <rppt@kernel.org>,
	David Hildenbrand <david@redhat.com>,
	Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>,
	"Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>
Subject: Re: [PATCH v2 mm-hotfixes 1/5] mm: move page table sync declarations to asm/pgalloc.h
Date: Mon, 21 Jul 2025 21:10:36 +0900	[thread overview]
Message-ID: <aH4uPI306ITiot7P@harry> (raw)
In-Reply-To: <50acb1ec-7b36-4073-8604-3132ef1e0447@lucifer.local>

On Mon, Jul 21, 2025 at 12:38:27PM +0100, Lorenzo Stoakes wrote:
> On Mon, Jul 21, 2025 at 11:40:10AM +0800, kernel test robot wrote:
> > Hi Harry,
> >
> > kernel test robot noticed the following build warnings:
> >
> > [auto build test WARNING on akpm-mm/mm-everything]
> >
> > url:    https://github.com/intel-lab-lkp/linux/commits/Harry-Yoo/mm-move-page-table-sync-declarations-to-asm-pgalloc-h/20250721-074448
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> > patch link:    https://lore.kernel.org/r/20250720234203.9126-2-harry.yoo%40oracle.com
> > patch subject: [PATCH v2 mm-hotfixes 1/5] mm: move page table sync declarations to asm/pgalloc.h
> > config: i386-buildonly-randconfig-003-20250721 (https://download.01.org/0day-ci/archive/20250721/202507211129.Xbn2bAOg-lkp@intel.com/config)
> > compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250721/202507211129.Xbn2bAOg-lkp@intel.com/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202507211129.Xbn2bAOg-lkp@intel.com/
> >
> > All warnings (new ones prefixed by >>):
> >
> > >> arch/x86/mm/fault.c:265:6: warning: no previous prototype for 'arch_sync_kernel_mappings' [-Wmissing-prototypes]
> >      265 | void arch_sync_kernel_mappings(unsigned long start, unsigned long end)
> >          |      ^~~~~~~~~~~~~~~~~~~~~~~~~
> >
> 
> Looks like arch/x86/mm/fault.c, which includes linux/vmalloc.h (such an odd
> place for this decl!) needs to:
> 
> #include <asm/pgalloc.h>

But in x86-32, ARCH_PAGE_TABLE_SYNC_MASK is defined in
arch/x86/include/asm/pgtable-2,3level_types.h, which can be included
via <asm/pgtable.h> or <linux/pgtable.h>.

I think it was a mistake to move the declarations to
<asm-generic/pgalloc.h> because if a file includes <asm/pgalloc.h> but
forgets to include <linux/vmalloc.h> or <linux/pgtable.h>, then
arch_sync_kernel_mappings() will be optimized out even when it's needed.

I'll move them to <linux/pgtable.h> and let architectures
override ARCH_PAGE_TABLE_SYNC_MASK by defining their own in <asm/pgtable.h>.

> This seems to be a 32-bit build thing, as your series builds locally on my
> x86-64 machine.

Yeah, I only tested it on x86-64 (with 4 & 5 level paging)..
I was unware that I was breaking x86-32.

Thanks!

-- 
Cheers,
Harry / Hyeonggon

> > vim +/arch_sync_kernel_mappings +265 arch/x86/mm/fault.c
> >
> > 4819e15f740ec88 Joerg Roedel        2020-09-02  264
> > 1e15d374bb1cb95 Alexander Potapenko 2023-01-11 @265  void arch_sync_kernel_mappings(unsigned long start, unsigned long end)
> > f2f13a8535174db Ingo Molnar         2009-02-20  266  {
> > 86cf69f1d893d48 Joerg Roedel        2020-06-01  267  	unsigned long addr;
> > f2f13a8535174db Ingo Molnar         2009-02-20  268
> > 86cf69f1d893d48 Joerg Roedel        2020-06-01  269  	for (addr = start & PMD_MASK;
> > 86cf69f1d893d48 Joerg Roedel        2020-06-01  270  	     addr >= TASK_SIZE_MAX && addr < VMALLOC_END;
> > 86cf69f1d893d48 Joerg Roedel        2020-06-01  271  	     addr += PMD_SIZE) {
> > f2f13a8535174db Ingo Molnar         2009-02-20  272  		struct page *page;
> > f2f13a8535174db Ingo Molnar         2009-02-20  273
> > a79e53d85683c6d Andrea Arcangeli    2011-02-16  274  		spin_lock(&pgd_lock);
> > f2f13a8535174db Ingo Molnar         2009-02-20  275  		list_for_each_entry(page, &pgd_list, lru) {
> > 617d34d9e5d8326 Jeremy Fitzhardinge 2010-09-21  276  			spinlock_t *pgt_lock;
> > 617d34d9e5d8326 Jeremy Fitzhardinge 2010-09-21  277
> > a79e53d85683c6d Andrea Arcangeli    2011-02-16  278  			/* the pgt_lock only for Xen */
> > 617d34d9e5d8326 Jeremy Fitzhardinge 2010-09-21  279  			pgt_lock = &pgd_page_get_mm(page)->page_table_lock;
> > 617d34d9e5d8326 Jeremy Fitzhardinge 2010-09-21  280
> > 617d34d9e5d8326 Jeremy Fitzhardinge 2010-09-21  281  			spin_lock(pgt_lock);
> > 86cf69f1d893d48 Joerg Roedel        2020-06-01  282  			vmalloc_sync_one(page_address(page), addr);
> > 617d34d9e5d8326 Jeremy Fitzhardinge 2010-09-21  283  			spin_unlock(pgt_lock);
> > f2f13a8535174db Ingo Molnar         2009-02-20  284  		}
> > a79e53d85683c6d Andrea Arcangeli    2011-02-16  285  		spin_unlock(&pgd_lock);
> > f2f13a8535174db Ingo Molnar         2009-02-20  286  	}
> > f2f13a8535174db Ingo Molnar         2009-02-20  287  }
> > f2f13a8535174db Ingo Molnar         2009-02-20  288
> >
> > --
> > 0-DAY CI Kernel Test Service
> > https://github.com/intel/lkp-tests/wiki

  reply	other threads:[~2025-07-21 12:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-20 23:41 [PATCH v2 mm-hotfixes 0/5] mm, arch: a more robust approach to sync top level kernel page tables Harry Yoo
2025-07-20 23:41 ` [PATCH v2 mm-hotfixes 1/5] mm: move page table sync declarations to asm/pgalloc.h Harry Yoo
2025-07-21  2:56   ` kernel test robot
2025-07-21  3:40   ` kernel test robot
2025-07-21 11:38     ` Lorenzo Stoakes
2025-07-21 12:10       ` Harry Yoo [this message]
2025-07-21 12:15         ` Lorenzo Stoakes
2025-07-20 23:42 ` [PATCH v2 mm-hotfixes 2/5] mm: introduce and use {pgd,p4d}_populate_kernel() Harry Yoo
2025-07-20 23:42 ` [PATCH v2 mm-hotfixes 3/5] x86/mm: define ARCH_PAGE_TABLE_SYNC_MASK and arch_sync_kernel_mappings() Harry Yoo
2025-07-21  7:06   ` kernel test robot
2025-07-20 23:42 ` [PATCH v2 mm-hotfixes 4/5] x86/mm: convert p*d_populate{,_init} to _kernel variants Harry Yoo
2025-07-20 23:42 ` [PATCH v2 mm-hotfixes 5/5] x86/mm: drop unnecessary calls to sync_global_pgds() and fold into its sole user Harry Yoo
2025-07-20 23:57 ` [PATCH v2 mm-hotfixes 0/5] mm, arch: a more robust approach to sync top level kernel page tables Harry Yoo
2025-07-21 11:46   ` Harry Yoo

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=aH4uPI306ITiot7P@harry \
    --to=harry.yoo@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=apopple@nvidia.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=cl@linux-foundation.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=david@redhat.com \
    --cc=dennis@kernel.org \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=gwan-gyeong.mun@intel.com \
    --cc=hpa@zytor.com \
    --cc=jane.chu@oracle.com \
    --cc=jgross@suse.com \
    --cc=joao.m.martins@oracle.com \
    --cc=kevin.brodsky@arm.com \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=muchun.song@linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=osalvador@suse.de \
    --cc=rppt@kernel.org \
    --cc=ryabinin.a.a@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --cc=vincenzo.frascino@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.