From patchwork Tue Jul 19 20:24:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bandan Das X-Patchwork-Id: 9238277 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 65101600CB for ; Tue, 19 Jul 2016 20:25:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54DFA27569 for ; Tue, 19 Jul 2016 20:25:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4665C26D19; Tue, 19 Jul 2016 20:25:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 912FE26D19 for ; Tue, 19 Jul 2016 20:25:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751840AbcGSUYe (ORCPT ); Tue, 19 Jul 2016 16:24:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43468 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751803AbcGSUYd (ORCPT ); Tue, 19 Jul 2016 16:24:33 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 929CD85547; Tue, 19 Jul 2016 20:24:32 +0000 (UTC) Received: from gigantic.usersys.redhat.com (dhcp-17-169.bos.redhat.com [10.18.17.169]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6JKOVVd025044 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 19 Jul 2016 16:24:31 -0400 From: Bandan Das To: Dave Jones Cc: Paolo Bonzini , Linux Kernel , Radim =?utf-8?B?S3LEjW3DocWZ?= , kvm@vger.kernel.org Subject: Re: RFC: silencing kvm unimplemented msr spew. References: <20160715192729.GA4712@fb.com> <110045299.8101686.1468855610053.JavaMail.zimbra@redhat.com> <20160719195856.GA31453@fb.com> Date: Tue, 19 Jul 2016 16:24:31 -0400 In-Reply-To: <20160719195856.GA31453@fb.com> (Dave Jones's message of "Tue, 19 Jul 2016 15:58:56 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 19 Jul 2016 20:24:32 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Dave Jones writes: > On Mon, Jul 18, 2016 at 11:26:50AM -0400, Paolo Bonzini wrote: > > > > > kvm is pretty noisy when you have guests poking at MSRs that the kernel > > > doesn't implement. The conveniently named 'ignore_msrs' option initially > > > seemed > > > like it was what I was looking for, but it changes the printk instead > > > of eliding it. > > > > > > Untested patch below converts ignore_msrs to a bitmask and adds an option to > > > be > > > completely silent. The idea being if after testing, things still work and you > > > don't care about those messages, you can deploy in production with the > > > silence option. > > > > > > Would something like this be acceptable ? > > > > Indeed, ignore_msrs does a completely different thing. It suppresses > > general protection faults in the guest. It is related to behavior that > > KVM injects in the guests, not to the things that KVM spews in the host. > > > > What about just downgrading the printf to KERN_DEBUG? You could simply > > change from vcpu_unimpl to vcpu_debug, but it's probably a good idea to > > keep the ratelimiting; there's a kvm_pr_unimpl, so maybe add a new > > kvm_pr_debug and vcpu_pr_debug. > > Hm, we've certainly got a lot of options in terms of print primitives these days. > > We could just do this... Heh, actually after speaking about this to Paolo a while back, I had this sleeping in my local branch for a while. Same as what you suggested (without the ratelimiting) I had the same reasoning regarding dynamic debugging which I think is enabled by default on most builds anyway. Bandan > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > index 1c9c973a7dd9..a80b9a0a5f8c 100644 > --- a/include/linux/kvm_host.h > +++ b/include/linux/kvm_host.h > @@ -423,7 +423,7 @@ struct kvm { > #define kvm_debug(fmt, ...) \ > pr_debug("kvm [%i]: " fmt, task_pid_nr(current), ## __VA_ARGS__) > #define kvm_pr_unimpl(fmt, ...) \ > - pr_err_ratelimited("kvm [%i]: " fmt, \ > + pr_debug_ratelimited("kvm [%i]: " fmt, \ > task_tgid_nr(current), ## __VA_ARGS__) > > /* The guest did something we don't support. */ > > > Which I think would have the desired effect, and also gets us dynamic debug > support for free. > > Thoughts ? > > Dave > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index def97b3..c6e6f64 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -4952,7 +4952,7 @@ void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm, struct kvm_memslots *slots) * zap all shadow pages. */ if (unlikely((slots->generation & MMIO_GEN_MASK) == 0)) { - printk_ratelimited(KERN_DEBUG "kvm: zapping shadow pages for mmio generation wraparound\n"); + kvm_debug("zapping shadow pages for mmio generation wraparound\n"); kvm_mmu_invalidate_zap_all_pages(kvm); } } diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 7da5dd2..02d09f9 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -2229,7 +2229,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) if (kvm_pmu_is_valid_msr(vcpu, msr)) return kvm_pmu_set_msr(vcpu, msr_info); if (!ignore_msrs) { - vcpu_unimpl(vcpu, "unhandled wrmsr: 0x%x data %llx\n", + vcpu_debug(vcpu, "unhandled wrmsr: 0x%x data %llx\n", msr, data); return 1; } else { @@ -2441,7 +2441,7 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) if (kvm_pmu_is_valid_msr(vcpu, msr_info->index)) return kvm_pmu_get_msr(vcpu, msr_info->index, &msr_info->data); if (!ignore_msrs) { - vcpu_unimpl(vcpu, "unhandled rdmsr: 0x%x\n", msr_info->index); + vcpu_debug(vcpu, "unhandled rdmsr: 0x%x\n", msr_info->index); return 1; } else { vcpu_unimpl(vcpu, "ignored rdmsr: 0x%x\n", msr_info->index);