From patchwork Mon Oct 24 11:29:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8774 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430577wru; Mon, 24 Oct 2022 05:41:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7v4k5LhRDpfTDAxb6ir6smvvmkLgsJnhT4Wfxvnpa9n5Zq/UXjAK5z78Dko6UdSeMNkk6s X-Received: by 2002:a17:907:a073:b0:78d:51c4:5b8c with SMTP id ia19-20020a170907a07300b0078d51c45b8cmr26766063ejc.355.1666615314512; Mon, 24 Oct 2022 05:41:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615314; cv=none; d=google.com; s=arc-20160816; b=wMl7SLwzp3+XNRLWTevLWuEHevXOKn7x+0cPQ2KHGBVPg2V2coqUOkSkwr6XufX4Wd Plvp0Zw9NVC0bi3gMCGH+uspWL51dbha5PUmAJccnJmYPXrWAzQ4zB6x0eKrpHNyB04k a+sbGp3jYccCOJ3wyQmrmmcGsxlo0gdxW2g327IRZcD2OzW5RxD4/Ug5kzjJyKReiY4F dwsfYpnc/leNQj5wt6wDvaCDpNeSxc2oi5uP3KMnpDJtLa6thZfsZ/FgsTiTafCv1D8L MFJ46hbpj3192GYxZZ6dVNHhc51lGZScvGsGiXsB5rvf8R5Ay6hM06D3Ims1vGCSE5Nw czOg== 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=NT3irz/8I7dofF0nS4BlmgOWusc/AZmdR70fYfGaofo=; b=SXUz/2nH+Bh7Tgx+B+DI0b7W8XIfDlG/D6+MI8BfgdixQXe6gMa9SdJzf1dfNpCBuj IYshOmeBjNrvV1EGpZn2GfV4Yhkj35gbahAMUVD6tinQYKVqwi7C7GRMXluLqBaFv0bG ezWm82X+ko8u50jsnkSRkG+vZxlyoCTwu+VvZwfNqRkmgIQqaFW6vd/8ANhr4uG+3sCG 7YT02o9OAFCFnx5iNF6H+i4+K87Yzj6zsxbDfrrUAT7y33b9R4Y+MkaFogm/KXoYuLSQ Yx1OJyTdn9aA22OE3TWqRRhTRRv9BgzMKy3eqVnGL7mUD4F4Ci/sUaa3aiZpbxgidw01 +tQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jRYTy8li; 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 t8-20020a056402524800b00461f0d84ee1si674544edd.228.2022.10.24.05.41.24; Mon, 24 Oct 2022 05:41:54 -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=jRYTy8li; 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 S233690AbiJXM2t (ORCPT + 99 others); Mon, 24 Oct 2022 08:28:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233711AbiJXM1s (ORCPT ); Mon, 24 Oct 2022 08:27:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F45B844C1; Mon, 24 Oct 2022 05:01:41 -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 8EA24B8117E; Mon, 24 Oct 2022 11:57:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED70CC433D6; Mon, 24 Oct 2022 11:57:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612643; bh=+a+45iTcgmJaN1eXRX6U24G2mAi3/f9sIfWs6mR2zE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jRYTy8liFQ9MfygCRJUEvvR0yr6DRx7413ygGV60SLXXJiD8evsSlxR61K5SALCvY zEHNCrp/2e16iua5BK3Tk3GVcVFG8FUtlkCHkW/9eYGgGcOGw55Bza1agx6MkQ3U1x He3aD0TVx5R+L4Uv3NsLjwYdbyRY0Y25nkcCoyuE= 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 4.19 065/229] ring-buffer: Check pending waiters when doing wake ups as well Date: Mon, 24 Oct 2022 13:29:44 +0200 Message-Id: <20221024113001.192948457@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747572820237578032?= X-GMAIL-MSGID: =?utf-8?q?1747572820237578032?= 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 @@ -542,8 +542,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); } }