generate notification of new console ring data
PATCH 1/1 generate notification of new console ring data
This patch provides notification of console updates via VIRQ. The readconsolering capabilities provide the opportunity to provide console output to other clients (remote systems, logging systems, etc). This patchs adds the ability to generate a notification of a change in the console buffer.
I have available both client and server programs that will take either serial line (from qemu) or consolering data and remote them to another system via UDP. I can easily post these as examples, if there's any interest. We use these programs fairly heavily to send serial line and/or dom 0 console output to other systems for debugging and/or logging.
-b
Signature · 5 lines
------------------------------------------------------------------------ Ben Thomas Virtual Iron Software [email protected] Tower 1, Floor 2 978-849-1214 900 Chelmsford Street Lowell, MA 01851
Allow notification of console updates via VIRQ.
The readconsolering capabilities provide the opportunity to provide console output to other clients (remote systems, logging systems, etc). This patchs adds the ability to generate a notification of a change in the console buffer.
tools/libxc/xc_misc.c +14 -0
@@ -31,6 +31,20 @@ int xc_readconsolering(int xc_handle,unlock_pages (buffer, nr_chars);return ret; +} + +int xc_set_conring_notify (int xc_handle,int enable) +{ +int ret; +DECLARE_SYSCTL ; + + sysctl.cmd = XEN_SYSCTL_conring_notify; + sysctl.u.conring_notify.enable = enable; + +if ( (ret =do_sysctl (xc_handle, &sysctl)) !=0 ) +return ret; + +return 0 ; } int xc_physinfo(int xc_handle,
tools/libxc/xenctrl.h +1 -0
@@ -465,6 +465,7 @@ int xc_readconsolering(int xc_handle,unsigned int *pnr_chars, int clear); +int xc_set_conring_notify (int xc_handle,int enable);typedef xen_sysctl_physinfo_t xc_physinfo_t ;int xc_physinfo (int xc_handle,xc_physinfo_t *info);
xen/common/sysctl.c +7 -0
@@ -128,6 +128,13 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_syscbreak ;#endif +case XEN_SYSCTL_conring_notify: + { + ret =set_conring_notify (op->u.conring_notify.enable); + } + +break ; +default : ret =arch_do_sysctl (op, u_sysctl);break ;
xen/drivers/char/console.c +17 -1
@@ -52,6 +52,7 @@ boolean_param("sync_console", opt_sync_c#define CONRING_IDX_MASK (i) ((i)&(CONRING_SIZE-1))static char conring[CONRING_SIZE ];static unsigned int conringc, conringp; +static int conring_notify =0 ;static char printk_prefix[16 ] ="" ;
@@ -173,6 +174,12 @@ static void putchar_console_ring(int c) conringc = conringp -CONRING_SIZE ; } +int set_conring_notify (int enable) +{ + conring_notify = enable; +return 0 ; +} +long read_console_ring (XEN_GUEST_HANDLE (char ) str,u32 *pcount,int clear) {unsigned int idx, len, max, sofar, c;
@@ -328,8 +335,13 @@ static long guest_console_write(XEN_GUESsercon_puts (kbuf); -for ( kptr = kbuf; *kptr !='\0' ; kptr++ ) +for ( kptr = kbuf; *kptr !='\0' ; kptr++ ) {vga_putchar (*kptr); +putchar_console_ring (*kptr); + } + +if (conring_notify) +send_guest_global_virq (dom0,VIRQ_CON_RING );guest_handle_add_offset (buffer, kcount); count -= kcount;
@@ -399,6 +411,10 @@ static void __putstr(const char *str)vga_putchar (c);putchar_console_ring (c); } + +if (conring_notify) +send_guest_global_virq (dom0,VIRQ_CON_RING ); + }static int printk_prefix_check (char *p,char **pp)
xen/include/public/sysctl.h +9 -0
@@ -140,6 +140,14 @@ typedef struct xen_sysctl_getdomaininfoltypedef struct xen_sysctl_getdomaininfolist xen_sysctl_getdomaininfolist_t ;DEFINE_XEN_GUEST_HANDLE (xen_sysctl_getdomaininfolist_t); +#define XEN_SYSCTL_conring_notify 7 +struct xen_sysctl_conring_notify { +/* IN variables. */ +uint32_t enable; +}; +typedef struct xen_sysctl_conring_notify xen_sysctl_conring_notify_t ; +DEFINE_XEN_GUEST_HANDLE (xen_sysctl_conring_notify_t); +struct xen_sysctl {uint32_t cmd;uint32_t interface_version;/* XEN_SYSCTL_INTERFACE_VERSION */
@@ -150,6 +158,7 @@ struct xen_sysctl {struct xen_sysctl_sched_id sched_id;struct xen_sysctl_perfc_op perfc_op;struct xen_sysctl_getdomaininfolist getdomaininfolist; +struct xen_sysctl_conring_notify conring_notify;uint8_t pad[128 ]; } u; };
xen/include/public/xen.h +1 -0
@@ -131,6 +131,7 @@#define VIRQ_TBUF 4/* G. (DOM0) Trace buffer has records available. */ #define VIRQ_DEBUGGER 6/* G. (DOM0) A domain has paused for debugging. */ #define VIRQ_XENOPROF 7/* V. XenOprofile interrupt: new sample available */ +#define VIRQ_CON_RING 8/* G. (DOM0) Bytes received on console */ /* Architecture-specific VIRQ definitions. */ #define VIRQ_ARCH_0 16
xen/include/xen/console.h +1 -0
@@ -14,6 +14,7 @@ void set_printk_prefix(const char *prefivoid set_printk_prefix (const char *prefix);long read_console_ring (XEN_GUEST_HANDLE (char ),u32 *,int ); +int set_conring_notify (int enable);void init_console (void );void console_endboot (void );
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel