Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3594639pxf; Mon, 22 Mar 2021 10:02:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbb78kZcreTt1jF9l4vklOZeeQAPDbq/nZqoI+nnTktTuipqwo5WOu5KC4mQUcMtneXMpP X-Received: by 2002:aa7:c6da:: with SMTP id b26mr604847eds.254.1616432577919; Mon, 22 Mar 2021 10:02:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616432577; cv=none; d=google.com; s=arc-20160816; b=iMzIZmQKnCGn0Bgajsd739yrxblqyg0GC9zKCG1bcowcLJN1vNN/GjeK0ZRuGCQVeL EmVEg7pfntf7PmhbCwPe9cME6qhAcELC2yt6R71V1mGAsbS1ztZzdJ74FBabsZkgUosH CWFN/2AltiVvYWyLbV9lAZXir4oJZ+82fVJXdMhH2L6D3rYy7QydpF5w3T+iBDEDfSEP 7SlJn8YTO9i3/diCXNcxv+jgJ7LT4RLfMOhQdooNGOZI8OuqJHz7QcV8vp1QW77ei4/x OQwrWrqVr5onlFpkW5xRBwthhcezkg6tFavLWIQL+0nT78uF2wKj6cDrha3pYF33vTU2 lnBg== 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:message-id:subject:cc:to:from:date:dkim-signature; bh=o6v/zfMN7cP3Lwj/tSzWNB8OGnpUUKIljfTnOZ6Had0=; b=DxVuTIqmfyQNPiI1g7BTr7+WMR0glNwk4PzJ9IbhDqMY1ey2DwVoDsAbOzQUBtFdKd 854Zb68IG4C7DI5jQ7wRsnOnLsqjIwP5wG54NuF57wE8erwm49OHVbK6xevK8ZSirsny vIPRlRgBorzlg67znlwFSx0QSpThscyO3oq9YKR/bX3Xa2+6gGtqTaHWN9N5GaZMn7i8 Tw6EqFnqHlL3urbJBDSycauJgqT0xV/aZplNs4SAcSZzRePkf0LgDIxwh+oGwlhLVARV YZVDIPIrL34nuzElOgiX5S2C2pdS1k51fDFaPjQKB5yN2i4MnDbQcOzx5HLGcOcDiEcj axTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=FHHq2DkU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ci8si11530097ejc.428.2021.03.22.10.02.35; Mon, 22 Mar 2021 10:02:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=FHHq2DkU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231435AbhCVRBS (ORCPT + 99 others); Mon, 22 Mar 2021 13:01:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231690AbhCVRA5 (ORCPT ); Mon, 22 Mar 2021 13:00:57 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27684C061574 for ; Mon, 22 Mar 2021 10:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=o6v/zfMN7cP3Lwj/tSzWNB8OGnpUUKIljfTnOZ6Had0=; b=FHHq2DkUkE/53iQTvTmDsTq2si gTvOn1lx1kbl7J4elBqsc5zqAUrsRrTXTsD8b3Tv2Jey5ICRBLivk3BQXPDQVY42qM7caY6DT/xm9 Y6DKHwlp7Dj0p0fcH20BPWwWxSm+YnC2fI7H7cHeb+CLGm6+sET1JDbs8y/zkpR05xGvaUQCOQ11r /q5NL/mCDOmG5GHSY0Ir//ENZsAKp+zVsqGV3YhKTCsR/lZzxZmv9bwUEhdG7jKwf4KmuT2ICsjbL 9/70QbZG0RfVGysuZZXzM+ZiViMZg7NrnSghy6GUSh4u4hpZ/Nq49oyGbvhzyVxFnXt6b4RhuDATC tufVW+Sw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lONtU-008oXp-NY; Mon, 22 Mar 2021 16:59:17 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 2967B301A32; Mon, 22 Mar 2021 17:59:08 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0D7E62C1677EF; Mon, 22 Mar 2021 17:59:08 +0100 (CET) Date: Mon, 22 Mar 2021 17:59:08 +0100 From: Peter Zijlstra To: Rasmus Villemoes Cc: x86@kernel.org, jpoimboe@redhat.com, jbaron@akamai.com, rostedt@goodmis.org, ardb@kernel.org, linux-kernel@vger.kernel.org, sumit.garg@linaro.org, oliver.sang@intel.com, jarkko@kernel.org Subject: Re: [PATCH 2/3] static_call: Align static_call_is_init() patching condition Message-ID: References: <20210318113156.407406787@infradead.org> <20210318113610.636651340@infradead.org> 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 Fri, Mar 19, 2021 at 03:40:46PM +0100, Rasmus Villemoes wrote: > On 19/03/2021 15.13, Peter Zijlstra wrote: > > >> Dunno, probably overkill, but perhaps we could have an atomic_t (or > >> refcount, whatever) init_ref inited to 1, with init_ref_get() doing an > >> inc_unless_zero, and iff you get a ref, you're free to call (/patch) > >> __init functions and access __initdata, but must do init_ref_put(), with > >> PID1 dropping its initial ref and waiting for it to drop to 0 before > >> doing the *free_initmem() calls. > > > > I'd as soon simply add another SYSTEM state. That way we don't have to > > worry about who else looks at RUNNING for what etc.. > > I don't understand. How would that solve the > > PID1 PIDX > ok = system_state < INIT_MEM_GONE; > system_state = INIT_MEM_GONE; > free_initmem(); > system_state = RUNNING; > if (ok) > poke init mem > > race? Argh, I meant to put it before SMP bringup, but then still have to run the smp_init calls :/ N/m, you're quite right.