LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 08-25-2009, 10:25 AM   #1
sanitynotvanity
Member
 
Registered: Jul 2007
Location: UK
Distribution: LFS 6.8, Android, Ubuntu 10.10, XP, 7 (HB,HP,Ultimate)
Posts: 41

Rep: Reputation: 15
What might i also need to recompile from changing major options in the kernel config


Hi,

This is just a thought that I haven't had the time to exercise yet, so forgive me if its a little un-prepared.

I have a situation where by a c++ program of mine locks up after i have recompiled my kernel (only changed the processor option from a generic 486 to the specific processor) (that is the real processor, no mistake) VIA C7.

So i know that GCC needs to be compiled for the kernel and the kernel for the GCC (the chicken and the egg situation). This was all taken care off in the early days of building this operating system (LFS 6.4).

I know that if I am right to be thinking down these lines that there will be plenty of documentation around the issue - in fact too much documentation,

but I got lost

I don't need lengthy explanations, I am only asking if anyone knows of a particular link that I might need to spend my time reading.

Please let me know,

Andy
 
Old 08-25-2009, 12:43 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,973
Blog Entries: 11

Rep: Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877
What an odd occurrence. I would have thought that the C7 has a
superset of the 486 instruction set (I haven't read up on this,
it's just the fact that the C7 is so much newer). Anyway:

I don't think you need to re-compile gcc ... all it should take
is to have your code recompiled.

Have you examined the part where your c++ program gets stuck
under gdb?


Cheers,
Tink
 
Old 08-25-2009, 12:44 PM   #3
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by sanitynotvanity View Post
So i know that GCC needs to be compiled for the kernel and the kernel for the GCC (the chicken and the egg situation).
You just need to make sure g++ uses the right "-march" option. This patch posted to LKML describes what the C7 kernel option actually does:
Re: [PATCH] Add an option for the VIA C7 which sets appropriate L1 cache
So, if build your program with "-march=i686" it should produce a binary that does not lock up.

Are you linking against any external libraries?

Last edited by David1357; 08-25-2009 at 04:27 PM. Reason: Added question about external libraries; Fixed a typo.
 
Old 08-25-2009, 01:27 PM   #4
sanitynotvanity
Member
 
Registered: Jul 2007
Location: UK
Distribution: LFS 6.8, Android, Ubuntu 10.10, XP, 7 (HB,HP,Ultimate)
Posts: 41

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Tinkster View Post
What an odd occurrence. I would have thought that the C7 has a
superset of the 486 instruction set (I haven't read up on this,
it's just the fact that the C7 is so much newer). Anyway:

I don't think you need to re-compile gcc ... all it should take
is to have your code recompiled.

Have you examined the part where your c++ program gets stuck
under gdb?


Cheers,
Tink
Thanks for the response.

I can't use gdb due to the joys of using RTAI...

the program doesnt actually freeze sorry, but it does sit there consuming 100% cpu according to top. (and the system is VERY sluggish)

bizarre that i am actually getting the best real time results yet...
 
Old 08-25-2009, 01:28 PM   #5
sanitynotvanity
Member
 
Registered: Jul 2007
Location: UK
Distribution: LFS 6.8, Android, Ubuntu 10.10, XP, 7 (HB,HP,Ultimate)
Posts: 41

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by David1357 View Post
You just need to make sure g++ uses the right "-march" option. This patch posted to LKML describes what the C7 kernel option actually does:
Re: [PATCH] Add an option for the VIA C7 which sets appropriate L1 cache
So, if build your program with "-march=i686" and it should produce a binary that does not lock up.

Are you linking against any external libraries?
This sounds VERY promising

im stuck in unpaid over-time trying to get this going, this post has actually re-lifted my hopes!

ALSO, yes i am using 3rd party libraries. im linking with RTAI :S

Last edited by sanitynotvanity; 08-25-2009 at 05:15 PM.
 
Old 08-25-2009, 05:44 PM   #6
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by sanitynotvanity View Post
The program doesn't actually freeze sorry, but it does sit there consuming 100% cpu according to top. (and the system is VERY sluggish)
This is a completely different problem from a program "crashing" or "locking up". In fact, this may be completely normal behavior for your program. If your program is very CPU intensive, and never calls "sleep" or "sched_yield", this is exactly the behavior you would expect.

Also, I was very surprised that a kernel compiled with "-march=i686" would have problems running binaries compiled with "-march=i486". So, this set of symptoms makes more sense to me.

Quote:
Originally Posted by sanitynotvanity View Post
bizarre that i am actually getting the best real time results yet...
Sounds like your kernel is fine and your program is fine. If you want your GUI to be more responsive, you will have to put in the occasional "sleep" or "sched_yield" into your program.
 
Old 08-25-2009, 05:48 PM   #7
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by sanitynotvanity View Post
im stuck in unpaid over-time trying to get this going, this post has actually re-lifted my hopes!
You should probably look at compiling your code with profiling enabled. This is a link to instructions for enabling profiling and using gprof.
 
Old 08-26-2009, 02:32 AM   #8
sanitynotvanity
Member
 
Registered: Jul 2007
Location: UK
Distribution: LFS 6.8, Android, Ubuntu 10.10, XP, 7 (HB,HP,Ultimate)
Posts: 41

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by David1357 View Post
This is a completely different problem from a program "crashing" or "locking up". In fact, this may be completely normal behavior for your program. If your program is very CPU intensive, and never calls "sleep" or "sched_yield", this is exactly the behavior you would expect.

Also, I was very surprised that a kernel compiled with "-march=i686" would have problems running binaries compiled with "-march=i486". So, this set of symptoms makes more sense to me.



Sounds like your kernel is fine and your program is fine. If you want your GUI to be more responsive, you will have to put in the occasional "sleep" or "sched_yield" into your program.
Let me start again,

I have a program that uses RTAI. Its written in C++ and its works fine when the kernel is complied for a 486 processor. its CPU usuage is between 20 and 40%.

After I have recompiled my kernel and changed the processor family from 486 to VIA C7 my program will then consume 100% of the processor.

sorry for not being more specific in my first post
 
Old 08-26-2009, 10:11 AM   #9
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by sanitynotvanity View Post
I have a program that uses RTAI. Its written in C++ and its works fine when the kernel is complied for a 486 processor. its CPU usuage is between 20 and 40%.
So what is throttling it from using 100% in this case? Is it doing some kind of hardware I/O that is slower when run against a kernel compiled with "-march=i486"? Is it waiting for user input? Is it reading or writing to a hard drive?

Quote:
Originally Posted by sanitynotvanity View Post
After I have recompiled my kernel and changed the processor family from 486 to VIA C7 my program will then consume 100% of the processor.
Is there anything in your program that will throttle its performance (e.g. wait for user input, read from a file, wait for a digital I/O line to change state)? If there is nothing preventing your program from running as fast as it can, that is what it will do: run as fast as it can. This translates to 100% CPU usage.

Changing the kernel options so that it builds with "-march=i686" may have removed a throughput bottleneck that was preventing your program from running at maximum speed.

If you do not want your program to consume 100% of the CPU with the new kernel, you may have to put a "sleep" or "sched_yield" somewhere in one of your loops.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache suEXEC recompile for new config options Thom_Redhat Red Hat 4 04-27-2009 10:35 AM
When recompile one kernel, it's necessary rename config for oldconfig??? xcore_on Linux - Newbie 1 05-20-2006 04:10 AM
Kernel config options elmu Linux - General 2 11-02-2005 11:15 AM
kernel recompile ethernet options riemann_noodles Slackware 3 08-02-2005 04:24 PM
when changing values under make xconfig, need to recompile the whole kernel? sirpelidor Linux - Newbie 2 02-01-2004 11:15 PM


All times are GMT -5. The time now is 09:32 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration