From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (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 CA517346FB3 for ; Fri, 7 Aug 2026 10:25:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786098331; cv=none; b=Bx0Nqg26M/4L/bSb/VBdXRWyEWj4cYFEItPt7kKP9c31Ny7Lx20joUo4QS8PupwdPekcD5ST6p4g3L/OW7NELMzBS9jZG98yX20XxChq55COI6/rRwroXng+wSB6OQf3g+6c300xWXeDq0nBPyUJKyI2iLdXZOuRlP5ks78OlG8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786098331; c=relaxed/simple; bh=inJLRty6ZgsoYYoNuJdPiOm8I47Wdr7rvozamiHV1Ho=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OEjIGSlD6wXKFLE0STuPqN/EO5jqfTzH0yrsWeh3itIgHGxXMmSfry6ASUDsAmnnwaDxU2zbqa2HtQC7mufoV+kMVd3+tTPKF3TviToPM6hqCiVfFlfLmkR9MiiKTRdaPw68QdzKsHUyLXGCxtySMpGkwyilTpjSA3iZeG6HX10= 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=bzj2CFnP; arc=none smtp.client-ip=209.85.218.54 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="bzj2CFnP" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-c15cb6f5c12so523731866b.0 for ; Fri, 07 Aug 2026 03:25:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1786098328; x=1786703128; 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=3IYy5szNuRGeMh5DMQZtziXg8pTrFr3dhRgA8Iqm8oo=; b=bzj2CFnPC4colberxvN1NrGsT1dfSl2rgXumAQ3hGq4WkM83pJhR28VQfiGbwRjGjK E07knWfyAMxnKHdK7R0qEV9g2y/aNz3pKWivQPpOpC/CH9+Z7sP+MPqhzVHBHGpa811A G0UKTMCJ5rbz1JQfjLbT8tZgt7Y5JLsJD9tLtb6lVYa8jK7QFUyhgTedNopVR/kGq3V6 MGKjAqaJcKzxpGobXOnBdvF5NuslK/1CMGu53MxRrx+c7HllhhCAN58MWLGMG2XAp4vz z3ikxyfKT+spLmTfAahvu38iiUntw1ci9vm2yV+ALenHPOkn21OlMqBDOSWpJAbLyprP 3MoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786098328; x=1786703128; 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=3IYy5szNuRGeMh5DMQZtziXg8pTrFr3dhRgA8Iqm8oo=; b=JfFr46iBQqURu6Y7ybciMgthbMeEjtu/O6kADrUsu1tFazvkRvQfM2fBpTD05pmE4T uI1AAeY83Fy/dsZnEBNooJh+8FxNGJ2vPFyQnf0fGwh2u+GCAnbPIKOY00g+MsKfxhrj d8B8BjxTiNT0nvgFwVm50qAig8XjdiRvcKq/36rbG9nlTTTnYOr6iKOBTJ4VgbhAbT8/ mclXQOSoPQfRtFoD0N4oY8RcmUhvFBHh0e8ZgolwgTc1MeOdg9Wofwvw6MuV2Ra2rYxt kHqTMJDgfRfHNaRNOoJ726PsLYByvtPtRemkgGdoA2gKPxrC87xpXQ35Ve0+/efNHoAZ vh4w== X-Forwarded-Encrypted: i=1; AHgh+RpKbGamzDwDKc2CkKhbqww/JqTTjr3pJ5bR0+3SEeyyIuyyn8hW3LYkuUgkuy738Q16eeKNP0qLKG3NuwM=@vger.kernel.org X-Gm-Message-State: AOJu0Yw9RhrfhQ5miA4YTofqXoVQIh0iMhKm6UHE4gFRNr3hPb6C8MpK 4G1uS2qy7OSf+JelQkvpyJgRvupxX9UQttXflgFgF6Awqg7ZZZqkuCCEz+oWlcU1uw== X-Gm-Gg: AR+sD12vE/2RnFec9Bb6gGJrOwfmtupO4Byc4jrz/on5MAMqhwvxo9iQhchdIfRKrOj 92lfh2QvSrSoNPPSWmVuI5KB6EvqI1w0eAw1N0W+O+LTZNk8thvE39LwRcot+OK8aWLOeLf2XPE kgekbSkNo1rMrq6t2e7Hc0JiqplRx/8ZOIZ+CMNNeB1p09QlhR1yDEKiL8mjezPFeGzbR2eq2lq 5f32gtf7ZzUwDc+wfiqoOgDt6NID3D82o56Evc60YChugqws4GAYNkE6x71YB/U4dRl06OC1Ndr mcMPjcmQPrd1T4nYcSAt99YhZFjEIdmHkoYy47XIlgSrvLHV+VICsAOmoysR3f+k45TfWrdavmW 09E8R5wE8ypSnQZiLNHawDLFsXK/vTuuupQFrSO5zKOauyRt81KxWYE5UWMIrdP7C7ejMUY3Q9s shCwtWnxBj/GBHbmvjUwOffZQ5q4V+W/qTOXJC+01Lddn4C76VvNy1jHMNeicJFxzHHs7zUKKC9 BLhQWgW/CXpFM7x8pGkByLZ7DmsfzbM X-Received: by 2002:a17:907:9301:b0:bec:64d4:3872 with SMTP id a640c23a62f3a-c2039ec8d14mr939317766b.24.1786098327209; Fri, 07 Aug 2026 03:25:27 -0700 (PDT) Received: from google.com (135.91.155.104.bc.googleusercontent.com. [104.155.91.135]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6a1e7d48ce7sm423129a12.16.2026.08.07.03.25.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2026 03:25:26 -0700 (PDT) Date: Fri, 7 Aug 2026 11:25:23 +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 10:43:12AM +0100, Vincent Donnefort wrote: > 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. With more logs, during a resize form 8 to 16K: cpu_buffer->new_pages contains: [ 632.919017] ring_buffer_resize: CPU 0 NEW page 00000000768ccc81 [ 632.919828] ring_buffer_resize: CPU 0 NEW page 00000000ee48729c while cpu_buffer->pages contains: [ 632.921511] ring_buffer_resize: CPU 0 OLD page 000000002c4c6f92 [ 632.921917] ring_buffer_resize: CPU 0 OLD page 00000000dadcb510 [ 632.922295] ring_buffer_resize: CPU 0 OLD page 00000000768ccc81 [ 632.923226] ring_buffer_resize: CPU 0 OLD reader page 000000003b4dd5ba So two buffer_page point to 00000000768ccc81. -- Vincent > > 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 >