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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C352FC433F5 for ; Mon, 14 Feb 2022 15:15:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241541AbiBNPPW (ORCPT ); Mon, 14 Feb 2022 10:15:22 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235450AbiBNPPW (ORCPT ); Mon, 14 Feb 2022 10:15:22 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 992AB488B7; Mon, 14 Feb 2022 07:15:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id EB5BECE1824; Mon, 14 Feb 2022 15:15:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B4F4C340E9; Mon, 14 Feb 2022 15:15:08 +0000 (UTC) Date: Mon, 14 Feb 2022 10:15:06 -0500 From: Steven Rostedt To: Peter Zijlstra Cc: Randy Dunlap , Andrew Morton , broonie@kernel.org, mhocko@suse.cz, sfr@canb.auug.org.au, linux-next@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, mm-commits@vger.kernel.org, Josh Poimboeuf Subject: Re: mmotm 2022-02-11-15-07 uploaded (objtool: ftrace_likely_update) Message-ID: <20220214101506.3e69ea97@gandalf.local.home> In-Reply-To: References: <20220211230819.191B1C340E9@smtp.kernel.org> <8074da01-7aa3-9913-1a1e-2ce307ccdbbd@infradead.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: linux-next@vger.kernel.org On Sat, 12 Feb 2022 09:06:49 +0100 Peter Zijlstra wrote: > Yes, TRACE_BRANCH_PROFILING and PROFILE_ALL_BRANCHES are fundamentally > broken and I have no intention of trying to fix them. > > The moment we pull PTI into noinstr C code this will result in insta > boot fail. Actually, I don't think anyone has every used the "tracers" for this, and I will be happy to get rid of it: void ftrace_likely_update(struct ftrace_likely_data *f, int val, int expect, int is_constant) { unsigned long flags = user_access_save(); /* A constant is always correct */ if (is_constant) { f->constant++; val = expect; } ------8<------ /* * I would love to have a trace point here instead, but the * trace point code is so inundated with unlikely and likely * conditions that the recursive nightmare that exists is too * much to try to get working. At least for now. */ trace_likely_condition(f, val, expect); ----->8------- /* FIXME: Make this atomic! */ if (val == expect) f->data.correct++; else f->data.incorrect++; user_access_restore(flags); } EXPORT_SYMBOL(ftrace_likely_update); The above with the cut lines I added. I still use the likely and unlikely counters. Would it be possible to mark that function as "noinstr" and still record them (I don't care if there's races where we miss a few or add a few too many). But they have been really affective in finding bad locations of likely and unlikely callers. As I said. I have no problem with removing the trace portion of that code. It was more of an academic exercise than a useful one, but the counters are still very useful to have. -- Steve