Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1858380ybb; Thu, 9 Apr 2020 10:17:10 -0700 (PDT) X-Google-Smtp-Source: APiQypKf10JyD3ykXONRNTacp4I+akpGL4q+0iry68hGSrmMmbV2FBNL7o1PqMcIQYI74rXhkyTS X-Received: by 2002:ac8:6753:: with SMTP id n19mr334445qtp.353.1586452630635; Thu, 09 Apr 2020 10:17:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586452630; cv=none; d=google.com; s=arc-20160816; b=r7q+kEme/1G/0ACceov4iyNTktCajGWlAqMRcbN9rBc6gj+KqDCLi6dgL/SKaRBu8g 0tltraLOrU3VSOK8kw3pyKz7SXY6pTw+yHLx3z+T/U/aX1FL4bVunMTNuOo461p7nFic aNugzaGcHCvorZuT21RUIa453JGteKbLRG2OshiFCUFskuoA6FJxG/j1yelIkmoSaVIj A6a6LzNvgw+wRKyXbdCYboj115wowusJl84SVCC9XNiVzZQb4LK/GwC6uH/WzRhS5xgd fS1+23zVguAnr1tiwbuVAMmNRv0Ahtp1f4LLdEGk7a07K6N5q95zBNMRNYeZ2saCqs/d /HTg== 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 :dkim-signature; bh=f8hRg5EYNwvd8gy24wDwcLfYiAk7Uf7td7X5fprQc0g=; b=GOBm7ObMrfu0R2p7zW/1x/YR63O0PYykfFlzACSkuggAovqAY9cuobPmMuMUxrkPlL mVg9MYys0dvFZzBMADii18GnSIqnjkBwYVcCAaPLF3V/YKKWAK5iKvnRufY3pbZGZnSF ubU93/rq+LPv3m5XXO2DzSEeKXhvNwJwAHBhhG8z7AYKtzIM/5vyIeFXOxwcrPXV61jk 2h92YbUIhA+U0vcK4vJXwQHRFffobTYBEOXlIwx06HqPxdj0z2pH4MaNgkKb+alFCggh qO455QMbLR2iFVUwB78RniUHnXX/b5LZRfYjPvLUMkB9RuQ/1W5MVCoW6U2kgzh6qMRc dtYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=W4cuyUmn; 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 m133si6272224qke.187.2020.04.09.10.16.55; Thu, 09 Apr 2020 10:17:10 -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=W4cuyUmn; 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 S1728039AbgDIRHN (ORCPT + 99 others); Thu, 9 Apr 2020 13:07:13 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:39756 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728026AbgDIRHM (ORCPT ); Thu, 9 Apr 2020 13:07:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586452031; 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: in-reply-to:in-reply-to:references:references; bh=f8hRg5EYNwvd8gy24wDwcLfYiAk7Uf7td7X5fprQc0g=; b=W4cuyUmnrHIGL3v2T9+u7YjyI2N0E7dDj9UAjfXkAVupOKjOvhzjxP78BVzp35bEnwjo2X atER6l5c+XRCh+qriqYFdtYK3kMByKXZksy1BclT4GtTNizEE8MsGF92bTQhBj4wAEaorY vb4FNbRvJ3ghFis2lcBTZ1G2g6lDp8s= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-226-wbcQ8QmgNVGmmCDUvSS3tA-1; Thu, 09 Apr 2020 13:07:08 -0400 X-MC-Unique: wbcQ8QmgNVGmmCDUvSS3tA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0D58F18AB2CF; Thu, 9 Apr 2020 17:07:07 +0000 (UTC) Received: from ovpn-113-89.phx2.redhat.com (ovpn-113-89.phx2.redhat.com [10.3.113.89]) by smtp.corp.redhat.com (Postfix) with ESMTP id 626165D9CA; Thu, 9 Apr 2020 17:07:06 +0000 (UTC) Message-ID: <1b1be267b80404dc8ca5a14b3e26710c53f50fb4.camel@redhat.com> Subject: Re: [PATCH] scsi: core: Rate limit "rejecting I/O" messages From: "Ewan D. Milne" To: Joe Perches , Daniel Wagner , linux-scsi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "James E.J. Bottomley" , "Martin K. Petersen" Date: Thu, 09 Apr 2020 13:07:05 -0400 In-Reply-To: <2de69a35463317f5eca2ce665b0ee8b90b8c717b.camel@perches.com> References: <20200408171012.76890-1-dwagner@suse.de> <120ce7f4cd1fd070e1f7c353223c21b8e4f29337.camel@redhat.com> <2de69a35463317f5eca2ce665b0ee8b90b8c717b.camel@perches.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2020-04-08 at 12:49 -0700, Joe Perches wrote: > > Could add a ratelimit_state to struct scsi_device. > > Something like: > --- > drivers/scsi/scsi_scan.c | 2 ++ > include/scsi/scsi_device.h | 2 ++ > 2 files changed, 4 insertions(+) > > diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c > index f2437a..938c83f 100644 > --- a/drivers/scsi/scsi_scan.c > +++ b/drivers/scsi/scsi_scan.c > @@ -279,6 +279,8 @@ static struct scsi_device *scsi_alloc_sdev(struct > scsi_target *starget, > scsi_change_queue_depth(sdev, sdev->host->cmd_per_lun ? > sdev->host->cmd_per_lun : 1); > > + ratelimit_state_init(&sdev->rs, DEFAULT_RATELIMIT_INTERVAL, > + DEFAULT_RATELIMIT_BURST); > scsi_sysfs_device_initialize(sdev); > > if (shost->hostt->slave_alloc) { > diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h > index c3cba2..2600de7 100644 > --- a/include/scsi/scsi_device.h > +++ b/include/scsi/scsi_device.h > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > > struct device; > struct request_queue; > @@ -233,6 +234,7 @@ struct scsi_device { > struct mutex state_mutex; > enum scsi_device_state sdev_state; > struct task_struct *quiesced_by; > + struct ratelimit_state rs; > unsigned long sdev_data[]; > } __attribute__((aligned(sizeof(unsigned long)))); > We could but in our experience this may not work well enough. We do wants to see the message when the device goes offline, so we can look at logs from SAN failures to see when that happened, but logging more than one message per device is worthless. And there can be *LOTS* of LUNs behind targets that go away. Hundreds. Thousands, even. I keep getting crash dumps with nothing useful in the dmesg buffer. And we see a lot of serial console lockups. -Ewan