Re: [uClinux-dev] segmentation fault while starting user-program under heavy interrupt load

2007-06-05 Thread Greg Ungerer

Hi Juergen,

Juergen Pfeiffer wrote:

Greg Ungerer schrieb:

This is on Freescales code base on the 5485 right?
(That is an old kernel...)


Yes it is.



Lots of interrupts means lots of context switches, into and out
of the kernel. If there is any bugs in the entry or exit code
that interferes with the running application processes then
you can get application crashes like you see.


Of course i looked at the kmalloc()'s in my driver, but there are 
only very few. They are only called on driver driver initialisation.

I could see no obvious problems yet with the allocated memory.


Much more likely to be related to the interrupt/softirq load, and
kernel code related to processing that.


Di you have any idea, how i can proof or falsify, if the problem is in 
my driver or if it is in general kernel code of interrupt/softirq 
processing?


If you can make your driver do most of its work without interrupts
then that would go part of the way. Obviously this is to test,
performance won't matter, poll to IO if you can. Rule our the raw
access (memory/bus cycle corruption, etc).

Regards
Greg




Greg Ungerer  --  Chief Software Dude   EMAIL: [EMAIL PROTECTED]
Secure Computing CorporationPHONE:   +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com
___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


Re: [uClinux-dev] segmentation fault while starting user-program under heavy interrupt load

2007-05-31 Thread Juergen Pfeiffer
Hi Greg

Greg Ungerer schrieb:
>
> This is on Freescales code base on the 5485 right?
> (That is an old kernel...)
>
Yes it is.

>
> Lots of interrupts means lots of context switches, into and out
> of the kernel. If there is any bugs in the entry or exit code
> that interferes with the running application processes then
> you can get application crashes like you see.
>
>
>> Of course i looked at the kmalloc()'s in my driver, but there are
>> only very few. They are only called on driver driver initialisation.
>> I could see no obvious problems yet with the allocated memory.
>
> Much more likely to be related to the interrupt/softirq load, and
> kernel code related to processing that.

Di you have any idea, how i can proof or falsify, if the problem is in
my driver or if it is in general kernel code of interrupt/softirq
processing?


Regards
-- 

Jürgen Pfeiffer 

* _mailto:[EMAIL PROTECTED]
SesKion Softwareentwicklung und System Konzeption GmbH  

