From patchwork Wed Mar 28 02:44:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 10312061 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C175F60386 for ; Wed, 28 Mar 2018 02:44:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFF1029AA0 for ; Wed, 28 Mar 2018 02:44:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2E4429BB6; Wed, 28 Mar 2018 02:44:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 340DA29AA0 for ; Wed, 28 Mar 2018 02:44:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752043AbeC1Co3 (ORCPT ); Tue, 27 Mar 2018 22:44:29 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:43086 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750753AbeC1Co1 (ORCPT ); Tue, 27 Mar 2018 22:44:27 -0400 Received: by mail-pl0-f68.google.com with SMTP id f23-v6so697578plr.10; Tue, 27 Mar 2018 19:44:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=CskYsIp3AIoBcpxrb2o+h+8Qkp26JVIZgn9MlAwOY6w=; b=NIFl9U//O1JwWlPIBuWgOsLENEYmzArl27vMFvi1HnFMDyhI8h3Eg2O9uqkO6OixMM +sc+cC/wSntt+XSTG3HNrGWDc05193UE7eiffpXBd8B620K7zXfE33NzTFXxdQm8UcC9 9M7h8PBp3BtaS5ymgwXd05HLJizXDYwpvXHqvBqzKELUjOxkTNrTQ/aoyJaLjljc6e9e 8nznl46N523JakU+RybFpsWhOevcmyRTPgJyR+yPt4I5xLjjvtDVVw7LCgjc/RjExP9J PaksWeQThGmVdqoEwDNzMgXgEpf9KfWpoBWrCAdu9DMIJPUYP/1XSGGAE2W36pBqVUpa +vVg== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=CskYsIp3AIoBcpxrb2o+h+8Qkp26JVIZgn9MlAwOY6w=; b=Odjz2RJLgcy2h5/K2OBUaIPz8Fzeh6SNBgVV8GFPKR4mKUzNED6auM9itf7iInyA8j D9T0mYCOQ7dyCfpw8YLHFO8CTe648QeSR5kOkAqcvxQDrttJT/6y1gP6+rIi1Ubp6KY6 li7xFaLnNI4iJTQs8ZODyBbc5YunYxPMe5Guu7bwU0LGLxhRyrFf5QlepUQ4IwT95Muq zLTfM1Oc11jo959FKD/rD46FL2pIz1WVuTBVgbPJ7aYBbpuWQsuEKxB6DTf8kqVlIkAG zQV2wneoP+sYY5WxmZg7qnyR7OfD+i+A5RM7zG39+pGpp7KYGYOIHG+8v6XTcEtiNrN1 sMOg== X-Gm-Message-State: AElRT7HcWudimpSgBZ2igC8X1gXwth2ZJqmYmh24And7tUAc53szL2vB ZD2k02eppJpN6JfVEPAbSWvxSKsS X-Google-Smtp-Source: AIpwx48/EYatAcIm4gbdZUKKsxK7eojXC8AH/t0E4xIr5BZUQtinutrI6T2RAWQHp7pNRGHo8xisqQ== X-Received: by 2002:a17:902:8c83:: with SMTP id t3-v6mr1837211plo.391.1522205067401; Tue, 27 Mar 2018 19:44:27 -0700 (PDT) Received: from localhost ([110.70.26.136]) by smtp.gmail.com with ESMTPSA id u9sm4164298pgb.27.2018.03.27.19.44.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Mar 2018 19:44:26 -0700 (PDT) Date: Wed, 28 Mar 2018 11:44:22 +0900 From: Sergey Senozhatsky To: wen.yang99@zte.com.cn Cc: Bart.VanAssche@wdc.com, sergey.senozhatsky.work@gmail.com, pmladek@suse.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, jiang.biao2@zte.com.cn, zhong.weidong@zte.com.cn, tan.hu@zte.com.cn Subject: Re: =?utf-8?B?562U5aSNOiBSZTogW1BBVENI?= =?utf-8?Q?=5D?= scsi: Replace sdev_printk with printk_deferred to avoid Message-ID: <20180328024422.GA1352@jagdpanzerIV> References: <199ab05df000f2e8b5497a7aaecd0951321aadae.camel@wdc.com> <201803281029555635678@zte.com.cn> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <201803281029555635678@zte.com.cn> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On (03/28/18 10:29), wen.yang99@zte.com.cn wrote: > Hello Bart, > > We have a detailed discussion of the problem. > Sergey Senozhatsky, Petr and many people have made a lot of efforts about > it. > Please see this link: > https://bugzilla.kernel.org/show_bug.cgi?id=199003 > > 1, Petr suggests that it should be modified in this way: > IMHO, printing the same message so many times is useless. Therefore > some throttling would make sense. If we want to keep sdev_printk(), The thing with retelimiting is that - yes, we do less printks but we still do them under queue spin_lock. So I was thinking about something like below [a quick-n-dirty workaround] --- drivers/scsi/scsi_lib.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 0dfec0dedd5e..6c930fbdd24c 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1825,9 +1825,13 @@ static void scsi_request_fn(struct request_queue *q) break; if (unlikely(!scsi_device_online(sdev))) { + scsi_kill_request(req, q); + spin_unlock_irq(q->queue_lock); + sdev_printk(KERN_ERR, sdev, "rejecting I/O to offline device\n"); - scsi_kill_request(req, q); + + spin_lock_irq(q->queue_lock); continue; }