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

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

 





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

Thanks!! Paul.
Will send out v2 with above changes.

Paul.


--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux