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=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 74472C63777 for ; Tue, 17 Nov 2020 23:06:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DFE902223D for ; Tue, 17 Nov 2020 23:06:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="fd6lbXHk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726846AbgKQXFy (ORCPT ); Tue, 17 Nov 2020 18:05:54 -0500 Received: from mail.efficios.com ([167.114.26.124]:48338 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726199AbgKQXFx (ORCPT ); Tue, 17 Nov 2020 18:05:53 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 120D32E572F; Tue, 17 Nov 2020 18:05:52 -0500 (EST) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 55Cdjqm2TOjt; Tue, 17 Nov 2020 18:05:51 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id C2F392E572E; Tue, 17 Nov 2020 18:05:51 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com C2F392E572E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1605654351; bh=4EF5Pyi9GurCoXIT1YIBSNpuGGryjRU/WtX91KjzkWk=; h=Date:From:To:Message-ID:MIME-Version; b=fd6lbXHkF4L3gy4LMwDQMF56a1l97+Al8jnBzfWblTIxc6H5OOueNc3cVcouMvIHo HkL5IRyXtcOBEzDDBjns1AgGfABE3jLN47sHjqlsAuvNHXPfNlXLXPTbhn9pytO3ib Iib531WdH8viGhWQNPNsd/uvqZx2D+kwAIih8XYP+XbNA1F4dw2JWpnrygzQqhpHI+ qJPvQT0jY/hnrMxnng1Fh8HxxIHsRKVGyTeX0X8QyBUfmq4HuJvslXqcZSYSjjlx50 LrgjIlCe+spHwgiPDihC/XqmexXOYRNq7ODRk/ii7KIMTgQ22sQ8eACYsje/zxmpFf WcfH+ltNeOaJg== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id M9rmpwAeEYN0; Tue, 17 Nov 2020 18:05:51 -0500 (EST) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id B07312E5722; Tue, 17 Nov 2020 18:05:51 -0500 (EST) Date: Tue, 17 Nov 2020 18:05:51 -0500 (EST) From: Mathieu Desnoyers To: rostedt Cc: paulmck , Matt Mullins , 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 Message-ID: <609819191.48825.1605654351686.JavaMail.zimbra@efficios.com> In-Reply-To: <20201116171027.458a6c17@gandalf.local.home> References: <00000000000004500b05b31e68ce@google.com> <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> Subject: Re: [PATCH] bpf: don't fail kmalloc while releasing raw_tp MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.26.124] X-Mailer: Zimbra 8.8.15_GA_3975 (ZimbraWebClient - FF82 (Linux)/8.8.15_GA_3975) Thread-Topic: don't fail kmalloc while releasing raw_tp Thread-Index: rDgx+9686j10JxC+vTlp4lzx8j00fQ== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Nov 16, 2020, at 5:10 PM, rostedt rostedt@goodmis.org wrote: > On Mon, 16 Nov 2020 16:34:41 -0500 (EST) > Mathieu Desnoyers wrote: [...] >> I think you'll want a WRITE_ONCE(old[i].func, tp_stub_func) here, matched >> with a READ_ONCE() in __DO_TRACE. This introduces a new situation where the >> func pointer can be updated and loaded concurrently. > > I thought about this a little, and then only thing we really should worry > about is synchronizing with those that unregister. Because when we make > this update, there are now two states. the __DO_TRACE either reads the > original func or the stub. And either should be OK to call. > > Only the func gets updated and not the data. So what exactly are we worried > about here? Indeed with a stub function, I don't see any need for READ_ONCE/WRITE_ONCE. However, if we want to compare the function pointer to some other value and conditionally do (or skip) the call, I think you'll need the READ_ONCE/WRITE_ONCE to make sure the pointer is not re-fetched between comparison and call. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com