mirror of https://github.com/xemu-project/xemu.git
target/i386/cpu: Consolidate the use of warn_report_once()
The difference between error_printf() and error_report() is the latter may contain more information, such as the name of the program ("qemu-system-x86_64"). Thus its variant error_report_once() and warn_report()'s variant warn_report_once() can be used here to print the information only once without a static local variable "ht_warned". Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Message-ID: <20240327103951.3853425-3-zhao1.liu@linux.intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
7502ffb2f3
commit
8e3991ebc8
|
@ -7367,7 +7367,6 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
|
||||||
X86CPUClass *xcc = X86_CPU_GET_CLASS(dev);
|
X86CPUClass *xcc = X86_CPU_GET_CLASS(dev);
|
||||||
CPUX86State *env = &cpu->env;
|
CPUX86State *env = &cpu->env;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
static bool ht_warned;
|
|
||||||
unsigned requested_lbr_fmt;
|
unsigned requested_lbr_fmt;
|
||||||
|
|
||||||
#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
|
#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
|
||||||
|
@ -7610,13 +7609,11 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
|
||||||
*/
|
*/
|
||||||
if (IS_AMD_CPU(env) &&
|
if (IS_AMD_CPU(env) &&
|
||||||
!(env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_TOPOEXT) &&
|
!(env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_TOPOEXT) &&
|
||||||
cs->nr_threads > 1 && !ht_warned) {
|
cs->nr_threads > 1) {
|
||||||
warn_report("This family of AMD CPU doesn't support "
|
warn_report_once("This family of AMD CPU doesn't support "
|
||||||
"hyperthreading(%d)",
|
"hyperthreading(%d).", cs->nr_threads);
|
||||||
cs->nr_threads);
|
error_report_once("Please configure -smp options properly"
|
||||||
error_printf("Please configure -smp options properly"
|
" or try enabling topoext feature.");
|
||||||
" or try enabling topoext feature.\n");
|
|
||||||
ht_warned = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
|
|
Loading…
Reference in New Issue