Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6740059rwi; Mon, 24 Oct 2022 05:38:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53UTqsVw4gokN+lQ4bA3yKdkyN0cj+m+lSNenBs7PY5CHxZx1QZoBMZPZpU36ABX68mQCV X-Received: by 2002:a65:6055:0:b0:42a:7b2b:dc71 with SMTP id a21-20020a656055000000b0042a7b2bdc71mr27902948pgp.23.1666615110195; Mon, 24 Oct 2022 05:38:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615110; cv=none; d=google.com; s=arc-20160816; b=F3zj8Qzb3hYSkOYmQTdsBM0JXx3EQp8um2uoSt+xc0CtSR116J93Szvc1sZEzykaZd DY9JgmrdfgxaaL5V2yhrPViaJI6c1pfD/BAWhAq//E4PZkaMB2HGa8HGrVFV24wu2qYn ZZ2UxOoauTuxxEqDr4dZJDx0UIm6wBsTXU5RcQ5YUycLuanPNU+T8JUtv0k7O2VtJ+1G lDZmU0k15nEHtXJmwjy3LaUyqLeue6TILv41kZsHUS9uKIhsZUh5emju36ocat93tT2w DGah7F1volvzTF1xW80XJgQBcV4Z3smmxse+je1MdUPNP2z8j4uoovT8vXfbVy2oFw6C g6rw== 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=3p0yf4xZ6/0vrxO/YXfvQsxxTaD4UUwpIbWxQFeoqfg=; b=lg5t3CXObREt1zSkpBoEkqql6kjMVFv2o8BkBjVmEOw5pqUl4Aj6mEfkeDpfepN6z8 VOzPzgOlyKuCXVNfMNVts19bwuMA9Mcr3G6QjO58UwBdQINRfWPNyDPxg+s9WKR+nusg 9upF6uU6YH3lVhR3AFq5sZXDoDBe/lCQIHyN43mqmmEXBs/EXXk/cv4WG11xjvVxBY+D hWLbaRrrPAS4S31rvDvNfaWYQyKReOslqJK7xcTyRxsYyQtPV7FfwPXt9nZsTC4SmPTN R3RWZdAoM3VAVS/8lE80lQJkjgOcxnzZ16SdZBnyMlYqbf6uvkdWXWHVCo+bz/Z3Z3nn Q6+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="zm/oux05"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k3-20020a170902ba8300b00176e4ac448esi14843030pls.224.2022.10.24.05.38.18; Mon, 24 Oct 2022 05:38:30 -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="zm/oux05"; 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 S231649AbiJXLtt (ORCPT + 99 others); Mon, 24 Oct 2022 07:49:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231650AbiJXLr7 (ORCPT ); Mon, 24 Oct 2022 07:47:59 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10BDF1A22C; Mon, 24 Oct 2022 04:43: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 sin.source.kernel.org (Postfix) with ESMTPS id 24DB2CE1343; Mon, 24 Oct 2022 11:40:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11739C433C1; Mon, 24 Oct 2022 11:40:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611652; bh=1IOQmUI6946jvhWqijchMtnbXd4TLovY9etrS+Rty8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zm/oux05W9eArkEkk9V83dEQC89t6QT5L8d3pnkmrmFigWHNSIwC28tQooinGFFxv Gju+fVOcFnpBDFByXUjxlNYmCjSIJBMUaIZ9oSa0CFhFyI+8Hkp4tar+v631tkCwV7 QkuALV/mcirL4XiXOaTztqTCjKzsGHu237cAMx4s= 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.9 060/159] ring-buffer: Check pending waiters when doing wake ups as well Date: Mon, 24 Oct 2022 13:30:14 +0200 Message-Id: <20221024112951.631538334@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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 @@ -513,8 +513,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); } }