linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Context Switching is Broken
@ 2010-06-10 11:11 Herman Swartz
  2010-06-10 14:01 ` Russell King - ARM Linux
  0 siblings, 1 reply; 11+ messages in thread
From: Herman Swartz @ 2010-06-10 11:11 UTC (permalink / raw)
  To: linux-arm-kernel

Context switching is broken. The man page for context is example code that doesn't work, but should.
Does a bug report need to be submitted?

Thanks 
Herman



      

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

* Context Switching is Broken
  2010-06-10 11:11 Context Switching is Broken Herman Swartz
@ 2010-06-10 14:01 ` Russell King - ARM Linux
  2010-06-10 14:16   ` Will Deacon
  0 siblings, 1 reply; 11+ messages in thread
From: Russell King - ARM Linux @ 2010-06-10 14:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jun 10, 2010 at 04:11:35AM -0700, Herman Swartz wrote:
> Context switching is broken. The man page for context is example code
> that doesn't work, but should. Does a bug report need to be submitted?

$ man context
No manual entry for context

?

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

* Context Switching is Broken
  2010-06-10 14:01 ` Russell King - ARM Linux
@ 2010-06-10 14:16   ` Will Deacon
  2010-06-10 14:20     ` Russell King - ARM Linux
  0 siblings, 1 reply; 11+ messages in thread
From: Will Deacon @ 2010-06-10 14:16 UTC (permalink / raw)
  To: linux-arm-kernel

> On Thu, Jun 10, 2010 at 04:11:35AM -0700, Herman Swartz wrote:
> > Context switching is broken. The man page for context is example code
> > that doesn't work, but should. Does a bug report need to be submitted?
> 
> $ man context
> No manual entry for context
> 
> ?
> 

Quite. man makecontext has a fairly scary example, maybe that's
it.

Will

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

* Context Switching is Broken
  2010-06-10 14:16   ` Will Deacon
@ 2010-06-10 14:20     ` Russell King - ARM Linux
  2010-06-10 20:36       ` Martin Guy
  0 siblings, 1 reply; 11+ messages in thread
From: Russell King - ARM Linux @ 2010-06-10 14:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jun 10, 2010 at 03:16:49PM +0100, Will Deacon wrote:
> > On Thu, Jun 10, 2010 at 04:11:35AM -0700, Herman Swartz wrote:
> > > Context switching is broken. The man page for context is example code
> > > that doesn't work, but should. Does a bug report need to be submitted?
> > 
> > $ man context
> > No manual entry for context
> > 
> > ?
> > 
> 
> Quite. man makecontext has a fairly scary example, maybe that's it.

In which case it's a question for libc people - the kernel has nothing
to do with makecontext, getcontext, setcontext and swapcontext.

I believe for glibc, these are simply unimplemented on ARM, and linking
a program which uses makecontext with glibc would result in the linker
issuing:

warning: makecontext is not implemented and will always fail

Same for the other three functions.

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

* Context Switching is Broken
  2010-06-10 14:20     ` Russell King - ARM Linux
@ 2010-06-10 20:36       ` Martin Guy
  2010-06-10 21:18         ` Herman Swartz
  0 siblings, 1 reply; 11+ messages in thread
From: Martin Guy @ 2010-06-10 20:36 UTC (permalink / raw)
  To: linux-arm-kernel

On 6/10/10, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> On Thu, Jun 10, 2010 at 03:16:49PM +0100, Will Deacon wrote:
>  > > On Thu, Jun 10, 2010 at 04:11:35AM -0700, Herman Swartz wrote:
>  > > > Context switching is broken. The man page for context is example code
>  > > > that doesn't work, but should. Does a bug report need to be submitted?
>  > >
>  > > $ man context
>  > > No manual entry for context
>  > >
>
> > Quite. man makecontext has a fairly scary example, maybe that's it.
>
> In which case it's a question for libc people - the kernel has nothing
>  to do with makecontext, getcontext, setcontext and swapcontext.
>
>  I believe for glibc, these are simply unimplemented on ARM, and linking
>  a program which uses makecontext with glibc would result in the linker
>  issuing:
>
>  warning: makecontext is not implemented and will always fail

Indeed on ARM:

martin:~$ make makecontext
cc     makecontext.c   -o makecontext
/tmp/ccnapqW4.o: In function `main':
makecontext.c:(.text+0x110): warning: warning: getcontext is not
implemented and will always fail
makecontext.c:(.text+0x164): warning: warning: makecontext is not
implemented and will always fail
/tmp/ccnapqW4.o: In function `func1':
makecontext.c:(.text+0x24): warning: warning: swapcontext is not
implemented and will always fail
$ ./makecontext
Function not inplemented.
$

so?

    M

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

