[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH 12/17] xenconsoled: make console_type->use_gnttab less confusing
Before this commit 'use_gnttab' means xenconsoled should first try special GNTTAB_RESERVED_CONSOLE entry, and only then fallback to ring-ref xenstore entry (being gfn of actual ring). In case of secondary consoles, ring-ref entry contains grant table reference (not gfn of it), which makes the old meaning of use_gnttab really confusing (should be false for such consoles). To solve this, add new entry in console_type (and console) structures named 'use_reserverd_gnttab' with the old meaning of 'use_gnttab', then use 'ues_gnttab' for consoles where ring-ref holds grant table reference. --- tools/console/daemon/io.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 92c3dff..2cf71a0 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -110,6 +110,7 @@ struct console { struct domain *d; bool optional; bool use_gnttab; + bool use_reserved_gnttab; bool have_state; }; @@ -119,6 +120,7 @@ struct console_type { char *log_suffix; bool optional; bool use_gnttab; + bool use_reserved_gnttab; bool have_state; // uses 'state' xenstore entry }; @@ -129,6 +131,7 @@ static struct console_type console_type[] = { .log_suffix = "", .optional = false, .use_gnttab = true, + .use_reserved_gnttab = true, }, #if defined(CONFIG_ARM) { @@ -670,7 +673,7 @@ static void console_unmap_interface(struct console *con) { if (con->interface == NULL) return; - if (xgt_handle && con->ring_ref == -1) + if (xgt_handle && con->use_gnttab) xengnttab_unmap(xgt_handle, con->interface, 1); else munmap(con->interface, XC_PAGE_SIZE); @@ -714,12 +717,19 @@ static int console_create_ring(struct console *con) if (!con->interface && xgt_handle && con->use_gnttab) { /* Prefer using grant table */ - con->interface = xengnttab_map_grant_ref(xgt_handle, - dom->domid, GNTTAB_RESERVED_CONSOLE, - PROT_READ|PROT_WRITE); - con->ring_ref = -1; + if (con->use_reserved_gnttab) { + con->interface = xengnttab_map_grant_ref(xgt_handle, + dom->domid, GNTTAB_RESERVED_CONSOLE, + PROT_READ|PROT_WRITE); + con->ring_ref = -1; + } else { + con->interface = xengnttab_map_grant_ref(xgt_handle, + dom->domid, ring_ref, + PROT_READ|PROT_WRITE); + con->ring_ref = ring_ref; + } } - if (!con->interface) { + if (!con->interface && (!con->use_gnttab || con->use_reserved_gnttab)) { /* Fall back to xc_map_foreign_range */ con->interface = xc_map_foreign_range( xc, dom->domid, XC_PAGE_SIZE, @@ -893,6 +903,7 @@ static int console_init(struct console *con, struct domain *dom, void **data) con->log_suffix = (*con_type)->log_suffix; con->optional = (*con_type)->optional; con->use_gnttab = (*con_type)->use_gnttab; + con->use_reserved_gnttab = (*con_type)->use_reserved_gnttab; con->have_state = (*con_type)->have_state; xsname = (char *)(*con_type)->xsname; xspath = xs_get_domain_path(xs, dom->domid); -- git-series 0.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |