Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1127484pxk; Fri, 18 Sep 2020 04:39:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxL4hiX8lt3cNL37Mf6kojJ1a8nyZT1PkJ1IxkK3/u68asyeHbv8dQj0cdWyBbLgrkLXR1D X-Received: by 2002:a17:906:c191:: with SMTP id g17mr28380575ejz.117.1600429140133; Fri, 18 Sep 2020 04:39:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600429140; cv=none; d=google.com; s=arc-20160816; b=szLX5QUWGADQe2vk9grWufsHZBznMrXRO16sjDTsl1zNNycuhagBJ6Vgdplm66i7MB DvuImMcluoNibzmn9YoNkRioWRF6UU712Ui2/lWwJtyFTrOSdeOGDPtqWbk5+7hG/TGR vGJb91sT96p1Q+iFM4YuGrwu84i0Xj27z/1yXOkSOpnCqzFFcJAPuX3Lv7tyB0Z/kXEQ Y8xEDIUZz9/Vbwj7xkB6yAzYBap9zY3NOEShcVpdvTJrU8M6+khSUAOUVn6y3RtZX+4Y Mr2MG7iV9XqwCcCOSv6+3ISm/gKCmOhPH04PaMCz7BCO43WxWDZOnYK3Q3GncMEwCZL7 dD2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5x3Q3md5qGvRlEB3C6YWreaiL2Y+wCY3JbYMnwoJSEM=; b=PKEVSD+YdmI9HUfKVR+j/7b1R2uizz0Ds/rxbi9bFdBxwiU1u1kOQz5iMU0TbE/31H GGniVDWutL1evZ+7ivrNPttNC/8eilvDWtam0u1r6UWfVnBbhVle2pyZRb9unXZ4HyXO Kt4xEBc1vnLBdeNp8Wxfe19XwG0RBjvoe1wxeri6VmN1POMz6XnBbJCP1wZFmKJRgYfO 2GMb/IaLiSDZ5DQFUrRQ3D2Jwjk8JQCnHsBCQdLUxkEfLKvm2ysYJntGpJT7iGrnbYKb qdf+745whDh5X2CwfyFstAQQRDjHv7uqe7PoagwCieTr8mKeZlPDzhNsnFbpGxL9WO3/ wHFw== 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 v11si2006089eju.488.2020.09.18.04.38.36; Fri, 18 Sep 2020 04:39:00 -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 S1726479AbgIRLhj (ORCPT + 99 others); Fri, 18 Sep 2020 07:37:39 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:13259 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726115AbgIRLhj (ORCPT ); Fri, 18 Sep 2020 07:37:39 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 6D142A4D0735F1DBFD98; Fri, 18 Sep 2020 19:37:35 +0800 (CST) Received: from huawei.com (10.90.53.225) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.487.0; Fri, 18 Sep 2020 19:37:29 +0800 From: Hou Tao To: "Paul E. McKenney" CC: Josh Triplett , Davidlohr Bueso , , , Subject: [PATCH v2 1/2] locktorture: doesn't check nreaders_stress when no readlock support Date: Fri, 18 Sep 2020 19:44:24 +0800 Message-ID: <20200918114424.100852-1-houtao1@huawei.com> X-Mailer: git-send-email 2.25.0.4.g0ad7144999 In-Reply-To: <20200918033755.GS29330@paulmck-ThinkPad-P72> References: <20200918033755.GS29330@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.90.53.225] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- kernel/locking/locktorture.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c index 9cfa5e89cff7f..bebdf98e6cd78 100644 --- a/kernel/locking/locktorture.c +++ b/kernel/locking/locktorture.c @@ -868,7 +868,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; -- 2.25.0.4.g0ad7144999