From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) (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 94E4A3CA486 for ; Thu, 19 Mar 2026 21:13:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773954807; cv=none; b=p6j1n+rPWtidCuxJgY1IxM51+znNOW8sv858a5DCgb8ddKJVFdo0bc7FS43Iafzu3JcUrcCOuPOlmJ4ZkUDS8w6wCsrTXAdlyTM7Uv8dIspeDuF/R2kM3lx2IxpmuK7y5e463ujGfMU9Xo2LjGFNkC/yK3da3PV2VaxGmwcthlM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773954807; c=relaxed/simple; bh=zoG0eEm6wGwBiUzhWVbDlXRtrW6e4Ji2cjYiDe2e4Ic=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=m2M6xh2I2SIPMyq312AVoNVXAq5Pc6Nl5IJQBbStko07+Q+EfdjQyy/iHh378dYmnvznGkNKHmAwU4ZozYj5j7yes8XsuHIuQGWvYIVRimOFiRxnbUuQmvMu/OxhayoMik9dCYK6Lha+XeANWLjK4sh5UUn3+y1FG1kT2m2q2YY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=goodmis.org; spf=pass smtp.mailfrom=goodmis.org; arc=none smtp.client-ip=216.40.44.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=goodmis.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=goodmis.org Received: from omf05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id D7CB113B80B; Thu, 19 Mar 2026 21:13:21 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: rostedt@goodmis.org) by omf05.hostedemail.com (Postfix) with ESMTPA id 08C602000D; Thu, 19 Mar 2026 21:13:19 +0000 (UTC) Date: Thu, 19 Mar 2026 17:13:50 -0400 From: Steven Rostedt To: Vincent Donnefort Cc: David Carlier , Masami Hiramatsu , Mathieu Desnoyers , linux-kernel@vger.kernel.org, maz@kernel.org Subject: Re: [PATCH] tracing: Fix nr_subbufs initialization in simple_ring_buffer_init_mm() Message-ID: <20260319171350.74175809@gandalf.local.home> In-Reply-To: References: <20260318171907.19640-1-devnexen@gmail.com> <20260318152804.26a8d6be@gandalf.local.home> X-Mailer: Claws Mail 3.20.0git84 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Stat-Signature: zbgxyxc3y4rqzrbz7yuq1cwnhnbr5bhu X-Rspamd-Server: rspamout08 X-Rspamd-Queue-Id: 08C602000D X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Session-ID: U2FsdGVkX19SsIAvhSkzt1qsuc/nNCTFRvkDLeZ8RTU= X-HE-Tag: 1773954799-65273 X-HE-Meta: U2FsdGVkX18282/lwAfcBiQxNbbEsfLb6YN/DG7E7neWVYeY+6bRXMBuvR68O5PO62bv+kK0/0ABbxgsqjAyx03lvJbYT1EG24OGD31ewqq8Ob3oj0LtHCRuQgxpTyqsu1W4zeacTQJRqaizlivoGW8xgM3pDmrDjjYTbl1wrmyxiRqgT3iPjYGA1okn7Mrz7d46tEErsZgPET/2wE8jfYRCPgOL+jmO2ng0vGDZ31B4LZpWLUbKwYsWqIIaQMQC9t1IFFMwQ9yCvYP6i7/vZDg9A+j+5iVKboNsjbJDiByBPQRd6JX8FSt1vDBAYT3dxXr7YxTGG5jflpzXqn/SkUe+4hnHNfk7BrPqOCAvQ9k8yESu8gDIww== On Thu, 19 Mar 2026 09:26:52 +0000 Vincent Donnefort wrote: > I don't think it is fixing anything at the moment. It sets nr_subbufs for the > sack of completing the meta_page but this field isn't read by the kernel. It > doesn't need it because the reader is using the ring_buffer_desc. > > Nonetheless it's probably worth to fix now, that will be less work if later we > e.g. allow remotes to be mapped by userspace. (Not something I have on my todo > list). Or add a comment to why it was set to zero. > > > > > > > > > Fixes: 34e5b958bdad ("tracing: Introduce simple_ring_buffer") > > > Signed-off-by: David Carlier > > > --- > > > kernel/trace/simple_ring_buffer.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/kernel/trace/simple_ring_buffer.c b/kernel/trace/simple_ring_buffer.c > > > index 02af2297ae5a..e991a0d8def2 100644 > > > --- a/kernel/trace/simple_ring_buffer.c > > > +++ b/kernel/trace/simple_ring_buffer.c > > > @@ -395,7 +395,7 @@ int simple_ring_buffer_init_mm(struct simple_rb_per_cpu *cpu_buffer, > > > > > > memset(cpu_buffer->meta, 0, sizeof(*cpu_buffer->meta)); > > > cpu_buffer->meta->meta_page_size = PAGE_SIZE; > > > - cpu_buffer->meta->nr_subbufs = cpu_buffer->nr_pages; > > > + cpu_buffer->meta->nr_subbufs = desc->nr_page_va; > > I would just move this assignment later to make sure cpu_buffer->nr_pages is > aligned with the meta page, instead of relying on the ring_buffer_desc. I was thinking the same thing. -- Steve > > > > > > > /* The reader page is not part of the ring initially */ > > > page = load_page(desc->page_va[0]); > >