[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <79a0c1205b646ead0b2128147cb7df4198646b99.camel@redhat.com>
Date: Thu, 28 Apr 2022 12:49:44 +0300
From: Maxim Levitsky <mlevitsk@...hat.com>
To: Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>
Cc: Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org,
"Maciej S . Szmigiero" <maciej.szmigiero@...cle.com>
Subject: Re: [PATCH v2 08/11] KVM: x86: Print error code in exception
injection tracepoint iff valid
On Sat, 2022-04-23 at 02:14 +0000, Sean Christopherson wrote:
> Print the error code in the exception injection tracepoint if and only if
> the exception has an error code. Define the entire error code sequence
> as a set of formatted strings, print empty strings if there's no error
> code, and abuse __print_symbolic() by passing it an empty array to coerce
> it into printing the error code as a hex string.
>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
> ---
> arch/x86/kvm/trace.h | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
> index d07428e660e3..385436d12024 100644
> --- a/arch/x86/kvm/trace.h
> +++ b/arch/x86/kvm/trace.h
> @@ -376,10 +376,11 @@ TRACE_EVENT(kvm_inj_exception,
> __entry->reinjected = reinjected;
> ),
>
> - TP_printk("%s (0x%x)%s",
> + TP_printk("%s%s%s%s%s",
> __print_symbolic(__entry->exception, kvm_trace_sym_exc),
> - /* FIXME: don't print error_code if not present */
> - __entry->has_error ? __entry->error_code : 0,
> + !__entry->has_error ? "" : " (",
> + !__entry->has_error ? "" : __print_symbolic(__entry->error_code, { }),
> + !__entry->has_error ? "" : ")",
> __entry->reinjected ? " [reinjected]" : "")
> );
>
Reviewed-by: Maxim Levitsky <mlevitsk@...hat.com>
Good idea to do it in few more places, I'll keep that in mind.
Best regards,
Maxim Levitsky
Powered by blists - more mailing lists