public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Can jffs2 support XIP extensions?
@ 2004-08-24 14:43 Christopher M Bergeron
  2004-08-24 15:10 ` David Woodhouse
  0 siblings, 1 reply; 8+ messages in thread
From: Christopher M Bergeron @ 2004-08-24 14:43 UTC (permalink / raw)
  To: linux-mtd

Does anyone know if jffs2 can utilize/support XIP (eXecute In Place)?  
I've read that only CramFS can work wit it.  I'm a little unclear about 
how XIP works and it's implications with jffs2 / CramFS.
Can anyone shed any light on this for me?

Much thanks in advance...
Chris B.


P.S.
Thanks for the replies re: my CVS question (and ipv6).  I was hoping 
that ipv4 would have been restored by now, but I think this will give me 
the excuse to finally upgrade to ipv6.  Also, thanks for the howto link 
David...!

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

* Re: Can jffs2 support XIP extensions?
  2004-08-24 14:43 Can jffs2 support XIP extensions? Christopher M Bergeron
@ 2004-08-24 15:10 ` David Woodhouse
  2004-08-24 18:27   ` Christopher M Bergeron
  2004-08-24 18:54   ` Todd Poynor
  0 siblings, 2 replies; 8+ messages in thread
From: David Woodhouse @ 2004-08-24 15:10 UTC (permalink / raw)
  To: Christopher M Bergeron; +Cc: linux-mtd

On Tue, 2004-08-24 at 10:43 -0400, Christopher M Bergeron wrote:
> Does anyone know if jffs2 can utilize/support XIP (eXecute In Place)?  
> I've read that only CramFS can work wit it.  I'm a little unclear about 
> how XIP works and it's implications with jffs2 / CramFS.
> Can anyone shed any light on this for me?

If you want Linux rather than something smaller, like eCos, then you
almost certainly don't want XIP.

XIP is for obvious reasons mutually exclusive with compression. You
throw away flash space in order to save RAM and to make data and code
access by the CPU slower.

Flash is more expensive than RAM -- your board will be cheaper if you
use half the flash and compress its contents, than it would be if you
use half the _RAM_ and XIP instead.

If you really really really care about power, then you might care that
RAM actually takes more power at runtime than flash does. But then we'd
just laugh at you for using Linux instead of something much smaller and
in particular without a periodic timer tick :)

In order to use XIP, you muck with the MMU to make mmap() of files on
the file system actually set up page tables to point at the flash chip.
You then have to care a lot about leaving the flash chip in read mode at
all times when userspace might be looking at it. 

Because cramfs is a read-only file system, it's easy enough to do this.
The files which are marked for XIP are carefully arranged so that each
logical page is physically page-aligned on the medium to allow the MMU
to map it. It would be a lot harder to achieve that in JFFS2, and
largely pointless. 

The only reason for using XIP under Linux which is even vaguely sane is
to improve boot time. But since the figures shown at OLS were comparing
apples and oranges -- compressed non-XIP kernel vs. uncompressed XIP
kernel, with a lot of the time taken being the actual decompression, I'm
not entirely convinced. There may well be better alternatives, without
the runtime and hardware overhead.

-- 
dwmw2

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

* Re: Can jffs2 support XIP extensions?
  2004-08-24 15:10 ` David Woodhouse
@ 2004-08-24 18:27   ` Christopher M Bergeron
  2004-08-24 18:50     ` George G. Davis
  2004-08-24 18:54   ` Todd Poynor
  1 sibling, 1 reply; 8+ messages in thread
From: Christopher M Bergeron @ 2004-08-24 18:27 UTC (permalink / raw)
  To: linux-mtd

Unfortunately, boot time is my primary concern.  However, I'm planning 
on booting an uncompressed linux kernel which should save quite a bit of 
boot time.  I'd be curious to know how much of an improvement is gained 
by using XIP in an uncompressed kernel without XIP - versus - 
uncompressed kernel _with_ XIP.

I would tend to think the difference is quite small, or OLS wouldn't 
have benchmarked with a compressed kernel against an uncompressed one.  
I think I'll steer clear of XIP for now...

Since we're on the topic, does anyone have any pointers, website links 
or kernel patches that have tips on accelerating kernel boot time?

