From nobody Fri Oct 17 10:31:36 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA8C3C4332F for ; Wed, 19 Oct 2022 08:58:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231898AbiJSI6m (ORCPT ); Wed, 19 Oct 2022 04:58:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231860AbiJSI5e (ORCPT ); Wed, 19 Oct 2022 04:57:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A3B89DDBB; Wed, 19 Oct 2022 01:53:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 665BB617F0; Wed, 19 Oct 2022 08:45:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78F33C433D6; Wed, 19 Oct 2022 08:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169103; bh=Sv+gMvx7ElIgs69dRSsTjaWSf4VxBR1l6ktaoWCiT5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nKDk0BrCb4NwtowzCxG9XnpsYw8lXUXoWBa6Rbsp2gHRTGJ1PUNVXC2DhGsaoB1ju pjZGsjqonEI7wU26IDsXbdiNn9nM9xlcgpqBE6a70+VCv7jt4GMiXMAbhptFy3o1QO 4p9I182vXe12NJ5F5W/pKAOHPJ1m7xyC/HaEBu3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Steven Rostedt (Google)" Subject: [PATCH 6.0 160/862] tracing: Wake up waiters when tracing is disabled Date: Wed, 19 Oct 2022 10:24:07 +0200 Message-Id: <20221019083257.041014477@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) commit 2b0fd9a59b7990c161fa1cb7b79edb22847c87c2 upstream. When tracing is disabled, there's no reason that waiters should stay waiting, wake them up, otherwise tasks get stuck when they should be flushing the buffers. Cc: stable@vger.kernel.org Fixes: e30f53aad2202 ("tracing: Do not busy wait in buffer splice") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -8334,6 +8334,10 @@ tracing_buffers_splice_read(struct file if (ret) goto out; =20 + /* No need to wait after waking up when tracing is off */ + if (!tracer_tracing_is_on(iter->tr)) + goto out; + /* Make sure we see the new wait_index */ smp_rmb(); if (wait_index !=3D iter->wait_index) @@ -9043,6 +9047,8 @@ rb_simple_write(struct file *filp, const tracer_tracing_off(tr); if (tr->current_trace->stop) tr->current_trace->stop(tr); + /* Wake up any waiters */ + ring_buffer_wake_waiters(buffer, RING_BUFFER_ALL_CPUS); } mutex_unlock(&trace_types_lock); }