Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp3749298ybn; Fri, 27 Sep 2019 10:46:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwVQwfXxp18o0315BF/ICa/kHTNfsqcWWzHe8OawFtUmMYxGL5+Z6Vl8UAd+pdJBjwEOZG X-Received: by 2002:aa7:dad9:: with SMTP id x25mr6031287eds.7.1569606369769; Fri, 27 Sep 2019 10:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569606369; cv=none; d=google.com; s=arc-20160816; b=xRdyx5Il9riKsgbCHrgO1dzz5OePxNCVvFocKeyLmRlW9ZORM4yaKaAgLtYMM9Yg3Y VnCtYgadDEvk/Mbd8sTI0TmSUn/gonjQ2Yn5goTfjvRUlMoYO6aFrdFBjFDiHdnjTBDJ LHPM7FkEXzgMTRoKag7JUqMdMVa6luCdtuWtjNvXB9bfNQD0a6ugHhvnpQiM1jFNzspl gpXrqPtE7C1HPuzp/kvo8u7t7Mvk2wEMMw5SpBwkYMb+B1TLOhpgPCIehrroAcxaHJOE pvq1MbBe2UojUPsmGRcaFb9g+CDR5F6YAW3dT3rpJpA6GGeRkRQvplLZCP9Xx2YemVs9 99yg== 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=V7uKVOUP48sjqm3uZXCLKF4/Ns/Wlt7x8/p5qhE25yM=; b=IC1s2xm6jy0gnWOUPY50VUR+MGs0lJg5MueaHFiocMlBGOLYLGofIEdR/i9/Weito8 E/Jb+Y4X52BqRp9/nVMgGOPKCQfHn+TXv2YsGGVhgHJSMYBoxVd9ABu4cgcFbzmIrQSr jJtVfbsjy+yYBZgbj3/N4xWjvpjFlGbrPiOXuBTykIa0fU6Qnbynes39aO1LI0s3XPgK Wwx0nLkp3P4j8LFOWZR0w+KBWNYW9omuGblWPz4ohdCMy2lf9KDW+VE9ESrS2CoRElYJ Z0xWJJMrEWX1QQfJOSMq1cox2D1BmFFlYUSGeY2YrpiXBChT2ENa2BZKE8P31JaNLo9A mneA== 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 v26si2951145eja.230.2019.09.27.10.45.45; Fri, 27 Sep 2019 10:46:09 -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 S1727355AbfI0Rp0 (ORCPT + 99 others); Fri, 27 Sep 2019 13:45:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38864 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726294AbfI0Rp0 (ORCPT ); Fri, 27 Sep 2019 13:45:26 -0400 Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) (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 5B365C05AA61 for ; Fri, 27 Sep 2019 17:45:25 +0000 (UTC) Received: by mail-io1-f70.google.com with SMTP id k13so5511803ioc.11 for ; Fri, 27 Sep 2019 10:45:25 -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=V7uKVOUP48sjqm3uZXCLKF4/Ns/Wlt7x8/p5qhE25yM=; b=ebtguJL8txKXer8YfaitvYmdU5bzXHZfmeOsAKAqDdci1Rmys0lJ4G1me/kujVTYOl knsvL8n99b57Y25b9zXrdzbbMoH8II/Y2nbp2d1fEwW4gUJfkkbXM0inLroL0qnZpBe7 Z380yJNYKrHSoh1BcXpB1wKjyybsn7bcafbuT7SE5NgB3e4RWBzWPseMohzp8KsMaUHz 8BOzwKZ4Ry4a5uRYWJHppEt9vzN3xXRnky0D6oh2eZCszslmaaWrdApjP84OqbgLkhFP oig/UjRAKUSCL6VEZPjZ0y04eR0HmDjTeC12/dURE4lidMy3egn/kmsXaLrS1WIVxng8 sTTQ== X-Gm-Message-State: APjAAAXV5cTvwmSRB3i0HnuASjDbu8x5X2mV7SmTVdZmivRH3z6sr+Hc oUGr7w/Wa6UEIeO2Pf0xZE6nN29YD7pcavI4g264I6e1s/XhRqPXZ1cDdMLr2Xd8AjQmFIjxvrP ZtOvfatjKfbcOLjMPfcwxV3Hc X-Received: by 2002:a6b:7b01:: with SMTP id l1mr9667887iop.292.1569606324583; Fri, 27 Sep 2019 10:45:24 -0700 (PDT) X-Received: by 2002:a6b:7b01:: with SMTP id l1mr9667854iop.292.1569606324228; Fri, 27 Sep 2019 10:45:24 -0700 (PDT) Received: from rhel7lobe ([2600:6c64:4e80:f1:aa45:cafe:5682:368f]) by smtp.gmail.com with ESMTPSA id b7sm2529587iod.42.2019.09.27.10.45.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Sep 2019 10:45:23 -0700 (PDT) Message-ID: <3a8ee584f9846fba94d98d0e6941fefdcbed5d71.camel@redhat.com> Subject: Re: [PATCH] scsi: core: Log SCSI command age with errors From: Laurence Oberman To: Martin Wilck , "Milan P. Gandhi" , linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Cc: jejb@linux.ibm.com, martin.petersen@oracle.com Date: Fri, 27 Sep 2019 13:45:21 -0400 In-Reply-To: <471732f03049a1528df1d144013d723041f0a419.camel@suse.de> References: <20190923060122.GA9603@machine1> <471732f03049a1528df1d144013d723041f0a419.camel@suse.de> 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 Fri, 2019-09-27 at 17:26 +0200, Martin Wilck wrote: > 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; > > This comes down to pretty coarse time resolution, does it not? More > often than not, the time difference shown will be 0. I'd recommend at > least millisecond resolution. > > > > > 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); > > This is certainly helpful in some situations. Yet I am unsure if it > should *always* be printed. I wouldn't say it's as important as the > other stuff scsi_print_result() provides. After all, by activating > MLQUEUE+MLCOMPLETE, the time on-wire can be extracted with better > accuracy from currently available logs. > > So perhaps make this depend on a module parameter? > > Also, we should carefully ponder if we want to put this on the same > line as the driver byte, as users may have created scripts for > parsing > this output. > > Regards, > Martin > > Hi Martin Agreed about log extraction, but turning that on with a busy workload in a production environment is not practical. We cant do it with systems with 1000's of luns and 1000's of IOPS/sec. Also second resolution is good enough for the debug we want to see. Regards Laurence