All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools: Use posix_memalign instead of valloc for NetBSD
@ 2026-04-30  9:55 Frediano Ziglio
  2026-04-30 10:48 ` Roger Pau Monné
  2026-07-03 13:05 ` Anthony PERARD
  0 siblings, 2 replies; 7+ messages in thread
From: Frediano Ziglio @ 2026-04-30  9:55 UTC (permalink / raw)
  To: xen-devel
  Cc: Frediano Ziglio, Anthony PERARD, Juergen Gross, Andrew Cooper,
	Roger Pau Monné

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@cloud.com>
---
 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



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] tools: Use posix_memalign instead of valloc for NetBSD
  2026-04-30  9:55 [PATCH] tools: Use posix_memalign instead of valloc for NetBSD Frediano Ziglio
@ 2026-04-30 10:48 ` Roger Pau Monné
  2026-04-30 19:38   ` Manuel Bouyer
  2026-06-26 15:07   ` Frediano Ziglio
  2026-07-03 13:05 ` Anthony PERARD
  1 sibling, 2 replies; 7+ messages in thread
From: Roger Pau Monné @ 2026-04-30 10:48 UTC (permalink / raw)
  To: bouyer
  Cc: xen-devel, Frediano Ziglio, Anthony PERARD, Juergen Gross,
	Andrew Cooper, Frediano Ziglio

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@cloud.com>
> ---
>  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
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tools: Use posix_memalign instead of valloc for NetBSD
  2026-04-30 10:48 ` Roger Pau Monné
@ 2026-04-30 19:38   ` Manuel Bouyer
  2026-06-26 15:07   ` Frediano Ziglio
  1 sibling, 0 replies; 7+ messages in thread
From: Manuel Bouyer @ 2026-04-30 19:38 UTC (permalink / raw)
  To: Roger Pau Monné
  Cc: xen-devel, Frediano Ziglio, Anthony PERARD, Juergen Gross,
	Andrew Cooper, Frediano Ziglio

On Thu, Apr 30, 2026 at 12:48:53PM +0200, Roger Pau Monné wrote:
> Adding Manuel that maintains the NetBSD xen-tools package.

thanks
AFAIK this patch is fine

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tools: Use posix_memalign instead of valloc for NetBSD
  2026-04-30 10:48 ` Roger Pau Monné
  2026-04-30 19:38   ` Manuel Bouyer
@ 2026-06-26 15:07   ` Frediano Ziglio
  2026-06-29  7:01     ` Jan Beulich
  1 sibling, 1 reply; 7+ messages in thread
From: Frediano Ziglio @ 2026-06-26 15:07 UTC (permalink / raw)
  To: Roger Pau Monné
  Cc: bouyer, xen-devel, Frediano Ziglio, Anthony PERARD, Juergen Gross,
	Andrew Cooper

On Thu, 30 Apr 2026 at 11:48, Roger Pau Monné <roger.pau@citrix.com> wrote:
>
> 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@cloud.com>
> > ---
> >  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
> >

I saw Manuel reply almost 2 months ago.
Still pending.

Frediano


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tools: Use posix_memalign instead of valloc for NetBSD
  2026-06-26 15:07   ` Frediano Ziglio
@ 2026-06-29  7:01     ` Jan Beulich
  2026-06-29  9:14       ` Frediano Ziglio
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2026-06-29  7:01 UTC (permalink / raw)
  To: Frediano Ziglio, Anthony PERARD
  Cc: bouyer, xen-devel, Frediano Ziglio, Juergen Gross, Andrew Cooper,
	Roger Pau Monné

On 26.06.2026 17:07, Frediano Ziglio wrote:
> On Thu, 30 Apr 2026 at 11:48, Roger Pau Monné <roger.pau@citrix.com> wrote:
>>
>> 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@cloud.com>
>>> ---
>>>  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
>>>
> 
> I saw Manuel reply almost 2 months ago.
> Still pending.

You understand, though, that Roger can't approve this patch. That'll need to be
Anthony. Sending a ping _his_ way is certainly appropriate after this long a
time.

Jan


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tools: Use posix_memalign instead of valloc for NetBSD
  2026-06-29  7:01     ` Jan Beulich
@ 2026-06-29  9:14       ` Frediano Ziglio
  0 siblings, 0 replies; 7+ messages in thread
From: Frediano Ziglio @ 2026-06-29  9:14 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Anthony PERARD, bouyer, xen-devel, Frediano Ziglio, Juergen Gross,
	Andrew Cooper, Roger Pau Monné

On Mon, 29 Jun 2026 at 08:01, Jan Beulich <jbeulich@suse.com> wrote:
>
> On 26.06.2026 17:07, Frediano Ziglio wrote:
> > On Thu, 30 Apr 2026 at 11:48, Roger Pau Monné <roger.pau@citrix.com> wrote:
> >>
> >> 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@cloud.com>
> >>> ---
> >>>  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
> >>>
> >
> > I saw Manuel reply almost 2 months ago.
> > Still pending.
>
> You understand, though, that Roger can't approve this patch. That'll need to be
> Anthony. Sending a ping _his_ way is certainly appropriate after this long a
> time.
>
> Jan

Okay, looking at previous exchanges I thought the maintainer was Manuel.

Frediano


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tools: Use posix_memalign instead of valloc for NetBSD
  2026-04-30  9:55 [PATCH] tools: Use posix_memalign instead of valloc for NetBSD Frediano Ziglio
  2026-04-30 10:48 ` Roger Pau Monné
@ 2026-07-03 13:05 ` Anthony PERARD
  1 sibling, 0 replies; 7+ messages in thread
From: Anthony PERARD @ 2026-07-03 13:05 UTC (permalink / raw)
  To: Frediano Ziglio
  Cc: xen-devel, Frediano Ziglio, Juergen Gross, Andrew Cooper,
	Roger Pau Monné

[-- Attachment #1: Type: text/plain, Size: 438 bytes --]

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@cloud.com>

Acked-by: Anthony PERARD <anthony.perard@vates.tech>

Thanks,


--
 | Vates

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-07-03 13:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-30  9:55 [PATCH] tools: Use posix_memalign instead of valloc for NetBSD Frediano Ziglio
2026-04-30 10:48 ` Roger Pau Monné
2026-04-30 19:38   ` Manuel Bouyer
2026-06-26 15:07   ` Frediano Ziglio
2026-06-29  7:01     ` Jan Beulich
2026-06-29  9:14       ` Frediano Ziglio
2026-07-03 13:05 ` Anthony PERARD

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.