[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 03/22] acpi: vmap pages in acpi_os_alloc_memory


  • To: Julien Grall <julien@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 20 Dec 2022 16:15:39 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ng7ZkDKheEp5vQSdVIDxyR9ss5uKnSuXcdpXQBfOiiU=; b=UggQ+240Uiaboy2T9DjWZw4fuqR+8Cvb5CIV8mBZfNgd4HELfsAUH1+1LLDSr6IDaBYU2K2xgP6iEXyoeUNZRLYP4QqcyNTLwgYaQxElAesMplgajez+CkgErP983LSrxlm910ZiJ81ywXjgtVAqXo+hRBElOltpSBc+L1HnCKxsqyxqqUJBKrwjO9B7xB1VEihbFOGxiMEYikiw2wCVrdI3CH6DMSUmEgChL2w2Itty+RDwVqh+4lnSNPuTG9abRltIlj/lcwT4lQZrcJBuNZ9DvmCO9dpCI6supUFLvECBuUThXiai0TCVMrj8eEaAYdYQtW/B9TsOr0MCeuA6Ow==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WWvVQ66fGxk+5OG/WOWfG/ZzBNBcYus+pyJe/usFo59I7jrhcggmNbzzOE9b0pPBjfS6IiIDdTgIY17+3XhiGPZMpoSX0F+61Yh1WIWttyqColjpq+IRFe/OebwO9917MYgv5Pz8wNz4vVK7uluO/qTbDemxMzTalgXG4oVKjFVslf42TUxg+JbyctYEgdaRNj0BYYNDrP5G/9Ogz5d6wOG4cO9g+Cd3+/1agJjl9OWeM2Bc8NCwLWVB6U4/bHA53y2t7JvEqGh/6AHv1rHuIFyfB2AMCYdzs+H0dqOPJSD2o/2TORKudmSeWrcHzMDx4WW3O1+dUI6XmvWEdQOKaw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Hongyan Xia <hongyxia@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 20 Dec 2022 15:15:52 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 16.12.2022 12:48, Julien Grall wrote:
> --- a/xen/common/vmap.c
> +++ b/xen/common/vmap.c
> @@ -244,6 +244,11 @@ void *vmap(const mfn_t *mfn, unsigned int nr)
>      return __vmap(mfn, 1, nr, 1, PAGE_HYPERVISOR, VMAP_DEFAULT);
>  }
>  
> +void *vmap_contig_pages(mfn_t mfn, unsigned int nr_pages)

I don't think the _pages suffix buys us much here. I also think parameter
names would better be consistent with other functions here, in particular
with vmap() (i.e. s/nr_pages/nr/).

> --- a/xen/drivers/acpi/osl.c
> +++ b/xen/drivers/acpi/osl.c
> @@ -221,7 +221,11 @@ void *__init acpi_os_alloc_memory(size_t sz)
>       void *ptr;
>  
>       if (system_state == SYS_STATE_early_boot)
> -             return mfn_to_virt(mfn_x(alloc_boot_pages(PFN_UP(sz), 1)));
> +     {
> +             mfn_t mfn = alloc_boot_pages(PFN_UP(sz), 1);
> +
> +             return vmap_contig_pages(mfn, PFN_UP(sz));
> +     }

Multiple pages may be allocated here, yet ...

> @@ -246,5 +250,10 @@ void __init acpi_os_free_memory(void *ptr)
>       if (is_xmalloc_memory(ptr))
>               xfree(ptr);
>       else if (ptr && system_state == SYS_STATE_early_boot)
> -             init_boot_pages(__pa(ptr), __pa(ptr) + PAGE_SIZE);
> +     {
> +             paddr_t addr = mfn_to_maddr(vmap_to_mfn(ptr));
> +
> +             vunmap(ptr);
> +             init_boot_pages(addr, addr + PAGE_SIZE);
> +     }

... (as before) only one page would be freed here. With the move to
vmap() it ought to be possible to do better now. (If you want to
defer this to a later patch, please at least mention the aspect in
the description.)

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.