* [PATCH 0/2] Drivers: hv: vmbus: Miscellaneous enhancements @ 2017-10-29 18:31 kys 2017-10-29 18:33 ` [PATCH 1/2] Drivers: hv: vmbus: Expose per-channel interrupts and events counters kys 0 siblings, 1 reply; 4+ messages in thread From: kys @ 2017-10-29 18:31 UTC (permalink / raw) To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang, leann.ogasawara, marcelo.cerri, sthemmin Cc: K. Y. Srinivasan From: "K. Y. Srinivasan" <kys@microsoft.com> Reply-To: kys@microsoft.com 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(-) -- 2.14.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] Drivers: hv: vmbus: Expose per-channel interrupts and events counters 2017-10-29 18:31 [PATCH 0/2] Drivers: hv: vmbus: Miscellaneous enhancements kys @ 2017-10-29 18:33 ` kys 2017-10-29 18:33 ` [PATCH 2/2] Drivers: hv: vmbus: Make pannic reporting to be more useful kys 0 siblings, 1 reply; 4+ messages in thread From: kys @ 2017-10-29 18:33 UTC (permalink / raw) To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang, leann.ogasawara, marcelo.cerri, sthemmin Cc: Stephen Hemminger, K . Y . Srinivasan From: Stephen Hemminger <stephen@networkplumber.org> 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. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> --- 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(-) diff --git a/Documentation/ABI/stable/sysfs-bus-vmbus b/Documentation/ABI/stable/sysfs-bus-vmbus index 0ebd8a1537a0..d4077cc60d55 100644 --- a/Documentation/ABI/stable/sysfs-bus-vmbus +++ b/Documentation/ABI/stable/sysfs-bus-vmbus @@ -61,39 +61,53 @@ Date: September. 2017 KernelVersion: 4.14 Contact: Stephen Hemminger <sthemmin@microsoft.com> 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 <sthemmin@microsoft.com> 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 <sthemmin@microsoft.com> 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 <sthemmin@microsoft.com> 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 <sthemmin@microsoft.com> 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 <sthemmin@microsoft.com> 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 <sthemmin@microsoft.com> +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 <sthemmin@microsoft.com> +Description: Number of times we have taken an interrupt (incoming) +Users: Debugging tools diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index f41901f80b64..b06a6b796819 100644 --- a/drivers/hv/connection.c +++ b/drivers/hv/connection.c @@ -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); diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 1da8e818f4de..bca8188f3c8c 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -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 }; diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index ea6b5586ad77..f3e97c5f94c9 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -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); -- 2.14.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] Drivers: hv: vmbus: Make pannic reporting to be more useful 2017-10-29 18:33 ` [PATCH 1/2] Drivers: hv: vmbus: Expose per-channel interrupts and events counters kys @ 2017-10-29 18:33 ` kys 2017-10-31 12:39 ` Greg KH 0 siblings, 1 reply; 4+ messages in thread From: kys @ 2017-10-29 18:33 UTC (permalink / raw) To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang, leann.ogasawara, marcelo.cerri, sthemmin Cc: K. Y. Srinivasan From: "K. Y. Srinivasan" <kys@microsoft.com> 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 Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> --- 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(-) diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index a5db63f728a2..aeb8edf32e2b 100644 --- a/arch/x86/hyperv/hv_init.c +++ b/arch/x86/hyperv/hv_init.c @@ -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 diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h index 530f448fddaf..bd89104a5533 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -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 */ diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index bca8188f3c8c..8fe13cd76acf 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -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; } -- 2.14.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] Drivers: hv: vmbus: Make pannic reporting to be more useful 2017-10-29 18:33 ` [PATCH 2/2] Drivers: hv: vmbus: Make pannic reporting to be more useful kys @ 2017-10-31 12:39 ` Greg KH 0 siblings, 0 replies; 4+ messages in thread From: Greg KH @ 2017-10-31 12:39 UTC (permalink / raw) To: kys Cc: linux-kernel, devel, olaf, apw, vkuznets, jasowang, leann.ogasawara, marcelo.cerri, sthemmin On Sun, Oct 29, 2017 at 11:33:41AM -0700, kys@exchange.microsoft.com wrote: > From: "K. Y. Srinivasan" <kys@microsoft.com> > > 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-31 12:39 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-10-29 18:31 [PATCH 0/2] Drivers: hv: vmbus: Miscellaneous enhancements kys 2017-10-29 18:33 ` [PATCH 1/2] Drivers: hv: vmbus: Expose per-channel interrupts and events counters kys 2017-10-29 18:33 ` [PATCH 2/2] Drivers: hv: vmbus: Make pannic reporting to be more useful kys 2017-10-31 12:39 ` Greg KH
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).