Drivers: hv: vmbus: Miscellaneous enhancements
Subsystems (2)
cover Drivers: hv: vmbus: Miscellaneous enhancements
From: "K. Y. Srinivasan" <[email protected]>
Reply-To: [email protected]
Miscellaneous enhancements.
K. Y. Srinivasan (1):
Drivers: hv: vmbus: Make pannic reporting to be more useful
Stephen Hemminger (1):
Drivers: hv: vmbus: Expose per-channel interrupts and events counters
Documentation/ABI/stable/sysfs-bus-vmbus | 26 ++++++++++++++++++++------ arch/x86/hyperv/hv_init.c | 15 +++++++++------ arch/x86/include/asm/mshyperv.h | 2 +- drivers/hv/connection.c | 2 ++ drivers/hv/vmbus_drv.c | 20 ++++++++++++++++++-- include/linux/hyperv.h | 4 ++++ 6 files changed, 54 insertions(+), 15 deletions(-)
Signature · 1 line
2.14.1
PATCH 1/2 Drivers: hv: vmbus: Expose per-channel interrupts and events counters
From: Stephen Hemminger <[email protected]>
When investigating performance, it is useful to be able to look at the number of host and guest events per-channel. This is equivalent to per-device interrupt statistics.
--- Documentation/ABI/stable/sysfs-bus-vmbus | 26 ++++++++++++++++++++------ drivers/hv/connection.c | 2 ++ drivers/hv/vmbus_drv.c | 16 ++++++++++++++++ include/linux/hyperv.h | 4 ++++ 4 files changed, 42 insertions(+), 6 deletions(-)
Documentation/ABI/stable/sysfs-bus-vmbus +20 -6
@@ -61,39 +61,53 @@ Date: September. 2017 KernelVersion: 4.14 Contact: Stephen Hemminger <[email protected]> Description: Inbound channel signaling state -Users: Debuggig tools +Users: Debugging tools What: /sys/bus/vmbus/devices/vmbus_*/channels/relid/latency Date: September. 2017 KernelVersion: 4.14 Contact: Stephen Hemminger <[email protected]> Description: Channel signaling latency -Users: Debuggig tools +Users: Debugging tools What: /sys/bus/vmbus/devices/vmbus_*/channels/relid/out_mask Date: September. 2017 KernelVersion: 4.14 Contact: Stephen Hemminger <[email protected]> Description: Outbound channel signaling state -Users: Debuggig tools +Users: Debugging tools What: /sys/bus/vmbus/devices/vmbus_*/channels/relid/pending Date: September. 2017 KernelVersion: 4.14 Contact: Stephen Hemminger <[email protected]> Description: Channel interrupt pending state -Users: Debuggig tools +Users: Debugging tools What: /sys/bus/vmbus/devices/vmbus_*/channels/relid/read_avail Date: September. 2017 KernelVersion: 4.14 Contact: Stephen Hemminger <[email protected]> Description: Bytes availabble to read -Users: Debuggig tools +Users: Debugging tools What: /sys/bus/vmbus/devices/vmbus_*/channels/relid/write_avail Date: September. 2017 KernelVersion: 4.14 Contact: Stephen Hemminger <[email protected]> Description: Bytes availabble to write -Users: Debuggig tools +Users: Debugging tools + +What: /sys/bus/vmbus/devices/vmbus_*/channels/relid/events +Date: September. 2017 +KernelVersion: 4.14 +Contact: Stephen Hemminger <[email protected]> +Description: Number of times we have signaled the host +Users: Debugging tools + +What: /sys/bus/vmbus/devices/vmbus_*/channels/relid/interrupts +Date: September. 2017 +KernelVersion: 4.14 +Contact: Stephen Hemminger <[email protected]> +Description: Number of times we have taken an interrupt (incoming) +Users: Debugging tools
drivers/hv/connection.c +2 -0
@@ -409,6 +409,8 @@ void vmbus_set_event(struct vmbus_channel *channel)if (!channel->is_dedicated_interrupt)vmbus_send_interrupt (child_relid); + ++channel->sig_events; +hv_do_fast_hypercall8 (HVCALL_SIGNAL_EVENT , channel->sig_event); }EXPORT_SYMBOL_GPL (vmbus_set_event);
drivers/hv/vmbus_drv.c +16 -0
@@ -944,6 +944,8 @@ static void vmbus_chan_sched(struct hv_per_cpu_context *hv_cpu)if (channel->rescind)continue ; + ++channel->interrupts; +switch (channel->callback_mode) {case HV_CALL_ISR :vmbus_channel_isr (channel);
@@ -1237,6 +1239,18 @@ static ssize_t channel_latency_show(const struct vmbus_channel *channel, }VMBUS_CHAN_ATTR (latency,S_IRUGO , channel_latency_show,NULL ); +static ssize_t channel_interrupts_show (const struct vmbus_channel *channel,char *buf) +{ +return sprintf (buf,"%llu\n" , channel->interrupts); +} +VMBUS_CHAN_ATTR (interrupts,S_IRUGO , channel_interrupts_show,NULL ); + +static ssize_t channel_events_show (const struct vmbus_channel *channel,char *buf) +{ +return sprintf (buf,"%llu\n" , channel->sig_events); +} +VMBUS_CHAN_ATTR (events,S_IRUGO , channel_events_show,NULL ); +static struct attribute *vmbus_chan_attrs[] = { &chan_attr_out_mask.attr, &chan_attr_in_mask.attr,
@@ -1245,6 +1259,8 @@ static struct attribute *vmbus_chan_attrs[] = { &chan_attr_cpu.attr, &chan_attr_pending.attr, &chan_attr_latency.attr, + &chan_attr_interrupts.attr, + &chan_attr_events.attr, NULL };
include/linux/hyperv.h +4 -0
@@ -719,6 +719,10 @@ struct vmbus_channel {struct vmbus_close_msg close_msg; +/* Statistics */ +u64 interrupts;/* Host to Guest interrupts */ +u64 sig_events;/* Guest to Host events */ +/* Channel callback's invoked in softirq context */ struct tasklet_struct callback_event;void (*onchannel_callback)(void *context);
Signature · 1 line
2.14.1
PATCH 2/2 Drivers: hv: vmbus: Make pannic reporting to be more useful
From: "K. Y. Srinivasan" <[email protected]>
Hyper-V allows the guest to report panic and the guest can pass additional information. All this is logged on the host. Currently Linux is passing back information that is not particularly useful. Make the following changes:
1. Windows uses crash MSR P0 to report bugcheck code. Follow the same convention for Linux as well.
2. It will be useful to know the gust ID of the Linux guest that has paniced. Pass back this information.
These changes will help in better supporting Linux on Hyper-V
--- arch/x86/hyperv/hv_init.c | 15 +++++++++------ arch/x86/include/asm/mshyperv.h | 2 +- drivers/hv/vmbus_drv.c | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-)
arch/x86/hyperv/hv_init.c +9 -6
@@ -210,9 +210,10 @@ void hyperv_cleanup(void) }EXPORT_SYMBOL_GPL (hyperv_cleanup); -void hyperv_report_panic (struct pt_regs *regs) +void hyperv_report_panic (struct pt_regs *regs,long err) {static bool panic_reported; +u64 guest_id;/* * We prefer to report panic on 'die' chain as we have proper
@@ -223,11 +224,13 @@ void hyperv_report_panic(struct pt_regs *regs)return ; panic_reported = true; -wrmsrl (HV_X64_MSR_CRASH_P0 , regs->ip); -wrmsrl (HV_X64_MSR_CRASH_P1 , regs->ax); -wrmsrl (HV_X64_MSR_CRASH_P2 , regs->bx); -wrmsrl (HV_X64_MSR_CRASH_P3 , regs->cx); -wrmsrl (HV_X64_MSR_CRASH_P4 , regs->dx); +rdmsrl (HV_X64_MSR_GUEST_OS_ID , guest_id); + +wrmsrl (HV_X64_MSR_CRASH_P0 , err); +wrmsrl (HV_X64_MSR_CRASH_P1 , guest_id); +wrmsrl (HV_X64_MSR_CRASH_P2 , regs->ip); +wrmsrl (HV_X64_MSR_CRASH_P3 , regs->ax); +wrmsrl (HV_X64_MSR_CRASH_P4 , regs->sp);/* * Let Hyper-V know there is crash data available
arch/x86/include/asm/mshyperv.h +1 -1
@@ -310,7 +310,7 @@ static inline int hv_cpu_number_to_vp_number(int cpu_number)void hyperv_init (void );void hyperv_setup_mmu_ops (void );void hyper_alloc_mmu (void ); -void hyperv_report_panic (struct pt_regs *regs); +void hyperv_report_panic (struct pt_regs *regs,long err);bool hv_is_hypercall_page_setup (void );void hyperv_cleanup (void );#else /* CONFIG_HYPERV */
drivers/hv/vmbus_drv.c +2 -2
@@ -65,7 +65,7 @@ static int hyperv_panic_event(struct notifier_block *nb, unsigned long val, regs =current_pt_regs (); -hyperv_report_panic (regs); +hyperv_report_panic (regs, val);return NOTIFY_DONE ; }
@@ -75,7 +75,7 @@ static int hyperv_die_event(struct notifier_block *nb, unsigned long val,struct die_args *die = (struct die_args *)args;struct pt_regs *regs = die->regs; -hyperv_report_panic (regs); +hyperv_report_panic (regs, val);return NOTIFY_DONE ; }
Signature · 1 line
2.14.1
Re: [PATCH 2/2] Drivers: hv: vmbus: Make pannic reporting to be more useful
Quoted 3 lines · On Sun, Oct 29, 2017 at 11:33:41AM -0700, [email protected] wrote:
From: "K. Y. Srinivasan" <[email protected]>
Hyper-V allows the guest to report panic and the guest can pass additional
"pannic" or "panic"? :)
I'll go fix it up by hand...
{sigh}
greg k-h