Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1387019pxk; Fri, 18 Sep 2020 11:03:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTMwS3XuwwnVn8Ov2rye2HmyPOLOevo3cnFs8MdFhLrQBEw8TZ4yy978szJ9b20+e/Nv8E X-Received: by 2002:aa7:c504:: with SMTP id o4mr40994627edq.82.1600452181887; Fri, 18 Sep 2020 11:03:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600452181; cv=none; d=google.com; s=arc-20160816; b=vroVllTV2Su5CFqgBImSpyc2S0RygVEmwNODy/zy5ZQQzrJyqmdqYdHE3W02/yOxfV gVrhZcEW9+ARE+pGPr8YEPEAYfQtH5PJ4fyFAjKVVyNS3CmUJQA55CL0Owx4/urqgUH8 3Kg0kjSoP2mJbYOatafEWgS2Y0ud1PtSHtaxYlh4ZAz6Aqt0vVbv8Fm44LfvV2Yxpacz qhpjuAzZGc4mNxojkoaowk6BGM/vq5nNiEkQcVliSRpfKBnVLfjdnzz5c9v87dxLndmG gZ/Oj26jJHVMpKGM2AGzJjwfZ8S0I2/2NDnFC6AvT8jppXWbV5ZVSllBQv+sdriUmxI6 xo+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=9K9+VsLjd8FKaLgmMJ9Ksgf/EbpQgd9rqDMwhnPz9RU=; b=W6SJThQW58HyG8P2dx0zkdm+pjabzG/DVRFmsjHY7JB7aINLmd9biRZ2agyUQCxWzn KvTK5Q8hqMfQ68fx7S8yH2yHYoRrEmJvw/ukHiyKRbRa4KwWapboE9xXlsLCVqBELGn9 NRwV8ZmKVwg0dylvckeVr2R3bDJrPyCwK4IM6domkb6AoolksDkRIAMySE1s8/WAx+e/ 69WEIGhQMeKecK0v36xl5U1f2LKrOf5DhR55E1gQ0jTERObeLRNueWSNkc3INlGmBwZl dvRHBrbGUDVqwh3ZoWKR682vZnbI7gDVDENN91fqmTKEh3JnKATR3gKyPyprJDyGfvQ2 Cg7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ymfu+wGX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fw23si2867094ejb.402.2020.09.18.11.02.38; Fri, 18 Sep 2020 11:03:01 -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; dkim=pass header.i=@kernel.org header.s=default header.b=ymfu+wGX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726276AbgIRR7N (ORCPT + 99 others); Fri, 18 Sep 2020 13:59:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:60608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726007AbgIRR7M (ORCPT ); Fri, 18 Sep 2020 13:59:12 -0400 Received: from paulmck-ThinkPad-P72.home (unknown [50.45.173.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 00FBC21734; Fri, 18 Sep 2020 17:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600451952; bh=RCXbSmb6TBTU6Nop+hAYsV3487c8KGvxhJr+53EhKec=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=ymfu+wGX0x9B5IGQMtA1nMLh/EusxF0K33xJ2JSuxrX8fKlJQsSTWuVJc0yPUewBv mFPmT6E9WrIkc7O2N3jaMFkxkMFIx8UPs+wPukeTQ2+jbY5Nyswc6lh+9iWjmaA/hs uLQMJiFtqU92H73YN52/pcnZv1qoumHyc5yVn5ME= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 9781A35226AD; Fri, 18 Sep 2020 10:59:11 -0700 (PDT) Date: Fri, 18 Sep 2020 10:59:11 -0700 From: "Paul E. McKenney" To: Hou Tao Cc: Josh Triplett , Davidlohr Bueso , linux-kernel@vger.kernel.org, rcu@vger.kernel.org Subject: Re: [PATCH v2 1/2] locktorture: doesn't check nreaders_stress when no readlock support Message-ID: <20200918175911.GV29330@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200918033755.GS29330@paulmck-ThinkPad-P72> <20200918114424.100852-1-houtao1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200918114424.100852-1-houtao1@huawei.com> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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;