lkml.org 
[lkml]   [2011]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC] "mustnotsleep"
Date
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


\
 
 \ /
  Last update: 2011-06-03 01:43    [W:0.056 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site