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

[Xen-changelog] [xen master] xen/arm: vpl011: Add a new handle_console_ring function in xenconsole



commit 0b6abb75a39571753ad89d271725c0d8a30acba7
Author:     Bhupinder Thakur <bhupinder.thakur@xxxxxxxxxx>
AuthorDate: Wed Sep 27 11:43:25 2017 +0530
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Tue Oct 3 15:23:37 2017 -0700

    xen/arm: vpl011: Add a new handle_console_ring function in xenconsole
    
    This patch introduces a new handle_console_ring function. This function
    reads the data from the ring buffer on receiving an event.
    
    The initialization of event channel poll fd to -1 is moved inside the
    handle_console_ring function as they are related. There should be no
    change in the behavior as there is no functional change.
    
    Signed-off-by: Bhupinder Thakur <bhupinder.thakur@xxxxxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/console/daemon/io.c | 40 +++++++++++++++++++++++++++-------------
 1 file changed, 27 insertions(+), 13 deletions(-)

diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index 2dcaee6..c361b42 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -934,17 +934,23 @@ static void console_evtchn_unmask(struct console *con, 
void *data)
        }
 }
 
-static void handle_ring_read(struct domain *dom)
+static void handle_ring_read(struct console *con)
 {
        xenevtchn_port_or_error_t port;
-       struct console *con = &dom->console;
 
-       if (dom->is_dead)
+       if (con->d->is_dead)
                return;
 
        if ((port = xenevtchn_pending(con->xce_handle)) == -1)
                return;
 
+       if (port != con->local_port) {
+               dolog(LOG_ERR,
+                     "Event received for invalid port %d, Expected port is 
%d\n",
+                     port, con->local_port);
+               return;
+       }
+
        con->event_count++;
 
        buffer_append(con);
@@ -953,6 +959,21 @@ static void handle_ring_read(struct domain *dom)
                (void)xenevtchn_unmask(con->xce_handle, port);
 }
 
+static void handle_console_ring(struct console *con)
+{
+       if (con->event_count < RATE_LIMIT_ALLOWANCE) {
+               if (con->xce_handle != NULL &&
+                   con->xce_pollfd_idx != -1 &&
+                   !(fds[con->xce_pollfd_idx].revents &
+                     ~(POLLIN|POLLOUT|POLLPRI)) &&
+                   (fds[con->xce_pollfd_idx].revents &
+                    POLLIN))
+                       handle_ring_read(con);
+       }
+
+       con->xce_pollfd_idx = -1;
+}
+
 static void handle_xs(void)
 {
        char **vec;
@@ -1236,15 +1257,8 @@ void handle_io(void)
                        struct console *con = &d->console;
 
                        n = d->next;
-                       if (con->event_count < RATE_LIMIT_ALLOWANCE) {
-                               if (con->xce_handle != NULL &&
-                                   con->xce_pollfd_idx != -1 &&
-                                   !(fds[con->xce_pollfd_idx].revents &
-                                     ~(POLLIN|POLLOUT|POLLPRI)) &&
-                                     (fds[con->xce_pollfd_idx].revents &
-                                      POLLIN))
-                                   handle_ring_read(d);
-                       }
+
+                       handle_console_ring(con);
 
                        if (con->master_fd != -1 && con->master_pollfd_idx != 
-1) {
                                if (fds[con->master_pollfd_idx].revents &
@@ -1261,7 +1275,7 @@ void handle_io(void)
                                }
                        }
 
-                       con->xce_pollfd_idx = con->master_pollfd_idx = -1;
+                       con->master_pollfd_idx = -1;
 
                        if (d->last_seen != enum_pass)
                                shutdown_domain(d);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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