Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp221624pxm; Fri, 25 Feb 2022 06:55:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJyR694zCC1D3e/MFR4xFOD4eZvkeNR09hJIhIn7dTfk9bSbajARr2h7J7TOQdos7i5wQ7wx X-Received: by 2002:a63:90c8:0:b0:365:5cc7:e776 with SMTP id a191-20020a6390c8000000b003655cc7e776mr6366230pge.13.1645800926837; Fri, 25 Feb 2022 06:55:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645800926; cv=none; d=google.com; s=arc-20160816; b=gHsLPObY9AnzbDu2YVPgFbYZpQ67p0ZI9qhGSNUXqtIqnqlO0xIYPIVYyp7WK7/MA1 b/NmzH9/qVhJfacfvN6hekSVnHWXKLHWR2tRxRakieeRiWORZdRlwmSpW4WuwCKkmz+i L78qWtNG+3Tp7OQnPwKdIo4/z8ALPlOYlcnQ6od3TRgwU3qwcfUnd+vQP6G4KCxoFN0w scCPT3qxXuv1y256iZrAugme/0Q4Mr9Pw6MR6Bbr7Yzz23i4rE7Bh/801rOrvJM3fFzQ TpRf8SCI+I6Woh5yFE5CNfTbamAs8p+h6o05VJgc7o8krsfAm6jhiz0FInprRfgyLJB4 SYBA== 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 :dkim-signature; bh=EEX/XnJ157HyHh4fsKzP0gwEA1HwD//1IdCINPZ+0fs=; b=dFnpI5nyf4io9BLYIJN80Gvb+HnQN1sltcysiC07n6LCuzuttOBxSrZ81bLcvUaOsl xtwiJVVHEvlq5LhgKBEvva6AZKwrU3iOUias+qiVvfQK6uic7mPNyzhamefPNE8gcXa4 gWaMPbw3i+QIRIHvyg/4/7BEPlRpDEVz3aGKoUa4d1VwV/WL1HEJ+h/NvoxUrjgYDtL8 wdcC1f5MLvlUcUY0Qs+tM2lOq1cYYGJHFY8YJ8WrwhVRXwa17fFrWYvCATblShDClVFc Nyj57N9FRS9jmf0fz1My8cWfnzmoEEWC8EEvpsBWD9UQlscIqMyiu/vjCzEnbmPjOubL Hy+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="qht9oQi/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a6-20020a63e406000000b003738e626e51si1939805pgi.229.2022.02.25.06.55.09; Fri, 25 Feb 2022 06:55:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="qht9oQi/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239406AbiBYKUw (ORCPT + 99 others); Fri, 25 Feb 2022 05:20:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238179AbiBYKUu (ORCPT ); Fri, 25 Feb 2022 05:20:50 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70D1A1C233E for ; Fri, 25 Feb 2022 02:20:17 -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 77BC8CE2429 for ; Fri, 25 Feb 2022 10:20:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7C55C340E7; Fri, 25 Feb 2022 10:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645784413; bh=jTN6lFqaS32dJ2UbgZGYAvzDkSeCb/06dnDC06bxVD8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=qht9oQi/uwHy7zPXb1T63ftiT8u3kdL+ml2WdA6QCIN2LCEdqMWQBz+K17pIwhOka Zpk5SCUwFxIkzkGhkM8LUZ/3Ot7BB+0CemetqOxR7+7ma7CuMkEhSzizYBdg5RZ5mJ a7r6fbeHinrLavoEc5YGchz7ww9VK0nzCjrHFdey6SVT04DBr8vnPBOTpIecs5fDLu f3EWyNx1Z1xLXQRT/wrF4pl4PX9DHM+sqrcMEc/BwD0iyhYR5MAhoUZ8yqZAiuuv/x W2yZL//0n8HHs1Ubvb3bBf6CvzWVg7uB/b3m5Lvw1UctgX9+ky7Z3dSRbYitxEmlzd 4GBGEyr+AIS/Q== Date: Fri, 25 Feb 2022 19:20:08 +0900 From: Masami Hiramatsu To: Steven Rostedt 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: <20220225192008.d7a4f2b5558fe43c95909777@kernel.org> In-Reply-To: <20220224211919.0612a3f6@rorschach.local.home> References: <20220224145138.952963315@infradead.org> <20220224151322.714815604@infradead.org> <20220225005520.c69be2fbdbd28028361792d9@kernel.org> <20220224105847.5c899324@gandalf.local.home> <20220225103449.6084e5314273556f35107cd9@kernel.org> <20220224211919.0612a3f6@rorschach.local.home> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; 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=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 21:19:19 -0500 Steven Rostedt wrote: > On Fri, 25 Feb 2022 10:34:49 +0900 > Masami Hiramatsu wrote: > > > > > > + 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. > > > > OK, so this means ftrace_location() will be same as > > ftrace_location_range(sym, sym_end) ? > > No. It only acts like ftrace_location_range(sym, sym_end) if the passed > in argument is the ip of the function (kallsyms returns offset = 0) Got it. So now ftrace_location() will return the ftrace address when the ip == func or ip == mcount-call. Thank you, -- Masami Hiramatsu