Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/xen/xen - add machdep.xen.version sysctl to easily ...
details: https://anonhg.NetBSD.org/src/rev/e5fc5a5a1d2f
branches: trunk
changeset: 345869:e5fc5a5a1d2f
user: jnemeth <jnemeth%NetBSD.org@localhost>
date: Sun Jun 12 09:08:09 2016 +0000
description:
- add machdep.xen.version sysctl to easily get hypervisor version
- move machdep.xen_timepush_ticks to machdep.xen.timepush_ticks to
consolidate all Xen related sysctls under machdep.xen
diffstat:
sys/arch/xen/xen/clock.c | 26 +++++++++++++++++++-------
sys/arch/xen/xen/hypervisor.c | 25 ++++++++++++++++++++++---
2 files changed, 41 insertions(+), 10 deletions(-)
diffs (109 lines):
diff -r bd289e287739 -r e5fc5a5a1d2f sys/arch/xen/xen/clock.c
--- a/sys/arch/xen/xen/clock.c Sun Jun 12 06:21:56 2016 +0000
+++ b/sys/arch/xen/xen/clock.c Sun Jun 12 09:08:09 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.63 2014/09/21 12:46:15 bouyer Exp $ */
+/* $NetBSD: clock.c,v 1.64 2016/06/12 09:08:09 jnemeth Exp $ */
/*
*
@@ -29,7 +29,7 @@
#include "opt_xen.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.63 2014/09/21 12:46:15 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.64 2016/06/12 09:08:09 jnemeth Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -471,15 +471,27 @@
KASSERT(err == 0);
#ifdef DOM0OPS
+ const struct sysctlnode *node = NULL;
+
if (!tcdone) { /* Do this only once */
xen_timepush_ticks = 53 * hz + 3; /* avoid exact # of min/sec */
if (xendomain_is_privileged()) {
- sysctl_createv(NULL, 0, NULL, NULL, CTLFLAG_READWRITE,
- CTLTYPE_INT, "xen_timepush_ticks", SYSCTL_DESCR("How often"
- " to update the hypervisor's time-of-day; 0 to disable"),
- sysctl_xen_timepush, 0, &xen_timepush_ticks, 0,
- CTL_MACHDEP, CTL_CREATE, CTL_EOL);
+ sysctl_createv(NULL, 0, NULL, &node, 0,
+ CTLTYPE_NODE, "xen",
+ SYSCTL_DESCR("Xen top level node"),
+ NULL, 0, NULL, 0,
+ CTL_MACHDEP, CTL_CREATE, CTL_EOL);
+ if (node != NULL) {
+ sysctl_createv(NULL, 0, &node, NULL,
+ CTLFLAG_READWRITE, CTLTYPE_INT,
+ "timepush_ticks",
+ SYSCTL_DESCR("How often to update the "
+ "hypervisor's time-of-day; 0 to disable"),
+ sysctl_xen_timepush, 0,
+ &xen_timepush_ticks, 0,
+ CTL_CREATE, CTL_EOL);
+ }
callout_reset(&xen_timepush_co, xen_timepush_ticks,
&xen_timepush, &xen_timepush_co);
}
diff -r bd289e287739 -r e5fc5a5a1d2f sys/arch/xen/xen/hypervisor.c
--- a/sys/arch/xen/xen/hypervisor.c Sun Jun 12 06:21:56 2016 +0000
+++ b/sys/arch/xen/xen/hypervisor.c Sun Jun 12 09:08:09 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.66 2016/05/29 17:06:17 bouyer Exp $ */
+/* $NetBSD: hypervisor.c,v 1.67 2016/06/12 09:08:09 jnemeth Exp $ */
/*
* Copyright (c) 2005 Manuel Bouyer.
@@ -53,12 +53,13 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.66 2016/05/29 17:06:17 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.67 2016/06/12 09:08:09 jnemeth Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/malloc.h>
+#include <sys/sysctl.h>
#include "xenbus.h"
#include "xencons.h"
@@ -203,14 +204,32 @@
#endif /* NPCI */
union hypervisor_attach_cookie hac;
char xen_extra_version[XEN_EXTRAVERSION_LEN];
+ static char xen_version_string[20];
+ int rc;
+ const struct sysctlnode *node = NULL;
xenkernfs_init();
xen_version = HYPERVISOR_xen_version(XENVER_version, NULL);
memset(xen_extra_version, 0, sizeof(xen_extra_version));
HYPERVISOR_xen_version(XENVER_extraversion, xen_extra_version);
- aprint_normal(": Xen version %d.%d%s\n", XEN_MAJOR(xen_version),
+ rc = snprintf(xen_version_string, 20, "%d.%d%s", XEN_MAJOR(xen_version),
XEN_MINOR(xen_version), xen_extra_version);
+ aprint_normal(": Xen version %s\n", xen_version_string);
+ if (rc >= 20)
+ aprint_debug(": xen_version_string truncated\n");
+
+ sysctl_createv(NULL, 0, NULL, &node, 0,
+ CTLTYPE_NODE, "xen",
+ SYSCTL_DESCR("Xen top level node"),
+ NULL, 0, NULL, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL);
+
+ if (node != NULL) {
+ sysctl_createv(NULL, 0, &node, NULL, CTLFLAG_READONLY,
+ CTLTYPE_STRING, "version",
+ SYSCTL_DESCR("Xen hypervisor version"),
+ NULL, 0, xen_version_string, 0, CTL_CREATE, CTL_EOL);
+ }
aprint_verbose_dev(self, "features: ");
#define XEN_TST_F(n) \
Home |
Main Index |
Thread Index |
Old Index