input to DOM0 when it boots --- if it is `x' then auto-switching is
disabled. Any other value, or omitting the character, enables
auto-switching. [NB. Default switch-char is `a'.]
+\item [ loglvl=$<$level$>/<$level$>$ ]
+ Specify logging level. Messages of the specified severity level (and
+ higher) will be printed to the Xen console. Valid levels are `none',
+ `error', `warning', `info', `debug', and `all'. The second level
+ specifier is optional: it is used to specify message severities
+ which are to be rate limited. Default is `loglvl=warning'.
+\item [ guest\_loglvl=$<$level$>/<$level$>$ ] As for loglvl, but
+ applies to messages relating to guests. Default is
+ `guest\_loglvl=none/warning'.
\item [ nmi=xxx ]
Specify what to do with an NMI parity or I/O error. \\
`nmi=fatal': Xen prints a diagnostic and then hangs. \\
return __hvm_copy(buf, shadow_gva_to_gpa(current, vaddr), size, 0);
}
-/*
- * HVM specific printbuf. Mostly used for hvmloader chit-chat.
- */
+/* HVM specific printbuf. Mostly used for hvmloader chit-chat. */
void hvm_print_line(struct vcpu *v, const char c)
{
- int *index = &v->domain->arch.hvm_domain.pbuf_index;
- char *pbuf = v->domain->arch.hvm_domain.pbuf;
-
- if (*index == HVM_PBUF_SIZE-2 || c == '\n') {
- if (*index == HVM_PBUF_SIZE-2)
- pbuf[(*index)++] = c;
- pbuf[*index] = '\0';
- printk("(GUEST: %u) %s\n", v->domain->domain_id, pbuf);
- *index = 0;
- } else
- pbuf[(*index)++] = c;
+ struct hvm_domain *hd = &v->domain->arch.hvm_domain;
+
+ spin_lock(&hd->pbuf_lock);
+ hd->pbuf[hd->pbuf_idx++] = c;
+ if ( (hd->pbuf_idx == (sizeof(hd->pbuf) - 2)) || (c == '\n') )
+ {
+ if ( c != '\n' )
+ hd->pbuf[hd->pbuf_idx++] = '\n';
+ hd->pbuf[hd->pbuf_idx] = '\0';
+ printk(XENLOG_G_DEBUG "HVM%u: %s\n", v->domain->domain_id, hd->pbuf);
+ hd->pbuf_idx = 0;
+ }
+ spin_unlock(&hd->pbuf_lock);
}
typedef unsigned long hvm_hypercall_t(
#define XENLOG_DEFAULT 1 /* XENLOG_WARNING */
#define XENLOG_GUEST_DEFAULT 1 /* XENLOG_WARNING */
-int xenlog_upper_thresh = XENLOG_UPPER_THRESHOLD;
-int xenlog_lower_thresh = XENLOG_LOWER_THRESHOLD;
-int xenlog_guest_upper_thresh = XENLOG_GUEST_UPPER_THRESHOLD;
-int xenlog_guest_lower_thresh = XENLOG_GUEST_LOWER_THRESHOLD;
+static int xenlog_upper_thresh = XENLOG_UPPER_THRESHOLD;
+static int xenlog_lower_thresh = XENLOG_LOWER_THRESHOLD;
+static int xenlog_guest_upper_thresh = XENLOG_GUEST_UPPER_THRESHOLD;
+static int xenlog_guest_lower_thresh = XENLOG_GUEST_LOWER_THRESHOLD;
+
+static void parse_loglvl(char *s);
+static void parse_guest_loglvl(char *s);
+
+/*
+ * <lvl> := none|error|warning|info|debug|all
+ * loglvl=<lvl_print_always>[/<lvl_print_ratelimit>]
+ * <lvl_print_always>: log level which is always printed
+ * <lvl_print_rlimit>: log level which is rate-limit printed
+ * Similar definitions for guest_loglvl, but applies to guest tracing.
+ * Defaults: loglvl=warning ; guest_loglvl=none/warning
+ */
+custom_param("loglvl", parse_loglvl);
+custom_param("guest_loglvl", parse_guest_loglvl);
static int xen_startup = 1;
+#define ___parse_loglvl(s, ps, lvlstr, lvlnum) \
+ if ( !strncmp((s), (lvlstr), strlen(lvlstr)) ) { \
+ *(ps) = (s) + strlen(lvlstr); \
+ return (lvlnum); \
+ }
+
+static int __parse_loglvl(char *s, char **ps)
+{
+ ___parse_loglvl(s, ps, "none", 0);
+ ___parse_loglvl(s, ps, "error", 1);
+ ___parse_loglvl(s, ps, "warning", 2);
+ ___parse_loglvl(s, ps, "info", 3);
+ ___parse_loglvl(s, ps, "debug", 4);
+ ___parse_loglvl(s, ps, "all", 4);
+ return 2; /* sane fallback */
+}
+
+static void _parse_loglvl(char *s, int *lower, int *upper)
+{
+ *lower = *upper = __parse_loglvl(s, &s);
+ if ( *s == '/' )
+ *upper = __parse_loglvl(s+1, &s);
+ if ( *upper < *lower )
+ *upper = *lower;
+}
+
+static void parse_loglvl(char *s)
+{
+ _parse_loglvl(s, &xenlog_lower_thresh, &xenlog_upper_thresh);
+}
+
+static void parse_guest_loglvl(char *s)
+{
+ _parse_loglvl(s, &xenlog_guest_lower_thresh, &xenlog_guest_upper_thresh);
+}
+
+static char *loglvl_str(int lvl)
+{
+ switch ( lvl )
+ {
+ case 0: return "Nothing";
+ case 1: return "Errors";
+ case 2: return "Errors and warnings";
+ case 3: return "Errors, warnings and info";
+ case 4: return "All";
+ }
+ return "???";
+}
+
/*
* ********************************************************
* *************** ACCESS TO CONSOLE RING *****************
{
int i, j;
+ printk("Std. Loglevel: %s", loglvl_str(xenlog_lower_thresh));
+ if ( xenlog_upper_thresh != xenlog_lower_thresh )
+ printk(" (Rate-limited: %s)", loglvl_str(xenlog_upper_thresh));
+ printk("\nGuest Loglevel: %s", loglvl_str(xenlog_guest_lower_thresh));
+ if ( xenlog_guest_upper_thresh != xenlog_guest_lower_thresh )
+ printk(" (Rate-limited: %s)", loglvl_str(xenlog_guest_upper_thresh));
+ printk("\n");
+
if ( opt_sync_console )
{
printk("**********************************************\n");