Thanks!
-CB



David Woodhouse wrote:

>On Tue, 2004-08-24 at 10:43 -0400, Christopher M Bergeron wrote:
>  
>
>>Does anyone know if jffs2 can utilize/support XIP (eXecute In Place)?  
>>I've read that only CramFS can work wit it.  I'm a little unclear about 
>>how XIP works and it's implications with jffs2 / CramFS.
>>Can anyone shed any light on this for me?
>>    
>>
>
>If you want Linux rather than something smaller, like eCos, then you
>almost certainly don't want XIP.
>
>XIP is for obvious reasons mutually exclusive with compression. You
>throw away flash space in order to save RAM and to make data and code
>access by the CPU slower.
>
>Flash is more expensive than RAM -- your board will be cheaper if you
>use half the flash and compress its contents, than it would be if you
>use half the _RAM_ and XIP instead.
>
>If you really really really care about power, then you might care that
>RAM actually takes more power at runtime than flash does. But then we'd
>just laugh at you for using Linux instead of something much smaller and
>in particular without a periodic timer tick :)
>
>In order to use XIP, you muck with the MMU to make mmap() of files on
>the file system actually set up page tables to point at the flash chip.
>You then have to care a lot about leaving the flash chip in read mode at
>all times when userspace might be looking at it. 
>
>Because cramfs is a read-only file system, it's easy enough to do this.
>The files which are marked for XIP are carefully arranged so that each
>logical page is physically page-aligned on the medium to allow the MMU
>to map it. It would be a lot harder to achieve that in JFFS2, and
>largely pointless. 
>
>The only reason for using XIP under Linux which is even vaguely sane is
>to improve boot time. But since the figures shown at OLS were comparing
>apples and oranges -- compressed non-XIP kernel vs. uncompressed XIP
>kernel, with a lot of the time taken being the actual decompression, I'm
>not entirely convinced. There may well be better alternatives, without
>the runtime and hardware overhead.
>
>  
>

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

* Re: Can jffs2 support XIP extensions?
  2004-08-24 18:27   ` Christopher M Bergeron
@ 2004-08-24 18:50     ` George G. Davis
  0 siblings, 0 replies; 8+ messages in thread
From: George G. Davis @ 2004-08-24 18:50 UTC (permalink / raw)
  To: Christopher M Bergeron; +Cc: linux-mtd

On Tue, Aug 24, 2004 at 02:27:01PM -0400, Christopher M Bergeron wrote:
<snip>
> Since we're on the topic, does anyone have any pointers, website links 
> or kernel patches that have tips on accelerating kernel boot time?

http://tree.celinuxforum.org/pubwiki/moin.cgi/BootupTimeWorkingGroup

<snip>

--
Regards,
George

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

* Re: Can jffs2 support XIP extensions?
  2004-08-24 15:10 ` David Woodhouse
  2004-08-24 18:27   ` Christopher M Bergeron
@ 2004-08-24 18:54   ` Todd Poynor
  2004-08-24 19:10     ` Joshua Wise
  1 sibling, 1 reply; 8+ messages in thread
From: Todd Poynor @ 2004-08-24 18:54 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd

David Woodhouse wrote:

> If you really really really care about power, then you might care that
> RAM actually takes more power at runtime than flash does. But then we'd
> just laugh at you for using Linux instead of something much smaller and
> in particular without a periodic timer tick :)

