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 'hyperv-next-signed-20240916' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux

Pull Hyper-V updates from Wei Liu:

- Optimize boot time by concurrent execution of hv_synic_init()
(Saurabh Sengar)

- Use helpers to read control registers in hv_snp_boot_ap() (Yosry
Ahmed)

- Add memory allocation check in hv_fcopy_start (Zhu Jun)

* tag 'hyperv-next-signed-20240916' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
tools/hv: Add memory allocation check in hv_fcopy_start
x86/hyperv: use helpers to read control registers in hv_snp_boot_ap()
Drivers: hv: vmbus: Optimize boot time by concurrent execution of hv_synic_init()

+41 -6
+3 -3
arch/x86/hyperv/ivm.c
··· 321 321 322 322 vmsa->efer = native_read_msr(MSR_EFER); 323 323 324 - asm volatile("movq %%cr4, %%rax;" : "=a" (vmsa->cr4)); 325 - asm volatile("movq %%cr3, %%rax;" : "=a" (vmsa->cr3)); 326 - asm volatile("movq %%cr0, %%rax;" : "=a" (vmsa->cr0)); 324 + vmsa->cr4 = native_read_cr4(); 325 + vmsa->cr3 = __native_read_cr3(); 326 + vmsa->cr0 = native_read_cr0(); 327 327 328 328 vmsa->xcr0 = 1; 329 329 vmsa->g_pat = HV_AP_INIT_GPAT_DEFAULT;
+31 -3
drivers/hv/vmbus_drv.c
··· 1306 1306 return IRQ_HANDLED; 1307 1307 } 1308 1308 1309 + static void vmbus_percpu_work(struct work_struct *work) 1310 + { 1311 + unsigned int cpu = smp_processor_id(); 1312 + 1313 + hv_synic_init(cpu); 1314 + } 1315 + 1309 1316 /* 1310 1317 * vmbus_bus_init -Main vmbus driver initialization routine. 1311 1318 * ··· 1323 1316 */ 1324 1317 static int vmbus_bus_init(void) 1325 1318 { 1326 - int ret; 1319 + int ret, cpu; 1320 + struct work_struct __percpu *works; 1327 1321 1328 1322 ret = hv_init(); 1329 1323 if (ret != 0) { ··· 1363 1355 if (ret) 1364 1356 goto err_alloc; 1365 1357 1358 + works = alloc_percpu(struct work_struct); 1359 + if (!works) { 1360 + ret = -ENOMEM; 1361 + goto err_alloc; 1362 + } 1363 + 1366 1364 /* 1367 1365 * Initialize the per-cpu interrupt state and stimer state. 1368 1366 * Then connect to the host. 1369 1367 */ 1370 - ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "hyperv/vmbus:online", 1371 - hv_synic_init, hv_synic_cleanup); 1368 + cpus_read_lock(); 1369 + for_each_online_cpu(cpu) { 1370 + struct work_struct *work = per_cpu_ptr(works, cpu); 1371 + 1372 + INIT_WORK(work, vmbus_percpu_work); 1373 + schedule_work_on(cpu, work); 1374 + } 1375 + 1376 + for_each_online_cpu(cpu) 1377 + flush_work(per_cpu_ptr(works, cpu)); 1378 + 1379 + /* Register the callbacks for possible CPU online/offline'ing */ 1380 + ret = cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ONLINE_DYN, "hyperv/vmbus:online", 1381 + hv_synic_init, hv_synic_cleanup); 1382 + cpus_read_unlock(); 1383 + free_percpu(works); 1372 1384 if (ret < 0) 1373 1385 goto err_alloc; 1374 1386 hyperv_cpuhp_online = ret;
+7
tools/hv/hv_fcopy_uio_daemon.c
··· 296 296 file_name = (char *)malloc(file_size * sizeof(char)); 297 297 path_name = (char *)malloc(path_size * sizeof(char)); 298 298 299 + if (!file_name || !path_name) { 300 + free(file_name); 301 + free(path_name); 302 + syslog(LOG_ERR, "Can't allocate memory for file name and/or path name"); 303 + return HV_E_FAIL; 304 + } 305 + 299 306 wcstoutf8(file_name, (__u16 *)in_file_name, file_size); 300 307 wcstoutf8(path_name, (__u16 *)in_path_name, path_size); 301 308