Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp976069rwe; Wed, 24 Aug 2022 12:23:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR6zyMRsioOnkMW+qQBac8pb8YUXe9o31a89akeZ+fCf5A/xi1Oer6zvDFJZ6KUdMjRI3JLh X-Received: by 2002:a17:907:720f:b0:731:8a9d:5ade with SMTP id dr15-20020a170907720f00b007318a9d5ademr263640ejc.768.1661369021063; Wed, 24 Aug 2022 12:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661369021; cv=none; d=google.com; s=arc-20160816; b=vW80hhSEaPR3GKI7eYAoofuYA1/VlwZwMWHIFSKsrR7x7Af+FnF5IApk6ulBRYV2u/ 8LDkWGS9f+jdtwE8myjWaPMQYkAYj0wQ4YYZ8+Bf1ICSYmrhChbAWk/e9x3UVLrtOHd4 SmFlQHqU9CcL/xXOCZYeJl2tUMFFHjQiSwhPCKYLmnqSU5dGufyIm2xLxay779cHkdsF d+SFpt96kGgzF7flqdCBtGGQkzQB9zsecgixnLz26sVP7gVmZJnZ0Nsx9APuh7Hit88b N0EUZqcViw8t7ISuwTE0k2ZA3PfxA3Cr1E8pRGf2fu74sOQAZumwKfmbgQbG38ZnYaiu X+cw== 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=j6YeFWVV6RFR5PrbBIcACQmUxyC0Y2lWzE2sBsFYzuo=; b=TAl4T8O+IQIyMnd523TiVqGQrAVdzAI65POJB9F049NPYp70VWXm035FiPfQ0cHwdS Ddt72xNZvwJJRlSIUmt2dofPVxKz3iAPBm7Mi84IqvYcJ7FVO4Qk2pHJoPV/MzZ7/Tq/ coocvbRmgcKsQr1o394XA3BMbONyiCc3XnSwL/kx/CtblQ1MK4uX46faybtpnG712rat BSMdRQmHCCdvhue/lyb+eonavrKItFp9nfLBSXe7kqblzqMObaAKvAODEClGT5CDcYVq 3OcGc9uP4vfgwHfSX3EIWPHv9LReOS9FS3453lRDUOMZ1apGFlRgOzVoUYVGZ052LqYa WUiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XMDu8XhM; 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 d21-20020aa7d695000000b0043d14d03dd9si4002862edr.496.2022.08.24.12.23.15; Wed, 24 Aug 2022 12:23:41 -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=XMDu8XhM; 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 S236708AbiHXTVi (ORCPT + 99 others); Wed, 24 Aug 2022 15:21:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237759AbiHXTVe (ORCPT ); Wed, 24 Aug 2022 15:21:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BB925B074; Wed, 24 Aug 2022 12:21:32 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id 88735B82660; Wed, 24 Aug 2022 19:21:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EF44C433D6; Wed, 24 Aug 2022 19:21:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661368890; bh=sSUP1soFdnM84s15NQ7LYscruLuO6dP0arOnIGJ7h90=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=XMDu8XhMJx0rsy/rJ2rpKKgnKf8QbCT+PZGopvuw85IPjO8eYQhho0XHOjV2JE8pz MHy7dPW9MVusnJ3Nt/PU3vVenz15TXFtayFs6qON5DTJnbnF9RQ0H0+KLQItIcQdw6 Q7lNmlx/zSOsLZkxQ05/1yxQ36So/si7CUVZ1gWXvv9LB+nAWWBC44s4SARCYdIeHZ r6K4LVqm4btxJkUV7K0yxGy1uV8ZDV8qAutwTVnXGywTKoCvh0egyGOafzEt9sQeD9 B9++OAP08sM6ywcb/XyH+LEg3pUH4tK3Z3xHWMd22mjiExn9hLmAhxHBsz7rRJceXq rNktdWdfZaZhg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id A55D95C055D; Wed, 24 Aug 2022 12:21:29 -0700 (PDT) Date: Wed, 24 Aug 2022 12:21:29 -0700 From: "Paul E. McKenney" To: Joel Fernandes Cc: Pingfan Liu , LKML , rcu , Frederic Weisbecker , Neeraj Upadhyay , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Thomas Gleixner , Steven Price , Mark Rutland , Kuppuswamy Sathyanarayanan , "Jason A. Donenfeld" , boqun.feng@gmail.com Subject: Re: [RFC 06/10] rcu/hotplug: Make rcutree_dead_cpu() parallel Message-ID: <20220824192129.GE6159@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20220822021520.6996-1-kernelfans@gmail.com> <20220822021520.6996-7-kernelfans@gmail.com> <20220822024528.GC6159@paulmck-ThinkPad-P17-Gen-1> <20220823030125.GJ6159@paulmck-ThinkPad-P17-Gen-1> <20220824162050.GA6159@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 On Wed, Aug 24, 2022 at 01:26:01PM -0400, Joel Fernandes wrote: > > > On 8/24/2022 12:20 PM, Paul E. McKenney wrote: > > On Wed, Aug 24, 2022 at 09:53:11PM +0800, Pingfan Liu wrote: > >> On Tue, Aug 23, 2022 at 11:01 AM Paul E. McKenney wrote: > >>> > >>> On Tue, Aug 23, 2022 at 09:50:56AM +0800, Pingfan Liu wrote: > >>>> On Sun, Aug 21, 2022 at 07:45:28PM -0700, Paul E. McKenney wrote: > >>>>> On Mon, Aug 22, 2022 at 10:15:16AM +0800, Pingfan Liu wrote: > >>>>>> In order to support parallel, rcu_state.n_online_cpus should be > >>>>>> atomic_dec() > >>>>>> > >>>>>> Signed-off-by: Pingfan Liu > >>>>> > >>>>> I have to ask... What testing have you subjected this patch to? > >>>>> > >>>> > >>>> This patch subjects to [1]. The series aims to enable kexec-reboot in > >>>> parallel on all cpu. As a result, the involved RCU part is expected to > >>>> support parallel. > >>> > >>> I understand (and even sympathize with) the expectation. But results > >>> sometimes diverge from expectations. There have been implicit assumptions > >>> in RCU about only one CPU going offline at a time, and I am not sure > >>> that all of them have been addressed. Concurrent CPU onlining has > >>> been looked at recently here: > >>> > >>> https://docs.google.com/document/d/1jymsaCPQ1PUDcfjIKm0UIbVdrJAaGX-6cXrmcfm0PRU/edit?usp=sharing > >>> > >>> You did us atomic_dec() to make rcu_state.n_online_cpus decrementing be > >>> atomic, which is good. Did you look through the rest of RCU's CPU-offline > >>> code paths and related code paths? > >> > >> I went through those codes at a shallow level, especially at each > >> cpuhp_step hook in the RCU system. > > > > And that is fine, at least as a first step. > > > >> But as you pointed out, there are implicit assumptions about only one > >> CPU going offline at a time, I will chew the google doc which you > >> share. Then I can come to a final result. > > > > Boqun Feng, Neeraj Upadhyay, Uladzislau Rezki, and I took a quick look, > > and rcu_boost_kthread_setaffinity() seems to need some help. As it > > stands, it appears that concurrent invocations of this function from the > > CPU-offline path will cause all but the last outgoing CPU's bit to be > > (incorrectly) set in the cpumask_var_t passed to set_cpus_allowed_ptr(). > > > > This should not be difficult to fix, for example, by maintaining a > > separate per-leaf-rcu_node-structure bitmask of the concurrently outgoing > > CPUs for that rcu_node structure. (Similar in structure to the > > ->qsmask field.) > > > > There are probably more where that one came from. ;-) > > Should rcutree_dying_cpu() access to rnp->qsmask have a READ_ONCE() ? I was > thinking grace period initialization or qs reporting paths racing with that. Its > just tracing, still :) Looks like it should be regardless of Pingfan's patches, given that the grace-period kthread might report a quiescent state concurrently. Good catch! Thanx, Paul