From patchwork Sat Oct 22 07:20:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7426 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097828wrr; Sat, 22 Oct 2022 01:08:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6pUG9PgsoZoA7Qhq0AZrY5pNe+Ma5cCMTHnPpU0ByBtiW8lu2YQvNnT4FQ8suqYUgACEvw X-Received: by 2002:a17:90a:1197:b0:212:cfa7:8388 with SMTP id e23-20020a17090a119700b00212cfa78388mr8009648pja.4.1666426130875; Sat, 22 Oct 2022 01:08:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426130; cv=none; d=google.com; s=arc-20160816; b=Eq3Wz4CdcFpul88mGlndk8PBoNH3hEb5M9g3HHMSCRbFAZS9vcLSaN+E0fYFUWgwYt bmE2lynSRaQUv7C42jthmDg71V6Ubkm9wlal4cAS0OYpbH6ygQXPJku2vln9StyC1dW0 ovSgb2rj8xKauhtKflOwD0LbU3KEsO05abUJl168s3ZIaoulLMHiU5NI4cdZV7B3rrB1 CsIqKO3WaIDxAe9jdyUbuPnoq4X9U06z4ACNT0OmgvJsRwq4n3lIJGF9A1Ts+BsCYspB 5dPhurz5UKchRfUw+XInh13jvzgrzESXXJQtJzI0q0QW0h0qmE4VrulJ5T+qe9eunfjZ ejEg== 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=tg3zZCik7o/KSYcmfzFiaDMuKBEp8A7+YAOkoZleivE=; b=FpIugCPimaQyH+dpRm9CRLcZFd1UCczkCWQXsCehVS70Z1J+yusY5sQu/jA62+KXUS dZgN2/EC/79SZ4Aia930VAk0Oy4UR1X8lnYDT//jZAp6gbzhuiAuCiE+dPNrWVxRLqQy Fzq5OVOwkOOg7Hlu2eE9AhvgKQ+ebdGpXR4OcQF3p0hQ+hwQGd71AZhcG6YQq1wwCdj8 v3THNmBSG4oeksi5Ck4sE5qhFNP0i5UUoM30kzHY+qoprA36fEWkWYYDbOqRKMGLqPiP ouDL30hCgCRdN/4FPfhkm5g+npVm/eT3Jvy278t3eRcbyJ5BzSmujFkuwLP3ILWGJYI+ YoLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eP3soSCH; 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 18-20020a630d52000000b0046af0960898si25686514pgn.625.2022.10.22.01.08.37; Sat, 22 Oct 2022 01:08:50 -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=eP3soSCH; 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 S233057AbiJVIIT (ORCPT + 99 others); Sat, 22 Oct 2022 04:08:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232954AbiJVIEb (ORCPT ); Sat, 22 Oct 2022 04:04:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 691722D37D9; Sat, 22 Oct 2022 00:51:54 -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 ams.source.kernel.org (Postfix) with ESMTPS id C84AEB82DFD; Sat, 22 Oct 2022 07:40:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46305C433D6; Sat, 22 Oct 2022 07:40:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424426; bh=lqz+c27qLgPZikG/yh+pME2iMkbgYwjlbdPKAFUv/fY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eP3soSCHr8WlSh7UPDnmzk+cndNC5RtMnTGcvwEuigMBcaQK31q0DCRpaW0rZtEJu q7hxrdjSunC//zQXpZjk16DcPYoyFIhXRZuGlGKrVn2CdXowktEtoy2/FQxx9h2gM0 X9IuI4z73fv9I4/aMH0yPGijH4oFeu/RhTYsmwE0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Andrew Morton , "Steven Rostedt (Google)" Subject: [PATCH 5.19 142/717] ring-buffer: Check pending waiters when doing wake ups as well Date: Sat, 22 Oct 2022 09:20:21 +0200 Message-Id: <20221022072440.676346757@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?1747374446200473461?= X-GMAIL-MSGID: =?utf-8?q?1747374446200473461?= From: Steven Rostedt (Google) commit ec0bbc5ec5664dcee344f79373852117dc672c86 upstream. The wake up waiters only checks the "wakeup_full" variable and not the "full_waiters_pending". The full_waiters_pending is set when a waiter is added to the wait queue. The wakeup_full is only set when an event is triggered, and it clears the full_waiters_pending to avoid multiple calls to irq_work_queue(). The irq_work callback really needs to check both wakeup_full as well as full_waiters_pending such that this code can be used to wake up waiters when a file is closed that represents the ring buffer and the waiters need to be woken up. Link: https://lkml.kernel.org/r/20220927231824.209460321@goodmis.org Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Fixes: 15693458c4bc0 ("tracing/ring-buffer: Move poll wake ups into ring buffer code") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ring_buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -917,8 +917,9 @@ static void rb_wake_up_waiters(struct ir struct rb_irq_work *rbwork = container_of(work, struct rb_irq_work, work); wake_up_all(&rbwork->waiters); - if (rbwork->wakeup_full) { + if (rbwork->full_waiters_pending || rbwork->wakeup_full) { rbwork->wakeup_full = false; + rbwork->full_waiters_pending = false; wake_up_all(&rbwork->full_waiters); } }