From patchwork Sat Oct 22 07:20:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7249 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091477wrr; Sat, 22 Oct 2022 00:50:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kSNktiwX2KvCIFDksr6P8Bz09WWv+i15fFJVHZJDP7Fmg4QTNxF9jQMXA17G5u7xixvOf X-Received: by 2002:a17:90b:3b50:b0:20d:93f3:9c8d with SMTP id ot16-20020a17090b3b5000b0020d93f39c8dmr60497821pjb.150.1666425045871; Sat, 22 Oct 2022 00:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425045; cv=none; d=google.com; s=arc-20160816; b=LWDXuWmEnYjKznO/vxGou0R5o4Qh6woFYfykFNwEsMZXFlQil1yBycN6vQbmNpJlNl XGRtdF6XHMERxdZaNMRNuYO8GwK5MzPUyge1bDgYqcM9Or52rLRn6VCpFyOARaoZd3ao pEKUC5tSKDl3mt/WQPsPwYjtO6AMAUgnvp9qw+Og0FzZ+4DIeaEkAW+RA9nics8/bfvN 0oFElSPTWeAj/Z/crJbX9mPRxZFSQuRfgMsAnGEWABlRfUSVyVI7rBzOZy8SZ7O4R0Nm nCTSvsnbTlGnrELuapzWcmeX4Ltidfm7x28F5V9QDGFQM0rJY4Euu9gufUv6SqazwxgG KbNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6Sm4xBGn13BnTHb/GXr5N9tQIwthy5VIZ/YGbjFkvSQ=; b=ChgzniLiTMyQtUwsQasKFH/UEfMdrANxMVLBLB1KzBIkP4eIyJyceegpdL67I2hOkl SR3TjvC8MM4mU6JCAzgXC96xXWLfoWyio3dNE5xEDODe+9MUTVLZJaldgF/aLGkbJuVF dk1Bi+4/s/h2h04+yT936lDCX+7FGzX822RzjvvcAPbJp2tFA33X/g0b5yUFFLi72zt7 H5szqft+k2W4h0jm8VnrTfD3OliImmDzB23NdLaTTBF4JPQSE+UGx8944nYhU8eLyyyI 6Law/87KD5eVbz6IVYIEEMzjE3yu0ybfCRdjH0o6z95a9jF/oa8cjPAxCgHbDjXk/tAB xFPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QxYycTCX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q24-20020a635c18000000b0045a8b142a48si26498347pgb.657.2022.10.22.00.50.31; Sat, 22 Oct 2022 00:50:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QxYycTCX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231607AbiJVHt6 (ORCPT + 99 others); Sat, 22 Oct 2022 03:49:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231319AbiJVHsm (ORCPT ); Sat, 22 Oct 2022 03:48:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4695A161FEB; Sat, 22 Oct 2022 00:45:23 -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 90EBB60B76; Sat, 22 Oct 2022 07:40:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A239FC433C1; Sat, 22 Oct 2022 07:40:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424440; bh=Sv+gMvx7ElIgs69dRSsTjaWSf4VxBR1l6ktaoWCiT5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QxYycTCXIYkIBCbYe1BRB6exMMXC9qx8j4776W+r3U87pDqYKjvQ3AqUo8Y/Dguc1 a8OqBtYutShmnxMfPdeIOUI0PaHAI9eLxUs8CHQxeC46a/0441h93ZTB9fyoFsDBWZ CO2AH5EcI4Fv8ten2KFvtqZC9U3m/kzc9E0MsjR8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Steven Rostedt (Google)" Subject: [PATCH 5.19 147/717] tracing: Wake up waiters when tracing is disabled Date: Sat, 22 Oct 2022 09:20:26 +0200 Message-Id: <20221022072441.504416845@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747373308559221138?= X-GMAIL-MSGID: =?utf-8?q?1747373308559221138?= 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; + /* 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 != 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); }