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

[Xen-devel] [RFC PATCH v3 03/18] xen: console: Add ratelimit support for error message



From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>

XENLOG_ERR_RATE_LIMIT and XENLOG_G_ERR_RATE_LIMIT
log levels are added to support rate limit for error messages

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
---
 xen/drivers/char/console.c |   17 +++++++++--------
 xen/include/xen/config.h   |    8 ++++++--
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index fce4cc8..b01fde5 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -92,15 +92,15 @@ static DEFINE_SPINLOCK(console_lock);
  * the lower threshold equal to the upper.
  */
 #ifdef NDEBUG
-#define XENLOG_UPPER_THRESHOLD       2 /* Do not print INFO and DEBUG  */
+#define XENLOG_UPPER_THRESHOLD       3 /* Do not print INFO and DEBUG  */
 #define XENLOG_LOWER_THRESHOLD       2 /* Always print ERR and WARNING */
-#define XENLOG_GUEST_UPPER_THRESHOLD 2 /* Do not print INFO and DEBUG  */
+#define XENLOG_GUEST_UPPER_THRESHOLD 3 /* Do not print INFO and DEBUG  */
 #define XENLOG_GUEST_LOWER_THRESHOLD 0 /* Rate-limit ERR and WARNING   */
 #else
-#define XENLOG_UPPER_THRESHOLD       4 /* Do not discard anything      */
-#define XENLOG_LOWER_THRESHOLD       4 /* Print everything             */
-#define XENLOG_GUEST_UPPER_THRESHOLD 4 /* Do not discard anything      */
-#define XENLOG_GUEST_LOWER_THRESHOLD 4 /* Print everything             */
+#define XENLOG_UPPER_THRESHOLD       5 /* Do not discard anything      */
+#define XENLOG_LOWER_THRESHOLD       5 /* Print everything             */
+#define XENLOG_GUEST_UPPER_THRESHOLD 5 /* Do not discard anything      */
+#define XENLOG_GUEST_LOWER_THRESHOLD 5 /* Print everything             */
 #endif
 /*
  * The XENLOG_DEFAULT is the default given to printks that
@@ -540,7 +540,7 @@ static int printk_prefix_check(char *p, char **pp)
             if ( loglvl == -1 )
                 loglvl = XENLOG_GUEST_DEFAULT;
             break;
-        case '0' ... '3':
+        case '0' ... '4':
             loglvl = p[1] - '0';
             break;
         }
@@ -554,7 +554,8 @@ static int printk_prefix_check(char *p, char **pp)
 
     return ((atomic_read(&print_everything) != 0) ||
             (loglvl < lower_thresh) ||
-            ((loglvl < upper_thresh) && printk_ratelimit()));
+            ((loglvl >= lower_thresh && loglvl < upper_thresh) &&
+             printk_ratelimit()));
 } 
 
 static void __init parse_console_timestamps(char *s)
diff --git a/xen/include/xen/config.h b/xen/include/xen/config.h
index f7258c7..b2ce0fe 100644
--- a/xen/include/xen/config.h
+++ b/xen/include/xen/config.h
@@ -18,6 +18,8 @@
 /*
  * The following log levels are as follows:
  *
+ *   XENLOG_ERR_RATE_LIMIT: Rate limit error message from Xen and Guest
+ *
  *   XENLOG_ERR: Fatal errors, either Xen, Guest or Dom0
  *               is about to crash.
  *
@@ -41,11 +43,13 @@
  */
 #define XENLOG_ERR     "<0>"
 #define XENLOG_WARNING "<1>"
-#define XENLOG_INFO    "<2>"
-#define XENLOG_DEBUG   "<3>"
+#define XENLOG_ERR_RATE_LIMIT  "<2>"
+#define XENLOG_INFO    "<3>"
+#define XENLOG_DEBUG   "<4>"
 
 #define XENLOG_GUEST   "<G>"
 
+#define XENLOG_G_ERR_RATE_LIMIT     XENLOG_GUEST XENLOG_ERR_RATE_LIMIT
 #define XENLOG_G_ERR     XENLOG_GUEST XENLOG_ERR
 #define XENLOG_G_WARNING XENLOG_GUEST XENLOG_WARNING
 #define XENLOG_G_INFO    XENLOG_GUEST XENLOG_INFO
-- 
1.7.9.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.