[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1624580015.hf7udh0vc3.astroid@bobo.none>
Date: Fri, 25 Jun 2021 10:20:32 +1000
From: Nicholas Piggin <npiggin@...il.com>
To: Aleksandar Markovic <aleksandar.qemu.devel@...il.com>,
Huacai Chen <chenhuacai@...nel.org>,
Marc Zyngier <maz@...nel.org>,
Paul Mackerras <paulus@...abs.org>,
Paolo Bonzini <pbonzini@...hat.com>,
David Stevens <stevensd@...omium.org>,
Zhenyu Wang <zhenyuw@...ux.intel.com>,
Zhi Wang <zhi.a.wang@...el.com>
Cc: Alexandru Elisei <alexandru.elisei@....com>,
dri-devel@...ts.freedesktop.org, intel-gfx@...ts.freedesktop.org,
intel-gvt-dev@...ts.freedesktop.org,
James Morse <james.morse@....com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvmarm@...ts.cs.columbia.edu,
kvm-ppc@...r.kernel.org, kvm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-mips@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
Sean Christopherson <seanjc@...gle.com>,
David Stevens <stevensd@...gle.com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Will Deacon <will@...nel.org>
Subject: Re: [PATCH 0/6] KVM: Remove uses of struct page from x86 and arm64
MMU
Excerpts from Paolo Bonzini's message of June 25, 2021 1:35 am:
> On 24/06/21 14:57, Nicholas Piggin wrote:
>> KVM: Fix page ref underflow for regions with valid but non-refcounted pages
>
> It doesn't really fix the underflow, it disallows mapping them in the
> first place. Since in principle things can break, I'd rather be
> explicit, so let's go with "KVM: do not allow mapping valid but
> non-reference-counted pages".
>
>> It's possible to create a region which maps valid but non-refcounted
>> pages (e.g., tail pages of non-compound higher order allocations). These
>> host pages can then be returned by gfn_to_page, gfn_to_pfn, etc., family
>> of APIs, which take a reference to the page, which takes it from 0 to 1.
>> When the reference is dropped, this will free the page incorrectly.
>>
>> Fix this by only taking a reference on the page if it was non-zero,
>
> s/on the page/on valid pages/ (makes clear that invalid pages are fine
> without refcounting).
That seems okay, you can adjust the title or changelog as you like.
> Thank you *so* much, I'm awful at Linux mm.
Glad to help. Easy to see why you were taking this approach because the
API really does need to be improved and even a pretty intwined with mm
subsystem like KVM shouldn't _really_ be doing this kind of trick (and
it should go away when old API is removed).
Thanks,
Nick
Powered by blists - more mailing lists