Skip to contentSkip to conversation

Execute in place

DISCUSSION Phillip Susi 6 participants 9 messages May 1, 2007 – May 3, 2007

lore
Share & tools
lore
#0 lore raw

I seem to remember seeing some patches go by at some point that allowed one of the rom type embeded system filesystems to directly execute binaries out of the original rom memory rather than copying them to ram first, then executing from there. I was wondering if rootfs or tmpfs support such execute in place today, or if binaries executed from there have their code segments duplicated in ram?

#1 lore raw
Quoted 6 lines · Phillip Susi

I seem to remember seeing some patches go by at some point that allowed one of the rom type embeded system filesystems to directly execute binaries out of the original rom memory rather than copying them to ram first, then executing from there. I was wondering if rootfs or tmpfs support such execute in place today, or if binaries executed from there have their code segments duplicated in ram?

Only ext2 supports it today: see Documentation/filesystems/xip.txt

Hugh

#2 lore raw
Quoted 9 lines · Hugh Dickins
Quoted 6 lines · Phillip Susi

I seem to remember seeing some patches go by at some point that allowed one of the rom type embeded system filesystems to directly execute binaries out of the original rom memory rather than copying them to ram first, then executing from there. I was wondering if rootfs or tmpfs support such execute in place today, or if binaries executed from there have their code segments duplicated in ram?

Only ext2 supports it today: see Documentation/filesystems/xip.txt

As I understand it, xip avoids the page cache copy. But tmpfs already lives in the page cache (or swap), so avoiding that "copy" is impossible. But I always expected tmpfs to implicitly due its own kind of xip, i.e. that it doesn't have to store its stuff in the page cache twice. Are you saying that this isn't true?

According to Documentation/filesystems/xip.txt the ramdisk driver does something similar, pushing the data into the page cache and discarding the original data.

thanks,
Björn

#3 lore raw
Quoted 9 lines · Björn Steinbrink
Quoted 8 lines · Hugh Dickins
Quoted 6 lines · Phillip Susi

I seem to remember seeing some patches go by at some point that allowed one of the rom type embeded system filesystems to directly execute binaries out of the original rom memory rather than copying them to ram first, then executing from there. I was wondering if rootfs or tmpfs support such execute in place today, or if binaries executed from there have their code segments duplicated in ram?

Quoted 7 lines
Quoted 1 line

Only ext2 supports it today: see Documentation/filesystems/xip.txt

As I understand it, xip avoids the page cache copy. But tmpfs already lives in the page cache (or swap), so avoiding that "copy" is impossible. But I always expected tmpfs to implicitly due its own kind of xip, i.e. that it doesn't have to store its stuff in the page cache twice. Are you saying that this isn't true?

tmpfs doesn't store its stuff in the page cache twice: that's true, and I didn't mean to imply otherwise. But tmpfs doesn't contain any support for rom memory: you'd have to copy from rom to tmpfs to use it.

Hugh

#4 lore raw
Quoted 5 lines · Hugh Dickins

tmpfs doesn't store its stuff in the page cache twice: that's true, and I didn't mean to imply otherwise. But tmpfs doesn't contain any support for rom memory: you'd have to copy from rom to tmpfs to use it.

Hugh

The question is, when you execute a binary on tmpfs, does its code segment get mapped directly where it's at in the buffer cache, or does it get copied to another page for the executing process? At least, assuming this is possible due to the vma and file offsets of the segment being aligned.

#5 lore raw
Quoted 9 lines · Phillip Susi
Quoted 3 lines · Hugh Dickins

tmpfs doesn't store its stuff in the page cache twice: that's true, and I didn't mean to imply otherwise. But tmpfs doesn't contain any support for rom memory: you'd have to copy from rom to tmpfs to use it.

The question is, when you execute a binary on tmpfs, does its code segment get mapped directly where it's at in the buffer cache, or does it get copied to another page for the executing process? At least, assuming this is possible due to the vma and file offsets of the segment being aligned.

Its pages are mapped directly into the executing process, without copying.

Hugh

#6 lore raw
In reply to Hugh Dickins
Quoted 9 lines · Hugh Dickins
Quoted 6 lines · Phillip Susi

I seem to remember seeing some patches go by at some point that allowed one of the rom type embeded system filesystems to directly execute binaries out of the original rom memory rather than copying them to ram first, then executing from there. I was wondering if rootfs or tmpfs support such execute in place today, or if binaries executed from there have their code segments duplicated in ram?

Only ext2 supports it today: see Documentation/filesystems/xip.txt

IIRC JFFS2 also supports XIP.

Erik

Signature · 2 lines
They're all fools. Don't worry. Darwin may be slow, but he'll
eventually get them. -- Matthew Lammers in alt.sysadmin.recovery
#7 lore raw
Quoted 5 lines · Erik Mouw
Quoted 2 lines · Hugh Dickins

Only ext2 supports it today: see Documentation/filesystems/xip.txt

IIRC JFFS2 also supports XIP.

Definitely not. AXFS does, if you want to consider out-of-tree patches.

Jörn

Signature · 3 lines
Fools ignore complexity.  Pragmatists suffer it.
Some can avoid it.  Geniuses remove it.
-- Perlis's Programming Proverb #58, SIGPLAN Notices, Sept.  1982
#8 lore raw
In reply to Hugh Dickins

On Wed 2 May 2007 10:04, Hugh Dickins pondered:

Quoted 11 lines · Phillip Susi
Quoted 7 lines

I seem to remember seeing some patches go by at some point that allowed one of the rom type embeded system filesystems to directly execute binaries out of the original rom memory rather than copying them to ram first, then executing from there. I was wondering if rootfs or tmpfs support such execute in place today, or if binaries executed from there have their code segments duplicated in ram?

Only ext2 supports it today: see Documentation/filesystems/xip.txt

Depends on if it is a noMMU or MMU platform.

Since noMMU platforms can't re-arrange non-contiguous blocks (which appears in a read/write ext2 file system) we need to use a read only romfs which applications are guaranteed to be contiguous by design.

I don't think the noMMU case is documented in xip.txt

-Robin