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 X-Spam-Level: X-Spam-Status: No, score=-7.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 715AEC07E9C for ; Wed, 7 Jul 2021 10:15:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 53DB361C9D for ; Wed, 7 Jul 2021 10:15:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231204AbhGGKRz (ORCPT ); Wed, 7 Jul 2021 06:17:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:57734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231137AbhGGKRy (ORCPT ); Wed, 7 Jul 2021 06:17:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 40D1961C99; Wed, 7 Jul 2021 10:15:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625652914; bh=WoOLCe/573KQNlOrEEqMXmu+eiiCZloj8cqFm7v8pTg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hDoYXpKtBEZ6RTCdoT1foEgQNZLF/DXPZA94tU6t7o7UVFjk4J9VllvYY+3Hjh90m PrPyRVe7Ej7L/zrv6J8l4f5g12jAqhs+oqnTkA6lxXHfDaoE8yhgAxXim3IFTkkWB1 Eq0ptKEhYDxpvwf3De4k02ADOcxfgp69ExdK4GI0etFfPK8psWGKJDVkF+gZoJInSd 37iqG/hWz4zXLuTPSdfwEvrppigj7dmBwxPhEFg9Lf2xUXQdKwpVZm4mqPkHMlqey5 PuptKA042B2c0l1UceV5ALGegOvafz69i1ml+dcDHWmmgueFsyiswj7JyK+DVGk+aD k1GfH0q+xDApg== Date: Wed, 7 Jul 2021 19:15:10 +0900 From: Masami Hiramatsu To: Peter Zijlstra Cc: Steven Rostedt , Masami Hiramatsu , Josh Poimboeuf , Ingo Molnar , X86 ML , Daniel Xu , linux-kernel@vger.kernel.org, bpf@vger.kernel.org, kuba@kernel.org, mingo@redhat.com, ast@kernel.org, Thomas Gleixner , Borislav Petkov , kernel-team@fb.com, yhs@fb.com, linux-ia64@vger.kernel.org, Abhishek Sagar , Andrii Nakryiko , wuqiang.matt@bytedance.com Subject: Re: [PATCH -tip v8 11/13] x86/unwind: Recover kretprobe trampoline entry Message-Id: <20210707191510.cb48ca4a20f0502ce6c46508@kernel.org> In-Reply-To: References: <162399992186.506599.8457763707951687195.stgit@devnote2> <162400002631.506599.2413605639666466945.stgit@devnote2> <20210706004257.9e282b98f447251a380f658f@kernel.org> <20210706111136.7c5e9843@oasis.local.home> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Wed, 7 Jul 2021 10:20:41 +0200 Peter Zijlstra wrote: > > > Steve, can you clarify the ftrace side here? Afaict return_to_handler() > > > is similarly affected. > > > > I'm not exactly sure what the issue is. As Masami stated, kretprobe > > uses a ret to return to the calling function, but ftrace uses a jmp. > > I'll have to re-read the ftrace bits, but from the top of my head you > cannot do an indirect jump and preserve all registers at the same time, > so a return stub must use jump from stack aka. ret. > > > kretprobe return tracing is more complex than the function graph return > > tracing is (which is one of the issues I need to overcome to unify > > them), > > I'm not sure it is. IIRC the biggest pain point with kretprobe is that > 'silly' property that the kretprobe_instance are not the same between > kretprobes. Luckily, that's not actually used anywhere, so we can simply > rip that out. I actually don't want to keep this feature because no one use it. (only systemtap needs it?) Anyway, if we keep the idea-level compatibility (not code level), what we need is 'void *data' in the struct kretprobe_instance. User who needs it can allocate their own instance data for their kretprobes when initialising it and sets in their entry handler. Then we can have a simple kretprobe_instance. Thank you, -- Masami Hiramatsu