Drivers: hv: vmbus: Enable kexec and other misc cleanup
Subsystems (3)
cover Drivers: hv: vmbus: Enable kexec and other misc cleanup
In addition to enabling kexec, this patch-set has a bunch of miscellaneous fixes.
I have been having mail issues and hence resending the series.
Alex Ng (1):
Drivers: hv: balloon: Enable dynamic memory protocol negotiation with
Windows 10 hosts
K. Y. Srinivasan (1):
Drivers: hv: vmbus: Permit sending of packets without payload
Vitaly Kuznetsov (8):
Drivers: hv: vmbus: remove hv_synic_free_cpu() call from
hv_synic_cleanup()
kexec: define kexec_in_progress in !CONFIG_KEXEC case
Drivers: hv: vmbus: add special kexec handler
Drivers: hv: don't do hypercalls when hypercall_page is NULL
Drivers: hv: vmbus: add special crash handler
Drivers: hv: vmbus: prefer 'die' notification chain to 'panic'
Drivers: hv: kvp: check kzalloc return value
Drivers: hv: fcopy: dynamically allocate smsg_out in
fcopy_send_data()
arch/x86/include/asm/mshyperv.h | 4 ++ arch/x86/kernel/cpu/mshyperv.c | 46 ++++++++++++++++++++++++++ drivers/hv/channel.c | 4 ++- drivers/hv/hv.c | 15 ++++---- drivers/hv/hv_balloon.c | 26 +++++++++++--- drivers/hv/hv_fcopy.c | 21 +++++++---- drivers/hv/hv_kvp.c | 3 ++ drivers/hv/vmbus_drv.c | 69 ++++++++++++++++++++++++++++++++++++-- include/linux/kexec.h | 1 + 9 files changed, 163 insertions(+), 26 deletions(-)
Signature · 1 line
1.7.4.1
PATCH RESEND 1/10 Drivers: hv: vmbus: remove hv_synic_free_cpu() call from hv_synic_cleanup()
From: Vitaly Kuznetsov <[email protected]>
We already have hv_synic_free() which frees all per-cpu pages for all CPUs, let's remove the hv_synic_free_cpu() call from hv_synic_cleanup() so it will be possible to do separate cleanup (writing to MSRs) and final freeing. This is going to be used to assist kexec.
--- drivers/hv/hv.c | 2 -- drivers/hv/vmbus_drv.c | 1 + 2 files changed, 1 insertions(+), 2 deletions(-)
drivers/hv/hv.c +0 -2
@@ -530,6 +530,4 @@ void hv_synic_cleanup(void *arg)rdmsrl (HV_X64_MSR_SCONTROL , sctrl.as_uint64); sctrl.enable =0 ;wrmsrl (HV_X64_MSR_SCONTROL , sctrl.as_uint64); - -hv_synic_free_cpu (cpu); }
drivers/hv/vmbus_drv.c +1 -0
@@ -1120,6 +1120,7 @@ static void __exit vmbus_exit(void)tasklet_kill (hv_context.event_dpc[cpu]);smp_call_function_single (cpu, hv_synic_cleanup,NULL ,1 ); } +hv_synic_free ();acpi_bus_unregister_driver (&vmbus_acpi_driver);hv_cpu_hotplug_quirk (false); }
Signature · 1 line
1.7.4.1
PATCH RESEND 2/10 kexec: define kexec_in_progress in !CONFIG_KEXEC case
From: Vitaly Kuznetsov <[email protected]>
If some piece of code wants to check kexec_in_progress it has to be put in #ifdef CONFIG_KEXEC block to not break the build in !CONFIG_KEXEC case. Overcome this limitation by defining kexec_in_progress to false.
--- include/linux/kexec.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/kexec.h +1 -0
@@ -323,6 +323,7 @@ struct pt_regs;struct task_struct ;static inline void crash_kexec (struct pt_regs *regs) { }static inline int kexec_should_crash (struct task_struct *p) {return 0 ; } +#define kexec_in_progress false#endif /* CONFIG_KEXEC */ #endif /* !defined(__ASSEBMLY__) */
Signature · 1 line
1.7.4.1
PATCH RESEND 3/10 Drivers: hv: vmbus: add special kexec handler
In reply to K. Y. SrinivasanFrom: Vitaly Kuznetsov <[email protected]>
When general-purpose kexec (not kdump) is being performed in Hyper-V guest the newly booted kernel fails with an MCE error coming from the host. It is the same error which was fixed in the "Drivers: hv: vmbus: Implement the protocol for tearing down vmbus state" commit - monitor pages remain special and when they're being written to (as the new kernel doesn't know these pages are special) bad things happen. We need to perform some minimalistic cleanup before booting a new kernel on kexec. To do so we need to register a special machine_ops.shutdown handler to be executed before the native_machine_shutdown(). Registering a shutdown notification handler via the register_reboot_notifier() call is not sufficient as it happens to early for our purposes. machine_ops is not being exported to modules (and I don't think we want to export it) so let's do this in mshyperv.c
The minimalistic cleanup consists of cleaning up clockevents, synic MSRs, guest os id MSR, and hypercall MSR.
Kdump doesn't require all this stuff as it lives in a separate memory space.
--- arch/x86/include/asm/mshyperv.h | 2 ++ arch/x86/kernel/cpu/mshyperv.c | 24 ++++++++++++++++++++++++ drivers/hv/vmbus_drv.c | 14 ++++++++++++++ 3 files changed, 40 insertions(+), 0 deletions(-)
arch/x86/include/asm/mshyperv.h +2 -0
@@ -20,4 +20,6 @@ void hyperv_vector_handler(struct pt_regs *regs);void hv_setup_vmbus_irq (void (*handler)(void ));void hv_remove_vmbus_irq (void ); +void hv_setup_kexec_handler (void (*handler)(void )); +void hv_remove_kexec_handler (void );#endif
arch/x86/kernel/cpu/mshyperv.c +24 -0
@@ -18,6 +18,7 @@#include <linux/efi.h> #include <linux/interrupt.h> #include <linux/irq.h> +#include <linux/kexec.h> #include <asm/processor.h> #include <asm/hypervisor.h> #include <asm/hyperv.h>
@@ -28,10 +29,13 @@#include <asm/i8259.h> #include <asm/apic.h> #include <asm/timer.h> +#include <asm/reboot.h> struct ms_hyperv_info ms_hyperv;EXPORT_SYMBOL_GPL (ms_hyperv); +static void (*hv_kexec_handler)(void ); +#if IS_ENABLED (CONFIG_HYPERV )static void (*vmbus_handler)(void );
@@ -69,8 +73,27 @@ void hv_remove_vmbus_irq(void) }EXPORT_SYMBOL_GPL (hv_setup_vmbus_irq);EXPORT_SYMBOL_GPL (hv_remove_vmbus_irq); + +void hv_setup_kexec_handler (void (*handler)(void )) +{ + hv_kexec_handler = handler; +} +EXPORT_SYMBOL_GPL (hv_setup_kexec_handler); + +void hv_remove_kexec_handler (void ) +{ + hv_kexec_handler =NULL ; +} +EXPORT_SYMBOL_GPL (hv_remove_kexec_handler);#endif +static void hv_machine_shutdown (void ) +{ +if (kexec_in_progress && hv_kexec_handler) +hv_kexec_handler (); +native_machine_shutdown (); +} +static uint32_t __init ms_hyperv_platform (void ) {u32 eax;
@@ -143,6 +166,7 @@ static void __init ms_hyperv_init_platform(void) no_timer_check =1 ;#endif + machine_ops.shutdown = hv_machine_shutdown; }const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
drivers/hv/vmbus_drv.c +14 -0
@@ -1060,6 +1060,17 @@ static struct acpi_driver vmbus_acpi_driver = { }, }; +static void hv_kexec_handler (void ) +{ +int cpu; + +hv_synic_clockevents_cleanup (); +vmbus_initiate_unload (); +for_each_online_cpu (cpu) +smp_call_function_single (cpu, hv_synic_cleanup,NULL ,1 ); +hv_cleanup (); +}; +static int __init hv_acpi_init (void ) {int ret, t;
@@ -1092,6 +1103,8 @@ static int __init hv_acpi_init(void)if (ret) goto cleanup; +hv_setup_kexec_handler (hv_kexec_handler); +return 0 ; cleanup:
@@ -1104,6 +1117,7 @@ static void __exit vmbus_exit(void) {int cpu; +hv_remove_kexec_handler (); vmbus_connection.conn_state =DISCONNECTED ;hv_synic_clockevents_cleanup ();vmbus_disconnect ();
Signature · 1 line
1.7.4.1
PATCH RESEND 4/10 Drivers: hv: don't do hypercalls when hypercall_page is NULL
In reply to K. Y. SrinivasanFrom: Vitaly Kuznetsov <[email protected]>
At the very late stage of kexec a driver (which are not being unloaded) can try to post a message or signal an event. This will crash the kernel as we already did hv_cleanup() and the hypercall page is NULL.
Move all common (between 32 and 64 bit code) declarations to the beginning of the do_hypercall() function. Unfortunately we have to write the !hypercall_page check twice to not mix declarations and code.
--- drivers/hv/hv.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
drivers/hv/hv.c +8 -5
@@ -93,11 +93,14 @@ static int query_hypervisor_info(void)*/ static u64 do_hypercall (u64 control,void *input,void *output) { -#ifdef CONFIG_X86_64 -u64 hv_status =0 ;u64 input_address = (input) ?virt_to_phys (input) :0 ;u64 output_address = (output) ?virt_to_phys (output) :0 ;void *hypercall_page = hv_context.hypercall_page; +#ifdef CONFIG_X86_64 +u64 hv_status =0 ; + +if (!hypercall_page) +return (u64 )ULLONG_MAX ; __asm__ __volatile__("mov %0, %%r8" : :"r" (output_address) :"r8" ); __asm__ __volatile__("call *%3" : "=a" (hv_status) :
@@ -112,13 +115,13 @@ static u64 do_hypercall(u64 control, void *input, void *output)u32 control_lo = control &0xFFFFFFFF ;u32 hv_status_hi =1 ;u32 hv_status_lo =1 ; -u64 input_address = (input) ?virt_to_phys (input) :0 ;u32 input_address_hi = input_address >>32 ;u32 input_address_lo = input_address &0xFFFFFFFF ; -u64 output_address = (output) ?virt_to_phys (output) :0 ;u32 output_address_hi = output_address >>32 ;u32 output_address_lo = output_address &0xFFFFFFFF ; -void *hypercall_page = hv_context.hypercall_page; + +if (!hypercall_page) +return (u64 )ULLONG_MAX ; __asm__ __volatile__ ("call *%8" : "=d"(hv_status_hi), "=a"(hv_status_lo) : "d" (control_hi),
Signature · 1 line
1.7.4.1
PATCH RESEND 5/10 Drivers: hv: vmbus: add special crash handler
In reply to K. Y. SrinivasanFrom: Vitaly Kuznetsov <[email protected]>
Full kernel hang is observed when kdump kernel starts after a crash. This hang happens in vmbus_negotiate_version() function on wait_for_completion() as Hyper-V host (Win2012R2 in my testing) never responds to CHANNELMSG_INITIATE_CONTACT as it thinks the connection is already established. We need to perform some mandatory minimalistic cleanup before we start new kernel.
--- arch/x86/include/asm/mshyperv.h | 2 ++ arch/x86/kernel/cpu/mshyperv.c | 22 ++++++++++++++++++++++ drivers/hv/vmbus_drv.c | 14 ++++++++++++++ 3 files changed, 38 insertions(+), 0 deletions(-)
arch/x86/include/asm/mshyperv.h +2 -0
@@ -22,4 +22,6 @@ void hv_remove_vmbus_irq(void);void hv_setup_kexec_handler (void (*handler)(void ));void hv_remove_kexec_handler (void ); +void hv_setup_crash_handler (void (*handler)(struct pt_regs *regs)); +void hv_remove_crash_handler (void );#endif
arch/x86/kernel/cpu/mshyperv.c +22 -0
@@ -35,6 +35,7 @@ struct ms_hyperv_info ms_hyperv;EXPORT_SYMBOL_GPL (ms_hyperv);static void (*hv_kexec_handler)(void ); +static void (*hv_crash_handler)(struct pt_regs *regs);#if IS_ENABLED (CONFIG_HYPERV )static void (*vmbus_handler)(void );
@@ -85,6 +86,18 @@ void hv_remove_kexec_handler(void) hv_kexec_handler = NULL; }EXPORT_SYMBOL_GPL (hv_remove_kexec_handler); + +void hv_setup_crash_handler (void (*handler)(struct pt_regs *regs)) +{ + hv_crash_handler = handler; +} +EXPORT_SYMBOL_GPL (hv_setup_crash_handler); + +void hv_remove_crash_handler (void ) +{ + hv_crash_handler =NULL ; +} +EXPORT_SYMBOL_GPL (hv_remove_crash_handler);#endif static void hv_machine_shutdown (void )
@@ -94,6 +107,14 @@ static void hv_machine_shutdown(void)native_machine_shutdown (); } +static void hv_machine_crash_shutdown (struct pt_regs *regs) +{ +if (hv_crash_handler) +hv_crash_handler (regs); +native_machine_crash_shutdown (regs); +} + +static uint32_t __init ms_hyperv_platform (void ) {u32 eax;
@@ -167,6 +188,7 @@ static void __init ms_hyperv_init_platform(void)#endif machine_ops.shutdown = hv_machine_shutdown; + machine_ops.crash_shutdown = hv_machine_crash_shutdown; }const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
drivers/hv/vmbus_drv.c +14 -0
@@ -1071,6 +1071,18 @@ static void hv_kexec_handler(void)hv_cleanup (); }; +static void hv_crash_handler (struct pt_regs *regs) +{ +vmbus_initiate_unload (); +/* +* In crash handler we can't schedule synic cleanup for all CPUs, +* doing the cleanup for current CPU only. This should be sufficient +* for kdump. +*/ +hv_synic_cleanup (NULL ); +hv_cleanup (); +}; +static int __init hv_acpi_init (void ) {int ret, t;
@@ -1104,6 +1116,7 @@ static int __init hv_acpi_init(void) goto cleanup;hv_setup_kexec_handler (hv_kexec_handler); +hv_setup_crash_handler (hv_crash_handler);return 0 ;
@@ -1118,6 +1131,7 @@ static void __exit vmbus_exit(void)int cpu;hv_remove_kexec_handler (); +hv_remove_crash_handler (); vmbus_connection.conn_state =DISCONNECTED ;hv_synic_clockevents_cleanup ();vmbus_disconnect ();
Signature · 1 line
1.7.4.1
PATCH 6/10 Drivers: hv: vmbus: prefer 'die' notification chain to 'panic'
In reply to K. Y. SrinivasanFrom: Vitaly Kuznetsov <[email protected]>
current_pt_regs() sometimes returns regs of the userspace process and in case of a kernel crash this is not what we need to report. E.g. when we trigger crash with sysrq we see the following:
...
RIP: 0010:[<ffffffff815b8696>] [<ffffffff815b8696>] sysrq_handle_crash+0x16/0x20 RSP: 0018:ffff8800db0a7d88 EFLAGS: 00010246 RAX: 000000000000000f RBX: ffffffff820a0660 RCX: 0000000000000000
...
at the same time current_pt_regs() give us:
ip=7f899ea7e9e0, ax=ffffffffffffffda, bx=26c81a0, cx=7f899ea7e9e0, ... These registers come from the userspace process triggered the crash. As we don't even know which process it was this information is rather useless.
When kernel crash happens through 'die' proper regs are being passed to all receivers on the die_chain (and panic_notifier_list is being notified with the string passed to panic() only). If panic() is called manually (e.g. on BUG()) we won't get 'die' notification so keep the 'panic' notification reporter as well but guard against double reporting.
--- drivers/hv/vmbus_drv.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 files changed, 36 insertions(+), 4 deletions(-)
drivers/hv/vmbus_drv.c +36 -4
@@ -39,6 +39,7 @@#include <asm/mshyperv.h> #include <linux/notifier.h> #include <linux/ptrace.h> +#include <linux/kdebug.h> #include "hyperv_vmbus.h" static struct acpi_device *hv_acpi_dev;
@@ -48,12 +49,18 @@ static struct completion probe_event;static int irq; -static int hyperv_panic_event (struct notifier_block *nb, -unsigned long event,void *ptr) +static void hyperv_report_panic (struct pt_regs *regs) { -struct pt_regs *regs; +static bool panic_reported; - regs =current_pt_regs (); +/* +* We prefer to report panic on 'die' chain as we have proper +* registers to report, but if we miss it (e.g. on BUG()) we need +* to report it on 'panic'. +*/ +if (panic_reported) +return ; + panic_reported = true;wrmsrl (HV_X64_MSR_CRASH_P0 , regs->ip);wrmsrl (HV_X64_MSR_CRASH_P1 , regs->ax);
@@ -65,9 +72,32 @@ static int hyperv_panic_event(struct notifier_block *nb,* Let Hyper-V know there is crash data available */ wrmsrl (HV_X64_MSR_CRASH_CTL ,HV_CRASH_CTL_CRASH_NOTIFY ); +} + +static int hyperv_panic_event (struct notifier_block *nb,unsigned long val, +void *args) +{ +struct pt_regs *regs; + + regs =current_pt_regs (); + +hyperv_report_panic (regs);return NOTIFY_DONE ; } +static int hyperv_die_event (struct notifier_block *nb,unsigned long val, +void *args) +{ +struct die_args *die = (struct die_args *)args; +struct pt_regs *regs = die->regs; + +hyperv_report_panic (regs); +return NOTIFY_DONE ; +} + +static struct notifier_block hyperv_die_block = { + .notifier_call = hyperv_die_event, +};static struct notifier_block hyperv_panic_block = { .notifier_call = hyperv_panic_event, };
@@ -842,6 +872,7 @@ static int vmbus_bus_init(int irq)* Only register if the crash MSRs are available */ if (ms_hyperv.features &HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE ) { +register_die_notifier (&hyperv_die_block);atomic_notifier_chain_register (&panic_notifier_list, &hyperv_panic_block); }
@@ -1139,6 +1170,7 @@ static void __exit vmbus_exit(void)tasklet_kill (&msg_dpc);vmbus_free_channels ();if (ms_hyperv.features &HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE ) { +unregister_die_notifier (&hyperv_die_block);atomic_notifier_chain_unregister (&panic_notifier_list, &hyperv_panic_block); }
Signature · 1 line
1.7.4.1
PATCH RESEND 7/10 Drivers: hv: kvp: check kzalloc return value
In reply to K. Y. SrinivasanFrom: Vitaly Kuznetsov <[email protected]>
kzalloc() return value check was accidentally lost in 11bc3a5fa91f:
"Drivers: hv: kvp: convert to hv_utils_transport" commit.
We don't need to reset kvp_transaction.state here as we have the kvp_timeout_func() timeout function and in case we're in OOM situation it is preferable to wait.
--- drivers/hv/hv_kvp.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/hv/hv_kvp.c +3 -0
@@ -353,6 +353,9 @@ kvp_send_key(struct work_struct *dummy)return ; message =kzalloc (sizeof (*message),GFP_KERNEL ); +if (!message) +return ; + message->kvp_hdr.operation = operation; message->kvp_hdr.pool = pool; in_msg = kvp_transaction.kvp_msg;
Signature · 1 line
1.7.4.1
PATCH RESEND 8/10 Drivers: hv: fcopy: dynamically allocate smsg_out in fcopy_send_data()
In reply to K. Y. SrinivasanFrom: Vitaly Kuznetsov <[email protected]>
struct hv_start_fcopy is too big to be on stack on i386, the following warning is reported:
Quoted 1 line
Quoted 1 line
drivers/hv/hv_fcopy.c:159:1: warning: the frame size of 1088 bytes is larger than 1024 bytes [-Wframe-larger-than=]
--- drivers/hv/hv_fcopy.c | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-)
drivers/hv/hv_fcopy.c +13 -8
@@ -116,7 +116,7 @@ static int fcopy_handle_handshake(u32 version)static void fcopy_send_data (struct work_struct *dummy) { -struct hv_start_fcopy smsg_out; +struct hv_start_fcopy *smsg_out =NULL ;int operation = fcopy_transaction.fcopy_msg->operation;struct hv_start_fcopy *smsg_in;void *out_src;
@@ -136,21 +136,24 @@ static void fcopy_send_data(struct work_struct *dummy)switch (operation) {case START_FILE_COPY : out_len =sizeof (struct hv_start_fcopy ); -memset (&smsg_out,0 , out_len); - smsg_out.hdr.operation = operation; + smsg_out =kzalloc (sizeof (*smsg_out),GFP_KERNEL ); +if (!smsg_out) +return ; + + smsg_out->hdr.operation = operation; smsg_in = (struct hv_start_fcopy *)fcopy_transaction.fcopy_msg;utf16s_to_utf8s ((wchar_t *)smsg_in->file_name,W_MAX_PATH ,UTF16_LITTLE_ENDIAN , - (__u8 *)&smsg_out.file_name,W_MAX_PATH -1 ); + (__u8 *)&smsg_out->file_name,W_MAX_PATH -1 );utf16s_to_utf8s ((wchar_t *)smsg_in->path_name,W_MAX_PATH ,UTF16_LITTLE_ENDIAN , - (__u8 *)&smsg_out.path_name,W_MAX_PATH -1 ); + (__u8 *)&smsg_out->path_name,W_MAX_PATH -1 ); - smsg_out.copy_flags = smsg_in->copy_flags; - smsg_out.file_size = smsg_in->file_size; - out_src = &smsg_out; + smsg_out->copy_flags = smsg_in->copy_flags; + smsg_out->file_size = smsg_in->file_size; + out_src = smsg_out;break ;default :
@@ -168,6 +171,8 @@ static void fcopy_send_data(struct work_struct *dummy) fcopy_transaction.state =HVUTIL_READY ; } } +kfree (smsg_out); +return ; }
Signature · 1 line
1.7.4.1
PATCH RESEND 9/10 Drivers: hv: balloon: Enable dynamic memory protocol negotiation with Windows 10 hosts
In reply to K. Y. SrinivasanFrom: Alex Ng <[email protected]>
Support Win10 protocol for Dynamic Memory. Thia patch allows guests on Win10 hosts to hot-add memory even when dynamic memory is not enabled on the guest.
--- drivers/hv/hv_balloon.c | 26 ++++++++++++++++++++------ 1 files changed, 20 insertions(+), 6 deletions(-)
drivers/hv/hv_balloon.c +20 -6
@@ -62,11 +62,13 @@enum {DYNMEM_PROTOCOL_VERSION_1 =DYNMEM_MAKE_VERSION (0 ,3 ),DYNMEM_PROTOCOL_VERSION_2 =DYNMEM_MAKE_VERSION (1 ,0 ), +DYNMEM_PROTOCOL_VERSION_3 =DYNMEM_MAKE_VERSION (2 ,0 ),DYNMEM_PROTOCOL_VERSION_WIN7 =DYNMEM_PROTOCOL_VERSION_1 ,DYNMEM_PROTOCOL_VERSION_WIN8 =DYNMEM_PROTOCOL_VERSION_2 , +DYNMEM_PROTOCOL_VERSION_WIN10 =DYNMEM_PROTOCOL_VERSION_3 , -DYNMEM_PROTOCOL_VERSION_CURRENT =DYNMEM_PROTOCOL_VERSION_WIN8 +DYNMEM_PROTOCOL_VERSION_CURRENT =DYNMEM_PROTOCOL_VERSION_WIN10 };
@@ -1296,13 +1298,25 @@ static void version_resp(struct hv_dynmem_device *dm,if (dm->next_version ==0 ) goto version_error; - dm->next_version =0 ;memset (&version_req,0 ,sizeof (struct dm_version_request )); version_req.hdr.type =DM_VERSION_REQUEST ; version_req.hdr.size =sizeof (struct dm_version_request ); version_req.hdr.trans_id =atomic_inc_return (&trans_id); - version_req.version.version =DYNMEM_PROTOCOL_VERSION_WIN7 ; - version_req.is_last_attempt =1 ; + version_req.version.version = dm->next_version; + +/* +* Set the next version to try in case current version fails. +* Win7 protocol ought to be the last one to try. +*/ +switch (version_req.version.version) { +case DYNMEM_PROTOCOL_VERSION_WIN8 : + dm->next_version =DYNMEM_PROTOCOL_VERSION_WIN7 ; + version_req.is_last_attempt =0 ; +break ; +default : + dm->next_version =0 ; + version_req.is_last_attempt =1 ; + } ret = vmbus_sendpacket(dm->dev->channel, &version_req, sizeof(struct dm_version_request),
@@ -1442,7 +1456,7 @@ static int balloon_probe(struct hv_device *dev, dm_device.dev = dev; dm_device.state =DM_INITIALIZING ; - dm_device.next_version =DYNMEM_PROTOCOL_VERSION_WIN7 ; + dm_device.next_version =DYNMEM_PROTOCOL_VERSION_WIN8 ;init_completion (&dm_device.host_event);init_completion (&dm_device.config_event);INIT_LIST_HEAD (&dm_device.ha_region_list);
@@ -1474,7 +1488,7 @@ static int balloon_probe(struct hv_device *dev, version_req.hdr.type =DM_VERSION_REQUEST ; version_req.hdr.size =sizeof (struct dm_version_request ); version_req.hdr.trans_id =atomic_inc_return (&trans_id); - version_req.version.version =DYNMEM_PROTOCOL_VERSION_WIN8 ; + version_req.version.version =DYNMEM_PROTOCOL_VERSION_WIN10 ; version_req.is_last_attempt =0 ; ret = vmbus_sendpacket(dev->channel, &version_req,
Signature · 1 line
1.7.4.1
PATCH RESEND 10/10 Drivers: hv: vmbus: Permit sending of packets without payload
In reply to K. Y. SrinivasanThe guest may have to send a completion packet back to the host. To support this usage, permit sending a packet without a payload - we would be only sending the descriptor in this case.
--- drivers/hv/channel.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/hv/channel.c +3 -1
@@ -601,6 +601,7 @@ int vmbus_sendpacket_ctl(struct vmbus_channel *channel, void *buffer,u64 aligned_data =0 ;int ret;bool signal = false; +int num_vecs = ((bufferlen !=0 ) ?3 :1 );/* Setup the descriptor */
@@ -618,7 +619,8 @@ int vmbus_sendpacket_ctl(struct vmbus_channel *channel, void *buffer, bufferlist[2 ].iov_base = &aligned_data; bufferlist[2 ].iov_len = (packetlen_aligned - packetlen); - ret =hv_ringbuffer_write (&channel->outbound, bufferlist,3 , &signal); + ret =hv_ringbuffer_write (&channel->outbound, bufferlist, num_vecs, + &signal);/* * Signalling the host is conditional on many factors:
Signature · 1 line
1.7.4.1