* [Qemu-devel] [PATCH] oslib-posix: check for posix_memalign in configure script
@ 2018-01-04 17:39 Andreas Gustafsson
2018-01-05 14:14 ` Kamil Rytarowski
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Andreas Gustafsson @ 2018-01-04 17:39 UTC (permalink / raw)
To: qemu-devel; +Cc: Kamil Rytarowski
Check for the presence of posix_memalign() in the configure script,
not using "defined(_POSIX_C_SOURCE) && !defined(__sun__)". This
lets qemu use posix_memalign() on NetBSD versions that have it,
instead of falling back to valloc() which is wasteful when the
required alignment is smaller than a page.
Signed-off-by: Andreas Gustafsson <gson@gson.org>
---
configure | 19 +++++++++++++++++++
util/oslib-posix.c | 2 +-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index 100309c33f..9f8580332a 100755
--- a/configure
+++ b/configure
@@ -4573,6 +4573,21 @@ if compile_prog "" "" ; then
posix_madvise=yes
fi
+##########################################
+# check if we have posix_memalign()
+
+posix_memalign=no
+cat > $TMPC << EOF
+#include <stdlib.h>
+int main(void) {
+ void *p;
+ return posix_memalign(&p, 8, 8);
+}
+EOF
+if compile_prog "" "" ; then
+ posix_memalign=yes
+fi
+
##########################################
# check if we have posix_syslog
@@ -5542,6 +5557,7 @@ echo "preadv support $preadv"
echo "fdatasync $fdatasync"
echo "madvise $madvise"
echo "posix_madvise $posix_madvise"
+echo "posix_memalign $posix_memalign"
echo "libcap-ng support $cap_ng"
echo "vhost-net support $vhost_net"
echo "vhost-scsi support $vhost_scsi"
@@ -6015,6 +6031,9 @@ fi
if test "$posix_madvise" = "yes" ; then
echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
fi
+if test "$posix_memalign" = "yes" ; then
+ echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak
+fi
if test "$spice" = "yes" ; then
echo "CONFIG_SPICE=y" >> $config_host_mak
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 77369c92ce..4655bc1f89 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -105,7 +105,7 @@ void *qemu_try_memalign(size_t alignment, size_t size)
alignment = sizeof(void*);
}
-#if defined(_POSIX_C_SOURCE) && !defined(__sun__)
+#if defined(CONFIG_POSIX_MEMALIGN)
int ret;
ret = posix_memalign(&ptr, alignment, size);
if (ret != 0) {
--
2.15.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] oslib-posix: check for posix_memalign in configure script
2018-01-04 17:39 [Qemu-devel] [PATCH] oslib-posix: check for posix_memalign in configure script Andreas Gustafsson
@ 2018-01-05 14:14 ` Kamil Rytarowski
2018-01-08 15:34 ` Peter Maydell
2018-02-10 7:22 ` Michael Tokarev
2 siblings, 0 replies; 7+ messages in thread
From: Kamil Rytarowski @ 2018-01-05 14:14 UTC (permalink / raw)
To: Andreas Gustafsson, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 2392 bytes --]
On 04.01.2018 18:39, Andreas Gustafsson wrote:
> Check for the presence of posix_memalign() in the configure script,
> not using "defined(_POSIX_C_SOURCE) && !defined(__sun__)". This
> lets qemu use posix_memalign() on NetBSD versions that have it,
> instead of falling back to valloc() which is wasteful when the
> required alignment is smaller than a page.
>
> Signed-off-by: Andreas Gustafsson <gson@gson.org>
Reviewed-by: Kamil Rytarowski <n54@gmx.com>
> ---
> configure | 19 +++++++++++++++++++
> util/oslib-posix.c | 2 +-
> 2 files changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 100309c33f..9f8580332a 100755
> --- a/configure
> +++ b/configure
> @@ -4573,6 +4573,21 @@ if compile_prog "" "" ; then
> posix_madvise=yes
> fi
>
> +##########################################
> +# check if we have posix_memalign()
> +
> +posix_memalign=no
> +cat > $TMPC << EOF
> +#include <stdlib.h>
> +int main(void) {
> + void *p;
> + return posix_memalign(&p, 8, 8);
> +}
> +EOF
> +if compile_prog "" "" ; then
> + posix_memalign=yes
> +fi
> +
> ##########################################
> # check if we have posix_syslog
>
> @@ -5542,6 +5557,7 @@ echo "preadv support $preadv"
> echo "fdatasync $fdatasync"
> echo "madvise $madvise"
> echo "posix_madvise $posix_madvise"
> +echo "posix_memalign $posix_memalign"
> echo "libcap-ng support $cap_ng"
> echo "vhost-net support $vhost_net"
> echo "vhost-scsi support $vhost_scsi"
> @@ -6015,6 +6031,9 @@ fi
> if test "$posix_madvise" = "yes" ; then
> echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
> fi
> +if test "$posix_memalign" = "yes" ; then
> + echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak
> +fi
>
> if test "$spice" = "yes" ; then
> echo "CONFIG_SPICE=y" >> $config_host_mak
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index 77369c92ce..4655bc1f89 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -105,7 +105,7 @@ void *qemu_try_memalign(size_t alignment, size_t size)
> alignment = sizeof(void*);
> }
>
> -#if defined(_POSIX_C_SOURCE) && !defined(__sun__)
> +#if defined(CONFIG_POSIX_MEMALIGN)
> int ret;
> ret = posix_memalign(&ptr, alignment, size);
> if (ret != 0) {
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 850 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] oslib-posix: check for posix_memalign in configure script
2018-01-04 17:39 [Qemu-devel] [PATCH] oslib-posix: check for posix_memalign in configure script Andreas Gustafsson
2018-01-05 14:14 ` Kamil Rytarowski
@ 2018-01-08 15:34 ` Peter Maydell
2018-01-08 16:01 ` Andreas Gustafsson
2018-02-10 7:22 ` Michael Tokarev
2 siblings, 1 reply; 7+ messages in thread
From: Peter Maydell @ 2018-01-08 15:34 UTC (permalink / raw)
To: Andreas Gustafsson; +Cc: QEMU Developers, Kamil Rytarowski, QEMU Trivial
On 4 January 2018 at 17:39, Andreas Gustafsson <gson@gson.org> wrote:
> Check for the presence of posix_memalign() in the configure script,
> not using "defined(_POSIX_C_SOURCE) && !defined(__sun__)". This
> lets qemu use posix_memalign() on NetBSD versions that have it,
> instead of falling back to valloc() which is wasteful when the
> required alignment is smaller than a page.
>
> Signed-off-by: Andreas Gustafsson <gson@gson.org>
> ---
> configure | 19 +++++++++++++++++++
> util/oslib-posix.c | 2 +-
> 2 files changed, 20 insertions(+), 1 deletion(-)
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Can we put this through the -trivial tree? (cc'd)
thanks
-- PMM
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] oslib-posix: check for posix_memalign in configure script
2018-01-08 15:34 ` Peter Maydell
@ 2018-01-08 16:01 ` Andreas Gustafsson
2018-01-08 16:05 ` Peter Maydell
2018-01-08 16:10 ` Kamil Rytarowski
0 siblings, 2 replies; 7+ messages in thread
From: Andreas Gustafsson @ 2018-01-08 16:01 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers, Kamil Rytarowski, QEMU Trivial
Peter Maydell wrote:
> Can we put this through the -trivial tree? (cc'd)
I'm not sufficiently familiar with the intenal workflows of the qemu
project to give a meaningful answer to that question.
--
Andreas Gustafsson, gson@gson.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] oslib-posix: check for posix_memalign in configure script
2018-01-08 16:01 ` Andreas Gustafsson
@ 2018-01-08 16:05 ` Peter Maydell
2018-01-08 16:10 ` Kamil Rytarowski
1 sibling, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2018-01-08 16:05 UTC (permalink / raw)
To: Andreas Gustafsson; +Cc: QEMU Developers, Kamil Rytarowski, QEMU Trivial
On 8 January 2018 at 16:01, Andreas Gustafsson <gson@gson.org> wrote:
> Peter Maydell wrote:
>> Can we put this through the -trivial tree? (cc'd)
>
> I'm not sufficiently familiar with the intenal workflows of the qemu
> project to give a meaningful answer to that question.
Sorry, I should have been clearer, that question was aimed
at the qemu-trivial queue maintainers.
thanks
-- PMM
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] oslib-posix: check for posix_memalign in configure script
2018-01-08 16:01 ` Andreas Gustafsson
2018-01-08 16:05 ` Peter Maydell
@ 2018-01-08 16:10 ` Kamil Rytarowski
1 sibling, 0 replies; 7+ messages in thread
From: Kamil Rytarowski @ 2018-01-08 16:10 UTC (permalink / raw)
To: Andreas Gustafsson, Peter Maydell
Cc: QEMU Developers, Kamil Rytarowski, QEMU Trivial
[-- Attachment #1: Type: text/plain, Size: 476 bytes --]
On 08.01.2018 17:01, Andreas Gustafsson wrote:
> Peter Maydell wrote:
>> Can we put this through the -trivial tree? (cc'd)
>
> I'm not sufficiently familiar with the intenal workflows of the qemu
> project to give a meaningful answer to that question.
>
I don't maintain a NetBSD merge queue and NetBSD patches go through
other developers (e.g. qemu-trivial).
I would comaintain a BSD merge queue, but so far there are no active
volunteers from other BSDs.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 850 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] oslib-posix: check for posix_memalign in configure script
2018-01-04 17:39 [Qemu-devel] [PATCH] oslib-posix: check for posix_memalign in configure script Andreas Gustafsson
2018-01-05 14:14 ` Kamil Rytarowski
2018-01-08 15:34 ` Peter Maydell
@ 2018-02-10 7:22 ` Michael Tokarev
2 siblings, 0 replies; 7+ messages in thread
From: Michael Tokarev @ 2018-02-10 7:22 UTC (permalink / raw)
To: Andreas Gustafsson, qemu-devel; +Cc: Kamil Rytarowski, QEMU Trivial
04.01.2018 20:39, Andreas Gustafsson wrote:
> Check for the presence of posix_memalign() in the configure script,
> not using "defined(_POSIX_C_SOURCE) && !defined(__sun__)". This
> lets qemu use posix_memalign() on NetBSD versions that have it,
> instead of falling back to valloc() which is wasteful when the
> required alignment is smaller than a page.
Applied to -trivial, thanks!
/mjt
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-02-10 7:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-04 17:39 [Qemu-devel] [PATCH] oslib-posix: check for posix_memalign in configure script Andreas Gustafsson
2018-01-05 14:14 ` Kamil Rytarowski
2018-01-08 15:34 ` Peter Maydell
2018-01-08 16:01 ` Andreas Gustafsson
2018-01-08 16:05 ` Peter Maydell
2018-01-08 16:10 ` Kamil Rytarowski
2018-02-10 7:22 ` Michael Tokarev
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.