public inbox for linux-bcachefs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: linux-bcachefs@vger.kernel.org
Subject: [BUG] trace_printk() broken?
Date: Mon, 12 Dec 2022 14:20:39 -0500	[thread overview]
Message-ID: <Y5d/B88BOu6qOE5X@bfoster> (raw)

Hi,

While poking around the bcachefs tree I ran into a problem where
trace_printk() seems to be broken. I suspect this has something to do
with the printbuf bits as it works once I back out some of those
changes.

What I observe is that a smaller printk with a fixed string seems to
work as expected, but once I add some variable args the message string
seems to get chewed up. This results in wonky formatting when reading
/sys/kernel/debug/tracing/trace and a read of the corresponding
trace_pipe file seems to spin in a livelock.

A diff is appended below to give a simple example of each case. A read
of the trace file ends up looking like this:

       fsck.ext4-535     [003] .....     6.112680: write_cache_pages:        fsck.ext4-535     [003] .....     6.113224: write_cache_pages: test
       fsck.ext4-535     [003] .....     6.117957: write_cache_pages:        fsck.ext4-535     [003] .....     6.118445: write_cache_pages: test
...

Brian

--- 8< ---

diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 032a7bf8d259..59ae76cb5756 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -2355,6 +2355,9 @@ int write_cache_pages(struct address_space *mapping,
 			if (!clear_page_dirty_for_io(page))
 				goto continue_unlock;
 
+			trace_printk("%d: ino 0x%lx\n", __LINE__, mapping->host->i_ino);
+			trace_printk("test\n");
+
 			trace_wbc_writepage(wbc, inode_to_bdi(mapping->host));
 			error = (*writepage)(page, wbc, data);
 			if (unlikely(error)) {


             reply	other threads:[~2022-12-12 19:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12 19:20 Brian Foster [this message]
2022-12-13 23:32 ` [BUG] trace_printk() broken? Kent Overstreet
2022-12-14 17:46   ` Brian Foster

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=Y5d/B88BOu6qOE5X@bfoster \
    --to=bfoster@redhat.com \
    --cc=linux-bcachefs@vger.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