The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: Mark Brown <broonie@kernel.org>
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@kernel.org>,
	 "H. Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	 Mike Rapoport <rppt@kernel.org>
Subject: Re: linux-next: manual merge of the tip tree with the mm-hotfixes-unstable tree
Date: Tue, 21 Jul 2026 17:14:13 +0100	[thread overview]
Message-ID: <al-Z08lGBdqUiTo2@lucifer> (raw)
In-Reply-To: <al94LynD19vVIqw6@sirena.org.uk>

On Tue, Jul 21, 2026 at 02:46:23PM +0100, Mark Brown wrote:
> Hi all,
>
> Today's linux-next merge of the tip tree got a conflict in:
>
>   arch/x86/mm/pat/set_memory.c
>
> between commit:
>
>   b8228ddfd0586 ("x86/mm/pat: allocate split page tables as kernel page tables")
>
> from the mm-hotfixes-unstable tree and commit:
>
>   5fce67641a3ed ("x86/mm/pat: Don't gate cpa_lock on debug_pagealloc_enabled()")
>
> from the tip tree.
>
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.

Thanks, the resolution looks correct! :)

There's some discussion on the patches themselves but that's by-the-by.

Cheers, Lorenzo

>
> diff --cc arch/x86/mm/pat/set_memory.c
> index a67ca33b9dd12,1f2a2ba9ce57d..0000000000000
> --- a/arch/x86/mm/pat/set_memory.c
> +++ b/arch/x86/mm/pat/set_memory.c
> @@@ -439,26 -441,12 +442,28 @@@ static void __cpa_collapse_large_pages(
>
>   	list_for_each_entry_safe(ptdesc, tmp, &pgtables, pt_list) {
>   		list_del(&ptdesc->pt_list);
>  -		pagetable_free(ptdesc);
>  +
>  +		if (folio_test_pgtable(ptdesc_folio(ptdesc)))
>  +			pagetable_dtor_free(ptdesc);
>  +		else
>  +			pagetable_free(ptdesc);
>   	}
> +
> + 	spin_unlock(&cpa_lock);
>   }
>
>  +static void cpa_collapse_large_pages(struct cpa_data *cpa)
>  +{
>  +	/*
>  +	 * Take the mmap write lock on init_mm to:
>  +	 * - Avoid a use-after-free if raced by ptdump (which takes its own
>  +	 *   write lock on init_mm).
>  +	 * - Serialise concurrent CPA walkers.
>  +	 */
>  +	scoped_guard(mmap_write_lock, &init_mm)
>  +		__cpa_collapse_large_pages(cpa);
>  +}
>  +
>   static void cpa_flush(struct cpa_data *cpa, int cache)
>   {
>   	unsigned int i;
> @@@ -1249,18 -1237,16 +1253,16 @@@ __split_large_page(struct cpa_data *cpa
>   static int split_large_page(struct cpa_data *cpa, pte_t *kpte,
>   			    unsigned long address)
>   {
>  -	struct ptdesc *ptdesc;
>  +	pte_t *pte;
>
> - 	if (!debug_pagealloc_enabled())
> - 		spin_unlock(&cpa_lock);
> + 	spin_unlock(&cpa_lock);
>  -	ptdesc = pagetable_alloc(GFP_KERNEL, 0);
>  +	pte = pte_alloc_one_kernel(&init_mm);
> - 	if (!debug_pagealloc_enabled())
> - 		spin_lock(&cpa_lock);
> + 	spin_lock(&cpa_lock);
>  -	if (!ptdesc)
>  +	if (!pte)
>   		return -ENOMEM;
>
>  -	if (__split_large_page(cpa, kpte, address, ptdesc))
>  -		pagetable_free(ptdesc);
>  +	if (__split_large_page(cpa, kpte, address, pte))
>  +		pte_free_kernel(&init_mm, pte);
>
>   	return 0;
>   }

  reply	other threads:[~2026-07-21 16:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 13:46 linux-next: manual merge of the tip tree with the mm-hotfixes-unstable tree Mark Brown
2026-07-21 16:14 ` Lorenzo Stoakes (ARM) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-07-26 21:33 Mark Brown
2026-07-27  5:48 ` Mike Rapoport

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=al-Z08lGBdqUiTo2@lucifer \
    --to=ljs@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=broonie@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rppt@kernel.org \
    --cc=tglx@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