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 569A3C433F5 for ; Wed, 25 May 2022 14:00:10 +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:MIME-Version:References:In-Reply-To: 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=Qeepo9UNcROdun6tWNXBJMmpgYeH025wC5XoA3nIm90=; b=yLXtNr6PDpjNjF 6YSpy5Wcn6tVWAGHTbRcOF+RhxtGaRERpesxedosU2MqPsHer9mncu+EfX7rApW7FZeOXQnGCFTPw EZOqXQGIy0eb2kAM5JA5GuGnkWml/sLN7SED9JtBxgCJPcbhZAUrZFs5TjF9NXI66hZk8aIOTl6vF UbAw9t6gBAK6/oZ+41tIwBQ+YuAsSRENlYDShxUHwEUURFzMeIYOo6gghMHzBYkB4uJXtrVHQgIvD zqhJe9APlgcm3UQWM9BH19OVEo0opO/Hn0yk9xawI6R7s3daKiuavzcQ3KDDKetMAYp4oRRY7Dfj0 lULLldzRSBBS126wvfvg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntrXK-00BKtz-Tn; Wed, 25 May 2022 13:58:55 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntrXG-00BKso-Vm for linux-arm-kernel@lists.infradead.org; Wed, 25 May 2022 13:58:52 +0000 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 896A261873; Wed, 25 May 2022 13:58:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A7B2C385B8; Wed, 25 May 2022 13:58:47 +0000 (UTC) Date: Wed, 25 May 2022 09:58:45 -0400 From: Steven Rostedt To: Mark Rutland 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: <20220525095845.53ec8fe0@gandalf.local.home> In-Reply-To: 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> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220525_065851_108749_D7C0B592 X-CRM114-Status: GOOD ( 17.66 ) 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, 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? 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. -- Steve > > ... so where we want to patch one of the later nops to banch to a pre-function > NOP, we need to know whether or not the compiler generated a BTI. We can > discover discover that either by: > > * Checking whether the recorded location is at sym+0 (no BTI) or sym+4 (BTI). > > * Reading the instruction before the recorded location, and seeing if this is a > BTI. > > ... and depending on how we handle thigns the two cases *might* need different > trampolines. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel