KVM uq/master changes for 2014-01-20
Anthony,
the following changes since commit 6747f6456fd1e5e986b6385ff5d706c79ebd8a32:
Merge remote-tracking branch 'rth/tcg-temp-order' into staging (2013-12-10 16:14:36 -0800)
are available in the git repository at:
git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git uq/master
for you to fetch changes up to 584f2be79de148b0765a758ac0c1036a29c5e830:
kvm: always update the MPX model specific register (2014-01-20 14:25:22 +0100)
Many small bug fixes, and the userspace side of MPX support.
Paolo
----------------------------------------------------------------
Alexander Graf (1):
roms: Flush icache when writing roms to guest memory
Alexey Kardashevskiy (1):
KVM: fix addr type for KVM_IOEVENTFD
Fernando Luis Vázquez Cao (2):
target-i386: do not special case TSC writeback
target-i386: clear guest TSC on reset
Jan Kiszka (1):
kvm: x86: Separately write feature control MSR on reset
Liu Jinsong (1):
target-i386: Intel MPX
Marcelo Tosatti (1):
mempath prefault: fix off-by-one error
Paolo Bonzini (1):
kvm: always update the MPX model specific register
thomas knych (1):
KVM: Retry KVM_CREATE_VM on EINTR
exec.c | 46 ++++++++++++++++++++++++++----- hw/core/loader.c | 7 +++++ include/exec/cpu-common.h | 1 + kvm-all.c | 14 +++++++--- target-i386/cpu.c | 7 +++++ target-i386/cpu.h | 25 ++++++++++++++--- target-i386/kvm.c | 69 ++++++++++++++++++++++++++++++++++++----------- target-i386/machine.c | 51 +++++++++++++++++++++++++++++++++++ 8 files changed, 192 insertions(+), 28 deletions(-)
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 1/9] target-i386: Intel MPX
From: Liu Jinsong <[email protected]>
Add some MPX related definiation, and hardcode sizes and offsets of xsave features 3 and 4. It also add corresponding part to kvm_get/put_xsave, and vmstate.
--- target-i386/cpu.c | 4 ++++ target-i386/cpu.h | 25 ++++++++++++++++++++++--- target-i386/kvm.c | 24 ++++++++++++++++++++++++ target-i386/machine.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+), 3 deletions(-)
target-i386/cpu.c +4 -0
@@ -336,6 +336,10 @@ typedef struct ExtSaveArea {static const ExtSaveArea ext_save_areas[] = { [2 ] = { .feature =FEAT_1_ECX , .bits =CPUID_EXT_AVX , .offset =0x240 , .size =0x100 }, + [3 ] = { .feature =FEAT_7_0_EBX , .bits =CPUID_7_0_EBX_MPX , + .offset =0x3c0 , .size =0x40 }, + [4 ] = { .feature =FEAT_7_0_EBX , .bits =CPUID_7_0_EBX_MPX , + .offset =0x400 , .size =0x10 }, };const char *get_register_name_32 (unsigned int reg)
target-i386/cpu.h +22 -3
@@ -380,9 +380,14 @@#define MSR_VM_HSAVE_PA 0xc0010117 -#define XSTATE_FP 1 -#define XSTATE_SSE 2 -#define XSTATE_YMM 4 +#define MSR_IA32_BNDCFGS 0x00000d90 + +#define XSTATE_FP (1ULL << 0) +#define XSTATE_SSE (1ULL << 1) +#define XSTATE_YMM (1ULL << 2) +#define XSTATE_BNDREGS (1ULL << 3) +#define XSTATE_BNDCSR (1ULL << 4) +/* CPUID feature words */ typedef enum FeatureWord {
@@ -545,6 +550,7 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];#define CPUID_7_0_EBX_ERMS (1 << 9)#define CPUID_7_0_EBX_INVPCID (1 << 10)#define CPUID_7_0_EBX_RTM (1 << 11) +#define CPUID_7_0_EBX_MPX (1 << 14)#define CPUID_7_0_EBX_RDSEED (1 << 18)#define CPUID_7_0_EBX_ADX (1 << 19)#define CPUID_7_0_EBX_SMAP (1 << 20)
@@ -695,6 +701,16 @@ typedef union {uint64_t q; } MMXReg; +typedef struct BNDReg { +uint64_t lb; +uint64_t ub; +}BNDReg ; + +typedef struct BNDCSReg { +uint64_t cfgu; +uint64_t sts; +}BNDCSReg ; +#ifdef HOST_WORDS_BIGENDIAN #define XMM_B (n) _b[15 - (n)]#define XMM_W (n) _w[7 - (n)]
@@ -912,6 +928,9 @@ typedef struct CPUX86State {uint64_t xstate_bv;XMMReg ymmh_regs[CPU_NB_REGS ]; +BNDReg bnd_regs[4 ]; +BNDCSReg bndcs_regs; +uint64_t msr_bndcfgs;uint64_t xcr0;
target-i386/kvm.c +24 -0
@@ -69,6 +69,7 @@ static bool has_msr_feature_control;static bool has_msr_async_pf_en;static bool has_msr_pv_eoi_en;static bool has_msr_misc_enable; +static bool has_msr_bndcfgs;static bool has_msr_kvm_steal_time;static int lm_capable_kernel;
@@ -772,6 +773,10 @@ static int kvm_get_supported_msrs(KVMState *s) has_msr_misc_enable = true;continue ; } +if (kvm_msr_list->indices[i] ==MSR_IA32_BNDCFGS ) { + has_msr_bndcfgs = true; +continue ; + } } }
@@ -975,6 +980,8 @@ static int kvm_put_fpu(X86CPU *cpu)#define XSAVE_XMM_SPACE 40#define XSAVE_XSTATE_BV 128#define XSAVE_YMMH_SPACE 144 +#define XSAVE_BNDREGS 240 +#define XSAVE_BNDCSR 256static int kvm_put_xsave (X86CPU *cpu) {
@@ -1007,6 +1014,10 @@ static int kvm_put_xsave(X86CPU *cpu) *(uint64_t *)&xsave->region[XSAVE_XSTATE_BV ] = env->xstate_bv;memcpy (&xsave->region[XSAVE_YMMH_SPACE ], env->ymmh_regs,sizeof env->ymmh_regs); +memcpy (&xsave->region[XSAVE_BNDREGS ], env->bnd_regs, +sizeof env->bnd_regs); +memcpy (&xsave->region[XSAVE_BNDCSR ], &env->bndcs_regs, +sizeof (env->bndcs_regs)); r =kvm_vcpu_ioctl (CPU (cpu),KVM_SET_XSAVE , xsave);return r; }
@@ -1208,6 +1219,9 @@ static int kvm_put_msrs(X86CPU *cpu, int level)kvm_msr_entry_set (&msrs[n++],MSR_IA32_FEATURE_CONTROL , env->msr_ia32_feature_control); } +if (has_msr_bndcfgs) { +kvm_msr_entry_set (&msrs[n++],MSR_IA32_BNDCFGS , env->msr_bndcfgs); + } }if (env->mcg_cap) {int i;
@@ -1289,6 +1303,10 @@ static int kvm_get_xsave(X86CPU *cpu) env->xstate_bv = *(uint64_t *)&xsave->region[XSAVE_XSTATE_BV ];memcpy (env->ymmh_regs, &xsave->region[XSAVE_YMMH_SPACE ],sizeof env->ymmh_regs); +memcpy (env->bnd_regs, &xsave->region[XSAVE_BNDREGS ], +sizeof env->bnd_regs); +memcpy (&env->bndcs_regs, &xsave->region[XSAVE_BNDCSR ], +sizeof (env->bndcs_regs));return 0 ; }
@@ -1435,6 +1453,9 @@ static int kvm_get_msrs(X86CPU *cpu)if (has_msr_feature_control) { msrs[n++].index =MSR_IA32_FEATURE_CONTROL ; } +if (has_msr_bndcfgs) { + msrs[n++].index =MSR_IA32_BNDCFGS ; + }if (!env->tsc_valid) { msrs[n++].index =MSR_IA32_TSC ;
@@ -1550,6 +1571,9 @@ static int kvm_get_msrs(X86CPU *cpu)case MSR_IA32_FEATURE_CONTROL : env->msr_ia32_feature_control = msrs[i].data;break ; +case MSR_IA32_BNDCFGS : + env->msr_bndcfgs = msrs[i].data; +break ;default :if (msrs[i].index >=MSR_MC0_CTL && msrs[i].index <MSR_MC0_CTL + (env->mcg_cap &0xff ) *4 ) {
target-i386/machine.c +51 -0
69 lines not on this page · raw message
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 4/9] roms: Flush icache when writing roms to guest memory
In reply to Paolo BonziniFrom: Alexander Graf <[email protected]>
We use the rom infrastructure to write firmware and/or initial kernel blobs into guest address space. So we're basically emulating the cache off phase on very early system bootup.
That phase is usually responsible for clearing the instruction cache for anything it writes into cachable memory, to ensure that after reboot we don't happen to execute stale bits from the instruction cache.
So we need to invalidate the icache every time we write a rom into guest address space. We do not need to do this for every DMA since the guest expects it has to flush the icache manually in that case.
This fixes random reboot issues on e5500 (booke ppc) for me.
--- exec.c | 44 +++++++++++++++++++++++++++++++++++++++----- hw/core/loader.c | 7 +++++++ include/exec/cpu-common.h | 1 + 3 files changed, 47 insertions(+), 5 deletions(-)
exec.c +39 -5
@@ -50,6 +50,7 @@#include "translate-all.h" #include "exec/memory-internal.h" +#include "qemu/cache-utils.h" //#define DEBUG_SUBPAGE
@@ -2010,9 +2011,13 @@ void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,address_space_rw (&address_space_memory, addr, buf, len, is_write); } -/* used for ROM loading : can write in RAM and ROM */ -void cpu_physical_memory_write_rom (hwaddr addr, -const uint8_t *buf,int len) +enum write_rom_type { +WRITE_DATA , +FLUSH_CACHE , +}; + +static inline void cpu_physical_memory_write_rom_internal ( +hwaddr addr,const uint8_t *buf,int len,enum write_rom_type type) {hwaddr l;uint8_t *ptr;
@@ -2031,8 +2036,15 @@ void cpu_physical_memory_write_rom(hwaddr addr, addr1 +=memory_region_get_ram_addr (mr);/* ROM/RAM case */ ptr =qemu_get_ram_ptr (addr1); -memcpy (ptr, buf, l); -invalidate_and_set_dirty (addr1, l); +switch (type) { +case WRITE_DATA : +memcpy (ptr, buf, l); +invalidate_and_set_dirty (addr1, l); +break ; +case FLUSH_CACHE : +flush_icache_range ((uintptr_t )ptr, (uintptr_t )ptr + l); +break ; + } } len -= l; buf += l;
@@ -2040,6 +2052,28 @@ void cpu_physical_memory_write_rom(hwaddr addr, } } +/* used for ROM loading : can write in RAM and ROM */ +void cpu_physical_memory_write_rom (hwaddr addr, +const uint8_t *buf,int len) +{ +cpu_physical_memory_write_rom_internal (addr, buf, len,WRITE_DATA ); +} + +void cpu_flush_icache_range (hwaddr start,int len) +{ +/* +* This function should do the same thing as an icache flush that was +* triggered from within the guest. For TCG we are always cache coherent, +* so there is no need to flush anything. For KVM / Xen we need to flush +* the host's instruction cache at least. +*/ +if (tcg_enabled ()) { +return ; + } + +cpu_physical_memory_write_rom_internal (start,NULL , len,FLUSH_CACHE ); +} + typedef struct { MemoryRegion *mr; void *buffer;
hw/core/loader.c +7 -0
@@ -785,6 +785,13 @@ static void rom_reset(void *unused)g_free (rom->data); rom->data =NULL ; } +/* +* The rom loader is really on the same level as firmware in the guest +* shadowing a ROM into RAM. Such a shadowing mechanism needs to ensure +* that the instruction cache for that new region is clear, so that the +* CPU definitely fetches its instructions from the just written data. +*/ +cpu_flush_icache_range (rom->addr, rom->datasize); } }
include/exec/cpu-common.h +1 -0
@@ -110,6 +110,7 @@ void stq_phys(hwaddr addr, uint64_t val);void cpu_physical_memory_write_rom (hwaddr addr,const uint8_t *buf,int len); +void cpu_flush_icache_range (hwaddr start,int len);extern struct MemoryRegion io_mem_rom;extern struct MemoryRegion io_mem_notdirty;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 2/9] target-i386: do not special case TSC writeback
In reply to Paolo BonziniFrom: Fernando Luis Vázquez Cao <[email protected]>
Newer kernels are capable of synchronizing TSC values of multiple VCPUs on writeback, but we were excluding the power up case, which is not needed anymore.
--- target-i386/kvm.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
target-i386/kvm.c +1 -9
@@ -1151,15 +1151,7 @@ static int kvm_put_msrs(X86CPU *cpu, int level) }#endif if (level ==KVM_PUT_FULL_STATE ) { -/* -* KVM is yet unable to synchronize TSC values of multiple VCPUs on -* writeback. Until this is fixed, we only write the offset to SMP -* guests after migration, desynchronizing the VCPUs, but avoiding -* huge jump-backs that would occur without any writeback at all. -*/ -if (smp_cpus ==1 || env->tsc !=0 ) { -kvm_msr_entry_set (&msrs[n++],MSR_IA32_TSC , env->tsc); - } +kvm_msr_entry_set (&msrs[n++],MSR_IA32_TSC , env->tsc); }/* * The following MSRs have side effects on the guest or are too heavy
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 3/9] target-i386: clear guest TSC on reset
In reply to Paolo BonziniFrom: Fernando Luis Vázquez Cao <[email protected]>
VCPU TSC is not cleared by a warm reset (*), which leaves some types of Linux
guests (non-pvops guests and those with the kernel parameter no-kvmclock set)
vulnerable to the overflow in cyc2ns_offset fixed by upstream commit 9993bc635d01a6ee7f6b833b4ee65ce7c06350b1 ("sched/x86: Fix overflow in cyc2ns_offset").
To put it in a nutshell, if such a Linux guest without the patch above applied has been up more than 208 days and attempts a warm reset chances are that the newly booted kernel will panic or hang.
(*) Intel Xeon E5 processors show the same broken behavior due to
the errata "TSC is Not Affected by Warm Reset" (Intel® Xeon® Processor E5 Family Specification Update - August 2013): "The TSC (Time Stamp Counter MSR 10H) should be cleared on reset. Due to this erratum the TSC is not affected by warm reset."
--- target-i386/cpu.c | 3 +++ target-i386/kvm.c | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-)
target-i386/cpu.c +3 -0
@@ -2450,6 +2450,9 @@ static void x86_cpu_reset(CPUState *s)cpu_breakpoint_remove_all (env,BP_CPU );cpu_watchpoint_remove_all (env,BP_CPU ); + env->tsc_adjust =0 ; + env->tsc =0 ; +#if !defined(CONFIG_USER_ONLY )/* We hard-wire the BSP to the first CPU. */ if (s->cpu_index ==0 ) {
target-i386/kvm.c +1 -3
@@ -1150,14 +1150,12 @@ static int kvm_put_msrs(X86CPU *cpu, int level) kvm_msr_entry_set(&msrs[n++], MSR_LSTAR, env->lstar); }#endif -if (level ==KVM_PUT_FULL_STATE ) { -kvm_msr_entry_set (&msrs[n++],MSR_IA32_TSC , env->tsc); - }/* * The following MSRs have side effects on the guest or are too heavy * for normal writeback. Limit them to reset or full state updates. */ if (level >=KVM_PUT_RESET_STATE ) { +kvm_msr_entry_set (&msrs[n++],MSR_IA32_TSC , env->tsc);kvm_msr_entry_set (&msrs[n++],MSR_KVM_SYSTEM_TIME , env->system_time_msr);kvm_msr_entry_set (&msrs[n++],MSR_KVM_WALL_CLOCK , env->wall_clock_msr);
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 5/9] kvm: x86: Separately write feature control MSR on reset
In reply to Paolo BonziniFrom: Jan Kiszka <[email protected]>
If the guest is running in nested mode on system reset, clearing the feature MSR signals the kernel to leave this mode. Recent kernels processes this properly, but leave the VCPU state undefined behind. It is the job of userspace to bring it to a proper shape. Therefore, write this specific MSR first so that no state transfer gets lost.
This allows to cleanly reset a guest with VMX in use.
--- target-i386/kvm.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-)
target-i386/kvm.c +29 -4
@@ -1115,6 +1115,25 @@ static int kvm_put_tscdeadline_msr(X86CPU *cpu)return kvm_vcpu_ioctl (CPU (cpu),KVM_SET_MSRS , &msr_data); } +/* +* Provide a separate write service for the feature control MSR in order to +* kick the VCPU out of VMXON or even guest mode on reset. This has to be done +* before writing any other state because forcibly leaving nested mode +* invalidates the VCPU state. +*/ +static int kvm_put_msr_feature_control (X86CPU *cpu) +{ +struct { +struct kvm_msrs info; +struct kvm_msr_entry entry; + } msr_data; + +kvm_msr_entry_set (&msr_data.entry,MSR_IA32_FEATURE_CONTROL , + cpu->env.msr_ia32_feature_control); + msr_data.info.nmsrs =1 ; +return kvm_vcpu_ioctl (CPU (cpu),KVM_SET_MSRS , &msr_data); +} +static int kvm_put_msrs (X86CPU *cpu,int level) {CPUX86State *env = &cpu->env;
@@ -1205,13 +1224,12 @@ static int kvm_put_msrs(X86CPU *cpu, int level)if (cpu->hyperv_vapic) {kvm_msr_entry_set (&msrs[n++],HV_X64_MSR_APIC_ASSIST_PAGE ,0 ); } -if (has_msr_feature_control) { -kvm_msr_entry_set (&msrs[n++],MSR_IA32_FEATURE_CONTROL , - env->msr_ia32_feature_control); - }if (has_msr_bndcfgs) {kvm_msr_entry_set (&msrs[n++],MSR_IA32_BNDCFGS , env->msr_bndcfgs); } + +/* Note: MSR_IA32_FEATURE_CONTROL is written separately, see +* kvm_put_msr_feature_control. */ }if (env->mcg_cap) {int i;
@@ -1815,6 +1833,13 @@ int kvm_arch_put_registers(CPUState *cpu, int level)assert (cpu_is_stopped (cpu) ||qemu_cpu_is_self (cpu)); +if (level >=KVM_PUT_RESET_STATE && has_msr_feature_control) { + ret =kvm_put_msr_feature_control (x86_cpu); +if (ret <0 ) { +return ret; + } + } + ret =kvm_getput_regs (x86_cpu,1 );if (ret <0 ) {return ret;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 7/9] KVM: Retry KVM_CREATE_VM on EINTR
In reply to Paolo BonziniFrom: thomas knych <[email protected]>
Upstreaming this change from Android (https://android-review.googlesource.com/54211).
On heavily loaded machines with many VM instances we see KVM_CREATE_VM failing with EINTR on this path:
kvm_dev_ioctl_create_vm -> kvm_create_vm -> kvm_init_mmu_notifier -> mmu_notifier_register -> do_mmu_notifier_register -> mm_take_all_locks
which checks if any signals have been raised while it was attaining locks and returns EINTR. Retrying the system call greatly improves reliability.
--- kvm-all.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
kvm-all.c +9 -3
@@ -1442,16 +1442,22 @@ int kvm_init(void) nc++; } - s->vmfd =kvm_ioctl (s,KVM_CREATE_VM ,0 ); -if (s->vmfd <0 ) { +do { + ret =kvm_ioctl (s,KVM_CREATE_VM ,0 ); + }while (ret == -EINTR ); + +if (ret <0 ) { +fprintf (stderr,"ioctl(KVM_CREATE_VM) failed: %d %s\n" , -s->vmfd, +strerror (-ret)); +#ifdef TARGET_S390X fprintf (stderr,"Please add the 'switch_amode' kernel parameter to " "your host kernel command line\n" );#endif - ret = s->vmfd; goto err; } + s->vmfd = ret; missing_cap =kvm_check_extension_list (s, kvm_required_capabilites);if (!missing_cap) { missing_cap =
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PULL 7/9] KVM: Retry KVM_CREATE_VM on EINTR
Quoted 25 lines · Paolo Bonzini
From: thomas knych <[email protected]>
Upstreaming this change from Android (https://android-review.googlesource.com/54211).
On heavily loaded machines with many VM instances we see
KVM_CREATE_VMfailing with EINTR on this path:
kvm_dev_ioctl_create_vm->kvm_create_vm->kvm_init_mmu_notifier->mmu_notifier_register->do_mmu_notifier_register->mm_take_all_lockswhich checks if any signals have been raised while it was attaining locks and returns EINTR. Retrying the system call greatly improves reliability.
Signed-off-by thomas knych <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>---
kvm-all.c| 12 +++++++++---1 file changed, 9 insertions(+), 3 deletions(-)kvm-all.c +0
-0@@ -1442,16 +1442,22 @@ int kvm_init(void) nc++;
kvm-all.c int kvm_init(void) · line 1450
Quoted 10 lines
kvm-all.c +6
-2} - s->vmfd =kvm_ioctl (s,KVM_CREATE_VM ,0 ); -if (s->vmfd <0 ) { +do { + ret =kvm_ioctl (s,KVM_CREATE_VM ,0 ); + }while (ret == -EINTR ); + +if (ret <0 ) { + fprintf(stderr, "ioctl(KVM_CREATE_VM) failed: %d %s\n", -s->vmfd,
Shouldn't this be -ret?
Alex
Quoted 19 lines
kvm-all.c +3
-1+ strerror(-ret)); +#ifdef TARGET_S390X fprintf (stderr,"Please add the 'switch_amode' kernel parameter to " "your host kernel command line\n" );#endif - ret = s->vmfd; goto err; } + s->vmfd = ret; missing_cap =kvm_check_extension_list (s, kvm_required_capabilites);if (!missing_cap) { missing_cap =Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PULL 7/9] KVM: Retry KVM_CREATE_VM on EINTR
Il 27/01/2014 14:44, Alexander Graf ha scritto:
Quoted 30 lines · Paolo Bonzini
Quoted 28 lines
From: thomas knych <[email protected]>
Upstreaming this change from Android (https://android-review.googlesource.com/54211).
On heavily loaded machines with many VM instances we see
KVM_CREATE_VMfailing with EINTR on this path:
kvm_dev_ioctl_create_vm->kvm_create_vm->kvm_init_mmu_notifier->mmu_notifier_register->do_mmu_notifier_register->mm_take_all_lockswhich checks if any signals have been raised while it was attaining locks and returns EINTR. Retrying the system call greatly improves reliability.
Signed-off-by thomas knych <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>---
kvm-all.c| 12 +++++++++---1 file changed, 9 insertions(+), 3 deletions(-)kvm-all.c +0
-0@@ -1442,16 +1442,22 @@ int kvm_init(void) nc++; }
Quoted 10 lines
kvm-all.c int kvm_init(void) · line 1450
Quoted 8 lines
kvm-all.c +6
-2- s->vmfd =kvm_ioctl (s,KVM_CREATE_VM ,0 ); -if (s->vmfd <0 ) { +do { + ret =kvm_ioctl (s,KVM_CREATE_VM ,0 ); + }while (ret == -EINTR ); + +if (ret <0 ) { + fprintf(stderr, "ioctl(KVM_CREATE_VM) failed: %d %s\n", -s->vmfd,Shouldn't this be -ret?
Yes. Can you send a patch?
Paolo
[Qemu-devel] [PULL 9/9] kvm: always update the MPX model specific register
In reply to Paolo BonziniThe original patch from Liu Jinsong restricted them to reset or full state updates, but that's unnecessary (and wrong) since the BNDCFGS MSR has no side effects.
--- target-i386/kvm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
target-i386/kvm.c +3 -3
@@ -1161,6 +1161,9 @@ static int kvm_put_msrs(X86CPU *cpu, int level)kvm_msr_entry_set (&msrs[n++],MSR_IA32_MISC_ENABLE , env->msr_ia32_misc_enable); } +if (has_msr_bndcfgs) { +kvm_msr_entry_set (&msrs[n++],MSR_IA32_BNDCFGS , env->msr_bndcfgs); + }#ifdef TARGET_X86_64 if (lm_capable_kernel) {kvm_msr_entry_set (&msrs[n++],MSR_CSTAR , env->cstar);
@@ -1224,9 +1227,6 @@ static int kvm_put_msrs(X86CPU *cpu, int level)if (cpu->hyperv_vapic) {kvm_msr_entry_set (&msrs[n++],HV_X64_MSR_APIC_ASSIST_PAGE ,0 ); } -if (has_msr_bndcfgs) { -kvm_msr_entry_set (&msrs[n++],MSR_IA32_BNDCFGS , env->msr_bndcfgs); - }/* Note: MSR_IA32_FEATURE_CONTROL is written separately, see * kvm_put_msr_feature_control. */
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PULL 9/9] kvm: always update the MPX model specific register
Yes, I ignore this point. Thanks!
Jinsong
Quoted 35 lines · Paolo Bonzini
The original patch from Liu Jinsong restricted them to reset or full state updates, but that's unnecessary (and wrong) since the BNDCFGS MSR has no side effects.
Cc Liu Jinsong <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>--- target-i386/kvm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)target-i386/kvm.c +2
-3@@ -1161,6 +1161,9 @@ static int kvm_put_msrs(X86CPU *cpu, int level)kvm_msr_entry_set (&msrs[n++],MSR_IA32_MISC_ENABLE , env->msr_ia32_misc_enable); } +if (has_msr_bndcfgs) { +kvm_msr_entry_set (&msrs[n++],MSR_IA32_BNDCFGS , env->msr_bndcfgs); + }#ifdef TARGET_X86_64 if (lm_capable_kernel) {kvm_msr_entry_set (&msrs[n++],MSR_CSTAR , env->cstar);@@ -1224,9 +1227,6 @@ static int kvm_put_msrs(X86CPU *cpu, int level)if (cpu->hyperv_vapic) {kvm_msr_entry_set (&msrs[n++],HV_X64_MSR_APIC_ASSIST_PAGE ,0 ); } -if (has_msr_bndcfgs) { -kvm_msr_entry_set (&msrs[n++],MSR_IA32_BNDCFGS , env->msr_bndcfgs); - }/* Note: MSR_IA32_FEATURE_CONTROL is written separately, see *
kvm_put_msr_feature_control. */
[Qemu-devel] [PULL 6/9] mempath prefault: fix off-by-one error
In reply to Paolo BonziniFrom: Marcelo Tosatti <[email protected]>
Fix off-by-one error (noticed by Andrea Arcangeli).
--- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
exec.c +1 -1
@@ -1001,7 +1001,7 @@ static void *file_ram_alloc(RAMBlock *block, }/* MAP_POPULATE silently ignores failures */ -for (i =0 ; i < (memory/hpagesize)-1 ; i++) { +for (i =0 ; i < (memory/hpagesize); i++) {memset (area + (hpagesize*i),0 ,1 ); }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 8/9] KVM: fix addr type for KVM_IOEVENTFD
In reply to Paolo BonziniFrom: Alexey Kardashevskiy <[email protected]>
The @addr here is a guest physical address and can easily be bigger than 4G.
This changes uint32_t to hwaddr.
--- kvm-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kvm-all.c +1 -1
@@ -519,7 +519,7 @@ int kvm_check_extension(KVMState *s, unsigned int extension)return ret; } -static int kvm_set_ioeventfd_mmio (int fd,uint32_t addr,uint32_t val, +static int kvm_set_ioeventfd_mmio (int fd,hwaddr addr,uint32_t val,bool assign,uint32_t size,bool datamatch) {int ret;
Signature · 1 line
1.8.3.1
Il 20/01/2014 15:44, Paolo Bonzini ha scritto:
Quoted 8 lines
Anthony,
the following changes since commit
6747f6456fd1e5e986b6385ff5d706c79ebd8a32:Merge remote-tracking branch 'rth/tcg-temp-order' into staging (2013-12-10 16:14:36 -0800)
are available in the git repository at:
Quoted 7 lines
git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.gituq/masterfor you to fetch changes up to
584f2be79de148b0765a758ac0c1036a29c5e830:kvm: always update the MPX model specific register (2014-01-20 14:25:22 +0100)
Many small bug fixes, and the userspace side of MPX support.
There is a trivial conflict in the include files of exec.c. Upstream already includes the header that is added in this series.
Paolo