Skip to contentSkip to conversation

Fast testing

DISCUSSION Dragoslav Zaric 6 participants 9 messages Apr 14, 2009 – Apr 15, 2009

lore
Share & tools
lore
#0 lore raw

Hello,

I have question regarding fast testing of some change in some kernel source file. Since rebooting is a long process, there must be way to test some change faster [of course only if source file is not some boot connected file, but maybe this is also doable].

This is question:

When system is running, file that drives the system is "vmlinux" executable and it is located in "/" or "/boot" folder. Let's say you change some kernel source file and run "make" [this is fast since "make" should see that just few files are changed]. After "make install" you should now have new "vmlinux" file. Since state of cpu registers and memory locations determine current system state, the change in binary system driver ["vmlinux"] should not freeze system ? So if I copy new vmlinux over old vmlinux file can I see change immediately ? I think it should continue to drive system without problem because vmlinux is binary algorithm file, it does not contain any data regarding current system state ? Also this assumes that your change does not affect some large things, like memory segmentation tables and paging, let's say it is more algorithmic and not structure change, because it is obvious if you have structural change, current memory and register states probably won't map
into new structure without system freeze.

Thanks,

Dragoslav Zaric,

[Programmer, M.Sc Astrophysics]

#1 lore raw
Quoted 11 lines · Dragoslav Zaric

Hello,

I have question regarding fast testing of some change in some kernel source file. Since rebooting is a long process, there must be way to test some change faster [of course only if source file is not some boot connected file, but maybe this is also doable].

This is question:

When system is running, file that drives the system is "vmlinux" executable and it is located in "/" or "/boot" folder.

Nope.

Kernel code (and data) is not demand-paged. The kernel image is fully loaded into memory at boot-time. Changing /boot/vmlinuz will have no effect on the running kernel. And there are several other reasons why what you describe would not work.

What you can do is compile some code as a module, and remove and re-insert it to apply changes. This doesn't work for core code or your main disk driver though :-).

Alan

#2 lore raw

Hmm,

Ok, I found this on internet:
"The bzImage file is in a specific format: It contains concatenated bootsect.o + setup.o + misc.o + piggy.o.
piggy.o contains the gzipped vmlinux file in its data section (ELF)
(see compressed/Makefile piggy.o)."

So after we make new bzImage and "somehow" extract these four .o files than we can manually load
kernel image into memory ? We can just run same routines that are run during the boot, but we can skip
everything till piggy.o file, because the vmlinux file is in piggy.o ?

thanks,

Dragoslav Zaric

[Programmer, M.Sc Astrophysics]

#4 lore raw

[Dragoslav Zaric - Tue, Apr 14, 2009 at 04:24:36PM +0200]

|
| The idea to compile targeted code like module is great,
| so when changed, re-insert resolves problem fast and you
| can see result immediately :)
| 
| thanks
| 

But don't be surprised if system gets down :) Dragoslav (since I've been CC'ed on thread) I believe the thread contains the mostly all testing techniques I can imagine. qemu + thin distro image is my preferred. And a real laptop as well.

Cyrill

#5 lore raw
In reply to Dragoslav Zaric

Dragoslav Zaric <[email protected]> writes:

As others pointed out vmlinux is not demand paged.

Quoted 1 line

Since rebooting is a long process,

The trick is to not make it a long process. Some ways to do that:

- Test simple changes in emulation. Emulators tend to boot faster than real systems.
- Use a stripped down Linux distribution that boots fast. I found that just using a old Linux distribution (without udev with static /dev) and minimal services boots dramatically faster. I use opensuse 10.0 for that.
- When you need to test on a real system use nfsroot with kernel boot through PXE. First that saves you one iteration of rebooting/copying to update a kernel. And then the NFS server can keep the small nfsroot cached in memory and then deliver it immediately.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#6 lore raw
In reply to Dragoslav Zaric
Quoted 4 lines · On Tue, 14 Apr 2009 11:55:10 +0200 Dragoslav Zaric…

Hello,

I have question regarding fast testing of some change in some kernel source file. Since rebooting is a long process, there must be way to

Rebooting is bloody fast for me (0.7 seconds for the kernel start, about 3 to 4 seconds for the whole boot)....

not sure that doing weird magic to save that is worth it...

Signature · 3 lines
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
#7 lore raw

Well Arjan it looks that you have a nice laptop if that is your reboot time :)

The idea about this is that when you have some idea and you write code, doing reboot and stuff can make you forgot your idea. If you write normal program you probably press "build" or type "gcc" at least 10 times to see what is going on. I think that only thing necessary is: system to boot one time and then you can load image in ram memory as many times as you want. So I am not sure if this is ok, but at least I will try.

But I am not saying that if this works, the changes are going to crush or freeze system more often than produce any kind of result :)

For example, we can boot from GRUB command line, so this would be something like falling back to GRUB command line [to that point] and load [any] image in ram memory.

thanks,

Dragoslav Zaric

[Programmer, M.Sc Astrophysics]

#8 lore raw
In reply to Arjan van de Ven
Quoted 8 lines · Arjan van de Ven
Quoted 2 lines · On Tue, 14 Apr 2009 11:55:10 +0200 Dragoslav Zaric…

I have question regarding fast testing of some change in some kernel source file. Since rebooting is a long process, there must be way to

Rebooting is bloody fast for me (0.7 seconds for the kernel start, about 3 to 4 seconds for the whole boot)....

Wow. Nice machine. I wish I had one like that. And how long until the GUI is usable again and you can actually continue working?

For comparison: my 3.4 GHz Pentium D takes 30 secs for kernel start (ie. until it begins looking for the filesystems), 6 mins for fsck if it happens to decide my filesystems have gone too long without checking, 2 mins until the graphical login screen appears, and 5 mins from logging in to the GUI being completely present.

Quoted 1 line

not sure that doing weird magic to save that is worth it...

Not for systems like yours, that's for sure, but perhaps for systems like mine.

Thanks,
Tilman

Signature · 4 lines
Tilman Schmidt                    E-Mail: [email protected]
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)