From patchwork Tue Feb 7 18:21:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florent Revest X-Patchwork-Id: 13131998 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 389CBC636CC for ; Tue, 7 Feb 2023 18:26:07 +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=C8QZEJUlbjKL/yKfDvlwBBf9MgKwGL8vbF4VN7shaHg=; b=h4+TT1BtJRsCsn ZZEJI5q4RBw8+COgdpuQVRr7QHC+0XrXSyfuIoXBEMTDuPOabrhJ4gWbXvP1zuRveqSHWN6ehwjC5 pGd1rFNR+PAzCJMPv2qgeIs6WQBGtwmFSrsvKZ1elIAgfT8C85SQezlC06DDHZx64eWI4LG/8zrzI eTKCjbGwEXRwYGi8MilyOYytnt7FHwXzcp31vIxsKzW3/5ozxOAUmlQR0WqQCh1JiJ9yZTMv3eDCM EZXfH2umUDXQz9zNUSq4/uGjsC8UB+04CEdEXBardZ8HEemoSuoEGqA2qcDne/bNVpTTV6KdJHlBF 7DdMeEw6uDDdJfGvCyGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pPSeC-00D4HH-Me; Tue, 07 Feb 2023 18:24:52 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pPSbn-00D32v-Nc for linux-arm-kernel@lists.infradead.org; Tue, 07 Feb 2023 18:22:25 +0000 Received: by mail-wr1-x435.google.com with SMTP id a2so14180486wrd.6 for ; Tue, 07 Feb 2023 10:22:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; 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=CwiKy1zj4XtkpCcy3j7M0LLtAyzN4Se5srzdcyUGneM=; b=i6anilsmtrDvvnD7dCrN7APQRKSLf4SQehdySBYQzHfjNwkByZSE27QgysKpKqEJTG 1XRm9Z9tWJvbwHGA01GZAoDA8aNKN4IxMAZ/PrL/qNrtJlIdWGtu5IBEAJuw8VvHNVYa 02ngq/sYVPC0fMjOVKxrpuj+5tOMU1YD5dssQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=CwiKy1zj4XtkpCcy3j7M0LLtAyzN4Se5srzdcyUGneM=; b=ikY+KBNxkVdqHTQuIfqboWGVORiUFJ+YfJqCvqW302JIpBwGgDYkMmF4THTTvEO1ub joMHR2LNbtilET+j/Cv9qAunbSCzCQal7xE3B2YYG4ZmYdD8JQc7TV4Wisj5tX0UKLR4 j/IEEOWgk7jmfFGLzL34QqU67IV43FknwU5civF2+n9efRn9/mOutiEzmQd42mdxVJRg JGE9kUxsYwlJot+s+g/CxZYJ7slT0A/pGygtaDojZgq5vmmG4sEOgLPzXfaYJu/sqCNx LroikMHzYKWjhnJ/oUAdgsXddMJ8lTeP5bSscPONRy48ZKKD2dR8NHw8OamYx4fqnix2 1Ofg== X-Gm-Message-State: AO0yUKXY2MnH31QPguJMYttJzx2HilMZkbGDYJjLlXtqlhyWuqbfQvKM 4xeqncrXqGtGFDPZIBW8bj4vTyPsdjUz2c8x7Gg= X-Google-Smtp-Source: AK7set8yHwGNGCZNZPCYn9JngyhQZFgrUNTJQQy+keu0mNN2pAKVQLvT7Cvp7NN7IjYJGJpWneockA== X-Received: by 2002:a5d:5150:0:b0:2c3:f971:ae1 with SMTP id u16-20020a5d5150000000b002c3f9710ae1mr592301wrt.29.1675794132793; Tue, 07 Feb 2023 10:22:12 -0800 (PST) Received: from revest.zrh.corp.google.com ([2a00:79e0:9d:6:5307:c0c0:ff97:80de]) by smtp.gmail.com with ESMTPSA id n6-20020a05600c4f8600b003daf672a616sm15578369wmq.22.2023.02.07.10.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Feb 2023 10:22:12 -0800 (PST) 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 v2 08/10] arm64: ftrace: Simplify get_ftrace_plt Date: Tue, 7 Feb 2023 19:21:33 +0100 Message-Id: <20230207182135.2671106-9-revest@chromium.org> X-Mailer: git-send-email 2.39.1.519.gcb327c4b5f-goog In-Reply-To: <20230207182135.2671106-1-revest@chromium.org> References: <20230207182135.2671106-1-revest@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230207_102223_877067_C6904F96 X-CRM114-Status: GOOD ( 12.53 ) 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 --- 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;