From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99CF4364942 for ; Fri, 7 Aug 2026 09:43:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786095800; cv=none; b=LKO/Vs+4S5nZ8l7xWoX2TAPSexwRLUPy9uqA8m417GNJfW1WnCt4++vvdCfR5TjpUGWq7bJX8CEeHYT8JdgQ1R9yOjUchrbvOOiN35CWUhooQAP44HYF7pUKxAWCf0G5gI5xoELm+LxjUupgEaEr3tPC+WzV2hhuihAMzU3XwfY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786095800; c=relaxed/simple; bh=j2eOaWnvU2KJhWx8NMfzCfYofi5p7LfuzO4wpDMwkK8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aVjQAHdzAxwRdmgz3o2hcld3Uz2QUAyjUYQT0F5x6ailKYG+ViQocOu9aWr9kYJxlUY/k/fvjenfBqPSLzShX4mjrwIAQ0ygF6m91HSIXOxB+1+v6nbxT3x681beftPwZ9q79xW5y+u2tySzMEirl4yAvkB9GH8X3ZpHSIClpJQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=dF4FahK5; arc=none smtp.client-ip=209.85.218.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="dF4FahK5" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-c15d111ca99so350136766b.0 for ; Fri, 07 Aug 2026 02:43:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1786095797; x=1786700597; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=HbE2bwnVMi7D8tqiB/gbTbPGphKHmCKr06HT/XDSX9o=; b=dF4FahK5v6IvxnK5kR+TXDjUw5DyqYT4URFNoLKZPY0Jq8WtpU2qcPdIivXHvciFc1 uQJky6Ygmpq1WFwLfdQJ5XWSjJCi4lKQAb6qYxFGtuu5XuPJV136hvpIK2HoKE6yEBDi bPkkT1w0HNVsNqI2knJX2dO1mNdGv8IHQ/WyhE36xUI3GqYv4rmdLNJj1Zr7jmB8A8BZ glaWYnlFKqzrrp/UaYbokx4M4tjWZTjYj4BieSGKnYguzPGA/QpUtWHMulZ18KmqqJu3 45Wl4HBgEy2t8z/YFhAvqvXhhd/Y6PYfBy8lvdabwP3esGm807XKH38NjBFWcye+ED5B PWMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786095797; x=1786700597; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=HbE2bwnVMi7D8tqiB/gbTbPGphKHmCKr06HT/XDSX9o=; b=gHR3E7f0H8UrBCPAI0SAhTLTpX2FFa2Tt0obh9qDWy7mLbGamC16nvuKeh0lG9guY1 9xApIJ65h+aSCOlKx/Zs+zaU/YQU2y3lnvV0w/Nm178x96VgsdUj8RFNUf4Srqrfj3L3 6Jza6GzREzanrB2M8hEzzba7C02Q727T/4co3VeQCwaMzaIyOq3xXAoMU7AufF6/BFUP HNe50tqXnp2fSmHDIEQ0xc366Q/5Cj8yL/wFiGjmcfbtRSNHp7u9UmbLFFOm0KJhlmT7 oT+A51kVh8UEBMsjdqUzFiEF222AoD3xYFxTSG0D9TDgAhQRjdYoFQzyi/bQvKsfoq4b hZgA== X-Forwarded-Encrypted: i=1; AHgh+RpZMkYi91WPIW+fx8uDtSwiYupbZfVh6kUjyHiaRGMKAjhlplxC4sUX6SK8WQvkkAH4TW6iP2BPCk33Dy4=@vger.kernel.org X-Gm-Message-State: AOJu0Yx/Oxc+nCDG1/FOVE3Xof5zJUWby5/nLJimMTTkPIqukJ3GHQEr WxEofdFGhevBlJ/iJvcMPGQUYSTnnQxq6tkpKSeGbCDM407mvsWUY8fOSdhMcf4wBg== X-Gm-Gg: AR+sD13FC4nqcJjyH4Oy1kUwj4Q/2wRMSbgwiWM0Z00WfxoYcDp1AW57ahEkuGUHHGQ uAMIIqvU59yw7Gmn0/VJUtjYGtQEwzAANCqBm9QSCrQ5Ki3vfQcFXOG0BEYIbt6iWMt2kOEla9t mZeuavOwsWa8rEzbFliA2mdfelxy1enGeZ4Wegckx6uO0I6YWN7zbrXmRI30t/KKfpoqROVfW3J jm8DGLZVSo880mF6BBs5epC9ukY/i8SrWgP2fdEWz2UF5cKpNILpS4MLlCZ2w8RNy4B+qLCmaP0 f+BNr/mKJpOJ3jqgZprnyGVARz9JmLPFhzHxogh+yNSug5HmwGXMimQ664ynu90sJRWfGD9si4P WrLQs+bhFIneUKG25YTo2pLyvTScOMZoAKUy6rQPalTYnf1BEOsekT/OmYt7K7rQiZ2Rmpfy+Ce 9xER1LjMKcf/XGfXi/NxhfvKmqK0H2Hdokuw/HFP7BD2kR2//IggfUU17385HHKQAJnjV4uYPOj 7nM+KJir5ubzYc0o+XQfoPG24y+tnnr X-Received: by 2002:a17:907:72d5:b0:c16:16b9:98fa with SMTP id a640c23a62f3a-c2039afa743mr957100566b.5.1786095796229; Fri, 07 Aug 2026 02:43:16 -0700 (PDT) Received: from google.com (135.91.155.104.bc.googleusercontent.com. [104.155.91.135]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c2080a6e657sm33479666b.14.2026.08.07.02.43.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2026 02:43:15 -0700 (PDT) Date: Fri, 7 Aug 2026 10:43:12 +0100 From: Vincent Donnefort To: Masami Hiramatsu Cc: rostedt@goodmis.org, linux-trace-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com, kernel-team@android.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/6] ring-buffer: Prevent resizing of persistent ring buffer Message-ID: References: <20260806211306.3704194-1-vdonnefort@google.com> <20260806211306.3704194-2-vdonnefort@google.com> <20260807111808.d5dc1a48b080d241100f4a57@kernel.org> 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-Disposition: inline In-Reply-To: On Fri, Aug 07, 2026 at 09:14:26AM +0100, Vincent Donnefort wrote: > On Fri, Aug 07, 2026 at 11:18:08AM +0900, Masami Hiramatsu wrote: > > On Thu, 6 Aug 2026 22:13:01 +0100 > > Vincent Donnefort wrote: > > > > > Dynamically resizing a persistent ring buffer is not possible. Disable > > > the feature. > > > > Is it true? Of course there is meaningless to resize the persistent > > ring buffer (because it makes the buffer none-persistent), we are currently > > allows user to resize it (like for resizing unused persistent ring buffer) > > __rb_allocate_pages() in ring_buffer_resize() would call for a persistent buffer > rb_range_buffer(), which IIUC, is just reusing the same ring buffer pages as the > one already in the persistent buffer. I have just tried and if reducing the size works, increasing fails in both rb_set_head_page() and rb_insert_pages() with a warning, which I believe is expected. We could improve that, but it feels like it is a lot of work for a meaningless feature which we should just disable? -- Vincent > > So, reducing the size would surely work, however increasing it, would most > likely mean having buffer_page pointing to the same buffer_data_page? > > Also, the comment > > /* > * Range mapped buffers have the same restrictions as memory > * mapped ones do. > */ > > Made me think that resize_disabled was omitted. > > > > > Thank you, > > > > > > > > Fixes: be68d63a139b ("ring-buffer: Add ring_buffer_alloc_range()") > > > Signed-off-by: Vincent Donnefort > > > > > > diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c > > > index 8e2485bb3aa8..afe75ad2bbf2 100644 > > > --- a/kernel/trace/ring_buffer.c > > > +++ b/kernel/trace/ring_buffer.c > > > @@ -2528,6 +2528,8 @@ rb_allocate_cpu_buffer(struct trace_buffer *buffer, long nr_pages, int cpu) > > > if (cpu_buffer->ring_meta->head_buffer) > > > rb_meta_buffer_update(cpu_buffer, bpage); > > > bpage->range = 1; > > > + > > > + atomic_inc(&cpu_buffer->resize_disabled); > > > } else if (buffer->remote) { > > > struct ring_buffer_desc *desc = ring_buffer_desc(buffer->remote->desc, cpu); > > > > > > -- > > > 2.55.0.654.g21b8a5bc05-goog > > > > > > > > > -- > > Masami Hiramatsu (Google) > > -- > Vincent