linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* realtime preemption patch on PPC
@ 2005-01-04 21:26 Tim Bird
  0 siblings, 0 replies; 7+ messages in thread
From: Tim Bird @ 2005-01-04 21:26 UTC (permalink / raw)
  To: linuxppc-embedded

Hello all,

I sent the message below to LKML, but someone suggested to send it
to this list as well.

I'm planning on doing some work with Ingo's realtime preemption patch
 on a PowerPC platform.  I did some preliminary investigation of the
 patch before Christmas, and am ready to do some serious work in the
 next few weeks.

Has anyone else worked on this patch on PPC?  Is anyone else interested
 in working with me on it?

Thanks,
 -- Tim

=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Electronics
=============================

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Realtime preemption patch on PPC
@ 2006-08-10 23:04 Ben Weintraub
  2006-08-11  1:38 ` Lee Revell
  2006-08-11 14:38 ` Brent Cook
  0 siblings, 2 replies; 7+ messages in thread
From: Ben Weintraub @ 2006-08-10 23:04 UTC (permalink / raw)
  To: linuxppc-embedded

Howdy,

I'm wondering if anyone has had success getting Ingo Molnar's realtime
preemption patch (the one here:
http://people.redhat.com/mingo/realtime-preempt/ ) working on the ppc
arch.  

I'm working with patch-2.6.17-rt8 (the latest) and linux-2.6.17.  The
realtime-preempt patch seems to include the generic timeofday patch, but
with no support for the ppc arch, only powerpc, so I've hacked in
support for ppc by basically replicating the powerpc arch-specific stuff
found here:
http://sr71.net/~jstultz/tod/archive/linux-2.6.17-rc3_timekeeping_C2/broken-out/linux-2.6.17-rc3_timeofday-arch-ppc_C2.patch

I can attach my patch if anyone would like, but for all I know it could
be wildly inaccurate.  

Anyhow, when I boot on an MPC8555 with my hack, I get an endless stream
of:

BUG: sleeping function called from invalid context init(1) at
arch/powerpc/math-emu/math.c:226
in_atomic():0 [00000000], irqs_disabled():1
Call Trace:
[A0BB3E90] [A000934C] show_stack+0x48/0x194 (unreliable)
[A0BB3EC0] [A001B7DC] __might_sleep+0xe8/0xf4
[A0BB3EE0] [A00136C0] do_mathemu+0x30/0x8c8
[A0BB3F00] [A00036AC] program_check_exception+0x1ac/0x514
[A0BB3F40] [A0002A08] ret_from_except_full+0x0/0x4c

Line 226 in arch/powerpc/math-emu/math.c is part of the do_mathemu()
function, and contains a call to get_user(), which calls
__might_sleep(), causing this problem.  

I did find this message in the LKML archives describing a very similar
problem:
http://lkml.org/lkml/2006/2/23/312

And so tried putting a call to local_irq_enable() before the call to
do_mathemu() in program_check_excpetion(), but this causes a hard lockup
with no messages printed when I try to bring up my network interface.  I
assume this means I've done something Very Bad with interrupts by adding
in local_irq_enable() at the wrong spot.  I also tried adding it at the
exact same spot as the patch given by Paul in his reply, but in this
case I still get the endless stream of BUG messages.

Can anyone offer some guidance or advice?

Thanks so much,
Ben 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Realtime preemption patch on PPC
@ 2006-08-11  0:55 Ben Weintraub
  0 siblings, 0 replies; 7+ messages in thread
From: Ben Weintraub @ 2006-08-11  0:55 UTC (permalink / raw)
  To: linuxppc-dev

(Sorry for those of you who see this message twice, it was originally  
posted in the linuxppc-embedded list, but Mark Greer suggested  
posting it here too)

Howdy,

I'm wondering if anyone has had success getting Ingo Molnar's realtime
preemption patch (the one here:
http://people.redhat.com/mingo/realtime-preempt/ ) working on the ppc
arch.

I'm working with patch-2.6.17-rt8 (the latest) and linux-2.6.17.  The
realtime-preempt patch seems to include the generic timeofday patch, but
with no support for the ppc arch, only powerpc, so I've hacked in
support for ppc by basically replicating the powerpc arch-specific stuff
found here:
http://sr71.net/~jstultz/tod/archive/linux-2.6.17-rc3_timekeeping_C2/ 
broken-out/linux-2.6.17-rc3_timeofday-arch-ppc_C2.patch

I can attach my patch if anyone would like, but for all I know it could
be wildly inaccurate.

Anyhow, when I boot on an MPC8555 with my hack, I get an endless stream
of:

BUG: sleeping function called from invalid context init(1) at
arch/powerpc/math-emu/math.c:226
in_atomic():0 [00000000], irqs_disabled():1
Call Trace:
[A0BB3E90] [A000934C] show_stack+0x48/0x194 (unreliable)
[A0BB3EC0] [A001B7DC] __might_sleep+0xe8/0xf4
[A0BB3EE0] [A00136C0] do_mathemu+0x30/0x8c8
[A0BB3F00] [A00036AC] program_check_exception+0x1ac/0x514
[A0BB3F40] [A0002A08] ret_from_except_full+0x0/0x4c

Line 226 in arch/powerpc/math-emu/math.c is part of the do_mathemu()
function, and contains a call to get_user(), which calls
__might_sleep(), causing this problem.

I did find this message in the LKML archives describing a very similar
problem:
http://lkml.org/lkml/2006/2/23/312

And so tried putting a call to local_irq_enable() before the call to
do_mathemu() in program_check_excpetion(), but this causes a hard lockup
with no messages printed when I try to bring up my network interface.  I
assume this means I've done something Very Bad with interrupts by adding
in local_irq_enable() at the wrong spot.  I also tried adding it at the
exact same spot as the patch given by Paul in his reply, but in this
case I still get the endless stream of BUG messages.

Can anyone offer some guidance or advice?

Thanks so much,
Ben

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Realtime preemption patch on PPC
  2006-08-10 23:04 Realtime preemption patch on PPC Ben Weintraub
@ 2006-08-11  1:38 ` Lee Revell
  2006-08-11 14:38 ` Brent Cook
  1 sibling, 0 replies; 7+ messages in thread
From: Lee Revell @ 2006-08-11  1:38 UTC (permalink / raw)
  To: Ben Weintraub; +Cc: linuxppc-embedded

On Thu, 2006-08-10 at 16:04 -0700, Ben Weintraub wrote:
> Howdy,
> 
> I'm wondering if anyone has had success getting Ingo Molnar's realtime
> preemption patch (the one here:
> http://people.redhat.com/mingo/realtime-preempt/ ) working on the ppc
> arch.  
> 

This is probably a better question for the -rt people and LKML than this
list.

Lee

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Realtime preemption patch on PPC
  2006-08-10 23:04 Realtime preemption patch on PPC Ben Weintraub
  2006-08-11  1:38 ` Lee Revell
@ 2006-08-11 14:38 ` Brent Cook
  2006-08-11 15:54   ` Kim Phillips
  2006-08-11 22:29   ` Roger Larsson
  1 sibling, 2 replies; 7+ messages in thread
From: Brent Cook @ 2006-08-11 14:38 UTC (permalink / raw)
  To: linuxppc-embedded

On Thursday 10 August 2006 18:04, Ben Weintraub wrote:
> Howdy,
>
> I'm wondering if anyone has had success getting Ingo Molnar's realtime
> preemption patch (the one here:
> http://people.redhat.com/mingo/realtime-preempt/ ) working on the ppc
> arch.

I have gotten them to work with MPC7448 boards, but it has hardware floating 
point, so no math-emu problems.

> Anyhow, when I boot on an MPC8555 with my hack, I get an endless stream
> of:
>
> BUG: sleeping function called from invalid context init(1) at
> arch/powerpc/math-emu/math.c:226
> in_atomic():0 [00000000], irqs_disabled():1
> Call Trace:
> [A0BB3E90] [A000934C] show_stack+0x48/0x194 (unreliable)
> [A0BB3EC0] [A001B7DC] __might_sleep+0xe8/0xf4
> [A0BB3EE0] [A00136C0] do_mathemu+0x30/0x8c8
> [A0BB3F00] [A00036AC] program_check_exception+0x1ac/0x514
> [A0BB3F40] [A0002A08] ret_from_except_full+0x0/0x4c
>
> Line 226 in arch/powerpc/math-emu/math.c is part of the do_mathemu()
> function, and contains a call to get_user(), which calls
> __might_sleep(), causing this problem.
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Realtime preemption patch on PPC
  2006-08-11 14:38 ` Brent Cook
@ 2006-08-11 15:54   ` Kim Phillips
  2006-08-11 22:29   ` Roger Larsson
  1 sibling, 0 replies; 7+ messages in thread
From: Kim Phillips @ 2006-08-11 15:54 UTC (permalink / raw)
  To: Brent Cook; +Cc: linuxppc-embedded

On Fri, 11 Aug 2006 09:38:45 -0500
Brent Cook <bcook@bpointsys.com> wrote:

> On Thursday 10 August 2006 18:04, Ben Weintraub wrote:

> I have gotten them to work with MPC7448 boards, but it has hardware floating 
> point, so no math-emu problems.
> 
> > Anyhow, when I boot on an MPC8555 with my hack, I get an endless stream
> > of:

if you can, you might want to rebuild your binaries with -msoft-float

Kim

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Realtime preemption patch on PPC
  2006-08-11 14:38 ` Brent Cook
  2006-08-11 15:54   ` Kim Phillips
@ 2006-08-11 22:29   ` Roger Larsson
  1 sibling, 0 replies; 7+ messages in thread
From: Roger Larsson @ 2006-08-11 22:29 UTC (permalink / raw)
  To: linuxppc-embedded

On Friday 11 August 2006 16:38, Brent Cook wrote:
> On Thursday 10 August 2006 18:04, Ben Weintraub wrote:
> > Howdy,
> >
> > I'm wondering if anyone has had success getting Ingo Molnar's realtime
> > preemption patch (the one here:
> > http://people.redhat.com/mingo/realtime-preempt/ ) working on the ppc
> > arch.
>
> I have gotten them to work with MPC7448 boards, but it has hardware
> floating point, so no math-emu problems.
>
> > Anyhow, when I boot on an MPC8555 with my hack, I get an endless stream
> > of:
> >
> > BUG: sleeping function called from invalid context init(1) at
> > arch/powerpc/math-emu/math.c:226
> > in_atomic():0 [00000000], irqs_disabled():1
> > Call Trace:
> > [A0BB3E90] [A000934C] show_stack+0x48/0x194 (unreliable)
> > [A0BB3EC0] [A001B7DC] __might_sleep+0xe8/0xf4
> > [A0BB3EE0] [A00136C0] do_mathemu+0x30/0x8c8
> > [A0BB3F00] [A00036AC] program_check_exception+0x1ac/0x514
> > [A0BB3F40] [A0002A08] ret_from_except_full+0x0/0x4c
> >
> > Line 226 in arch/powerpc/math-emu/math.c is part of the do_mathemu()
> > function, and contains a call to get_user(), which calls
> > __might_sleep(), causing this problem.
It is not the might sleep that is the problem. Nor the get_user.
It is that the irqs are DISABLED.
If the thread goes to sleep it might never wake up! (With interrupts disabled
what HW can not notify SW that it is live...)

1) Floating point in kernel is difficult to handle due to lazy register saving
2) When using a processor without hardware floating point, compile with 
library (to avoid taking exceptions due to unimplemented instructions with
emulation)

My guess is that you have a driver that disables interrupts, does floating 
point calculations expecting that it has floating point support, takes an 
exception, exception code does not expect to get an exception from kernel
space and absolutely not when having interrupts disabled...

Recompile with soft float, or even better use fixed point calculations!

/RogerL

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-08-11 22:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-10 23:04 Realtime preemption patch on PPC Ben Weintraub
2006-08-11  1:38 ` Lee Revell
2006-08-11 14:38 ` Brent Cook
2006-08-11 15:54   ` Kim Phillips
2006-08-11 22:29   ` Roger Larsson
  -- strict thread matches above, loose matches on Subject: below --
2006-08-11  0:55 Ben Weintraub
2005-01-04 21:26 realtime " Tim Bird

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).