From nobody Tue Nov 26 22:32:18 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0CD531FAEFE; Tue, 15 Oct 2024 21:24:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729027445; cv=none; b=F6RxHPtjjmbmCduqHBcSU1wmaG/OCH4R91wFMLgX1H9K+8ptf1iag5GgBaJ4ggFGbQmgdpOiN94PeDHbrVQ+APWhncty+C0jV84ojAx/sKCxj/z2EDYd0+rwbs4mnR613ig8uzlqKu8lmJJ7GAGNkIm/LEjOF8oY5QBJImJLPgA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729027445; c=relaxed/simple; bh=EYWUVATKArZD69rRd6A6/hL+eORzGSXJYgqfPoXLHCk=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=cikfvqATM0KWlpy7RIuGYw+ptoTJntEaXwMdUS4N5QJ8DETSownxTqd07ujkPGUcJLtmI742BwgvybBWDdyg1nPOknVe6C/rEfa9gh+C4/eCx2jYmNpIaf0aYYdQPwkGSOHkYwId7QH8MZgsD01+ATwneVQRxnf9wakzFmCu0DU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CD63C4CECE; Tue, 15 Oct 2024 21:24:04 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1t0p1k-00000003508-2WwM; Tue, 15 Oct 2024 17:24:24 -0400 Message-ID: <20241015212424.463508437@goodmis.org> User-Agent: quilt/0.68 Date: Tue, 15 Oct 2024 17:24:09 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Alexei Starovoitov , Florent Revest , Martin KaFai Lau , bpf , Alexei Starovoitov , Jiri Olsa , Alan Maguire Subject: [for-next][PATCH 1/3] ftrace: Use arch_ftrace_regs() for ftrace_regs_*() macros References: <20241015212408.300754469@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Masami Hiramatsu (Google)" Since the arch_ftrace_get_regs(fregs) is only valid when the FL_SAVE_REGS is set, we need to use `&arch_ftrace_regs()->regs` for ftrace_regs_*() APIs because those APIs are for ftrace_regs, not complete pt_regs. Cc: Alexei Starovoitov Cc: Florent Revest Cc: Martin KaFai Lau Cc: bpf Cc: Alexei Starovoitov Cc: Jiri Olsa Cc: Alan Maguire Cc: Mark Rutland Link: https://lore.kernel.org/172895572290.107311.16057631001860177198.stgi= t@devnote2 Fixes: e4cf33ca4812 ("ftrace: Consolidate ftrace_regs accessor functions fo= r archs using pt_regs") Signed-off-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) --- include/linux/ftrace_regs.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/ftrace_regs.h b/include/linux/ftrace_regs.h index dea6a0851b74..b78a0a60515b 100644 --- a/include/linux/ftrace_regs.h +++ b/include/linux/ftrace_regs.h @@ -17,17 +17,17 @@ struct __arch_ftrace_regs { struct ftrace_regs; =20 #define ftrace_regs_get_instruction_pointer(fregs) \ - instruction_pointer(arch_ftrace_get_regs(fregs)) + instruction_pointer(&arch_ftrace_regs(fregs)->regs) #define ftrace_regs_get_argument(fregs, n) \ - regs_get_kernel_argument(arch_ftrace_get_regs(fregs), n) + regs_get_kernel_argument(&arch_ftrace_regs(fregs)->regs, n) #define ftrace_regs_get_stack_pointer(fregs) \ - kernel_stack_pointer(arch_ftrace_get_regs(fregs)) + kernel_stack_pointer(&arch_ftrace_regs(fregs)->regs) #define ftrace_regs_return_value(fregs) \ - regs_return_value(arch_ftrace_get_regs(fregs)) + regs_return_value(&arch_ftrace_regs(fregs)->regs) #define ftrace_regs_set_return_value(fregs, ret) \ - regs_set_return_value(arch_ftrace_get_regs(fregs), ret) + regs_set_return_value(&arch_ftrace_regs(fregs)->regs, ret) #define ftrace_override_function_with_return(fregs) \ - override_function_with_return(arch_ftrace_get_regs(fregs)) + override_function_with_return(&arch_ftrace_regs(fregs)->regs) #define ftrace_regs_query_register_offset(name) \ regs_query_register_offset(name) =20 --=20 2.45.2 From nobody Tue Nov 26 22:32:18 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B8641FAEE9 for ; Tue, 15 Oct 2024 21:24:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729027445; cv=none; b=qlGNr5WokUMz8DbNKGs835cqLWDGQQlqIKwUuaMJM9C4Eh1vCcPnAj0twM7VsgsFqpLdu8532SlvdHoFnFmV678f264OU1/7XKzsj6nneBtT4lLvxZ/Er/AaybmbO1AnpMwL+0DuJTi5cK4E5FdnFKjoVj/5AVmnvvVacpo1nr8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729027445; c=relaxed/simple; bh=QK8X94tByFInqDHTuFetKcS1kDi1+z4RzhFuZyLBHxw=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=BUpvJgM+W3zTAJLCu8QZ8lvIZXRWOIdBGHmX78Lx7+z44T6KXPIq7StC3cgDUy3Tl7RRSjsWGjR1aJGxCstdCd3qUnw/Rd4Jpe+OZ+M5CvljFbVMYMKhxnHZ8RRK2TIfxrJZTD3LT7F1mK2LOU/lZaLzvi4hf6z71m661Xg6Tes= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B217EC4AF09; Tue, 15 Oct 2024 21:24:04 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1t0p1k-0000000350d-3Ctb; Tue, 15 Oct 2024 17:24:24 -0400 Message-ID: <20241015212424.623565632@goodmis.org> User-Agent: quilt/0.68 Date: Tue, 15 Oct 2024 17:24:10 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Shuah Khan , Donglin Peng Subject: [for-next][PATCH 2/3] selftests/ftrace: Fix check of return value in fgraph-retval.tc test References: <20241015212408.300754469@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Steven Rostedt The addition of recording both the function name and return address to the function graph tracer updated the selftest to check for "=3D-5" from "=3D -= 5". But this causes the test to fail on certain configs, as "=3D -5" is still a value that can be returned if function addresses are not enabled (older ker= nels). Check for both "=3D-5" and " -5" as a success value. Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Cc: Shuah Khan Cc: Donglin Peng Link: https://lore.kernel.org/20241011132042.435f43cc@gandalf.local.home Fixes: 21e92806d39c6 ("function_graph: Support recording and printing the f= unction return address") Signed-off-by: Steven Rostedt (Google) --- tools/testing/selftests/ftrace/test.d/ftrace/fgraph-retval.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-retval.tc = b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-retval.tc index e8e46378b88d..4307d4eef417 100644 --- a/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-retval.tc +++ b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-retval.tc @@ -29,7 +29,7 @@ set -e =20 : "Test printing the error code in signed decimal format" echo 0 > options/funcgraph-retval-hex -count=3D`cat trace | grep 'proc_reg_write' | grep '=3D-5' | wc -l` +count=3D`cat trace | grep 'proc_reg_write' | grep -e '=3D-5 ' -e '=3D -5 '= | wc -l` if [ $count -eq 0 ]; then fail "Return value can not be printed in signed decimal format" fi --=20 2.45.2 From nobody Tue Nov 26 22:32:18 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5099F1FBF69; Tue, 15 Oct 2024 21:24:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729027445; cv=none; b=n6q4Ya+jgTpIFLCpGaeWdRoL9ZXguHta4373YN/JHJWN8pen8LZWy8dTUn/QzxugzmjyUOph0MsbAtui2LH4vp4VxB0lYnvSzdLkfpUdX6PaiDpOZrn9k7cQBOrqy+axTNMIkiK20OxY7ia8sP7IuXBRCoZHO4B9TbD3ALB9Ylc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729027445; c=relaxed/simple; bh=7CjrsLcdS425VLUPINBWwbx7Xhs+Zszb1auA7UaZTbg=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=fN+7kZMc5RMRTfQtwwdMkK+TZ4Pxjz2Giwz8veWxhE1hWCe+eyP2WivH2GRVx5QW6y65M/E+DUKXTPdAcObkzIW2bG5ewTEmAJ8deSbgKMKjBICY1h+OJvecfKgGfk4QDe59ZrkMPeyd31q2mL9YYtBYr07G09OOuS4AyLV+sZc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3E1BC4CED5; Tue, 15 Oct 2024 21:24:04 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1t0p1k-00000003517-3sp9; Tue, 15 Oct 2024 17:24:24 -0400 Message-ID: <20241015212424.785004334@goodmis.org> User-Agent: quilt/0.68 Date: Tue, 15 Oct 2024 17:24:11 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Alexei Starovoitov , Florent Revest , Martin KaFai Lau , bpf , Alexei Starovoitov , Jiri Olsa , Alan Maguire Subject: [for-next][PATCH 3/3] ftrace: Rename ftrace_regs_return_value to ftrace_regs_get_return_value References: <20241015212408.300754469@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Masami Hiramatsu (Google)" Rename ftrace_regs_return_value to ftrace_regs_get_return_value as same as other ftrace_regs_get/set_* APIs. arm64 and riscv are already using this new name. Cc: Alexei Starovoitov Cc: Florent Revest Cc: Martin KaFai Lau Cc: bpf Cc: Alexei Starovoitov Cc: Jiri Olsa Cc: Alan Maguire Link: https://lore.kernel.org/172895573350.107311.7564634260652361511.stgit= @devnote2 Acked-by: Mark Rutland Signed-off-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) --- include/linux/ftrace_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/ftrace_regs.h b/include/linux/ftrace_regs.h index b78a0a60515b..be1ed0c891d0 100644 --- a/include/linux/ftrace_regs.h +++ b/include/linux/ftrace_regs.h @@ -22,7 +22,7 @@ struct ftrace_regs; regs_get_kernel_argument(&arch_ftrace_regs(fregs)->regs, n) #define ftrace_regs_get_stack_pointer(fregs) \ kernel_stack_pointer(&arch_ftrace_regs(fregs)->regs) -#define ftrace_regs_return_value(fregs) \ +#define ftrace_regs_get_return_value(fregs) \ regs_return_value(&arch_ftrace_regs(fregs)->regs) #define ftrace_regs_set_return_value(fregs, ret) \ regs_set_return_value(&arch_ftrace_regs(fregs)->regs, ret) --=20 2.45.2