Andrew Cooper
2013-Feb-21 15:46 UTC
[PATCH 1 of 5 v2] common/sysctl: Introduce hypercall to query the console ring size
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> diff -r 66f563be41d9 -r 1306e69a7018 xen/common/sysctl.c --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -357,6 +357,9 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xe } break; + case XEN_SYSCTL_consoleringsize: + ret = console_ring_size(&op->u.consoleringsize); + break; default: ret = arch_do_sysctl(op, u_sysctl); diff -r 66f563be41d9 -r 1306e69a7018 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 66f563be41d9 -r 1306e69a7018 xen/include/public/sysctl.h --- a/xen/include/public/sysctl.h +++ b/xen/include/public/sysctl.h @@ -596,6 +596,14 @@ struct xen_sysctl_scheduler_op { typedef struct xen_sysctl_scheduler_op xen_sysctl_scheduler_op_t; DEFINE_XEN_GUEST_HANDLE(xen_sysctl_scheduler_op_t); +/* XEN_SYSCTL_consoleringsize */ +/* Get the size of the hypervisor console ring. */ +struct xen_sysctl_consoleringsize { + uint64_t size; /* Written by Xen. */ +}; +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 @@ -616,6 +624,7 @@ struct xen_sysctl { #define XEN_SYSCTL_numainfo 17 #define XEN_SYSCTL_cpupool_op 18 #define XEN_SYSCTL_scheduler_op 19 +#define XEN_SYSCTL_consoleringsize 20 uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */ union { struct xen_sysctl_readconsole readconsole; @@ -636,6 +645,7 @@ struct xen_sysctl { struct xen_sysctl_lockprof_op lockprof_op; struct xen_sysctl_cpupool_op cpupool_op; struct xen_sysctl_scheduler_op scheduler_op; + struct xen_sysctl_consoleringsize consoleringsize; uint8_t pad[128]; } u; }; diff -r 66f563be41d9 -r 1306e69a7018 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);
Ian Campbell
2013-Mar-12 17:05 UTC
Re: [PATCH 1 of 5 v2] common/sysctl: Introduce hypercall to query the console ring size
On Thu, 2013-02-21 at 15:46 +0000, Andrew Cooper wrote:> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>Seems pretty obvious to me, any (n)ack from a hypervisor hat wearing person?> > diff -r 66f563be41d9 -r 1306e69a7018 xen/common/sysctl.c > --- a/xen/common/sysctl.c > +++ b/xen/common/sysctl.c > @@ -357,6 +357,9 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xe > } > break; > > + case XEN_SYSCTL_consoleringsize: > + ret = console_ring_size(&op->u.consoleringsize); > + break; > > default: > ret = arch_do_sysctl(op, u_sysctl); > diff -r 66f563be41d9 -r 1306e69a7018 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 66f563be41d9 -r 1306e69a7018 xen/include/public/sysctl.h > --- a/xen/include/public/sysctl.h > +++ b/xen/include/public/sysctl.h > @@ -596,6 +596,14 @@ struct xen_sysctl_scheduler_op { > typedef struct xen_sysctl_scheduler_op xen_sysctl_scheduler_op_t; > DEFINE_XEN_GUEST_HANDLE(xen_sysctl_scheduler_op_t); > > +/* XEN_SYSCTL_consoleringsize */ > +/* Get the size of the hypervisor console ring. */ > +struct xen_sysctl_consoleringsize { > + uint64_t size;Is this bytes? Because even 2^32 is a hell of a lot of logging... I suppose you could say it was future-proof ;-)> /* Written by Xen. */The norm in the Xen headers seems to be /* OUT */ above the output variables.> +}; > +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 > @@ -616,6 +624,7 @@ struct xen_sysctl { > #define XEN_SYSCTL_numainfo 17 > #define XEN_SYSCTL_cpupool_op 18 > #define XEN_SYSCTL_scheduler_op 19 > +#define XEN_SYSCTL_consoleringsize 20 > uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */ > union { > struct xen_sysctl_readconsole readconsole; > @@ -636,6 +645,7 @@ struct xen_sysctl { > struct xen_sysctl_lockprof_op lockprof_op; > struct xen_sysctl_cpupool_op cpupool_op; > struct xen_sysctl_scheduler_op scheduler_op; > + struct xen_sysctl_consoleringsize consoleringsize; > uint8_t pad[128]; > } u; > }; > diff -r 66f563be41d9 -r 1306e69a7018 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);
Andrew Cooper
2013-Mar-12 17:13 UTC
Re: [PATCH 1 of 5 v2] common/sysctl: Introduce hypercall to query the console ring size
On 12/03/13 17:05, Ian Campbell wrote:> On Thu, 2013-02-21 at 15:46 +0000, Andrew Cooper wrote: >> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> > Seems pretty obvious to me, any (n)ack from a hypervisor hat wearing > person? > >> diff -r 66f563be41d9 -r 1306e69a7018 xen/common/sysctl.c >> --- a/xen/common/sysctl.c >> +++ b/xen/common/sysctl.c >> @@ -357,6 +357,9 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xe >> } >> break; >> >> + case XEN_SYSCTL_consoleringsize: >> + ret = console_ring_size(&op->u.consoleringsize); >> + break; >> >> default: >> ret = arch_do_sysctl(op, u_sysctl); >> diff -r 66f563be41d9 -r 1306e69a7018 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 66f563be41d9 -r 1306e69a7018 xen/include/public/sysctl.h >> --- a/xen/include/public/sysctl.h >> +++ b/xen/include/public/sysctl.h >> @@ -596,6 +596,14 @@ struct xen_sysctl_scheduler_op { >> typedef struct xen_sysctl_scheduler_op xen_sysctl_scheduler_op_t; >> DEFINE_XEN_GUEST_HANDLE(xen_sysctl_scheduler_op_t); >> >> +/* XEN_SYSCTL_consoleringsize */ >> +/* Get the size of the hypervisor console ring. */ >> +struct xen_sysctl_consoleringsize { >> + uint64_t size; > Is this bytes? Because even 2^32 is a hell of a lot of logging... I > suppose you could say it was future-proof ;-) > >> /* Written by Xen. */ > The norm in the Xen headers seems to be /* OUT */ above the output > variables.Ok - I will make these changes. I am going to have to rebase this series back on top of unstable anyway given the latest churn. ~Andrew> >> +}; >> +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 >> @@ -616,6 +624,7 @@ struct xen_sysctl { >> #define XEN_SYSCTL_numainfo 17 >> #define XEN_SYSCTL_cpupool_op 18 >> #define XEN_SYSCTL_scheduler_op 19 >> +#define XEN_SYSCTL_consoleringsize 20 >> uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */ >> union { >> struct xen_sysctl_readconsole readconsole; >> @@ -636,6 +645,7 @@ struct xen_sysctl { >> struct xen_sysctl_lockprof_op lockprof_op; >> struct xen_sysctl_cpupool_op cpupool_op; >> struct xen_sysctl_scheduler_op scheduler_op; >> + struct xen_sysctl_consoleringsize consoleringsize; >> uint8_t pad[128]; >> } u; >> }; >> diff -r 66f563be41d9 -r 1306e69a7018 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); >