( : +49-711-9905814
Karlsruher Str. 11/1

Fax: +49-711-9905827
70771 Leinfelden-Echterdingen   

1 _http://www.seskion.de_
Vertretungsberechtigte Geschäftsführer: 

Gerhard Kuhn,
Jürgen Pfeiffer,
Horst Tabel.
Handelsregister:

HRB 224379
Amtsgericht Stuttgart
Unsere Ust-IdNr.:   

DE189769369
Unsere Steuernummer:

99060 / 04155


___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Re: [uClinux-dev] segmentation fault while starting user-program under heavy interrupt load

2007-05-31 Thread Juergen Pfeiffer
Gavin Lambert schrieb:
> On !MMU systems there is no memory protection between processes or between
> kernel and user space.  So if a driver is randomly stomping over memory
> supposedly in user space then it will break things.  Another possibility is
> just that you're running out of RAM, or that it's becoming too fragmented,
> since kernel and userspace use the same memory pools.
>   

Hi Gavin

 The Coldfire MCF5485 has a builtin MMU and it is used by the linux
implementatio i use.
So maybe uClinux is not the correct mailing list. Sorry. Is there a
mailing list for embedded linux?


-- 

Jürgen Pfeiffer 

* _mailto:[EMAIL PROTECTED]
SesKion Softwareentwicklung und System Konzeption GmbH  

( : +49-711-9905814
Karlsruher Str. 11/1

Fax: +49-711-9905827
70771 Leinfelden-Echterdingen   

1 _http://www.seskion.de_
Vertretungsberechtigte Geschäftsführer: 

Gerhard Kuhn,
Jürgen Pfeiffer,
Horst Tabel.
Handelsregister:

HRB 224379
Amtsgericht Stuttgart
Unsere Ust-IdNr.:   

DE189769369
Unsere Steuernummer:

99060 / 04155


___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Re: [uClinux-dev] segmentation fault while starting user-program under heavy interrupt load

2007-05-31 Thread Greg Ungerer


Greg Ungerer wrote:

Hi Huergen,

 ^^^
Oops, typo, sorry Juergen :-)

Regards
Greg




Juergen Pfeiffer wrote:
I'm using Linux Kernel 2.6.10 for Coldfire 5485 in an embedded 
application.
I developped my own device-driver (Profibus), working on the internal 
UART of the coldfire.


This is on Freescales code base on the 5485 right?
(That is an old kernel...)


This Driver produces heavy hard-interrupt und soft-irq load, because 
UART Data is received and transmitted with 93750 bit/s.
But the driver works fine and communicates with other devices as it 
should do. No Kernel-oops.


Now i have the situation, that when i try to start some user program 
like "ls" or "ps" ... out of an interactive bash,
sometimes i get a message "Segmentation fault" and the program isn't 
started. Then i try again and this time it works.
This shows up in any standard user programm (most of them inside 
busybox), but it happens only about every 100th try.
free shows over 1 Megabyte of free memory. I cannot believe, that the 
problem is in all of the user programms.

I deactivated my driver and (bad world) no problem anymore.

So my question is:
How can an error inside a device driver produce problems in starting 
user programs?


Lots of interrupts means lots of context switches, into and out
of the kernel. If there is any bugs in the entry or exit code
that interferes with the running application processes then
you can get application crashes like you see.


Of course i looked at the kmalloc()'s in my driver, but there are only 
very few. They are only called on driver driver initialisation.

I could see no obvious problems yet with the allocated memory.


Much more likely to be related to the interrupt/softirq load, and
kernel code related to processing that.

Regards
Greg





Hope, somebody can help me
--

Jürgen Pfeiffer

* _mailto:[EMAIL PROTECTED]
SesKion Softwareentwicklung und System Konzeption GmbH

( : +49-711-9905814
Karlsruher Str. 11/1

Fax: +49-711-9905827
70771 Leinfelden-Echterdingen

1 _http://www.seskion.de_
Vertretungsberechtigte Geschäftsführer:

Gerhard Kuhn,

Jürgen Pfeiffer,
Horst Tabel.
Handelsregister:

HRB 224379

Amtsgericht Stuttgart
Unsere Ust-IdNr.:

DE189769369
Unsere Steuernummer:

99060 / 04155







___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev




--

Greg Ungerer  --  Chief Software Dude   EMAIL: [EMAIL PROTECTED]
Secure Computing CorporationPHONE:   +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com
___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


Re: [uClinux-dev] segmentation fault while starting user-program under heavy interrupt load

2007-05-31 Thread Greg Ungerer

Hi Huergen,

Juergen Pfeiffer wrote:

I'm using Linux Kernel 2.6.10 for Coldfire 5485 in an embedded application.
I developped my own device-driver (Profibus), working on the internal 
UART of the coldfire.


This is on Freescales code base on the 5485 right?
(That is an old kernel...)


This Driver produces heavy hard-interrupt und soft-irq load, because 
UART Data is received and transmitted with 93750 bit/s.
But the driver works fine and communicates with other devices as it 
should do. No Kernel-oops.


Now i have the situation, that when i try to start some user program 
like "ls" or "ps" ... out of an interactive bash,
sometimes i get a message "Segmentation fault" and the program isn't 
started. Then i try again and this time it works.
This shows up in any standard user programm (most of them inside 
busybox), but it happens only about every 100th try.
free shows over 1 Megabyte of free memory. I cannot believe, that the 
problem is in all of the user programms.

I deactivated my driver and (bad world) no problem anymore.

So my question is:
How can an error inside a device driver produce problems in starting 
user programs?


Lots of interrupts means lots of context switches, into and out
of the kernel. If there is any bugs in the entry or exit code
that interferes with the running application processes then
you can get application crashes like you see.


Of course i looked at the kmalloc()'s in my driver, but there are only 
very few. They are only called on driver driver initialisation.

I could see no obvious problems yet with the allocated memory.


Much more likely to be related to the interrupt/softirq load, and
kernel code related to processing that.

Regards
Greg





Hope, somebody can help me
--

Jürgen Pfeiffer 

* _mailto:[EMAIL PROTECTED]
SesKion Softwareentwicklung und System Konzeption GmbH  

( : +49-711-9905814
Karlsruher Str. 11/1

Fax: +49-711-9905827
70771 Leinfelden-Echterdingen   

1 _http://www.seskion.de_
Vertretungsberechtigte Geschäftsführer: 

Gerhard Kuhn,
Jürgen Pfeiffer,
Horst Tabel.
Handelsregister:

HRB 224379
Amtsgericht Stuttgart
Unsere Ust-IdNr.:   

DE189769369
Unsere Steuernummer:

99060 / 04155






___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


--

Greg Ungerer  --  Chief Software Dude   EMAIL: [EMAIL PROTECTED]
Secure Computing CorporationPHONE:   +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com
___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


RE: [uClinux-dev] segmentation fault while starting user-program under heavy interrupt load

2007-05-31 Thread Gavin Lambert
Quoth Juergen Pfeiffer:
>I'm using Linux Kernel 2.6.10 for Coldfire 5485 in an embedded 
>application.
>I developped my own device-driver (Profibus), working on the internal 
>UART of the coldfire.
[...]
Now i have the situation, that when i try to start some user program like 
>"ls" or "ps" ... out of an interactive bash, sometimes i get a message 
>"Segmentation fault" and the program isn't started. Then i try again and 
>this time it works.
[...]
>I deactivated my driver and (bad world) no problem anymore.
>
>So my question is:
>How can an error inside a device driver produce problems in starting 
>user programs?

On !MMU systems there is no memory protection between processes or between
kernel and user space.  So if a driver is randomly stomping over memory
supposedly in user space then it will break things.  Another possibility is
just that you're running out of RAM, or that it's becoming too fragmented,
since kernel and userspace use the same memory pools.

You'll need to carefully go over the code in your driver, looking not just
at the allocations, but also the deallocations and use of pointers.  In
particular look for cases where you're potentially accessing a pointer after
it has been deallocated, or accessing beyond the bounds of a buffer
allocation.  Also watch out for race conditions and similar concurrency
issues (remember that the kernel is potentially reentrant in many places).


___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev