Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Takahiro Itazuri <itazur@amazon.com>
To: <brendan.jackman@linux.dev>, <maz@kernel.org>
Cc: <Liam.Howlett@oracle.com>, <ackerleytng@google.com>,
	<agordeev@linux.ibm.com>, <ajones@ventanamicro.com>,
	<akpm@linux-foundation.org>, <alex@ghiti.fr>, <andrii@kernel.org>,
	<ast@kernel.org>, <baolu.lu@linux.intel.com>,
	<borntraeger@linux.ibm.com>, <bp@alien8.de>,
	<bpf@vger.kernel.org>, <catalin.marinas@arm.com>,
	<chenhuacai@kernel.org>, <corbet@lwn.net>, <coxu@redhat.com>,
	<daniel@iogearbox.net>, <dave.hansen@linux.intel.com>,
	<david@kernel.org>, <dev.jain@arm.com>, <eddyz87@gmail.com>,
	<haoluo@google.com>, <hpa@zytor.com>, <itazur@amazon.co.uk>,
	<jackmanb@google.com>, <jannh@google.com>, <jgg@ziepe.ca>,
	<jgross@suse.com>, <jhubbard@nvidia.com>, <jmattson@google.com>,
	<joey.gouly@arm.com>, <john.fastabend@gmail.com>,
	<jolsa@kernel.org>, <jthoughton@google.com>,
	<kalyazin@amazon.co.uk>, <kas@kernel.org>, <kernel@xen0n.name>,
	<kpsingh@kernel.org>, <kvm@vger.kernel.org>,
	<kvmarm@lists.linux.dev>, <lenb@kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-doc@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-kselftest@vger.kernel.org>,
	<linux-mm@kvack.org>, <linux-pm@vger.kernel.org>,
	<linux-riscv@lists.infradead.org>, <linux-s390@vger.kernel.org>,
	<loongarch@lists.linux.dev>, <lorenzo.stoakes@oracle.com>,
	<luto@kernel.org>, <maobibo@loongson.cn>, <martin.lau@linux.dev>,
	<mhocko@suse.com>, <mingo@redhat.com>, <mlevitsk@redhat.com>,
	<oupton@kernel.org>, <palmer@dabbelt.com>,
	<patrick.roy@linux.dev>, <pavel@kernel.org>,
	<pbonzini@redhat.com>, <peterx@redhat.com>,
	<peterz@infradead.org>, <pfalcato@suse.de>, <pjw@kernel.org>,
	<prsampat@amd.com>, <riel@surriel.com>, <rppt@kernel.org>,
	<ryan.roberts@arm.com>, <sdf@fomichev.me>, <seanjc@google.com>,
	<shijie@os.amperecomputing.com>, <skhan@linuxfoundation.org>,
	<song@kernel.org>, <surenb@google.com>, <suzuki.poulose@arm.com>,
	<tabba@google.com>, <tglx@kernel.org>, <thuth@redhat.com>,
	<vannapurve@google.com>, <vbabka@kernel.org>, <will@kernel.org>,
	<willy@infradead.org>, <wu.fei9@sanechips.com.cn>,
	<x86@kernel.org>, <yang@os.amperecomputing.com>,
	<yangyicong@hisilicon.com>, <yonghong.song@linux.dev>,
	<yosry@kernel.org>, <yu-cheng.yu@intel.com>,
	<yuzenghui@huawei.com>, <zhengqi.arch@bytedance.com>,
	Takahiro Itazuri <zulinx86@gmail.com>
Subject: Re: [PATCH v12 09/16] KVM: arm64: define kvm_arch_gmem_supports_no_direct_map()
Date: Tue, 1 Sep 2026 15:05:21 +0100	[thread overview]
Message-ID: <20260901140520.78333-2-itazur@amazon.com> (raw)
In-Reply-To: <DJJ28Z81JTQI.1SI0CNIP7W1JQ@linux.dev>

Apologies for the delayed response, and thank you for the review.

