Message ID | 20240412073346.458116-28-richard.henderson@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | misc: Replace sprintf | expand |
On 12/4/24 09:33, Richard Henderson wrote: > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- > target/i386/kvm/kvm.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
On Fri, 12 Apr 2024 at 08:37, Richard Henderson <richard.henderson@linaro.org> wrote: > > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- > target/i386/kvm/kvm.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c > index e68cbe9293..1fc809b2f9 100644 > --- a/target/i386/kvm/kvm.c > +++ b/target/i386/kvm/kvm.c > @@ -5275,7 +5275,6 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) > uint64_t code; > int ret; > bool ctx_invalid; > - char str[256]; > KVMState *state; > > switch (run->exit_reason) { > @@ -5335,15 +5334,16 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) > case KVM_EXIT_NOTIFY: > ctx_invalid = !!(run->notify.flags & KVM_NOTIFY_CONTEXT_INVALID); > state = KVM_STATE(current_accel()); > - sprintf(str, "Encounter a notify exit with %svalid context in" > - " guest. There can be possible misbehaves in guest." > - " Please have a look.", ctx_invalid ? "in" : ""); > if (ctx_invalid || > state->notify_vmexit == NOTIFY_VMEXIT_OPTION_INTERNAL_ERROR) { > - warn_report("KVM internal error: %s", str); > + warn_report("KVM internal error: Encountered a notify exit " > + "with invalid context in guest."); > ret = -1; > } else { > - warn_report_once("KVM: %s", str); > + warn_report_once("KVM: Encounterd a notify exit with valid " "Encountered" > + "context in guest. " > + "The guest could be misbehaving. " > + "Please have a look."); "Please have a look" is a bit more chatty than we usually are in warning messages... thanks -- PMM
On Fri, Apr 12, 2024 at 12:33:46AM -0700, Richard Henderson wrote: > Date: Fri, 12 Apr 2024 00:33:46 -0700 > From: Richard Henderson <richard.henderson@linaro.org> > Subject: [PATCH v3 27/27] target/i386/kvm: Improve KVM_EXIT_NOTIFY warnings > X-Mailer: git-send-email 2.34.1 > > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- > target/i386/kvm/kvm.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index e68cbe9293..1fc809b2f9 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -5275,7 +5275,6 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) uint64_t code; int ret; bool ctx_invalid; - char str[256]; KVMState *state; switch (run->exit_reason) { @@ -5335,15 +5334,16 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) case KVM_EXIT_NOTIFY: ctx_invalid = !!(run->notify.flags & KVM_NOTIFY_CONTEXT_INVALID); state = KVM_STATE(current_accel()); - sprintf(str, "Encounter a notify exit with %svalid context in" - " guest. There can be possible misbehaves in guest." - " Please have a look.", ctx_invalid ? "in" : ""); if (ctx_invalid || state->notify_vmexit == NOTIFY_VMEXIT_OPTION_INTERNAL_ERROR) { - warn_report("KVM internal error: %s", str); + warn_report("KVM internal error: Encountered a notify exit " + "with invalid context in guest."); ret = -1; } else { - warn_report_once("KVM: %s", str); + warn_report_once("KVM: Encounterd a notify exit with valid " + "context in guest. " + "The guest could be misbehaving. " + "Please have a look."); ret = 0; } break;
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- target/i386/kvm/kvm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)