From patchwork Mon Oct 24 11:27: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: 9026 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441643wru; Mon, 24 Oct 2022 06:06:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6dY3BIwwvqaTL3/VbU3KchPJBGCq3EjYu0SD8JjkRlgOguTlqjlMvwp5Orfj9tS6th3y05 X-Received: by 2002:a65:62c7:0:b0:463:9c67:5fe2 with SMTP id m7-20020a6562c7000000b004639c675fe2mr27971793pgv.443.1666616771524; Mon, 24 Oct 2022 06:06:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616771; cv=none; d=google.com; s=arc-20160816; b=EpKtDY2p1RxnEYY8rZ6oKHNLHXO+NkrwashUFZ0uvQi0X2pHxaCiGi7fGu+UTh+TY+ 7ElH9iHihcOZS4YwTNZs8mGj+fj9IMMcH3CZcB/8l/kvhLXZBH/ycWRhy6kNHuNZLvTm MP8JykD4/sW+B/DCBxw/6llRfZJ9v+6e2rItQ6mH1tUZAzwSK2s8nJTABrMJJbHn1SjE vPaFSVTEWZr+8ZRs27RRnsXQiVa2x3jWxHBzDyAzdNk/FlVFZjWfa8eHzq6z6DEUlaOE a+hlkMvOWO7/1BepTGSmYVwPj4mQ61SKOcPcJkVZ/vTKwLALqOwpAHN/gSKmtNNDR30W DJPw== 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=oU7nyBJPJ0Kvenl8tqnNJVBAw7ziBxJRuRWMs+zWN68=; b=KgX3XiDxaKciz2yLTrCQ8tgCTgcfAjSVdhOC8knlrxc67KCYCcOzUQzsKEzKwE+Cmr MoknukI+wVlBWjb5mOwf/j1Xzu0Icw8UBhdb9SqO+aH5nr1MmjQjODqs/a/Lc3GMpkt7 LcDqdGNyyAqvG0+BvnFotB+jZTK4g7RaC1kd6Z/3+59lO8vluzEqfFuVfM28Xwx7Mmm5 t88XuD3Q0aRU+eRW/o0XaQx5FzsImnHLTIXUNb26HoBgsPvTmJUX6BIxQUShFJnYA8ez pCUonDORJ2b04G4Czw340/LI5EoBJv37mHJWRRhCqL2GR6o1y+rwsqqJ9CcV2Xs+1/sZ aLYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DX+A5a5U; 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 t185-20020a6381c2000000b00434bfa4c2d7si1407789pgd.317.2022.10.24.06.05.51; Mon, 24 Oct 2022 06:06:11 -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=DX+A5a5U; 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 S235099AbiJXNFC (ORCPT + 99 others); Mon, 24 Oct 2022 09:05:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235147AbiJXNBr (ORCPT ); Mon, 24 Oct 2022 09:01:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AB403609F; Mon, 24 Oct 2022 05:20: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 dfw.source.kernel.org (Postfix) with ESMTPS id 9583B6127C; Mon, 24 Oct 2022 12:19:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB136C433C1; Mon, 24 Oct 2022 12:19:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613950; bh=jSUSX011/c+RLBZj1ZDUOWJuC2nRC9752Bn9eWu4wEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DX+A5a5U9+8EisKrDYkKO/0shrhl+XInDO6tL89HMdyWP3EBA9O+zg6WFsUefX1dy guzJbOnkb6RC2+59V7W1gU/4jkn8qFrzdvGidE63vsO8mA9CuZj2e+6vD34IUD+Oe9 YYSmsAq/nIo9LgklTe7zP8PB7i2LyHqL6WbYBTBc= 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.10 075/390] ring-buffer: Check pending waiters when doing wake ups as well Date: Mon, 24 Oct 2022 13:27:52 +0200 Message-Id: <20221024113025.809508175@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@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?1747574347771364601?= X-GMAIL-MSGID: =?utf-8?q?1747574347771364601?= 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 @@ -794,8 +794,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); } }