On Fri, 26 Jun 2026 14:45:45 +0000, Brendan Jackman wrote:
> On Tue Apr 21, 2026 at 4:55 PM UTC, Marc Zyngier wrote:
> > Support for GUEST_MEMFD_FLAG_NO_DIRECT_MAP on arm64 depends on 1) direct
> > map manipulations at 4k granularity being possible, and 2) FEAT_S2FWB.
> >
> > Where is this 4kB requirement enforced? Or is it that you means
> > "PAGE_SIZE"?
>
> Yeah I believe this means PAGE_SIZE and that it's effectively enforced
> by checking can_set_direct_map() in
> kvm_arch_gmem_supports_no_direct_map().

Yes, this should say PAGE_SIZE rather than 4k.

If I understand the arm64 MM code correctly, can_set_direct_map() is the
capability gate, but it does not require the linear map to be built with
page-sized PTEs from boot. Without BBML2_NOABORT, force_pte_mapping()
builds the linear map with PAGE_SIZE PTEs. With BBML2_NOABORT,
update_range_prot() can use split_kernel_leaf_mapping() to safely split
larger mappings on demand before changing a PAGE_SIZE range.

I'll update the v13 commit message to describe this.

On Tue, 21 Apr 2026 17:55:05 +0100, Marc Zyngier wrote:
> KVM/arm64 has:
>
>         select KVM_GUEST_MEMFD

I also confirmed that KVM/arm64 selects KVM_GUEST_MEMFD, so I'll drop the
redundant #ifdef in v13.

> Why is it an inline function? Given that it takes a kvm parameter,
> I fully expect that you'll have to evaluate this at some point.
>
> But since struct kvm cannot be dereferenced in asm/kvm_host.h, it will
> have to move. How about doing it right now?

