Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3662191pxb; Wed, 13 Oct 2021 10:19:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMnz/YXFulyg5I0VyYhvvAykYmRkbzc+f3RlrEvo0J/nauW8B1vOEe++NEJ9mHLM0xpGjk X-Received: by 2002:a17:902:c643:b0:13f:68b4:4abf with SMTP id s3-20020a170902c64300b0013f68b44abfmr349111pls.82.1634145597101; Wed, 13 Oct 2021 10:19:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634145597; cv=none; d=google.com; s=arc-20160816; b=C+SZYdvB3hracwkCRGvQefi9/DK0QX9eoK1bK19Ty/nLDHOP/ccD/cjyehEpZjvsBP K2DmfK0OiCEQCQtziq3QPZldIHhY9Guqphd0L8Yv4V5FaqDJw05HqfOMW2tFM+rJLrIH aBl98H2L7OJUw68aTBnrDzX0wyOKI9rDEZlHbAFZlxD0e4gbkmxF1FWAvmIxXb87lzc8 DzykAyGyBD7tYXvs+667ayduBoXgckArVJfvi0pwOC3AjUpepb1fVHfnoJGSaYIo++0B T6kcEXzZkM28OdVt2g9pLiIditHrNH05yFQjYx+Mlwinvs7713yxxR5HFjRxIKjqM33/ 6SYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=6w7G9sjykt7RkTkpmi8YgipyaMWboWHG8s9GEMJ5XHY=; b=Bo/lU7wPojOxn+g2+Jd/q4c5rFL0xymEWXk9HEn9GFXyZQ5cIMMD9IWn7o/kuwtD9f ODx8XwfqLIdnt/EI478AMiElDvo45V1bw6Cqxq9+DuIqjaH7w54ej2MuhcPaXnO8ic1d otW65ObUdfSFB44pUBjyy+569HsD1gA8A9UCB90DudLoNYa5dRHiUfPvLrZm+jA5qE4U q/1MHy4p9MM/f1WniE78A43Px89/wF2FdT1piipbb0qdNUJz5xg17urXPBsitkbW480h SGQQfHg8i9aR7lbzKs31UCuFRYciA/7Gkz8LIzmTSlKSQGzL89zpg0LTl8nicwvrFwHA xN/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=GJI2PLUF; 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=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s15si9214plg.442.2021.10.13.10.19.43; Wed, 13 Oct 2021 10:19:57 -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=@linux.microsoft.com header.s=default header.b=GJI2PLUF; 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=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237654AbhJMRT4 (ORCPT + 99 others); Wed, 13 Oct 2021 13:19:56 -0400 Received: from linux.microsoft.com ([13.77.154.182]:37042 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229889AbhJMRTz (ORCPT ); Wed, 13 Oct 2021 13:19:55 -0400 Received: from kbox (unknown [24.17.193.74]) by linux.microsoft.com (Postfix) with ESMTPSA id AFA6620B9CF8; Wed, 13 Oct 2021 10:17:51 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com AFA6620B9CF8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1634145471; bh=6w7G9sjykt7RkTkpmi8YgipyaMWboWHG8s9GEMJ5XHY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GJI2PLUFSvM8L/EPA6LUiyY6XS4GuJ8Pe8FD0uQ6n96snSliezPU6GnaHTUo+aE2G 9srWgkqXxD45HUWGkX2ZDSZ/WO8M7V/pFgO+2W/s8BsblZyKc5KaEN/13TMVcWqMmo xTcFH1SK6v1QCjEC/kAiMyVD4rLgydfnEph2nSdo= Date: Wed, 13 Oct 2021 10:17:47 -0700 From: Beau Belgrave To: Steven Rostedt Cc: Masami Hiramatsu , linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] user_events: Enable user processes to create and write to trace events Message-ID: <20211013171747.GA1549@kbox> References: <20211006175611.GA2995@kbox> <20211007231738.0626e348322dc09e7ebbf1d6@kernel.org> <20211007162204.GA30947@kbox> <20211008081249.8fbacc4f5d9fa7cf2e488d21@kernel.org> <20211008000540.GA31220@kbox> <20211008182258.6bf272e6691679d41e7971fc@kernel.org> <20211011162523.GA1542@kbox> <20211012211852.2bbf921b@oasis.local.home> <20211013165043.GA1427@kbox> <20211013131155.69fa0e11@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211013131155.69fa0e11@gandalf.local.home> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 13, 2021 at 01:11:55PM -0400, Steven Rostedt wrote: > On Wed, 13 Oct 2021 09:50:43 -0700 > Beau Belgrave wrote: > > > > Does it require RCU synchronization as the updates only happen from > > > user space. But is this for the writing of the event? You want a > > > separate fd for each event to write to, instead of saying you have > > > another interface to write and just pass the given id? > > > > > Yes, an example is a process creates the fd and registers some events. > > Then the process forks and the child registers another event using the > > same fd that was inherited. > > Well, I was thinking simple locking could work too. But I guess RCU is like > Batman. You know, "Always be yourself. Unless you can be Batman, then > always be Batman!". So always use locking, unless you can use RCU, > then always use RCU. > LOL, I'm happy to use a rwlock_t instead. Not sure which is faster, to me I care most about the write path not skewing clock times of the events being emitted. It seems like the contention case will be low in most cases, so these paths will be read-only most of the time. It seems rwlock_t has the disadvantage of the writes blocking on the realloc/free case during the resize. RCU can delay the free until something has time to do so, so seems a good fit. Thoughts? Thanks, -Beau