BUG: scheduling while atomic

Bug #499033 reported by RichardN
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux-rt (Ubuntu)
Fix Released
Low
Alessio Igor Bogani
Nominated for Lucid by Alessio Igor Bogani

Bug Description

Running c application. Application used to work on RT kernel and uses SCHED_RR priority.
Now it crashes the moment it tries to create pthread threads that will run at some priortiy using SCHED_RR

'Full' crashreport from syslog:

Dec 17 16:32:02 host16 kernel: [ 1308.894129] BUG: scheduling while atomic: myapp/0x00000001/3340, CPU#0
Dec 17 16:32:02 host16 kernel: [ 1308.894132] Modules linked in: binfmt_misc vboxnetflt vboxnetadp vboxdrv nls_cp437 cifs snd_hda_codec_realtek snd_hda_intel snd_hda_codec snd_hwdep snd_pcm_oss snd_mixer_oss iptable_filter ip_tables x_tables snd_pcm snd_seq_dummy snd_seq_oss snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq snd_timer snd_seq_device snd ppdev lp parport_pc soundcore heci(C) snd_page_alloc parport led_class usbhid radeon ttm drm i2c_algo_bit e1000e floppy intel_agp
Dec 17 16:32:02 host16 kernel: [ 1308.894180] Pid: 3340, comm: myapp Tainted: G C 2.6.31-9-rt #152-Ubuntu
Dec 17 16:32:02 host16 kernel: [ 1308.894184] Call Trace:
Dec 17 16:32:02 host16 kernel: [ 1308.894189] [<ffffffff8104f92a>] __schedule_bug+0x6a/0x70
Dec 17 16:32:02 host16 kernel: [ 1308.894195] [<ffffffff8153bfb9>] thread_return+0x278/0x3cf
Dec 17 16:32:02 host16 kernel: [ 1308.894201] [<ffffffff8153c394>] schedule+0x14/0x30
Dec 17 16:32:02 host16 kernel: [ 1308.894206] [<ffffffff8153d41a>] rt_spin_lock_slowlock+0x1ba/0x290
Dec 17 16:32:02 host16 kernel: [ 1308.894213] [<ffffffff8153de46>] rt_spin_lock+0x36/0x60
Dec 17 16:32:02 host16 kernel: [ 1308.894218] [<ffffffff8153b807>] wait_for_common+0xc7/0x180
Dec 17 16:32:02 host16 kernel: [ 1308.894224] [<ffffffff8105a770>] ? default_wake_function+0x0/0x20
Dec 17 16:32:02 host16 kernel: [ 1308.894230] [<ffffffff8106f243>] ? signal_wake_up+0x43/0x50
Dec 17 16:32:02 host16 kernel: [ 1308.894236] [<ffffffff8153b958>] wait_for_completion+0x18/0x20
Dec 17 16:32:02 host16 kernel: [ 1308.894241] [<ffffffff81128fa4>] coredump_wait+0x1f4/0x230
Dec 17 16:32:02 host16 kernel: [ 1308.894247] [<ffffffff811298a6>] do_coredump+0x146/0x490
Dec 17 16:32:02 host16 kernel: [ 1308.894253] [<ffffffff8153bd94>] ? thread_return+0x53/0x3cf
Dec 17 16:32:02 host16 kernel: [ 1308.894259] [<ffffffff810774d9>] ? __task_pid_nr_ns+0x69/0xc0
Dec 17 16:32:02 host16 kernel: [ 1308.894265] [<ffffffff810717ea>] get_signal_to_deliver+0x19a/0x330
Dec 17 16:32:02 host16 kernel: [ 1308.894271] [<ffffffff81011a9d>] do_signal+0x8d/0x1f0
Dec 17 16:32:02 host16 kernel: [ 1308.894277] [<ffffffff8106e761>] ? sys_rt_sigaction+0x81/0xc0
Dec 17 16:32:02 host16 kernel: [ 1308.894283] [<ffffffff81011c4f>] do_notify_resume+0x4f/0x60
Dec 17 16:32:02 host16 kernel: [ 1308.894288] [<ffffffff81012c1c>] retint_signal+0x48/0x8c
Dec 17 16:32:02 host16 kernel: [ 1308.894311] note: myapp[3340] exited with preempt_count 1

Running Karmic 9.10 AMD64 on Intel processor with all recent patches.

