Message ID | 20221103210421.359837-1-pgonda@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a40e:b0:83:7221:86ba with SMTP id ck14csp1114261dyb; Thu, 3 Nov 2022 14:13:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6bh5jMKNZ56j7MWFsEYlA/jEEl2ThzP8VPFitNad3dvenOdg1Co7FV2oso7/euksgW4rSX X-Received: by 2002:a05:6402:2a03:b0:463:11e7:cd5f with SMTP id ey3-20020a0564022a0300b0046311e7cd5fmr28761376edb.274.1667509986108; Thu, 03 Nov 2022 14:13:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667509986; cv=none; d=google.com; s=arc-20160816; b=TOUc+GCv8vORXmcGT3/dvPSz+UA3AUgd/Ep6v9CpBUnS7ZjqmIdkKrlPGNNfa4iQ9d Tm+4XjkJoK6jcWfrtvnKsR5+8CSlyTqikgb9DauFLG28jUeDzAAgiQ/DOKKnbxxswFkr jQQjxpwXkXORgQCGaumXOKG0lcBqhh2rayzbsvbr+nbGdH+vFmwly45t4OGLgLYCUBTj AxWRv5cLJkVCwIxx7g4zG/Je01AxHe4miyQD6ddDnXk5hffbzG3ARsuGtKzPOp8CmIOk azyU2bpif8KnBWMx2FELinkZaGvKaoxWV0GpiPQqADl67yBoNBA+By50ueEZRnLN4kke 8Law== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=1MqUUYTBqZBuLSU6Stq6+emUDWkFLI+9b+J7NXsYFdg=; b=ob9VrPBrNy2/z6mHCkW9pxLf9f1BU80lkvpWEeJkVeALKoIfZRoKg0ZnON5rE5yrMF 77tWRbEiG1KKIrhVzLWmaX8CFDwJI6Hry1UpjTC/Jki+/MfDuy4y4CCcSHmwQi0L/ie8 sXYqiEQ1YYgl63lxvU0sSj9ggBPGUVToF6UFUAey1jYPo7apgZComgLcV5yI28XD++RO bxHa4HidftDQsP2s6RTikUa75cTSqOvX5fzZsY5Qlrg0sVUwcCkKr3vdtYwRXcENIq99 Bo/ygu2KzPxi67YhRi42Z6woRUJxzSwLPD/l+/EX54FlDarLWQUYg+H3IT8P9fie/0l0 k1fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=M75acoPP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o21-20020a170906975500b00772fe97b31esi2725701ejy.901.2022.11.03.14.12.16; Thu, 03 Nov 2022 14:13:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=M75acoPP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230258AbiKCVEd (ORCPT <rfc822;yves.mi.zy@gmail.com> + 99 others); Thu, 3 Nov 2022 17:04:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231406AbiKCVE1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 3 Nov 2022 17:04:27 -0400 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07B0F6475 for <linux-kernel@vger.kernel.org>; Thu, 3 Nov 2022 14:04:25 -0700 (PDT) Received: by mail-pl1-x649.google.com with SMTP id e13-20020a17090301cd00b001871e6f8714so2028761plh.14 for <linux-kernel@vger.kernel.org>; Thu, 03 Nov 2022 14:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=1MqUUYTBqZBuLSU6Stq6+emUDWkFLI+9b+J7NXsYFdg=; b=M75acoPPp8sxUkaoycxX9GC5fTgwvRvyoYqiAaCc8zdoEcqEcIyRy8QsFv0nmD6c5c Y5oOMdtaC5bcq0dP7PeKtfxaQm9xK2ST+/pWQA6NCEQoJ2XWbffTRR9kdJZLHq4iZ4WX +YToRzOLZ55t2I7mDYu0Ths/zoFcNKwnmuh/tlB9n8w5BRkBrExwS3Z6FEETINHROuwz iUHMEeFgR2cwGtd5YeSEyqZTq8p9KpDOvqc0OZYk+rZLg593zS4ekA45q1K9S++z6Ezb Xn9nkpyr4Dtx/NG9goxj/hSJdpr0hOINoKqTcQiGX0wOkIwaXrRO5v0A5iDzo5DA2Tr8 DNlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=1MqUUYTBqZBuLSU6Stq6+emUDWkFLI+9b+J7NXsYFdg=; b=ukUf+v4hYsQ/CRTJWRxoX0MrybDgcr0BZ8Wmv6ylQSMvagZgrdb1v1+4W4JUH0yRw3 yaiGdjnZ+GJXwUqF1AhGqQ2gE90/J2SMMt+RGMxndH9FBDF6vTMZx9rmGMeD5n2ntSB3 wLq8bTUBJxN3CqQ6N4uvtEaKR4YsnOuyaYqn2PC9UPvvKkqKbg8Dn+HeYv+Aoyvt3L2h wlg2Epx3felMDBMudPJucphi65RSwgKqQK5npzrA6Sn8JO4BDUlH/5/b8OvxwxfQzopY rZ1eg5WSLNY7aYI/7NDiIU65BFqxNSW0SVBtuz3C8jU+brcCozGg/ZQw+fzPrb5S/Y5r ZXcA== X-Gm-Message-State: ACrzQf1Q/b1my1WHOryqCtVcsqRRoDDR//ypZnx9g+DEiZB+XMZzUlLJ JvKyoqbQW73H1Y+SB42jp19NBvlJ+Ns= X-Received: from pgonda1.kir.corp.google.com ([2620:0:1008:11:45e5:86a8:76c:1f1c]) (user=pgonda job=sendgmr) by 2002:a63:5d12:0:b0:46e:cd38:3f76 with SMTP id r18-20020a635d12000000b0046ecd383f76mr26972646pgb.64.1667509464485; Thu, 03 Nov 2022 14:04:24 -0700 (PDT) Date: Thu, 3 Nov 2022 14:04:21 -0700 Message-Id: <20221103210421.359837-1-pgonda@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Subject: [PATCH] KVM: SVM: Only dump VSMA to klog for debugging From: Peter Gonda <pgonda@google.com> To: jarkko@kernel.org Cc: Peter Gonda <pgonda@google.com>, Harald Hoyer <harald@profian.com>, Paolo Bonzini <pbonzini@redhat.com>, Sean Christopherson <seanjc@google.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748510950926984096?= X-GMAIL-MSGID: =?utf-8?q?1748510950926984096?= |
Series |
KVM: SVM: Only dump VSMA to klog for debugging
|
|
Commit Message
Peter Gonda
Nov. 3, 2022, 9:04 p.m. UTC
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(-)
Comments
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>
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.
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; }