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 A4D20C433F5 for ; Wed, 25 May 2022 17:26:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245659AbiEYR0O (ORCPT ); Wed, 25 May 2022 13:26:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244575AbiEYR0L (ORCPT ); Wed, 25 May 2022 13:26:11 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6E9811116E for ; Wed, 25 May 2022 10:26:10 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2BF4A1424; Wed, 25 May 2022 10:26:10 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.0.228]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 27C4C3F66F; Wed, 25 May 2022 10:26:08 -0700 (PDT) Date: Wed, 25 May 2022 18:26:04 +0100 From: Mark Rutland To: Steven Rostedt Cc: "Wangshaobo (bobo)" , cj.chengjian@huawei.com, huawei.libin@huawei.com, xiexiuqi@huawei.com, liwei391@huawei.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, zengshun.wu@outlook.com Subject: Re: [RFC PATCH -next v2 0/4] arm64/ftrace: support dynamic trampoline Message-ID: References: <20220316100132.244849-1-bobo.shaobowang@huawei.com> <20220420141143.23286faa@gandalf.local.home> <5ddc2722-4489-f66d-552d-1f4c755b5d30@huawei.com> <20220421083758.37b239a4@gandalf.local.home> <20220525095845.53ec8fe0@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220525095845.53ec8fe0@gandalf.local.home> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 25, 2022 at 09:58:45AM -0400, Steven Rostedt wrote: > On Wed, 25 May 2022 13:45:13 +0100 > Mark Rutland wrote: > > > ... the compiler places 3 NOPs *before* any BTI, and 2 NOPs *after* any BTI, > > still recording the location of the first NOP. So in the two cases we get: > > > > NOP <--- recorded location > > NOP > > NOP > > __func_without_bti: > > NOP > > NOP > > > > NOP <--- recorded location > > NOP > > NOP > > __func_with_bti: > > BTI > > NOP > > NOP > > Are you saying that the above "recorded location" is what we have in > mcount_loc section? Yes; I'm saying that with this series, the compiler would record that into the mcount_loc section. Note that's not necessarily what goes into rec->ip, which we can adjust at initialization time to be within the function. We'd need to record the presence/absence of the BTI somewhere (I guess in dyn_arch_ftrace). > If that's the case, we will need to modify it to point to something that > kallsyms will recognize (ie. sym+0 or greater). Because that will cause > set_ftrace_filter to fail as well. Yup, understood. Like I mentioned it also wrecks the unwinder and would make it really hard to implement RELIABLE_STACKTRACE. Just to be clear, I don't think we should follow this specific approach. I just wrote the examples to clarify what was being proposed. Thanks, Mark. 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 161C6C433EF for ; Wed, 25 May 2022 17:27:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fGC/oyAZ5ZWFFencoFxVd/8NCDNbgYGsGdrQ9ElPLnY=; b=CqGi3TZZSqk4kr 7wnTEqYGE23fUqvf/VJf6F/3hCXwjPrzu7CDYvfWbGoTHQ2b+m0uv0Ob8iTZauyBIennYOBI6I8/6 rO3KoYzvu1RudI80f+ZubHUyU/Sxu0jjik/XcChOmOEOeFr6JunNT9vne7cFTSAv3Z3Q1W3lC0TLF Gh0j3VMxT++Rzr/qYdyu1FdOAwZSmdi3ZMf/X9b33UI1iu2QKLfXel+/fPIBOzo4NKu1biQbrkMcL zmxQr4nhWoPhAOP7s/Z5IqRvoyvP6Lj0ZupRmLZr9d6yjoqQv1ZDOLPQUXV5mkCsb4zuSPZRcU/ne dxAUHlpFPHoPfnQIdUKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntulz-00ByXu-Gk; Wed, 25 May 2022 17:26:15 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntulv-00ByXE-GM for linux-arm-kernel@lists.infradead.org; Wed, 25 May 2022 17:26:12 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2BF4A1424; Wed, 25 May 2022 10:26:10 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.0.228]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 27C4C3F66F; Wed, 25 May 2022 10:26:08 -0700 (PDT) Date: Wed, 25 May 2022 18:26:04 +0100 From: Mark Rutland To: Steven Rostedt Cc: "Wangshaobo (bobo)" , cj.chengjian@huawei.com, huawei.libin@huawei.com, xiexiuqi@huawei.com, liwei391@huawei.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, zengshun.wu@outlook.com Subject: Re: [RFC PATCH -next v2 0/4] arm64/ftrace: support dynamic trampoline Message-ID: References: <20220316100132.244849-1-bobo.shaobowang@huawei.com> <20220420141143.23286faa@gandalf.local.home> <5ddc2722-4489-f66d-552d-1f4c755b5d30@huawei.com> <20220421083758.37b239a4@gandalf.local.home> <20220525095845.53ec8fe0@gandalf.local.home> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220525095845.53ec8fe0@gandalf.local.home> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220525_102611_625204_B02BDF81 X-CRM114-Status: GOOD ( 16.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, May 25, 2022 at 09:58:45AM -0400, Steven Rostedt wrote: > On Wed, 25 May 2022 13:45:13 +0100 > Mark Rutland wrote: > > > ... the compiler places 3 NOPs *before* any BTI, and 2 NOPs *after* any BTI, > > still recording the location of the first NOP. So in the two cases we get: > > > > NOP <--- recorded location > > NOP > > NOP > > __func_without_bti: > > NOP > > NOP > > > > NOP <--- recorded location > > NOP > > NOP > > __func_with_bti: > > BTI > > NOP > > NOP > > Are you saying that the above "recorded location" is what we have in > mcount_loc section? Yes; I'm saying that with this series, the compiler would record that into the mcount_loc section. Note that's not necessarily what goes into rec->ip, which we can adjust at initialization time to be within the function. We'd need to record the presence/absence of the BTI somewhere (I guess in dyn_arch_ftrace). > If that's the case, we will need to modify it to point to something that > kallsyms will recognize (ie. sym+0 or greater). Because that will cause > set_ftrace_filter to fail as well. Yup, understood. Like I mentioned it also wrecks the unwinder and would make it really hard to implement RELIABLE_STACKTRACE. Just to be clear, I don't think we should follow this specific approach. I just wrote the examples to clarify what was being proposed. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel