mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
block: compile out assert_bdrv_graph_readable() by default
reader_count() is a performance bottleneck because the global aio_context_list_lock mutex causes thread contention. Put this debugging assertion behind a new ./configure --enable-debug-graph-lock option and disable it by default. The --enable-debug-graph-lock option is also enabled by the more general --enable-debug option. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20230501173443.153062-1-stefanha@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
e19b157f3c
commit
58a2e3f5c3
5 changed files with 12 additions and 0 deletions
|
@ -265,7 +265,10 @@ void bdrv_graph_rdunlock_main_loop(void)
|
||||||
|
|
||||||
void assert_bdrv_graph_readable(void)
|
void assert_bdrv_graph_readable(void)
|
||||||
{
|
{
|
||||||
|
/* reader_count() is slow due to aio_context_list_lock lock contention */
|
||||||
|
#ifdef CONFIG_DEBUG_GRAPH_LOCK
|
||||||
assert(qemu_in_main_thread() || reader_count());
|
assert(qemu_in_main_thread() || reader_count());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void assert_bdrv_graph_writable(void)
|
void assert_bdrv_graph_writable(void)
|
||||||
|
|
1
configure
vendored
1
configure
vendored
|
@ -816,6 +816,7 @@ for opt do
|
||||||
--enable-debug)
|
--enable-debug)
|
||||||
# Enable debugging options that aren't excessively noisy
|
# Enable debugging options that aren't excessively noisy
|
||||||
debug_tcg="yes"
|
debug_tcg="yes"
|
||||||
|
meson_option_parse --enable-debug-graph-lock ""
|
||||||
meson_option_parse --enable-debug-mutex ""
|
meson_option_parse --enable-debug-mutex ""
|
||||||
meson_option_add -Doptimization=0
|
meson_option_add -Doptimization=0
|
||||||
fortify_source="no"
|
fortify_source="no"
|
||||||
|
|
|
@ -1963,6 +1963,7 @@ if get_option('debug_stack_usage') and have_coroutine_pool
|
||||||
have_coroutine_pool = false
|
have_coroutine_pool = false
|
||||||
endif
|
endif
|
||||||
config_host_data.set10('CONFIG_COROUTINE_POOL', have_coroutine_pool)
|
config_host_data.set10('CONFIG_COROUTINE_POOL', have_coroutine_pool)
|
||||||
|
config_host_data.set('CONFIG_DEBUG_GRAPH_LOCK', get_option('debug_graph_lock'))
|
||||||
config_host_data.set('CONFIG_DEBUG_MUTEX', get_option('debug_mutex'))
|
config_host_data.set('CONFIG_DEBUG_MUTEX', get_option('debug_mutex'))
|
||||||
config_host_data.set('CONFIG_DEBUG_STACK_USAGE', get_option('debug_stack_usage'))
|
config_host_data.set('CONFIG_DEBUG_STACK_USAGE', get_option('debug_stack_usage'))
|
||||||
config_host_data.set('CONFIG_GPROF', get_option('gprof'))
|
config_host_data.set('CONFIG_GPROF', get_option('gprof'))
|
||||||
|
@ -3841,6 +3842,7 @@ summary_info += {'PIE': get_option('b_pie')}
|
||||||
summary_info += {'static build': config_host.has_key('CONFIG_STATIC')}
|
summary_info += {'static build': config_host.has_key('CONFIG_STATIC')}
|
||||||
summary_info += {'malloc trim support': has_malloc_trim}
|
summary_info += {'malloc trim support': has_malloc_trim}
|
||||||
summary_info += {'membarrier': have_membarrier}
|
summary_info += {'membarrier': have_membarrier}
|
||||||
|
summary_info += {'debug graph lock': get_option('debug_graph_lock')}
|
||||||
summary_info += {'debug stack usage': get_option('debug_stack_usage')}
|
summary_info += {'debug stack usage': get_option('debug_stack_usage')}
|
||||||
summary_info += {'mutex debugging': get_option('debug_mutex')}
|
summary_info += {'mutex debugging': get_option('debug_mutex')}
|
||||||
summary_info += {'memory allocator': get_option('malloc')}
|
summary_info += {'memory allocator': get_option('malloc')}
|
||||||
|
|
|
@ -319,6 +319,8 @@ option('rng_none', type: 'boolean', value: false,
|
||||||
description: 'dummy RNG, avoid using /dev/(u)random and getrandom()')
|
description: 'dummy RNG, avoid using /dev/(u)random and getrandom()')
|
||||||
option('coroutine_pool', type: 'boolean', value: true,
|
option('coroutine_pool', type: 'boolean', value: true,
|
||||||
description: 'coroutine freelist (better performance)')
|
description: 'coroutine freelist (better performance)')
|
||||||
|
option('debug_graph_lock', type: 'boolean', value: false,
|
||||||
|
description: 'graph lock debugging support')
|
||||||
option('debug_mutex', type: 'boolean', value: false,
|
option('debug_mutex', type: 'boolean', value: false,
|
||||||
description: 'mutex debugging support')
|
description: 'mutex debugging support')
|
||||||
option('debug_stack_usage', type: 'boolean', value: false,
|
option('debug_stack_usage', type: 'boolean', value: false,
|
||||||
|
|
|
@ -23,6 +23,8 @@ meson_options_help() {
|
||||||
printf "%s\n" ' QEMU'
|
printf "%s\n" ' QEMU'
|
||||||
printf "%s\n" ' --enable-cfi Control-Flow Integrity (CFI)'
|
printf "%s\n" ' --enable-cfi Control-Flow Integrity (CFI)'
|
||||||
printf "%s\n" ' --enable-cfi-debug Verbose errors in case of CFI violation'
|
printf "%s\n" ' --enable-cfi-debug Verbose errors in case of CFI violation'
|
||||||
|
printf "%s\n" ' --enable-debug-graph-lock'
|
||||||
|
printf "%s\n" ' graph lock debugging support'
|
||||||
printf "%s\n" ' --enable-debug-mutex mutex debugging support'
|
printf "%s\n" ' --enable-debug-mutex mutex debugging support'
|
||||||
printf "%s\n" ' --enable-debug-stack-usage'
|
printf "%s\n" ' --enable-debug-stack-usage'
|
||||||
printf "%s\n" ' measure coroutine stack usage'
|
printf "%s\n" ' measure coroutine stack usage'
|
||||||
|
@ -254,6 +256,8 @@ _meson_option_parse() {
|
||||||
--datadir=*) quote_sh "-Ddatadir=$2" ;;
|
--datadir=*) quote_sh "-Ddatadir=$2" ;;
|
||||||
--enable-dbus-display) printf "%s" -Ddbus_display=enabled ;;
|
--enable-dbus-display) printf "%s" -Ddbus_display=enabled ;;
|
||||||
--disable-dbus-display) printf "%s" -Ddbus_display=disabled ;;
|
--disable-dbus-display) printf "%s" -Ddbus_display=disabled ;;
|
||||||
|
--enable-debug-graph-lock) printf "%s" -Ddebug_graph_lock=true ;;
|
||||||
|
--disable-debug-graph-lock) printf "%s" -Ddebug_graph_lock=false ;;
|
||||||
--enable-debug-mutex) printf "%s" -Ddebug_mutex=true ;;
|
--enable-debug-mutex) printf "%s" -Ddebug_mutex=true ;;
|
||||||
--disable-debug-mutex) printf "%s" -Ddebug_mutex=false ;;
|
--disable-debug-mutex) printf "%s" -Ddebug_mutex=false ;;
|
||||||
--enable-debug-stack-usage) printf "%s" -Ddebug_stack_usage=true ;;
|
--enable-debug-stack-usage) printf "%s" -Ddebug_stack_usage=true ;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue