KVM: SVM: Only dump VSMA to klog for debugging
PATCH 1/1 KVM: SVM: Only dump VSMA to klog for debugging
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().
---
Tested before without DEBUG or CONFIG_DYNAMIC_DEBUG I would see the VMSA raw hex bytes spew on dmesg. After change no such spew.
--- arch/x86/kvm/svm/sev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/svm/sev.c +1 -1
@@ -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 ; }
Signature · 1 line
2.38.1.431.g37b22c650d-goog
Quoted 1 line · Peter Gonda
The
KERN_CONTdocumentation says it defaults back toKERNL_DEFAULTif the
State what actually happens. Documentation is sometimes wrong, and just saying "the docs say XYZ" makes it sound like this is a fix based on code inspection, whereas you encountered a real problem. E.g.
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.
Quoted 2 lines
previous log line has a newline. So switch from
KERN_CONTtoprint_hex_dump_debug().
Jarkko pointed this out in the original submission, but the buggy patch got queued without the fixup. This is a good opportunity to throw in a link so that it's clear that the change is aligned with the original intent.
Quoted 14 lines
Cc Jarkko Sakkinen <[email protected]>Cc Harald Hoyer <[email protected]>Cc Paolo Bonzini <[email protected]>Cc Sean Christopherson <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc Borislav Petkov <[email protected]>Cc Dave Hansen <[email protected]>Cc "H. Peter Anvin" <[email protected]>Signed-off-by Peter Gonda <[email protected]>
Quoted 1 line
Fixes 6fac42f127b8 ("KVM: SVM: Dump Virtual Machine Save Area (VMSA) to klog")
Fixes: usually goes before everything else, and this should probably Cc stable@ as well.
With the above tweaks,
Quoted 13 lines · Sean Christopherson
Quoted 1 line · Peter Gonda
The
KERN_CONTdocumentation says it defaults back toKERNL_DEFAULTif theState what actually happens. Documentation is sometimes wrong, and just saying "the docs say XYZ" makes it sound like this is a fix based on code inspection, whereas you encountered a real problem. E.g.
Explicitly print the VMSA dump at
KERN_DEBUGlog level,KERN_CONTusesKERNEL_DEFAULTif 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.
Quoted 8 lines
Quoted 2 lines
previous log line has a newline. So switch from
KERN_CONTtoprint_hex_dump_debug().Jarkko pointed this out in the original submission, but the buggy patch got queued without the fixup. This is a good opportunity to throw in a link so that it's clear that the change is aligned with the original intent.
Thanks. I've expanded on the description based on your feedback.
Quoted 15 lines
Quoted 15 lines
Cc Jarkko Sakkinen <[email protected]>Cc Harald Hoyer <[email protected]>Cc Paolo Bonzini <[email protected]>Cc Sean Christopherson <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc Borislav Petkov <[email protected]>Cc Dave Hansen <[email protected]>Cc "H. Peter Anvin" <[email protected]>Signed-off-by Peter Gonda <[email protected]>
Quoted 8 lines
Quoted 1 line
Fixes 6fac42f127b8 ("KVM: SVM: Dump Virtual Machine Save Area (VMSA) to klog")Fixes: usually goes before everything else, and this should probably Cc stable@ as well.
With the above tweaks,
Reviewed-by Sean Christopherson <[email protected]>
Done. Sent a V2 with your review tag.