Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (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 313E4432306 for ; Mon, 17 Aug 2026 13:47:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.69 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786974478; cv=none; b=nw9PXdpIwqjBguVNJkEFKkxD4BUeq4egqeDW2ao3lR4hKvGhiQaNV6yt0SkNhxj9kjyLozKX8lj+o/Q8y/9++e5jkpGeXF9IP0g3hQ5IAZhpwsJhFXkp8ENFvuxtZBa6obWqme1SSqir3s3CLDRDc1v4+3UF+2JdMSj/fEy3c8k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786974478; c=relaxed/simple; bh=wLdvS8J+Y9CyUr3LRopLNeShbFf/fncIFik0YUXJa9k=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=WUHhMnmBz5n4VrqgcZbN+qcaGOEnIPvgyaJVizi8bWaHDpsMk+eRSvBq8ccMcDaTXYQpLdo0mrwLpJg2EecGYTiYtVtZ/XgQ1RczyGdEqAAoJup9LkCTVVQduL1ruv1gYcMDXCw1guWufxmk/Kofta4+jqEbKo8gOMSlRZl87s0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--vdonnefort.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=PB4K3ku+; arc=none smtp.client-ip=209.85.128.69 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=flex--vdonnefort.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="PB4K3ku+" Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4957287363bso20612085e9.0 for ; Mon, 17 Aug 2026 06:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1786974472; x=1787579272; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=mW/FeJu1Nbb01FNYhICdkqAU1UXHHos9+nMEqvEz9Ks=; b=PB4K3ku+yr77yqPe5QU6ituNEE4b68W/b80RW1/cro8PMeETNK2z8A2Lh/SDu+iPRE Yl6l4BTmqwRt+c6/kLYUWSgLif9Ao8h85hCj23qf1yHHj82ggs3JurZYQgTiUjN+AmRc l8tFDxf92N1U81tasqjm/59F1EjqbPoPAS78tkP3fWnkyD+OoEQ2hAHEJ+E01Zs9uSPD z54ZRargsOv6qt4dQj+ARkIDvVcnKJGoMZPxQZRnVzUzjEBuVzh5DYSx9j3gcLcbhyxT ErtOTO4xpfOSmTLS/9wfTuLNFOlAkYTKVbDexmN2JxAT/fkZqnSWf2UiPTBdafKRJoMQ ocPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786974472; x=1787579272; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=mW/FeJu1Nbb01FNYhICdkqAU1UXHHos9+nMEqvEz9Ks=; b=IhJQA2gOInEctqM5MubDQlh7BMGt5ap/QQHkEKYZYvLusTV5rG5+4JapP/mtRBjfUt XxuhfZcjSEt17y11HvXAl32qmd+TGBthY2CoBL6qoTmp/BM7o+0PJi0XBRpdj1TnQUWg QT6zWNN1htIskuaeaDjagLb6yMi/xhwPCwLsiUPu/hMHDBz78S75JYD6t1GmHaxoQYHq Hr4GMWss6hIZAC9ACOMc90SLC2Z6w25JCcNYWUWFWZbnMo0gTNK9BLDK2gVwVrwv1Ya0 PVLji1csT9ps1KnaYAVy7ghrXytPchvrNjH/AfftPJG2L+Arl7KX6isafU70ly7JqC/1 uOEg== X-Forwarded-Encrypted: i=1; AHgh+RrzsedV5SoNYGpXJtwx1yflSPkTmcxMJABC/lUnkUTAjnb/iMbergnhrfrFYBduz6Di4OZH78h1/kqTm0Q=@vger.kernel.org X-Gm-Message-State: AOJu0YxbuBTf9dLqLnBe9XXh5zxvANtyWbYmi1a7k1xDjJ4uxKDMKas8 yWafWFPU/kjoC1BO4q6awwLTi8xZU6veFXxPCgTfW4jkVJukLWRD9RRi/GqgQkwud+vlJkTM/Nl gJro7oLcYaJzAkKr6R10BRg== X-Received: from wrrq2.prod.google.com ([2002:adf:f942:0:b0:47f:50ce:a675]) (user=vdonnefort job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:5299:b0:493:aa0a:45ad with SMTP id 5b1f17b1804b1-4998d7aeb77mr308215735e9.2.1786974472409; Mon, 17 Aug 2026 06:47:52 -0700 (PDT) Date: Mon, 17 Aug 2026 14:47:47 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.55.0.691.gc56d675ccc-goog Message-ID: <20260817134750.3909384-1-vdonnefort@google.com> Subject: [PATCH v7 0/3] ring-buffer: Fixes for subbuf resizing and persistent buffers From: Vincent Donnefort To: rostedt@goodmis.org, mhiramat@kernel.org, linux-trace-kernel@vger.kernel.org Cc: mathieu.desnoyers@efficios.com, kernel-team@android.com, linux-kernel@vger.kernel.org, Vincent Donnefort Content-Type: text/plain; charset="UTF-8" This series addresses multiple issues discovered with the dynamic ring buffer resizing. Changelog: v7: - Match the "static" rb limit with bpage::id bitwidth - Cover another 32-bit truncation in rb_range_buffer (Sashiko) - Fix uninitialized spare_size (Sashiko) v6 (https://lore.kernel.org/all/20260814154823.755406-1-vdonnefort@google.com/): - New prototype for ring_buffer_alloc_read_page() (Steven) - ring_buffer_read_page() to return -EAGAIN (Steven) - Keep nr_pages "unsigned long" (Steven) - Repase on ring-buffer/next (Drop most of the patches) v5 (https://lore.kernel.org/all/20260813131152.3589632-1-vdonnefort@google.com/): - Reset info->spare_read only when data is in the ring-buffer (Sashiko) - Use `unsigned long` for subbuf_size declaration to avoid 32-bit truncation. (Sashiko) - Make cpu_buffer::free_page a buffer_read_data_page - Update kerneldoc for ring_buffer_alloc_read_page() v4 (https://lore.kernel.org/all/20260812153311.2328812-1-vdonnefort@google.com/): - Add rb_subbuf_start() helper (Steven) - kerneldoc additions - Fix races in trace_pipe_raw readers - Use rb_subbuf_capacity() in ring_buffer_subbuf_order_set() - use rb_page_capacity() in ring_buffer_map_get_reader (Sashiko) - Fix 32-bit overflow in ring_buffer_subbuf_order_set() (Sashiko) - Hold cpu_buffer::lock when modifying cpu_buffer->free_page in ring_buffer_subbuf_order_set (Sashiko) v3 (https://lore.kernel.org/all/20260810125633.3344684-1-vdonnefort@google.com/): - Drop first 3 patches (Rebased on 7.2-rc7) - Add a patch to align "nr_pages" to unsigned int - Add a patch to remove useless trace_buffer::cpus - Add unsigned long cast for rb_subbuf_size() - subbuf_order fix for rb_free_cpu_buffer() (Sashiko) - Use __always_inline just like the other accessors for the hot-path. v2 (https://lore.kernel.org/all/20260806211306.3704194-1-vdonnefort@google.com/): - Prevent resizing of the persistent ring buffer - Add missing bpage::order init - Rework subbuf_size/subbuf_order (Sashiko) - Remove ring_buffer_per_cpu::mapped - Dynamically calculate trace_buffer::max_data_size v1 (https://lore.kernel.org/all/20260805153225.2096152-1-vdonnefort@google.com/) Vincent Donnefort (3): tracing: Fix subbuf resize races with trace_pipe_raw readers ring-buffer: Cap static ring buffer nr_pages ring-buffer: Prevent truncation of nr_pages / nr_subbufs include/linux/ring_buffer.h | 5 +- kernel/trace/ring_buffer.c | 182 ++++++++++++++++++--------- kernel/trace/ring_buffer_benchmark.c | 6 +- kernel/trace/trace.c | 101 +++++++-------- kernel/trace/trace.h | 9 +- 5 files changed, 181 insertions(+), 122 deletions(-) base-commit: 8b502bf6eb3da15f4b954ad3632335ff10ed746a -- 2.55.0.691.gc56d675ccc-goog