KVM: PPC: Book3S PR: Ratelimit copy data failure error messages
authorVipin K Parashar <vipin@linux.vnet.ibm.com>
Thu, 16 Feb 2017 17:10:26 +0000 (22:40 +0530)
committerPaul Mackerras <paulus@ozlabs.org>
Fri, 17 Feb 2017 03:03:35 +0000 (14:03 +1100)
kvm_ppc_mmu_book3s_32/64 xlat() logs "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>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
arch/powerpc/kvm/book3s_32_mmu.c
arch/powerpc/kvm/book3s_64_mmu.c

index a2eb6d354a57d093c3e46c3f038771176261c38c..1992676c7a9479f00fe9717b7ff16aeb5204ae8b 100644 (file)
@@ -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);
+               printk_ratelimited(KERN_ERR
+                       "KVM: Can't copy data from 0x%lx!\n", ptegp);
                goto no_page_found;
        }
 
index b9131aa1aedf0d9430a80867582f19aa2dc941f0..70153578131a047593185152b4be4bd4276d99d1 100644 (file)
@@ -265,7 +265,8 @@ do_second:
                goto no_page_found;
 
        if(copy_from_user(pteg, (void __user *)ptegp, sizeof(pteg))) {
-               printk(KERN_ERR "KVM can't copy data from 0x%lx!\n", ptegp);
+               printk_ratelimited(KERN_ERR
+                       "KVM: Can't copy data from 0x%lx!\n", ptegp);
                goto no_page_found;
        }