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: 54039 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3011315wrn; Tue, 7 Feb 2023 10:36:58 -0800 (PST) X-Google-Smtp-Source: AK7set+e1CfBcR3hxrxPoZLkzZzxoKFXg+RnOqOIgkMuXLbTTEtCbJh2YprL8Vui6DrBz57Yswxy X-Received: by 2002:aa7:983d:0:b0:593:cdc7:5dd3 with SMTP id q29-20020aa7983d000000b00593cdc75dd3mr3920917pfl.4.1675795018090; Tue, 07 Feb 2023 10:36:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675795018; cv=none; d=google.com; s=arc-20160816; b=vg3PWDP+HZ+t0FO7L7J8Gs8GipnAY+EFFKBd/xCCSmbNZZnLwklaoXJpVwCQKOcY8h +j8WvYSPDRiBIQ4VX4Rp0Sz+PqeWYd2Vd2xw1RgxQPyuz0GDEFvqI0KUdfuVx8p+hW7q WRE9AZCPDjhgbuZvv2XdXIh0pAbUnIkTB1AEP/dEm7HtOxEiq754iOzEkeSoVOlqqlug oZ9fuEoZKHaE5gmGpIFiEBtn4jgdGHdRJ0mjSuKUA+9X2aV9LjYdho0iAj52c4N1xG9x KCgx0t0BmQqRAZHixdbjybqqO43q7BNBseAqwhNYuLDgIh8OCfFCkgV/Vtn3GrI9Od/z /1Fg== 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=CwiKy1zj4XtkpCcy3j7M0LLtAyzN4Se5srzdcyUGneM=; b=i4OBF9H/sZygltJC23RrIlHKZPG/nKvmn4Sr5qatNMzl6cd7lO0Nwk4nA5HpCTg3Ut F8KIF3ByH3wN0gESIJV9XpixwlH/C+tuUfGonr/nWqGp0BfC33EsReuQK3vhT933ZICj C+7NvHvn+1onf9OSe1E1XscOrfeAFP5uPd7li2icIOfFYQ10jNQfhsKeIe7m+S3JsA3z I5BD0VMjWsMN1ztLR5ulH4ksRVX0LRCmAlg53vpAqxIrMXoqpOokC+S/6EBePesoNk23 zvf/5SXWYH3Tquam6lrjlaVcAw1wbYOgEB62qdJZp4omx7hr2jLwd+xwR0/zPUFVZjCE M9lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=i6anilsm; 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 z3-20020aa79e43000000b0058dd0e03e08si15437427pfq.254.2023.02.07.10.36.45; Tue, 07 Feb 2023 10:36:58 -0800 (PST) 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=i6anilsm; 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 S232675AbjBGSX2 (ORCPT + 99 others); Tue, 7 Feb 2023 13:23:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232334AbjBGSWq (ORCPT ); Tue, 7 Feb 2023 13:22:46 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A651402D3 for ; Tue, 7 Feb 2023 10:22:14 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id o18so14461656wrj.3 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=Q30WE3RHjXF5lH4BK3qa9fWbsb/5kaHZt2pCh/ZWQORzvY3MLTtHZIYLNgQx/8dgFs tsXXAyHFOSmK6mwAyW1jDuGVrjSomDQ+nnye6Ezej0mTTTos3MuTraoYW642uDySJc8u I8ZrWUiYSeQhqxyZzgd//EOeYJK/ZN2GMwlMiEkBk3OZe+onU4+TG7PgBSvdE/vqde3Y cGop6J8kf6eQWRDuqICM0b+XNkqz79U7crDb0Ownq8XjLPjTm2pHeZZJ6wJkX4SGBZig Z71zzg1NcaZWxQSwO+RhrqhIj5zPORzUGP4J3a17SMi2w5ekj1LIpPVwAnWc+7m+upPy HeeA== X-Gm-Message-State: AO0yUKVTd567TbtERVyQDkhKGX/GLxWNm4051iokuFI2uULB/JVkb5II MbamJ71oGaOTB3dwCEBRXPdoyQ== 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,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?1757198436916603248?= X-GMAIL-MSGID: =?utf-8?q?1757198436916603248?= 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;