From patchwork Mon Oct 24 11:29:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9824 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp555154wru; Mon, 24 Oct 2022 09:59:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6UTcuqT19ct1xWMIXUqYhNmPlDQEYx5Vwze4ONOHvKXEmTbMGqCpAwE2chcnGfiY+oYD/w X-Received: by 2002:a05:6a00:1596:b0:563:9a1a:b5b0 with SMTP id u22-20020a056a00159600b005639a1ab5b0mr33551070pfk.38.1666630749569; Mon, 24 Oct 2022 09:59:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630749; cv=none; d=google.com; s=arc-20160816; b=ilDIfIKhzYBJCyJMGqatvqTFnAu0wx5742aty7HOMh3ZRO6vPjuIpKBbaBWHIM6iTy TQRqAJLGuYB+acfj/eufVYFIlTpcXRe5LJAj9su4SUucUEKgKhGVhc3nA059Z2g2/9bR QPsCrQYf2mYjAkCfyANCEx5RH2ORDKmG227pclmUN+bGP1WG7r1hASqZqqYSqk4/1BNc nBz8Dk/ND2HMIXBcsArg0wstLPuU02T7iu14qfCipxbPCNcqltsKxTSTbKaxa/GsRDbr tkYUQq7qf55/TdLjoI77ypRK7w4Xkpni/CFVxQmifiNpbcVzLO3uHUFWySjZuH4jrs1i oqnw== 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=dAyvHZn5UFfHfZK5Rl35YLAQbqD1BjUFH9FboZC6bHU=; b=uI1C2TIgljOkpqn1Xl2HFAa8bjHO4itIvwWVoDJueJZDcV/n4jXpL09QMGNKeAj/go vTBD/5WrH4MhnOXoEZljA8mgMhitMaEowp3xltwiucI2+ZKOrJLGf69xHDPhIDTH/bW/ Q7cvxC6XFF9O7GjvUqriLHn/vfpxVVTgTJu5qjQTfcX3xxjbJx470aRr1KQYfSxVlusZ qstSk5c1k/OTok7XalPH9D7mMI9iR5sigOgUqEABTdoMkxXwgjju505ksTSHmpnte4do MHeJRqIFhXs+/3goNO55OpBMMv7KUg6YNVqQp/1vo68bolzNkzDfCxVni8Kooj/nIonC Vg9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MUaLmpxi; 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 r23-20020a17090a941700b0020a7e0138d2si393372pjo.50.2022.10.24.09.58.52; Mon, 24 Oct 2022 09:59:09 -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=MUaLmpxi; 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 S235721AbiJXQyz (ORCPT + 99 others); Mon, 24 Oct 2022 12:54:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235524AbiJXQts (ORCPT ); Mon, 24 Oct 2022 12:49: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 F15653AE69; Mon, 24 Oct 2022 08:33:02 -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 0FC32B811F5; Mon, 24 Oct 2022 12:06:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64103C433C1; Mon, 24 Oct 2022 12:06:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613208; bh=ZIGrfetGEIU8wKnKF3wqlhW5iLqaHlFdnmonhwY5LqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MUaLmpxiD2AOX+rVPBcNtbNlqxF9M1HSfIapABY0ER0nc43nrzN6Egl4WnnHo0ra7 EYQipx7yCXeaLOxjVfUXp/rLU+L3Bxu2WKrZK+etnwUfXc73Ogwohc4ttSJLOHfnh0 ibG6zWT8dm4SVMaEzZ5Q60RBKzszv20m6ayKLTCg= 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.4 049/255] ring-buffer: Check pending waiters when doing wake ups as well Date: Mon, 24 Oct 2022 13:29:19 +0200 Message-Id: <20221024113004.064636694@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747589004827316259?= X-GMAIL-MSGID: =?utf-8?q?1747589004827316259?= 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 @@ -568,8 +568,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); } }