Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1279464rwb; Fri, 18 Nov 2022 15:57:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf4JYOt4uGgda2uR45XcXWoaQW4EfT78gQA2bmrB2wDGh5LTzEsT77C+oXEAKVYWGalowsz6 X-Received: by 2002:a17:906:1495:b0:7ad:d250:b904 with SMTP id x21-20020a170906149500b007add250b904mr7823714ejc.633.1668815851546; Fri, 18 Nov 2022 15:57:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668815851; cv=none; d=google.com; s=arc-20160816; b=RyAspFJ4/lREF/mX2tmKkWmeKXPNdUiBYRfAqzk2s2ahmlu6sN2LORejA18Nb+EAsV 5GClrP2y9209SNfD+bR2M2CfJ2W36m8i3DIpnQ94VwzvaGWeVH5sK2q/Aqz69l9pdPXV UDu8UsI7Q7uarYTXzFeElgkTTjhK1mz9PWo7cnnjmRut44fCzqh9gJLPc4Uq4XUaSfQ+ UbebJCryiw6EIRcDB8NbZqULIJ4K2eVZgSGMEtGqiefwx5+rdTjgtX1fHXXAP1v5CHXY X0mx+QUszXGYr8wCpRPbNi5cosqJCFSlxUpEzqlY1vUsAlxWgiY9EYhzvPgC/AxNQ6zR zRWA== 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=swmcE3mmL4A+fhX1ZiCvAhFKua5THO0dRBvoWLey/Ro=; b=SkVviiObFGesa9axrDrMrE8cvI/B5u+g3srzPalguPXnMK/ueo9d30ni71itx/6es0 QNwL8egAjXWrq+hYZRgCxcc9JCCEh9vmwl3qA8+99T/14PGlmuDzr8scYtODNLzGGIFu XRb6cnc0hcNxjQKK1MHXkeJzSljUcbMpydqsIJ/ootZxmXPS50SlgSWTdHtdryj55VbH Y3HQlA2jcR+q5M2f/ru+lL+iPcay5bh4xNt9ji57Oqgiljb8IpmfMQzBh8QBEQemgR0D 1jHzHn00+gkAfdkzpTED2lkzURIM1gF6SmLlrl/rWo+XujME3vJpbJ9r1RuutlidP8Rr Tquw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=blwOQFIu; 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 q14-20020a056402248e00b0046184b7c4besi3996977eda.462.2022.11.18.15.57.09; Fri, 18 Nov 2022 15:57:31 -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=blwOQFIu; 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 S236680AbiKRXnW (ORCPT + 90 others); Fri, 18 Nov 2022 18:43:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237153AbiKRXmp (ORCPT ); Fri, 18 Nov 2022 18:42:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D7448CBA7; Fri, 18 Nov 2022 15:23:53 -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 6470B627C1; Fri, 18 Nov 2022 23:23:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD33FC433D7; Fri, 18 Nov 2022 23:23:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668813830; bh=7XBXVXhCCU9Em+DNHd2vQ8ORuGvO8P1sSalA66wErCk=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=blwOQFIuTxcwSMpQfrpRN3vC+oXQ40d5Lx+Q0/7zTNaBJTFcIK2j+q+GS+VrLqn5K B79Cgvf4A9grFKlXAGPPqkY1372eQqdzBUtKiJRKwDkDbr3G0/6ds+KtZjWXsigm6X vsXaSRjoqxaoNAL0BfBqbQThoPiMeK3UphY5UqY7q+MiLYEP1oF72dXrBWzBwuanFC XouSFG7wXvG9SgmIPoEudeVCIW7/1x2bRf951UUJoJov4aYB+CERze2SH3/yvbxIrG rUT2UPdfTMSZeiU9K1cTI+qkRHzn2amvhwVfHBX3NBEmv9HO51kk9FFC3j/w8rtxbE 7wy4ERwgRrMvw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 6A8A35C0EBE; Fri, 18 Nov 2022 15:23:50 -0800 (PST) Date: Fri, 18 Nov 2022 15:23:50 -0800 From: "Paul E. McKenney" To: Sven Schnelle Cc: Davidlohr Bueso , Josh Triplett , linux-kernel@vger.kernel.org, rcu@vger.kernel.org Subject: Re: [PATCH 1/2] torture: use for_each_present() loop in torture_online_all() Message-ID: <20221118232350.GA2340322@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20221111125126.3319474-1-svens@linux.ibm.com> <20221111125126.3319474-2-svens@linux.ibm.com> <20221111185331.GA725751@paulmck-ThinkPad-P17-Gen-1> <20221114163009.GE4001@paulmck-ThinkPad-P17-Gen-1> <20221115134139.GI4001@paulmck-ThinkPad-P17-Gen-1> <20221117150637.GB4001@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221117150637.GB4001@paulmck-ThinkPad-P17-Gen-1> 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 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 Thu, Nov 17, 2022 at 07:06:37AM -0800, Paul E. McKenney wrote: > On Thu, Nov 17, 2022 at 07:30:32AM +0100, Sven Schnelle wrote: > > Hi Paul, > > > > "Paul E. McKenney" writes: > > > > >> > Yes, rcutorture has lower-level checks for CPUs being hotplugged > > >> > behind its back. Which might be sufficient. But this patch is in > > >> > response to something bad happening if the CPU is also not present in > > >> > the cpu_present_mask. Would that same bad thing happen if rcutorture saw > > >> > the CPU in cpu_online_mask, but by the time it attempted to CPU-hotplug > > >> > it, that CPU was gone not just from cpu_online_mask, but also from > > >> > cpu_present_mask? > > >> > > > >> > Or are CPUs never removed from cpu_present_mask? > > >> > > >> In the current implementation CPUs can only be added to the > > >> cpu_present_mask, but never removed. This might change in the future > > >> when we get support from firmware for that, but the current s390 code > > >> doesn't do that. > > > > > > Very good! > > > > > > Then could the patch please check that bits are never removed? > > > That way the code will complain should firmware support be added. > > > > > > Thanx, Paul > > > > I'm not sure whether i fully understand that. If the CPU could > > be removed from the system and the cpu_present_mask, that could > > happen at any time. So i don't see how we should check about that? > > Well, that is my question to you. ;-) > > Suppose we have the following sequence of events: > > o rcutorture sees that CPU 5 is in cpu_present_mask, but offline. > > o rcutorture therefore decides to online CPU 5. > > o s390 firmware removes CPU 5, and s390 architecture code then > clears it from the cpu_present_mask. > > o rcutorture proceeds with onlining CPU 5. > > Don't we then get the same problem that prompted you to change from > cpu_possible_mask to cpu_present mask? If not, why can't the rcutorture > code continue to use cpu_possible_mask? > > If it really is bad to try to online or offline a CPU that is in > cpu_possible_mask but not in cpu_present_mask, and if CPUs can be removed > from cpu_present_mask, then we need some way to synchronize the removal > of CPUs from cpu_present_mask. There are of course a lot of possible > ways to do that synchronization, for example, protecting cpu_present_mask > with a mutex or similar. > > Alternatively, s390 could restrict things. One way to do that would > be to turn off rcutorture's use of CPU hotplug when running on s390, > for example, by using the module parameters provided for that purpose. > Another way to do that would be to refrain from removing CPUs from > cpu_present_mask while rcutorture is running. > > Are there other approaches? For the near term, why not have rcutorture keep a snapshot of cpu_present_mask, and splat if a CPU is ever removed from that mask? That would catch any issues, and defer any synchronization decisions to a time at which we actually have some chance of knowing what is going on. Thanx, Paul