mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: Thorsten Leemhuis <linux@leemhuis.info>
Cc: Wei Liu <wei.liu@kernel.org>,
	Magnus Kulke <magnuskulke@linux.microsoft.com>,
	Wei Liu <liuwe@microsoft.com>, Arnd Bergmann <arnd@arndb.de>,
	Magnus Kulke <magnuskulke@microsoft.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Dexuan Cui <decui@microsoft.com>,
	linux-hyperv@vger.kernel.org, Long Li <longli@microsoft.com>,
	linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Souradeep Chakrabarti <schakrabarti@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Anirudh Rayabharam <Anirudh.Rayabharam@microsoft.com>
Subject: Re: [PATCH v4] drivers/hv: remove deposited pages from direct map
Date: Wed, 28 Oct 2026 22:41:03 -0700	[thread overview]
Message-ID: <20261029054103.GB3595008@liuwe-devbox-debian-v2.local> (raw)
In-Reply-To: <879b3af5-3853-4f9d-8dea-c90c338a4369@leemhuis.info>

On Wed, Oct 28, 2026 at 07:44:14PM +0100, Thorsten Leemhuis wrote:
> On 10/28/26 19:31, Wei Liu wrote:
> > On Wed, Oct 28, 2026 at 07:28:15PM +0100, Thorsten Leemhuis wrote:
> >> On 9/30/26 14:10, Magnus Kulke wrote:
> >>> hv_call_deposit_pages() donates pages (deposit) to hypervisor for L2
> >>> guest on L1VH systems via HVCALL_DEPOSIT_MEMORY. The hypervisor takes
> >>> ownership of those pages and per contract revokes root partition
> >>> access to them, raising a #GP on access from the L1VH root partition.
> >>>
> >>> However, the pages remain mapped in the kernel direct map, so kernel
> >>> code may still access them even though the hypervisor has revoked
> >>> access.
> >>
> >> Wei, Magnus, this patch showed up in -next today and broke my daily
> >> Fedora builds on x86_64 and arm64 which use the rawhide config as base.
> >> Reverting it made the build succeed.
> > 
> > Can you share the kconfig?
> 
> Sadly can't access it directly, but it should be the attached one after
> running it through "make olddefconfig".
> 
> Ciao, Thorsten
> 
> >> """
> >>> drivers/hv/hv_proc.c: In function ‘hv_deposit_update_direct_map’:
> >>> drivers/hv/hv_proc.c:32:23: error: implicit declaration of function ‘set_direct_map_valid_noflush’; did you mean ‘set_direct_map_invalid_noflush’? [-Wimplicit-function-declaration]
> >>>    32 |                 err = set_direct_map_valid_noflush(pfn_to_page(pfns[i]),
> >>>       |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >>>       |                       set_direct_map_invalid_noflush

I didn't end up building the kernel. I see why by purely inspecting the
linux-next tree.

That function was removed by Mike Rapoport in 37fb25b34cd92.

I will rework this in my branch -- we should follow what MM tree does.
Hopefully it will be a straightforward change.

Thanks for your report.

Wei

======

commit 37fb25b34cd9273cb987b80a46a13a1e3f0a534f
Author:     Mike Rapoport (Microsoft) <rppt@kernel.org>
AuthorDate: Thu Sep 3 12:28:32 2026 +0300
Commit:     Andrew Morton <akpm@linux-foundation.org>
CommitDate: Thu Sep 10 20:20:09 2026 -0700

    Revert "arch: introduce set_direct_map_valid_noflush()"

    Commit 0c6378a71574 ("arch: introduce set_direct_map_valid_noflush()")
    added set_direct_map_valid_noflush() to allow updating the direct map for
    a physically contiguous range in execmem.

    As Brendan recently pointed out [1], this API is confusing because on
    arm64 it means that is sets VALID bit in ptes, while on other
    architectures it is an analog of set_direct_map_default_noflush().

    The only user of set_direct_map_valid_noflush() was execmem's ROX cache
    freeing path and it was switched to utilize VM_FLUSH_RESET_PERMS for
    resetting permissions of the direct map alias.

    With the last user gone and with
    set_direct_map_{invalid,default}_noflush() accepting number of pages as a
    parameter, set_direct_map_valid_noflush() become a copy of
    set_memory_valid() on arm64 and a duplicate of
    set_direct_map_{invalid,default}_noflush() on other architecture, it is
    safe to remove set_direct_map_valid_noflush().

    Also drop a stale comment in arm64::__kernel_map_pages() that Linus
    bothered to add when merging changes containing
    set_direct_map_valid_noflush() to his tree.

    This reverts commit 0c6378a71574daa6cd1534ad42a956e3262756c7.

  reply	other threads:[~2026-10-29  5:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 12:10 Magnus Kulke
2026-10-01 11:42 ` Anirudh Rayabharam
2026-10-21  7:30 ` Wei Liu
2026-10-28 18:28 ` Thorsten Leemhuis
2026-10-28 18:31   ` Wei Liu
2026-10-28 18:44     ` Thorsten Leemhuis
2026-10-29  5:41       ` Wei Liu [this message]
2026-10-28 22:54 ` Mukesh R

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=20261029054103.GB3595008@liuwe-devbox-debian-v2.local \
    --to=wei.liu@kernel.org \
    --cc=Anirudh.Rayabharam@microsoft.com \
    --cc=arnd@arndb.de \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@leemhuis.info \
    --cc=liuwe@microsoft.com \
    --cc=longli@microsoft.com \
    --cc=magnuskulke@linux.microsoft.com \
    --cc=magnuskulke@microsoft.com \
    --cc=pbonzini@redhat.com \
    --cc=schakrabarti@microsoft.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®