Skip to contentSkip to conversation

Test MSR exits to userspace

PATCH In review Aaron Lewis 3 participants 13 messages Oct 12, 2020 – Dec 3, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover Test MSR exits to userspace

This patchset adds additional testing to the series ("Allow user space to restrict and augment MSR emulation") by Alexander Graf <[email protected]>, and supliments the selftest in that series.

This patchset introduces exception handling into the kvm selftest framework which is then used in the test to be able to handle #GPs that are injected into the guest from userspace.

The test focuses on two main areas:
1) It tests the MSR filter API.
2) It tests MSR permission bitmaps.

v1 -> v2:

- Use exception_handlers instead of gs base to pass table to the guest.
- Move unexpected vector assert to processor.c.

v2 -> v3:

- Add stubs for assert_on_unhandled_exception() in aarch64 and s390x.

Aaron Lewis (4):
selftests: kvm: Fix the segment descriptor layout to match the actual
layout
selftests: kvm: Clear uc so UCALL_NONE is being properly reported
selftests: kvm: Add exception handling to selftests
selftests: kvm: Test MSR exiting to userspace

 tools/testing/selftests/kvm/.gitignore        |   1 +
 tools/testing/selftests/kvm/Makefile          |  20 +-
 .../testing/selftests/kvm/include/kvm_util.h  |   2 +
 .../selftests/kvm/include/x86_64/processor.h  |  26 +-
 .../selftests/kvm/lib/aarch64/processor.c     |   4 +
 .../testing/selftests/kvm/lib/aarch64/ucall.c |   3 +
 tools/testing/selftests/kvm/lib/kvm_util.c    |   5 +
 .../selftests/kvm/lib/kvm_util_internal.h     |   2 +
 .../selftests/kvm/lib/s390x/processor.c       |   4 +
 tools/testing/selftests/kvm/lib/s390x/ucall.c |   3 +
 .../selftests/kvm/lib/x86_64/handlers.S       |  81 +++
 .../selftests/kvm/lib/x86_64/processor.c      | 117 +++-
 .../testing/selftests/kvm/lib/x86_64/ucall.c  |   3 +
 .../kvm/x86_64/userspace_msr_exit_test.c      | 560 ++++++++++++++++++
 14 files changed, 820 insertions(+), 11 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/lib/x86_64/handlers.S
 create mode 100644 tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c
Signature · 1 line
2.28.0.1011.ga647a8990f-goog
#1 lore raw

PATCH v3 1/4 selftests: kvm: Fix the segment descriptor layout to match the actual layout

Fix the layout of 'struct desc64' to match the layout described in the SDM Vol 3, Chapter 3 "Protected-Mode Memory Management", section 3.4.5 "Segment Descriptors", Figure 3-8 "Segment Descriptor". The test added later in this series relies on this and crashes if this layout is not correct.

---
 tools/testing/selftests/kvm/include/x86_64/processor.h | 2 +-
 tools/testing/selftests/kvm/lib/x86_64/processor.c     | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/kvm/include/x86_64/processor.h +1 -1
