hyperv-next for v6.12

-----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEIbPD0id6easf0xsudhRwX5BBoF4FAmboyr0THHdlaS5saXVA
 a2VybmVsLm9yZwAKCRB2FHBfkEGgXtASB/9sOUPP+CrvwEbJ3HJhb4hRyjgNoP2/
 PjE+7QglZlBodXND0/W/LHSbseaZ5CyENvnEN+nz7g7hp/nkl5cpFFCb7wg6OEF3
 6kgiWCsM5A5tdDx2Rt+AF5hJ6JdzduHVa1bnrrg10xwM7G7uJUS3JMDtCDcW2MSc
 sYpZ113mEZ8MZ93WtghJHoDKq7xLqw+h/PEv7MQaxwyxGusIfy9SzUVKkjFTwfzb
 DOyeeujagecr3/MsZRRyieUfRRTdwPeK1sgWgya3M9RSyFSSD2PhKh+JQRZvRs0n
 YbfhktckB/FobPxxWbNwv2vM1FoZugwEm84GlXryXgn9M6aBv9sW/Rty
 =nU/w
 -----END PGP SIGNATURE-----

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()
This commit is contained in:
Linus Torvalds 2024-09-19 08:15:30 +02:00
commit 1d7bb2bf7a
3 changed files with 41 additions and 6 deletions

View File

@ -321,9 +321,9 @@ int hv_snp_boot_ap(u32 cpu, unsigned long start_ip)
vmsa->efer = native_read_msr(MSR_EFER);
asm volatile("movq %%cr4, %%rax;" : "=a" (vmsa->cr4));
asm volatile("movq %%cr3, %%rax;" : "=a" (vmsa->cr3));
asm volatile("movq %%cr0, %%rax;" : "=a" (vmsa->cr0));
vmsa->cr4 = native_read_cr4();
vmsa->cr3 = __native_read_cr3();
vmsa->cr0 = native_read_cr0();
vmsa->xcr0 = 1;
vmsa->g_pat = HV_AP_INIT_GPAT_DEFAULT;

View File

@ -1306,6 +1306,13 @@ static irqreturn_t vmbus_percpu_isr(int irq, void *dev_id)
return IRQ_HANDLED;
}
static void vmbus_percpu_work(struct work_struct *work)
{
unsigned int cpu = smp_processor_id();
hv_synic_init(cpu);
}
/*
* vmbus_bus_init -Main vmbus driver initialization routine.
*
@ -1316,7 +1323,8 @@ static irqreturn_t vmbus_percpu_isr(int irq, void *dev_id)
*/
static int vmbus_bus_init(void)
{
int ret;
int ret, cpu;
struct work_struct __percpu *works;
ret = hv_init();
if (ret != 0) {
@ -1355,12 +1363,32 @@ static int vmbus_bus_init(void)
if (ret)
goto err_alloc;
works = alloc_percpu(struct work_struct);
if (!works) {
ret = -ENOMEM;
goto err_alloc;
}
/*
* Initialize the per-cpu interrupt state and stimer state.
* Then connect to the host.
*/
ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "hyperv/vmbus:online",
hv_synic_init, hv_synic_cleanup);
cpus_read_lock();
for_each_online_cpu(cpu) {
struct work_struct *work = per_cpu_ptr(works, cpu);
INIT_WORK(work, vmbus_percpu_work);
schedule_work_on(cpu, work);
}
for_each_online_cpu(cpu)
flush_work(per_cpu_ptr(works, cpu));
/* Register the callbacks for possible CPU online/offline'ing */
ret = cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ONLINE_DYN, "hyperv/vmbus:online",
hv_synic_init, hv_synic_cleanup);
cpus_read_unlock();
free_percpu(works);
if (ret < 0)
goto err_alloc;
hyperv_cpuhp_online = ret;

View File

@ -296,6 +296,13 @@ static int hv_fcopy_start(struct hv_start_fcopy *smsg_in)
file_name = (char *)malloc(file_size * sizeof(char));
path_name = (char *)malloc(path_size * sizeof(char));
if (!file_name || !path_name) {
free(file_name);
free(path_name);
syslog(LOG_ERR, "Can't allocate memory for file name and/or path name");
return HV_E_FAIL;
}
wcstoutf8(file_name, (__u16 *)in_file_name, file_size);
wcstoutf8(path_name, (__u16 *)in_path_name, path_size);