From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) (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 D68A7352021 for ; Sat, 30 May 2026 22:53:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780181611; cv=none; b=VLz4X+p/fVkE3eBSZ2yukQo1E4VUCTtdWYIki9Ft2JctTqC4Hm//e4Tbr+TX8F/7ONB88NwrijyKG2eCqq0+sel6aKNDc3JTgdWmyBTj7w5hut+T25X+0asP29Mx0FHAcoBt4DNkEXLsVg4ahI1bp0sE8H+qQ6Chi0c66p2OwUI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780181611; c=relaxed/simple; bh=yH8f3jiU/+1PRiJP0JU7UX6ZvJaTePHOyZ7bH8Iek5k=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type; b=iHjKgcoad0RlnJYpAQgVZvZHEfPGmOGSckhT5h/sD6+NSmPZt5WvZniJHwLSVythb6VlpuqhPU2kDgJAzn5xxZsRA7cLwu0UzY+RJGsxQUYNCv5sya7xnSvTIAHLNkA8+17fGAmdAASEu74dH3cTR9VYmjb5IHnA4VNDhLzPsn0= 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.11 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 omf15.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay02.hostedemail.com (Postfix) with ESMTP id CB464120324; Sat, 30 May 2026 22:53:28 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: rostedt@goodmis.org) by omf15.hostedemail.com (Postfix) with ESMTPA id 5A70817; Sat, 30 May 2026 22:53:27 +0000 (UTC) Date: Sat, 30 May 2026 18:53:26 -0400 From: Steven Rostedt To: LKML Cc: Masami Hiramatsu , Mathieu Desnoyers Subject: [for-next][PATCH] ring-buffer: Updates for 7.2 Message-ID: <20260530185326.18c367de@fedora> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-redhat-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-Rspamd-Queue-Id: 5A70817 X-Stat-Signature: qpni3xkpdc7p8qoatu6dfddkgf5a5n6o X-Rspamd-Server: rspamout03 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Session-ID: U2FsdGVkX18MJaomet7sQwYJPfkelKSmP1q2VDa8Kl0= X-HE-Tag: 1780181607-404341 X-HE-Meta: U2FsdGVkX18XR1zF3nTBhz7RNO0hjYr+ILHEaX3bPhSgpM+dkLYSJL54ocqxeDF0fpYVfEsI7HqFmWwqDGlCRN3bZVwXYeqyBjEWLnjbF5PEFxW0yPCqo89VgU+ngg3jOK9FGTFR9l5eDe1/SMxI/oDyo+8nIVGVmS19bZVEnU6GGTFEku4cxmsP7Qy7ImH59FgSONB7ee0XYKtZlZfIIPKEUq1rBbXTraVpJ/wffv50YAG5TReQM/NSpespLkf9Yg2G8Tv7nHQfCDEJfOoBTgZGy4c6Jt5LMazwomNdGaZzjHp5ICNfbTLEGc0S55D7KBTk+kM94o4O+e22WTfHPp44quFUA2Ih1nkN3195QjFkDRdlxoj/qjTDL95OdyrYuNBstUg0qTCfpUPVkVR7oapxm297a+M6tl5YRrykfvYRxWVqKBAQaVa16AFNznZ2ShJ0xChslHbvCBDXFcmwvNlFEb3LgxMnRXR+okU81yw= git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git ring-buffer/for-next Head SHA1: a027c6d105ff8e8a72c532fac4e76409ccdc06ca Steven Rostedt (1): ring-buffer: Better comment the use of RB_MISSED_EVENTS ---- kernel/trace/ring_buffer.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) --------------------------- commit a027c6d105ff8e8a72c532fac4e76409ccdc06ca Author: Steven Rostedt Date: Thu May 28 22:37:38 2026 -0400 ring-buffer: Better comment the use of RB_MISSED_EVENTS If the persistent ring buffer is detected on boot up to have a corrupted sub-buffer, that sub-buffer is cleared to zero and its commit value has the RB_MISSED_EVENTS bit set. That bit is to allow the "trace", "trace_pipe" and "trace_pipe_raw" files know that events were dropped by outputting "[LOST EVENTS]". Only in this case does that bit get set in the writeable portion of the ring buffer. When events are dropped in the normal ring buffer, that information is stored in the cpu_buffer descriptor and the RB_MISSED_EVENTS is set in the buffer page at the time the page is consumed. It is never set in the writeable portion of the buffer. Add comments to describe this better as it can be confusing to know when the RB_MISSED_EVENTS are set in the commit portion of the buffer page. Link: https://lore.kernel.org/all/20260529001500.14178455a046a5cbc6180861@kernel.org/ Link: https://patch.msgid.link/20260528223738.41276c0e@fedora Signed-off-by: Steven Rostedt diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 910f6b3adf74..06fb365bb86e 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -1929,6 +1929,12 @@ static int __rb_validate_buffer(struct buffer_page *bpage, int cpu, */ if (ret < 0 || (prev_ts && prev_ts > ts) || (next_ts && ts > next_ts)) { local_set(&bpage->entries, 0); + /* + * Note, the RB_MISSED_EVENTS is only set inside the main write + * buffer by this verification logic. The normal ring buffer + * has this bit set when the page is read and passed to the + * consumers. + */ local_set(&dpage->commit, RB_MISSED_EVENTS); dpage->time_stamp = prev_ts ? prev_ts : next_ts; ret = -1; @@ -7232,6 +7238,14 @@ int ring_buffer_read_page(struct trace_buffer *buffer, local_add(RB_MISSED_STORED, &dpage->commit); size += sizeof(missed_events); } + /* + * Note, for the persistent ring buffer, the RB_MISSED_EVENTS + * may have been set in the main buffer via the verification code. + * But here, dpage is a copy of that page and has not yet had + * the RB_MISSED_EVENTS set. As for the normal buffers, + * the main write buffer does not set these bits and it needs + * to be set here. + */ local_add(RB_MISSED_EVENTS, &dpage->commit); }