Re: [PATCH] KVM: PPC: Book3S: Ratelimit copy data failure error messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
> ---
>  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.

Paul.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux