From patchwork Wed Oct 19 08:24:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5092 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249767wrs; Wed, 19 Oct 2022 03:47:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6iV7ZptbGjaJqkAbROzv/VLYgCvNkg+Rr5V4JQFtmdl9dJlH9UYi9NoQK5u7LdBs/6w5dk X-Received: by 2002:a17:903:2591:b0:17f:8b74:f3c0 with SMTP id jb17-20020a170903259100b0017f8b74f3c0mr8020801plb.36.1666176425319; Wed, 19 Oct 2022 03:47:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176425; cv=none; d=google.com; s=arc-20160816; b=na5p1ZCRjAIovY35DBwpiVZDjPgtKBG5Mz0RMm3UHwsW5jkwWlp1zRxLKcVHemXu/k gde/gdgesizuktAz3UqVMMXtOEL6tDnSiqDPYjLTUfZEGkYv2Q2jnRkJfUx7p1vmQA4X Lxlbt3T3LiTmAsRIBc7PO7ierkTnLsNG0Pv0LBcewihUvk1/jHMuy6Zcos2k570U8u8z apteGw80ysoQJjrtZ3m6z20ELszMm58j2u7GwMMYlskN6XPx1OWkhjue7oXYO8/tzvdA bf3dd8sYt868Y7pW8jWePIcZTMTjEFkxZyK5hMxMgvXMsT5StdxTY41G+u606/Dn3H6t Ri+w== 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=tg3zZCik7o/KSYcmfzFiaDMuKBEp8A7+YAOkoZleivE=; b=Vf9BkbkkA/nRtmf7PJlueug9NydwBfh3p3OL3TFktJGAAZEKU5Fh/UZPtfDYUjm66O XienCtJd+kBK7rPUNTZP1PutB3TH9SZ6wvkyrublfrC8h+4eyRn6WDGvvT55P2Y51kGj VNS915PCDXkXPUYVd9LaS3otRTJYXIrWmcb/jIKaJidFJbv82J1pyLKDf4bXtbTGMGx5 dfOJMtG4AbcpiZwsO/xiHeNKbGF+tngdkvBiL91823ck08KeDci7FbPqM86YJqnw+V37 gINGD5HCNHeLOqA0F2+m36AuTrGaxuaWtDfzxmVAm8zc2Yh7ouh70osH6bGnSD4kDR+F q0IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="H/OKGGB6"; 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 c23-20020a170902849700b00182140f0836si16617021plo.459.2022.10.19.03.46.51; Wed, 19 Oct 2022 03:47:05 -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="H/OKGGB6"; 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 S233306AbiJSKqh (ORCPT + 99 others); Wed, 19 Oct 2022 06:46:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233305AbiJSKoe (ORCPT ); Wed, 19 Oct 2022 06:44:34 -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 D5DD310EA22; Wed, 19 Oct 2022 03:20:56 -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 8445FB82305; Wed, 19 Oct 2022 08:46:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7EBFC433D7; Wed, 19 Oct 2022 08:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169198; bh=lqz+c27qLgPZikG/yh+pME2iMkbgYwjlbdPKAFUv/fY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H/OKGGB6o3aBzA1XHF0TW5TW7KdaHZ1OttbuibblRcwM5bpHlHv/kxQrKd2LYAQxX sf+RjgosCfeywueHyV7/bJAkxx5NlSZUFM82eRIF7e3yHy3yBxanijIkHQgDqIMCDL 7iI2d97qB3u9Y/mRo/t187ZFGlmsYjADjJxJD3v8= 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 6.0 154/862] ring-buffer: Check pending waiters when doing wake ups as well Date: Wed, 19 Oct 2022 10:24:01 +0200 Message-Id: <20221019083256.794910184@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747112611143845105?= X-GMAIL-MSGID: =?utf-8?q?1747112611143845105?= 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 @@ -917,8 +917,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); } }