From patchwork Mon Apr 3 11:35:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florent Revest X-Patchwork-Id: 13198100 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 5FCE8C76196 for ; Mon, 3 Apr 2023 11:37:02 +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=0MGm0vT+aL8oGv kwan7VW0QVNDVKX4cpRL2F1hrMWjJRcQjWer3aQ4UgTj3lHoYbHWaveGig+eB4XdJC80mRVT6nUGM 4XeGMy7bMNOols5sge4U/lgKRDQ9mHtKlU7qeJ29ZdUUgyIJZToEhzFMsMZyoE516IdBfG+F4khZA 8vBCOwx4QvGjUiQOBQlKT0l0IRy21KlNekQppGnInhW6FRicASeKVyRFZAVgs/9nhSa5U3GK+blYY Ft90cEAUKOIcL2rQAZNAumVlabvkNX+hiUxsIoTG44mqYTsHjCwlCgCcRpL7FRzKNH2Zmva1Ar+aP NWcf6NpTClwRYVZS9mXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pjITq-00F9ed-1b; Mon, 03 Apr 2023 11:36:10 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pjITn-00F9ai-05 for linux-arm-kernel@lists.infradead.org; Mon, 03 Apr 2023 11:36:08 +0000 Received: by mail-wm1-x332.google.com with SMTP id l15-20020a05600c4f0f00b003ef6d684102so14314023wmq.3 for ; Mon, 03 Apr 2023 04:36:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1680521761; 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=d21bNTTTerhufMWt9se/NWVWUHQheCPhiV7zaklubrZxhCBxTQ1+EyXCBH7GXTURt6 /yQPt78roXGy5ltgVsPYL42e7mLgIYTVBCtadleADRgpScd24T83qjEbGwAvNDC5Wb2r XFUM1+X7Zn0iTHd80a/dFBy4B6Zj6zqjMpEz8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680521761; 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=JeA5ogd1yhk6zlHqzvf52PsasmCvhLLMVB3SsQu7X3XqalSbFqo4aKynsK3VA5tR5l TE/OLw7SKSAo8obB7s+drlcI5b//pKe2oKva/lsaD/NtUqGoWDRNajMThDKjaMOyVnYC O/uJNJswNcDMz650hYjPuyMGSmopm1gOSD9Om/FRcfZ/CYHxu+dZPwVJA082ajohRspl JVWmRrtrXyu16U7LKDjAW/matnj5R+7MGVpQqWo846EKxv5ICRCARC/WLYZ8b0pVbxgM H+2ESdSBsE8qCVpkwxjpxgA5CeCz4V2SOIUsJe3j5IyTvO0leMkwYqgkJ5bXX5M1ux6a ghWQ== X-Gm-Message-State: AO0yUKV6JpkIxKgIWhmXRy1LQIpBMba+DV15m1O41B76cZLjw5aodkBQ HQWjHP81PZfSdS2KSbpBDKgfnqi6pMsL3wnbmQM= X-Google-Smtp-Source: AK7set8dbeu0np8yhxoyImONiRj570jnBy4imGpxld9ZSDNakB2E/78I4N+XTLJj4LUuhYDH0GB7nw== X-Received: by 2002:a05:600c:22d6:b0:3ed:e5db:52e1 with SMTP id 22-20020a05600c22d600b003ede5db52e1mr28166157wmg.15.1680521761105; Mon, 03 Apr 2023 04:36:01 -0700 (PDT) Received: from revest.zrh.corp.google.com ([2a00:79e0:9d:6:b5a2:4ffd:8524:ac1]) by smtp.gmail.com with ESMTPSA id s15-20020a05600c45cf00b003eb2e33f327sm29841410wmo.2.2023.04.03.04.35.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Apr 2023 04:36:00 -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 v5 2/4] arm64: ftrace: Simplify get_ftrace_plt Date: Mon, 3 Apr 2023 13:35:50 +0200 Message-Id: <20230403113552.2857693-3-revest@chromium.org> X-Mailer: git-send-email 2.40.0.423.gd6c402a77b-goog In-Reply-To: <20230403113552.2857693-1-revest@chromium.org> References: <20230403113552.2857693-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_043607_067142_EC8158BB X-CRM114-Status: GOOD ( 12.17 ) 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;