* [PATCH 1 of 5 v4] common/sysctl: Introduce hypercall to query the console ring size
[not found] <patchbomb.1363179134@andrewcoop.uk.xensource.com>
@ 2013-03-13 12:52 ` Andrew Cooper
2013-03-13 12:52 ` [PATCH 2 of 5 v4] tools/libxc: Helper function for XEN_SYSCTL_consoleringsize Andrew Cooper
` (7 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Andrew Cooper @ 2013-03-13 12:52 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Keir Fraser, Ian Campbell, Jan Beulich, xen-api
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
--
Changes since v2:
* Rebase on top of coverage patches.
* Reword hypercall comments.
diff -r a6b81234b189 -r 89f3c6846f6b xen/common/sysctl.c
--- a/xen/common/sysctl.c
+++ b/xen/common/sysctl.c
@@ -358,6 +358,10 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xe
}
break;
+ case XEN_SYSCTL_consoleringsize:
+ ret = console_ring_size(&op->u.consoleringsize);
+ break;
+
#ifdef TEST_COVERAGE
case XEN_SYSCTL_coverage_op:
ret = sysctl_coverage_op(&op->u.coverage_op);
diff -r a6b81234b189 -r 89f3c6846f6b xen/drivers/char/console.c
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -226,6 +226,12 @@ long read_console_ring(struct xen_sysctl
return 0;
}
+long console_ring_size(struct xen_sysctl_consoleringsize * op)
+{
+ op->size = conring_size;
+ return 0;
+}
+
/*
* *******************************************************
diff -r a6b81234b189 -r 89f3c6846f6b xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -632,6 +632,14 @@ typedef struct xen_sysctl_coverage_op xe
DEFINE_XEN_GUEST_HANDLE(xen_sysctl_coverage_op_t);
+/* XEN_SYSCTL_consoleringsize */
+/* Get the size of the hypervisor console ring in bytes. */
+struct xen_sysctl_consoleringsize {
+ uint64_t size; /* OUT */
+};
+typedef struct xen_sysctl_consoleringsize xen_sysctl_consoleringsize_t;
+DEFINE_XEN_GUEST_HANDLE(xen_sysctl_consoleringsize_t);
+
struct xen_sysctl {
uint32_t cmd;
#define XEN_SYSCTL_readconsole 1
@@ -653,6 +661,7 @@ struct xen_sysctl {
#define XEN_SYSCTL_cpupool_op 18
#define XEN_SYSCTL_scheduler_op 19
#define XEN_SYSCTL_coverage_op 20
+#define XEN_SYSCTL_consoleringsize 21
uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
union {
struct xen_sysctl_readconsole readconsole;
@@ -674,6 +683,7 @@ struct xen_sysctl {
struct xen_sysctl_cpupool_op cpupool_op;
struct xen_sysctl_scheduler_op scheduler_op;
struct xen_sysctl_coverage_op coverage_op;
+ struct xen_sysctl_consoleringsize consoleringsize;
uint8_t pad[128];
} u;
};
diff -r a6b81234b189 -r 89f3c6846f6b xen/include/xen/console.h
--- a/xen/include/xen/console.h
+++ b/xen/include/xen/console.h
@@ -12,6 +12,8 @@
struct xen_sysctl_readconsole;
long read_console_ring(struct xen_sysctl_readconsole *op);
+struct xen_sysctl_consoleringsize;
+long console_ring_size(struct xen_sysctl_consoleringsize *op);
void console_init_preirq(void);
void console_init_postirq(void);
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2 of 5 v4] tools/libxc: Helper function for XEN_SYSCTL_consoleringsize
[not found] <patchbomb.1363179134@andrewcoop.uk.xensource.com>
2013-03-13 12:52 ` [PATCH 1 of 5 v4] common/sysctl: Introduce hypercall to query the console ring size Andrew Cooper
@ 2013-03-13 12:52 ` Andrew Cooper
2013-03-13 12:52 ` [PATCH 3 of 5 v4] tools/libxc: Implement xc_readconsolering_buffer() Andrew Cooper
` (6 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Andrew Cooper @ 2013-03-13 12:52 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Keir Fraser, Ian Campbell, Jan Beulich, xen-api
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
Changes since v2:
* Tweak style and errno in case of invalid pointer.
diff -r 89f3c6846f6b -r 0bd32c19873e tools/libxc/xc_misc.c
--- a/tools/libxc/xc_misc.c
+++ b/tools/libxc/xc_misc.c
@@ -100,6 +100,26 @@ int xc_readconsolering(xc_interface *xch
return ret;
}
+int xc_consoleringsize(xc_interface *xch, uint64_t *psize)
+{
+ int ret = -1;
+ DECLARE_SYSCTL;
+
+ if ( !psize )
+ {
+ errno = EINVAL;
+ return ret;
+ }
+
+ sysctl.cmd = XEN_SYSCTL_consoleringsize;
+ ret = do_sysctl(xch, &sysctl);
+
+ if ( !ret )
+ *psize = sysctl.u.consoleringsize.size;
+
+ return ret;
+}
+
int xc_send_debug_keys(xc_interface *xch, char *keys)
{
int ret, len = strlen(keys);
diff -r 89f3c6846f6b -r 0bd32c19873e tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h
+++ b/tools/libxc/xenctrl.h
@@ -998,6 +998,7 @@ int xc_readconsolering(xc_interface *xch
char *buffer,
unsigned int *pnr_chars,
int clear, int incremental, uint32_t *pindex);
+int xc_consoleringsize(xc_interface *xch, uint64_t *psize);
int xc_send_debug_keys(xc_interface *xch, char *keys);
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3 of 5 v4] tools/libxc: Implement xc_readconsolering_buffer()
[not found] <patchbomb.1363179134@andrewcoop.uk.xensource.com>
2013-03-13 12:52 ` [PATCH 1 of 5 v4] common/sysctl: Introduce hypercall to query the console ring size Andrew Cooper
2013-03-13 12:52 ` [PATCH 2 of 5 v4] tools/libxc: Helper function for XEN_SYSCTL_consoleringsize Andrew Cooper
@ 2013-03-13 12:52 ` Andrew Cooper
2013-03-13 12:52 ` [PATCH 4 of 5 v4] tools/ocaml: libxc bindings: Fix stub_xc_readconsolering() Andrew Cooper
` (5 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Andrew Cooper @ 2013-03-13 12:52 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Keir Fraser, Ian Campbell, Jan Beulich, xen-api
Functions identically to xc_readconsolering(), but uses a user-provided
xc_hypercall_buffer_t to save using a bounce buffer.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
--
Changes since v2:
* Document xc_readconsolering() and xc_readconsolering_buffer() functions
Changes since v1:
* Reduce xc_readconsolering() to use xc_readconsolering_buffer()
diff -r 0bd32c19873e -r c7b82dfbec34 tools/libxc/xc_misc.c
--- a/tools/libxc/xc_misc.c
+++ b/tools/libxc/xc_misc.c
@@ -70,13 +70,29 @@ int xc_readconsolering(xc_interface *xch
int clear, int incremental, uint32_t *pindex)
{
int ret;
- unsigned int nr_chars = *pnr_chars;
- DECLARE_SYSCTL;
- DECLARE_HYPERCALL_BOUNCE(buffer, nr_chars, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
+ DECLARE_HYPERCALL_BOUNCE(buffer, *pnr_chars, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
if ( xc_hypercall_bounce_pre(xch, buffer) )
return -1;
+ ret = xc_readconsolering_buffer(xch, HYPERCALL_BUFFER(buffer),
+ pnr_chars, clear, incremental, pindex);
+
+ xc_hypercall_bounce_post(xch, buffer);
+
+ return ret;
+}
+
+int xc_readconsolering_buffer(xc_interface *xch,
+ xc_hypercall_buffer_t *buffer,
+ unsigned int *pnr_chars,
+ int clear, int incremental, uint32_t *pindex)
+{
+ int ret;
+ unsigned int nr_chars = *pnr_chars;
+ DECLARE_SYSCTL;
+ DECLARE_HYPERCALL_BUFFER_ARGUMENT(buffer);
+
sysctl.cmd = XEN_SYSCTL_readconsole;
set_xen_guest_handle(sysctl.u.readconsole.buffer, buffer);
sysctl.u.readconsole.count = nr_chars;
@@ -95,8 +111,6 @@ int xc_readconsolering(xc_interface *xch
*pindex = sysctl.u.readconsole.index;
}
- xc_hypercall_bounce_post(xch, buffer);
-
return ret;
}
diff -r 0bd32c19873e -r c7b82dfbec34 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h
+++ b/tools/libxc/xenctrl.h
@@ -994,10 +994,26 @@ int xc_physdev_pci_access_modify(xc_inte
int func,
int enable);
+/*
+ * For both readconsolering functions, *pnr_chars is both an input and
+ * output. As an input, it specifies the size of *buffer, and as an output
+ * indicates now many character Xen wrote into *buffer.
+ *
+ * The 'clear' parameter indicates whether Xen should clear the buffer or not.
+ * If incremental is set, *pindex is an input and output parameter to aid with
+ * sequential small reads of the console ring.
+ *
+ * xc_readconsolering_buffer is preferred to avoid an extra copy of the console
+ * ring buffer.
+ */
int xc_readconsolering(xc_interface *xch,
char *buffer,
unsigned int *pnr_chars,
int clear, int incremental, uint32_t *pindex);
+int xc_readconsolering_buffer(xc_interface *xch,
+ xc_hypercall_buffer_t *buffer,
+ unsigned int *pnr_chars,
+ int clear, int incremental, uint32_t *pindex);
int xc_consoleringsize(xc_interface *xch, uint64_t *psize);
int xc_send_debug_keys(xc_interface *xch, char *keys);
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 4 of 5 v4] tools/ocaml: libxc bindings: Fix stub_xc_readconsolering()
[not found] <patchbomb.1363179134@andrewcoop.uk.xensource.com>
` (2 preceding siblings ...)
2013-03-13 12:52 ` [PATCH 3 of 5 v4] tools/libxc: Implement xc_readconsolering_buffer() Andrew Cooper
@ 2013-03-13 12:52 ` Andrew Cooper
2013-03-13 12:52 ` [PATCH 5 of 5 v4] tools/ocaml: libxc bindings: Fix failwith_xc() Andrew Cooper
` (4 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Andrew Cooper @ 2013-03-13 12:52 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Keir Fraser, Ian Campbell, Jan Beulich, xen-api
There are two problems with this function:
* The caml_{enter,leave}_blocking_section() calls mean that two threads can
compete for use of the static ring[] buffer.
* It fails to retrieve the entire buffer if the hypervisor has used 32K or
more of its console ring.
Rewrite the function using the new xc_consoleringsize() and
xc_readconsolering_buffer() functions to efficiently grab the entire console
ring.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
--
Changes since v3:
* Use caml_alloc_string/memcpy in preference to caml_copy_string to allow
for the possibility of NULL characters in the middle of the conring
Changes since v2:
* Tweak style and remove redundant variables
Changes since v1:
* Convert conring_size to being static to avoid needless hypercalls
* Fix memory due to ordering of failwith_xc() and xc_hypercall_buffer_free()
* Remove useless CAMLreturns()
diff -r c7b82dfbec34 -r 5bd08f35b362 tools/ocaml/libs/xc/xenctrl_stubs.c
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -523,27 +523,47 @@ CAMLprim value stub_xc_evtchn_reset(valu
CAMLreturn(Val_unit);
}
-
-#define RING_SIZE 32768
-static char ring[RING_SIZE];
-
CAMLprim value stub_xc_readconsolering(value xch)
{
- unsigned int size = RING_SIZE - 1;
- char *ring_ptr = ring;
+ static uint64_t conring_size = 0;
+ unsigned int nr_chars;
+ DECLARE_HYPERCALL_BUFFER(char, ring);
int retval;
CAMLparam1(xch);
+ CAMLlocal1(conring);
+
+ if (!conring_size)
+ {
+ if (xc_consoleringsize(_H(xch), &conring_size))
+ failwith_xc(_H(xch));
+
+ /* Round conring_size up to the next page, for NULL terminator
+ and slop from a race with printk() in the hypervisor. */
+ conring_size = (conring_size + XC_PAGE_SIZE) & XC_PAGE_MASK;
+ }
+
+ nr_chars = conring_size - 1;
+ ring = xc_hypercall_buffer_alloc(_H(xch), ring, conring_size);
+
+ if (!ring)
+ caml_raise_out_of_memory();
caml_enter_blocking_section();
- retval = xc_readconsolering(_H(xch), ring_ptr, &size, 0, 0, NULL);
+ retval = xc_readconsolering_buffer(_H(xch), HYPERCALL_BUFFER(ring),
+ &nr_chars, 0, 0, NULL);
caml_leave_blocking_section();
if (retval)
+ {
+ xc_hypercall_buffer_free(_H(xch), ring);
failwith_xc(_H(xch));
+ }
- ring[size] = '\0';
- CAMLreturn(caml_copy_string(ring));
+ conring = caml_alloc_string(nr_chars);
+ memcpy(String_val(conring), ring, nr_chars);
+ xc_hypercall_buffer_free(_H(xch), ring);
+ CAMLreturn(conring);
}
CAMLprim value stub_xc_send_debug_keys(value xch, value keys)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 5 of 5 v4] tools/ocaml: libxc bindings: Fix failwith_xc()
[not found] <patchbomb.1363179134@andrewcoop.uk.xensource.com>
` (3 preceding siblings ...)
2013-03-13 12:52 ` [PATCH 4 of 5 v4] tools/ocaml: libxc bindings: Fix stub_xc_readconsolering() Andrew Cooper
@ 2013-03-13 12:52 ` Andrew Cooper
[not found] ` <5bd08f35b3622b4e21e8.1363179138@andrewcoop.uk.xensource.com>
` (3 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Andrew Cooper @ 2013-03-13 12:52 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Keir Fraser, Ian Campbell, Jan Beulich, xen-api
The static error_str[] buffer is not thread-safe, and 1024 bytes is
unreasonably large. Reduce to 256 bytes (which is still much larger than any
current use), and move it to being a stack variable.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Dave Scott <Dave.Scott@eu.citrix.com>
--
Changes since v1:
* Mark as Noreturn, due to unconditional use of caml_raise_with_string()
diff -r 5bd08f35b362 -r e195c13431d5 tools/ocaml/libs/xc/xenctrl_stubs.c
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -51,21 +51,22 @@
i1 = (uint32_t) Int64_val(Field(input, 0)); \
i2 = ((Field(input, 1) == Val_none) ? 0xffffffff : (uint32_t) Int64_val(Field(Field(input, 1), 0)));
-#define ERROR_STRLEN 1024
-void failwith_xc(xc_interface *xch)
+static void Noreturn failwith_xc(xc_interface *xch)
{
- static char error_str[ERROR_STRLEN];
+ char error_str[256];
if (xch) {
const xc_error *error = xc_get_last_error(xch);
if (error->code == XC_ERROR_NONE)
- snprintf(error_str, ERROR_STRLEN, "%d: %s", errno, strerror(errno));
+ snprintf(error_str, sizeof(error_str),
+ "%d: %s", errno, strerror(errno));
else
- snprintf(error_str, ERROR_STRLEN, "%d: %s: %s",
- error->code,
+ snprintf(error_str, sizeof(error_str),
+ "%d: %s: %s", error->code,
xc_error_code_to_desc(error->code),
error->message);
} else {
- snprintf(error_str, ERROR_STRLEN, "Unable to open XC interface");
+ snprintf(error_str, sizeof(error_str),
+ "Unable to open XC interface");
}
caml_raise_with_string(*caml_named_value("xc.error"), error_str);
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4 of 5 v4] tools/ocaml: libxc bindings: Fix stub_xc_readconsolering()
[not found] ` <5bd08f35b3622b4e21e8.1363179138@andrewcoop.uk.xensource.com>
@ 2013-03-13 15:19 ` Dave Scott
0 siblings, 0 replies; 12+ messages in thread
From: Dave Scott @ 2013-03-13 15:19 UTC (permalink / raw)
To: Andrew Cooper, xen-devel@lists.xen.org
Cc: Keir (Xen.org), Ian Jackson, Ian Campbell, Jan Beulich,
xen-api@lists.xen.org
This looks good to me.
Acked-by: Dave Scott <dave.scott@eu.citrix.com>
> -----Original Message-----
> From: xen-devel-bounces@lists.xen.org [mailto:xen-devel-
> bounces@lists.xen.org] On Behalf Of Andrew Cooper
> Sent: 13 March 2013 12:52 PM
> To: xen-devel@lists.xen.org
> Cc: Ian Jackson; Keir (Xen.org); Ian Campbell; Jan Beulich; xen-
> api@lists.xen.org
> Subject: [Xen-devel] [PATCH 4 of 5 v4] tools/ocaml: libxc bindings: Fix
> stub_xc_readconsolering()
>
> There are two problems with this function:
> * The caml_{enter,leave}_blocking_section() calls mean that two threads
> can
> compete for use of the static ring[] buffer.
> * It fails to retrieve the entire buffer if the hypervisor has used 32K or
> more of its console ring.
>
> Rewrite the function using the new xc_consoleringsize() and
> xc_readconsolering_buffer() functions to efficiently grab the entire console
> ring.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> --
> Changes since v3:
> * Use caml_alloc_string/memcpy in preference to caml_copy_string to
> allow
> for the possibility of NULL characters in the middle of the conring Changes
> since v2:
> * Tweak style and remove redundant variables Changes since v1:
> * Convert conring_size to being static to avoid needless hypercalls
> * Fix memory due to ordering of failwith_xc() and
> xc_hypercall_buffer_free()
> * Remove useless CAMLreturns()
>
> diff -r c7b82dfbec34 -r 5bd08f35b362 tools/ocaml/libs/xc/xenctrl_stubs.c
> --- a/tools/ocaml/libs/xc/xenctrl_stubs.c
> +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
> @@ -523,27 +523,47 @@ CAMLprim value stub_xc_evtchn_reset(valu
> CAMLreturn(Val_unit);
> }
>
> -
> -#define RING_SIZE 32768
> -static char ring[RING_SIZE];
> -
> CAMLprim value stub_xc_readconsolering(value xch) {
> - unsigned int size = RING_SIZE - 1;
> - char *ring_ptr = ring;
> + static uint64_t conring_size = 0;
> + unsigned int nr_chars;
> + DECLARE_HYPERCALL_BUFFER(char, ring);
> int retval;
>
> CAMLparam1(xch);
> + CAMLlocal1(conring);
> +
> + if (!conring_size)
> + {
> + if (xc_consoleringsize(_H(xch), &conring_size))
> + failwith_xc(_H(xch));
> +
> + /* Round conring_size up to the next page, for NULL
> terminator
> + and slop from a race with printk() in the hypervisor. */
> + conring_size = (conring_size + XC_PAGE_SIZE) &
> XC_PAGE_MASK;
> + }
> +
> + nr_chars = conring_size - 1;
> + ring = xc_hypercall_buffer_alloc(_H(xch), ring, conring_size);
> +
> + if (!ring)
> + caml_raise_out_of_memory();
>
> caml_enter_blocking_section();
> - retval = xc_readconsolering(_H(xch), ring_ptr, &size, 0, 0, NULL);
> + retval = xc_readconsolering_buffer(_H(xch),
> HYPERCALL_BUFFER(ring),
> + &nr_chars, 0, 0, NULL);
> caml_leave_blocking_section();
>
> if (retval)
> + {
> + xc_hypercall_buffer_free(_H(xch), ring);
> failwith_xc(_H(xch));
> + }
>
> - ring[size] = '\0';
> - CAMLreturn(caml_copy_string(ring));
> + conring = caml_alloc_string(nr_chars);
> + memcpy(String_val(conring), ring, nr_chars);
> + xc_hypercall_buffer_free(_H(xch), ring);
> + CAMLreturn(conring);
> }
>
> CAMLprim value stub_xc_send_debug_keys(value xch, value keys)
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2 of 5 v4] tools/libxc: Helper function for XEN_SYSCTL_consoleringsize
[not found] ` <0bd32c19873e4ff55c07.1363179136@andrewcoop.uk.xensource.com>
@ 2013-04-05 14:47 ` Andrew Cooper
[not found] ` <515EE418.1020808@citrix.com>
1 sibling, 0 replies; 12+ messages in thread
From: Andrew Cooper @ 2013-04-05 14:47 UTC (permalink / raw)
To: xen-devel@lists.xen.org
Cc: Keir (Xen.org), Ian Jackson, Ian Campbell, Jan Beulich,
xen-api@lists.xen.org
On 13/03/13 12:52, Andrew Cooper wrote:
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Keir/Jan: Ping? This is a hypervisor change.
>
> ---
> Changes since v2:
> * Tweak style and errno in case of invalid pointer.
>
> diff -r 89f3c6846f6b -r 0bd32c19873e tools/libxc/xc_misc.c
> --- a/tools/libxc/xc_misc.c
> +++ b/tools/libxc/xc_misc.c
> @@ -100,6 +100,26 @@ int xc_readconsolering(xc_interface *xch
> return ret;
> }
>
> +int xc_consoleringsize(xc_interface *xch, uint64_t *psize)
> +{
> + int ret = -1;
> + DECLARE_SYSCTL;
> +
> + if ( !psize )
> + {
> + errno = EINVAL;
> + return ret;
> + }
> +
> + sysctl.cmd = XEN_SYSCTL_consoleringsize;
> + ret = do_sysctl(xch, &sysctl);
> +
> + if ( !ret )
> + *psize = sysctl.u.consoleringsize.size;
> +
> + return ret;
> +}
> +
> int xc_send_debug_keys(xc_interface *xch, char *keys)
> {
> int ret, len = strlen(keys);
> diff -r 89f3c6846f6b -r 0bd32c19873e tools/libxc/xenctrl.h
> --- a/tools/libxc/xenctrl.h
> +++ b/tools/libxc/xenctrl.h
> @@ -998,6 +998,7 @@ int xc_readconsolering(xc_interface *xch
> char *buffer,
> unsigned int *pnr_chars,
> int clear, int incremental, uint32_t *pindex);
> +int xc_consoleringsize(xc_interface *xch, uint64_t *psize);
>
> int xc_send_debug_keys(xc_interface *xch, char *keys);
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1 of 5 v4] common/sysctl: Introduce hypercall to query the console ring size
[not found] ` <89f3c6846f6b4f229e68.1363179135@andrewcoop.uk.xensource.com>
@ 2013-04-05 14:48 ` Andrew Cooper
[not found] ` <515EE44D.6070907@citrix.com>
1 sibling, 0 replies; 12+ messages in thread
From: Andrew Cooper @ 2013-04-05 14:48 UTC (permalink / raw)
To: xen-devel@lists.xen.org
Cc: Keir (Xen.org), Ian Jackson, Ian Campbell, Jan Beulich,
xen-api@lists.xen.org
On 13/03/13 12:52, Andrew Cooper wrote:
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Keir/Jan: Ping - this is a hypervisor change.
~Andrew
>
> --
> Changes since v2:
> * Rebase on top of coverage patches.
> * Reword hypercall comments.
>
> diff -r a6b81234b189 -r 89f3c6846f6b xen/common/sysctl.c
> --- a/xen/common/sysctl.c
> +++ b/xen/common/sysctl.c
> @@ -358,6 +358,10 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xe
> }
> break;
>
> + case XEN_SYSCTL_consoleringsize:
> + ret = console_ring_size(&op->u.consoleringsize);
> + break;
> +
> #ifdef TEST_COVERAGE
> case XEN_SYSCTL_coverage_op:
> ret = sysctl_coverage_op(&op->u.coverage_op);
> diff -r a6b81234b189 -r 89f3c6846f6b xen/drivers/char/console.c
> --- a/xen/drivers/char/console.c
> +++ b/xen/drivers/char/console.c
> @@ -226,6 +226,12 @@ long read_console_ring(struct xen_sysctl
> return 0;
> }
>
> +long console_ring_size(struct xen_sysctl_consoleringsize * op)
> +{
> + op->size = conring_size;
> + return 0;
> +}
> +
>
> /*
> * *******************************************************
> diff -r a6b81234b189 -r 89f3c6846f6b xen/include/public/sysctl.h
> --- a/xen/include/public/sysctl.h
> +++ b/xen/include/public/sysctl.h
> @@ -632,6 +632,14 @@ typedef struct xen_sysctl_coverage_op xe
> DEFINE_XEN_GUEST_HANDLE(xen_sysctl_coverage_op_t);
>
>
> +/* XEN_SYSCTL_consoleringsize */
> +/* Get the size of the hypervisor console ring in bytes. */
> +struct xen_sysctl_consoleringsize {
> + uint64_t size; /* OUT */
> +};
> +typedef struct xen_sysctl_consoleringsize xen_sysctl_consoleringsize_t;
> +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_consoleringsize_t);
> +
> struct xen_sysctl {
> uint32_t cmd;
> #define XEN_SYSCTL_readconsole 1
> @@ -653,6 +661,7 @@ struct xen_sysctl {
> #define XEN_SYSCTL_cpupool_op 18
> #define XEN_SYSCTL_scheduler_op 19
> #define XEN_SYSCTL_coverage_op 20
> +#define XEN_SYSCTL_consoleringsize 21
> uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
> union {
> struct xen_sysctl_readconsole readconsole;
> @@ -674,6 +683,7 @@ struct xen_sysctl {
> struct xen_sysctl_cpupool_op cpupool_op;
> struct xen_sysctl_scheduler_op scheduler_op;
> struct xen_sysctl_coverage_op coverage_op;
> + struct xen_sysctl_consoleringsize consoleringsize;
> uint8_t pad[128];
> } u;
> };
> diff -r a6b81234b189 -r 89f3c6846f6b xen/include/xen/console.h
> --- a/xen/include/xen/console.h
> +++ b/xen/include/xen/console.h
> @@ -12,6 +12,8 @@
>
> struct xen_sysctl_readconsole;
> long read_console_ring(struct xen_sysctl_readconsole *op);
> +struct xen_sysctl_consoleringsize;
> +long console_ring_size(struct xen_sysctl_consoleringsize *op);
>
> void console_init_preirq(void);
> void console_init_postirq(void);
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2 of 5 v4] tools/libxc: Helper function for XEN_SYSCTL_consoleringsize
[not found] ` <515EE418.1020808@citrix.com>
@ 2013-04-05 14:50 ` Andrew Cooper
2013-04-11 13:18 ` Ian Campbell
0 siblings, 1 reply; 12+ messages in thread
From: Andrew Cooper @ 2013-04-05 14:50 UTC (permalink / raw)
To: xen-devel@lists.xen.org
Cc: Ian Jackson, Keir (Xen.org), Ian Campbell, Jan Beulich,
xen-api@lists.xen.org
On 05/04/13 15:47, Andrew Cooper wrote:
> On 13/03/13 12:52, Andrew Cooper wrote:
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Keir/Jan: Ping? This is a hypervisor change.
Apologies - this is actually a tools change. Ian/Ian?
>
>> ---
>> Changes since v2:
>> * Tweak style and errno in case of invalid pointer.
>>
>> diff -r 89f3c6846f6b -r 0bd32c19873e tools/libxc/xc_misc.c
>> --- a/tools/libxc/xc_misc.c
>> +++ b/tools/libxc/xc_misc.c
>> @@ -100,6 +100,26 @@ int xc_readconsolering(xc_interface *xch
>> return ret;
>> }
>>
>> +int xc_consoleringsize(xc_interface *xch, uint64_t *psize)
>> +{
>> + int ret = -1;
>> + DECLARE_SYSCTL;
>> +
>> + if ( !psize )
>> + {
>> + errno = EINVAL;
>> + return ret;
>> + }
>> +
>> + sysctl.cmd = XEN_SYSCTL_consoleringsize;
>> + ret = do_sysctl(xch, &sysctl);
>> +
>> + if ( !ret )
>> + *psize = sysctl.u.consoleringsize.size;
>> +
>> + return ret;
>> +}
>> +
>> int xc_send_debug_keys(xc_interface *xch, char *keys)
>> {
>> int ret, len = strlen(keys);
>> diff -r 89f3c6846f6b -r 0bd32c19873e tools/libxc/xenctrl.h
>> --- a/tools/libxc/xenctrl.h
>> +++ b/tools/libxc/xenctrl.h
>> @@ -998,6 +998,7 @@ int xc_readconsolering(xc_interface *xch
>> char *buffer,
>> unsigned int *pnr_chars,
>> int clear, int incremental, uint32_t *pindex);
>> +int xc_consoleringsize(xc_interface *xch, uint64_t *psize);
>>
>> int xc_send_debug_keys(xc_interface *xch, char *keys);
>>
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xen.org
>> http://lists.xen.org/xen-devel
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2 of 5 v4] tools/libxc: Helper function for XEN_SYSCTL_consoleringsize
2013-04-05 14:50 ` Andrew Cooper
@ 2013-04-11 13:18 ` Ian Campbell
0 siblings, 0 replies; 12+ messages in thread
From: Ian Campbell @ 2013-04-11 13:18 UTC (permalink / raw)
To: Andrew Cooper
Cc: Ian Jackson, xen-api@lists.xen.org, Keir (Xen.org), Jan Beulich,
xen-devel@lists.xen.org
On Fri, 2013-04-05 at 15:50 +0100, Andrew Cooper wrote:
> On 05/04/13 15:47, Andrew Cooper wrote:
> > On 13/03/13 12:52, Andrew Cooper wrote:
> >> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> > Keir/Jan: Ping? This is a hypervisor change.
>
> Apologies - this is actually a tools change. Ian/Ian?
Acked-by: Ian Campbell <ian.campbell@citrix.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3 of 5 v4] tools/libxc: Implement xc_readconsolering_buffer()
[not found] ` <c7b82dfbec34f4abc049.1363179137@andrewcoop.uk.xensource.com>
@ 2013-04-11 13:21 ` Ian Campbell
0 siblings, 0 replies; 12+ messages in thread
From: Ian Campbell @ 2013-04-11 13:21 UTC (permalink / raw)
To: Andrew Cooper
Cc: Ian Jackson, xen-api@lists.xen.org, Keir (Xen.org), Jan Beulich,
xen-devel@lists.xen.org
On Wed, 2013-03-13 at 12:52 +0000, Andrew Cooper wrote:
> +/*
> + * For both readconsolering functions, *pnr_chars is both an input and
> + * output. As an input, it specifies the size of *buffer, and as an output
> + * indicates now many character Xen wrote into *buffer.
> + *
> + * The 'clear' parameter indicates whether Xen should clear the buffer or not.
Buffer here refers to Xen's internal ring, not the char *buffer argument
to this function, right? If so the wording (at least in the context) is
a bit confusing!
The actual code looks good to me.
Ian.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1 of 5 v4] common/sysctl: Introduce hypercall to query the console ring size
[not found] ` <515EE44D.6070907@citrix.com>
@ 2013-04-22 11:59 ` Ian Campbell
0 siblings, 0 replies; 12+ messages in thread
From: Ian Campbell @ 2013-04-22 11:59 UTC (permalink / raw)
To: Andrew Cooper
Cc: Keir (Xen.org), xen-api@lists.xen.org, Ian Jackson, Jan Beulich,
xen-devel@lists.xen.org
On Fri, 2013-04-05 at 15:48 +0100, Andrew Cooper wrote:
> On 13/03/13 12:52, Andrew Cooper wrote:
> > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> Keir/Jan: Ping - this is a hypervisor change.
Anyone? This hypervisor side portion of this series seems pretty trivial
to me.
Ian.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-04-22 11:59 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <patchbomb.1363179134@andrewcoop.uk.xensource.com>
2013-03-13 12:52 ` [PATCH 1 of 5 v4] common/sysctl: Introduce hypercall to query the console ring size Andrew Cooper
2013-03-13 12:52 ` [PATCH 2 of 5 v4] tools/libxc: Helper function for XEN_SYSCTL_consoleringsize Andrew Cooper
2013-03-13 12:52 ` [PATCH 3 of 5 v4] tools/libxc: Implement xc_readconsolering_buffer() Andrew Cooper
2013-03-13 12:52 ` [PATCH 4 of 5 v4] tools/ocaml: libxc bindings: Fix stub_xc_readconsolering() Andrew Cooper
2013-03-13 12:52 ` [PATCH 5 of 5 v4] tools/ocaml: libxc bindings: Fix failwith_xc() Andrew Cooper
[not found] ` <5bd08f35b3622b4e21e8.1363179138@andrewcoop.uk.xensource.com>
2013-03-13 15:19 ` [PATCH 4 of 5 v4] tools/ocaml: libxc bindings: Fix stub_xc_readconsolering() Dave Scott
[not found] ` <0bd32c19873e4ff55c07.1363179136@andrewcoop.uk.xensource.com>
2013-04-05 14:47 ` [PATCH 2 of 5 v4] tools/libxc: Helper function for XEN_SYSCTL_consoleringsize Andrew Cooper
[not found] ` <515EE418.1020808@citrix.com>
2013-04-05 14:50 ` Andrew Cooper
2013-04-11 13:18 ` Ian Campbell
[not found] ` <89f3c6846f6b4f229e68.1363179135@andrewcoop.uk.xensource.com>
2013-04-05 14:48 ` [PATCH 1 of 5 v4] common/sysctl: Introduce hypercall to query the console ring size Andrew Cooper
[not found] ` <515EE44D.6070907@citrix.com>
2013-04-22 11:59 ` Ian Campbell
[not found] ` <c7b82dfbec34f4abc049.1363179137@andrewcoop.uk.xensource.com>
2013-04-11 13:21 ` [PATCH 3 of 5 v4] tools/libxc: Implement xc_readconsolering_buffer() Ian Campbell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.