Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp719558ybn; Wed, 25 Sep 2019 06:46:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqlhsxmOwz73ob+iLaR+qHBvPeqhxTXHmlR8Azam9bL0wOCqe7c8nuqn/det56trQIig6u X-Received: by 2002:a05:6402:1355:: with SMTP id y21mr2956783edw.303.1569419174217; Wed, 25 Sep 2019 06:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569419174; cv=none; d=google.com; s=arc-20160816; b=vhUW0alwfUdrNRvVGKp2TDwZpObEp0gSAFqhZFXbW8LOPysxGdAOwvTBn1eGvggVFj 3fh7QMg8dYD76r960QoTAEV+nkl+AueYef8gBnsNImqwEYBIlliBc811YAoU5JOv1s8L diLOtxUAPKdHRt4g0Xt7Y/Ztb6tVoGk9tgE6S4f3D/7vFKzAJmzJ2Bmne7LhdyBcYe5t /DiKbyybQ2fbNFGyP5VhHDNE1q7Vy7sUUORHvs6Ytd3yF8MziwKK0jKuFMUKw1LRKi/c o3q4xKIX0U8nvfLT9qrGD70PST5Ih8u9LggppoByEGhhC8ZL+xCxiaKgTlK/VMxp23+a 6aWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=wo++7OHZ5TF55fscJSREmBycjATg1Pg/3l6GgeJun4o=; b=lkUi+ABULDm5VgUCEgG339MKpfJN+xjyUDoqhnWL1b18HeyMtwBlMBEEJc83KX2X0K 7NNq9tPeIs2w5ou1eYgyra6BAWHeu4wAaE9e9MjA95R7X2P/Un85JbqHPrf6+9/nuJZF yQ75Sfb+mb2OdweqAoDuwNn5UKInwL7T3cxOArThl7qPu7Yi80w0X4ryIeftLCYJOVS1 jDXdSURK8nB7o70stj61iEgucF1Tq1mBKiU8ix4TkbXHKIy3ySfEkeGUpXsZ5dX/EQfZ vBa+1QT3JLfwQJgpWNs3TMdYlKs6b/erMJjYtAHVpFPZMeMz/FtlJT/B7AXjSmAGugYs L0ZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v2si2838999eju.3.2019.09.25.06.45.50; Wed, 25 Sep 2019 06:46:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394945AbfIWNCl (ORCPT + 99 others); Mon, 23 Sep 2019 09:02:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59170 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394853AbfIWNCl (ORCPT ); Mon, 23 Sep 2019 09:02:41 -0400 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9801BC01D36C for ; Mon, 23 Sep 2019 13:02:40 +0000 (UTC) Received: by mail-qt1-f200.google.com with SMTP id e13so17092644qto.18 for ; Mon, 23 Sep 2019 06:02:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=wo++7OHZ5TF55fscJSREmBycjATg1Pg/3l6GgeJun4o=; b=iS6atO6WglevN3+x845zmu2AIK8UQQssar6JGNVD5C3KyF3QqIB4C6OyA+FfURbT2E z/PE8tGBU18dSj8tVMJS25JQeRI4JQC9l4+KDxYfCFWSOycRnyhUdj89fQvMlw4LrChM 2iL88frR8q+MXLXriQ6DlnqBwm8tZiXF6sTw1yPU+Cu7roTHPqZTwPWSPYDiHGfLfSL7 v9+V+wHtLpvH0s7TXKw+GRtc17KphPWjGRnS4fhtim2dflQUHdiaSq0Jhnw9/nEi3AnV mq5ClZJ+YxSirHxSWrSlW5dStKs6TsTmeBplElKwipxmLVfxokK6pQOIkIRJ9HB7MOJG WAVw== X-Gm-Message-State: APjAAAX51OdvGdhwSKBBIptJidmF6BCW8AaPGaQG9LhV9b+tG+u4znak x3Qenf781B282f7l8GL2n16fpJNwpqQ+xKpkJZ3xLVLupM2IoNovN6hRte7cZ0vxafvR17BlVfY Bp6c8e1vqForebeZROGZ7E7TX X-Received: by 2002:a37:bc82:: with SMTP id m124mr17491668qkf.231.1569243759829; Mon, 23 Sep 2019 06:02:39 -0700 (PDT) X-Received: by 2002:a37:bc82:: with SMTP id m124mr17491620qkf.231.1569243759411; Mon, 23 Sep 2019 06:02:39 -0700 (PDT) Received: from rhel7lobe ([2600:6c64:4e80:f1:aa45:cafe:5682:368f]) by smtp.gmail.com with ESMTPSA id 200sm5125496qkf.65.2019.09.23.06.02.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Sep 2019 06:02:38 -0700 (PDT) Message-ID: <8e9c537b7eaabd611968d22ec31f7cfb90e72efe.camel@redhat.com> Subject: Re: [PATCH] scsi: core: Log SCSI command age with errors From: Laurence Oberman To: "Milan P. Gandhi" , linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Cc: jejb@linux.ibm.com, martin.petersen@oracle.com Date: Mon, 23 Sep 2019 09:02:37 -0400 In-Reply-To: <20190923060122.GA9603@machine1> References: <20190923060122.GA9603@machine1> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-2.el7) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2019-09-23 at 11:31 +0530, Milan P. Gandhi wrote: > Couple of users had requested to print the SCSI command age along > with command failure errors. This is a small change, but allows > users to get more important information about the command that was > failed, it would help the users in debugging the command failures: > > Signed-off-by: Milan P. Gandhi > --- > diff --git a/drivers/scsi/scsi_logging.c > b/drivers/scsi/scsi_logging.c > index ecc5918e372a..ca2182bc53c6 100644 > --- a/drivers/scsi/scsi_logging.c > +++ b/drivers/scsi/scsi_logging.c > @@ -437,6 +437,7 @@ void scsi_print_result(const struct scsi_cmnd > *cmd, const char *msg, > const char *mlret_string = scsi_mlreturn_string(disposition); > const char *hb_string = scsi_hostbyte_string(cmd->result); > const char *db_string = scsi_driverbyte_string(cmd->result); > + unsigned long cmd_age = (jiffies - cmd->jiffies_at_alloc) / HZ; > > logbuf = scsi_log_reserve_buffer(&logbuf_len); > if (!logbuf) > @@ -478,10 +479,15 @@ void scsi_print_result(const struct scsi_cmnd > *cmd, const char *msg, > > if (db_string) > off += scnprintf(logbuf + off, logbuf_len - off, > - "driverbyte=%s", db_string); > + "driverbyte=%s ", db_string); > else > off += scnprintf(logbuf + off, logbuf_len - off, > - "driverbyte=0x%02x", driver_byte(cmd- > >result)); > + "driverbyte=0x%02x ", > + driver_byte(cmd->result)); > + > + off += scnprintf(logbuf + off, logbuf_len - off, > + "cmd-age=%lus", cmd_age); > + > out_printk: > dev_printk(KERN_INFO, &cmd->device->sdev_gendev, "%s", logbuf); > scsi_log_release_buffer(logbuf); > This looks to be a useful debug addition to me, and the code looks correct. I believe this has also been tested by Milan in our lab. Reviewed-by: Laurence Oberman