Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull more KVM fixes from Paolo Bonzini:

- fixes for CONFIG_KVM_COMPAT=n

- two updates to the IFU erratum

- selftests build fix

- brown paper bag fix

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
KVM: Add a comment describing the /dev/kvm no_compat handling
KVM: x86/mmu: Take slots_lock when using kvm_mmu_zap_all_fast()
KVM: Forbid /dev/kvm being opened by a compat task when CONFIG_KVM_COMPAT=n
KVM: X86: Reset the three MSR list number variables to 0 in kvm_init_msr_list()
selftests: kvm: fix build with glibc >= 2.30
kvm: x86: disable shattered huge page recovery for PREEMPT_RT.

+27 -6
+7 -3
arch/x86/kvm/mmu.c
··· 51 51 extern bool itlb_multihit_kvm_mitigation; 52 52 53 53 static int __read_mostly nx_huge_pages = -1; 54 + #ifdef CONFIG_PREEMPT_RT 55 + /* Recovery can cause latency spikes, disable it for PREEMPT_RT. */ 56 + static uint __read_mostly nx_huge_pages_recovery_ratio = 0; 57 + #else 54 58 static uint __read_mostly nx_huge_pages_recovery_ratio = 60; 59 + #endif 55 60 56 61 static int set_nx_huge_pages(const char *val, const struct kernel_param *kp); 57 62 static int set_nx_huge_pages_recovery_ratio(const char *val, const struct kernel_param *kp); ··· 6285 6280 6286 6281 if (new_val != old_val) { 6287 6282 struct kvm *kvm; 6288 - int idx; 6289 6283 6290 6284 mutex_lock(&kvm_lock); 6291 6285 6292 6286 list_for_each_entry(kvm, &vm_list, vm_list) { 6293 - idx = srcu_read_lock(&kvm->srcu); 6287 + mutex_lock(&kvm->slots_lock); 6294 6288 kvm_mmu_zap_all_fast(kvm); 6295 - srcu_read_unlock(&kvm->srcu, idx); 6289 + mutex_unlock(&kvm->slots_lock); 6296 6290 6297 6291 wake_up_process(kvm->arch.nx_lpage_recovery_thread); 6298 6292 }
+4
arch/x86/kvm/x86.c
··· 5130 5130 5131 5131 perf_get_x86_pmu_capability(&x86_pmu); 5132 5132 5133 + num_msrs_to_save = 0; 5134 + num_emulated_msrs = 0; 5135 + num_msr_based_features = 0; 5136 + 5133 5137 for (i = 0; i < ARRAY_SIZE(msrs_to_save_all); i++) { 5134 5138 if (rdmsr_safe(msrs_to_save_all[i], &dummy[0], &dummy[1]) < 0) 5135 5139 continue;
+2 -2
tools/testing/selftests/kvm/lib/assert.c
··· 55 55 #pragma GCC diagnostic pop 56 56 } 57 57 58 - static pid_t gettid(void) 58 + static pid_t _gettid(void) 59 59 { 60 60 return syscall(SYS_gettid); 61 61 } ··· 72 72 fprintf(stderr, "==== Test Assertion Failure ====\n" 73 73 " %s:%u: %s\n" 74 74 " pid=%d tid=%d - %s\n", 75 - file, line, exp_str, getpid(), gettid(), 75 + file, line, exp_str, getpid(), _gettid(), 76 76 strerror(errno)); 77 77 test_dump_stack(); 78 78 if (fmt) {
+14 -1
virt/kvm/kvm_main.c
··· 122 122 unsigned long arg); 123 123 #define KVM_COMPAT(c) .compat_ioctl = (c) 124 124 #else 125 + /* 126 + * For architectures that don't implement a compat infrastructure, 127 + * adopt a double line of defense: 128 + * - Prevent a compat task from opening /dev/kvm 129 + * - If the open has been done by a 64bit task, and the KVM fd 130 + * passed to a compat task, let the ioctls fail. 131 + */ 125 132 static long kvm_no_compat_ioctl(struct file *file, unsigned int ioctl, 126 133 unsigned long arg) { return -EINVAL; } 127 - #define KVM_COMPAT(c) .compat_ioctl = kvm_no_compat_ioctl 134 + 135 + static int kvm_no_compat_open(struct inode *inode, struct file *file) 136 + { 137 + return is_compat_task() ? -ENODEV : 0; 138 + } 139 + #define KVM_COMPAT(c) .compat_ioctl = kvm_no_compat_ioctl, \ 140 + .open = kvm_no_compat_open 128 141 #endif 129 142 static int hardware_enable_all(void); 130 143 static void hardware_disable_all(void);