From patchwork Mon Oct 24 11:30:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8457 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402572wru; Mon, 24 Oct 2022 04:50:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74WO1QuYABSxBo0d5PaC7t7xWVh0k7S35v/bYTNfkS/ZBXEbzhMeSqQC8wYEFH9h3E61L3 X-Received: by 2002:a63:c112:0:b0:443:94a1:f09 with SMTP id w18-20020a63c112000000b0044394a10f09mr28211119pgf.396.1666612218715; Mon, 24 Oct 2022 04:50:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612218; cv=none; d=google.com; s=arc-20160816; b=iPQ3W5WvY9AhNzpuhVYBdSk4ZSH35yoCUtYNdo8Ipq6Dnudl2XqVELMJoR+ihLN82r FZeHAXnHY90fpVilwKyUUmuUciKVVJPpSCMHTFG/ChkAKAczlCN/vcbEg9eqlo4u7fph wXh5O4F1jAsS/xrzyMXBQkw252dTPsEdDflezESXTgyVwbovcQVKQsR8RY6jGZrR3MBG tnui1ExJwHgVR5z+fwxHPf/rnCtkUF46HCVLrF/YkVuSeYhkK0cCluiyoZSrkfaHp7O1 pJcl32cZI9Z97+cv2vqDql42kqVczp9p1rmr7TwerS48B41+RHwtrZIDQT2FFAv0WwM9 eoNg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j15-20020aa78dcf000000b005631dab9f69si32065693pfr.301.2022.10.24.04.50.05; Mon, 24 Oct 2022 04:50:18 -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 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?1747569573803560136?= X-GMAIL-MSGID: =?utf-8?q?1747569573803560136?= 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); } }