Received: by 10.213.65.68 with SMTP id h4csp3292115imn; Tue, 3 Apr 2018 02:13:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx48bujyRGKgww2S3/MktKsJrajc7XfiUG1sLvLwyce0/3wAb9u6iaqTf6AqofYyDSCMvuzGp X-Received: by 2002:a17:902:6c4f:: with SMTP id h15-v6mr13572402pln.33.1522746822395; Tue, 03 Apr 2018 02:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522746822; cv=none; d=google.com; s=arc-20160816; b=qDjQIpzB8GF6Q43eyIQxQEC+0K0Jpiy7d2ov9cAfhUdfCwp7PRbtE/lAQyZN4nOXs1 ecwCgexxjEkd2yAta2ZYND66cnGaxyXQefW+MC5nU24wmkDoYK4YSghazUmD283vd8ip t4iinSngDcGVuF0aEtbHoiD143Kmcio2bl15lF23rpEBGPizTGx9HAFK/cLClijzVqcK HLW7H7kJbHTY3zgEt+V+1YjSBs959qmM5V8ZlPJn6buTW67B+EAQVmCW7tCp82PrSqvE TLJLWnJHTLiKrU08jHM83aFKbvuIMi/0LkOqWiDPfHKALvDbUFeBRdkdkHEf/LjYeL5P 7c7A== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=SOsRXXt08wPD9Vuh83G5VXlksz317g7HGTaFhG09xJc=; b=b7ojHiK8Ue3KIEIWJQVbOlbEkbDHEn7J7isgxrhk6TNFu/pg8DcW7KaMU5q/I3+idr Tdj/xTKWiQh4g8qp47Q6U8dGkaI/oseCsA14eEC6Pqvwco5RwrS5A4MFKDOHjyoRV6wg cBCtnv091wStqor+ydWpVn/3/PNWTVGsK9+ShA7NX+E+TfzEIiZTGurIiHNlMawR6ccV xTSyMoXWNRdYFMUYXs72GYBY+GVbsWGG2hkNUEpA8SSxtulcpwnwDJiVG+oGZ50v4xrb 9HToGXdWRJGh+tWUC9RcTiGOaYfcJDVRnDMUjfz7XBx+rfszcJDakRS5fi2vF7Y8FDWI AWOQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w125si1638264pgb.190.2018.04.03.02.13.28; Tue, 03 Apr 2018 02:13:42 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755255AbeDCJMN (ORCPT + 99 others); Tue, 3 Apr 2018 05:12:13 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:54639 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751226AbeDCJML (ORCPT ); Tue, 3 Apr 2018 05:12:11 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id F2BF1EF2176EB; Tue, 3 Apr 2018 17:12:06 +0800 (CST) Received: from [127.0.0.1] (10.177.96.203) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.361.1; Tue, 3 Apr 2018 17:12:03 +0800 Subject: Re: [PATCH v3] scsi: Introduce sdev_printk_ratelimited to throttle frequent printk To: Wen Yang , , References: <1522735480-159023-1-git-send-email-wen.yang99@zte.com.cn> CC: , , , , , , , , Tan Hu From: Jason Yan Message-ID: <5AC34562.6030207@huawei.com> Date: Tue, 3 Apr 2018 17:12:02 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <1522735480-159023-1-git-send-email-wen.yang99@zte.com.cn> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.96.203] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/4/3 14:04, Wen Yang wrote: > There would be so many same lines printed by frequent printk if one > disk went wrong, like, > [ 546.185242] sd 0:1:0:0: rejecting I/O to offline device > [ 546.185258] sd 0:1:0:0: rejecting I/O to offline device > [ 546.185280] sd 0:1:0:0: rejecting I/O to offline device > [ 546.185307] sd 0:1:0:0: rejecting I/O to offline device > [ 546.185334] sd 0:1:0:0: rejecting I/O to offline device > [ 546.185364] sd 0:1:0:0: rejecting I/O to offline device > [ 546.185390] sd 0:1:0:0: rejecting I/O to offline device > [ 546.185410] sd 0:1:0:0: rejecting I/O to offline device > For slow serial console, the frequent printk may be blocked for a > long time, and if any spin_lock has been acquired before the printk > like in scsi_request_fn, watchdog could be triggered. > > Related disscussion can be found here, > https://bugzilla.kernel.org/show_bug.cgi?id=199003 > And Petr brought the idea to throttle the frequent printk, it's > useless to print the same lines frequently after all. > > v2: fix some typos > v3: limit the print only for the same device > > Suggested-by: Petr Mladek > Suggested-by: Sergey Senozhatsky > Signed-off-by: Wen Yang > Signed-off-by: Jiang Biao > Signed-off-by: Tan Hu > Reviewed-by: Bart Van Assche > CC: BartVanAssche > CC: Petr Mladek > CC: Sergey Senozhatsky > CC: Martin K. Petersen > CC: "James E.J. Bottomley" > CC: Tejun Heo > CC: JasonYan In my machine it works fine. Tested-by: Jason Yan