Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1510401pxb; Wed, 30 Mar 2022 05:19:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgqeTy2M8LYYQpNkbZHeCfYnGmy01Z7E07y2DC+EqrjTcpU5iyIW2rnxnjOk48/IcnV5QQ X-Received: by 2002:a50:9eaa:0:b0:418:f708:f59c with SMTP id a39-20020a509eaa000000b00418f708f59cmr10069982edf.333.1648642781728; Wed, 30 Mar 2022 05:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648642781; cv=none; d=google.com; s=arc-20160816; b=CUXhOGsZhlr59ZsAIvlHm8cm49xaw+JfclkUd35rGpdxq768f372+5IG3UT7+Cg8jX DOLVIVVL0Pqc3aiWBQaBtHLDGVRlfYyfxe7koOMhMNU9E6X5XuvRMFE6n79/bFjR76hZ Xylp9ilyaOO3BZUQwTS3/TInen7BzGONMnbJ2EDnaGl1mQXLqUbHm4kDZoPXkaZ6SJC3 +nMGDxDpKLUZf0lSY1trKfgXQWOtuZVLx7Rso8m4WyVtmq/IDlnX0VUdfml9Da1Xknn4 Z/7boXvUiVQiu5sPbxHd32ecj4u6p7mTBO/dNxX2mXMCYEBC/8ZjVgBOVAcYgFv1lZ8d 0zXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-filter; bh=zlzTxp+08vt3bMLHgmFGGXahGNx5lIFl8D8SrSqydk8=; b=eretrKsWLzAUTbUP342FyJu3rNYQYu/O9dBpOJ/gbzFl0ys5cagWxD9lx6YkWJEH1C nIHiaX89LIgsCvE9CPkDwkQlsWTeJ7AYo/IH5CxMa6TvQHSwJZtJg3Qcpv/r891YyyEd 1VCC2zD4t1EOPx/JOdvMm+oWGl4xcSES3bCdZCxXOeG1ovCxtQ6KkCzhTh8hMn0rKfL7 tIUvivEUcGZuW8s/Oyx286T3h2gFnPpJw9y4EECOOuunkEzInAjwwZw4TGqlSdiBGXA3 tjhYCtft8DahdvvGssRvy+l6PFc2Q8DIkSJD8K/EqSq3r4PK439WAxAHzuVG+I6Xe9wh KppQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=LpSkVUYE; 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=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p13-20020a1709066a8d00b006df76385ebasi18529866ejr.858.2022.03.30.05.19.13; Wed, 30 Mar 2022 05:19:41 -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=@linux.microsoft.com header.s=default header.b=LpSkVUYE; 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=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239531AbiC2XNa (ORCPT + 99 others); Tue, 29 Mar 2022 19:13:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235262AbiC2XN2 (ORCPT ); Tue, 29 Mar 2022 19:13:28 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6287F18F23C; Tue, 29 Mar 2022 16:11:44 -0700 (PDT) Received: from kbox (c-73-140-2-214.hsd1.wa.comcast.net [73.140.2.214]) by linux.microsoft.com (Postfix) with ESMTPSA id CB61E20DEE31; Tue, 29 Mar 2022 16:11:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CB61E20DEE31 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1648595504; bh=zlzTxp+08vt3bMLHgmFGGXahGNx5lIFl8D8SrSqydk8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LpSkVUYEhTTL7DLJeD/qpcTOpkU8sd7SVuQKZqa9PJxD9lH32ZACJSueKOFHMhjix LmAT8ofaPLypSywQivSyPqpOB4Llc69QQNZxDdaC+47FPD4ecm8FlPgBLuQ8k2jXWn DoKloMJnqTrnht7HwRXmsyUhpeRycvRYP3kmqZb0= Date: Tue, 29 Mar 2022 16:11:37 -0700 From: Beau Belgrave To: Alexei Starovoitov Cc: Steven Rostedt , Masami Hiramatsu , linux-trace-devel , LKML , bpf , Network Development , linux-arch , Mathieu Desnoyers Subject: Re: [PATCH] tracing/user_events: Add eBPF interface for user_event created events Message-ID: <20220329231137.GA3357@kbox> References: <20220329181935.2183-1-beaub@linux.microsoft.com> <20220329201057.GA2549@kbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL 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 03:31:31PM -0700, Alexei Starovoitov wrote: > 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. Sorry. > To take advantage of user_events user space has to be modified > and writev syscalls inserted. Yes, both user_events and lttng require user space modifications to do tracing correctly. The syscall overheads are real, and the cost depends on the mitigations around spectre/meltdown. > This is not cheap and I cannot see a production system using this interface. But you are fine with uprobe costs? uprobes appear to be much more costly than a syscall approach on the hardware I've run on. > All you did is a poor man version of lttng that doesn't rely > on such heavy instrumentation. Well I am a frugal person. :) This work has solved some critical issues we've been having, and I would appreciate a review of the code if possible. Thanks, -Beau