Commit 1d7bb2bf authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'hyperv-next-signed-20240916' of...

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()
parents 3a7101e9 94e86b17
...@@ -321,9 +321,9 @@ int hv_snp_boot_ap(u32 cpu, unsigned long start_ip) ...@@ -321,9 +321,9 @@ int hv_snp_boot_ap(u32 cpu, unsigned long start_ip)
vmsa->efer = native_read_msr(MSR_EFER); vmsa->efer = native_read_msr(MSR_EFER);
asm volatile("movq %%cr4, %%rax;" : "=a" (vmsa->cr4)); vmsa->cr4 = native_read_cr4();
asm volatile("movq %%cr3, %%rax;" : "=a" (vmsa->cr3)); vmsa->cr3 = __native_read_cr3();
asm volatile("movq %%cr0, %%rax;" : "=a" (vmsa->cr0)); vmsa->cr0 = native_read_cr0();
vmsa->xcr0 = 1; vmsa->xcr0 = 1;
vmsa->g_pat = HV_AP_INIT_GPAT_DEFAULT; vmsa->g_pat = HV_AP_INIT_GPAT_DEFAULT;
......
...@@ -1306,6 +1306,13 @@ static irqreturn_t vmbus_percpu_isr(int irq, void *dev_id) ...@@ -1306,6 +1306,13 @@ static irqreturn_t vmbus_percpu_isr(int irq, void *dev_id)
return IRQ_HANDLED; 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. * vmbus_bus_init -Main vmbus driver initialization routine.
* *
...@@ -1316,7 +1323,8 @@ static irqreturn_t vmbus_percpu_isr(int irq, void *dev_id) ...@@ -1316,7 +1323,8 @@ static irqreturn_t vmbus_percpu_isr(int irq, void *dev_id)
*/ */
static int vmbus_bus_init(void) static int vmbus_bus_init(void)
{ {
int ret; int ret, cpu;
struct work_struct __percpu *works;
ret = hv_init(); ret = hv_init();
if (ret != 0) { if (ret != 0) {
...@@ -1355,12 +1363,32 @@ static int vmbus_bus_init(void) ...@@ -1355,12 +1363,32 @@ static int vmbus_bus_init(void)
if (ret) if (ret)
goto err_alloc; 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. * Initialize the per-cpu interrupt state and stimer state.
* Then connect to the host. * Then connect to the host.
*/ */
ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "hyperv/vmbus:online", 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); hv_synic_init, hv_synic_cleanup);
cpus_read_unlock();
free_percpu(works);
if (ret < 0) if (ret < 0)
goto err_alloc; goto err_alloc;
hyperv_cpuhp_online = ret; hyperv_cpuhp_online = ret;
......
...@@ -296,6 +296,13 @@ static int hv_fcopy_start(struct hv_start_fcopy *smsg_in) ...@@ -296,6 +296,13 @@ static int hv_fcopy_start(struct hv_start_fcopy *smsg_in)
file_name = (char *)malloc(file_size * sizeof(char)); file_name = (char *)malloc(file_size * sizeof(char));
path_name = (char *)malloc(path_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(file_name, (__u16 *)in_file_name, file_size);
wcstoutf8(path_name, (__u16 *)in_path_name, path_size); wcstoutf8(path_name, (__u16 *)in_path_name, path_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment