All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vipin K Parashar <vipin@linux.vnet.ibm.com>
To: Paul Mackerras <paulus@ozlabs.org>
Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: PPC: Book3S: Ratelimit copy data failure error messages
Date: Thu, 16 Feb 2017 16:03:09 +0530	[thread overview]
Message-ID: <56ada2fe-9ed0-2e53-1d6b-ac8571c23ff4@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170216053159.GD19110@fergus.ozlabs.ibm.com>



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 <vipin@linux.vnet.ibm.com>
>> ---
>>   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.
>

WARNING: multiple messages have this Message-ID (diff)
From: Vipin K Parashar <vipin@linux.vnet.ibm.com>
To: Paul Mackerras <paulus@ozlabs.org>
Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: PPC: Book3S: Ratelimit copy data failure error messages
Date: Thu, 16 Feb 2017 10:45:09 +0000	[thread overview]
Message-ID: <56ada2fe-9ed0-2e53-1d6b-ac8571c23ff4@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170216053159.GD19110@fergus.ozlabs.ibm.com>



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 <vipin@linux.vnet.ibm.com>
>> ---
>>   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.
>


  reply	other threads:[~2017-02-16 10:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13 18:56 [PATCH] KVM: PPC: Book3S: Ratelimit copy data failure error messages Vipin K Parashar
2017-02-14  6:12 ` Vipin K Parashar
2017-02-14  6:24   ` Vipin K Parashar
2017-02-16  5:31   ` Paul Mackerras
2017-02-16  5:31     ` Paul Mackerras
2017-02-16 10:33     ` Vipin K Parashar [this message]
2017-02-16 10:45       ` Vipin K Parashar
2017-02-14  6:20 ` Vipin K Parashar
2017-02-23  9:11   ` Vipin K Parashar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56ada2fe-9ed0-2e53-1d6b-ac8571c23ff4@linux.vnet.ibm.com \
    --to=vipin@linux.vnet.ibm.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=paulus@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.