Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp5415059pxv; Wed, 7 Jul 2021 03:16:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeAxo8EnbYNS5Wl6fNxCJtUGd/MbYD2MxlJHGcSN+t00beI0HdYm6cM4pfZ8Nwsee2PkDy X-Received: by 2002:a05:6402:290c:: with SMTP id ee12mr28889596edb.161.1625652998244; Wed, 07 Jul 2021 03:16:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625652998; cv=none; d=google.com; s=arc-20160816; b=wM6TJv6bM+/KJd7EbgT8bOKislX2b4QRIpErywDl7FMIumxEVxhFkTywg9mKI3FC9v 8xUoqSO2hyDJh8J14P8AiM/tbE6FEpX2+oyk8Ovqdlsc21trFgUsGTK/5+KokHx/d8Jt 3Jj3XJD+RC8SYF2CX/HcNhDo4ITGvjBFK5It/mBDBa2iIRDCnxfeNFl1NsmyrTh+w5gS A71O6QQsCw27uuvlyilZE6y5xl+pgdhV/Uwb5smrEpwoO4E985h2jBdspyojzet+4bLN c1b3CbyCTAeexoNr2BNC6skVgA1bgIJMuaf4HRnv43RxUH126PC3lRMUVOiCMkQKR/p9 6xYA== 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:subject:cc:to:from:date :dkim-signature; bh=Futb7ss/19YQ13jxIToIIeqnOsptoaV2rvbcMPv0Rag=; b=zO1NQC+jIT2Zii74Hag5oT2dq6FGHnbo1fFjFLpQ5JL5HqqtRsBay9tC/Bk7PnSOF4 hRj/Z+MV/Kk96i6BP3JcqpEJ2rvEZfya/gl3Zfbz02MngnlcJfpbjuA2I8I3fSY48rY9 J33CtEkX+XCEYz/MtZHV9uwQ/gE9fx2+a/fyLSHDOGhygdETPhsY3Axns2kndvOsxWZc pnRUkHKqIMJ3YQtEY77Eg0nmpThd6IJ05PqJsEuJjhUVpVRnoVm4JfiLJREJdlvkio+y QVEPDgIRo5KjPO7noDinWydkj5HW5YEXghiLFM595PvS4Fjkj1uhtX4ooB3O1/b0GBbi OpHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hDoYXpKt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w22si17914825edc.230.2021.07.07.03.16.15; Wed, 07 Jul 2021 03:16:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hDoYXpKt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231262AbhGGKRz (ORCPT + 99 others); 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: linux-kernel@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