Re: sched.c:659 dec_rt_tasks BUG with patch-2.6.15-rt1(realtime-preempt)

From: Steven Rostedt
Date: Fri Jan 06 2006 - 21:09:29 EST


On Fri, 2006-01-06 at 20:05 -0500, Steven Rostedt wrote:
> On Thu, 2006-01-05 at 17:15 +0200, Nedko Arnaudov wrote:
> > Will try to crash SMP ASAP, I'm not able to do tests now.
> >
> > I do erase/burn of 210 MiB rw disk. Erase is done without crash.
> > I use version 2.01.01a03 of cdrecord.
> > It crashes when burning:
> >
> > http://nedko.arnaudov.name/tmp/rt-cdrecord-crash.jpg
> >
> > Same crash occurs when I run oss2jack with -d option.
> > It does not occur when running without -d option (daemonize).
> >
>
> Nedko,
>
> Could you try either the patch below, or the link
> http://home.stny.rr.com/rostedt/patches/patch-2.6.15-rt2-sr2
> which has the patch included, to see if this fixes your problem.

OK, I think this is it. Without the patch, the attached program crashes
the system. With the patch, it runs fine. I believe that cdrecord and
friends were forking processes with RT priorities. Which would crash the
system.

-- Steve

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sched.h>

int main(int argc, char **argv)
{
int pid;
struct sched_param sp = { .sched_priority = 5 };

sched_setscheduler(getpid(), SCHED_FIFO, &sp);

if ((pid = fork()) < 0) {
perror("fork");
exit(0);
} else if (!pid) {
printf("child!\n");
exit(0);
}

printf("parent\n");
exit(0);
}