Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752189AbdLGAXJ (ORCPT ); Wed, 6 Dec 2017 19:23:09 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:39230 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751748AbdLGAXI (ORCPT ); Wed, 6 Dec 2017 19:23:08 -0500 Date: Wed, 6 Dec 2017 16:23:04 -0800 From: "Paul E. McKenney" To: lianglihao@huawei.com Cc: guohanjun@huawei.com, lihao.liang@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] rcutorture: Add usage warnings for parameters gp_normal and gp_exp Reply-To: paulmck@linux.vnet.ibm.com References: <1512557468-52633-1-git-send-email-lianglihao@huawei.com> <1512557468-52633-2-git-send-email-lianglihao@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1512557468-52633-2-git-send-email-lianglihao@huawei.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17120700-0008-0000-0000-000002ABD787 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008162; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000244; SDB=6.00956481; UDB=6.00483503; IPR=6.00736518; BA=6.00005729; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00018391; XFM=3.00000015; UTC=2017-12-07 00:23:04 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17120700-0009-0000-0000-00003785385D Message-Id: <20171207002304.GG7829@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-06_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712070003 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1831 Lines: 50 On Wed, Dec 06, 2017 at 06:51:07PM +0800, lianglihao@huawei.com wrote: > From: Lihao Liang > > In rcu_torture_fakewriter(), when param gp_normal is equal to > gp_exp (even when they are false), both cur_ops->sync() and > cur_ops->exp_sync() may be invoked. This commit checks that > if any of them is NULL, it will print out a warning message. > It also emits a warning if gp_normal is true but cur_ops->sync() > is NULL. > > Signed-off-by: Lihao Liang Queued for review and testing, thank you! Passes light rcutorture testing. Thanx, Paul > --- > > I think the last else-if block is redundant and I choose to include it > for completeness. In addition, it may be better to have more informative > warning messages for the new if-else blocks. Feel free to revise them. > > kernel/rcu/rcutorture.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c > index d1b64dc..d2abebd 100644 > --- a/kernel/rcu/rcutorture.c > +++ b/kernel/rcu/rcutorture.c > @@ -937,6 +937,16 @@ rcu_torture_writer(void *arg) > synctype[nsynctypes++] = RTWS_SYNC; > else if (gp_sync && !cur_ops->sync) > pr_alert("%s: gp_sync without primitives.\n", __func__); > + if (gp_normal == gp_exp) { > + if (!cur_ops->sync) > + pr_alert("%s: gp_sync without primitives.\n", __func__); > + if (!cur_ops->exp_sync) > + pr_alert("%s: gp_exp without primitives.\n", __func__); > + } else if (gp_normal && !cur_ops->sync) { > + pr_alert("%s: gp_sync without primitives.\n", __func__); > + } else if (gp_exp && !cur_ops->exp_sync) { > + pr_alert("%s: gp_exp without primitives.\n", __func__); > + } > if (WARN_ONCE(nsynctypes == 0, > "rcu_torture_writer: No update-side primitives.\n")) { > /* > -- > 2.7.4 >