index 82b7fe16a824..0a65e7bb5249 100644
@@ -59,7 +59,7 @@ struct gpr64_regs {
 struct desc64 {
 	uint16_t limit0;
 	uint16_t base0;
-	unsigned base1:8, s:1, type:4, dpl:2, p:1;
+	unsigned base1:8, type:4, s:1, dpl:2, p:1;
 	unsigned limit1:4, avl:1, l:1, db:1, g:1, base2:8;
 	uint32_t base3;
 	uint32_t zero1;
tools/testing/selftests/kvm/lib/x86_64/processor.c +2 -1
index f6eb34eaa0d2..1ccf6c9b3476 100644
@@ -392,11 +392,12 @@ static void kvm_seg_fill_gdt_64bit(struct kvm_vm *vm, struct kvm_segment *segp)
 	desc->limit0 = segp->limit & 0xFFFF;
 	desc->base0 = segp->base & 0xFFFF;
 	desc->base1 = segp->base >> 16;
-	desc->s = segp->s;
 	desc->type = segp->type;
+	desc->s = segp->s;
 	desc->dpl = segp->dpl;
 	desc->p = segp->present;
 	desc->limit1 = segp->limit >> 16;
+	desc->avl = segp->avl;
 	desc->l = segp->l;
 	desc->db = segp->db;
 	desc->g = segp->g;
Signature · 1 line
2.28.0.1011.ga647a8990f-goog
#2 lore raw

PATCH v3 2/4 selftests: kvm: Clear uc so UCALL_NONE is being properly reported

In reply to Aaron Lewis

Ensure the out value 'uc' in get_ucall() is properly reporting UCALL_NONE if the call fails. The return value will be correctly reported, however, the out parameter 'uc' will not be. Clear the struct to ensure the correct value is being reported in the out parameter.

---
 tools/testing/selftests/kvm/lib/aarch64/ucall.c | 3 +++
 tools/testing/selftests/kvm/lib/s390x/ucall.c   | 3 +++
 tools/testing/selftests/kvm/lib/x86_64/ucall.c  | 3 +++
 3 files changed, 9 insertions(+)
tools/testing/selftests/kvm/lib/aarch64/ucall.c +3 -0
index c8e0ec20d3bf..2f37b90ee1a9 100644
@@ -94,6 +94,9 @@ uint64_t get_ucall(struct kvm_vm *vm, uint32_t vcpu_id, struct ucall *uc)
 	struct kvm_run *run = vcpu_state(vm, vcpu_id);
 	struct ucall ucall = {};
 
+	if (uc)
+		memset(uc, 0, sizeof(*uc));
+
 	if (run->exit_reason == KVM_EXIT_MMIO &&
 	    run->mmio.phys_addr == (uint64_t)ucall_exit_mmio_addr) {
 		vm_vaddr_t gva;
tools/testing/selftests/kvm/lib/s390x/ucall.c +3 -0
index fd589dc9bfab..9d3b0f15249a 100644
@@ -38,6 +38,9 @@ uint64_t get_ucall(struct kvm_vm *vm, uint32_t vcpu_id, struct ucall *uc)
 	struct kvm_run *run = vcpu_state(vm, vcpu_id);
 	struct ucall ucall = {};
 
+	if (uc)
+		memset(uc, 0, sizeof(*uc));
+
 	if (run->exit_reason == KVM_EXIT_S390_SIEIC &&
 	    run->s390_sieic.icptcode == 4 &&
 	    (run->s390_sieic.ipa >> 8) == 0x83 &&    /* 0x83 means DIAGNOSE */
tools/testing/selftests/kvm/lib/x86_64/ucall.c +3 -0
index da4d89ad5419..a3489973e290 100644
@@ -40,6 +40,9 @@ uint64_t get_ucall(struct kvm_vm *vm, uint32_t vcpu_id, struct ucall *uc)
 	struct kvm_run *run = vcpu_state(vm, vcpu_id);
 	struct ucall ucall = {};
 
+	if (uc)
+		memset(uc, 0, sizeof(*uc));
+
 	if (run->exit_reason == KVM_EXIT_IO && run->io.port == UCALL_PIO_PORT) {
 		struct kvm_regs regs;
 
Signature · 1 line
2.28.0.1011.ga647a8990f-goog
#3 lore raw

PATCH v3 3/4 selftests: kvm: Add exception handling to selftests

In reply to Aaron Lewis

Add the infrastructure needed to enable exception handling in selftests. This allows any of the exception and interrupt vectors to be overridden in the guest.

---

v1 -> v2:

- Use exception_handlers instead of gs base to pass table to the guest.
- Move unexpected vector assert to processor.c.

v2 -> v3:

- Add stubs for assert_on_unhandled_exception() in aarch64 and s390x.

---
 tools/testing/selftests/kvm/Makefile          |  19 ++-
 .../testing/selftests/kvm/include/kvm_util.h  |   2 +
 .../selftests/kvm/include/x86_64/processor.h  |  24 ++++
 .../selftests/kvm/lib/aarch64/processor.c     |   4 +
 tools/testing/selftests/kvm/lib/kvm_util.c    |   3 +
 .../selftests/kvm/lib/kvm_util_internal.h     |   2 +
 .../selftests/kvm/lib/s390x/processor.c       |   4 +
 .../selftests/kvm/lib/x86_64/handlers.S       |  81 +++++++++++++
 .../selftests/kvm/lib/x86_64/processor.c      | 114 +++++++++++++++++-
 9 files changed, 244 insertions(+), 9 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/lib/x86_64/handlers.S
tools/testing/selftests/kvm/Makefile +13 -6
index 7ebe71fbca53..aaaf992faf87 100644
@@ -34,7 +34,7 @@ ifeq ($(ARCH),s390)
 endif
 
 LIBKVM = lib/assert.c lib/elf.c lib/io.c lib/kvm_util.c lib/sparsebit.c lib/test_util.c
-LIBKVM_x86_64 = lib/x86_64/processor.c lib/x86_64/vmx.c lib/x86_64/svm.c lib/x86_64/ucall.c
+LIBKVM_x86_64 = lib/x86_64/processor.c lib/x86_64/vmx.c lib/x86_64/svm.c lib/x86_64/ucall.c lib/x86_64/handlers.S
 LIBKVM_aarch64 = lib/aarch64/processor.c lib/aarch64/ucall.c
 LIBKVM_s390x = lib/s390x/processor.c lib/s390x/ucall.c
 
@@ -110,14 +110,21 @@ LDFLAGS += -pthread $(no-pie-option) $(pgste-option)
 include ../lib.mk
 
 STATIC_LIBS := $(OUTPUT)/libkvm.a
-LIBKVM_OBJ := $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM))
-EXTRA_CLEAN += $(LIBKVM_OBJ) $(STATIC_LIBS) cscope.*
+LIBKVM_C := $(filter %.c,$(LIBKVM))
+LIBKVM_S := $(filter %.S,$(LIBKVM))
+LIBKVM_C_OBJ := $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM_C))
+LIBKVM_S_OBJ := $(patsubst %.S, $(OUTPUT)/%.o, $(LIBKVM_S))
+EXTRA_CLEAN += $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ) $(STATIC_LIBS) cscope.*
+
+x := $(shell mkdir -p $(sort $(dir $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ))))
+$(LIBKVM_C_OBJ): $(OUTPUT)/%.o: %.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
 
