Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1764530rdd; Thu, 11 Jan 2024 08:35:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4bacGZuR8wAzOZ9nxIgSPJbtc2T+uFooS0fjobbJtlGau0VOI4oGGSHO+LuSXQk8suqUK X-Received: by 2002:aa7:c3cb:0:b0:554:489a:2a55 with SMTP id l11-20020aa7c3cb000000b00554489a2a55mr794952edr.10.1704990912193; Thu, 11 Jan 2024 08:35:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704990912; cv=none; d=google.com; s=arc-20160816; b=qgRaiUgLRN8xsA6w/zHLY1uHgrfuiKFTujzDMnc3C+0+PSZyOJUlUL0ldt+EL+KaR1 bIaKlo0WFiZXYTX24lIgHJyotMzrErg0lYkUHY5yNQV2h4Wtch2D/vPS9R0wFU9bbZJ6 Mo9HSwptFI0W1Juoy/HDqpemtPsTHC34pYnsxV1lROPjIYxlsaM+F2iUqjxMO3pF+69z Jd+g3QRsyyOB0rIZZbt9CtwkGiGJJC2tQOubVJXMw4tTUUy9Xebh6I6xRHT2SFWmimqi jnIs+Nd8DBlo+PLaaLcUnJ0qIZKl7Xih/xsJr2V/pykCd6GWe9Ceku5SeVRaYji7Ffjd 3/4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=sgnMjKi+ZUGSvP98oADRuolEn0Ggye3TcS2GKSooA+Q=; fh=Y6bn7wPhWoFl72+KTpLI3UltmzyA3lRTOunKMKAQPBs=; b=EPENSPmwLtaWowFAA3irCFxEe5Ef3+yDP1Tl9aL70oiKhT0a0lY5rlesYjRnhtHe1/ mpX7mW0NKxcSrKDu6dpsPbS0BpMR3/MpBt6G6J2IkISbzyBJr36jQ4bVPQEwv6pv0xOA tarwG4opxHS0t/LDGFLBF5kJKsmNjuq13fDfRfb0242J/N1hINAHNaDCggnToqZc9VYp btne7+pNhOkD6SxvYn5sqHB1K3y5/omMcVAQ5P4WMwMumLoGGJvEk3n+YObw0We0bJnL XDARZMXEs02p+vXLDwehIbJakq1tgvDK5ztiJeVlZOd8W07Kh4o9zCrG414EjhZGSzFh twEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=KY878Q+0; spf=pass (google.com: domain of linux-kernel+bounces-23873-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23873-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id cb17-20020a0564020b7100b0054cf1dc6dfesi645899edb.425.2024.01.11.08.35.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 08:35:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23873-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=KY878Q+0; spf=pass (google.com: domain of linux-kernel+bounces-23873-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23873-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id BB03E1F223D6 for ; Thu, 11 Jan 2024 16:35:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6EB7950254; Thu, 11 Jan 2024 16:35:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="KY878Q+0" Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8DBC04D5B2; Thu, 11 Jan 2024 16:34:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1704990898; bh=iptWAYX6bX/a++7Sbagn8Qw6LW3EjeeZBFrURsz1XMA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=KY878Q+0xUFoEvDQnMBIL4Ovva3pvUTwD8MzXRMMcEdtdzEBFKNuax0FWmjXQVh1R HJ2zraSqBHHxBJ799le8UYcmNAvrOMCcEQZdVTggC+m2HQTRZeWMxTSgjfWIIVNOwm tYFH8Iy3WPtFiz35HRnEC2CePhLlq5pM6tQUCk+6sCfmdXpW23poc+UxpuiRcesI9n 7FzMAcwMz1bK4vY0VolVr034VOQ05XL4o6PkDZUETw9zracMli/gdbZTLPEQrgkIXy +hF5LTB1QLo1axF2l/TCUJVyBKPd08Mkk4N5WsxeaQVUdY2CfVlmqk1Ubi67T552e/ tkLDE7qnDVgtg== Received: from [172.16.0.134] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4T9qyV2kSkzKZk; Thu, 11 Jan 2024 11:34:58 -0500 (EST) Message-ID: Date: Thu, 11 Jan 2024 11:34:58 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v11 2/5] ring-buffer: Introducing ring-buffer mapping functions Content-Language: en-US To: Vincent Donnefort , rostedt@goodmis.org, mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: kernel-team@android.com References: <20240111161712.1480333-1-vdonnefort@google.com> <20240111161712.1480333-3-vdonnefort@google.com> From: Mathieu Desnoyers In-Reply-To: <20240111161712.1480333-3-vdonnefort@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024-01-11 11:17, Vincent Donnefort wrote: > In preparation for allowing the user-space to map a ring-buffer, add > a set of mapping functions: > > ring_buffer_{map,unmap}() > ring_buffer_map_fault() > > And controls on the ring-buffer: > > ring_buffer_map_get_reader() /* swap reader and head */ > > Mapping the ring-buffer also involves: > > A unique ID for each subbuf of the ring-buffer, currently they are > only identified through their in-kernel VA. > > A meta-page, where are stored ring-buffer statistics and a > description for the current reader > Hi Vincent, The LTTng kernel tracer has supported mmap'd buffers for nearly 15 years [1], and has a lot of similarities with this patch series. LTTng has the notion of "subbuffer id" to allow atomically exchanging a "reader" extra subbuffer with the subbuffer to be read. It implements "get subbuffer" / "put subbuffer" ioctls to allow the consumer (reader) to move the currently read subbuffer position. [2] It would not hurt to compare your approach to LTTng and highlight similarities/differences, and the rationale for the differences. Especially when it comes to designing kernel ABIs, it's good to make sure that all bases are covered, because those choices will have lasting impacts. Thanks, Mathieu [1] https://git.lttng.org/?p=lttng-modules.git;a=blob;f=src/lib/ringbuffer/ring_buffer_mmap.c [2] https://git.lttng.org/?p=lttng-modules.git;a=blob;f=src/lib/ringbuffer/ring_buffer_vfs.c -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com