mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Oliver Upton <oupton@kernel.org>, Marc Zyngier <maz@kernel.org>
Cc: Fuad Tabba <fuad.tabba@linux.dev>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Vincent Donnefort <vdonnefort@google.com>
Subject: linux-next: manual merge of the kvm-arm tree with the kvm-arm-fixes tree
Date: Tue, 24 Nov 2026 17:03:50 +0000	[thread overview]
Message-ID: <awXDdoe3z5nyb2u-@sirena.org.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 2385 bytes --]

Hi all,

Today's linux-next merge of the kvm-arm tree got a conflict in:

  arch/arm64/kvm/mmu.c

between commit:

  fb92b5981ae3c ("KVM: arm64: Fix THP block mapping when the PMD level is folded")

from the kvm-arm-fixes tree and commit:

  9da9b26ce1aca ("KVM: arm64: Fast fail transparent_hugepage_adjust() for non-PMD folios")

from the kvm-arm 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.

diff --cc arch/arm64/kvm/mmu.c
index a0d4981ebb998,042dc53267cb3..0000000000000
--- a/arch/arm64/kvm/mmu.c
+++ b/arch/arm64/kvm/mmu.c
@@@ -1564,25 -1566,31 +1566,31 @@@ transparent_hugepage_adjust(const struc
  	 * sure that the HVA and IPA are sufficiently aligned and that the
  	 * block map is contained within the memslot.
  	 */
- 	if (fault_supports_stage2_huge_mapping(s2fd, PMD_SIZE)) {
- 		int sz = get_user_mapping_size(kvm, s2fd->hva);
+ 	if (!fault_supports_stage2_huge_mapping(s2fd, PMD_SIZE))
+ 		return PAGE_SIZE;
  
- 		if (sz < 0)
- 			return sz;
+ 	/*
+ 	 * If the allocated folio isn't at least PMD_SIZE, there is no way a
+ 	 * stage-1 PMD level was installed.
+ 	 */
+ 	if (s2vi->page && !folio_test_pmd_mappable(page_folio(s2vi->page)))
+ 		return PAGE_SIZE;
  
- 		if (sz < PMD_SIZE)
- 			return PAGE_SIZE;
+ 	/*
+ 	 * Even though the folio size is big enough, the stage-1 mapping might
+ 	 * have been split. Verify it.
+ 	 */
+ 	sz = get_user_mapping_size(kvm, s2fd->hva);
+ 	if (sz < 0)
+ 		return sz;
  
- 		gfn = ALIGN_DOWN(gfn, PMD_SIZE >> PAGE_SHIFT);
- 		*gfnp = gfn;
- 		pfn = ALIGN_DOWN(pfn, PMD_SIZE >> PAGE_SHIFT);
- 		*pfnp = pfn;
+ 	if (sz < PMD_SIZE)
+ 		return PAGE_SIZE;
  
- 		return PMD_SIZE;
- 	}
 -	*gfnp &= ~(PTRS_PER_PMD - 1);
 -	*pfnp &= ~(PTRS_PER_PMD - 1);
++	*gfnp = ALIGN_DOWN(*gfnp, PMD_SIZE >> PAGE_SHIFT);
++	*pfnp = ALIGN_DOWN(*pfnp, PMD_SIZE >> PAGE_SHIFT);
  
- 	/* Use page mapping if we cannot use block mapping. */
- 	return PAGE_SIZE;
+ 	return PMD_SIZE;
  }
  
  static int get_vma_page_shift(struct vm_area_struct *vma)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2026-11-24 17:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 17:03 Mark Brown [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-10-19 16:46 Mark Brown

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=awXDdoe3z5nyb2u-@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=fuad.tabba@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=vdonnefort@google.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

all inboxes | Powered by JetHome®