pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

qemu-nvmm: improvements



Module Name:	pkgsrc-wip
Committed By:	Maxime Villard <max%m00nbsd.net@localhost>
Pushed By:	maxv
Date:		Thu Jan 24 14:12:24 2019 +0100
Changeset:	c797277737162b8a6aec892579cff120e2f279d1

Modified Files:
	qemu-nvmm/distinfo
	qemu-nvmm/patches/patch-nvmm-support

Log Message:
qemu-nvmm: improvements

 - Sync HLT with NVMM, no need to manually execute the instruction because
   the kernel does it now. This increases performance.

 - Handle hard shutdowns gracefully. Some livecds don't shut down the
   machine via ACPI and go the hard way.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=c797277737162b8a6aec892579cff120e2f279d1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 qemu-nvmm/distinfo                   |  2 +-
 qemu-nvmm/patches/patch-nvmm-support | 55 ++++++++----------------------------
 2 files changed, 12 insertions(+), 45 deletions(-)

diffs:
diff --git a/qemu-nvmm/distinfo b/qemu-nvmm/distinfo
index 5ad290cb00..2a6c71d78b 100644
--- a/qemu-nvmm/distinfo
+++ b/qemu-nvmm/distinfo
@@ -13,5 +13,5 @@ SHA1 (patch-hw_display_omap__dss.c) = 6b13242f28e32346bc70548c216c578d98fd3420
 SHA1 (patch-hw_net_etraxfs__eth.c) = e5dd1661d60dbcd27b332403e0843500ba9544bc
 SHA1 (patch-hw_net_xilinx__axienet.c) = ebcd2676d64ce6f31e4a8c976d4fdf530ad5e8b7
 SHA1 (patch-hw_usb_dev-mtp.c) = 66543b5559d92f8e2fa9a6eb85e5dfe7c1ad3339
-SHA1 (patch-nvmm-support) = 9bd211a8cf557a10df859bf9c73d865ad4c67d94
+SHA1 (patch-nvmm-support) = c8b47aa128df97ff9c16b6d334bd1ac4b0e7601c
 SHA1 (patch-tests_Makefile.include) = 42345d697cb2e324dccf1d68bd8d61e8001c6162
diff --git a/qemu-nvmm/patches/patch-nvmm-support b/qemu-nvmm/patches/patch-nvmm-support
index 74f8c3ee1b..3710f08141 100644
--- a/qemu-nvmm/patches/patch-nvmm-support
+++ b/qemu-nvmm/patches/patch-nvmm-support
@@ -421,8 +421,8 @@ Add NVMM support.
  obj-$(CONFIG_WHPX) += whpx-all.o
 +obj-$(CONFIG_NVMM) += nvmm-all.o
 --- target/i386/nvmm-all.c	1970-01-01 01:00:00.000000000 +0100
-+++ target/i386/nvmm-all.c	2019-01-13 08:38:19.209949716 +0100
-@@ -0,0 +1,1230 @@
++++ target/i386/nvmm-all.c	2019-01-24 13:08:23.465295728 +0100
+@@ -0,0 +1,1197 @@
 +/*
 + * Copyright (c) 2018 The NetBSD Foundation, Inc.
 + * All rights reserved.
@@ -1058,48 +1058,12 @@ Add NVMM support.
 +}
 +
 +static int
-+nvmm_handle_hlt(struct nvmm_machine *mach, CPUState *cpu,
++nvmm_handle_halted(struct nvmm_machine *mach, CPUState *cpu,
 +    struct nvmm_exit *exit)
 +{
 +	struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr);
-+	struct nvmm_vcpu *vcpu = get_nvmm_vcpu(cpu);
-+	struct nvmm_x64_state state;
 +	int ret = 0;
 +
-+	/*
-+	 * Disable the INT shadow, and the INT window-exiting, to have
-+	 * nvmm_can_take_int() process pending interrupts and take us
-+	 * out of HLT.
-+	 *
-+	 * XXX: This mechanism is not really optimized, maybe it should
-+	 * be done in the kernel.
-+	 */
-+
-+	ret = nvmm_vcpu_getstate(mach, vcpu->cpuid, &state,
-+	    NVMM_X64_STATE_GPRS | NVMM_X64_STATE_MISC);
-+	if (ret == -1) {
-+		return -1;
-+	}
-+
-+	/* Advance RIP. */
-+	state.gprs[NVMM_X64_GPR_RIP] = exit->u.hlt.npc;
-+
-+	/* Disable the INT shadow, if any. */
-+	state.misc[NVMM_X64_MISC_INT_SHADOW] = 0;
-+	vcpu->int_shadow = false;
-+
-+	if (env->eflags & IF_MASK) {
-+		/* Disable the INT window-exiting, if any. */
-+		state.misc[NVMM_X64_MISC_INT_WINDOW_EXIT] = 0;
-+		vcpu->int_window_exit = false;
-+	}
-+
-+	ret = nvmm_vcpu_setstate(mach, vcpu->cpuid, &state,
-+	    NVMM_X64_STATE_GPRS | NVMM_X64_STATE_MISC);
-+	if (ret == -1) {
-+		return -1;
-+	}
-+
 +	qemu_mutex_lock_iothread();
 +
 +	if (!((cpu->interrupt_request & CPU_INTERRUPT_HARD) &&
@@ -1219,19 +1183,22 @@ Add NVMM support.
 +			ret = nvmm_handle_msr(mach, cpu, &exit);
 +			break;
 +		case NVMM_EXIT_INT_READY:
-+			break;
 +		case NVMM_EXIT_NMI_READY:
 +			break;
-+		case NVMM_EXIT_HLT:
-+			ret = nvmm_handle_hlt(mach, cpu, &exit);
-+			break;
 +		case NVMM_EXIT_MONITOR:
 +		case NVMM_EXIT_MWAIT:
 +		case NVMM_EXIT_MWAIT_COND:
 +			ret = nvmm_inject_ud(mach, vcpu);
 +			break;
++		case NVMM_EXIT_HALTED:
++			ret = nvmm_handle_halted(mach, cpu, &exit);
++			break;
++		case NVMM_EXIT_SHUTDOWN:
++			qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
++			cpu->exception_index = EXCP_INTERRUPT;
++			ret = 1;
++			break;
 +
-+		case NVMM_EXIT_SHUTDOWN: /* XXX what to do? */
 +		default:
 +			error_report("NVMM: Unexpected VM exit code %lu",
 +			    exit.reason);


Home | Main Index | Thread Index | Old Index