-x := $(shell mkdir -p $(sort $(dir $(LIBKVM_OBJ))))
-$(LIBKVM_OBJ): $(OUTPUT)/%.o: %.c
+$(LIBKVM_S_OBJ): $(OUTPUT)/%.o: %.S
 	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
 
-$(OUTPUT)/libkvm.a: $(LIBKVM_OBJ)
+LIBKVM_OBJS = $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ)
+$(OUTPUT)/libkvm.a: $(LIBKVM_OBJS)
 	$(AR) crs $@ $^
 
 x := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
tools/testing/selftests/kvm/include/kvm_util.h +2 -0
index 919e161dd289..356930690bea 100644
@@ -294,6 +294,8 @@ int vm_create_device(struct kvm_vm *vm, struct kvm_create_device *cd);
 	memcpy(&(g), _p, sizeof(g));				\
 })
 
+void assert_on_unhandled_exception(struct kvm_vm *vm, uint32_t vcpuid);
+
 /* Common ucalls */
 enum {
 	UCALL_NONE,
tools/testing/selftests/kvm/include/x86_64/processor.h +24 -0
index 0a65e7bb5249..02530dc6339b 100644
@@ -36,6 +36,8 @@
 #define X86_CR4_SMAP		(1ul << 21)
 #define X86_CR4_PKE		(1ul << 22)
 
+#define UNEXPECTED_VECTOR_PORT 0xfff0u
+
 /* General Registers in 64-Bit Mode */
 struct gpr64_regs {
 	u64 rax;
@@ -239,6 +241,11 @@ static inline struct desc_ptr get_idt(void)
 	return idt;
 }
 
+static inline void outl(uint16_t port, uint32_t value)
+{
+	__asm__ __volatile__("outl %%eax, %%dx" : : "d"(port), "a"(value));
+}
+
 #define SET_XMM(__var, __xmm) \
 	asm volatile("movq %0, %%"#__xmm : : "r"(__var) : #__xmm)
 
@@ -338,6 +345,23 @@ uint32_t kvm_get_cpuid_max_basic(void);
 uint32_t kvm_get_cpuid_max_extended(void);
 void kvm_get_cpu_address_width(unsigned int *pa_bits, unsigned int *va_bits);
 
+struct ex_regs {
+	uint64_t rax, rcx, rdx, rbx;
+	uint64_t rbp, rsi, rdi;
+	uint64_t r8, r9, r10, r11;
+	uint64_t r12, r13, r14, r15;
+	uint64_t vector;
+	uint64_t error_code;
+	uint64_t rip;
+	uint64_t cs;
+	uint64_t rflags;
+};
+
+void vm_init_descriptor_tables(struct kvm_vm *vm);
+void vcpu_init_descriptor_tables(struct kvm_vm *vm, uint32_t vcpuid);
+void vm_handle_exception(struct kvm_vm *vm, int vector,
+			void (*handler)(struct ex_regs *));
+
 /*
  * Basic CPU control in CR0
  */
tools/testing/selftests/kvm/lib/aarch64/processor.c +4 -0
index 2afa6618b396..d6c32c328e9a 100644
@@ -350,3 +350,7 @@ void vcpu_args_set(struct kvm_vm *vm, uint32_t vcpuid, unsigned int num, ...)
 
 	va_end(ap);
 }
+
+void assert_on_unhandled_exception(struct kvm_vm *vm, uint32_t vcpuid)
+{
+}
tools/testing/selftests/kvm/lib/kvm_util.c +3 -0
index 74776ee228f2..9a7115071c66 100644
@@ -1195,6 +1195,9 @@ int _vcpu_run(struct kvm_vm *vm, uint32_t vcpuid)
 	do {
 		rc = ioctl(vcpu->fd, KVM_RUN, NULL);
 	} while (rc == -1 && errno == EINTR);
+
+	assert_on_unhandled_exception(vm, vcpuid);
+
 	return rc;
 }
 
