Re: [PATCH 4/6] system/cpus: rename qemu_global_mutex to qemu_bql
On Thu, Nov 30, 2023 at 02:44:07PM +0100, Philippe Mathieu-Daudé wrote: > Hi Stefan, > > On 29/11/23 22:26, Stefan Hajnoczi wrote: > > The APIs using qemu_global_mutex now follow the Big QEMU Lock (BQL) > > nomenclature. It's a little strange that the actual QemuMutex variable > > that embodies the BQL is called qemu_global_mutex instead of qemu_bql. > > Rename it for consistency. > > > > Signed-off-by: Stefan Hajnoczi > > --- > > system/cpus.c | 20 ++-- > > 1 file changed, 10 insertions(+), 10 deletions(-) > > > > diff --git a/system/cpus.c b/system/cpus.c > > index eb24a4db8e..138720a540 100644 > > --- a/system/cpus.c > > +++ b/system/cpus.c > > @@ -65,7 +65,7 @@ > > #endif /* CONFIG_LINUX */ > > -static QemuMutex qemu_global_mutex; > > +static QemuMutex qemu_bql; > > I thought we were using _cond/_sem/_mutex suffixes, but > this is not enforced: I'm open to alternative names. Here are some I can think of: - big_qemu_lock (although grepping for "bql" won't find it) - qemu_bql_mutex If there is no strong feeling about this then let's leave it at qemu_bql. Otherwise, please discuss. Thanks, Stefan signature.asc Description: PGP signature
Re: [PATCH 4/6] system/cpus: rename qemu_global_mutex to qemu_bql
Hi Stefan, On 29/11/23 22:26, Stefan Hajnoczi wrote: The APIs using qemu_global_mutex now follow the Big QEMU Lock (BQL) nomenclature. It's a little strange that the actual QemuMutex variable that embodies the BQL is called qemu_global_mutex instead of qemu_bql. Rename it for consistency. Signed-off-by: Stefan Hajnoczi --- system/cpus.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/system/cpus.c b/system/cpus.c index eb24a4db8e..138720a540 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -65,7 +65,7 @@ #endif /* CONFIG_LINUX */ -static QemuMutex qemu_global_mutex; +static QemuMutex qemu_bql; I thought we were using _cond/_sem/_mutex suffixes, but this is not enforced: $ git grep -hE 'Qemu(Cond|Mutex|Semaphore) [a-zA-Z]' \ | sed -e 's/static //' -e 's/extern //' -e 's/^ *//' \ | sort -u QemuCond comp_done_cond; QemuCond cond; QemuCond decomp_done_cond; QemuCond event_complete_cond; QemuCond exclusive_cond; QemuCond exclusive_resume; QemuCond fwnmi_machine_check_interlock_cond; QemuCond handle_apdu_cond; QemuCond init_done_cond;/* is thread initialization done? */ QemuCond key_cond; QemuCond mutex_cond; QemuCond page_cond; QemuCond page_request_cond; QemuCond qemu_cpu_cond; QemuCond qemu_pause_cond; QemuCond qemu_work_cond; QemuCond request_cond; QemuCond reset_cond; QemuCond thr_cond; QemuCond thread_cond; QemuCond worker_stopped; QemuMutex active_timers_lock; QemuMutex aio_context_list_lock; QemuMutex bitmap_mutex; QemuMutex blkio_lock; QemuMutex chr_write_lock; QemuMutex cmdq_mutex; QemuMutex colo_compare_mutex; QemuMutex comp_done_lock; QemuMutex counts_mutex; QemuMutex decomp_done_lock; QemuMutex dirty_bitmap_mutex; QemuMutex dirtylimit_mutex; QemuMutex error_mutex; QemuMutex event_list_mutex; QemuMutex event_mtx; QemuMutex evlock; QemuMutex free_page_lock; QemuMutex global_mutex; QemuMutex gnt_lock; QemuMutex handle_apdu_mutex; QemuMutex handlers_mutex; QemuMutex init_done_lock; QemuMutex intp_mutex; /* protect the intp_list IRQ state */ QemuMutex io_mutex; QemuMutex iommu_lock; QemuMutex irq_level_lock[REMOTE_IOHUB_NB_PIRQS]; QemuMutex job_mutex; QemuMutex key_mutex; QemuMutex kml_slots_lock; QemuMutex lock; QemuMutex m; QemuMutex map_client_list_lock; QemuMutex migration_threads_lock; QemuMutex mon_fdsets_lock; QemuMutex mon_lock; QemuMutex monitor_lock; QemuMutex mutex; QemuMutex output_mutex; QemuMutex page_mutex; QemuMutex page_request_mutex; QemuMutex pending_out_mutex; QemuMutex port_lock; QemuMutex postcopy_prio_thread_mutex; QemuMutex qemu_cpu_list_lock; QemuMutex qemu_file_lock; QemuMutex qemu_global_mutex; QemuMutex qemu_sigp_mutex; QemuMutex qjack_shutdown_lock; QemuMutex qmp_queue_lock; QemuMutex queue_mutex; QemuMutex queued_requests_lock; /* protects queued_requests */ QemuMutex ram_block_discard_disable_mutex; QemuMutex rcu_registry_lock; QemuMutex rcu_sync_lock; QemuMutex readdir_mutex_L; QemuMutex reqs_lock; QemuMutex requests_lock; QemuMutex rp_mutex;/* We send replies from multiple threads */ QemuMutex rsp_mutex; QemuMutex rx_queue_lock; QemuMutex sigbus_mutex; QemuMutex sint_routes_mutex; QemuMutex src_page_req_mutex; QemuMutex start_lock; QemuMutex target_fd_trans_lock; QemuMutex thr_mutex; QemuMutex thread_lock; QemuMutex vdev_mutex; QemuMutex vmstop_lock; QemuMutex vreader_mutex; /* and guest_apdu_list mutex */ QemuMutex work_mutex; QemuMutex xen_timers_lock; QemuMutex yank_lock; QemuSemaphore channels_ready; QemuSemaphore colo_exit_sem; QemuSemaphore colo_incoming_sem; QemuSemaphore init_done_sem; /* is thread init done? */ QemuSemaphore pause_sem; QemuSemaphore postcopy_pause_sem; QemuSemaphore postcopy_pause_sem_dst; QemuSemaphore postcopy_pause_sem_fast_load; QemuSemaphore postcopy_pause_sem_fault; QemuSemaphore postcopy_qemufile_dst_done; QemuSemaphore postcopy_qemufile_src_sem; QemuSemaphore rate_limit_sem; QemuSemaphore rp_pong_acks; QemuSemaphore rp_sem; QemuSemaphore sem; QemuSemaphore sem_sync; QemuSemaphore sem_thread; QemuSemaphore wait_unplug_sem; So: Reviewed-by: Philippe Mathieu-Daudé
Re: [PATCH 4/6] system/cpus: rename qemu_global_mutex to qemu_bql
On 11/29/23 22:26, Stefan Hajnoczi wrote: The APIs using qemu_global_mutex now follow the Big QEMU Lock (BQL) nomenclature. It's a little strange that the actual QemuMutex variable that embodies the BQL is called qemu_global_mutex instead of qemu_bql. Rename it for consistency. Signed-off-by: Stefan Hajnoczi Reviewed-by: Cédric Le Goater Thanks, C.
[PATCH 4/6] system/cpus: rename qemu_global_mutex to qemu_bql
The APIs using qemu_global_mutex now follow the Big QEMU Lock (BQL) nomenclature. It's a little strange that the actual QemuMutex variable that embodies the BQL is called qemu_global_mutex instead of qemu_bql. Rename it for consistency. Signed-off-by: Stefan Hajnoczi --- system/cpus.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/system/cpus.c b/system/cpus.c index eb24a4db8e..138720a540 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -65,7 +65,7 @@ #endif /* CONFIG_LINUX */ -static QemuMutex qemu_global_mutex; +static QemuMutex qemu_bql; /* * The chosen accelerator is supposed to register this. @@ -389,14 +389,14 @@ void qemu_init_cpu_loop(void) qemu_init_sigbus(); qemu_cond_init(_cpu_cond); qemu_cond_init(_pause_cond); -qemu_mutex_init(_global_mutex); +qemu_mutex_init(_bql); qemu_thread_get_self(_thread); } void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) { -do_run_on_cpu(cpu, func, data, _global_mutex); +do_run_on_cpu(cpu, func, data, _bql); } static void qemu_cpu_stop(CPUState *cpu, bool exit) @@ -428,7 +428,7 @@ void qemu_wait_io_event(CPUState *cpu) slept = true; qemu_plugin_vcpu_idle_cb(cpu); } -qemu_cond_wait(cpu->halt_cond, _global_mutex); +qemu_cond_wait(cpu->halt_cond, _bql); } if (slept) { qemu_plugin_vcpu_resume_cb(cpu); @@ -502,7 +502,7 @@ void qemu_bql_lock_impl(const char *file, int line) QemuMutexLockFunc bql_lock = qatomic_read(_bql_mutex_lock_func); g_assert(!qemu_bql_locked()); -bql_lock(_global_mutex, file, line); +bql_lock(_bql, file, line); set_bql_locked(true); } @@ -510,17 +510,17 @@ void qemu_bql_unlock(void) { g_assert(qemu_bql_locked()); set_bql_locked(false); -qemu_mutex_unlock(_global_mutex); +qemu_mutex_unlock(_bql); } void qemu_cond_wait_bql(QemuCond *cond) { -qemu_cond_wait(cond, _global_mutex); +qemu_cond_wait(cond, _bql); } void qemu_cond_timedwait_bql(QemuCond *cond, int ms) { -qemu_cond_timedwait(cond, _global_mutex, ms); +qemu_cond_timedwait(cond, _bql, ms); } /* signal CPU creation */ @@ -571,7 +571,7 @@ void pause_all_vcpus(void) replay_mutex_unlock(); while (!all_vcpus_paused()) { -qemu_cond_wait(_pause_cond, _global_mutex); +qemu_cond_wait(_pause_cond, _bql); CPU_FOREACH(cpu) { qemu_cpu_kick(cpu); } @@ -649,7 +649,7 @@ void qemu_init_vcpu(CPUState *cpu) cpus_accel->create_vcpu_thread(cpu); while (!cpu->created) { -qemu_cond_wait(_cpu_cond, _global_mutex); +qemu_cond_wait(_cpu_cond, _bql); } } -- 2.42.0