Excerpt of c code (-m64):

 pthread_t my_thread;

    struct sched_param param;
    pthread_attr_t threadAttr;

    param.sched_priority = 2;
    if (sched_setscheduler(0, SCHED_RR, &param) != 0) {
        exit(-1);
    }

    param.sched_priority = 90;
    pthread_attr_init(&threadAttr);
    pthread_attr_setschedpolicy(&threadAttr, SCHED_RR);
    pthread_attr_setschedparam(&threadAttr, &param);

    if (pthread_create(&my_thread, &threadAttr, my_task, (void *) 10) != 0) {
        exit(-1);
    }
    pthread_attr_destroy(&threadAttr);

ProblemType: Bug
Architecture: amd64
Date: Mon Dec 21 13:44:10 2009
DistroRelease: Ubuntu 9.10
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release amd64 (20091027)
Package: linux-image-2.6.31-9-rt 2.6.31-9.152
ProcEnviron:
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-16.53-generic
SourcePackage: linux-rt
Uname: Linux 2.6.31-16-generic x86_64

Revision history for this message
RichardN (rnumatwmc) wrote :
description: updated
RichardN (rnumatwmc)
description: updated
Revision history for this message
Alessio Igor Bogani (abogani) wrote :

Hi,

This bug was reported a while ago and there hasn't been any activity in
it recently. We were wondering if this is still an issue? Can you try
with the latest development release of Ubuntu (Lucid Lynx)? ISO CD
images are available from http://cdimage.ubuntu.com/releases/

Thanks!

Revision history for this message
RichardN (rnumatwmc) wrote :

Hi,

Perhaps I can try to run Lucid Lynx. However the problem is easily solvable (we found out by incident) by building the latest kernel with RT path from Ingo Molnar

Instructions are at https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO (as you will certainly know).

Revision history for this message
Alessio Igor Bogani (abogani) wrote :

RichardN,

You are right. The problem is that I'm the only person that try to take care of linux realtime package in Ubuntu.
This isn't a little task (test the upstream version, release a new Ubuntu version, bug triage, reply to answer, try to fix bugs and others) so, at the moment, I don't have enough power for provide updates through SRU Stable Release Update (that is updates after that an Ubuntu is released: https://wiki.ubuntu.com/StableReleaseUpdates). Sorry.

For Lucid I provide kernels in a bit little different way to mitigate the above mentioned problems:
https://lists.ubuntu.com/archives/kernel-team/2010-March/009323.html

Thanks!

Revision history for this message
RichardN (rnumatwmc) wrote :

Hi Alessio,

I will have a go at the Lucid kernels you provide via the PPA.

Is there a big difference between applying the patch to a Vanilla kernel and Ubuntu kernel? I wouldn't mind having some wiki that kind off describes the steppes to take to create an RT Ubuntu kernel (without 'warranty' of course).

Richard.

Revision history for this message
RichardN (rnumatwmc) wrote :

I have added the package sources and pressed 'reload' in the synaptic package manager. An error is shown:

W: GPG error: http://ppa.launchpad.net lucid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F44462BDF141B61E

Revision history for this message
Alessio Igor Bogani (abogani) wrote :

RichardN,

Ubuntu Kernel = vanilla kernel + a lot of patches (some backported others done by Ubuntu Kernel Team).

No differences but on Ubuntu kernel patches don't simply apply clean.

If you install linux-rt (already available in Lucid through Ubuntu archive) you install an Ubuntu kernel with PREEMPT_RT patchset applied. Instead if you install linux-realtime (available through my PPA) you install vanilla kernel with PREEMPT_RT patchset applied.

Revision history for this message
RichardN (rnumatwmc) wrote :

aha. OK. That will save us some trouble.

thanks again!

Revision history for this message
Alessio Igor Bogani (abogani) wrote :

@RichardN,

PPA install instructions:
https://launchpad.net/+help/soyuz/ppa-sources-list.html

Revision history for this message
RichardN (rnumatwmc) wrote :

Note:
I installed the linux-realtime package. Not sure if it is a meta-package.

The kernel headers were not installed. So the kernel post install script that compiles my NVidia module (proprietry) did not work. After installing the kernel headers, it did of course.

(A package named linux-meta-realtime is NOT visible in Synaptic).

System (x64) runs fine so far. No hangups in KDE with compiz wobbly windows and audio running.

thx

Changed in linux-rt (Ubuntu):
assignee: nobody → Alessio Igor Bogani (abogani)
status: New → In Progress
Changed in linux-rt (Ubuntu):
importance: Undecided → Low
Revision history for this message
Alessio Igor Bogani (abogani) wrote :

Review requested and obtained from Ubuntu Kernel Team:
https://lists.ubuntu.com/archives/kernel-team/2010-May/010543.html

Packages are available on this PPA:
https://launchpad.net/~abogani/+archive/broken/+packages

Changed in linux-rt (Ubuntu):
status: In Progress → Fix Committed
Changed in linux-rt (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.