tools/testing/selftests/kvm/lib/kvm_util_internal.h +2 -0
index 2ef446520748..f07d383d03a1 100644
@@ -50,6 +50,8 @@ struct kvm_vm {
 	vm_paddr_t pgd;
 	vm_vaddr_t gdt;
 	vm_vaddr_t tss;
+	vm_vaddr_t idt;
+	vm_vaddr_t handlers;
 };
 
 struct vcpu *vcpu_find(struct kvm_vm *vm, uint32_t vcpuid);
tools/testing/selftests/kvm/lib/s390x/processor.c +4 -0
index a88c5d665725..7349bb2e1a24 100644
@@ -241,3 +241,7 @@ void vcpu_dump(FILE *stream, struct kvm_vm *vm, uint32_t vcpuid, uint8_t indent)
 	fprintf(stream, "%*spstate: psw: 0x%.16llx:0x%.16llx\n",
 		indent, "", vcpu->state->psw_mask, vcpu->state->psw_addr);
 }
+
+void assert_on_unhandled_exception(struct kvm_vm *vm, uint32_t vcpuid)
+{
+}
tools/testing/selftests/kvm/lib/x86_64/handlers.S new file +81 -0

81 lines not on this page · raw message

tools/testing/selftests/kvm/lib/x86_64/processor.c +111 -3

132 lines not on this page · raw message

Signature · 1 line
2.28.0.1011.ga647a8990f-goog
Reviewed-by on v3 3/4
#4 lore raw

Re: [PATCH v3 3/4] selftests: kvm: Add exception handling to selftests

Quoted 6 lines · Aaron Lewis

Add the infrastructure needed to enable exception handling in selftests. This allows any of the exception and interrupt vectors to be overridden in the guest.

Alex

Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879

#5 lore raw

PATCH v3 4/4 selftests: kvm: Test MSR exiting to userspace

In reply to Aaron Lewis

Add a selftest to test that when the ioctl KVM_X86_SET_MSR_FILTER is called with an MSR list, those MSRs exit to userspace.

This test uses 3 MSRs to test this:
1. MSR_IA32_XSS, an MSR the kernel knows about.
2. MSR_IA32_FLUSH_CMD, an MSR the kernel does not know about.
3. MSR_NON_EXISTENT, an MSR invented in this test for the purposes of passing a fake MSR from the guest to userspace. KVM just acts as a pass through.

