[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ldy8t7zy.wl-maz@kernel.org>
Date: Mon, 28 Oct 2024 18:09:05 +0000
From: Marc Zyngier <maz@...nel.org>
To: Aneesh Kumar K.V <aneesh.kumar@...nel.org>
Cc: linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
kvmarm@...ts.linux.dev,
Suzuki K Poulose <Suzuki.Poulose@....com>,
Steven Price <steven.price@....com>,
Will Deacon <will@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Mark Rutland <mark.rutland@....com>,
Oliver Upton <oliver.upton@...ux.dev>,
Joey Gouly <joey.gouly@....com>,
Zenghui Yu <yuzenghui@...wei.com>
Subject: Re: [PATCH 3/4] arm64: mte: update code comments
On Mon, 28 Oct 2024 12:47:30 +0000,
Aneesh Kumar K.V <aneesh.kumar@...nel.org> wrote:
>
> >> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> >> index a509b63bd4dd..b5824e93cee0 100644
> >> --- a/arch/arm64/kvm/mmu.c
> >> +++ b/arch/arm64/kvm/mmu.c
> >> @@ -1390,11 +1390,8 @@ static int get_vma_page_shift(struct vm_area_struct *vma, unsigned long hva)
> >> * able to see the page's tags and therefore they must be initialised first. If
> >> * PG_mte_tagged is set, tags have already been initialised.
> >> *
> >> - * The race in the test/set of the PG_mte_tagged flag is handled by:
> >> - * - preventing VM_SHARED mappings in a memslot with MTE preventing two VMs
> >> - * racing to santise the same page
> >> - * - mmap_lock protects between a VM faulting a page in and the VMM performing
> >> - * an mprotect() to add VM_MTE
> >> + * The race in the test/set of the PG_mte_tagged flag is handled by
> >> + * using PG_mte_lock and PG_mte_tagged together.
> >
> > How? This comment is pretty content-free. TO be useful, you should
> > elaborate on *how* these two are used together.
> >
>
> I will add more details described in commit d77e59a8fccde7fb5dd8c57594ed147b4291c970
> Should i quote the commit there in the comment?
The commit is not relevant. What is important is an indication of how
the race is resolved if that's important. A reference to
try_page_mte_tagging() would probably be the right thing to do.
>
> >
> >> */
> >> static void sanitise_mte_tags(struct kvm *kvm, kvm_pfn_t pfn,
> >> unsigned long size)
> >> @@ -1646,7 +1643,10 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
> >> }
> >>
> >> if (!fault_is_perm && !device && kvm_has_mte(kvm)) {
> >> - /* Check the VMM hasn't introduced a new disallowed VMA */
> >> + /*
> >> + * not a permission fault implies a translation fault which
> >> + * means mapping the page for the first time
> >
> > How about an Access fault due to page ageing?
> >
>
> IIUC access fault is already handled by the caller kvm_handle_guest_abort?
> I can add that as part of the updated comments?
Maybe. The thing is, you are removing a pretty essential comment for
no good reason, and now there is no rational left behind the -EFAULT
that is returned.
M.
--
Without deviation from the norm, progress is not possible.
Powered by blists - more mailing lists