[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 04/10] qemu-thread: optimize QemuLockCnt with fu
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 04/10] qemu-thread: optimize QemuLockCnt with futexes on Linux |
Date: |
Wed, 30 Nov 2016 13:19:48 +0000 |
User-agent: |
Mutt/1.7.1 (2016-10-04) |
On Tue, Nov 29, 2016 at 12:47:01PM +0100, Paolo Bonzini wrote:
> diff --git a/include/qemu/futex.h b/include/qemu/futex.h
> new file mode 100644
> index 0000000..c3d1089
> --- /dev/null
> +++ b/include/qemu/futex.h
> @@ -0,0 +1,36 @@
> +/*
> + * Wrappers around Linux futex syscall
> + *
> + * Copyright Red Hat, Inc. 2015
> + *
> + * Author:
> + * Paolo Bonzini <address@hidden>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + *
> + */
> +
> +#include <sys/syscall.h>
> +#include <linux/futex.h>
> +
> +#define futex(...) syscall(__NR_futex, __VA_ARGS__)
> +
> +static inline void futex_wake(void *f, int n)
> +{
> + futex(f, FUTEX_WAKE, n, NULL, NULL, 0);
> +}
> +
> +static inline void futex_wait(void *f, unsigned val)
Now that this is being promoted to an include/ API please use
qemu_futex(), qemu_futex_wake(), and qemu_futex_wait() names. It's a
bit bold to use futex(), futex_wake(), and futex_wait(). We're relying
on the fact that no system headers will ever use those names.
I haven't reviewed this patch in detail but:
Acked-by: Stefan Hajnoczi <address@hidden>
signature.asc
Description: PGP signature
- [Qemu-devel] [PATCH 01/10] aio: rename bh_lock to list_lock, (continued)
- [Qemu-devel] [PATCH 01/10] aio: rename bh_lock to list_lock, Paolo Bonzini, 2016/11/29
- [Qemu-devel] [PATCH 02/10] qemu-thread: introduce QemuLockCnt, Paolo Bonzini, 2016/11/29
- [Qemu-devel] [PATCH 03/10] aio: make ctx->list_lock a QemuLockCnt, subsuming ctx->walking_bh, Paolo Bonzini, 2016/11/29
- [Qemu-devel] [PATCH 05/10] aio: tweak walking in dispatch phase, Paolo Bonzini, 2016/11/29
- [Qemu-devel] [PATCH 04/10] qemu-thread: optimize QemuLockCnt with futexes on Linux, Paolo Bonzini, 2016/11/29
- Re: [Qemu-devel] [PATCH 04/10] qemu-thread: optimize QemuLockCnt with futexes on Linux,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 07/10] aio-win32: remove walking_handlers, protecting AioHandler list with list_lock, Paolo Bonzini, 2016/11/29
- [Qemu-devel] [PATCH 06/10] aio-posix: remove walking_handlers, protecting AioHandler list with list_lock, Paolo Bonzini, 2016/11/29
- [Qemu-devel] [PATCH 10/10] async: optimize aio_bh_poll, Paolo Bonzini, 2016/11/29
- [Qemu-devel] [PATCH 08/10] aio: document locking, Paolo Bonzini, 2016/11/29
- [Qemu-devel] [PATCH 09/10] aio: push aio_context_acquire/release down to dispatching, Paolo Bonzini, 2016/11/29