From patchwork Wed Apr 5 18:02:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florent Revest X-Patchwork-Id: 79861 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp500905vqo; Wed, 5 Apr 2023 11:12:35 -0700 (PDT) X-Google-Smtp-Source: AKy350aN/0yb9CItd7ZuGHoL6wN4qeGVXEePY2DrKQxrw8mm3syddijxWnU/XnrlfaniNVz/HXaN X-Received: by 2002:a17:902:c643:b0:1a1:e39c:d4f8 with SMTP id s3-20020a170902c64300b001a1e39cd4f8mr6006322pls.26.1680718355261; Wed, 05 Apr 2023 11:12:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680718355; cv=none; d=google.com; s=arc-20160816; b=u8PwAtkYQkY+8D1gjZw0UjUn8/FmK6+OwSj0xiq4T9hubPfUPqIsIuPdT6B+CMx/s+ Kk2gE1keP4FKz1X4FYwLKKhsiljVdSpyfAN6w0jMwyGjBzzjwiqn5AMqfmbcKoMH4Ytu OLlyUBEbD5IYGutTzT+Z/x5F708CSWNd3m+P+Ypig59WG0sQTqFPWzkG570JafZJm+OZ YVoB3QliXNreGMyj5ZqfEh0bKdTgzhw9L85YqBKiKHWbx5toY9M3qA66W5Io+WJ9T+o8 vgRhIjrpRmSmJ/KWcyGt5VXTSFKcekqnjDJauEFfXFBuIzV3vrrNswFNpXuqY1/27qEX Rhjg== 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:date:subject:cc:to:from :dkim-signature; bh=DBVm5Zb8SvFMICocd9qO1ZxlhdAx1c4kialWJuW3JL8=; b=u49KHmBmdRvTLe4AiJPmTu/ppK1p9CqIRQyJi9dFJpuZXZdzKYfVyiVMPoJsj2/8fH fec6m/26uqd5YZyLorwYkZouVueNCAM7aDwL9yYvwxbKxCSF+msThHUWdE3kBthj/JDQ bfQGiThKo3w8bfY6RmRt4IR2taVvXtlABvrNwbcoyFumlrQ/gHPlEukl4kN5wy6c+aVQ r84yFQ4lyj9eYUiBlQpN5TQCB0iE7Ha3P66iA8SLPvlFmVK52gZB6BwMe3Rg82V3aqd2 m1qladteQspoS2ChcA06nCJEnev6mQkHKhkLoFQdvdfAFC9JbkRcAuUOAfIFjb8lxxze MFAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mYZ2ebBF; 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=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j13-20020a170903024d00b0019e88376e3csi3753199plh.162.2023.04.05.11.12.22; Wed, 05 Apr 2023 11:12:35 -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; dkim=pass header.i=@chromium.org header.s=google header.b=mYZ2ebBF; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230114AbjDESEK (ORCPT + 99 others); Wed, 5 Apr 2023 14:04:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233769AbjDESDy (ORCPT ); Wed, 5 Apr 2023 14:03:54 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E16406A77 for ; Wed, 5 Apr 2023 11:03:12 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id p34so21385613wms.3 for ; Wed, 05 Apr 2023 11:03:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1680717777; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DBVm5Zb8SvFMICocd9qO1ZxlhdAx1c4kialWJuW3JL8=; b=mYZ2ebBFhZzuxU4cNfsqpAqCqhwJKdWklj5QOg1NUs875jkf+Nq8raj8nf0ExLPfXx A+KwVuhrQts+hLJdZT7w7vB6vOUvrB5GOSiNb9/Ptd4Pe88bZsFbBbPfQSkUbBx9xmz9 8EOqRXufDXqb0Qb8OWiM1dC3ab7+7DBIVEVYA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680717777; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DBVm5Zb8SvFMICocd9qO1ZxlhdAx1c4kialWJuW3JL8=; b=ZR9CngdpNF4V7hGHDircgF5xpnHPv2w7UZZXJkgcZYGO3ZmWFJv3D1MWNnsBePFwWu 8FOf+7JJ9/zm0t7p5EmBM1hE7zW6E1jypaBtgrb12zu26EqFRlK3O7YlwP+/pUoW3kIp IGjmwHjJDtSOtpfzVzgZQApuOWaqQ1zgH49Y8wZjycxLg41KL/050s1wcUWP085s2a7n TpYOHCMjPe0aprjFJTnQXcb2FwpviiKl3wwOrenaaACE7/+dqHVPEka5CREqdjypbQdh 0cI+mJ7ILA287sHpjsGxGWrZfP9lJeYlZqIQ9vPZV8iqAmpDFW9zUFAfGJ8txb5byGyJ OA0A== X-Gm-Message-State: AAQBX9e9i5uqH9MhuY3OJ5nrW8oPRxvzl99+xpK0Qs5DGfAGpqDokwZX 2Q6tp58EM6+/UKxEq0um9Y1ojA== X-Received: by 2002:a1c:f20d:0:b0:3ea:e582:48dd with SMTP id s13-20020a1cf20d000000b003eae58248ddmr5383281wmc.34.1680717777383; Wed, 05 Apr 2023 11:02:57 -0700 (PDT) Received: from revest.zrh.corp.google.com ([2a00:79e0:9d:6:cf6a:9ae6:15f1:4213]) by smtp.gmail.com with ESMTPSA id bd5-20020a05600c1f0500b003f0472ffc7csm2913233wmb.11.2023.04.05.11.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 11:02:57 -0700 (PDT) From: Florent Revest To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, rostedt@goodmis.org, mhiramat@kernel.org, mark.rutland@arm.com, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kpsingh@kernel.org, jolsa@kernel.org, xukuohai@huaweicloud.com, lihuafei1@huawei.com, Florent Revest Subject: [PATCH v6 2/5] arm64: ftrace: Simplify get_ftrace_plt Date: Wed, 5 Apr 2023 20:02:47 +0200 Message-Id: <20230405180250.2046566-3-revest@chromium.org> X-Mailer: git-send-email 2.40.0.577.gac1e443424-goog In-Reply-To: <20230405180250.2046566-1-revest@chromium.org> References: <20230405180250.2046566-1-revest@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762360929768181038?= X-GMAIL-MSGID: =?utf-8?q?1762360929768181038?= Following recent refactorings, the get_ftrace_plt function only ever gets called with addr = FTRACE_ADDR so its code can be simplified to always return the ftrace trampoline plt. Signed-off-by: Florent Revest Acked-by: Mark Rutland --- arch/arm64/kernel/ftrace.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c index 758436727fba..432626c866a8 100644 --- a/arch/arm64/kernel/ftrace.c +++ b/arch/arm64/kernel/ftrace.c @@ -195,15 +195,15 @@ int ftrace_update_ftrace_func(ftrace_func_t func) return ftrace_modify_code(pc, 0, new, false); } -static struct plt_entry *get_ftrace_plt(struct module *mod, unsigned long addr) +static struct plt_entry *get_ftrace_plt(struct module *mod) { #ifdef CONFIG_ARM64_MODULE_PLTS struct plt_entry *plt = mod->arch.ftrace_trampolines; - if (addr == FTRACE_ADDR) - return &plt[FTRACE_PLT_IDX]; -#endif + return &plt[FTRACE_PLT_IDX]; +#else return NULL; +#endif } static bool reachable_by_bl(unsigned long addr, unsigned long pc) @@ -270,7 +270,7 @@ static bool ftrace_find_callable_addr(struct dyn_ftrace *rec, if (WARN_ON(!mod)) return false; - plt = get_ftrace_plt(mod, *addr); + plt = get_ftrace_plt(mod); if (!plt) { pr_err("ftrace: no module PLT for %ps\n", (void *)*addr); return false;