Agreed. Although the current implementation does not dereference kvm, it
makes sense to move it out of asm/kvm_host.h now. I'll move the
implementation to an arm64 KVM .c file in v13.

  reply	other threads:[~2026-09-01 14:07 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 15:17 [PATCH v12 00/16] Direct Map Removal Support for guest_memfd Kalyazin, Nikita
2026-04-10 15:17 ` [PATCH v12 01/16] set_memory: set_direct_map_* to take address Kalyazin, Nikita
2026-04-21 14:43   ` Lorenzo Stoakes
2026-06-26 14:38     ` Brendan Jackman
2026-06-26 14:58       ` David Hildenbrand (Arm)
2026-06-26 15:08         ` Brendan Jackman
2026-06-26 15:04       ` Brendan Jackman
2026-06-26 15:28         ` Mike Rapoport
2026-04-10 15:18 ` [PATCH v12 02/16] set_memory: add folio_{zap,restore}_direct_map helpers Kalyazin, Nikita
2026-07-03 10:19   ` Brendan Jackman
2026-07-03 13:38     ` Mike Rapoport
2026-07-03 14:54       ` Brendan Jackman
2026-04-10 15:18 ` [PATCH v12 03/16] mm/secretmem: make use of folio_{zap,restore}_direct_map Kalyazin, Nikita
2026-04-10 15:18 ` [PATCH v12 04/16] mm/gup: drop secretmem optimization from gup_fast_folio_allowed Kalyazin, Nikita
2026-04-10 15:18 ` [PATCH v12 05/16] mm/gup: drop local variable in gup_fast_folio_allowed Kalyazin, Nikita
2026-04-10 15:18 ` [PATCH v12 06/16] mm: introduce AS_NO_DIRECT_MAP Kalyazin, Nikita
2026-04-10 15:19 ` [PATCH v12 07/16] KVM: guest_memfd: Add stub for kvm_arch_gmem_invalidate Kalyazin, Nikita
2026-04-10 15:19 ` [PATCH v12 08/16] KVM: x86: define kvm_arch_gmem_supports_no_direct_map() Kalyazin, Nikita
2026-04-10 15:19 ` [PATCH v12 09/16] KVM: arm64: " Kalyazin, Nikita
2026-04-21 16:55   ` Marc Zyngier
2026-06-26 14:45     ` Brendan Jackman
2026-09-01 14:05       ` Takahiro Itazuri [this message]
2026-04-10 15:19 ` [PATCH v12 10/16] KVM: guest_memfd: Add flag to remove from direct map Kalyazin, Nikita
2026-04-21 16:31   ` Sean Christopherson
2026-04-21 17:08     ` Frank van der Linden
2026-05-08  8:18       ` Takahiro Itazuri
2026-05-14 16:45         ` Ackerley Tng
2026-04-10 15:19 ` [PATCH v12 11/16] KVM: selftests: load elf via bounce buffer Kalyazin, Nikita
2026-04-10 15:19 ` [PATCH v12 12/16] KVM: selftests: set KVM_MEM_GUEST_MEMFD in vm_mem_add() if guest_memfd != -1 Kalyazin, Nikita
2026-04-10 15:20 ` [PATCH v12 13/16] KVM: selftests: Add guest_memfd based vm_mem_backing_src_types Kalyazin, Nikita
2026-06-26 14:22   ` Brendan Jackman
2026-04-10 15:20 ` [PATCH v12 14/16] KVM: selftests: cover GUEST_MEMFD_FLAG_NO_DIRECT_MAP in existing selftests Kalyazin, Nikita
2026-04-10 15:20 ` [PATCH v12 15/16] KVM: selftests: stuff vm_mem_backing_src_type into vm_shape Kalyazin, Nikita
2026-04-10 15:20 ` [PATCH v12 16/16] KVM: selftests: Test guest execution from direct map removed gmem Kalyazin, Nikita
2026-04-21 13:40 ` [PATCH v12 00/16] Direct Map Removal Support for guest_memfd Lorenzo Stoakes
2026-04-21 16:36   ` Sean Christopherson
2026-05-06  8:07     ` Takahiro Itazuri
2026-05-26 16:27       ` Lorenzo Stoakes
2026-06-26 15:28       ` Brendan Jackman

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=20260901140520.78333-2-itazur@amazon.com \
    --to=itazur@amazon.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=ackerleytng@google.com \
    --cc=agordeev@linux.ibm.com \
    --cc=ajones@ventanamicro.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex@ghiti.fr \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=baolu.lu@linux.intel.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=bp@alien8.de \
    --cc=bpf@vger.kernel.org \
    --cc=brendan.jackman@linux.dev \
    --cc=catalin.marinas@arm.com \
    --cc=chenhuacai@kernel.org \
    --cc=corbet@lwn.net \
    --cc=coxu@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=hpa@zytor.com \
    --cc=itazur@amazon.co.uk \
    --cc=jackmanb@google.com \
    --cc=jannh@google.com \
    --cc=jgg@ziepe.ca \
    --cc=jgross@suse.com \
    --cc=jhubbard@nvidia.com \
    --cc=jmattson@google.com \
    --cc=joey.gouly@arm.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=jthoughton@google.com \
    --cc=kalyazin@amazon.co.uk \
    --cc=kas@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=kpsingh@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=lenb@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=luto@kernel.org \
    --cc=maobibo@loongson.cn \
    --cc=martin.lau@linux.dev \
    --cc=maz@kernel.org \
    --cc=mhocko@suse.com \
    --cc=mingo@redhat.com \
    --cc=mlevitsk@redhat.com \
    --cc=oupton@kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=patrick.roy@linux.dev \
    --cc=pavel@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pfalcato@suse.de \
    --cc=pjw@kernel.org \
    --cc=prsampat@amd.com \
    --cc=riel@surriel.com \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=sdf@fomichev.me \
    --cc=seanjc@google.com \
    --cc=shijie@os.amperecomputing.com \
    --cc=skhan@linuxfoundation.org \
    --cc=song@kernel.org \
    --cc=surenb@google.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tabba@google.com \
    --cc=tglx@kernel.org \
    --cc=thuth@redhat.com \
    --cc=vannapurve@google.com \
    --cc=vbabka@kernel.org \
    --cc=will@kernel.org \
    --cc=willy@infradead.org \
    --cc=wu.fei9@sanechips.com.cn \
    --cc=x86@kernel.org \
    --cc=yang@os.amperecomputing.com \
    --cc=yangyicong@hisilicon.com \
    --cc=yonghong.song@linux.dev \
    --cc=yosry@kernel.org \
    --cc=yu-cheng.yu@intel.com \
    --cc=yuzenghui@huawei.com \
    --cc=zhengqi.arch@bytedance.com \
    --cc=zulinx86@gmail.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