From patchwork Tue Feb 7 15:06:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 53960 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2902267wrn; Tue, 7 Feb 2023 07:12:24 -0800 (PST) X-Google-Smtp-Source: AK7set/ZhV2A0OiDowaazQDrkubu9v8WlcfHI5Uzk44cdho9w6QcpM5+GcamrtBVj3yH+qNil4qg X-Received: by 2002:a50:c05c:0:b0:49c:91d8:e989 with SMTP id u28-20020a50c05c000000b0049c91d8e989mr3495928edd.42.1675782744473; Tue, 07 Feb 2023 07:12:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675782744; cv=none; d=google.com; s=arc-20160816; b=hJXz7RxKnX3nFFG2h95z6uMWJNQJDEYI3nno4RqRtBRmXRn4VA48j0zUOmMDQ9+PZb NXtFnPqXacA3uhfL4CifZsxgUuWAcFBb1qNj1M8jrMqF14AHV4YaBzJ+wuMhypRBKuev 2yYSZVyO1W/3WuMq+RZLZYlVhfuG7RwaSa8hqVlRzJcgB/OQ6fbjKdJFggQeUYSp9SAh qhWQN4u5L0F2BwXoVLsr13/OxwTBjKEA/Y//LLVCMMXX+W6GGCVkfVsqMKIDDR4nzBfq ER6MLpuilGmnb0YSNez+svtePoxKRb0th5jyFgx/SfkwxHT3p5ZV43O7Yh2/aPANmHRX 5oYQ== 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 :message-id:subject:cc:to:from:date; bh=b9p6qlS9wAxCwZ0QerbgA224KkvhC/IxM3Z0I/H2x18=; b=OjhnzmRQoRDWa+0YNLEc+N06VqGxadWyacp/8gbEy4nCzjtKaxfRlvhbIaDi27mG5w 5E3O7ehrwivw0qoB4i7lutr3yNQYn6kZztV8Yz+u3phLa7+T73IuwUtzT05FTcToqSfW VeDUakUAuTRoMEsMMAGgoejGXKPB1hVSf6gb3ejdRco67Ksi/Nxb62CLi5++hE8czibk PVi+xrUEQB5aYB/3P02PYYHliwoDi61lw3JeTej/wOpNPwPhWKxcCbQQOU4Ey2h9QWkC KsFJwKZbawOi3y8MC6oMi5VWDlfIsTzyQE8DmAGbN5mpLU37NpBd9aJFfHxn9vy1kri3 N2Tg== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f4-20020a056402194400b0046b2840ca3dsi16270122edz.474.2023.02.07.07.12.00; Tue, 07 Feb 2023 07:12:24 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232469AbjBGPGR (ORCPT + 99 others); Tue, 7 Feb 2023 10:06:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232427AbjBGPGN (ORCPT ); Tue, 7 Feb 2023 10:06:13 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C655415C93 for ; Tue, 7 Feb 2023 07:06:11 -0800 (PST) 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 559A260DD1 for ; Tue, 7 Feb 2023 15:06:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36AD8C433D2; Tue, 7 Feb 2023 15:06:10 +0000 (UTC) Date: Tue, 7 Feb 2023 10:06:08 -0500 From: Steven Rostedt To: Linus Torvalds Cc: LKML , Masami Hiramatsu , Shiju Jose , mchehab@kernel.org Subject: [ GIT PULL] tracing: Allow poll() and select() to not block Message-ID: <20230207100608.203ef0f1@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,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?1757185566641078977?= X-GMAIL-MSGID: =?utf-8?q?1757185566641078977?= Linus, Tracing: Fix small regression in poll() and select() With the fix that made poll() and select() block if read would block caused a slight regression in rasdaemon, as it needed that kind of behavior. Add a way to make that behavior come back by writing zero into the "buffer_percentage", which means to never block on read, poll or select. Please pull the latest trace-v6.2-rc6 tree, which can be found at: git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git trace-v6.2-rc6 Tag SHA1: d35c826e198a367e8eda280b42dc0b408bd2ccef Head SHA1: 3e46d910d8acf94e5360126593b68bf4fee4c4a1 Shiju Jose (1): tracing: Fix poll() and select() do not work on per_cpu trace_pipe and trace_pipe_raw ---- kernel/trace/trace.c | 3 --- 1 file changed, 3 deletions(-) --------------------------- commit 3e46d910d8acf94e5360126593b68bf4fee4c4a1 Author: Shiju Jose Date: Thu Feb 2 18:23:09 2023 +0000 tracing: Fix poll() and select() do not work on per_cpu trace_pipe and trace_pipe_raw poll() and select() on per_cpu trace_pipe and trace_pipe_raw do not work since kernel 6.1-rc6. This issue is seen after the commit 42fb0a1e84ff525ebe560e2baf9451ab69127e2b ("tracing/ring-buffer: Have polling block on watermark"). This issue is firstly detected and reported, when testing the CXL error events in the rasdaemon and also erified using the test application for poll() and select(). This issue occurs for the per_cpu case, when calling the ring_buffer_poll_wait(), in kernel/trace/ring_buffer.c, with the buffer_percent > 0 and then wait until the percentage of pages are available. The default value set for the buffer_percent is 50 in the kernel/trace/trace.c. As a fix, allow userspace application could set buffer_percent as 0 through the buffer_percent_fops, so that the task will wake up as soon as data is added to any of the specific cpu buffer. Link: https://lore.kernel.org/linux-trace-kernel/20230202182309.742-2-shiju.jose@huawei.com Cc: Cc: Cc: Cc: stable@vger.kernel.org Fixes: 42fb0a1e84ff5 ("tracing/ring-buffer: Have polling block on watermark") Signed-off-by: Shiju Jose Signed-off-by: Steven Rostedt (Google) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 78ed5f1baa8c..c9e40f692650 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -9148,9 +9148,6 @@ buffer_percent_write(struct file *filp, const char __user *ubuf, if (val > 100) return -EINVAL; - if (!val) - val = 1; - tr->buffer_percent = val; (*ppos)++;