From 216c0364bd42f2f5c57623dbfa8f20f28b4bb3b7 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <sthemmin@microsoft.com>
Date: Tue, 28 Feb 2017 09:38:57 -0800
Subject: [PATCH] storvsc instrumentation
Add some debug output to Hyper-v storvsc driver to log results
of SCSI requests.
---
drivers/scsi/storvsc_drv.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
@@ -20,6 +20,8 @@
* K. Y. Srinivasan <kys@microsoft.com>
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/kernel.h>
#include <linux/wait.h>
#include <linux/sched.h>
@@ -520,6 +522,8 @@ static void storvsc_host_scan(struct work_struct *work)
wrk = container_of(work, struct storvsc_scan_work, work);
host = wrk->host;
+ pr_info(" host scan initiated\n");
+
/*
* Before scanning the host, first check to see if any of the
* currrently known devices have been hot removed. We issue a
@@ -923,6 +927,9 @@ static void storvsc_handle_error(struct vmscsi_request *vm_srb,
void (*process_err_fn)(struct work_struct *work);
bool do_work = false;
+ pr_info(" error status %#x\n",
+ SRB_STATUS(vm_srb->srb_status));
+
switch (SRB_STATUS(vm_srb->srb_status)) {
case SRB_STATUS_ERROR:
/*
@@ -1060,6 +1067,12 @@ static void storvsc_on_io_completion(struct storvsc_device *stor_device,
* We do this so we can distinguish truly fatal failues
* (srb status == 0x4) and off-line the device in that case.
*/
+ pr_info(" IO cmd %#x %#x %#x scsi status %#x srb status %#x length %u\n",
+ stor_pkt->vm_srb.cdb[0], stor_pkt->vm_srb.cdb[1],
+ stor_pkt->vm_srb.cdb[2],
+ vstor_packet->vm_srb.scsi_status,
+ vstor_packet->vm_srb.srb_status,
+ vstor_packet->vm_srb.data_transfer_length);
if ((stor_pkt->vm_srb.cdb[0] == INQUIRY) ||
(stor_pkt->vm_srb.cdb[0] == MODE_SENSE)) {
@@ -1178,6 +1191,9 @@ static void storvsc_on_channel_callback(void *context)
if ((request == &stor_device->init_request) ||
(request == &stor_device->reset_request)) {
+ dev_info(&device->device, "complete %s request\n",
+ request == &stor_device->init_request ? "init" : "reset");
+
memcpy(&request->vstor_packet, packet,
(sizeof(struct vstor_packet) -
vmscsi_size_delta));
--
2.11.0