Userspace is also able to inject a #GP. This is demonstrated when MSR_IA32_XSS and MSR_IA32_FLUSH_CMD are misused in the test. When this happens a #GP is initiated in userspace to be thrown in the guest which is handled gracefully by the exception handling framework introduced earlier in this series.

Tests for the generic instruction emulator were also added. For this to work the module parameter kvm.force_emulation_prefix=1 has to be enabled. If it isn't enabled the tests will be skipped.

A test was also added to ensure the MSR permission bitmap is being set correctly by executing reads and writes of MSR_FS_BASE and MSR_GS_BASE in the guest while alternating which MSR userspace should intercept. If the permission bitmap is being set correctly only one of the MSRs should be coming through at a time, and the guest should be able to read and write the other one directly.

---
 tools/testing/selftests/kvm/.gitignore        |   1 +
 tools/testing/selftests/kvm/Makefile          |   1 +
 tools/testing/selftests/kvm/lib/kvm_util.c    |   2 +
 .../kvm/x86_64/userspace_msr_exit_test.c      | 560 ++++++++++++++++++
 4 files changed, 564 insertions(+)
 create mode 100644 tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c
tools/testing/selftests/kvm/.gitignore +1 -0
index 307ceaadbbb9..30686fbb8b9f 100644
@@ -15,6 +15,7 @@
 /x86_64/vmx_preemption_timer_test
 /x86_64/svm_vmcall_test
 /x86_64/sync_regs_test
+/x86_64/userspace_msr_exit_test
 /x86_64/vmx_close_while_nested_test
 /x86_64/vmx_dirty_log_test
 /x86_64/vmx_set_nested_state_test
tools/testing/selftests/kvm/Makefile +1 -0
index aaaf992faf87..7acc14d06ba8 100644
@@ -49,6 +49,7 @@ TEST_GEN_PROGS_x86_64 += x86_64/state_test
 TEST_GEN_PROGS_x86_64 += x86_64/vmx_preemption_timer_test
 TEST_GEN_PROGS_x86_64 += x86_64/svm_vmcall_test
 TEST_GEN_PROGS_x86_64 += x86_64/sync_regs_test
+TEST_GEN_PROGS_x86_64 += x86_64/userspace_msr_exit_test
 TEST_GEN_PROGS_x86_64 += x86_64/vmx_close_while_nested_test
 TEST_GEN_PROGS_x86_64 += x86_64/vmx_dirty_log_test
 TEST_GEN_PROGS_x86_64 += x86_64/vmx_set_nested_state_test
