From 0c825583fc20f1b91c56e1aaf450d6a753d24658 Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Thu, 2 Feb 2023 18:38:00 -0600 Subject: qemu-pagestep is quasi-realtime when suppresing slow kernel logging --- util/loglevel.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 util/loglevel.c (limited to 'util/loglevel.c') diff --git a/util/loglevel.c b/util/loglevel.c new file mode 100644 index 0000000..e24923e --- /dev/null +++ b/util/loglevel.c @@ -0,0 +1,34 @@ +#include "cachepc/uapi.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int +main(int argc, const char **argv) +{ + uint32_t arg; + int fd, ret; + + fd = open("/dev/kvm", O_RDONLY); + if (fd < 0) err(1, "open"); + + if (argc > 1 && !strcmp(argv[1], "debug")) + arg = CPC_LOGLVL_DBG; + else if (argc > 1 && !strcmp(argv[1], "info")) + arg = CPC_LOGLVL_INFO; + else + arg = 0; + + printf("loglevel: %i\n", arg); + ret = ioctl(fd, KVM_CPC_LOGLEVEL, &arg); + if (ret == -1) err(1, "ioctl KVM_CPC_LOGLEVEL"); + + close(fd); +} -- cgit v1.2.3-71-gd317