From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A58A724DFE6; Tue, 20 May 2025 15:00:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747753203; cv=none; b=U+dVVj9bKtiAsf6KyBmcBxXxfOlcwcHekyfln5YFBIfMDI+iXhb94UZbrcnK/6Gqq7XwqV7M9TGXkxfRjiQ45tJ3A8ITHKdW4ocO9YxolqfcwA/1PsJtC5n/G5tdWLsquemiXH1a38hRSjYN5Bdfo7kHlvxqpOfpyZYC6glnLyY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747753203; c=relaxed/simple; bh=b2CXkXS2G46uSTQOueN2gHh64Q7El3fMSoWYlj2jZoc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=NvR4H3jV5dVr/ojgkobNGtcQv8KKYMmjsbLzXHqc8cE90vAmWSwqhHTJ304kk71/D2h1CbBmdLSfACeb+kVHoKHjTVz2kV5p9L7kLlpmHGy1YIjl3W6wGG5WUF+hSR6YyGvoPeGvFzM8Xa8W5wKv46cj6M5A2NgjD6OI3CA0m2M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C92181516; Tue, 20 May 2025 07:59:47 -0700 (PDT) Received: from [10.57.50.40] (unknown [10.57.50.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2722C3F6A8; Tue, 20 May 2025 07:59:58 -0700 (PDT) Message-ID: <3103faef-1f02-47f9-b1ca-ec6af200773f@arm.com> Date: Tue, 20 May 2025 15:59:57 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 29/43] arm64: RME: Always use 4k pages for realms Content-Language: en-GB To: Steven Price , kvm@vger.kernel.org, kvmarm@lists.linux.dev Cc: Catalin Marinas , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev, Ganapatrao Kulkarni , Gavin Shan , Shanker Donthineni , Alper Gun , "Aneesh Kumar K . V" References: <20250416134208.383984-1-steven.price@arm.com> <20250416134208.383984-30-steven.price@arm.com> From: Suzuki K Poulose In-Reply-To: <20250416134208.383984-30-steven.price@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 16/04/2025 14:41, Steven Price wrote: > Guest_memfd doesn't yet natively support huge pages, and there are > currently difficulties for a VMM to manage huge pages efficiently so for > now always split up mappings to PTE (4k). > > The two issues that need progressing before supporting huge pages for > realms are: > > 1. guest_memfd needs to be able to allocate from an appropriate > allocator which can provide huge pages. > > 2. The VMM needs to be able to repurpose private memory for a shared > mapping when the guest VM requests memory is transitioned. Because > this can happen at a 4k granularity it isn't possible to > free/reallocate while huge pages are in use. Allowing the VMM to > mmap() the shared portion of a huge page would allow the huge page > to be recreated when the memory is unshared and made protected again. > > These two issues are not specific to realms and don't affect the realm > API, so for now just break everything down to 4k pages in the RMM > controlled stage 2. Future work can add huge page support without > changing the uAPI. > > Signed-off-by: Steven Price With comments from Gavin addressed, Reviewed-by: Suzuki K Poulose > --- > Changes since v7: > * Rewritten commit message > --- > arch/arm64/kvm/mmu.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > index 02b66ee35426..29bab7a46033 100644 > --- a/arch/arm64/kvm/mmu.c > +++ b/arch/arm64/kvm/mmu.c > @@ -1653,6 +1653,10 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, > if (logging_active || is_protected_kvm_enabled()) { > force_pte = true; > vma_shift = PAGE_SHIFT; > + } else if (vcpu_is_rec(vcpu)) { > + // Force PTE level mappings for realms > + force_pte = true; > + vma_shift = PAGE_SHIFT; > } else { > vma_shift = get_vma_page_shift(vma, hva); > }