Re: [kvm-unit-tests PATCH v1 05/12] lib/alloc_page: fix and improve the page allocator

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

 



On Wed, Dec 16, 2020, Claudio Imbrenda wrote:
>  /*
> - * Allocates and reserves the specified memory range if possible.
> - * Returns NULL in case of failure.
> + * Allocates and reserves the specified physical memory range if possible.
> + * If the specified range cannot be reserved in its entirety, no action is
> + * performed and false is returned.
> + *
> + * Returns true in case of success, false otherwise.
>   */
> -void *alloc_pages_special(uintptr_t addr, size_t npages);
> +bool alloc_pages_special(phys_addr_t addr, size_t npages);

The boolean return is a bit awkward as kernel programmers will likely expect a
non-zero return to mean failure.  But, since there are no users, can we simply
drop the entire *_pages_special() API?  Allocating a specific PFN that isn't
MMIO seems doomed to fail anyways; I'm having a hard time envisioning a test
that would be able to use such an API without being horribly fragile.

>  
>  /*
>   * Frees a reserved memory range that had been reserved with
> @@ -91,6 +110,6 @@ void *alloc_pages_special(uintptr_t addr, size_t npages);
>   * exactly, it can also be a subset, in which case only the specified
>   * pages will be freed and unreserved.
>   */
> -void free_pages_special(uintptr_t addr, size_t npages);
> +void free_pages_special(phys_addr_t addr, size_t npages);



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux