Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp50152rwe; Wed, 24 Aug 2022 16:44:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR51b5GAg5lRKxHFbUadO0H/4GbO2HfKLsxUTrwSMU36Nxymh223705SNoiz8HWQ3mw1j65D X-Received: by 2002:a17:902:b48f:b0:172:b57e:f0ff with SMTP id y15-20020a170902b48f00b00172b57ef0ffmr1128342plr.25.1661384652866; Wed, 24 Aug 2022 16:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661384652; cv=none; d=google.com; s=arc-20160816; b=Uo5RCAz+j1f09ZSgvfGOqqiEa5/igVhZUrZx9aEaDMcoHZWH+cLBDGfGWUEQ5QbVWf 7rH8lle9NtjOex01oMSVy4K6fnksR4qISHjvtBNyVfFVxhYZO3Cc7gFMsnyejX3e2JyQ mjS9oWKZ3QlNRm+vwgOUscjLdKaFYjmaSgULNeI6LntwvAJMHXTdWhUb4zROpsMDazKE taT0I6g6j3QAbuCyometITrZ+rZo6ld50m2dTN/C9vpOJlTrW9Hq/CR0HI8wXa1vGfSJ Ge/mQ+yFCjSiNxvszAQ8gU+MwRQ7nkkQC3lL16+2HKfeqIqkMnF+PKJ23qY5CriWLhKm RBMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=YzSGn2dwYx9MaxeNT5wOgLOGOLdzT7ca2Get9KWngZY=; b=lL6re6v/OZZZCY3rsPJHV7Fqfx3Fv4qBLBQDyEno0nuKxumi2bpnXlVV7mRajPDspj YE0gBwbijA9od/Ah8AdfhNdiPW3s9MFgP4g2JQLCu5lzkMbiHo0oeKQBZyk2JnP5M+CC x+PPy5dGhapAvOhvQUv/q0aAdFkEZx3cBpMAB1tWHFzg+acQZQkduJdPbC3GFaT69aZO 4t3KkBHwuDv24PkKWOcytsShca/42SHY++lNQIpgRlgq38sVg50UCBKOmkcPA274m79j wvDGhrvSLyDyTso7DocjzBaRe9Wm6N0DBuiWjIG7RHa+7us3N2JbjlMhbIPPUP+n7LkA 1nTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=Hr3sPSxU; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j17-20020aa78dd1000000b0052dacafe991si4639379pfr.117.2022.08.24.16.44.02; Wed, 24 Aug 2022 16:44:12 -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=@joelfernandes.org header.s=google header.b=Hr3sPSxU; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230045AbiHXWyQ (ORCPT + 99 others); Wed, 24 Aug 2022 18:54:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbiHXWyP (ORCPT ); Wed, 24 Aug 2022 18:54:15 -0400 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31BAD792D7 for ; Wed, 24 Aug 2022 15:54:14 -0700 (PDT) Received: by mail-io1-xd2b.google.com with SMTP id x64so14634673iof.1 for ; Wed, 24 Aug 2022 15:54:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=YzSGn2dwYx9MaxeNT5wOgLOGOLdzT7ca2Get9KWngZY=; b=Hr3sPSxUonzow3KkSdGol2N/BWjIgts6D3nLpP2kKmImFaMw16jbrkb1YAKrPn0LMr dj8E6kU9LssBAhB1DwsfXXC3yEBem03+ikqOw+cqBBG5P2NMcD8pwg3sA1PILsrMBj9z AgP6Y+cPupOJkxApWu5pC39RwKCYRd7+ARvWQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=YzSGn2dwYx9MaxeNT5wOgLOGOLdzT7ca2Get9KWngZY=; b=IPCWLfP9lXRVko9o8mQcl/1THdKSiB/7Y9SsNdj40mBXasrYIlYcclHApznN7fM/jZ XLOflUqMyDaVPEp0bHDzgqauxfxfKgXZ/A3EC060v5isCEaGRBmamR8xssm3pbsA/io9 4jvb/IY4xD2Hc7HIXU3vaAKOF6E5n6b+2swFmFxz4o0NHGvKO4YqNHI/VmJqlkv5fuLu U8Y2ikB0n9xEpd8sRQ4p6aVLinZwEx/BS4egMDSwU1PzcobQUqslp1fhX9YNSGlu2/45 a+CdgspWFvWTjRCPPukXXWMEj0CcMWlP+c2V9tWRopPjjiH7ptqC3CK7tj3aJgyYppSr 3yig== X-Gm-Message-State: ACgBeo2PcM04aZXbZ2ag/ktEzNoA1o2XmpRvioDvhRhpN38mHC+xSHfk TRskfQqFzMWnWlrVhWJi16bKZzHhH8M8knTr8Dvysw== X-Received: by 2002:a5d:9914:0:b0:67c:2039:caff with SMTP id x20-20020a5d9914000000b0067c2039caffmr467782iol.201.1661381653450; Wed, 24 Aug 2022 15:54:13 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <20220824192129.GE6159@paulmck-ThinkPad-P17-Gen-1> From: Joel Fernandes Date: Wed, 24 Aug 2022 18:54:01 -0400 Message-ID: Subject: Re: [RFC 06/10] rcu/hotplug: Make rcutree_dead_cpu() parallel To: "Paul E. McKenney" 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 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. - Joel