Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8102913rwb; Wed, 23 Nov 2022 15:41:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf5abQTAbRVKI1bk/vhOyuY1SiMsz5G3CQ2Aj3DiR7r1ZxgBO3wg/fpCEs+sWaOPc41Fk/uM X-Received: by 2002:a63:4b1d:0:b0:476:837c:e0a with SMTP id y29-20020a634b1d000000b00476837c0e0amr10139248pga.411.1669246884512; Wed, 23 Nov 2022 15:41:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669246884; cv=none; d=google.com; s=arc-20160816; b=agWCKAVuyMiX6Dbko15Yh78E9tPTiFimPVKjh7BAnnLn50N0dYcdNygSU/6GfNqPiW eHdvlRx6g5yz9zJrjegiA3eeWMiz1y7ckBzkn8oSa5Yi0lDsXIb1gsxKy70h3xl8PuFD AfQeVLSPqnwfpkQYf+asjocqcFhrZKHpf0CrRHDNOAqoPFBF9Hhn7DOQjzsVTyDKJAVG HKhkNL4V1683ocZoTmxgJHyhiEhwocvpGljvseKCUe0FLTMEc8CBv8aSKNEUdFbETUAV Zi/dC8jUW5CJRGOKW50gZ7FwN/6UVa5UgexEqX5kkZtNrO/Qp7yrty9NE1puhubrYkjz bxZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=TLkYjKbr71Akiy9dqt9Oq5+b30FUC6BakoweMDCwgPI=; b=WQeKBOV8lkHpns7JCbMtL1CEar7DnlI+dgXmyG0LijgMxQpS6v0pRnrQ5eM2tczJ6L hYKjkxFLzPGjhs3D3CdwFQiqlIUIB9cGNi134KR6HqZ76Hv8x7M7r/BRhtidRE4MRj1g DYFHyfzesYrLPhwzbe7B6nFGK/7USaWhzo9u94jawLxZ1KJi8skT689a+V2v3h9WNGuV tkm+2HczXJj8LpuDooxvaRJkK2poxRhJo4BZsMnsfTZ6DkGi9uuEiv5q9/bzBPoF+Wbf TrGSMitXfwKf8+MdLamxBJjK33okujrDwn1GchIM/dUBQUDEQFw/7aQg6fH7Ec8tmjmv 4p8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nctdZzry; 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 p18-20020a170902e75200b00188fe19d3dbsi17754986plf.163.2022.11.23.15.41.13; Wed, 23 Nov 2022 15:41:24 -0800 (PST) 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=nctdZzry; 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 S229644AbiKWXAf (ORCPT + 88 others); Wed, 23 Nov 2022 18:00:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229471AbiKWXAd (ORCPT ); Wed, 23 Nov 2022 18:00:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB2F393CED for ; Wed, 23 Nov 2022 15:00:32 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4829561F68 for ; Wed, 23 Nov 2022 23:00:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BEE0C433D6; Wed, 23 Nov 2022 23:00:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669244431; bh=xMQEI5/UaBXleLy7rFHYc25uhmr6Xx1RJf02gKDCj3M=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=nctdZzryom/KqAWlqstK1IX3ZErCw0/X5k4uA/2V6MLzCwgUcTqhN4zH6R9bAbRI9 KvJyEzaOpSCZ3ORLjDsLGWheT4XrAAIncCtfo7+TOyBRUHqFdCNoXfHUma9WYp7r/w AjrCdqDjbUaJ7H33vIY+y/E10XveRVZvolFq6R14QZ4kUfxeGp3J4mMg+qp3VFmI8f uVv6JLbhmdLY6Rnl7LglwezKbF7G4hjzaOhwWZQIYfVrmOu2RGyMhv1L1QJhLhISWt GyN5jx9bWPP3agxPdRvTOFG60AAJtrVGSHtKRLuOJBISHW8HCwMGKdDcm1XNTJ8NE3 MrXg92lfYJAgg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 37FD85C0DF2; Wed, 23 Nov 2022 15:00:31 -0800 (PST) Date: Wed, 23 Nov 2022 15:00:31 -0800 From: "Paul E. McKenney" To: Frederic Weisbecker Cc: Zhouyi Zhou , fweisbec@gmail.com, tglx@linutronix.de, mingo@kernel.org, dave@stgolabs.net, josh@joshtriplett.org, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH linux-next][RFC]torture: avoid offline tick_do_timer_cpu Message-ID: <20221123230031.GL4001@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20221121035140.118651-1-zhouzhouyi@gmail.com> <20221122013754.GY4001@paulmck-ThinkPad-P17-Gen-1> <20221123222543.GB1395324@lothringen> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221123222543.GB1395324@lothringen> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS 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 On Wed, Nov 23, 2022 at 11:25:43PM +0100, Frederic Weisbecker wrote: > On Mon, Nov 21, 2022 at 05:37:54PM -0800, Paul E. McKenney wrote: > > On Mon, Nov 21, 2022 at 11:51:40AM +0800, Zhouyi Zhou wrote: > > > @@ -358,7 +359,16 @@ torture_onoff(void *arg) > > > schedule_timeout_interruptible(HZ / 10); > > > continue; > > > } > > > +#ifdef CONFIG_NO_HZ_FULL > > > + /* do not offline tick do timer cpu */ > > > + if (tick_nohz_full_running) { > > > + cpu = (torture_random(&rand) >> 4) % maxcpu; > > > + if (cpu >= tick_do_timer_cpu) > > > > Why is this ">=" instead of "=="? > > > > > + cpu = (cpu + 1) % (maxcpu + 1); > > > + } else > > > +#else > > > cpu = (torture_random(&rand) >> 4) % (maxcpu + 1); > > > +#endif > > > > What happens if the value of tick_do_timer_cpu changes between the time of > > the check above and the call to torture_offline() below? Alternatively, > > how is such a change in value prevented? > > It can't, currently tick_do_timer_cpu is fixed when nohz_full is running. > It can however have special values at early boot such as TICK_DO_TIMER_NONE. > But if rcutorture is initialized after smp, it should be ok. Ah, getting ahead of myself, thank you for the info! So the thing to do would be to generate only maxcpu-1 choices. Thanx, Paul > Thanks. > > > > > Thanx, Paul > > > > > if (!torture_offline(cpu, > > > &n_offline_attempts, &n_offline_successes, > > > &sum_offline, &min_offline, &max_offline)) > > > -- > > > 2.34.1 > > >