Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp599052imp; Thu, 21 Feb 2019 07:32:42 -0800 (PST) X-Google-Smtp-Source: AHgI3IYIn/iiheBGXXpwGc0KJopN3VpQ0GiB34rND79SVlKvqtgYDdoJy0hHE+mdhVRMRh3kJTKb X-Received: by 2002:a63:e10:: with SMTP id d16mr35179919pgl.148.1550763162125; Thu, 21 Feb 2019 07:32:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550763162; cv=none; d=google.com; s=arc-20160816; b=1LzDma1qdh7x4pS9HIInhyUnvq+2ivAqiHrwnhA70zLc7K1/08UoszmlKq9zkRZCKQ 0jR42Az4mkkTt/P81fqIR9DS592PbBPThFYiG60CcjjaCYxFw8cczjD0+SjCYTQZKiWC KqYI8R2EmKo/CblRAhdFt4gK+pimbLc/QhPGYfe0qIjvbR6LU/x2lX5sw+5+eT4cJ31N OQT5ToQDDxIOHP5VK3xQJY5Cw2VyBqWrXNGXwY4bDttJf9iuM92m0zZ1+5TCR0bVebXs P9B8e5fBJjq84DQ3HIUGXJbGoo718G2pr6IznEVpRZj7eJp5KCjLOgyGhl5iMaFyWMU0 0fZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=H2AlPf/San2lH+W5wwdKet9prltcvmYRTKXWCKIfSww=; b=1GiXzsiXTX3JfnfCL28FxmhoED7Ihi9EWyAqIUyLaHsdJnZl6bZ2bSAnT95sJxcaLK 7uy9iXcX/N6bGH5rxrcCzytzNrYrzB256INrXOdK7Ye0TWpPmTGsMJrrgwAgx8tGOVgY +LG8h2aoYn2hooO3LqDrASKe6bJy8eWWd/FcYJ3kcqA01VDkHr2AbYL5alRy+GuKobbB mK1ifVJDkNd7aW/CdZOukzurNe4/1jW+Ic2sKIy64X/lOyAO6TKFREhOHCUUYITXLf2y Wj0B501kXSCzwrdAq79XcXO44cd6j0ikxepodeekoQ6UDWWnMuv9BhdwLQrg4ljwfJ7t eA4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=TY0N5Az3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i36si22926716plb.210.2019.02.21.07.32.26; Thu, 21 Feb 2019 07:32:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=TY0N5Az3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728340AbfBUPbh (ORCPT + 99 others); Thu, 21 Feb 2019 10:31:37 -0500 Received: from merlin.infradead.org ([205.233.59.134]:36598 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726279AbfBUPbh (ORCPT ); Thu, 21 Feb 2019 10:31:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=H2AlPf/San2lH+W5wwdKet9prltcvmYRTKXWCKIfSww=; b=TY0N5Az39TgIvC740C8G8lm1J UdXrhFrJoKZozRHHFymJfOWOEzjaS8w8q2r/MlzsVS81u4OEprd7WPYqenFm0/310G/6hBkc7FFX2 3ltei01yEDDPhzzSQTlaXOLDnHbevN+NTOn0k23qvjsBUk9AxMeFZ7MC85N4wCvPE7JL56kIWUnQo tqUL+iVjRDOR1iO/tF+bhycyT2ql3aBbb7t5mPNZeZkmvcRR+/22DC7obFYWZrNfpT+ALT35y+Ucp Nrp9vkb4bAzYPEEgAh+J4p7gF+5bT0SSPVLyglgG9+CApCCzJpZDVRpfYhPO8P10MMNxtWWa3i53A hzGJezN+g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwqIE-00021n-C0; Thu, 21 Feb 2019 15:29:47 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 908DD2030EE5E; Thu, 21 Feb 2019 16:29:44 +0100 (CET) Date: Thu, 21 Feb 2019 16:29:44 +0100 From: Peter Zijlstra To: Joel Fernandes Cc: linux-kernel@vger.kernel.org, Alexei Starovoitov , Christian Brauner , Daniel Borkmann , David Ahern , "David S. Miller" , Ido Schimmel , Ingo Molnar , "moderated list:INTEL ETHERNET DRIVERS" , Jakub Kicinski , Jeff Kirsher , Jesper Dangaard Brouer , John Fastabend , Josh Triplett , keescook@chromium.org, Lai Jiangshan , Martin KaFai Lau , Mathieu Desnoyers , netdev@vger.kernel.org, "Paul E. McKenney" , rcu@vger.kernel.org, Song Liu , Steven Rostedt , xdp-newbies@vger.kernel.org, Yonghong Song Subject: Re: [PATCH RFC 4/5] sched/topology: Annonate RCU pointers properly Message-ID: <20190221152944.GS32494@hirez.programming.kicks-ass.net> References: <20190221054942.132388-1-joel@joelfernandes.org> <20190221054942.132388-5-joel@joelfernandes.org> <20190221091944.GY32477@hirez.programming.kicks-ass.net> <20190221151057.GA19213@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190221151057.GA19213@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 21, 2019 at 10:10:57AM -0500, Joel Fernandes wrote: > Hi Peter, > > Thanks for taking a look. > > On Thu, Feb 21, 2019 at 10:19:44AM +0100, Peter Zijlstra wrote: > > On Thu, Feb 21, 2019 at 12:49:41AM -0500, Joel Fernandes (Google) wrote: > > > > > Also replace rcu_assign_pointer call on rq->sd with WRITE_ONCE. This > > > should be sufficient for the rq->sd initialization. > > > > > @@ -668,7 +668,7 @@ cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu) > > > > > > rq_attach_root(rq, rd); > > > tmp = rq->sd; > > > - rcu_assign_pointer(rq->sd, sd); > > > + WRITE_ONCE(rq->sd, sd); > > > dirty_sched_domain_sysctl(cpu); > > > destroy_sched_domains(tmp); > > > > Where did the RELEASE barrier go? > > > > That was a publish operation, now it is not. > > Funny thing is, initially I had written this patch with smp_store_release() > instead of WRITE_ONCE, but checkpatch complaints with that since it needs a > comment on top of it, and I wasn't sure if RELEASE barrier was the intent of > using rcu_assign_pointer (all the more reason to replace it with something > more explicit). > > I will replace it with the following and resubmit it then: > > /* Release barrier */ > smp_store_release(&rq->sd, sd); > > Or do we want to just drop the "Release barrier" comment and live with the > checkpatch warning? How about we keep using rcu_assign_pointer(), the whole sched domain tree is under rcu; peruse that destroy_sched_domains() function for instance. Also check how for_each_domain() uses rcu_dereference().