Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5917192rwp; Mon, 17 Jul 2023 11:30:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlFF7wd+muCcPnHb6UX3aJ4bSmcTAgB7QSKQ02+jmvxa+pyJxduekAiUpIxMxUUlwxkXFZCq X-Received: by 2002:a05:6512:10d6:b0:4fb:7675:1c16 with SMTP id k22-20020a05651210d600b004fb76751c16mr9004574lfg.49.1689618610297; Mon, 17 Jul 2023 11:30:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689618610; cv=none; d=google.com; s=arc-20160816; b=NV+BNQWRpGXlC6jFSgbY+hMS7j6pqjU31JjNzmMiionyVNkgGzA48VXKsHN99MytsV gb05G2qCdrKW72ChUV177sXO7SRVbHH2v4geycbigiSzrCVd5VvrVsM4O+ckTtnO6/Iw KHFicDwtKQtsS7AQ47VLStl8wzVAnCSO4S7bF6HZeNX36nR7Pq5Yg4+7LHXA53TazWc6 WwQPoU/KgBDuNBviqi2pTdKisuWw0y5N344GCLB8xDP4tBub/vsCIvQI7+Kntr5TZJAz PrdDfRwXsUTb8pNl7WrJ/BdOSK3cm+T0Hswne/3RQZcxcca0/iXy1y1+ZQCM98BTso58 sa9w== 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 :dkim-signature; bh=w9fipyXV7rYUmy1uFvN/O+dHPDEwSB+QbFFKBKVtO1A=; fh=Ag0RbRk3LxdpQ9OdMLAf8hbnmFe6FOAHRGAvgVTwgEc=; b=oviBqeK7S9etHdkAVRKb5SaQaC5nz3/8hBvqlQx7OUzoYYXFcvbuUk0oL9/I78nEu4 COtlNKz2LdNdJGRG5N2R20n+ddnQyIQsH/Dt+Q6VVTqPywitrrgDCbPN+GGfx2mVoCvW 82JOX8r8pQGv1ysTHNPcY1pC3qun2yg3HLXkfF1VShcIVfH0+uPELqyN7+CRzHvu90gK NGylmdJ5H5pmhErTqfkLsC/cYhUHmMKuDFZrZpKkPEx+3Ta94UlYT0zIssAWCHTLXDhD 5NdUwt//STEKlIJT8cwu3d6gWTqyfPxkTyz+y13EZ2yJC5maPZZI3/hdcAdtNwLyCoyA 3oEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h0wuZpGJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bm24-20020a0564020b1800b0051e162ffa28si13640001edb.691.2023.07.17.11.29.46; Mon, 17 Jul 2023 11:30:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h0wuZpGJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231707AbjGQSVK (ORCPT + 99 others); Mon, 17 Jul 2023 14:21:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231296AbjGQSUv (ORCPT ); Mon, 17 Jul 2023 14:20:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84939A1; Mon, 17 Jul 2023 11:20:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 21F94611F5; Mon, 17 Jul 2023 18:20:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C4B6C43395; Mon, 17 Jul 2023 18:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689618044; bh=XDuRFq+mHkr5+XpHsV+2nDbFWbS9cEpeXF9JX6lizsE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h0wuZpGJ7JN1bE4+fsoi2u1d+PL8FRvgU4yt0JU5sf6WcLvJHULSxnr3gCQmFdGZ6 xBGkY+hsNjQvzjEc3JYU7cDtdbKeHlhnRAYYZnWD/lX3YGwHNYHv6VXN0PcnWM2Xtf H1PJKsIRf3V97vgU3YHzjFZpYC8mPKOjk4LQ0sLZpd/4ArSr6curreirh3x6haq4lF cmV60F2/THlsq/nOkIpSFdgOOMD4ROjYUmrD3G6eyNof3xt7+x3+tIgK7j4ow0t8+i zjBPt65uOHrtzW1YVxnteQU/qA/z7cZIxzrVwSWOViRB173qvBxq82+v3K+ih6kRNJ LfkBxG3mWJ5tQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 9D205CE097F; Mon, 17 Jul 2023 11:20:43 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH rcu 9/9] rcutorture: Stop right-shifting torture_random() return values Date: Mon, 17 Jul 2023 11:20:42 -0700 Message-Id: <20230717182042.1098651-9-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that torture_random() uses swahw32(), its callers no longer see not-so-random low-order bits, as these are now swapped up into the upper 16 bits of the torture_random() function's return value. This commit therefore removes the right-shifting of torture_random() return values. Signed-off-by: Paul E. McKenney --- kernel/rcu/rcutorture.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index d291a1438c30..ade42d6a9d9b 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -1877,7 +1877,7 @@ static int rcutorture_extend_mask(int oldmask, struct torture_random_state *trsp) { int mask = rcutorture_extend_mask_max(); - unsigned long randmask1 = torture_random(trsp) >> 8; + unsigned long randmask1 = torture_random(trsp); unsigned long randmask2 = randmask1 >> 3; unsigned long preempts = RCUTORTURE_RDR_PREEMPT | RCUTORTURE_RDR_SCHED; unsigned long preempts_irq = preempts | RCUTORTURE_RDR_IRQ; @@ -1936,7 +1936,7 @@ rcutorture_loop_extend(int *readstate, struct torture_random_state *trsp, if (!((mask - 1) & mask)) return rtrsp; /* Current RCU reader not extendable. */ /* Bias towards larger numbers of loops. */ - i = (torture_random(trsp) >> 3); + i = torture_random(trsp); i = ((i | (i >> 3)) & RCUTORTURE_RDR_MAX_LOOPS) + 1; for (j = 0; j < i; j++) { mask = rcutorture_extend_mask(*readstate, trsp); @@ -2137,7 +2137,7 @@ static int rcu_nocb_toggle(void *arg) toggle_fuzz = NSEC_PER_USEC; do { r = torture_random(&rand); - cpu = (r >> 4) % (maxcpu + 1); + cpu = (r >> 1) % (maxcpu + 1); if (r & 0x1) { rcu_nocb_cpu_offload(cpu); atomic_long_inc(&n_nocb_offload); -- 2.40.1