Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp212185ybn; Tue, 24 Sep 2019 21:34:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxnG54oFSrz94iFGoZQwigYTztauphbfLN8qpnyO9HqQImXj+r56STSu3udKedpPOD11Knr X-Received: by 2002:a05:600c:2186:: with SMTP id e6mr2836323wme.154.1569386070519; Tue, 24 Sep 2019 21:34:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569386070; cv=none; d=google.com; s=arc-20160816; b=x9UplVBSLD/DWNF24VuZMvnLGA3moS5iHLdvLzRj8V//HudYxzr6VxLHSzTXlhzKOi EbQMyvHSYEHbWFtt1gNVHQwgmLo6GWK8kk2uC8orKPsq6KKksG6BRHugd22ZZzz3Cnvi 9nsoELjIZFrD+Ty/GOFPBAydz2uM0aEG5UCOufGXi1OcwDyyMBdN2F3V+WUj0ZB4sRPD ChuZ4ogXvYf1ghkx7o2XGbCn0MpvED2URI7JnGhBK2vhg1znmP53yrDhY9135JyCqcR8 846cP9ucCFBFYk2Xuh/6eHmhC4rfkvhs9rec4qADJUij5SPuZFn9FQNwtp9PY/mNHtM+ 4egg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:user-agent:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=vdX8tdsz8p0cI70eNyOOHHqPsOCERsGcj5XIq8ZYihI=; b=BkAXfK4yd4ZACdE/ppwWWeyRer6n01wO30YIHszpEienPUMAgy/x1cZt7ZODFYM5Uq urOojFBIjRdM5jjH7+c2HNcQOVg30cshUSM3gH9ZNhXcQzyf+efqTxtkxqM3NcOqrMGb KVVl+6XfMN3JIMBqoiByX9eAwP4Ppy3mv/axV7rIu89qpKs5jpbwU6aqJgWzOJCrE/9T bBuNdrhrsVv5Vbv9gPRpqsxVURgv2OVyWKOtlqqlr7zCgFkx0IMlFHKFvCzCw8ChqX+Q iZfz0EjOlGREOdNxJQkaJWw+OHaBlI/LwXAP9fRxopA+dvLOK56oxjudmlOchTIPkPlw jfFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Tf3LoB5A; 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=pass (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 f29si2149749ejj.110.2019.09.24.21.34.07; Tue, 24 Sep 2019 21:34:30 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Tf3LoB5A; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392326AbfIWGBe (ORCPT + 99 others); Mon, 23 Sep 2019 02:01:34 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:58644 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387519AbfIWGBa (ORCPT ); Mon, 23 Sep 2019 02:01:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1569218489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vdX8tdsz8p0cI70eNyOOHHqPsOCERsGcj5XIq8ZYihI=; b=Tf3LoB5AcFjrp+t5TCu0UdTg+rCsupYY81c8Vdy7a/NPbVegtjfVI3XuqSaXxLa4VXqfFE em+cqeoRE2kwETVEUYLbqqefs85Qbw4IQf3kWpkN5U1PSj8LiB2CnOA1tUlJ5WCOCeWijA euzjhkaEl+WHHU9RMj43U2UAtJo64tw= Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-22-Ix0ysnPhOm21q-xhLsjRyA-1; Mon, 23 Sep 2019 02:01:28 -0400 Received: by mail-pf1-f200.google.com with SMTP id z13so9491860pfr.15 for ; Sun, 22 Sep 2019 23:01:28 -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=6whaabGHABPeYQY1Y8LH/wuL+jQ1IMXfQogkhGaUTG4=; b=MaP1/peU+Kupc3afKqM83SSoEz8jUQK9lrlvIAwPeIkl9h1h6Yn2RLcoVex5V8D3/j myU74MQ6FabHFFxJFhQCIaKjIPmPZpTcnt4XTlk6b+m3Nj4Iy9q/epGkcA0Vb9MWDfSn 87paBoIFRuVPxKIXmGxOeTPOvsAGZBW9XrT0vsHALQTks6MoW+HDSORVEo/qE5eZk5xi pxm3R+CQjhx4MvhpI34sCgpEc6X63B9Cmi3LNHTdpUPokp+p3WuFwl5zLleTe8vprc72 P4VGYFToVUrplcshUCsIgoyuLh3yTZTtWJSTeS3rcEWpBl6RPf5ET3qW0FR5gKfOgaU+ /1Jg== X-Gm-Message-State: APjAAAUI9V58ZvJBXEu1XssUALefbT7b5n4tn6FdHGbkWkY7/lQAeR6O VbCvSxec/M+6aVSEOCdKTvGCm9qWzDUBuggrZ9zYbIr0NQR3jhoseO63Hv+5VyUgH3VNoq5LVmg etIPSd2PE6j7GUqf+WaBRx06k X-Received: by 2002:a65:4286:: with SMTP id j6mr28025367pgp.218.1569218487153; Sun, 22 Sep 2019 23:01:27 -0700 (PDT) X-Received: by 2002:a65:4286:: with SMTP id j6mr28025339pgp.218.1569218486738; Sun, 22 Sep 2019 23:01:26 -0700 (PDT) Received: from machine1 ([125.16.200.50]) by smtp.gmail.com with ESMTPSA id l72sm14191309pjb.7.2019.09.22.23.01.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Sep 2019 23:01:26 -0700 (PDT) Date: Mon, 23 Sep 2019 11:31:22 +0530 From: "Milan P. Gandhi" To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Cc: jejb@linux.ibm.com, martin.petersen@oracle.com Subject: [PATCH] scsi: core: Log SCSI command age with errors Message-ID: <20190923060122.GA9603@machine1> MIME-Version: 1.0 User-Agent: Mutt/1.11.3 (2019-02-01) X-MC-Unique: Ix0ysnPhOm21q-xhLsjRyA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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=20 with command failure errors. This is a small change, but allows=20 users to get more important information about the command that was=20 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, con= st char *msg, =09const char *mlret_string =3D scsi_mlreturn_string(disposition); =09const char *hb_string =3D scsi_hostbyte_string(cmd->result); =09const char *db_string =3D scsi_driverbyte_string(cmd->result); +=09unsigned long cmd_age =3D (jiffies - cmd->jiffies_at_alloc) / HZ; =20 =09logbuf =3D scsi_log_reserve_buffer(&logbuf_len); =09if (!logbuf) @@ -478,10 +479,15 @@ void scsi_print_result(const struct scsi_cmnd *cmd, c= onst char *msg, =20 =09if (db_string) =09=09off +=3D scnprintf(logbuf + off, logbuf_len - off, -=09=09=09=09 "driverbyte=3D%s", db_string); +=09=09=09=09 "driverbyte=3D%s ", db_string); =09else =09=09off +=3D scnprintf(logbuf + off, logbuf_len - off, -=09=09=09=09 "driverbyte=3D0x%02x", driver_byte(cmd->result)); +=09=09=09=09 "driverbyte=3D0x%02x ", +=09=09=09=09 driver_byte(cmd->result)); + +=09off +=3D scnprintf(logbuf + off, logbuf_len - off, +=09=09=09 "cmd-age=3D%lus", cmd_age); + out_printk: =09dev_printk(KERN_INFO, &cmd->device->sdev_gendev, "%s", logbuf); =09scsi_log_release_buffer(logbuf);