diff mbox series

[V2] KVM: SVM: Only dump VSMA to klog for debugging

Message ID 20221104142220.469452-1-pgonda@google.com (mailing list archive)
State New, archived
Headers show
Series [V2] KVM: SVM: Only dump VSMA to klog for debugging | expand

Commit Message

Peter Gonda Nov. 4, 2022, 2:22 p.m. UTC
Explicitly print the VMSA dump at KERN_DEBUG log level, KERN_CONT uses
KERNEL_DEFAULT if the previous log line has a newline, i.e. if there's
nothing to continuing, and as a result the VMSA gets dumped when it
shouldn't.

The KERN_CONT documentation says it defaults back to KERNL_DEFAULT if the
previous log line has a newline. So switch from KERN_CONT to
print_hex_dump_debug().

Jarkko pointed this out in reference to the original patch. See:
https://lore.kernel.org/all/YuPMeWX4uuR1Tz3M@kernel.org/
print_hex_dump(KERN_DEBUG, ...) was pointed out there, but
print_hex_dump_debug() should similar.

Fixes: 6fac42f127b8 ("KVM: SVM: Dump Virtual Machine Save Area (VMSA) to klog")
Signed-off-by: Peter Gonda <pgonda@google.com>
Reviewed-by: Sean Christopherson <seanjc@google.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Harald Hoyer <harald@profian.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
---
 arch/x86/kvm/svm/sev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jarkko Sakkinen Nov. 7, 2022, 3:47 p.m. UTC | #1
On Fri, Nov 04, 2022 at 07:22:20AM -0700, Peter Gonda wrote:
> Explicitly print the VMSA dump at KERN_DEBUG log level, KERN_CONT uses
> KERNEL_DEFAULT if the previous log line has a newline, i.e. if there's
> nothing to continuing, and as a result the VMSA gets dumped when it
> shouldn't.
> 
> The KERN_CONT documentation says it defaults back to KERNL_DEFAULT if the
> previous log line has a newline. So switch from KERN_CONT to
> print_hex_dump_debug().
> 
> Jarkko pointed this out in reference to the original patch. See:
> https://lore.kernel.org/all/YuPMeWX4uuR1Tz3M@kernel.org/
> print_hex_dump(KERN_DEBUG, ...) was pointed out there, but
> print_hex_dump_debug() should similar.
> 
> Fixes: 6fac42f127b8 ("KVM: SVM: Dump Virtual Machine Save Area (VMSA) to klog")
> Signed-off-by: Peter Gonda <pgonda@google.com>
> Reviewed-by: Sean Christopherson <seanjc@google.com>
> Cc: Jarkko Sakkinen <jarkko@kernel.org>
> Cc: Harald Hoyer <harald@profian.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: x86@kernel.org
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: kvm@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: stable@vger.kernel.org
> ---
>  arch/x86/kvm/svm/sev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index c0c9ed5e279cb..9b8db157cf773 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -605,7 +605,7 @@ static int sev_es_sync_vmsa(struct vcpu_svm *svm)
>  	save->dr6  = svm->vcpu.arch.dr6;
>  
>  	pr_debug("Virtual Machine Save Area (VMSA):\n");
> -	print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, save, sizeof(*save), false);
> +	print_hex_dump_debug("", DUMP_PREFIX_NONE, 16, 1, save, sizeof(*save), false);
>  
>  	return 0;
>  }
> -- 
> 2.38.1.431.g37b22c650d-goog
> 

OK, this was my careless mistake, sorry about that:


Acked-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko
Paolo Bonzini Nov. 7, 2022, 5:18 p.m. UTC | #2
On 11/4/22 15:22, Peter Gonda wrote:
> Explicitly print the VMSA dump at KERN_DEBUG log level, KERN_CONT uses
> KERNEL_DEFAULT if the previous log line has a newline, i.e. if there's
> nothing to continuing, and as a result the VMSA gets dumped when it
> shouldn't.
> 
> The KERN_CONT documentation says it defaults back to KERNL_DEFAULT if the
> previous log line has a newline. So switch from KERN_CONT to
> print_hex_dump_debug().
> 
> Jarkko pointed this out in reference to the original patch. See:
> https://lore.kernel.org/all/YuPMeWX4uuR1Tz3M@kernel.org/
> print_hex_dump(KERN_DEBUG, ...) was pointed out there, but
> print_hex_dump_debug() should similar.
> 
> Fixes: 6fac42f127b8 ("KVM: SVM: Dump Virtual Machine Save Area (VMSA) to klog")
> Signed-off-by: Peter Gonda <pgonda@google.com>
> Reviewed-by: Sean Christopherson <seanjc@google.com>
> Cc: Jarkko Sakkinen <jarkko@kernel.org>
> Cc: Harald Hoyer <harald@profian.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: x86@kernel.org
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: kvm@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: stable@vger.kernel.org
> ---
>   arch/x86/kvm/svm/sev.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index c0c9ed5e279cb..9b8db157cf773 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -605,7 +605,7 @@ static int sev_es_sync_vmsa(struct vcpu_svm *svm)
>   	save->dr6  = svm->vcpu.arch.dr6;
>   
>   	pr_debug("Virtual Machine Save Area (VMSA):\n");
> -	print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, save, sizeof(*save), false);
> +	print_hex_dump_debug("", DUMP_PREFIX_NONE, 16, 1, save, sizeof(*save), false);
>   
>   	return 0;
>   }

Queued, thanks.

Paolo
diff mbox series

Patch

diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index c0c9ed5e279cb..9b8db157cf773 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -605,7 +605,7 @@  static int sev_es_sync_vmsa(struct vcpu_svm *svm)
 	save->dr6  = svm->vcpu.arch.dr6;
 
 	pr_debug("Virtual Machine Save Area (VMSA):\n");
-	print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, save, sizeof(*save), false);
+	print_hex_dump_debug("", DUMP_PREFIX_NONE, 16, 1, save, sizeof(*save), false);
 
 	return 0;
 }