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

[Xen-changelog] [xen master] tools/xenconsoled: Possibly perform repeated xc_readconsolering() hypercalls



commit 63a04d97a01936bff5388947f1348ac144b64101
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Jul 22 17:17:15 2014 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Thu Jul 24 16:23:19 2014 +0100

    tools/xenconsoled: Possibly perform repeated xc_readconsolering() hypercalls
    
    The size of the Xen console ring is runtime configurable, so the statically
    sized 16k buffer is not necessarily sufficient.  Make repeated
    xc_readconsolering() hypercalls while Xen managed to completely fill the
    provided buffer.
    
    Also, change the buffer to being static to save on stack space.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
    CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/console/daemon/io.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index 313b256..b1268fa 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -909,17 +909,24 @@ static void handle_xs(void)
 
 static void handle_hv_logs(xc_evtchn *xce_handle)
 {
-       char buffer[1024*16];
+       static char buffer[1024*16];
        char *bufptr = buffer;
-       unsigned int size = sizeof(buffer);
+       unsigned int size;
        static uint32_t index = 0;
        evtchn_port_or_error_t port;
 
        if ((port = xc_evtchn_pending(xce_handle)) == -1)
                return;
 
-       if (xc_readconsolering(xc, bufptr, &size, 0, 1, &index) == 0 && size > 
0) {
+       do
+       {
                int logret;
+
+               size = sizeof(buffer);
+               if (xc_readconsolering(xc, bufptr, &size, 0, 1, &index) != 0 ||
+                   size == 0)
+                       break;
+
                if (log_time_hv)
                        logret = write_with_timestamp(log_hv_fd, buffer, size,
                                                      &log_time_hv_needts);
@@ -929,7 +936,7 @@ static void handle_hv_logs(xc_evtchn *xce_handle)
                if (logret < 0)
                        dolog(LOG_ERR, "Failed to write hypervisor log: "
                                       "%d (%s)", errno, strerror(errno));
-       }
+       } while (size == sizeof(buffer));
 
        (void)xc_evtchn_unmask(xce_handle, port);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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