summaryrefslogtreecommitdiff
path: root/arch/x86/kvm/trace.h
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2022-05-02 00:07:32 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2022-06-08 04:46:58 -0400
commit21d4c575eb4a1e6d956b61b5e9c162895fa7d4ba (patch)
treef03336160ac0dc0243a9b69b8e9cca08f82656ca /arch/x86/kvm/trace.h
parenta61d7c5432ac5a953bbcec17af031661c2bd201d (diff)
KVM: x86: Print error code in exception injection tracepoint iff valid
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@google.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com> Message-Id: <e8f0511733ed2a0410cbee8a0a7388eac2ee5bac.1651440202.git.maciej.szmigiero@oracle.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/trace.h')
-rw-r--r--arch/x86/kvm/trace.h7
1 files 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]" : "")
);