* Context Switching is Broken
  2010-06-10 20:36       ` Martin Guy
@ 2010-06-10 21:18         ` Herman Swartz
  2010-06-10 21:29           ` Martin Guy
  0 siblings, 1 reply; 11+ messages in thread
From: Herman Swartz @ 2010-06-10 21:18 UTC (permalink / raw)
  To: linux-arm-kernel

Martin,

Looks like you took the example code out of the man page and tried to compile. This is what I get to. Look at my email sent a few minutes ago.

Thanks
HermanI



----- Original Message ----
From: Martin Guy <martinwguy@gmail.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Will Deacon <will.deacon@arm.com>; Herman Swartz <herman_swartz@yahoo.com>; linux-arm-kernel at lists.infradead.org
Sent: Thu, June 10, 2010 4:36:39 PM
Subject: Re: Context Switching is Broken

On 6/10/10, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> On Thu, Jun 10, 2010 at 03:16:49PM +0100, Will Deacon wrote:
>? > > On Thu, Jun 10, 2010 at 04:11:35AM -0700, Herman Swartz wrote:
>? > > > Context switching is broken. The man page for context is example code
>? > > > that doesn't work, but should. Does a bug report need to be submitted?
>? > >
>? > > $ man context
>? > > No manual entry for context
>? > >
>
> > Quite. man makecontext has a fairly scary example, maybe that's it.
>
> In which case it's a question for libc people - the kernel has nothing
>? to do with makecontext, getcontext, setcontext and swapcontext.
>
>? I believe for glibc, these are simply unimplemented on ARM, and linking
>? a program which uses makecontext with glibc would result in the linker
>? issuing:
>
>? warning: makecontext is not implemented and will always fail

Indeed on ARM:

martin:~$ make makecontext
cc? ? makecontext.c? -o makecontext
/tmp/ccnapqW4.o: In function `main':
makecontext.c:(.text+0x110): warning: warning: getcontext is not
implemented and will always fail
makecontext.c:(.text+0x164): warning: warning: makecontext is not
implemented and will always fail
/tmp/ccnapqW4.o: In function `func1':
makecontext.c:(.text+0x24): warning: warning: swapcontext is not
implemented and will always fail
$ ./makecontext
Function not inplemented.
$

so?

? ? M



      

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

* Context Switching is Broken
  2010-06-10 21:18         ` Herman Swartz
@ 2010-06-10 21:29           ` Martin Guy
  2010-06-10 22:59             ` Russell King - ARM Linux
  2010-06-10 23:22             ` Herman Swartz
  0 siblings, 2 replies; 11+ messages in thread
From: Martin Guy @ 2010-06-10 21:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hermann

While context switching works fine - any Unix system would have a hard
time working without it - these four esoteric system calls are not
implemented in the ARM port of Linux. If you'd like to modify the
linux source code to implement them, I'm sure the community would be
happy to review the patches for inclusion in the next version of the
kernel.

They seem to be implemented on x86 processors if you need them.

    M

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

* Context Switching is Broken
  2010-06-10 21:29           ` Martin Guy
@ 2010-06-10 22:59             ` Russell King - ARM Linux
  2010-06-10 23:26               ` Herman Swartz
  2010-06-10 23:22             ` Herman Swartz
  1 sibling, 1 reply; 11+ messages in thread
From: Russell King - ARM Linux @ 2010-06-10 22:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jun 10, 2010 at 10:29:12PM +0100, Martin Guy wrote:
> While context switching works fine - any Unix system would have a hard
> time working without it - these four esoteric system calls are not
> implemented in the ARM port of Linux. If you'd like to modify the
> linux source code to implement them, I'm sure the community would be
> happy to review the patches for inclusion in the next version of the
> kernel.

If you read what I said:

"I believe for glibc, these are simply unimplemented on ARM, and linking
a program which uses makecontext with glibc would result in the linker
issuing:"

These calls are nothing to do with the kernel.  They're a subject purely
for glibc.  So there's no modification to the Linux kernel source code
which could effect their implementation.

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

* Context Switching is Broken
  2010-06-10 21:29           ` Martin Guy
  2010-06-10 22:59             ` Russell King - ARM Linux
@ 2010-06-10 23:22             ` Herman Swartz
  1 sibling, 0 replies; 11+ messages in thread
From: Herman Swartz @ 2010-06-10 23:22 UTC (permalink / raw)
  To: linux-arm-kernel

esoteric "confined to and understandable by only an enlightened inner circle"

Sounds like there was a decision made during porting not to include these calls because they weren't considered useful enough.

What is the chance of requesting this to be included, along with other mods,?in the next release of the kernel for ARM?

The Sheeva PLUG is a neat/thrifty little box that runs 7X24. Unlike other computers laying around the house. :-)

JNOS is an Amateur Radio?packet radio communications program for TCP/IP running many?time dependent?segments.

Here is a requested?segment of the code:

