Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1860122ybn; Thu, 26 Sep 2019 03:20:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzV79KrgUy8JnK5Xic+uHdAbk68No16asbScxH8gKMEjSiRPOa+wdgZlsaMRIh431l2ku9Q X-Received: by 2002:a50:cf0d:: with SMTP id c13mr2595355edk.125.1569493223333; Thu, 26 Sep 2019 03:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569493223; cv=none; d=google.com; s=arc-20160816; b=kNJQrahKbezne8CJlkOFyBNjrGLqeAdXCBppDftnl9qxO8EtzdELsxHndSmizH1CF8 97VEcFXFOLdIvm4IRIj3/w6giz+/bcO8eFH6GGywI9DvcbLh55Qje83uuwoz3oP1vixH fDUTagrQFndTPnKswCO9Tg5Yy2WDqrGeRU7assGzY0VR1hdWoe9w1JSdFQLeQibbxSjB pzOgRRNejVB0/AAWCc4icYh6QYSsCVfTTybouE1hDoJsWtPox42WW9oauIKxPJWW5GvL TAxYTKtBe+rVCHFks92CupR4jSMfVobH0Gr7iqYQ507ypp53D2ur7H+SK8VPuyQjoRh3 4l1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=1fe6UqqBNwxIhubj0sRC3S5FKZ0/ZDDNO4mSuZB59Wk=; b=SfNAx+F7vb3rf/UaCEkNVjm6+ZUYdRwooMbGTlUqRSGRDZaEy1RMeg/mmvwU7SKlB/ Npy/8P5RSet9iGnjqN59yqTCjTfKKbFj6sYSeNU4NpmkcxVckCTF9VgAdnVRnoe4EBiG +q2jtmCF51Y3Ec8hjh8ZkJyQsQrucvBq/uOOsa/XTHJVkVlpbvmmsVlZk2546DX4Z1kz vuPP8nfModyoEr6x/uQ4lHmS7tQ7pmGzIiMdeNfbrQpHjC+TxZYUDWt1h0IHOezI/pTq GlKXh9kqQfdedCTjffeeFAQIMR56XKLHNLRldVKQVovhKFWMBsy0PHW/Gxv4BqMubYzJ dXXA== 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 h15si1017892eda.284.2019.09.26.03.19.52; Thu, 26 Sep 2019 03:20:23 -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 S2392152AbfIZFZK (ORCPT + 99 others); Thu, 26 Sep 2019 01:25:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33898 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731361AbfIZFZJ (ORCPT ); Thu, 26 Sep 2019 01:25:09 -0400 Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) (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 D72BC58 for ; Thu, 26 Sep 2019 05:25:08 +0000 (UTC) Received: by mail-pl1-f199.google.com with SMTP id c14so789372plo.12 for ; Wed, 25 Sep 2019 22:25:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=1fe6UqqBNwxIhubj0sRC3S5FKZ0/ZDDNO4mSuZB59Wk=; b=BEWKuvOuTtJIALzDrh9kMNJQej82DB9Eq1idXsz+h60Mh5fzFpj4nge7TJ3Qak80ZC n4nBmygbhpv1sMihDA0/EgCi/40DPGfuudqvQdDXMnyfKomXseQv6V73F4sxQEJFIpR7 047FhIFdi3SVX+rPUVEBUllp+BoFTg/1MyzTwGLrmSJ0ShLEZls9nGDzypXcJE5zDhAd XcnXqNtc0SvhwslbeQh4oMO3a1//ZowAT3PWmzjlZ2LTQbcSHb0J5h/vRXbzUA1E0VAr xNnhTcN3FZHM5Pucc38YxU06WeFkNnQOqC1JxJQWP3Px4q2EPrWniVowPZy1PDFPmT2L /2RA== X-Gm-Message-State: APjAAAVFcb3vUUMyRyQvRMVKBOoKLMRaPZpms5ZMkAlYb4/VruNA6pHj qaSrBPO43cdyJHJBWUHBBhSq0amAf8qfFx0wp9ZHCQ28qhb2xTkCOOHEeNlh0XL3afdPKAUqkWh WA2tNQ7cr2DWdK1N5rmADQf07 X-Received: by 2002:a65:6802:: with SMTP id l2mr1591184pgt.33.1569475508154; Wed, 25 Sep 2019 22:25:08 -0700 (PDT) X-Received: by 2002:a65:6802:: with SMTP id l2mr1591156pgt.33.1569475507654; Wed, 25 Sep 2019 22:25:07 -0700 (PDT) Received: from machine1 ([125.16.200.50]) by smtp.gmail.com with ESMTPSA id t68sm1436660pgt.61.2019.09.25.22.25.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2019 22:25:06 -0700 (PDT) Date: Thu, 26 Sep 2019 10:55:02 +0530 From: "Milan P. Gandhi" To: bvanassche@acm.org, loberman@redhat.com, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Cc: jejb@linux.ibm.com, martin.petersen@oracle.com Subject: [PATCH v2] scsi: core: Log SCSI command age with errors Message-ID: <20190926052501.GA8352@machine1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- changes v2: - Changed the message to print SCSI command age as 'cmd_age' and not 'cmd-age' to avoid any confusion. 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_logging.c b/drivers/scsi/scsi_logging.c index 39b8cc4574b4..0ccb4c95266d 100644 --- a/drivers/scsi/scsi_logging.c +++ b/drivers/scsi/scsi_logging.c @@ -432,6 +432,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) @@ -473,10 +474,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);