diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-03-17 08:34:16 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-03-17 08:34:16 +0000 |
commit | 35d60c59af284262ae011c7e52bd9927788fb47a (patch) | |
tree | c552fc85f6cecaab468953a9c8fc5727a75328b9 /tools | |
parent | a7e7bb6199d2d9e81b0097dcbd3edac1fb886d24 (diff) | |
download | xen-35d60c59af284262ae011c7e52bd9927788fb47a.tar.gz xen-35d60c59af284262ae011c7e52bd9927788fb47a.tar.bz2 xen-35d60c59af284262ae011c7e52bd9927788fb47a.zip |
Increase default console ring allocation size and reduce default verbosity
In order to have better chance that relevant messages fit into the
ring buffer, allocate a dynamic (larger) one in more cases, and make
the default allocation size depend on both the number of CPUs and the
log level. Also free the static buffer if a dynamic one was obtained.
In order for "xm dmesg" to retrieve larger buffers, eliminate
pyxc_readconsolering()'s 32k limitation resulting from the use of a
statically allocated buffer.
Finally, suppress on x86 most per-CPU boot time messages (by default,
most of them can be re-enabled with a new command line option
"cpuinfo", some others are now only printed more than once when there
are inconsistencies between CPUs). This reduces both boot time (namely
when a graphical console is in use) and pressure on the console ring
and serial transmit buffers.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/python/xen/lowlevel/xc/xc.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 8ed1053575..09bb260800 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -1062,14 +1062,16 @@ static PyObject *pyxc_readconsolering(XcObject *self, PyObject *kwds) { unsigned int clear = 0, index = 0, incremental = 0; - char _str[32768], *str = _str; - unsigned int count = 32768; + unsigned int count = 16384 + 1, size = count; + char *str = malloc(size), *ptr; + PyObject *obj; int ret; static char *kwd_list[] = { "clear", "index", "incremental", NULL }; if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iii", kwd_list, - &clear, &index, &incremental) ) + &clear, &index, &incremental) || + !str ) return NULL; ret = xc_readconsolering(self->xc_handle, &str, &count, clear, @@ -1077,7 +1079,30 @@ static PyObject *pyxc_readconsolering(XcObject *self, if ( ret < 0 ) return pyxc_error_to_exception(); - return PyString_FromStringAndSize(str, count); + while ( !incremental && count == size ) + { + size += count - 1; + if ( size < count ) + break; + + ptr = realloc(str, size); + if ( !ptr ) + break; + + str = ptr + count; + count = size - count; + ret = xc_readconsolering(self->xc_handle, &str, &count, clear, + 1, &index); + if ( ret < 0 ) + break; + + count += str - ptr; + str = ptr; + } + + obj = PyString_FromStringAndSize(str, count); + free(str); + return obj; } |