From: Zhao Liu <zhao1.liu@linux.intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, Zhao Liu <zhao1.liu@intel.com>
Subject: [PATCH 2/3] target/i386/cpu: Consolidate the use of warn_report_once()
Date: Wed, 27 Mar 2024 18:39:50 +0800 [thread overview]
Message-ID: <20240327103951.3853425-3-zhao1.liu@linux.intel.com> (raw)
In-Reply-To: <20240327103951.3853425-1-zhao1.liu@linux.intel.com>
From: Zhao Liu <zhao1.liu@intel.com>
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>
---
target/i386/cpu.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 33760a2ee163..0487469d75f3 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -7230,7 +7230,6 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
X86CPUClass *xcc = X86_CPU_GET_CLASS(dev);
CPUX86State *env = &cpu->env;
Error *local_err = NULL;
- static bool ht_warned;
unsigned requested_lbr_fmt;
#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
@@ -7453,13 +7452,11 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
*/
if (IS_AMD_CPU(env) &&
!(env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_TOPOEXT) &&
- cs->nr_threads > 1 && !ht_warned) {
- warn_report("This family of AMD CPU doesn't support "
- "hyperthreading(%d)",
- cs->nr_threads);
- error_printf("Please configure -smp options properly"
- " or try enabling topoext feature.\n");
- ht_warned = true;
+ cs->nr_threads > 1) {
+ warn_report_once("This family of AMD CPU doesn't support "
+ "hyperthreading(%d).", cs->nr_threads);
+ error_report_once("Please configure -smp options properly"
+ " or try enabling topoext feature.");
}
#ifndef CONFIG_USER_ONLY
--
2.34.1
next prev parent reply other threads:[~2024-03-27 10:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-27 10:39 [PATCH 0/3] target/i386/cpu: Misc cleanup for warning message Zhao Liu
2024-03-27 10:39 ` [PATCH 1/3] target/i386/host-cpu: Consolidate the use of warn_report_once() Zhao Liu
2024-03-27 10:39 ` Zhao Liu [this message]
2024-03-27 10:39 ` [PATCH 3/3] target/i386/cpu: Merge the warning and error messages for AMD HT check Zhao Liu
2024-04-17 8:34 ` [PATCH 0/3] target/i386/cpu: Misc cleanup for warning message Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240327103951.3853425-3-zhao1.liu@linux.intel.com \
--to=zhao1.liu@linux.intel.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=zhao1.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).