From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 AD093268685; Tue, 8 Apr 2025 12:07:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744114070; cv=none; b=TYFJr2wFnOYk1YnOgIFewa/HSSYdS+Ox3Mjcxv4TSAvqtpXbiz14Z/iapYTDKf6NLCu5OvLE+Qm1i0L0GiIJeAWeJ1JlnFWZ9w+5o8WuRc3lSLgcSlCQJ1samGm+Kurm+XzkFHTI8lEU7MBMH0jcKWfSlUdP58x1EPMkWzkW34c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744114070; c=relaxed/simple; bh=GFoP006RhTXiF1z+AZnsfR0I9oe34Kbkr+YjxuhZA7k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r2Rtx9MdHrPfqrdAe0M3KsHkL8S3akf8I5WhnOJWaLC4h6GbRX8+roBRIzf+zhQwgIN5eL+uMlcH0N2qJKz20GKFuFqgf+Ii5NBpVfKGPtSQv/RPh2rSAZuUYh89RWTUVG+LnvCbp0hZdcp9cvobXXIFuaP+FC7UfklP5oDHOpI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=oGQRYt3F; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="oGQRYt3F" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C0FBC4CEE5; Tue, 8 Apr 2025 12:07:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744114070; bh=GFoP006RhTXiF1z+AZnsfR0I9oe34Kbkr+YjxuhZA7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oGQRYt3FbRTnSzH+8Nkjk2IPBw4IfDghxhPovJjDS8cpW6MphnU8KhZQX2we0A1tm 4fI2L010PExye8y2kiagnIZ6PdLd8yf0wY15BmYFxeoB01qSdyOV5MRp9iSs7YQRE3 Mb3mHKPMsIxrFXRdd7uvqsfUxS2T9b4rWKSZXzfA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Feng Yang , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.4 126/154] ring-buffer: Fix bytes_dropped calculation issue Date: Tue, 8 Apr 2025 12:51:07 +0200 Message-ID: <20250408104819.349426717@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250408104815.295196624@linuxfoundation.org> References: <20250408104815.295196624@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Feng Yang [ Upstream commit c73f0b69648501978e8b3e8fa7eef7f4197d0481 ] The calculation of bytes-dropped and bytes_dropped_nested is reversed. Although it does not affect the final calculation of total_dropped, it should still be modified. Link: https://lore.kernel.org/20250223070106.6781-1-yangfeng59949@163.com Fixes: 6c43e554a2a5 ("ring-buffer: Add ring buffer startup selftest") Signed-off-by: Feng Yang Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin --- kernel/trace/ring_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 2011219c11a91..b12838d4c3270 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -5195,9 +5195,9 @@ static __init int rb_write_something(struct rb_test_data *data, bool nested) /* Ignore dropped events before test starts. */ if (started) { if (nested) - data->bytes_dropped += len; - else data->bytes_dropped_nested += len; + else + data->bytes_dropped += len; } return len; } -- 2.39.5