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 X-Spam-Level: X-Spam-Status: No, score=-7.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4E44C63777 for ; Wed, 18 Nov 2020 04:58:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 88AF4246A4 for ; Wed, 18 Nov 2020 04:58:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="op/XhzDH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726557AbgKRE5s (ORCPT ); Tue, 17 Nov 2020 23:57:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:49262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725446AbgKRE5s (ORCPT ); Tue, 17 Nov 2020 23:57:48 -0500 Received: from paulmck-ThinkPad-P72.home (50-39-104-11.bvtn.or.frontiernet.net [50.39.104.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A4B852463F; Wed, 18 Nov 2020 04:57:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605675467; bh=P6T1UQXF1TGia034LOF14sr42Ekt76ERzkz1oq8E3pE=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=op/XhzDH1RzBgaMZ3dceJ1Hc/gg18B0n4VUvAVUZZIo1VagaAJQ21dC8+BDqWtUaZ 2ASqsbR/ubmvO2BKkDKKAbbQUpc9tmajREw1+l6cANKSskmxNpVvItB1agtPvoih07 p2OPJoQMLYrEtSWwDUGmFI8N3KzukBKvbFECk0J0= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 5CE003523137; Tue, 17 Nov 2020 20:57:47 -0800 (PST) Date: Tue, 17 Nov 2020 20:57:47 -0800 From: "Paul E. McKenney" To: Steven Rostedt Cc: Matt Mullins , Mathieu Desnoyers , Ingo Molnar , Alexei Starovoitov , Daniel Borkmann , Dmitry Vyukov , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , linux-kernel , netdev , bpf Subject: Re: [PATCH] bpf: don't fail kmalloc while releasing raw_tp Message-ID: <20201118045747.GN1437@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20201115055256.65625-1-mmullins@mmlx.us> <20201116121929.1a7aeb16@gandalf.local.home> <1889971276.46615.1605559047845.JavaMail.zimbra@efficios.com> <20201116154437.254a8b97@gandalf.local.home> <20201116160218.3b705345@gandalf.local.home> <1368007646.46749.1605562481450.JavaMail.zimbra@efficios.com> <20201116171027.458a6c17@gandalf.local.home> <609819191.48825.1605654351686.JavaMail.zimbra@efficios.com> <20201118004242.rygrwivqcdgeowi7@hydra.tuxags.com> <20201117200922.195ba28c@oasis.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201117200922.195ba28c@oasis.local.home> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Nov 17, 2020 at 08:09:22PM -0500, Steven Rostedt wrote: > On Tue, 17 Nov 2020 16:42:44 -0800 > Matt Mullins wrote: > > > > > Indeed with a stub function, I don't see any need for READ_ONCE/WRITE_ONCE. > > > > I'm not sure if this is a practical issue, but without WRITE_ONCE, can't > > the write be torn? A racing __traceiter_ could potentially see a > > half-modified function pointer, which wouldn't work out too well. > > This has been discussed before, and Linus said: > > "We add READ_ONCE and WRITE_ONCE annotations when they make sense. Not > because of some theoretical "compiler is free to do garbage" > arguments. If such garbage happens, we need to fix the compiler" > > https://lore.kernel.org/lkml/CAHk-=wi_KeD1M-_-_SU_H92vJ-yNkDnAGhAS=RR1yNNGWKW+aA@mail.gmail.com/ I have to ask... Did the ARM compilers get fixed? As of a few months ago, they would tear stores of some constant values. > > This was actually my gut instinct before I wrote the __GFP_NOFAIL > > instead -- currently that whole array's memory ordering is provided by > > RCU and I didn't dive deep enough to evaluate getting too clever with > > atomic modifications to it. > > The pointers are always going to be the architecture word size (by > definition), and any compiler that tears a write of a long is broken. But yes, if the write is of a non-constant pointer, the compiler does have less leverage. Thanx, Paul