/* Now do the context switch.
???? * This technique was inspired by Rob, PE1CHL, and is a bit tricky.
???? *
???? * If the old process has gone away, simply load the new process's
???? * environment. Otherwise, save the current process's state. Then if
???? * this is still the old process, load the new environment. Since the
???? * new task will "think" it's returning from the setjmp() with a return
???? * value of 1, the comparison with 0 will bypass the longjmp(), which
???? * would otherwise cause an infinite loop.
???? */
??? /* i_state isn't needed --- the signal mask is part of the context */
??? if (oldproc == NULLPROC)
??????? setcontext(&Curproc->env);
??? else
??????? swapcontext(&oldproc->env, &Curproc->env);
??? /* At this point, we're running in the newly dispatched task */
??? tmp = Curproc->retval;
??? Curproc->retval = 0;
??? /* Also restore the true interrupt state here, in case the longjmp
???? * DOES restore the interrupt state saved at the time of the setjmp().
???? * This is the case with Turbo-C's setjmp/longjmp.
???? */
??? restore(Curproc->i_state);
??? return tmp;
}




----- Original Message ----
From: Martin Guy <martinwguy@gmail.com>
To: Herman Swartz <herman_swartz@yahoo.com>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>; Will Deacon <will.deacon@arm.com>; linux-arm-kernel at lists.infradead.org
Sent: Thu, June 10, 2010 5:29:12 PM
Subject: Re: Context Switching is Broken

Hermann

While context switching works fine - any Unix system would have a hard
time working without it - these four esoteric system calls are not
implemented in the ARM port of Linux. If you'd like to modify the
linux source code to implement them, I'm sure the community would be
happy to review the patches for inclusion in the next version of the
kernel.

They seem to be implemented on x86 processors if you need them.

? ? M



      

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

* Context Switching is Broken
  2010-06-10 22:59             ` Russell King - ARM Linux
@ 2010-06-10 23:26               ` Herman Swartz
  2010-06-10 23:36                 ` Russell King - ARM Linux
  0 siblings, 1 reply; 11+ messages in thread
From: Herman Swartz @ 2010-06-10 23:26 UTC (permalink / raw)
  To: linux-arm-kernel

Yes, the kernel has the functions, because the kernel uses them in it's operation. The glibc needs to implement these calls to the kernel. Do I have that right?

Herman



----- Original Message ----
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Martin Guy <martinwguy@gmail.com>
Cc: Herman Swartz <herman_swartz@yahoo.com>; Will Deacon <will.deacon@arm.com>; linux-arm-kernel at lists.infradead.org
Sent: Thu, June 10, 2010 6:59:30 PM
Subject: Re: Context Switching is Broken

On Thu, Jun 10, 2010 at 10:29:12PM +0100, Martin Guy wrote:
> While context switching works fine - any Unix system would have a hard
> time working without it - these four esoteric system calls are not
> implemented in the ARM port of Linux. If you'd like to modify the
> linux source code to implement them, I'm sure the community would be
> happy to review the patches for inclusion in the next version of the
> kernel.

If you read what I said:

"I believe for glibc, these are simply unimplemented on ARM, and linking
a program which uses makecontext with glibc would result in the linker
issuing:"

These calls are nothing to do with the kernel.? They're a subject purely
for glibc.? So there's no modification to the Linux kernel source code
which could effect their implementation.



      

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

* Context Switching is Broken
  2010-06-10 23:26               ` Herman Swartz
@ 2010-06-10 23:36                 ` Russell King - ARM Linux
  0 siblings, 0 replies; 11+ messages in thread
From: Russell King - ARM Linux @ 2010-06-10 23:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jun 10, 2010 at 04:26:47PM -0700, Herman Swartz wrote:
> Yes, the kernel has the functions, because the kernel uses them in
> it's operation. The glibc needs to implement these calls to the
> kernel. Do I have that right?

No.  The kernel's context switching is entirely different to the
"context switching" that you're talking about here.

As I've said twice - and I'm not going to repeat it a third time -
this has nothing to do with the kernel and everything to do with
glibc.

You can see this from the i386 version of setcontext(), which can
be found in the glibc source code:

	sysdeps/unix/sysv/linux/i386/setcontext.S

The only call this code makes to the kernel is to set the processes
signal mask - which ARM has provided since day 1, and is used for
many things other than providing this support.  So there's nothing
to add to the kernel.

What's missing is the glibc support code.  Not the kernel code.

You need to talk to glibc people about this, not kernel people.

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

end of thread, other threads:[~2010-06-10 23:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-10 11:11 Context Switching is Broken Herman Swartz
2010-06-10 14:01 ` Russell King - ARM Linux
2010-06-10 14:16   ` Will Deacon
2010-06-10 14:20     ` Russell King - ARM Linux
2010-06-10 20:36       ` Martin Guy
2010-06-10 21:18         ` Herman Swartz
2010-06-10 21:29           ` Martin Guy
2010-06-10 22:59             ` Russell King - ARM Linux
2010-06-10 23:26               ` Herman Swartz
2010-06-10 23:36                 ` Russell King - ARM Linux
2010-06-10 23:22             ` Herman Swartz

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).