A debate of the merits of various OS technologies for battery-powered 
portable devices would be interesting, but a number of awfully bright 
product designers are choosing Linux for *some* reason. ;)  Makers of 
cell phones do really really care about power.  And periodic timer ticks 
are being worked on (such as the Variable Scheduling Timeouts technology 
of George Anzinger's High Res Timers project).

> The only reason for using XIP under Linux which is even vaguely sane is
> to improve boot time. But since the figures shown at OLS were comparing
> apples and oranges -- compressed non-XIP kernel vs. uncompressed XIP
> kernel, with a lot of the time taken being the actual decompression, I'm
> not entirely convinced. There may well be better alternatives, without
> the runtime and hardware overhead.

For the kernel boot time it's true that boot times tend to be dominated 
by the decompression step.  I measured this on a couple platforms at one 
point (some of my measurements may have been in the OLS presentation, 
not sure).  I didn't directly measure kernel boot times of an 
uncompressed non-XIP kernel, but would roughly guess an uncompressed 
non-XIP kernel would boot to /sbin/init in only about a few tens of 
milliseconds more time (I'm guessing about the increased time to copy an 
uncompressed tetx image to RAM) than an XIP kernel on a 266MHz PowerPC 
405LP, and 168MHz OMAP ARM 926T is probably similar (it seems to better 
deal with the cache effects).

Application startup times non-XIP vs. XIP, compared to either CramFS 
compressed or ROMFS uncompressed, can add up to a more significant 
savings -- about 2 seconds for a TinyX startup and app start in the 
configuration I tried.  I have more data on kernel boot time, 
application startup, system sizing, and runtime performance benchmarks 
that I can send to anyone interested.

And yes, lower-overhead alternative technologies to help reduce SDRAM 
needs and sub-second startup times for consumer electronics would be 
welcome and are the subject of various other projects...

-- 
Todd Poynor
MontaVista Software

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

* Re: Can jffs2 support XIP extensions?
  2004-08-24 18:54   ` Todd Poynor
@ 2004-08-24 19:10     ` Joshua Wise
  2004-08-25  6:08       ` Der Herr Hofrat
  0 siblings, 1 reply; 8+ messages in thread
From: Joshua Wise @ 2004-08-24 19:10 UTC (permalink / raw)
  To: Todd Poynor; +Cc: linux-mtd, David Woodhouse

> For the kernel boot time it's true that boot times tend to be dominated 
> by the decompression step.  I measured this on a couple platforms at one 
> point (some of my measurements may have been in the OLS presentation, 
> not sure).  I didn't directly measure kernel boot times of an 
> uncompressed non-XIP kernel, but would roughly guess an uncompressed 
> non-XIP kernel would boot to /sbin/init in only about a few tens of 
> milliseconds more time (I'm guessing about the increased time to copy an 
> uncompressed tetx image to RAM) than an XIP kernel on a 266MHz PowerPC 
> 405LP, and 168MHz OMAP ARM 926T is probably similar (it seems to better 
> deal with the cache effects).
Also remember that on many systems, flash is a lot slower than RAM, so 
it is entirely possible that an XIP kernel would actually be _SLOWER_ 
than non-XIP!

joshua

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

* Re: Can jffs2 support XIP extensions?
  2004-08-24 19:10     ` Joshua Wise
@ 2004-08-25  6:08       ` Der Herr Hofrat
  2004-08-25 22:04         ` Todd Poynor
  0 siblings, 1 reply; 8+ messages in thread
From: Der Herr Hofrat @ 2004-08-25  6:08 UTC (permalink / raw)
  To: Joshua Wise; +Cc: linux-mtd, David Woodhouse

> > For the kernel boot time it's true that boot times tend to be dominated 
> > by the decompression step.  I measured this on a couple platforms at one 
> > point (some of my measurements may have been in the OLS presentation, 
> > not sure).  I didn't directly measure kernel boot times of an 
> > uncompressed non-XIP kernel, but would roughly guess an uncompressed 
> > non-XIP kernel would boot to /sbin/init in only about a few tens of 
> > milliseconds more time (I'm guessing about the increased time to copy an 
> > uncompressed tetx image to RAM) than an XIP kernel on a 266MHz PowerPC 
> > 405LP, and 168MHz OMAP ARM 926T is probably similar (it seems to better 
> > deal with the cache effects).
> Also remember that on many systems, flash is a lot slower than RAM, so 
> it is entirely possible that an XIP kernel would actually be _SLOWER_ 
> than non-XIP!
>
there are a number of examples of boot times and runtime performance posted
on the web and ALL of them show that the boot times of XIP
enabled kernels are primarily lower due to the kernel
not being decompressed and other steps actually being slower.

   Table of bootup times:

   Boot Stage                         Non-XIP  Time XIP Time
   Copy kernel to RAM                 85 ms    12 ms 
   Decompress kernel                  453 ms   0 ms
   Kernel time to initialize
   (time to first user space program) 819 ms   882 ms
   Total kernel boot time             1357 ms  894 ms
   Reduction:                         -        463 ms

(from: http://tree.celinuxforum.org/pubwiki/moin.cgi/KernelXIP)

The execution times of most system calls are clearly longer (not sure if
it was a 405/266 or a OMAP/168) fork was reported at 7.1 vs 4.8 us , trivial 
system calls will be about the same time (did not find the reference - if of 
interest I can dig it out).

The only (?) real argument for XIP is system RAM requirements on very small 
systems (see: http://www.denx.de/twiki/publish/DULG/ConfigureLinuxForXIP.htm) 
 
hofrat
 

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

* Re: Can jffs2 support XIP extensions?
  2004-08-25  6:08       ` Der Herr Hofrat
@ 2004-08-25 22:04         ` Todd Poynor
  0 siblings, 0 replies; 8+ messages in thread
From: Todd Poynor @ 2004-08-25 22:04 UTC (permalink / raw)
  To: Der Herr Hofrat; +Cc: David Woodhouse, linux-mtd

Der Herr Hofrat wrote:

> there are a number of examples of boot times and runtime performance posted
> on the web and ALL of them show that the boot times of XIP
> enabled kernels are primarily lower due to the kernel
> not being decompressed and other steps actually being slower.
> 
>    Table of bootup times:
> 
>    Boot Stage                         Non-XIP  Time XIP Time
>    Copy kernel to RAM                 85 ms    12 ms 
>    Decompress kernel                  453 ms   0 ms
>    Kernel time to initialize
>    (time to first user space program) 819 ms   882 ms
>    Total kernel boot time             1357 ms  894 ms
>    Reduction:                         -        463 ms
> 
> (from: http://tree.celinuxforum.org/pubwiki/moin.cgi/KernelXIP)

Yes, those are the numbers I measured on a PPC405LP.  The step of 
copying the necessary kernel image is also slower non-XIP, since XIP 
copies only the initialized data sections.  If an uncompressed non-XIP 
image is used then that particular number will increase, partially 
offseting the gain due to skipping the decompression.  Depending on the 
sizes involved XIP will likely be faster by a few tens or hundreds of 
milliseconds.  When combined with application XIP of several executables 
and shared libraries from a CramFS filesystem this can add up to a 
significant gain; if ROMFS is used to avoid compression then the 
difference is less but still significant.

> The execution times of most system calls are clearly longer (not sure if
> it was a 405/266 or a OMAP/168) fork was reported at 7.1 vs 4.8 us , trivial 
> system calls will be about the same time (did not find the reference - if of 
> interest I can dig it out).

Should be 7.1ms vs. 4.7ms, on OMAP (and 4.1ms vs. 1.1ms on PPC405LP, 
which seems to have a lower locality of reference or some other 
uninvestigated disadvantage running XIP).  I've got the full LMbench 
runs and some additional experimentation that produced those numbers as 
well.  The system will definitely run overall slower due to the slower 
memory, but certain operations such as the first exec of an image will 
be faster -- subsequent exec's of the same image may be as fast or 
faster after the block cache is warmed.

> The only (?) real argument for XIP is system RAM requirements on very small 
> systems (see: http://www.denx.de/twiki/publish/DULG/ConfigureLinuxForXIP.htm) 

System startup time reduction (including applications) is certainly a 
consideration as well.  After evaluating unit production cost, power 
consumption, startup time, and performance, some cell phone designers 
have chosen to go the XIP route, although no word on whether they'd 
choose it again the next time. ;)

-- 
Todd Poynor
MontaVista Software

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

end of thread, other threads:[~2004-08-25 22:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-24 14:43 Can jffs2 support XIP extensions? Christopher M Bergeron
2004-08-24 15:10 ` David Woodhouse
2004-08-24 18:27   ` Christopher M Bergeron
2004-08-24 18:50     ` George G. Davis
2004-08-24 18:54   ` Todd Poynor
2004-08-24 19:10     ` Joshua Wise
2004-08-25  6:08       ` Der Herr Hofrat
2004-08-25 22:04         ` Todd Poynor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox