Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1509412pxb; Wed, 30 Mar 2022 05:18:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwki9rF51RQTZW/ot8/SOVVXjzEKGS/sFj7HZ5uBjwYnW1F9dqh5uH2+17PlAE8of9Xs0Ii X-Received: by 2002:a17:907:8688:b0:6d2:c19:e1a0 with SMTP id qa8-20020a170907868800b006d20c19e1a0mr38015795ejc.249.1648642696168; Wed, 30 Mar 2022 05:18:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648642696; cv=none; d=google.com; s=arc-20160816; b=t5vJd6roCumckRgZG1Gh+OYRWVxDQVFjLIrCKosuJ3GpE2F5qcVvj1HRXRGNqu5sYr BVR9qQeoftd5mJ10ut2VsdqjuA0m6yDg0Vy43q1z0ishn41nF7vPNJqlXJBjhfz5dJjc swmGI25aLdAGy5KyB3mPZ1GWCmjGOCIdBKLvnrIWOt1PooH6M34+bp8GNUskuo7LUNj2 NKwb1wYegy1EAt9hPUO2G0FkGJBvWfKnHZe00yLzbEBlKO2gp4jgw4+UJbpiEQhZDwf8 ArbssfFmXONY28d/XUnnQMLclEANwutMHMlz3BGdFrdLwGI9Lph49U7FEcVQS7avCUrh RaeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=OX10xLhNulTBcdU5muA8JTM3Au0wWeRUYrKCzsEHaU0=; b=pwmmJ9fUJw1XYRCsfADo7LtUu1FZLUEJ+WZBBmjTAxeYsK7uTnJkDmHi1oXxLh7H/R T/ZXSFYlk3+qyX5JMdLrvY3rgGxPxTpodCeysIgzAPfaugLl3jmr5Is60JHOn7OK3SM3 xqEAXpEl6XB9ZPvNurBhf2e4SWIyhKXNVG7SOqiOs/aan+5P89LUXZedqieUVzdSIv7u PAnsz3aoW/rqRuyaWapFat0NQKHuVWk1cD49CwpwdvQ50CtbhKVZa3Z7inYtxFZ1jKNt U2r78zEBdbdTC2oZ/o1fQWtO5ubS6sNLGLe6xG23drjIvL7BZTGcyQQfFdHTIRMZkCfm e8ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XulX9SUn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fy3-20020a170906b7c300b006e134025da6si6333422ejb.819.2022.03.30.05.17.48; Wed, 30 Mar 2022 05:18:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XulX9SUn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236666AbiC2Wd2 (ORCPT + 99 others); Tue, 29 Mar 2022 18:33:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236806AbiC2Wd0 (ORCPT ); Tue, 29 Mar 2022 18:33:26 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C696A1C5526; Tue, 29 Mar 2022 15:31:42 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id w8so18893962pll.10; Tue, 29 Mar 2022 15:31:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OX10xLhNulTBcdU5muA8JTM3Au0wWeRUYrKCzsEHaU0=; b=XulX9SUn7wpdo6Fv0r2P+0LXSb/g25UbI2y0CULw/8zpw73PJi31NAptJj/hMfqqBA Js94HsIZCiFgQY6UJ0HziKiPkGGirLUY4jeZ3AEZ1JFtGUCL4ii6U0HyIUHAvWHWjFv+ yvgK1MiYg55maIktd/hI3NNTZ9Ag3WTM8jvfMDwpAwl5TGj4BfBFXSi92blY7ckHU3fJ bsslItjIJ7wPi7OA6PABXdcnv2SJMzsMqm5XYvmebE7IwRUXn3nejlvvTmg6KzoUvc8J yUVQrKNz7rwgW6WBGmpsII1/uAd/jdm1Caw5zb6yZn0zpUi072JW3y4EuFm3WxvKlSlf mBOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OX10xLhNulTBcdU5muA8JTM3Au0wWeRUYrKCzsEHaU0=; b=NQbMkEx+agDDlg72EAIDn0uyk8Yshju5B0sZCLQgN5sMMGwJUrYr5UrNdLQY9xvnCj dapG6fqZFeB5eDvlmMqAU/GduwJhje7kmaYQlo0f8Ou11ic9O4UIN/BRLHB9eY+kpEDF 54VUNJ90J55xE3EBfwjULw2PIwv67eyU5AI/qX/nAHU9rf8R+ubM0GO7s6RbH0nhWzbM eb9hCGR7LK0125PBNisnLJwlxq9X07spu0Gz77WRIEoA6w/BUerM/p7UJ9Caq6Kz4KPF VvruyzFDsnoHJFVab+DyVpyXQCMjlB59aDjrXU3BVYTIDU04t5K1HcAy+91jfJV/UfcM tyEA== X-Gm-Message-State: AOAM533fih4eVM7+xsXo38oQdsCm713aqvX4kUFhRFjKO+kNYtxBl1I0 JJ9ozRrArJdQKATp2Btfw9iSRd6NL/DkuxRKv668kZ6a X-Received: by 2002:a17:90b:4b45:b0:1c7:cc71:fdf7 with SMTP id mi5-20020a17090b4b4500b001c7cc71fdf7mr1425270pjb.33.1648593102302; Tue, 29 Mar 2022 15:31:42 -0700 (PDT) MIME-Version: 1.0 References: <20220329181935.2183-1-beaub@linux.microsoft.com> <20220329201057.GA2549@kbox> In-Reply-To: <20220329201057.GA2549@kbox> From: Alexei Starovoitov Date: Tue, 29 Mar 2022 15:31:31 -0700 Message-ID: Subject: Re: [PATCH] tracing/user_events: Add eBPF interface for user_event created events To: Beau Belgrave Cc: Steven Rostedt , Masami Hiramatsu , linux-trace-devel , LKML , bpf , Network Development , linux-arch , Mathieu Desnoyers Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 29, 2022 at 1:11 PM Beau Belgrave wrote: > > On Tue, Mar 29, 2022 at 12:50:40PM -0700, Alexei Starovoitov wrote: > > On Tue, Mar 29, 2022 at 11:19 AM Beau Belgrave > > wrote: > > > > > > Send user_event data to attached eBPF programs for user_event based perf > > > events. > > > > > > Add BPF_ITER flag to allow user_event data to have a zero copy path into > > > eBPF programs if required. > > > > > > Update documentation to describe new flags and structures for eBPF > > > integration. > > > > > > Signed-off-by: Beau Belgrave > > > > The commit describes _what_ it does, but says nothing about _why_. > > At present I see no use out of bpf and user_events connection. > > The whole user_events feature looks redundant to me. > > We have uprobes and usdt. It doesn't look to me that > > user_events provide anything new that wasn't available earlier. > > A lot of the why, in general, for user_events is covered in the first > change in the series. > Link: https://lore.kernel.org/all/20220118204326.2169-1-beaub@linux.microsoft.com/ > > The why was also covered in Linux Plumbers Conference 2021 within the > tracing microconference. > > An example of why we want user_events: > Managed code running that emits data out via Open Telemetry. > Since it's managed there isn't a stub location to patch, it moves. > We watch the Open Telemetry spans in an eBPF program, when a span takes > too long we collect stack data and perform other actions. > With user_events and perf we can monitor the entire system from the root > container without having to have relay agents within each > cgroup/namespace taking up resources. > We do not need to enter each cgroup mnt space and determine the correct > patch location or the right version of each binary for processes that > use user_events. > > An example of why we want eBPF integration: > We also have scenarios where we are live decoding the data quickly. > Having user_data fed directly to eBPF lets us cast the data coming in to > a struct and decode very very quickly to determine if something is > wrong. > We can take that data quickly and put it into maps to perform further > aggregation as required. > We have scenarios that have "skid" problems, where we need to grab > further data exactly when the process that had the problem was running. > eBPF lets us do all of this that we cannot easily do otherwise. > > Another benefit from user_events is the tracing is much faster than > uprobes or others using int 3 traps. This is critical to us to enable on > production systems. None of it makes sense to me. To take advantage of user_events user space has to be modified and writev syscalls inserted. This is not cheap and I cannot see a production system using this interface. All you did is a poor man version of lttng that doesn't rely on such heavy instrumentation.