Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1657444pxk; Fri, 18 Sep 2020 20:29:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDMpKlkHKxRU2ULCuQ+ZLozV9ESJE13pavBIW0r7JYUZngm5gy7UabBaX16PWbrNugAZ7M X-Received: by 2002:a05:6402:1495:: with SMTP id e21mr41064685edv.146.1600486160634; Fri, 18 Sep 2020 20:29:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600486160; cv=none; d=google.com; s=arc-20160816; b=dvG94raq9LYZnhzqtM3ENv25uKKTg+Puqw+JqTPhKHfcmLvs/UisTnCFCWQsGuv7/I LX4B0I+K+9uqSctJsdmj55eoxx67a9nxEv2ItQ12vHPTHWEaCnjZn+Uj/hL6mdg4BRS/ +p5aeNR9rXMm4Oi376X0akNQ1qMxX7wdOWfPJ+CiRrCYc/SoQavoyMMfIYUhX2W1qyJO X7Z5JTHOYPZWm9JcCj8twjyu1kdZoJ+6B7pGuMxzAAApube7tYRYnrloaMgSti/Oh6K4 ckv/eP+BxsgbhAls3IaQE3t4bRLe+TR9Wsmg7kD8CaY6586gKyEmQ4vM04c53I+2JGix OzBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=EUewd8EB8PQ7qf0EvnFn5AdAD/7/iK0E+Ge9QpdqZ5g=; b=FZ5/CTT425k0y9eKo0jbWvBQg0amDZKUvP+wWm/U7gRUsFeesfGmhkMWviWEvg1gtG EQp9q9S+de3vexFisaA8FIwbBoHm/YKuJx1MtjWGEx+0HmbtylCWd35KdqT93xpQOf0I 3/kBoaBncFv9KpHOxHhZivGF2HiXwSmuVXXnrfH5Z96PcW1j1yt5acHLCv4oV+n7YxTr makf06U4Rr6TrB9G7lO0qLiBwMriSXKj6v68B+tp3/flepQSqqbHigI+NbeJioTCuY8u w1Z8VMU83uypIF2dmDB4Hz1LgxNOOcBca/Wa38znE3jiVlUVafpDStvGElxwCl+xdrP9 WJfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nq4si3916322ejb.569.2020.09.18.20.28.57; Fri, 18 Sep 2020 20:29:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726157AbgISDZv (ORCPT + 99 others); Fri, 18 Sep 2020 23:25:51 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:49648 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726104AbgISDZv (ORCPT ); Fri, 18 Sep 2020 23:25:51 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id DF6A8AB6E1ECC9ABE957; Sat, 19 Sep 2020 11:25:47 +0800 (CST) Received: from [10.174.177.167] (10.174.177.167) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.487.0; Sat, 19 Sep 2020 11:25:45 +0800 Subject: Re: [PATCH v2 1/2] locktorture: doesn't check nreaders_stress when no readlock support To: CC: Josh Triplett , Davidlohr Bueso , , References: <20200918033755.GS29330@paulmck-ThinkPad-P72> <20200918114424.100852-1-houtao1@huawei.com> <20200918175911.GV29330@paulmck-ThinkPad-P72> From: Hou Tao Message-ID: Date: Sat, 19 Sep 2020 11:25:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200918175911.GV29330@paulmck-ThinkPad-P72> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.167] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paul, On 2020/9/19 1:59, Paul E. McKenney wrote: > On Fri, Sep 18, 2020 at 07:44:24PM +0800, Hou Tao wrote: >> When do locktorture for exclusive lock which doesn't have readlock >> support, the following module parameters will be considered as valid: >> >> torture_type=mutex_lock nwriters_stress=0 nreaders_stress=1 >> >> But locktorture will do nothing useful, so instead of permitting >> these useless parameters, let's reject these parameters by returning >> -EINVAL during module init. >> >> Signed-off-by: Hou Tao > > Much better, much easier for people a year from now to understand. > Queued for v5.11, thank you! > > I did edit the commit log a bit as shown below, so please let me > know if I messed anything up. > Thanks for your edit, it looks more clearer. Regards, Tao > Thanx, Paul > > commit 4985c52e3b5237666265e59f56856f485ee36e71 > Author: Hou Tao > Date: Fri Sep 18 19:44:24 2020 +0800 > > locktorture: Ignore nreaders_stress if no readlock support > > Exclusive locks do not have readlock support, which means that a > locktorture run with the following module parameters will do nothing: > > torture_type=mutex_lock nwriters_stress=0 nreaders_stress=1 > > This commit therefore rejects this combination for exclusive locks by > returning -EINVAL during module init. > > Signed-off-by: Hou Tao > Signed-off-by: Paul E. McKenney > > diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c > index 316531d..046ea2d 100644 > --- a/kernel/locking/locktorture.c > +++ b/kernel/locking/locktorture.c > @@ -870,7 +870,8 @@ static int __init lock_torture_init(void) > goto unwind; > } > > - if (nwriters_stress == 0 && nreaders_stress == 0) { > + if (nwriters_stress == 0 && > + (!cxt.cur_ops->readlock || nreaders_stress == 0)) { > pr_alert("lock-torture: must run at least one locking thread\n"); > firsterr = -EINVAL; > goto unwind; > . >