From: Luis Henriques <luis.henrix@gmail.com>
To: Dan Magenheimer <dan.magenheimer@oracle.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] "mustnotsleep"
Date: Fri, 03 Jun 2011 00:36:19 +0100 [thread overview]
Message-ID: <87hb87lsb0.fsf@gmail.com> (raw)
In-Reply-To: <1af7a43d-84fa-47c4-a145-409e5bac585b@default> (Dan Magenheimer's message of "Thu, 2 Jun 2011 14:46:23 -0700 (PDT)")
Dan Magenheimer <dan.magenheimer@oracle.com> writes:
> In development of RAMster, I have frequently been bitten
> by indirect use of existing kernel subsystems that
> unexpectedly sleep. As such, I have hacked the
> following "debug" code fragments for use where I need to
> ensure that doesn't happen.
>
> DEFINE_PER_CPU(int, mustnotsleep_count);
>
> void mustnotsleep_start(void)
> {
> int cpu = smp_processor_id();
> per_cpu(mustnotsleep_count, cpu)++;
> }
>
> void mustnotsleep_done(void)
> {
> int cpu = smp_processor_id();
> per_cpu(mustnotsleep_count, cpu)--;
> }
>
> and in schedule.c in schedule():
>
> if (per_cpu(mustnotsleep_count))
> panic("scheduler called in mustnotsleep code");
>
> This has enabled me to start identifying code that
> is causing me problems. (I know this is a horrible
> hack, but that's OK right now.)
I'm pretty sure I'm missing something here but... what if you just use
CONFIG_DEBUG_PREEMPT? Isn't that good enough?
Cheers,
--
Luis Henriques
next prev parent reply other threads:[~2011-06-02 23:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-02 21:46 [RFC] "mustnotsleep" Dan Magenheimer
2011-06-02 23:36 ` Luis Henriques [this message]
2011-06-03 0:00 ` Dan Magenheimer
2011-06-04 3:04 ` Hugh Dickins
2011-06-05 19:28 ` Dan Magenheimer
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=87hb87lsb0.fsf@gmail.com \
--to=luis.henrix@gmail.com \
--cc=dan.magenheimer@oracle.com \
--cc=linux-kernel@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