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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43204C433F5 for ; Mon, 14 Feb 2022 15:15:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B30FF6B007B; Mon, 14 Feb 2022 10:15:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AE0526B007D; Mon, 14 Feb 2022 10:15:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D8816B007E; Mon, 14 Feb 2022 10:15:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id 8F96F6B007B for ; Mon, 14 Feb 2022 10:15:11 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5558521476 for ; Mon, 14 Feb 2022 15:15:11 +0000 (UTC) X-FDA: 79141733622.05.9C471E4 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf13.hostedemail.com (Postfix) with ESMTP id C4E1420008 for ; Mon, 14 Feb 2022 15:15:10 +0000 (UTC) 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 dfw.source.kernel.org (Postfix) with ESMTPS id EF5F461256; Mon, 14 Feb 2022 15:15:09 +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 X-Rspamd-Queue-Id: C4E1420008 X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of "SRS0=3I1i=S5=goodmis.org=rostedt@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=3I1i=S5=goodmis.org=rostedt@kernel.org"; dmarc=none X-Stat-Signature: hkukaqa6rqb4grbayujbetbushg9hkpj X-Rspamd-Server: rspam03 X-HE-Tag: 1644851710-122666 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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