[Xen-devel] xen/arm: make the error log printk ratelimited

Message ID 1459415131-17460-1-git-send-email-zhaoshenglong@huawei.com
State New
Headers show

Commit Message

Shannon Zhao March 31, 2016, 9:05 a.m.
From: Shannon Zhao <shannon.zhao@linaro.org>

To avoid a lot of possible error logs in function map_dev_mmio_region,
make it printk ratelimited.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 xen/arch/arm/p2m.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Patch

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 0011708..be4ab9d 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1284,8 +1284,9 @@  int map_dev_mmio_region(struct domain *d,
     res = map_mmio_regions(d, start_gfn, nr, mfn);
     if ( res < 0 )
     {
-        printk(XENLOG_ERR "Unable to map [%#lx - %#lx] in Dom%d\n",
-               start_gfn, start_gfn + nr - 1, d->domain_id);
+        if ( printk_ratelimit() )
+            printk(XENLOG_ERR "Unable to map [%#lx - %#lx] in Dom%d\n",
+                   start_gfn, start_gfn + nr - 1, d->domain_id);
         return res;
     }