mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v4 2/8] bthread: add debug print for scheduler context switches
Date: Tue, 22 Jun 2021 10:26:11 +0200	[thread overview]
Message-ID: <20210622082617.18011-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20210622082617.18011-1-a.fatoum@pengutronix.de>

When debugging around bthreads, it's often useful to log context
switches. Make this easier by adding a ready-to-use pr_debug at the
correct location.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/bthread.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/common/bthread.c b/common/bthread.c
index c811797130eb..80651344da64 100644
--- a/common/bthread.c
+++ b/common/bthread.c
@@ -163,7 +163,10 @@ void bthread_info(void)
 
 void bthread_reschedule(void)
 {
-	bthread_schedule(list_next_entry(current, list));
+	struct bthread *next = list_next_entry(current, list);
+	if (current != next)
+		pr_debug("switch %s -> %s\n", current->name, next->name);
+	bthread_schedule(next);
 }
 
 void bthread_schedule(struct bthread *to)
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  parent reply	other threads:[~2021-06-22  8:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22  8:26 [PATCH v4 0/8] usbgadget: add support for USB mass storage gadget Ahmad Fatoum
2021-06-22  8:26 ` [PATCH v4 1/8] input: virtio: poll from poller, not bthread Ahmad Fatoum
2021-06-22  8:26 ` Ahmad Fatoum [this message]
2021-06-22  8:26 ` [PATCH v4 3/8] common: move workqueue handling from poller_call() to sched() Ahmad Fatoum
2021-06-22  8:26 ` [PATCH v4 4/8] common: bthread: schedule only in command context Ahmad Fatoum
2021-06-22  9:08   ` Ahmad Fatoum
2021-06-22  8:26 ` [PATCH v4 5/8] bthread: implement basic Linux-like completion API Ahmad Fatoum
2021-06-22  8:26 ` [PATCH v4 6/8] Documentation: devel: background-execution: update bthread docs Ahmad Fatoum
2021-06-22  8:26 ` [PATCH v4 7/8] usbgadget: refactor usbgadget_register to accept array Ahmad Fatoum
2021-06-22  8:26 ` [PATCH v4 8/8] usbgadget: add support for USB mass storage gadget Ahmad Fatoum
2021-06-25  7:34 ` [PATCH v4 0/8] " Sascha Hauer

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=20210622082617.18011-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.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