From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 650893815CD for ; Mon, 2 Feb 2026 16:51:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770051074; cv=none; b=YdAsCQ5efbs+proJpeZxIYRF98wFyTqqVYDTGO6jT6uciRP1xqDxva5zMCU48O+TrDfiUsgVbwwNZrtD/L2a8Msf9eZ80m87qP5p+T823h1ON8ACM6bmypJ8JgQr9BfWUpRD7P3dPqfp9Gev15u0g56chYlXqVQTh/93zj56y4o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770051074; c=relaxed/simple; bh=2IG15X5CbThZwzL2MaRQjtbDbxt9buphp7mC7rJnX80=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=MMICmyXmiOJ7Hor0Id0MD/i1dPv8j4QRNcjwqXa08LyiD1tLvUlh0WhQhq9dlR25YwzEGMRHkshchX2SKONrQ7BqPqekH4wfUEfRL4rCo0EdnDl77RAmnkbuDTwiGr7AQ+sNw+r6wvSykZvP9f8nIMAITtne0/DKlsSkvl3Rk/M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TFj+xBI2; arc=none smtp.client-ip=209.85.215.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TFj+xBI2" Received: by mail-pg1-f194.google.com with SMTP id 41be03b00d2f7-c06cb8004e8so1895201a12.0 for ; Mon, 02 Feb 2026 08:51:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770051069; x=1770655869; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=lbhWXNt6R+bbY45my7/0cdZ1hSkxZU69wC4//UhDbUI=; b=TFj+xBI2cDJIW6edY95W0sVUyBNIYoLGODn4OiAR3vuH/62y7OeL+tSO1oJPzHersE FkjQXIpJ9e5aGt5vvP92YHZGmyAsxRKy8DDsH1zHWi1hP4HPyc52BO0kU3n6HbDzHOm9 oPe8J3T53gVUPMJg6zrLVR+rI2Qk5QxCjKCguUvIExiPw8JmMZFxBpQnk5g3B2D0Jomj Dh8h7liPzLtfVfavOWXkt0144gAdt5yaYnvNETEsgF/WqotmqpU/iN7xZwVK8UndyMAA hPxqr+lBtrujKR9JGKhSALnvZVsVrhRo4mZEHVQ28iSkL6XxMqEe7/AenRM0TAsh6Mps UGtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770051069; x=1770655869; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=lbhWXNt6R+bbY45my7/0cdZ1hSkxZU69wC4//UhDbUI=; b=PD3Tqe6o92saxQOkG9Qk3yrY6FxXnUM4jKlJyFdvlCoEg7CjYN3lpqeR8C/nOZ6ml7 sr35Z0/TzSXLVOvKhg7PuJpoMbAMHrlphwvCUyq4M4YOotw8vBX9c7ip3jpAHiEe9wcy 4nc41ONocffqNfqKcDufHnY6yd3UXFH3bVMg2qxQJC2FjHXLh7LpQTMe/12eS9PMJO01 S7KQUzxPbUUyLm8On+GOvYSXmXAdLE+Yp6fepm+8h13DbDcLTROxX+WzFGsxRCW5d2Wb hJnZyyDDAmMz6VoD0J3HWHNxjAJzuy8dj9moDFyIQ18fZ5dof3nd6X8TurJMEgLkiGMy KrkQ== X-Gm-Message-State: AOJu0YwMPcNZKvqmPE71Mh0JfyA1d7n/4nQnJl9K8rK+ylile9GDsiVf Y9H7+71lq5zGLS+ML2HWuUXXsh69/bGHf4ZWETMFyyxXBk0ObVGLmPI6 X-Gm-Gg: AZuq6aIdQlIRBsJxWEYVd1gLLZfWqZB9F/ZWX0yObhANPZKSWArKEVx6/eGojmr5rFD Z5cUJDk9fdps073+yXBJPvOTr9sKZ5tz4XFJmDxE5NnNerMeqa84nz1OsbBmg/q7eApiGo4hIqS Kx4b0AtSP7wRywRQWMaJ5PU/Fa45zVEeTkPstaMVwAHWSKoIZoVrJiOM6Vfz4pEIMAMgMVRTigz pIYDgoMQNe/b2KzJv4u2BhyxnAXeLz9a+a4iDqzBkxNIcZdbWlgevkkNbiajUmt+KIuTY3ImYJu sype+Svk9hOFM0w3aAtP3i/UZ0Zdvk4g/R9lmKlowDeb22Z3RoXVudoXn17nETd6esbaMhYUs2E q5altrtOXC3imeEbYQDr1Tkq9LQn7j43fEckPMrJ0OIch9gefVPXgcx499Wi17EEsWIjtOP1tOo oGXmEF8je8sEAHk6EC2bsfeRWA/7KZ1ZzDvziBDoUwIQr+yW2nuXMA3m1JS5+Lhqxdk3WneGTl2 T3N X-Received: by 2002:a17:903:388e:b0:2a1:3cd8:d2df with SMTP id d9443c01a7336-2a8d9a75e18mr124606865ad.54.1770051069259; Mon, 02 Feb 2026 08:51:09 -0800 (PST) Received: from localhost.localdomain (c-174-165-208-10.hsd1.wa.comcast.net. [174.165.208.10]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a88b7f9a42sm154742675ad.99.2026.02.02.08.51.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 08:51:08 -0800 (PST) From: mhkelley58@gmail.com X-Google-Original-From: mhklinux@outlook.com To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, longli@microsoft.com, skinsburskii@linux.microsoft.com, linux-hyperv@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 1/1] mshv: Add comment about huge page mappings in guest physical address space Date: Mon, 2 Feb 2026 08:51:01 -0800 Message-Id: <20260202165101.1750-1-mhklinux@outlook.com> X-Mailer: git-send-email 2.25.1 Reply-To: mhklinux@outlook.com Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Michael Kelley Huge page mappings in the guest physical address space depend on having matching alignment of the userspace address in the parent partition and of the guest physical address. Add a comment that captures this information. See the link to the mailing list thread. No code or functional change. Link: https://lore.kernel.org/linux-hyperv/aUrC94YvscoqBzh3@skinsburskii.localdomain/T/#m0871d2cae9b297fd397ddb8459e534981307c7dc Signed-off-by: Michael Kelley --- drivers/hv/mshv_root_main.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/hv/mshv_root_main.c b/drivers/hv/mshv_root_main.c index 681b58154d5e..bc738ff4508e 100644 --- a/drivers/hv/mshv_root_main.c +++ b/drivers/hv/mshv_root_main.c @@ -1389,6 +1389,20 @@ mshv_partition_ioctl_set_memory(struct mshv_partition *partition, if (mem.flags & BIT(MSHV_SET_MEM_BIT_UNMAP)) return mshv_unmap_user_memory(partition, mem); + /* + * If the userspace_addr and the guest physical address (as derived + * from the guest_pfn) have the same alignment modulo PMD huge page + * size, the MSHV driver can map any PMD huge pages to the guest + * physical address space as PMD huge pages. If the alignments do + * not match, PMD huge pages must be mapped as single pages in the + * guest physical address space. The MSHV driver does not enforce + * that the alignments match, and it invokes the hypervisor to set + * up correct functional mappings either way. See mshv_chunk_stride(). + * The caller of the ioctl is responsible for providing userspace_addr + * and guest_pfn values with matching alignments if it wants the guest + * to get the performance benefits of PMD huge page mappings of its + * physical address space to real system memory. + */ return mshv_map_user_memory(partition, mem); } -- 2.25.1