Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp5434281pxv; Wed, 7 Jul 2021 03:47:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcRupU6jw3TSfQ39fqC1E8BSIqk1ND7NVf99hRBCy/PG8Ojqyqh7xIbnNfbR8X9yXAnvVT X-Received: by 2002:a92:c6ce:: with SMTP id v14mr18503211ilm.12.1625654843701; Wed, 07 Jul 2021 03:47:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625654843; cv=none; d=google.com; s=arc-20160816; b=RlvWe8mO6hDlwAid1uz3IzTmjcmPcORM9RtgDbctxtZAIQqsthsRQwi/bkPvvxa/9J 6QEarFILV1GzxCXrlg7MtFqt/UzLxQrbUFmcsQAB3lT69Vy9YCRiOPaUoyjYcr5rom/g 74n2xVirHClFL9ectEGC6JztLHt0j9hyU/hWUpzLHFgpsKi6JbTKWz0jXRkV2WRiQfDI rhsOvKsXycaSxWNT/kGKs6YGw33Y7WT7pVLmqPzmt2HAPjnWwHzln6u7BuCO0aqWDsUA JF8kj5M6fTJbiEbZXGUg9SK30PEqjFE1DbRvLHboaq23easiafQguIfyBR2uaGR6fLcR 1Zlw== 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=XPLS0eqgiPT6Qpqsv2akOPjLGsh7BCvt+uAURUY2Q0M=; b=g5pSGEd41/msyumGUQSX8tXqyn1y3Q7GANRco/yZb1H02zlUFP4MYrYpGsvMTWlYdc wLqz/kEzfaM+FB9yRMKQGN/qXPkyoKdYJxxSZk/25clTk7ClVLkYf93hM4qSi2YNL/PU A85NIBpXyY2Ui4FKJAd34cyDiJ3/6kn4+EsXMhtUXvrzSZHN4DIRTsWC5cW5D3GkLkYW jKJoaQ+PMIdyu0DIDa94OmVAMaqlL+M96W5l8xW9jtMW4Ee4MdjoQMzXMP5ousdk9jTM IWPzgzKmm/Iv3s9O55aOkkNmtImRkl5tAeRK5kqllVfWlOrggvnDWlHWBeNMoyM21iWf RSyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="MhrN/1tl"; 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 g21si22655301jat.111.2021.07.07.03.47.12; Wed, 07 Jul 2021 03:47:23 -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="MhrN/1tl"; 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 S231431AbhGGKsQ (ORCPT + 99 others); Wed, 7 Jul 2021 06:48:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:33684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230354AbhGGKsO (ORCPT ); Wed, 7 Jul 2021 06:48:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CB93661C73; Wed, 7 Jul 2021 10:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625654734; bh=8aOJz6m5RJlTXs6gh0uc/O0I73BykATmNxUl6cB0w3w=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=MhrN/1tlrnCGavOeEq49Qur6+PSu6kg6J7gm7/e2okTmQNBoTXp0PLI9KFjtWKTPA 1QZPIC7znIe+kzZ8FLmTkHZyc6JWs8/HNOOjD0zrh7jNm87gSy3mTyw8lKcfpcVbWu 4/z5YHEng+CYOkg8GS+AsqR/1w+eTseE7YfUnr3SCQHvFC/g78yvLrhuVlEyyVnZvR ykdZYGLKMEpykcsGTpj6fyPSNkY0aLpDhZhuoQHACwX8TuInO2O99+F+7gNu8zvT8X N/pgISSE5SIUgg2cPuMz0HAofJOcoOfoudYr8g8hx5IU8wgR6TsfDA++IfPnCCwwwW NzwRfBd3elcYg== Date: Wed, 7 Jul 2021 19:45:30 +0900 From: Masami Hiramatsu To: Peter Zijlstra Cc: Steven Rostedt , 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: <20210707194530.766a9c8364f3b2d7714ca590@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> <20210707191510.cb48ca4a20f0502ce6c46508@kernel.org> 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 12:20:57 +0200 Peter Zijlstra wrote: > On Wed, Jul 07, 2021 at 07:15:10PM +0900, Masami Hiramatsu wrote: > > > I actually don't want to keep this feature because no one use it. > > (only systemtap needs it?) > > Yeah, you mentioned systemtap, but since that's out-of-tree I don't > care. Their problem. > > > 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. > > When would you do the alloc? When installing the retprobe, but that > might be inside the allocator, which means you can't call the allocator > etc.. :-) Yes, so the user may need to allocate a pool right before register_kretprobe(). (whether per-kretprobe or per-task or global pool, that is user's choice.) > > If we look at struct ftrace_ret_stack, it has a few fixed function > fields. The calltime one is all that is needed for the kretprobe > example code. kretprobe consumes 3 fields, a pointer to 'struct kretprobe' (which stores callee function address in 'kretprobe::kp.addr'), a return address and a frame pointer (*). * note that this frame pointer might be used for fixing up the stack trace, but the fixup method depends on the architecture. Thank you, -- Masami Hiramatsu