From mboxrd@z Thu Jan 1 00:00:00 1970 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 80048C76196 for ; Thu, 6 Apr 2023 10:23:15 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ipgZwZPq1ziwQSFqxgWIEjKRHQD03zS+QGEPvdsXyHw=; b=Xeg7kcCWpucEON GVK+sTWVIA4bOyZpYW7G12TQQqDAftMuVISiE8vA6CEsm5SyP1LWisGBWRfysLewGHS0nxV+Eipf9 y/RYh5hh1Clx0OTPQN+a8q4Bd8aI3u4/QIj+qxDM0XyNf39fu8e82QCacFSICgO3LYQrjzTRWs3mc 7qbg1TGpcS6w7rGbNaY4qXbo4Z8H+vKOMQ2uLZGc2JoX0D6jWScJcb0uprACY9f3XjuABRJTDwYek n8aZmoJpSIfshgvwLws84tc2s6Ct5NGbfenPu7S4hguVindnkcmULnNWyG/ozUY8YpJLX8JbrnJYm oQ4JEKtu6Ai52ckdvqOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pkMl7-006zgR-0i; Thu, 06 Apr 2023 10:22:25 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pkMl3-006zg2-2D for linux-arm-kernel@lists.infradead.org; Thu, 06 Apr 2023 10:22:23 +0000 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 BBCA516F8; Thu, 6 Apr 2023 03:23:01 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.20.171]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 42B2E3F762; Thu, 6 Apr 2023 03:22:15 -0700 (PDT) Date: Thu, 6 Apr 2023 11:22:09 +0100 From: Mark Rutland To: Florent Revest Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org, catalin.marinas@arm.com, will@kernel.org, rostedt@goodmis.org, mhiramat@kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kpsingh@kernel.org, jolsa@kernel.org, xukuohai@huaweicloud.com, lihuafei1@huawei.com Subject: Re: [PATCH v6 3/5] samples: ftrace: Save required argument registers in sample trampolines Message-ID: References: <20230405180250.2046566-1-revest@chromium.org> <20230405180250.2046566-4-revest@chromium.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230405180250.2046566-4-revest@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230406_032221_793850_68D8054F X-CRM114-Status: GOOD ( 18.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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Apr 05, 2023 at 08:02:48PM +0200, Florent Revest wrote: > The ftrace-direct-too sample traces the handle_mm_fault function whose > signature changed since the introduction of the sample. Since: > commit bce617edecad ("mm: do page fault accounting in handle_mm_fault") > handle_mm_fault now has 4 arguments. Therefore, the sample trampoline > should save 4 argument registers. > > s390 saves all argument registers already so it does not need a change > but x86_64 needs an extra push and pop. > > This also evolves the signature of the tracing function to make it > mirror the signature of the traced function. > > Signed-off-by: Florent Revest Reviewed-by: Mark Rutland Thanks for this! Mark. > --- > samples/ftrace/ftrace-direct-too.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/samples/ftrace/ftrace-direct-too.c b/samples/ftrace/ftrace-direct-too.c > index f28e7b99840f..71ed4ee8cb4a 100644 > --- a/samples/ftrace/ftrace-direct-too.c > +++ b/samples/ftrace/ftrace-direct-too.c > @@ -5,14 +5,14 @@ > #include > #include > > -extern void my_direct_func(struct vm_area_struct *vma, > - unsigned long address, unsigned int flags); > +extern void my_direct_func(struct vm_area_struct *vma, unsigned long address, > + unsigned int flags, struct pt_regs *regs); > > -void my_direct_func(struct vm_area_struct *vma, > - unsigned long address, unsigned int flags) > +void my_direct_func(struct vm_area_struct *vma, unsigned long address, > + unsigned int flags, struct pt_regs *regs) > { > - trace_printk("handle mm fault vma=%p address=%lx flags=%x\n", > - vma, address, flags); > + trace_printk("handle mm fault vma=%p address=%lx flags=%x regs=%p\n", > + vma, address, flags, regs); > } > > extern void my_tramp(void *); > @@ -34,7 +34,9 @@ asm ( > " pushq %rdi\n" > " pushq %rsi\n" > " pushq %rdx\n" > +" pushq %rcx\n" > " call my_direct_func\n" > +" popq %rcx\n" > " popq %rdx\n" > " popq %rsi\n" > " popq %rdi\n" > -- > 2.40.0.577.gac1e443424-goog > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel