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=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=ham 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 8487DC43381 for ; Mon, 1 Feb 2021 17:10:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 44EBD64EB9 for ; Mon, 1 Feb 2021 17:10:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231344AbhBARKy (ORCPT ); Mon, 1 Feb 2021 12:10:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:40366 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229599AbhBARKv (ORCPT ); Mon, 1 Feb 2021 12:10:51 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 7026D64EA9; Mon, 1 Feb 2021 17:10:09 +0000 (UTC) Date: Mon, 1 Feb 2021 12:10:07 -0500 From: Steven Rostedt To: Alexey Kardashevskiy , Ingo Molnar Cc: LKML , Mathieu Desnoyers , Matt Mullins , paulmck , Alexei Starovoitov , Daniel Borkmann , Dmitry Vyukov , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , Kees Cook , Peter Zijlstra , Josh Poimboeuf Subject: Re: [PATCH v5] tracepoint: Do not fail unregistering a probe due to memory failure Message-ID: <20210201121007.51c0ac59@gandalf.local.home> In-Reply-To: <13608cdc-2068-6340-6795-28944c9fe3ca@ozlabs.ru> References: <20210127170721.58bce7cc@gandalf.local.home> <20210130093626.0b7b3b1b@oasis.local.home> <20210130094211.719f03a6@oasis.local.home> <13608cdc-2068-6340-6795-28944c9fe3ca@ozlabs.ru> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 1 Feb 2021 12:18:34 +1100 Alexey Kardashevskiy wrote: > > Just curious, does the following patch fix it for v5? > > > Yes it does! Thanks for verifying. > > > > > > -- Steve > > > > diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c > > index 7261fa0f5e3c..cf3a6d104fdb 100644 > > --- a/kernel/tracepoint.c > > +++ b/kernel/tracepoint.c > > @@ -306,6 +306,7 @@ static int tracepoint_remove_func(struct tracepoint *tp, > > tp->unregfunc(); > > > > static_key_disable(&tp->key); > > + tracepoint_synchronize_unregister(); > > rcu_assign_pointer(tp->funcs, tp_funcs); > > } else { > > rcu_assign_pointer(tp->funcs, tp_funcs); > > OK, since it would be expensive to do a synchronization on every removal like that, but the tp->funcs should not be reset. It appears that your check is still required, since the iterator has been added. The quick fix is the check you gave. But I think we could optimize this (not having to dereference the array twice, and do the check twice) by making the iterator part of the tp_funcs array, and having the rest of the array as its argument. But that can be a separate update. The check you added should be a patch and marked for stable. Care to send it, and mark it for stable as well as: Fixes: d25e37d89dd2f ("tracepoint: Optimize using static_call()") Thanks! -- Steve