[<prev] [next>] [day] [month] [year] [list]
Message-ID: <43d53ebd2637bd9106137103028a4f0e@www.loen.fr>
Date: Thu, 07 Nov 2019 15:28:49 +0109
From: Marc Zyngier <maz@...nel.org>
To: Michael Kelley <mikelley@...rosoft.com>
Cc: <will@...nel.org>, <catalin.marinas@....com>,
<mark.rutland@....com>, <linux-arm-kernel@...ts.infradead.org>,
<gregkh@...uxfoundation.org>, <linux-kernel@...r.kernel.org>,
<linux-hyperv@...r.kernel.org>, <devel@...uxdriverproject.org>,
<olaf@...fle.de>, <apw@...onical.com>,
vkuznets <vkuznets@...hat.com>, <jasowang@...hat.com>,
<marcelo.cerri@...onical.com>, KY Srinivasan <kys@...rosoft.com>,
Sunil Muthuswamy <sunilmut@...rosoft.com>,
"boqun.feng" <boqun.feng@...il.com>
Subject: Re: [PATCH v5 3/8] arm64: hyperv: Add memory alloc/free functions for Hyper-V size pages
On 2019-10-03 20:12, Michael Kelley wrote:
> Add ARM64-specific code to allocate memory with HV_HYP_PAGE_SIZE
> size and alignment. These are for use when pages need to be shared
> with Hyper-V. Separate functions are needed as the page size used
> by Hyper-V may not be the same as the guest page size. Free
> operations are rarely done, so no attempt is made to combine
> freed pages into larger chunks.
>
> This code is built only when CONFIG_HYPERV is enabled.
>
> Signed-off-by: Michael Kelley <mikelley@...rosoft.com>
> ---
> arch/arm64/hyperv/hv_init.c | 68
> ++++++++++++++++++++++++++++++++++++++++++
> include/asm-generic/mshyperv.h | 5 ++++
> 2 files changed, 73 insertions(+)
>
> diff --git a/arch/arm64/hyperv/hv_init.c
> b/arch/arm64/hyperv/hv_init.c
> index 6808bc8..9c294f6 100644
> --- a/arch/arm64/hyperv/hv_init.c
> +++ b/arch/arm64/hyperv/hv_init.c
> @@ -15,10 +15,78 @@
> #include <linux/export.h>
> #include <linux/mm.h>
> #include <linux/hyperv.h>
> +#include <linux/spinlock.h>
> +#include <linux/list.h>
> +#include <linux/string.h>
> #include <asm-generic/bug.h>
> #include <asm/hyperv-tlfs.h>
> #include <asm/mshyperv.h>
>
> +
> +/*
> + * Functions for allocating and freeing memory with size and
> + * alignment HV_HYP_PAGE_SIZE. These functions are needed because
> + * the guest page size may not be the same as the Hyper-V page
> + * size. And while kalloc() could allocate the memory, it does not
> + * guarantee the required alignment. So a separate small memory
> + * allocator is needed. The free function is rarely used, so it
> + * does not try to combine freed pages into larger chunks.
Is this still needed now that kmalloc has alignment guarantees
(see 59bb47985c1d)?
M.
--
Jazz is not dead. It just smells funny...
Powered by blists - more mailing lists