v2 for this patch with 'printk_ratelimit' replaced with

'printk_ratelimited' is available at mailing list.


https://patchwork.ozlabs.org/patch/728831/



On Tuesday 14 February 2017 11:50 AM, Vipin K Parashar wrote:
Forwarded same patch to k...@vger.kernel.org

and kvm-...@vger.kernel.org too.


On Tuesday 14 February 2017 12:26 AM, 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 <vi...@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);
          goto no_page_found;
      }

diff --git a/arch/powerpc/kvm/book3s_64_mmu.c b/arch/powerpc/kvm/book3s_64_mmu.c
index b9131aa..b420aca 100644
--- a/arch/powerpc/kvm/book3s_64_mmu.c
+++ b/arch/powerpc/kvm/book3s_64_mmu.c
@@ -265,7 +265,8 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
          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);
+        if (printk_ratelimit())
+ printk(KERN_ERR "KVM can't copy data from 0x%lx!\n", ptegp);
          goto no_page_found;
      }



Reply via email to