All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: SVM: Only dump VSMA to klog for debugging
@ 2022-11-03 21:04 Peter Gonda
  2022-11-03 22:25 ` Sean Christopherson
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Gonda @ 2022-11-03 21:04 UTC (permalink / raw)
  To: jarkko
  Cc: Peter Gonda, Harald Hoyer, Paolo Bonzini, Sean Christopherson,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, kvm, linux-kernel

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().

Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Harald Hoyer <harald@profian.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.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
Signed-off-by: Peter Gonda <pgonda@google.com>

Fixes: 6fac42f127b8 ("KVM: SVM: Dump Virtual Machine Save Area (VMSA) to klog")
---

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(-)

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: SVM: Only dump VSMA to klog for debugging
  2022-11-03 21:04 [PATCH] KVM: SVM: Only dump VSMA to klog for debugging Peter Gonda
@ 2022-11-03 22:25 ` Sean Christopherson
  2022-11-04 14:23   ` Peter Gonda
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Christopherson @ 2022-11-03 22:25 UTC (permalink / raw)
  To: Peter Gonda
  Cc: jarkko, Harald Hoyer, Paolo Bonzini, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
	kvm, linux-kernel

On Thu, Nov 03, 2022, Peter Gonda wrote:
> The KERN_CONT documentation says it defaults back to KERNL_DEFAULT if 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.

> previous log line has a newline. So switch from KERN_CONT to
> print_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.

  Link: https://lore.kernel.org/all/YuPMeWX4uuR1Tz3M@kernel.org

> Cc: Jarkko Sakkinen <jarkko@kernel.org>
> Cc: Harald Hoyer <harald@profian.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Sean Christopherson <seanjc@google.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
> Signed-off-by: Peter Gonda <pgonda@google.com>
> 
> 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 <seanjc@google.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: SVM: Only dump VSMA to klog for debugging
  2022-11-03 22:25 ` Sean Christopherson
@ 2022-11-04 14:23   ` Peter Gonda
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Gonda @ 2022-11-04 14:23 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: jarkko, Harald Hoyer, Paolo Bonzini, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
	kvm, linux-kernel

On Thu, Nov 3, 2022 at 4:25 PM Sean Christopherson <seanjc@google.com> wrote:
>
> On Thu, Nov 03, 2022, Peter Gonda wrote:
> > The KERN_CONT documentation says it defaults back to KERNL_DEFAULT if 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.
>
> > previous log line has a newline. So switch from KERN_CONT to
> > print_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.
>
>   Link: https://lore.kernel.org/all/YuPMeWX4uuR1Tz3M@kernel.org

Thanks. I've expanded on the description based on your feedback.

>
> > Cc: Jarkko Sakkinen <jarkko@kernel.org>
> > Cc: Harald Hoyer <harald@profian.com>
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Cc: Sean Christopherson <seanjc@google.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
> > Signed-off-by: Peter Gonda <pgonda@google.com>
> >
> > 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 <seanjc@google.com>

Done. Sent a V2 with your review tag.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-04 14:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-03 21:04 [PATCH] KVM: SVM: Only dump VSMA to klog for debugging Peter Gonda
2022-11-03 22:25 ` Sean Christopherson
2022-11-04 14:23   ` Peter Gonda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.