Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6356721rwr; Tue, 9 May 2023 14:05:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7twWI85GFkSuDx2BDBkknna1zFyokqb7v0a6/svrUcVJUaiJqqTf7km+WU1RRvk5pkihl4 X-Received: by 2002:a17:902:9346:b0:1aa:ef83:34be with SMTP id g6-20020a170902934600b001aaef8334bemr14012688plp.47.1683666343916; Tue, 09 May 2023 14:05:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683666343; cv=none; d=google.com; s=arc-20160816; b=P7VvSK+BlKzUtTc1nHHt6L1mDcAiqTA5b0DUFoGmUA6/zV3u7rIgFd5Z8I6rj1tEiT ygOdc2/xnule21f6TK3YKjD6qdxKnvKw6MZ478mX15rzjoTlaHT7QP2W/VH7nsFq4c7Q kbeAdr4jWsmeprBw+C5BsTmKP7wMyoqM+9Ots0QmmXUXvpOBn0sMkAynYGr9k6sWg1o7 BgT2a67wL9AjdBz51qs0ViRoElyVxx8e/Lys+SEbqA2MQErFzQEjkNQfQ4TR5xHEDNqz MVGsY7JQ245Z6xQbeiExmN3XXXVgKNmzOJe6ARwncBmQ6QKwfj2N2BhuKVK7hndMbkg+ K0Sw== 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; bh=gccnEL/ppsDjyT3jY0kWdx8DVhRCVgKsmmf9wgRipCE=; b=t+VjPR4jXkyFMunjTlRFx22Io/64E3Wxbwjs7G7SPqzqR9QSZAqk4CxkpkPxGnjZkC ZBY+hrvNTeIbw+VlxQhUnWXBe/wke1MF3HTe2Wy6+doFuyPbFYVFZVGOYXycvyWw4WpR jm2DBu7/JSJL3sdXGyza1XeD+sCwr+h75pCcY4KfPpWnW0Yfilyl/foW432gjA3qjpj7 U3un0vTP+UbOTLyjFekNtpnsFilCEWJKMglbtP1jmO50jgzqZznArtrxeg/qoWn6QdXR Kg9dXUm8skf0e7sDKracw3C+9SQQ4v0v1qw9yH6X/rs8l29Ns88GANoqWHUqveFWgylV wF/A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l13-20020a170902f68d00b001ab18790b12si2654380plg.97.2023.05.09.14.05.29; Tue, 09 May 2023 14:05:43 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235121AbjEIUmw (ORCPT + 99 others); Tue, 9 May 2023 16:42:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234791AbjEIUmt (ORCPT ); Tue, 9 May 2023 16:42:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4422D1BDB; Tue, 9 May 2023 13:42:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CDC10618EB; Tue, 9 May 2023 20:42:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8F6DC433EF; Tue, 9 May 2023 20:42:46 +0000 (UTC) Date: Tue, 9 May 2023 16:42:44 -0400 From: Steven Rostedt To: Alexei Starovoitov Cc: Beau Belgrave , Masami Hiramatsu , LKML , linux-trace-kernel@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , bpf , David Vernet , Linus Torvalds Subject: Re: [PATCH] tracing/user_events: Run BPF program if attached Message-ID: <20230509164244.3163e421@rorschach.local.home> In-Reply-To: <20230509163050.127d5123@rorschach.local.home> References: <20230508163751.841-1-beaub@linux.microsoft.com> <20230509130111.62d587f1@rorschach.local.home> <20230509163050.127d5123@rorschach.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,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, 9 May 2023 16:30:50 -0400 Steven Rostedt wrote: > >From the user space side, which does: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/samples/user_events/example.c#n60 > > /* Check if anyone is listening */ > if (enabled) { Hmm, looking at this deeper, we should update it to prevent the compiler from optimizing it, and keeping "enabled" in a register. Which would not work. Should probably add: if (*(const volatile int *)&enabled) { -- Steve > /* Yep, trace out our data */ > writev(data_fd, (const struct iovec *)io, 2); > > /* Increase the count */ > count++; > > printf("Something was attached, wrote data\n"); > }