From patchwork Mon Apr 3 11:20:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florent Revest X-Patchwork-Id: 13198075 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 6A717C761A6 for ; Mon, 3 Apr 2023 11:22:18 +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:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QmFLKVnJN8yhbjUS5DvQD8dxUa+ofNAIHtRRCHLxzjE=; b=Fha8yb1/thJxUM vg55ySIpkMIiQ1QHZVU3THzNzhaSfe40gnwikTHkvRFcQCnczJSqcZgNtVaVlS9E3NizLEYgomcic lL58X4umhpM8ZpRZmbnOrI691m+x/cs+KK5VDGF0deG+KyW5sT6wRN1KFxaVNkQyhyzIbnXBfzyxr naq7pJSkI2LDp8DGfkjzclIE1/0Nq3A1HMbHn6+H51x5Jz9mpJgG7n/xRl0aIWFAZqDmj0hdqLHLg M9vh+jjovIt/NudmveQYtYRpGyTM1euacc8Hne873LdEw7/jrQc5Y/kGbUJUAEo7jctoAZpzsM9tC VQBp1hirIjPlvmI87bkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pjIFi-00F6aU-1J; Mon, 03 Apr 2023 11:21:34 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pjIFc-00F6Vx-1I for linux-arm-kernel@lists.infradead.org; Mon, 03 Apr 2023 11:21:29 +0000 Received: by mail-wr1-x435.google.com with SMTP id t4so23719421wra.7 for ; Mon, 03 Apr 2023 04:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1680520884; 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=ccD+WMcpnfxpdEJ20qi2WQ3yxV21AzFl62yMric/kQs=; b=AhCYV+eMAiRqkEFIZZCxRh4GXN58tf1TxfTeDHp19jbjkX2YxBnH2QpPjJ0HIdm9JO iyvZrNh2wwTauil0fQm6Z9HWXCNltVm/t/kIS+JflHqXsrPYZ1wpHxw1Fxlecvla2dcW puXX87gZylWHxocfXtFSOPP+SFLvn3aPHhy3c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680520884; 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=ccD+WMcpnfxpdEJ20qi2WQ3yxV21AzFl62yMric/kQs=; b=PXRJvsjoTxJIwKL3lR/844uO/A9cQEuDbJRcA/iyUYkDnmhUZ3K4q4bQ5raWHft7I8 LBovxRSLG5ebhNL/OfzlUeht/DGmaUTxQpq/cRtuNKWVLy+JrDJWL0XmMuPWq+j2f4cE by/oFK9eNVRt2zwPJ++Jynn/L7MHe45WqiTkSG+pBxE5HFAqtUQ8D/B9jJYjHpOEQJqo F393wFKln7EHtuLTmPWvjb5KReIUrFdyZvILiqcAHguQqXvzcRyUNSxcOgFwBMb2KTG2 WMhnR/qZ4w4+bu/3fcsSjoYgfDgzeKlZdN5QTmB2A3Ge+EmcDWKkMBHfBPNzQ/R9Rkpo 9Lvg== X-Gm-Message-State: AAQBX9cW1mQJXhBuxU5DBHZQspqwITKVCiGhE0CMgDsK5bEOY6FgkNpl Eiir4jlmTI0xmAuzYQSuofe7dQxuN5mP/0gX1RE= X-Google-Smtp-Source: AKy350Zgv+BnOKwyxEwke4yedmRdckQgXNSpQ+JtjC4hDbJ8wkdJo2VCOh4gPSxeHI+ho5KDR3RkZg== X-Received: by 2002:a5d:6602:0:b0:2ce:a098:c6b8 with SMTP id n2-20020a5d6602000000b002cea098c6b8mr25905426wru.55.1680520884478; Mon, 03 Apr 2023 04:21:24 -0700 (PDT) Received: from revest.zrh.corp.google.com ([2a00:79e0:9d:6:b5a2:4ffd:8524:ac1]) by smtp.gmail.com with ESMTPSA id u13-20020adfeb4d000000b002daeb108304sm9510031wrn.33.2023.04.03.04.21.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Apr 2023 04:21:24 -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 v4 2/4] arm64: ftrace: Simplify get_ftrace_plt Date: Mon, 3 Apr 2023 13:20:57 +0200 Message-Id: <20230403112059.2749695-3-revest@chromium.org> X-Mailer: git-send-email 2.40.0.423.gd6c402a77b-goog In-Reply-To: <20230403112059.2749695-1-revest@chromium.org> References: <20230403112059.2749695-1-revest@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230403_042128_433798_8DC3D28E X-CRM114-Status: GOOD ( 12.28 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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;