Re: [PATCH 2/6] qemu/main-loop: rename QEMU_IOTHREAD_LOCK_GUARD to QEMU_BQL_LOCK_GUARD
On 12/1/23 01:57, Stefan Hajnoczi wrote: On Thu, Nov 30, 2023 at 10:14:47AM +0100, Ilya Leoshkevich wrote: On Wed, 2023-11-29 at 16:26 -0500, Stefan Hajnoczi wrote: The name "iothread" is overloaded. Use the term Big QEMU Lock (BQL) instead, it is already widely used and unambiguous. Signed-off-by: Stefan Hajnoczi --- include/qemu/main-loop.h | 20 ++-- hw/i386/kvm/xen_evtchn.c | 14 +++--- hw/i386/kvm/xen_gnttab.c | 2 +- hw/mips/mips_int.c | 2 +- hw/ppc/ppc.c | 2 +- target/i386/kvm/xen-emu.c | 2 +- target/ppc/excp_helper.c | 2 +- target/ppc/helper_regs.c | 2 +- target/riscv/cpu_helper.c | 4 ++-- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h index d6f75e57bd..0b6a3e4824 100644 --- a/include/qemu/main-loop.h +++ b/include/qemu/main-loop.h @@ -344,13 +344,13 @@ void qemu_bql_lock_impl(const char *file, int line); void qemu_bql_unlock(void); /** - * QEMU_IOTHREAD_LOCK_GUARD + * QEMU_BQL_LOCK_GUARD * - * Wrap a block of code in a conditional qemu_mutex_{lock,unlock}_iothread. + * Wrap a block of code in a conditional qemu_bql_{lock,unlock}. */ -typedef struct IOThreadLockAuto IOThreadLockAuto; +typedef struct BQLLockAuto BQLLockAuto; -static inline IOThreadLockAuto *qemu_iothread_auto_lock(const char *file, +static inline BQLLockAuto *qemu_bql_auto_lock(const char *file, int line) The padding is not correct anymore. Good point, I didn't check the formatting after search-and-replace. I will fix this across the patch series in v2. Yeh, some comments in 5/6 and 6/6 can also make full use of 80 char width after search-replace effect. regards, Harsh Stefan
Re: [PATCH 2/6] qemu/main-loop: rename QEMU_IOTHREAD_LOCK_GUARD to QEMU_BQL_LOCK_GUARD
On Thu, Nov 30, 2023 at 10:14:47AM +0100, Ilya Leoshkevich wrote: > On Wed, 2023-11-29 at 16:26 -0500, Stefan Hajnoczi wrote: > > The name "iothread" is overloaded. Use the term Big QEMU Lock (BQL) > > instead, it is already widely used and unambiguous. > > > > Signed-off-by: Stefan Hajnoczi > > --- > > include/qemu/main-loop.h | 20 ++-- > > hw/i386/kvm/xen_evtchn.c | 14 +++--- > > hw/i386/kvm/xen_gnttab.c | 2 +- > > hw/mips/mips_int.c | 2 +- > > hw/ppc/ppc.c | 2 +- > > target/i386/kvm/xen-emu.c | 2 +- > > target/ppc/excp_helper.c | 2 +- > > target/ppc/helper_regs.c | 2 +- > > target/riscv/cpu_helper.c | 4 ++-- > > 9 files changed, 25 insertions(+), 25 deletions(-) > > > > diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h > > index d6f75e57bd..0b6a3e4824 100644 > > --- a/include/qemu/main-loop.h > > +++ b/include/qemu/main-loop.h > > @@ -344,13 +344,13 @@ void qemu_bql_lock_impl(const char *file, int > > line); > > void qemu_bql_unlock(void); > > > > /** > > - * QEMU_IOTHREAD_LOCK_GUARD > > + * QEMU_BQL_LOCK_GUARD > > * > > - * Wrap a block of code in a conditional > > qemu_mutex_{lock,unlock}_iothread. > > + * Wrap a block of code in a conditional qemu_bql_{lock,unlock}. > > */ > > -typedef struct IOThreadLockAuto IOThreadLockAuto; > > +typedef struct BQLLockAuto BQLLockAuto; > > > > -static inline IOThreadLockAuto *qemu_iothread_auto_lock(const char > > *file, > > +static inline BQLLockAuto *qemu_bql_auto_lock(const char *file, > > int line) > > The padding is not correct anymore. Good point, I didn't check the formatting after search-and-replace. I will fix this across the patch series in v2. Stefan signature.asc Description: PGP signature
Re: [PATCH 2/6] qemu/main-loop: rename QEMU_IOTHREAD_LOCK_GUARD to QEMU_BQL_LOCK_GUARD
On 11/29/23 22:26, Stefan Hajnoczi wrote: The name "iothread" is overloaded. Use the term Big QEMU Lock (BQL) instead, it is already widely used and unambiguous. Signed-off-by: Stefan Hajnoczi Reviewed-by: Cédric Le Goater Thanks, C.
Re: [PATCH 2/6] qemu/main-loop: rename QEMU_IOTHREAD_LOCK_GUARD to QEMU_BQL_LOCK_GUARD
On Wed, 2023-11-29 at 16:26 -0500, Stefan Hajnoczi wrote: > The name "iothread" is overloaded. Use the term Big QEMU Lock (BQL) > instead, it is already widely used and unambiguous. > > Signed-off-by: Stefan Hajnoczi Acked-by: David Woodhouse smime.p7s Description: S/MIME cryptographic signature
Re: [PATCH 2/6] qemu/main-loop: rename QEMU_IOTHREAD_LOCK_GUARD to QEMU_BQL_LOCK_GUARD
On Wed, 2023-11-29 at 16:26 -0500, Stefan Hajnoczi wrote: > The name "iothread" is overloaded. Use the term Big QEMU Lock (BQL) > instead, it is already widely used and unambiguous. > > Signed-off-by: Stefan Hajnoczi > --- > include/qemu/main-loop.h | 20 ++-- > hw/i386/kvm/xen_evtchn.c | 14 +++--- > hw/i386/kvm/xen_gnttab.c | 2 +- > hw/mips/mips_int.c | 2 +- > hw/ppc/ppc.c | 2 +- > target/i386/kvm/xen-emu.c | 2 +- > target/ppc/excp_helper.c | 2 +- > target/ppc/helper_regs.c | 2 +- > target/riscv/cpu_helper.c | 4 ++-- > 9 files changed, 25 insertions(+), 25 deletions(-) > > diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h > index d6f75e57bd..0b6a3e4824 100644 > --- a/include/qemu/main-loop.h > +++ b/include/qemu/main-loop.h > @@ -344,13 +344,13 @@ void qemu_bql_lock_impl(const char *file, int > line); > void qemu_bql_unlock(void); > > /** > - * QEMU_IOTHREAD_LOCK_GUARD > + * QEMU_BQL_LOCK_GUARD > * > - * Wrap a block of code in a conditional > qemu_mutex_{lock,unlock}_iothread. > + * Wrap a block of code in a conditional qemu_bql_{lock,unlock}. > */ > -typedef struct IOThreadLockAuto IOThreadLockAuto; > +typedef struct BQLLockAuto BQLLockAuto; > > -static inline IOThreadLockAuto *qemu_iothread_auto_lock(const char > *file, > +static inline BQLLockAuto *qemu_bql_auto_lock(const char *file, > int line) The padding is not correct anymore. Other than this: Acked-by: Ilya Leoshkevich
Re: [PATCH 2/6] qemu/main-loop: rename QEMU_IOTHREAD_LOCK_GUARD to QEMU_BQL_LOCK_GUARD
On 29/11/2023 21:26, Stefan Hajnoczi wrote: The name "iothread" is overloaded. Use the term Big QEMU Lock (BQL) instead, it is already widely used and unambiguous. Signed-off-by: Stefan Hajnoczi --- include/qemu/main-loop.h | 20 ++-- hw/i386/kvm/xen_evtchn.c | 14 +++--- hw/i386/kvm/xen_gnttab.c | 2 +- hw/mips/mips_int.c| 2 +- hw/ppc/ppc.c | 2 +- target/i386/kvm/xen-emu.c | 2 +- target/ppc/excp_helper.c | 2 +- target/ppc/helper_regs.c | 2 +- target/riscv/cpu_helper.c | 4 ++-- 9 files changed, 25 insertions(+), 25 deletions(-) Reviewed-by: Paul Durrant
[PATCH 2/6] qemu/main-loop: rename QEMU_IOTHREAD_LOCK_GUARD to QEMU_BQL_LOCK_GUARD
The name "iothread" is overloaded. Use the term Big QEMU Lock (BQL) instead, it is already widely used and unambiguous. Signed-off-by: Stefan Hajnoczi --- include/qemu/main-loop.h | 20 ++-- hw/i386/kvm/xen_evtchn.c | 14 +++--- hw/i386/kvm/xen_gnttab.c | 2 +- hw/mips/mips_int.c| 2 +- hw/ppc/ppc.c | 2 +- target/i386/kvm/xen-emu.c | 2 +- target/ppc/excp_helper.c | 2 +- target/ppc/helper_regs.c | 2 +- target/riscv/cpu_helper.c | 4 ++-- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h index d6f75e57bd..0b6a3e4824 100644 --- a/include/qemu/main-loop.h +++ b/include/qemu/main-loop.h @@ -344,13 +344,13 @@ void qemu_bql_lock_impl(const char *file, int line); void qemu_bql_unlock(void); /** - * QEMU_IOTHREAD_LOCK_GUARD + * QEMU_BQL_LOCK_GUARD * - * Wrap a block of code in a conditional qemu_mutex_{lock,unlock}_iothread. + * Wrap a block of code in a conditional qemu_bql_{lock,unlock}. */ -typedef struct IOThreadLockAuto IOThreadLockAuto; +typedef struct BQLLockAuto BQLLockAuto; -static inline IOThreadLockAuto *qemu_iothread_auto_lock(const char *file, +static inline BQLLockAuto *qemu_bql_auto_lock(const char *file, int line) { if (qemu_bql_locked()) { @@ -358,19 +358,19 @@ static inline IOThreadLockAuto *qemu_iothread_auto_lock(const char *file, } qemu_bql_lock_impl(file, line); /* Anything non-NULL causes the cleanup function to be called */ -return (IOThreadLockAuto *)(uintptr_t)1; +return (BQLLockAuto *)(uintptr_t)1; } -static inline void qemu_iothread_auto_unlock(IOThreadLockAuto *l) +static inline void qemu_bql_auto_unlock(BQLLockAuto *l) { qemu_bql_unlock(); } -G_DEFINE_AUTOPTR_CLEANUP_FUNC(IOThreadLockAuto, qemu_iothread_auto_unlock) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BQLLockAuto, qemu_bql_auto_unlock) -#define QEMU_IOTHREAD_LOCK_GUARD() \ -g_autoptr(IOThreadLockAuto) _iothread_lock_auto __attribute__((unused)) \ -= qemu_iothread_auto_lock(__FILE__, __LINE__) +#define QEMU_BQL_LOCK_GUARD() \ +g_autoptr(BQLLockAuto) _bql_lock_auto __attribute__((unused)) \ += qemu_bql_auto_lock(__FILE__, __LINE__) /* * qemu_cond_wait_iothread: Wait on condition for the main loop mutex diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c index 07d0ff0253..3ab686bd79 100644 --- a/hw/i386/kvm/xen_evtchn.c +++ b/hw/i386/kvm/xen_evtchn.c @@ -1127,7 +1127,7 @@ int xen_evtchn_reset_op(struct evtchn_reset *reset) return -ESRCH; } -QEMU_IOTHREAD_LOCK_GUARD(); +QEMU_BQL_LOCK_GUARD(); return xen_evtchn_soft_reset(); } @@ -1145,7 +1145,7 @@ int xen_evtchn_close_op(struct evtchn_close *close) return -EINVAL; } -QEMU_IOTHREAD_LOCK_GUARD(); +QEMU_BQL_LOCK_GUARD(); qemu_mutex_lock(>port_lock); ret = close_port(s, close->port, _kvm_routes); @@ -1272,7 +1272,7 @@ int xen_evtchn_bind_pirq_op(struct evtchn_bind_pirq *pirq) return -EINVAL; } -QEMU_IOTHREAD_LOCK_GUARD(); +QEMU_BQL_LOCK_GUARD(); if (s->pirq[pirq->pirq].port) { return -EBUSY; @@ -1824,7 +1824,7 @@ int xen_physdev_map_pirq(struct physdev_map_pirq *map) return -ENOTSUP; } -QEMU_IOTHREAD_LOCK_GUARD(); +QEMU_BQL_LOCK_GUARD(); QEMU_LOCK_GUARD(>port_lock); if (map->domid != DOMID_SELF && map->domid != xen_domid) { @@ -1884,7 +1884,7 @@ int xen_physdev_unmap_pirq(struct physdev_unmap_pirq *unmap) return -EINVAL; } -QEMU_IOTHREAD_LOCK_GUARD(); +QEMU_BQL_LOCK_GUARD(); qemu_mutex_lock(>port_lock); if (!pirq_inuse(s, pirq)) { @@ -1924,7 +1924,7 @@ int xen_physdev_eoi_pirq(struct physdev_eoi *eoi) return -ENOTSUP; } -QEMU_IOTHREAD_LOCK_GUARD(); +QEMU_BQL_LOCK_GUARD(); QEMU_LOCK_GUARD(>port_lock); if (!pirq_inuse(s, pirq)) { @@ -1956,7 +1956,7 @@ int xen_physdev_query_pirq(struct physdev_irq_status_query *query) return -ENOTSUP; } -QEMU_IOTHREAD_LOCK_GUARD(); +QEMU_BQL_LOCK_GUARD(); QEMU_LOCK_GUARD(>port_lock); if (!pirq_inuse(s, pirq)) { diff --git a/hw/i386/kvm/xen_gnttab.c b/hw/i386/kvm/xen_gnttab.c index 0a24f53f20..ee5f8cf257 100644 --- a/hw/i386/kvm/xen_gnttab.c +++ b/hw/i386/kvm/xen_gnttab.c @@ -176,7 +176,7 @@ int xen_gnttab_map_page(uint64_t idx, uint64_t gfn) return -EINVAL; } -QEMU_IOTHREAD_LOCK_GUARD(); +QEMU_BQL_LOCK_GUARD(); QEMU_LOCK_GUARD(>gnt_lock); xen_overlay_do_map_page(>gnt_aliases[idx], gpa); diff --git a/hw/mips/mips_int.c b/hw/mips/mips_int.c index 6c32e466a3..c2454f9724 100644 --- a/hw/mips/mips_int.c +++ b/hw/mips/mips_int.c @@ -36,7 +36,7 @@ static void cpu_mips_irq_request(void *opaque, int irq, int level) return; } -QEMU_IOTHREAD_LOCK_GUARD(); +QEMU_BQL_LOCK_GUARD(); if