Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1829449ybi; Wed, 17 Jul 2019 22:46:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDOl0rtFY1DUyLerDT9Syx5+F5Np4gpk+HdNapN5NWpJMnhdZ+hpZVdNWisgV3g/nivJPn X-Received: by 2002:a17:90a:32c7:: with SMTP id l65mr49120516pjb.1.1563428759992; Wed, 17 Jul 2019 22:45:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563428759; cv=none; d=google.com; s=arc-20160816; b=kD6yBKxOJF7FoCa/ad5YmJWcE16PsALlcsi6XRD3l/XxXi9cMYpYuwaEkiCIf89+Rt nClLKKXUWhxoDl5B2RA7xZZqOVnWdojDonERshaNCyPuKIOSkO1/ltwSsnEeW00+yg2u c664FEItpPG+AlQTSC0a8EcLYMNGM99Y9BiNq7wxXwSJhSKQRN2krtXL6u8pYF52OZ6M UfDtMFd+VXSVV2p/0cFKlIyf+bwWEJJg/vD9b11lVKKG/2P1zsHrOmyBxHinQnW0hxZ9 XOJ/5r9rhPM/GVk68s6M+/tRj2Cl1elkOA5ZvTAz+rplIl83ztape4VMeP39766Zk4Zi mghQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=KCSuVyICyHGVOt3WArKR6jFR0iD8+yG4v5g294Hjy2k=; b=inuPDfyDtEM3vRvbIVcqyIvvPfEe/wbziFjPmez0QmuQV/TaedPSb1HR3TO0HSYfan dH0cwjJsfTrcOvV1RK5ft9sgXwJkZDT9cXGmY0DR27xg9GOzQt5qW9x2raIgovIFAhBB 8mSR64NLRhQ0gujDhjcbSbd6qmQ6Y9yeKiK2rNqzcaMszBtnoZ6EczybwzxTQRC+WSu/ MhumgVCHwn4hdnhDtungynVvBE17cuxXcCbMq2QvL8VbYc9rgAegU+ymJ9+fojSEO0S5 Npr4qL/QkqBg2i8NkD23f3es0dftdgrpDasiuEjULVtbKdrulpS02xo48E+qwaVB1pv4 75MA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 21si22467pgh.148.2019.07.17.22.45.43; Wed, 17 Jul 2019 22:45:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727851AbfGRFpW (ORCPT + 99 others); Thu, 18 Jul 2019 01:45:22 -0400 Received: from mga02.intel.com ([134.134.136.20]:11144 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725959AbfGRFpW (ORCPT ); Thu, 18 Jul 2019 01:45:22 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2019 22:45:21 -0700 X-IronPort-AV: E=Sophos;i="5.64,276,1559545200"; d="scan'208";a="161970970" Received: from likexu-mobl1.ccr.corp.intel.com (HELO [10.239.196.90]) ([10.239.196.90]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/AES256-SHA; 17 Jul 2019 22:45:20 -0700 Subject: Re: [PATCH] KVM: x86/vPMU: refine kvm_pmu err msg when event creation failed To: Joe Perches , Paolo Bonzini , Avi Kivity Cc: kvm@vger.kernel.org, Gleb Natapov , like.xu@linux.inetl.com, linux-kernel@vger.kernel.org References: <20190718044914.35631-1-like.xu@linux.intel.com> <9eda0e29f524275a217411ea81352271b782baa4.camel@perches.com> From: Like Xu Organization: Intel OTC Message-ID: <1f865724-999d-89a7-c246-acfe9cb08d54@linux.intel.com> Date: Thu, 18 Jul 2019 13:45:18 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <9eda0e29f524275a217411ea81352271b782baa4.camel@perches.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Joe, On 2019/7/18 13:18, Joe Perches wrote: > On Thu, 2019-07-18 at 12:49 +0800, Like Xu wrote: >> If a perf_event creation fails due to any reason of the host perf >> subsystem, it has no chance to log the corresponding event for guest >> which may cause abnormal sampling data in guest result. In debug mode, >> this message helps to understand the state of vPMC and we should not >> limit the number of occurrences. > [] >> diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c > [] >> @@ -131,8 +131,8 @@ static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type, >> intr ? kvm_perf_overflow_intr : >> kvm_perf_overflow, pmc); >> if (IS_ERR(event)) { >> - printk_once("kvm_pmu: event creation failed %ld\n", >> - PTR_ERR(event)); >> + pr_debug("kvm_pmu: event creation failed %ld\n for pmc->idx = %d", >> + PTR_ERR(event), pmc->idx); > > Perhaps this was written as printk_once to avoid > spamming the log with repeated messages. The spamming case in practice from this messages is very rare but it's logically possible. > > Maybe this should use pr_debug_ratelimited. > (and it should also have a \n termination like:) Thanks and it's my mistake, agree on '\n' usage. > > pr_debug_ratelimited("kvm_pmu: event creation failed %ld for pmc->idx = %d\n", > PTR_ERR(event), pmc->idx); > > Perhaps Avi Kivity remembers why he wrote it this way. > https://lore.kernel.org/kvm/1305129333-7456-6-git-send-email-avi@redhat.com >> >