From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 577E8C04AA5 for ; Wed, 24 Aug 2022 23:01:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230398AbiHXXBk (ORCPT ); Wed, 24 Aug 2022 19:01:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbiHXXBi (ORCPT ); Wed, 24 Aug 2022 19:01:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15C2D61D67; Wed, 24 Aug 2022 16:01:37 -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 dfw.source.kernel.org (Postfix) with ESMTPS id A438F6198D; Wed, 24 Aug 2022 23:01:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02320C433C1; Wed, 24 Aug 2022 23:01:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661382096; bh=K3AbTfljAyXVZM4eIUALsi1LVRgo6MtUgR1LZeL3H60=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=kJkmYAXd/qlzEbph6FQwXr/qP+E/zZg6j3xY1ujeUbS3h3cWZ3ynHv+m5qAgkcB80 DShJqWwlCImTDbBZ0WpyBm4oB6bgygxoZNDovR5SZ8EEx/wa1gpfvIqHObZ5prFmq3 kxS4arHARwRBVwJmu2ChH7vk1DnJ+qs+OX4uSkUdOjeaKcDkKTAiqyUNbgDvJ3W7Iz iaJ0iDVfC5xXVNrQzDhW09BHqkXOl/Uktkbz6+IeYwswvo2C55ZHAAmHcLP/H6rJ34 Y/4SsELKzrIc1EoJdw/KL84HAH8UnKmMYaYrjUDsGnEsSUB+nKhWNVu73UFwFwnu6T 2AvwLTo99keBQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 8DDC25C05C9; Wed, 24 Aug 2022 16:01:35 -0700 (PDT) Date: Wed, 24 Aug 2022 16:01:35 -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 Subject: Re: [RFC 06/10] rcu/hotplug: Make rcutree_dead_cpu() parallel Message-ID: <20220824230135.GG6159@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> <20220824192129.GE6159@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 24, 2022 at 06:54:01PM -0400, Joel Fernandes wrote: > On Wed, Aug 24, 2022 at 3:21 PM Paul E. McKenney wrote: > > > > 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. > > Thanks for confirming, I'll queue it into my next revision of the series. Sounds good! Thanx, Paul