Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1753559pxm; Thu, 24 Feb 2022 08:44:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5Y9p1ylUItmE2k3y/4rKCwGdaraCIgzMBRwI+TX8/aHS9SHvq87FBEICWSQGIGs/mWSag X-Received: by 2002:a63:c112:0:b0:364:12c8:8673 with SMTP id w18-20020a63c112000000b0036412c88673mr2954007pgf.576.1645721090177; Thu, 24 Feb 2022 08:44:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645721090; cv=none; d=google.com; s=arc-20160816; b=Fmw0kcRoimTDNDCn7lcqcYMJ67v9SUe2WoMb+/4dumt4XvLaBMfryB7THXWZUxBrj1 hAS2Z3VP8Dm+BRWSxReAmmC+THU0LdsRr/90v8/i+Gg6pEGhr4mB2UE25AGciPBM/zXq MhAruuj5TgWgyJNqVn5Nw4NSy6Od43kkHSij/4HsYFfGPK3izLo1utcx7/H9LY7fM4wL FbUt64PQ/b/hrk2HuH2rqlnS0nm65PIjSHyKeANPrF/FvxzB3pZevJk51i9oNMmxGojp GwCzh1PDZC1CknQddIwPqBLngq+Z1lXVM++CC5K+fJnOFscFK/XysBKVAcLu8kfPFqw9 RfXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=xtLXriWSNONX0fiMsJpB0qTJBmLgKOFU5gFc9UkoOn0=; b=rqUl0J/emQtZ97k+lrAm9/vQdpg0Ij7v+slTITGmHPHEOytTAxc7TYFDKbu3dROxO6 qQMzxG/cQFPBLeDhfPCy6xN9315tgpNaEEXh6fBCuIxv1vw0ebrfQlnmbSFiWbBfkop8 VpuTsRj/wvA/RvorkPv4hBoXDp7TPhkoRwm/MWnmd/1xcV7mNZkEWVRwQe5XHSL8KNlY MzvNzUzPWEJ50a9gJL1xVMYTRED1cwQKPBFb4cRZzVix+RIQrJ3q8E7U+C/n9Uywaga+ LwAP4Nb8rH7cMQd5UclPQYFzpOysrHHxziHP7wX54IgknhpWwdd1TmTZmsG38CaobH1o ytkw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u3si3120342ple.615.2022.02.24.08.44.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 08:44:50 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 66DB61AAA70; Thu, 24 Feb 2022 08:24:11 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230366AbiBXQDV (ORCPT + 99 others); Thu, 24 Feb 2022 11:03:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233802AbiBXQDB (ORCPT ); Thu, 24 Feb 2022 11:03:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B412539B9D for ; Thu, 24 Feb 2022 08:02:24 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 225DF6179C for ; Thu, 24 Feb 2022 16:01:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02C66C340E9; Thu, 24 Feb 2022 16:01:31 +0000 (UTC) Date: Thu, 24 Feb 2022 11:01:30 -0500 From: Steven Rostedt To: Masami Hiramatsu Cc: Peter Zijlstra , x86@kernel.org, joao@overdrivepizza.com, hjl.tools@gmail.com, jpoimboe@redhat.com, andrew.cooper3@citrix.com, linux-kernel@vger.kernel.org, ndesaulniers@google.com, keescook@chromium.org, samitolvanen@google.com, mark.rutland@arm.com, alyssa.milburn@intel.com, mbenes@suse.cz, alexei.starovoitov@gmail.com Subject: Re: [PATCH v2 12/39] x86/ibt,ftrace: Search for __fentry__ location Message-ID: <20220224110130.4f4ae4ac@gandalf.local.home> In-Reply-To: <20220224105847.5c899324@gandalf.local.home> References: <20220224145138.952963315@infradead.org> <20220224151322.714815604@infradead.org> <20220225005520.c69be2fbdbd28028361792d9@kernel.org> <20220224105847.5c899324@gandalf.local.home> 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 24 Feb 2022 10:58:47 -0500 Steven Rostedt wrote: > On Fri, 25 Feb 2022 00:55:20 +0900 > Masami Hiramatsu wrote: > > > > unsigned long ftrace_location(unsigned long ip) > > > { > > > - return ftrace_location_range(ip, ip); > > > + struct dyn_ftrace *rec; > > > + unsigned long offset; > > > + unsigned long size; > > > + > > > + rec = lookup_rec(ip, ip); > > > + if (!rec) { > > > + if (!kallsyms_lookup_size_offset(ip, &size, &offset)) > > > + goto out; > > > + > > > + if (!offset) > > > > Isn't this 'if (offset)' ? > > No, the point to only look for the fentry location if the ip passed in > points to the start of the function. IOW, +0 offset. > I do agree with Masami that it is confusing. Please add a comment: /* Search the entire function if ip is the start of the function */ if (!offset) [..] -- Steve > > > > > > > + rec = lookup_rec(ip - offset, (ip - offset) + size); > > > + } > > > + > > > + if (rec) > > > + return rec->ip; > > > + > > > +out: > > > + return 0;