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 33B80C433E6 for ; Wed, 3 Feb 2021 17:26:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D8B2864F6A for ; Wed, 3 Feb 2021 17:26:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232425AbhBCRZm (ORCPT ); Wed, 3 Feb 2021 12:25:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:47010 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232301AbhBCRYj (ORCPT ); Wed, 3 Feb 2021 12:24:39 -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 CE9B964F86; Wed, 3 Feb 2021 17:23:55 +0000 (UTC) Date: Wed, 3 Feb 2021 12:23:54 -0500 From: Steven Rostedt To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , Josh Poimboeuf , Mathieu Desnoyers , Ingo Molnar , Alexei Starovoitov , Daniel Borkmann , Dmitry Vyukov , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , netdev , bpf , Kees Cook , Florian Weimer , syzbot+83aa762ef23b6f0d1991@syzkaller.appspotmail.com, syzbot+d29e58bb557324e55e5e@syzkaller.appspotmail.com, Matt Mullins Subject: Re: [for-next][PATCH 14/15] tracepoint: Do not fail unregistering a probe due to memory failure Message-ID: <20210203122354.5da83b21@gandalf.local.home> In-Reply-To: References: <20210203160517.982448432@goodmis.org> <20210203160550.710877069@goodmis.org> 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: netdev@vger.kernel.org On Wed, 3 Feb 2021 18:09:27 +0100 Peter Zijlstra wrote: > On Wed, Feb 03, 2021 at 11:05:31AM -0500, Steven Rostedt wrote: > > + if (new) { > > + for (i = 0; old[i].func; i++) > > + if ((old[i].func != tp_func->func > > + || old[i].data != tp_func->data) > > + && old[i].func != tp_stub_func) > > logical operators go at the end.. Agreed. I just added that "if (new) {" around the original block, didn't think about the formatting when doing so. > > > + new[j++] = old[i]; > > + new[nr_probes - nr_del].func = NULL; > > + *funcs = new; > > + } else { > > + /* > > + * Failed to allocate, replace the old function > > + * with calls to tp_stub_func. > > + */ > > + for (i = 0; old[i].func; i++) > > { > > > + if (old[i].func == tp_func->func && > > + old[i].data == tp_func->data) { > > like here. > > > + old[i].func = tp_stub_func; > > + /* Set the prio to the next event. */ > > + if (old[i + 1].func) > > + old[i].prio = > > + old[i + 1].prio; > > multi line demands { }, but in this case just don't line-break. Sure. > > > + else > > + old[i].prio = -1; > > + } > > } > > > + *funcs = old; > > + } > > } > > debug_print_probes(*funcs); > > return old; > > @@ -295,10 +341,12 @@ static int tracepoint_remove_func(struct tracepoint *tp, > > tp_funcs = rcu_dereference_protected(tp->funcs, > > lockdep_is_held(&tracepoints_mutex)); > > old = func_remove(&tp_funcs, func); > > - if (IS_ERR(old)) { > > - WARN_ON_ONCE(PTR_ERR(old) != -ENOMEM); > > + if (WARN_ON_ONCE(IS_ERR(old))) > > return PTR_ERR(old); > > - } > > + > > + if (tp_funcs == old) > > + /* Failed allocating new tp_funcs, replaced func with stub */ > > + return 0; > > { } Even if it's just a comment that causes multiple lines? I could just move the comment above the if. This has already been through my test suite, and since the changes requested are just formatting and non-functional, I'll just add a clean up patch on top. Thanks! -- Steve