From patchwork Mon Oct 24 11:29:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10053 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622900wru; Mon, 24 Oct 2022 12:46:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4njEXjtn0BJDjtcOljyKSrFKPGBOFLGVnnGMh18Y1GKfVQguPq/15KQDdU2fPOX43TFBxJ X-Received: by 2002:a05:6a00:1256:b0:563:ce4b:f525 with SMTP id u22-20020a056a00125600b00563ce4bf525mr35227163pfi.72.1666640813266; Mon, 24 Oct 2022 12:46:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640813; cv=none; d=google.com; s=arc-20160816; b=mOZcLvydW+y3M490PEdt7Airz93a3Enzb0arWJFTALt5WRp2CqCN2lV56kVibqZk1w xxV9mhxeftuhUbyNCiWYEVMTYqr+83WO4QOc0OKNDUZUBXc+uz7rkiZPRYXX+WhH8rVO dqeUYaijtp/flrA3MEdm1YjBiclpNI35fnmwS85axHizvR8nvgI9UJcwiT0qJNfoAZN7 yo8kHOwAqdcxPg/pXFzqAYJ0mGHONSKkGhhBOV1EnGoitRwivA82uifWCTjtnobXK4x2 rWN0mZoLmMp/FHvfxw6WqZbhOBuxS5EIK8bUkjfHR1g2GL2FdD5XWvfgOP3S0kN8sSAs bu9w== 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=kdeLuWxM1DQ8Yk1vQc4JlJu9CamVaoepax76ACY7zPE=; b=fu1BBW6DlFDtFyOPuHg5z/VfuynseON3FIPk7zjzLPGiEqkNGqqecY8LgrS9deeyDK 3dElpCWyCoHcEvZ+36O1GPKBWi9gR4+VsJAw3lqov/XgnZzORJl+BU0Dr8H5j9JvKXSc Jrjma9JGWrBhdiw9oG5RMTklmrHcJuhJsqWBV2MIQD0rTAM4asbnRdvd70vuxtXvzw1h c76qdiUNTbnT6EpgEvNTFAtWXr413W2CnJC5jsjqXul/p7ntxy5ASQBHNUAlxmoEvXIl qodWYeOBVlOrDTsYGob39bLm2O9gQIDYQ0T7ayreUrKMs8Wia37WmlO5Of8/RR5h4twW Mz6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jSNtaVm2; 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 81-20020a630354000000b0041c506dde92si415424pgd.636.2022.10.24.12.46.37; Mon, 24 Oct 2022 12:46:53 -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=jSNtaVm2; 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 S231573AbiJXTk4 (ORCPT + 99 others); Mon, 24 Oct 2022 15:40:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233381AbiJXTkP (ORCPT ); Mon, 24 Oct 2022 15:40:15 -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 220311D1021; Mon, 24 Oct 2022 11:10: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 9D9A7B811A9; Mon, 24 Oct 2022 11:48:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1381C433B5; Mon, 24 Oct 2022 11:48:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612112; bh=exJ6/ycf2cPgXPDrwu+frN0ZqvWYWR4ZkIMOmn0PI5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jSNtaVm28anVXL2mizqvNFQXQqSsnv0DyqFX5LsqulmvS0ZCfj1kAaeu70M2TdD9U tSThzEpRgk9k15698rLOuLjuoab6/Z/ThUlpBopvXJbCUV/3Zj9pMEwMDnkOP4VW4h eX+oqYYfoaLD0JVW9UsJmM1UH3OO1GjDvu7ZoWSQ= 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.14 075/210] ring-buffer: Check pending waiters when doing wake ups as well Date: Mon, 24 Oct 2022 13:29:52 +0200 Message-Id: <20221024112959.497465537@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@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?1747599557556442135?= X-GMAIL-MSGID: =?utf-8?q?1747599557556442135?= 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 @@ -512,8 +512,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); } }