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

Re: [PATCH] tools: Use posix_memalign instead of valloc for NetBSD


  • To: bouyer@xxxxxxxxxxxxxxx
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Thu, 30 Apr 2026 12:48:53 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=5hs/q9NxL12vrhL7CLss2+XL4VeCTy14mpj+T/lTmC8=; b=r7kC/GjvPIj5n2vq/aiClYBLN8Mk8tepYn4UovgNBXRZD0eVGbZifLzdXWUlPOYbB7U9PAHjG+QoXcQZkBEj+Q+RwN7YpWaoE6nqxZajL8x34mtn0of080dMoI2pkVeVWOiQ/WQigcDEtc/pftFKRAISc9/qGHlUchXE8H3mkWr4Iup1UITDA1JOuyOvlaDNmE3d5/VkKHzgoWeYr/MX71LEHYh+IMYzw3yj35nSoFtEiVaROnKgp1C1h1lLm28kEoN6nhIIDMs4TSgJH45hCIqdk7Sf5AyeqzeH8wC3XtZvukpS2EAyQxVour1eFqy0lGxuy/lbpkD0pxV3U1OfBA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yBBNC8AegJKWe9f5lDgGTvuDM6y7/enp8Xf9EPHbZfld9pUXtskgvpDumxvKw50Pz/efEkyDWOEOEYucprW3qrxYq3cumShvL0nDjIFn6jJFHKe8Jv/mS76oDB98mdS6JC57XYrLbsjRpIejgMRgzIWqyZ5hpvLSvUnqBCOZ89VnN5r+Agcz5OL0Fc2Aw9tBpvjW+hnBVLDYsKCiJnbnlnZ0h3Dgak48fWZviuF11WlvQEZ5V/rd2sMeH2DVjbK4yTSNedd2VXkaneGksqPu4gfhvmTheyYLXxVlcEvf09GH5Og6IHPw0MRBhsXbSLA3/afCl3g0SnKBpzGNWyqLoQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Frediano Ziglio <frediano.ziglio@xxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Frediano Ziglio <freddy77@xxxxxxxxx>
  • Delivery-date: Thu, 30 Apr 2026 10:49:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Adding Manuel that maintains the NetBSD xen-tools package.

On Thu, Apr 30, 2026 at 10:55:21AM +0100, Frediano Ziglio wrote:
> More similar to other implementation.
> posix_memalign was adde in NetBSD 8.0, released on July 17, 2018
> and went out of support on May 4, 2024.
> 
> Signed-off-by: Frediano Ziglio <frediano.ziglio@xxxxxxxxx>
> ---
>  tools/include/xenctrl.h     | 5 +++++
>  tools/libs/ctrl/xc_netbsd.c | 9 ++++++++-
>  2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
> index d5dbf69c89..f4316089e7 100644
> --- a/tools/include/xenctrl.h
> +++ b/tools/include/xenctrl.h
> @@ -1390,6 +1390,11 @@ int xc_lockprof_query(xc_interface *xch,
>                        uint64_t *time,
>                        xc_hypercall_buffer_t *data);
>  
> +/**
> + * Allocate memory with a given alignment.
> + * The alignment must be a power of 2 and at least sizeof(void*).
> + * It returns NULL on error, errno is not set.
> + */
>  void *xc_memalign(xc_interface *xch, size_t alignment, size_t size);
>  
>  /**
> diff --git a/tools/libs/ctrl/xc_netbsd.c b/tools/libs/ctrl/xc_netbsd.c
> index 1318d4d906..d27154dce9 100644
> --- a/tools/libs/ctrl/xc_netbsd.c
> +++ b/tools/libs/ctrl/xc_netbsd.c
> @@ -60,7 +60,14 @@ void discard_file_cache(xc_interface *xch, int fd, int 
> flush)
>  
>  void *xc_memalign(xc_interface *xch, size_t alignment, size_t size)
>  {
> -    return valloc(size);
> +    int ret;
> +    void *ptr;
> +
> +    ret = posix_memalign(&ptr, alignment, size);
> +    if (ret != 0 || !ptr)
> +        return NULL;
> +
> +    return ptr;
>  }
>  
>  int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
> -- 
> 2.43.0
> 



 


Rackspace

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