Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2291535rwl; Thu, 30 Mar 2023 08:24:31 -0700 (PDT) X-Google-Smtp-Source: AKy350bEnoPFEgbJMAkIZmzrEz10BT27pFm4PKeaTVe6yUzEZ9sbtNwMLC5NUooohR4r/rJ9Sm8W X-Received: by 2002:a17:906:208:b0:931:5145:c51d with SMTP id 8-20020a170906020800b009315145c51dmr2609605ejd.0.1680189871626; Thu, 30 Mar 2023 08:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680189871; cv=none; d=google.com; s=arc-20160816; b=yg8xuF2DXS/8f6okFrRuAcYWEdFz/qrsL7amnO/unopVDsCY0mNs2OyGPDm0TxIMBy S5vUXV97jYjI704mrWTJvGyY1E1bHdv0PqPD+tamG75cvraSb7EAYjM9n3SbXYzYzgnZ +Xqr9c9t2zJGfYK+L0IbWD8uO5eCfm1RfZC/Lpwh6UamlC6bm32FDXRbLezRyTZ5ENvd 0tSTo8uO1zcj7t3tzdEeQJQ1M61W/Rwk07NsDr5BFvPmEpW8du7pX7kh++ZySO1PiKsG l4LG/3+BRo2RVRV8EwUBT0Ni2O1aS4HQkPayivT2J4D3z8tpUi5lltqUq7QAR80ip2EC Hqsw== 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=ETM86HXqs4ygSBA/bUEoUiVuq+9lVAWskwlnbor1dnY=; b=QMB+MbvPWLzJ0NL5XgILbCOuYAeABTBV7ktI7/jgS9RPiD/4T43pfI/M7Sw8IAr44k 8N/XosVvdrhJRJqj4EyKKkKsyC49zWUmLPwYbMsgQNFr4h8r/WhKb84++kfc8mNmKXTj avXM4qF2GrIuIebFlhVw/WZfH49/e2+Cq0eFBXcZ+ftu2SMKFCyw95sdd48Uf/6sPdLT ggmD7hff5F5rT1A2cXvN+VHe9n9KJnrG5jCctjn4APJbVkdsHREovVRTgX+iHT/WH10q AhXqS5IDB1h5NpfUEwvjh20dwzbwSY3oZXOtvQ/arZsUVvyNNVQLlmGSkIvLeXmAmXpy AEDQ== 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 wv2-20020a170907080200b0093fe6abfa07si13926304ejb.305.2023.03.30.08.24.03; Thu, 30 Mar 2023 08:24:31 -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 S232964AbjC3PXQ (ORCPT + 99 others); Thu, 30 Mar 2023 11:23:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232958AbjC3PXJ (ORCPT ); Thu, 30 Mar 2023 11:23:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50280D31D; Thu, 30 Mar 2023 08:22:30 -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 9AAE5620D0; Thu, 30 Mar 2023 15:21:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53AD1C4339B; Thu, 30 Mar 2023 15:21:05 +0000 (UTC) Date: Thu, 30 Mar 2023 11:21:03 -0400 From: Steven Rostedt To: Vincent Donnefort Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v2 1/2] ring-buffer: Introducing ring-buffer mapping functions Message-ID: <20230330112103.00c3f422@gandalf.local.home> In-Reply-To: References: <20230328224411.0d69e272@gandalf.local.home> <20230329070353.1e1b443b@gandalf.local.home> <20230329085106.046a8991@rorschach.local.home> <20230329091107.408d63a8@rorschach.local.home> <20230329093602.2b3243f0@rorschach.local.home> <20230329113234.3285209c@gandalf.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=-2.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Thu, 30 Mar 2023 11:30:51 +0100 Vincent Donnefort wrote: > How about? > > userspace: > > prev_read = meta->read; > ioctl(TRACE_MMAP_IOCTL_GET_READER_PAGE) > > kernel: > ring_buffer_get_reader_page() > rb_get_reader_page(cpu_buffer); > cpu_buffer->reader_page->read = rb_page_size(reader); > meta->read = cpu_buffer->reader_page->read; > > userspace: > /* if new page prev_read = 0 */ > /* read between prev_read and meta->read */ > > If the writer does anything in-between, wouldn't rb_get_reader_page() handle it > nicely by returning the same reader as more would be there to read? > > It is similar to rb_advance_reader() except we'd be moving several events at > once? Yeah, I think that can work. So we just need to make sure that the meta page has the "read" variable passed through. -- Steve