Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp326989ioo; Thu, 26 May 2022 04:44:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyj4uPSpwqJqnwPzeYBp+KV+yr6L4dTCVVOV6kaKcJfIQglu1YQmmyrenvHLJf6kEoQy4jj X-Received: by 2002:a05:6402:2994:b0:42b:7c29:dcb with SMTP id eq20-20020a056402299400b0042b7c290dcbmr15715328edb.182.1653565496489; Thu, 26 May 2022 04:44:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653565496; cv=none; d=google.com; s=arc-20160816; b=t5R793kKMRJsp0jZFrUNA4RViBn5nKl3G3hItBkjf6pJ7LS4q0oo7shIDTXuMX6u65 wtpBnaCMNz2MeIoA9k9hNqqSpwxcnMO3GKV+eNOkMSY1xEMDclPjmttIiSbqD3VuUw/V UUuSwW1xreT1M/UNyHSBLctgZLNHRVfNK+aNTNqJRE3jK4e+o0tb620o9C5G9igZvRdS JD/F4z2gtnfmsl+0uyjl0YeJ154fff0iuVMsdU2CRkWAlCPXS3EizQf3tx88w6LzVV4+ AGPvBHO9dVc9qS/od1Gpf1p1f/4J9djNqmFnkvvbq611hjbQKPxUd9Lq1EzdWCb/bDde HAfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=BBZ3KldURPGQbN5WI2tfPzIkRu82Fj4M//ChP9OtMA8=; b=r/BL0m5y2F8OD0UnbMyOdVCK7TnEX4ilOmZovEf+aftB5yn3dZEZLJhwPbqQ4m5X14 lgwljEgB56W/LuJ/J4kPyUNVmDW2i8qr8bl9UnutbqD4N2auWtxGyjYWD7N+a4SbjeEc 0EDQ+kqMxwCFNQeGQZ00dN8Qp1ZE3F+vEyu6VR03OFqF/zOIsjcaHmcZlH9r8BmUgCZl PTBpU6NzosUATmuCvg9/jB/0mxAKW4iacXzXFOUABSzXX8t37euEqH0lKOP3v/w9f2tl 7p/rmI7JIRaPdJ+YqUKG0orDr/13hH8F+fm69md36pm9P5j7nGCjameXN1QQh27yEZUt LCrA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr19-20020a170906d55300b006e8bd883224si1899814ejc.792.2022.05.26.04.44.30; Thu, 26 May 2022 04:44:56 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245651AbiEYR0M (ORCPT + 99 others); Wed, 25 May 2022 13:26:12 -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> X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,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 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.