[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f4f68f53-f318-4bfe-8121-9b718b697fbe@redhat.com>
Date: Thu, 1 Aug 2024 08:56:42 +0200
From: David Hildenbrand <david@...hat.com>
To: Elliot Berman <quic_eberman@...cinc.com>,
Christoph Hellwig <hch@...radead.org>, Will Deacon <will@...nel.org>,
Quentin Perret <qperret@...gle.com>,
Chris Goldsworthy <quic_cgoldswo@...cinc.com>,
Android KVM <android-kvm@...gle.com>, Patrick Daly <quic_pdaly@...cinc.com>,
Alex Elder <elder@...aro.org>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Murali Nalajal <quic_mnalajal@...cinc.com>,
Trilok Soni <quic_tsoni@...cinc.com>,
Srivatsa Vaddagiri <quic_svaddagi@...cinc.com>,
Carl van Schaik <quic_cvanscha@...cinc.com>,
Philip Derrin <quic_pderrin@...cinc.com>,
Prakruthi Deepak Heragu <quic_pheragu@...cinc.com>,
Jonathan Corbet <corbet@....net>, Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>, Catalin Marinas
<catalin.marinas@....com>, Konrad Dybcio <konrad.dybcio@...aro.org>,
Bjorn Andersson <andersson@...nel.org>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>, Fuad Tabba
<tabba@...gle.com>, Sean Christopherson <seanjc@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>, linux-arm-msm@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mm@...ck.org
Subject: Re: [PATCH v17 19/35] arch/mm: Export direct {un,}map functions
On 01.08.24 00:21, Elliot Berman wrote:
> I wanted to revive this thread based on the mm alignment discussion for
> guest_memfd.
>
> Gunyah's guest_memfd allocates memory via filemap_alloc_folio, identical
> to KVM's guest_memfd. There's a possiblity of a stage-2 fault when
> memory is donated to guest VM and Linux incidentally tries to access the
> donated memory with an unaligned access. This access will cause kernel
> to panic as it expects to be able to access all memory which has been
> mapped in stage 1. We don't want to disallow unaligned access simply
> because Gunyah drivers are enabled.
>
> There are two options I see to prevent the stage-2 fault from crashing
> the kernel: we can fix up the stage-2 fault or ensure that Linux has a
> S1 table consistent with S2.
>
> To do the latter, the obvious solution seemed to be using the
> set_direct_map functions, but you and Christoph have valid concerns
> about exporting this to modules since it's a low-level API. One way to
> avoid exporting the symbols is to make Gunyah a built-in, but I'd like
> to find a better solution.
>
> One way I can think of is to create a "guest_memfd library" that both
> KVM and Gunyah can use. It abstracts the common bits between the 2 into
> a built-in module and can be the one to call the set_direct_map
> functions. I also think the abstraction will also help keep KVM
> guest_memfd cleaner once we start supporting huge folios (and splitting
> them). Do KVM and mm folks also see value to using a library-fied
> guest_memfd?
Without knowing about any details, this sounds like the right approach
to me!
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists