Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1923489rwi; Thu, 3 Nov 2022 10:32:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5YfOg2AsPEWVfKYEIsmKduZsWKbC2Fa2s0L5q45nZnrZIuFkIH+iOdJiQNzZsp6KxOvhdl X-Received: by 2002:a05:6402:524e:b0:461:fa05:aff8 with SMTP id t14-20020a056402524e00b00461fa05aff8mr31529759edd.283.1667496731551; Thu, 03 Nov 2022 10:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667496731; cv=none; d=google.com; s=arc-20160816; b=RmaqaWx73BxJaJLluGaKkrudsi67qjP9ZsIFrwnBet1O7vvYeuKOqhIcvHTRJbBDbB awcxszgOYhleRLTPi49+Zb/V/H/AOsPf/Lch++ORWKiROIbYdgsyz0h+WsnyRlb0xxL5 rzwueJy7FMHGhrUDhrc2UP9z4R6z1hYl8NR+SDxV0l2vWk8QhXAtxzy4YW6ZaWzjasm1 WBoAw+v1UHdvm+3n9TNv5wbCq6y8A3WxCFwCa3ihwIQOjriMbuhMIJUNyhELTPm1G7Rf VFYgRGz9iLQhFZjw0z1mKLV8rKUm7SUb5qAyGqZa5ElJ30+4fPCKgme9dNwb2NckFb7A imJQ== 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; bh=zUhlD/SR8zs679EEFYI+hnvzAPtQ7jn3B/N+GdKmCkI=; b=E9KENTT4XOUJ9rpam4VkZkY/eOhsLtKnxB6CdQDkevmK+5JaEq+u26tTaSLkG0a/Si vS1ckTrc90/NP/syl47qbtcAQbQvk18aIoYVEVwShHsAxRShunMdTvsceyOCpTnv4p7p rKU/IIy6riV1+hGk6n1cBVbSfkchJ3Uqw5COrCEbUtePwe33TKNBjOiRl1+r45WPSjMX g1FXB2kpbekhYT0JSsuYpo8LkgxoqgTZqDhC+P7+Fef0yADAfPvS5p0m7sBt3bheXSH7 kkm8McRb8XVdpseiChFXmbVK5B2fOKmUotzbvDonm+/fcLDcfmu0OryqGlV/TTy5kmVg 400Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf34-20020a1709077f2200b0078df948151esi1969323ejc.946.2022.11.03.10.31.46; Thu, 03 Nov 2022 10:32:11 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231154AbiKCRGo (ORCPT + 98 others); Thu, 3 Nov 2022 13:06:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231962AbiKCRF6 (ORCPT ); Thu, 3 Nov 2022 13:05:58 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C5C861B1F8 for ; Thu, 3 Nov 2022 10:05:34 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A456411FB; Thu, 3 Nov 2022 10:05:40 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D32773F5A1; Thu, 3 Nov 2022 10:05:32 -0700 (PDT) From: Mark Rutland To: linux-kernel@vger.kernel.org Cc: catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, mhiramat@kernel.org, revest@chromium.org, rostedt@goodmis.org, will@kernel.org Subject: [PATCH v2 2/4] ftrace: rename ftrace_instruction_pointer_set() -> ftrace_regs_set_instruction_pointer() Date: Thu, 3 Nov 2022 17:05:18 +0000 Message-Id: <20221103170520.931305-3-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221103170520.931305-1-mark.rutland@arm.com> References: <20221103170520.931305-1-mark.rutland@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham 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 In subsequent patches we'll add a sew of ftrace_regs_{get,set}_*() helpers. In preparation, this patch renames ftrace_instruction_pointer_set() to ftrace_regs_set_instruction_pointer(). There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland Cc: Florent Revest Cc: Masami Hiramatsu Cc: Steven Rostedt --- arch/powerpc/include/asm/ftrace.h | 5 +++-- arch/s390/include/asm/ftrace.h | 5 +++-- arch/x86/include/asm/ftrace.h | 2 +- include/linux/ftrace.h | 9 ++++----- kernel/livepatch/patch.c | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h index 3cee7115441b4..c3eb48f675669 100644 --- a/arch/powerpc/include/asm/ftrace.h +++ b/arch/powerpc/include/asm/ftrace.h @@ -37,8 +37,9 @@ static __always_inline struct pt_regs *arch_ftrace_get_regs(struct ftrace_regs * return fregs->regs.msr ? &fregs->regs : NULL; } -static __always_inline void ftrace_instruction_pointer_set(struct ftrace_regs *fregs, - unsigned long ip) +static __always_inline void +ftrace_regs_set_instruction_pointer(struct ftrace_regs *fregs, + unsigned long ip) { regs_set_return_ip(&fregs->regs, ip); } diff --git a/arch/s390/include/asm/ftrace.h b/arch/s390/include/asm/ftrace.h index 85bc26ccdb872..113d194acea01 100644 --- a/arch/s390/include/asm/ftrace.h +++ b/arch/s390/include/asm/ftrace.h @@ -54,8 +54,9 @@ static __always_inline struct pt_regs *arch_ftrace_get_regs(struct ftrace_regs * return NULL; } -static __always_inline void ftrace_instruction_pointer_set(struct ftrace_regs *fregs, - unsigned long ip) +static __always_inline void +ftrace_regs_set_instruction_pointer(struct ftrace_regs *fregs, + unsigned long ip) { fregs->regs.psw.addr = ip; } diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h index d2350a8351fa4..b2925d342c650 100644 --- a/arch/x86/include/asm/ftrace.h +++ b/arch/x86/include/asm/ftrace.h @@ -48,7 +48,7 @@ arch_ftrace_get_regs(struct ftrace_regs *fregs) return &fregs->regs; } -#define ftrace_instruction_pointer_set(fregs, _ip) \ +#define ftrace_regs_set_instruction_pointer(fregs, _ip) \ do { (fregs)->regs.ip = (_ip); } while (0) struct ftrace_ops; diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index f201fcbfffb07..ec3657a60f850 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -111,12 +111,11 @@ struct ftrace_regs { #define arch_ftrace_get_regs(fregs) (&(fregs)->regs) /* - * ftrace_instruction_pointer_set() is to be defined by the architecture - * if to allow setting of the instruction pointer from the ftrace_regs - * when HAVE_DYNAMIC_FTRACE_WITH_ARGS is set and it supports - * live kernel patching. + * ftrace_regs_set_instruction_pointer() is to be defined by the architecture + * if to allow setting of the instruction pointer from the ftrace_regs when + * HAVE_DYNAMIC_FTRACE_WITH_ARGS is set and it supports live kernel patching. */ -#define ftrace_instruction_pointer_set(fregs, ip) do { } while (0) +#define ftrace_regs_set_instruction_pointer(fregs, ip) do { } while (0) #endif /* CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS */ static __always_inline struct pt_regs *ftrace_get_regs(struct ftrace_regs *fregs) diff --git a/kernel/livepatch/patch.c b/kernel/livepatch/patch.c index 4c4f5a776d808..4152c71507e24 100644 --- a/kernel/livepatch/patch.c +++ b/kernel/livepatch/patch.c @@ -118,7 +118,7 @@ static void notrace klp_ftrace_handler(unsigned long ip, if (func->nop) goto unlock; - ftrace_instruction_pointer_set(fregs, (unsigned long)func->new_func); + ftrace_regs_set_instruction_pointer(fregs, (unsigned long)func->new_func); unlock: ftrace_test_recursion_unlock(bit); -- 2.30.2