From: Vipin K Parashar Subject: Re: [PATCH] KVM: PPC: Book3S: Ratelimit copy data failure error messages Date: Thu, 16 Feb 2017 16:03:09 +0530 Message-ID: <56ada2fe-9ed0-2e53-1d6b-ac8571c23ff4@linux.vnet.ibm.com> References: <1487012190-19830-1-git-send-email-vipin@linux.vnet.ibm.com> <293fadf7-0d63-91e3-f9f2-5d641269927a@linux.vnet.ibm.com> <20170216053159.GD19110@fergus.ozlabs.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org To: Paul Mackerras Return-path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:47583 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754633AbdBPKeW (ORCPT ); Thu, 16 Feb 2017 05:34:22 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1GAT2PC028569 for ; Thu, 16 Feb 2017 05:34:22 -0500 Received: from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148]) by mx0a-001b2d01.pphosted.com with ESMTP id 28n7mfq5q4-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 16 Feb 2017 05:34:21 -0500 Received: from localhost by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 16 Feb 2017 20:34:18 +1000 In-Reply-To: <20170216053159.GD19110@fergus.ozlabs.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thursday 16 February 2017 11:01 AM, Paul Mackerras wrote: > On Tue, Feb 14, 2017 at 11:42:21AM +0530, Vipin K Parashar wrote: >> kvm_ppc_mmu_book3s_32/64 xlat() log "KVM can't copy data" error >> upon failing to copy user data to kernel space. This floods kernel >> log once such fails occur in short time period. Ratelimit this >> error to avoid flooding kernel logs upon copy data failures. >> >> Signed-off-by: Vipin K Parashar >> --- >> arch/powerpc/kvm/book3s_32_mmu.c | 3 ++- >> arch/powerpc/kvm/book3s_64_mmu.c | 3 ++- >> 2 files changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/arch/powerpc/kvm/book3s_32_mmu.c b/arch/powerpc/kvm/book3s_32_mmu.c >> index a2eb6d3..ca8f960 100644 >> --- a/arch/powerpc/kvm/book3s_32_mmu.c >> +++ b/arch/powerpc/kvm/book3s_32_mmu.c >> @@ -224,7 +224,8 @@ static int kvmppc_mmu_book3s_32_xlate_pte(struct kvm_vcpu *vcpu, gva_t eaddr, >> ptem = kvmppc_mmu_book3s_32_get_ptem(sre, eaddr, primary); >> >> if(copy_from_user(pteg, (void __user *)ptegp, sizeof(pteg))) { >> - printk(KERN_ERR "KVM: Can't copy data from 0x%lx!\n", ptegp); >> + if (printk_ratelimit()) >> + printk(KERN_ERR "KVM: Can't copy data from 0x%lx!\n", ptegp); > I found this in include/linux/printk.h: > > /* > * Please don't use printk_ratelimit(), because it shares ratelimiting state > * with all other unrelated printk_ratelimit() callsites. Instead use > * printk_ratelimited() or plain old __ratelimit(). > */ > > It does seem that using printk_ratelimited(KERN_ERR ...) or the > equivalent pr_err_ratelimited(...) would be a better option. Thanks!! Paul. Will send out v2 with above changes. > Paul. >