linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Kevin Brodsky <kevin.brodsky@arm.com>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	"Mike Rapoport (IBM)" <rppt@kernel.org>,
	Ryan Roberts <ryan.roberts@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Will Deacon <will@kernel.org>,
	Matthew Wilcox <willy@infradead.org>,
	Qi Zheng <zhengqi.arch@bytedance.com>,
	linux-alpha@vger.kernel.org, linux-arch@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org,
	linux-hexagon@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org,
	linux-openrisc@vger.kernel.org, linux-parisc@vger.kernel.org,
	linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org,
	linux-snps-arc@lists.infradead.org, linux-um@lists.infradead.org,
	loongarch@lists.linux.dev, x86@kernel.org
Subject: Re: [PATCH v2 6/6] mm: Introduce ctor/dtor at PGD level
Date: Wed, 22 Jan 2025 08:49:54 +0100	[thread overview]
Message-ID: <20250122074954.8685-A-hca@linux.ibm.com> (raw)
In-Reply-To: <Z4/NTRDBXEEimdvc@li-008a6a4c-3549-11b2-a85c-c5cc2836eea2.ibm.com>

On Tue, Jan 21, 2025 at 05:37:33PM +0100, Alexander Gordeev wrote:
> On Fri, Jan 03, 2025 at 06:44:15PM +0000, Kevin Brodsky wrote:
> 
> Hi Kevin,
> ...
> > diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h
> > index 5fced6d3c36b..b19b6ed2ab53 100644
> > --- a/arch/s390/include/asm/pgalloc.h
> > +++ b/arch/s390/include/asm/pgalloc.h
> > @@ -130,11 +130,18 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
> >  
> >  static inline pgd_t *pgd_alloc(struct mm_struct *mm)
> >  {
> > -	return (pgd_t *) crst_table_alloc(mm);
> > +	unsigned long *table = crst_table_alloc(mm);
> > +
> > +	if (!table)
> > +		return NULL;
> 
> I do not know status of this series, but FWIW, this call is missed:
> 
> 	crst_table_init(table, _REGION1_ENTRY_EMPTY); 

Why is that missing?

A pgd table can be a Region1, Region2, or Region3 table. The only caller of
this function is mm_init() via mm_alloc_pgd(); and right after mm_alloc_pgd()
there is a call to init_new_context() which will initialize the pgd correctly.

I guess what really gets odd, and might be broken (haven't checked yet) is
what happens on dynamic upgrade of page table levels (->crst_table_upgrade()).

With that a pgd may become a pud, and with that we get an imbalance with
the ctor/dtor calls for the various page table levels when they get freed
again. Plus, at first glance, it looks also broken that we have open-coded
crst_alloc() calls instead of using the "proper" page table allocation API
within crst_table_upgrade(), which again would cause an imbalance.


  reply	other threads:[~2025-01-22  7:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-03 18:44 [PATCH v2 0/6] Account page tables at all levels Kevin Brodsky
2025-01-03 18:44 ` [PATCH v2 1/6] mm: Move common part of pagetable_*_ctor to helper Kevin Brodsky
2025-01-03 18:44 ` [PATCH v2 2/6] parisc: mm: Ensure pagetable_pmd_[cd]tor are called Kevin Brodsky
2025-01-03 18:44 ` [PATCH v2 3/6] m68k: mm: Add calls to pagetable_pmd_[cd]tor Kevin Brodsky
2025-01-03 18:44 ` [PATCH v2 4/6] ARM: mm: Rename PGD helpers Kevin Brodsky
2025-01-03 18:44 ` [PATCH v2 5/6] asm-generic: pgalloc: Provide generic __pgd_{alloc,free} Kevin Brodsky
2025-01-03 18:44 ` [PATCH v2 6/6] mm: Introduce ctor/dtor at PGD level Kevin Brodsky
2025-01-21 16:37   ` Alexander Gordeev
2025-01-22  7:49     ` Heiko Carstens [this message]
2025-01-22 14:06       ` Alexander Gordeev
2025-01-22 21:16         ` Alexander Gordeev
2025-01-06  8:38 ` [PATCH v2 0/6] Account page tables at all levels Qi Zheng
2025-01-07  9:15   ` Kevin Brodsky
2025-02-03 19:15 ` patchwork-bot+linux-riscv

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=20250122074954.8685-A-hca@linux.ibm.com \
    --to=hca@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=kevin.brodsky@arm.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-csky@vger.kernel.org \
    --cc=linux-hexagon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-openrisc@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=linux-um@lists.infradead.org \
    --cc=loongarch@lists.linux.dev \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    --cc=willy@infradead.org \
    --cc=x86@kernel.org \
    --cc=zhengqi.arch@bytedance.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox