lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87wml0egzo.fsf@draig.linaro.org>
Date: Thu, 01 Aug 2024 10:20:59 +0100
From: Alex Bennée <alex.bennee@...aro.org>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>,  Marc Zyngier <maz@...nel.org>,
  Oliver Upton <oliver.upton@...ux.dev>,  Tianrui Zhao
 <zhaotianrui@...ngson.cn>,  Bibo Mao <maobibo@...ngson.cn>,  Huacai Chen
 <chenhuacai@...nel.org>,  Michael Ellerman <mpe@...erman.id.au>,  Anup
 Patel <anup@...infault.org>,  Paul Walmsley <paul.walmsley@...ive.com>,
  Palmer Dabbelt <palmer@...belt.com>,  Albert Ou <aou@...s.berkeley.edu>,
  Christian Borntraeger <borntraeger@...ux.ibm.com>,  Janosch Frank
 <frankja@...ux.ibm.com>,  Claudio Imbrenda <imbrenda@...ux.ibm.com>,
  kvm@...r.kernel.org,  linux-arm-kernel@...ts.infradead.org,
  kvmarm@...ts.linux.dev,  loongarch@...ts.linux.dev,
  linux-mips@...r.kernel.org,  linuxppc-dev@...ts.ozlabs.org,
  kvm-riscv@...ts.infradead.org,  linux-riscv@...ts.infradead.org,
  linux-kernel@...r.kernel.org,  David Matlack <dmatlack@...gle.com>,
  David Stevens <stevensd@...omium.org>
Subject: Re: [PATCH v12 05/84] KVM: Add kvm_release_page_unused() API to put
 pages that KVM never consumes

Sean Christopherson <seanjc@...gle.com> writes:

> Add an API to release an unused page, i.e. to put a page without marking
> it accessed or dirty.  The API will be used when KVM faults-in a page but
> bails before installing the guest mapping (and other similar flows).
>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
> ---
>  include/linux/kvm_host.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index 3d9617d1de41..c5d39a337aa3 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -1201,6 +1201,15 @@ unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable);
>  unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn);
>  unsigned long gfn_to_hva_memslot_prot(struct kvm_memory_slot *slot, gfn_t gfn,
>  				      bool *writable);
> +
> +static inline void kvm_release_page_unused(struct page *page)
> +{
> +	if (!page)
> +		return;
> +
> +	put_page(page);
> +}

I guess it's unfamiliarity with the mm layout but I was trying to find
where the get_pages come from to see the full pattern of allocate and
return. I guess somewhere in the depths of hva_to_pfn() from
hva_to_pfn_retry()? I think the indirection of the page walking confuses
me ;-)

Anyway the API seems reasonable enough given the other kvm_release_
functions.

Reviewed-by: Alex Bennée <alex.bennee@...aro.org>

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