From patchwork Wed Oct 19 08:24:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4644 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212294wrs; Wed, 19 Oct 2022 02:07:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5u9XnnMcEafpGLAz1w0Z+ZrzT1BNYw8s5xTNlQ/uUGqhi9xlwjv1QuKKZG1H6gYjGD4l3j X-Received: by 2002:a17:906:5dce:b0:78d:e71a:6e0 with SMTP id p14-20020a1709065dce00b0078de71a06e0mr5886095ejv.360.1666170430325; Wed, 19 Oct 2022 02:07:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170430; cv=none; d=google.com; s=arc-20160816; b=p6lSpmbhcBwMftPGx3BmBYPHlaTx2G4mtxbttaRieGZM/Rk1c+UFS3bc/QUaDnZrpb gnDPNQtGF3SmE7YJ9avbI1+OiKViIswmcllIhY8aZYjQ2tlNkig5wW4t3SFZPY91nd+U 6Ja/4wbiOrIy2Np4vp7L9LYx0J0l5I325acuglebtIukOPIoSfkBBojJhkig1H+zPFHd U9KFOr43/oT+iaDDUC4PDode01DnYrUenYdoiMIQuAvTed+PZBfSOI+AbqZlULnFicbD j5Xb0ri0gMJMR3rLdup0lmaQJX69nFLXr1kfI/ZDtKeyjSDIQnoh30TEOCvJvZ12fe6i icRw== 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=eQtfav5zAUyqElLHxic8DsvIL0qtbITPxpmo0bLI89xwCJhczy10dJkcsghJhk6hEu pdnV1foeXJigDuvFXljPGfJBkmEAe0mGMRX7+2NJRP4fAYcJaQZXUabBy7o4HswowApb g6fxajfCNBS/HnShXLmotvYkfZdvDAr9FGwZTcy4IYpueuB/GejeIVGjxWGzjFTbNLFO Hs0i/N1eK8CM6gii3uZHFNJjd9hLW2o/RHz/Qn9EKLDNYfC4Wcn0HRSvQ9lF+Kd9CpRI UMWSSZsBSZMkbkUBHzjwmwF/5x7gk3v+CvxnrKhBZ86acXlYn5oHfonnmAYTdLVRfB1j tw4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nKDk0BrC; 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 b19-20020a056402279300b0044e9ca6880bsi16532767ede.364.2022.10.19.02.06.35; Wed, 19 Oct 2022 02:07:10 -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=nKDk0BrC; 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 S232069AbiJSI6m (ORCPT + 99 others); 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 X-Spam-Status: No, score=-7.4 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?1747106325051830518?= X-GMAIL-MSGID: =?utf-8?q?1747106325051830518?= 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); }