linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Luck <tony.luck@intel.com>
To: Borislav Petkov <bp@alien8.de>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Tony Luck <tony.luck@intel.com>
Subject: [PATCH v2] RAS: Fix the trace_show() function to output trace_count
Date: Wed,  5 Oct 2022 12:46:44 -0700	[thread overview]
Message-ID: <20221005194644.311204-1-tony.luck@intel.com> (raw)
In-Reply-To: <Yz3KI5qY70rvJV63@zn.tnic>

The /sys/kernel/debug/ras/daemon_active file is used to indicate to some
kernel code whether there is a user mode consumer of RAS trace events
to decide whether to print to the console.

It looks like the intent was that reading the file would show the count
of tasks with the file open. But the code in the trace_show() function
is nonsense.

Add a seq_printf() to output the current value of the trace_count.

Fixes: d963cd95bea9 ("RAS, debugfs: Add debugfs interface for RAS subsystem")
Signed-off-by: Tony Luck <tony.luck@intel.com>
---

V2: Updated commit description based on feedback from Boris

 drivers/ras/debugfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/ras/debugfs.c b/drivers/ras/debugfs.c
index 0d4f985afbf3..d67af5e08caf 100644
--- a/drivers/ras/debugfs.c
+++ b/drivers/ras/debugfs.c
@@ -15,7 +15,8 @@ EXPORT_SYMBOL_GPL(ras_userspace_consumers);
 
 static int trace_show(struct seq_file *m, void *v)
 {
-	return atomic_read(&trace_count);
+	seq_printf(m, "%d\n", atomic_read(&trace_count));
+	return 0;
 }
 
 static int trace_open(struct inode *inode, struct file *file)
-- 
2.37.3


  reply	other threads:[~2022-10-05 19:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-05 16:16 [PATCH] RAS: Fix the trace_show() function to output trace_count Tony Luck
2022-10-05 18:17 ` Borislav Petkov
2022-10-05 19:46   ` Tony Luck [this message]
2022-10-17 10:36     ` [PATCH v2] " Borislav Petkov
2022-10-17 16:09       ` Luck, Tony
2022-10-17 19:40         ` Borislav Petkov
2022-10-18 14:36           ` Tony Luck
2022-10-18 16:05             ` Borislav Petkov
2022-10-18 16:59             ` [PATCH v3] RAS: Fix return value from show_trace() Tony Luck
2022-10-31 18:15               ` [tip: ras/core] " tip-bot2 for Tony Luck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221005194644.311204-1-tony.luck@intel.com \
    --to=tony.luck@intel.com \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).