Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libnvmm Implement nvmm_vcpu::stop, a race-free exit from...
details: https://anonhg.NetBSD.org/src/rev/1b5ed2498506
branches: trunk
changeset: 954357:1b5ed2498506
user: reinoud <reinoud%NetBSD.org@localhost>
date: Tue Apr 06 08:40:17 2021 +0000
description:
Implement nvmm_vcpu::stop, a race-free exit from nvmm_vcpu_run() without
signals. This introduces a new kernel and userland NVMM version indicating
this support.
Patch by Kamil Rytarowski <kamil%netbsd.org@localhost> and committed on his request.
This is the missing libnvmm part I forgot to include in the origional commit.
diffstat:
lib/libnvmm/libnvmm.c | 12 +++++++++++-
lib/libnvmm/nvmm.h | 12 ++++++++++--
2 files changed, 21 insertions(+), 3 deletions(-)
diffs (68 lines):
diff -r 9076372f4b78 -r 1b5ed2498506 lib/libnvmm/libnvmm.c
--- a/lib/libnvmm/libnvmm.c Tue Apr 06 08:19:15 2021 +0000
+++ b/lib/libnvmm/libnvmm.c Tue Apr 06 08:40:17 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: libnvmm.c,v 1.19 2020/09/05 07:22:25 maxv Exp $ */
+/* $NetBSD: libnvmm.c,v 1.20 2021/04/06 08:40:17 reinoud Exp $ */
/*
* Copyright (c) 2018-2020 Maxime Villard, m00nbsd.net
@@ -310,6 +310,7 @@
vcpu->cpuid = cpuid;
vcpu->state = &comm->state;
vcpu->event = &comm->event;
+ vcpu->stop = &comm->stop;
vcpu->exit = malloc(sizeof(*vcpu->exit));
return 0;
@@ -561,3 +562,12 @@
return 0;
}
+
+int
+nvmm_vcpu_stop(struct nvmm_vcpu *vcpu)
+{
+
+ *vcpu->stop = 1;
+
+ return 0;
+}
diff -r 9076372f4b78 -r 1b5ed2498506 lib/libnvmm/nvmm.h
--- a/lib/libnvmm/nvmm.h Tue Apr 06 08:19:15 2021 +0000
+++ b/lib/libnvmm/nvmm.h Tue Apr 06 08:40:17 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nvmm.h,v 1.18 2020/09/05 07:22:25 maxv Exp $ */
+/* $NetBSD: nvmm.h,v 1.19 2021/04/06 08:40:17 reinoud Exp $ */
/*
* Copyright (c) 2018-2020 Maxime Villard, m00nbsd.net
@@ -37,7 +37,12 @@
#include <dev/nvmm/nvmm.h>
#include <dev/nvmm/nvmm_ioctl.h>
-#define NVMM_USER_VERSION 1
+#define NVMM_USER_VERSION 2
+
+/*
+ * Version 1 - Initial release in NetBSD 9.0.
+ * Version 2 - Added nvmm_vcpu::stop.
+ */
struct nvmm_io;
struct nvmm_mem;
@@ -59,6 +64,7 @@
struct nvmm_vcpu_state *state;
struct nvmm_vcpu_event *event;
struct nvmm_vcpu_exit *exit;
+ volatile int *stop;
};
struct nvmm_io {
@@ -123,4 +129,6 @@
int nvmm_vcpu_dump(struct nvmm_machine *, struct nvmm_vcpu *);
+int nvmm_vcpu_stop(struct nvmm_vcpu *);
+
#endif /* _LIBNVMM_H_ */
Home |
Main Index |
Thread Index |
Old Index