tools/testing/selftests/kvm/lib/kvm_util.c +2 -0
index 9a7115071c66..b662d2d7b07c 100644
@@ -1593,6 +1593,8 @@ static struct exit_reason {
 	{KVM_EXIT_INTERNAL_ERROR, "INTERNAL_ERROR"},
 	{KVM_EXIT_OSI, "OSI"},
 	{KVM_EXIT_PAPR_HCALL, "PAPR_HCALL"},
+	{KVM_EXIT_X86_RDMSR, "RDMSR"},
+	{KVM_EXIT_X86_WRMSR, "WRMSR"},
 #ifdef KVM_EXIT_MEMORY_NOT_PRESENT
 	{KVM_EXIT_MEMORY_NOT_PRESENT, "MEMORY_NOT_PRESENT"},
 #endif
tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c new file +560 -0

560 lines not on this page · raw message

Signature · 1 line
2.28.0.1011.ga647a8990f-goog
#6 lore raw

Re: [PATCH v3 4/4] selftests: kvm: Test MSR exiting to userspace

Quoted 30 lines · Aaron Lewis

Add a selftest to test that when the ioctl KVM_X86_SET_MSR_FILTER is called with an MSR list, those MSRs exit to userspace.

This test uses 3 MSRs to test this:
1. MSR_IA32_XSS, an MSR the kernel knows about.
2. MSR_IA32_FLUSH_CMD, an MSR the kernel does not know about.
3. MSR_NON_EXISTENT, an MSR invented in this test for the purposes of passing a fake MSR from the guest to userspace. KVM just acts as a pass through.

Userspace is also able to inject a #GP. This is demonstrated when MSR_IA32_XSS and MSR_IA32_FLUSH_CMD are misused in the test. When this happens a #GP is initiated in userspace to be thrown in the guest which is handled gracefully by the exception handling framework introduced earlier in this series.

Tests for the generic instruction emulator were also added. For this to work the module parameter kvm.force_emulation_prefix=1 has to be enabled. If it isn't enabled the tests will be skipped.

A test was also added to ensure the MSR permission bitmap is being set correctly by executing reads and writes of MSR_FS_BASE and MSR_GS_BASE in the guest while alternating which MSR userspace should intercept. If the permission bitmap is being set correctly only one of the MSRs should be coming through at a time, and the guest should be able to read and write the other one directly.

Quoted 8 lines
---
 tools/testing/selftests/kvm/.gitignore        |   1 +
 tools/testing/selftests/kvm/Makefile          |   1 +
 tools/testing/selftests/kvm/lib/kvm_util.c    |   2 +
 .../kvm/x86_64/userspace_msr_exit_test.c      | 560 ++++++++++++++++++
 4 files changed, 564 insertions(+)
 create mode 100644 tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c

It looks like the rest of this patchset has been accepted upstream. Is this one okay to be taken too?

maintainer
#7 lore raw

Re: [PATCH v3 4/4] selftests: kvm: Test MSR exiting to userspace

Quoted 10 lines · Aaron Lewis
Quoted 10 lines
---
  tools/testing/selftests/kvm/.gitignore        |   1 +
  tools/testing/selftests/kvm/Makefile          |   1 +
  tools/testing/selftests/kvm/lib/kvm_util.c    |   2 +
  .../kvm/x86_64/userspace_msr_exit_test.c      | 560 ++++++++++++++++++
  4 files changed, 564 insertions(+)

create mode 100644 tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c

Quoted 3 lines

It looks like the rest of this patchset has been accepted upstream. Is this one okay to be taken too?

I needed more time to understand the overlap between the tests, but yes.

Paolo

#8 lore raw

Re: [PATCH v3 4/4] selftests: kvm: Test MSR exiting to userspace

Quoted 12 lines · Paolo Bonzini
Quoted 10 lines · Aaron Lewis
Quoted 10 lines
---
  tools/testing/selftests/kvm/.gitignore        |   1 +
  tools/testing/selftests/kvm/Makefile          |   1 +
  tools/testing/selftests/kvm/lib/kvm_util.c    |   2 +
  .../kvm/x86_64/userspace_msr_exit_test.c      | 560 ++++++++++++++++++
  4 files changed, 564 insertions(+)

create mode 100644 tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c

Quoted 8 lines
Quoted 3 lines

It looks like the rest of this patchset has been accepted upstream. Is this one okay to be taken too?

I needed more time to understand the overlap between the tests, but yes.

Paolo

Pinging this thread.

Just wanted to check if this will be upstreamed soon or if there are any questions about it.

maintainer
#9 lore raw

Re: [PATCH v3 4/4] selftests: kvm: Test MSR exiting to userspace

Quoted 19 lines · Aaron Lewis
Quoted 18 lines · Paolo Bonzini
Quoted 10 lines · Aaron Lewis
Quoted 10 lines
---
   tools/testing/selftests/kvm/.gitignore        |   1 +
   tools/testing/selftests/kvm/Makefile          |   1 +
   tools/testing/selftests/kvm/lib/kvm_util.c    |   2 +
   .../kvm/x86_64/userspace_msr_exit_test.c      | 560 ++++++++++++++++++
   4 files changed, 564 insertions(+)

create mode 100644 tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c

Quoted 3 lines

It looks like the rest of this patchset has been accepted upstream. Is this one okay to be taken too?

I needed more time to understand the overlap between the tests, but yes.

Quoted 7 lines
Quoted 2 lines

Paolo

Pinging this thread.

Just wanted to check if this will be upstreamed soon or if there are any questions about it.

Yes, I'm queuing it. Any objections to replacing x86_64/user_msr_test.c completely, since this test is effectively a superset?

Paolo

#10 lore raw

Re: [PATCH v3 4/4] selftests: kvm: Test MSR exiting to userspace

Quoted 26 lines · Paolo Bonzini
Quoted 24 lines · Aaron Lewis
Quoted 12 lines · Paolo Bonzini
Quoted 10 lines · Aaron Lewis
Quoted 10 lines
---
   tools/testing/selftests/kvm/.gitignore        |   1 +
   tools/testing/selftests/kvm/Makefile          |   1 +
   tools/testing/selftests/kvm/lib/kvm_util.c    |   2 +
   .../kvm/x86_64/userspace_msr_exit_test.c      | 560 ++++++++++++++++++
   4 files changed, 564 insertions(+)

create mode 100644 tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c

Quoted 8 lines
Quoted 3 lines

It looks like the rest of this patchset has been accepted upstream. Is this one okay to be taken too?

I needed more time to understand the overlap between the tests, but yes.

Paolo

Pinging this thread.

Quoted 8 lines
Quoted 2 lines

Just wanted to check if this will be upstreamed soon or if there are any questions about it.

Yes, I'm queuing it. Any objections to replacing x86_64/user_msr_test.c completely, since this test is effectively a superset?

Paolo

Hi Paolo,

The main difference between the two tests is my test does not exercise the KVM_MSR_FILTER_DEFAULT_DENY flag. If Alex is okay with that test being replaced I'm okay with it. However, I wouldn't be opposed to adding it from user_msr_test.c into mine. That way they are all in one place.

Cheers,
Aaron

#11 lore raw

Re: [PATCH v3 4/4] selftests: kvm: Test MSR exiting to userspace

Quoted 40 lines · Aaron Lewis

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Quoted 26 lines · Paolo Bonzini
Quoted 24 lines · Aaron Lewis
Quoted 12 lines · Paolo Bonzini
Quoted 10 lines · Aaron Lewis
Quoted 10 lines
---
    tools/testing/selftests/kvm/.gitignore        |   1 +
    tools/testing/selftests/kvm/Makefile          |   1 +
    tools/testing/selftests/kvm/lib/kvm_util.c    |   2 +
    .../kvm/x86_64/userspace_msr_exit_test.c      | 560 ++++++++++++++++++
    4 files changed, 564 insertions(+)
    create mode 100644 tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c
Quoted 8 lines
Quoted 3 lines

It looks like the rest of this patchset has been accepted upstream. Is this one okay to be taken too?

I needed more time to understand the overlap between the tests, but yes.

Paolo

Pinging this thread.

Quoted 8 lines
Quoted 2 lines

Just wanted to check if this will be upstreamed soon or if there are any questions about it.

Yes, I'm queuing it. Any objections to replacing x86_64/user_msr_test.c completely, since this test is effectively a superset?

Paolo

Quoted 7 lines

Hi Paolo,

The main difference between the two tests is my test does not exercise the KVM_MSR_FILTER_DEFAULT_DENY flag. If Alex is okay with that test being replaced I'm okay with it. However, I wouldn't be opposed to adding it from user_msr_test.c into mine. That way they are all in one place.

I think that would be best. Would you happen to have some time to just merge them quickly? It's probably best to first apply both, and then have one patch that merges them. :)

Thanks!

Alex

Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879

#12 lore raw

Re: [PATCH v3 4/4] selftests: kvm: Test MSR exiting to userspace

Quoted 15 lines
Quoted 7 lines
Quoted 6 lines

Yes, I'm queuing it. Any objections to replacing x86_64/user_msr_test.c completely, since this test is effectively a superset?

Paolo

Quoted 7 lines

Hi Paolo,

The main difference between the two tests is my test does not exercise the KVM_MSR_FILTER_DEFAULT_DENY flag. If Alex is okay with that test being replaced I'm okay with it. However, I wouldn't be opposed to adding it from user_msr_test.c into mine. That way they are all in one place.

Quoted 3 lines

I think that would be best. Would you happen to have some time to just merge them quickly? It's probably best to first apply both, and then have one patch that merges them. :)

Yes, I can merge them.

Quoted 17 lines

Thanks!

Alex

Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879