The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dan Magenheimer <dan.magenheimer@oracle.com>
To: Luis Henriques <luis.henrix@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: RE: [RFC] "mustnotsleep"
Date: Thu, 2 Jun 2011 17:00:29 -0700 (PDT)	[thread overview]
Message-ID: <58c0ab81-5c63-4d41-957b-df02e15aeba5@default> (raw)
In-Reply-To: <87hb87lsb0.fsf@gmail.com>

> From: Luis Henriques [mailto:luis.henrix@gmail.com]
> Subject: Re: [RFC] "mustnotsleep"
> 
> 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?

Thanks for the reply Luis.

Looking at the code enabled by CONFIG_DEBUG_PREEMPT,
I don't think it does what I'm looking for.  I need
to ensure that no code called inside the boundaries
of mustnotsleep_start/done ever calls the scheduler,
e.g. cond_resched is never called etc.

  reply	other threads:[~2011-06-03  0:00 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
2011-06-03  0:00   ` Dan Magenheimer [this message]
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=58c0ab81-5c63-4d41-957b-df02e15aeba5@default \
    --to=dan.magenheimer@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luis.henrix@gmail.com \
    /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