<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://elinux.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://elinux.org/index.php?title=Data_Read_In_Place&amp;feed=atom&amp;action=history</id>
		<title>Data Read In Place - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://elinux.org/index.php?title=Data_Read_In_Place&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=Data_Read_In_Place&amp;action=history"/>
		<updated>2013-05-20T14:02:24Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.21alpha</generator>

	<entry>
		<id>http://elinux.org/index.php?title=Data_Read_In_Place&amp;diff=33835&amp;oldid=prev</id>
		<title>Tim Bird: add to category System Size</title>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=Data_Read_In_Place&amp;diff=33835&amp;oldid=prev"/>
				<updated>2011-02-05T00:56:35Z</updated>
		
		<summary type="html">&lt;p&gt;add to category System Size&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 00:56, 5 February 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 137:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 137:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; return N_(&amp;quot;failed to memory lock segment from shared object&amp;quot;);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; return N_(&amp;quot;failed to memory lock segment from shared object&amp;quot;);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Category:System Size]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key elinux:diff:version:1.11a:oldid:21959:newid:33835 --&gt;
&lt;/table&gt;</summary>
		<author><name>Tim Bird</name></author>	</entry>

	<entry>
		<id>http://elinux.org/index.php?title=Data_Read_In_Place&amp;diff=21959&amp;oldid=prev</id>
		<title>Tim Bird: /* Documents */ use local link for Mizuyama presentation</title>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=Data_Read_In_Place&amp;diff=21959&amp;oldid=prev"/>
				<updated>2010-06-25T20:18:50Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Documents: &lt;/span&gt; use local link for Mizuyama presentation&lt;/span&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 20:18, 25 June 2010&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 74:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 74:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Documents ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Documents ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Information about this technology is included in the Panasoinc presentation &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;available &lt;/del&gt;[&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;http://tree&lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;celinuxforum.org/CelfPubWiki/ITJ2005Detail1_2d2?action=AttachFile&amp;amp;do=get&amp;amp;target=&lt;/del&gt;CELF_Technical_Jamboree_June13.pdf &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;here&lt;/del&gt;]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Information about this technology is included in the Panasoinc presentation &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;made at the CELF &lt;/ins&gt;[&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[International Technical Jamboree]]&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;** see pages 6 - 12 of the presentation&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;** [[Media:&lt;/ins&gt;CELF_Technical_Jamboree_June13.pdf&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;|Making Mobile Phone with CE Linux]&lt;/ins&gt;] &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;by Masashige Mizuyama (Panasonic Mobile Communications), June 2005&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;*&lt;/ins&gt;** see pages 6 - 12 of the presentation&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== draft patch ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== draft patch ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Tim Bird</name></author>	</entry>

	<entry>
		<id>http://elinux.org/index.php?title=Data_Read_In_Place&amp;diff=1965&amp;oldid=prev</id>
		<title>RBot: Bot (Edward's framework)</title>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=Data_Read_In_Place&amp;diff=1965&amp;oldid=prev"/>
				<updated>2007-03-06T03:32:13Z</updated>
		
		<summary type="html">&lt;p&gt;Bot (Edward&amp;#039;s framework)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Table Of Contents:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This page has information about &amp;quot;Data Read-In-Place&amp;quot;, which is of interest to CE Linux Forum members,&lt;br /&gt;
because it allows data pages to reside on ROM or flash, until they are written to.  This is essentially&lt;br /&gt;
a form of XIP, or copy-on-write, for data pages.  XIP is used to keep text segment pages in flash&lt;br /&gt;
permanently.  This technique (&amp;quot;DRIP&amp;quot;) is used to keep data pages in flash until they are written to.  Since&lt;br /&gt;
many application data pages are never written to, the net effect is a substantial reduction in &lt;br /&gt;
RAM usage for application data segments.  This feature was also called &amp;quot;Data Allocate On Write&amp;quot; previously,&lt;br /&gt;
but the name &amp;quot;Data Read In Place&amp;quot; is closer to the already-existing term for text (Execute In Place), and&lt;br /&gt;
is now preferred.&lt;br /&gt;
&lt;br /&gt;
The total effect for one system measured by Panasonic was a reduction of 26% of the page&lt;br /&gt;
cache allocated to processes, when the product was in the stand-by state.&lt;br /&gt;
&lt;br /&gt;
The technique was described by Masashige Mizuyama, Chief Architect in the&lt;br /&gt;
System Architecture Develompent Group, Base System Development Center,&lt;br /&gt;
Panasonic Mobile Communications Co., Ltd. &lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
There is no need to change kernel code for this feature.&lt;br /&gt;
We changed the dynamic linker (in glibc of MVL CEE3.1) only.&lt;br /&gt;
This was used with a 2.4.x Linux kernel.&lt;br /&gt;
&lt;br /&gt;
Usually, the dynamic linker maps each ELF segment to the virtual&lt;br /&gt;
address space of the process, using mmap.&lt;br /&gt;
&lt;br /&gt;
We change it as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     if(segment includes a .data section){                       &lt;br /&gt;
        Do mmap(), forcing PROT_WRITE bit off. ------(1)&lt;br /&gt;
        Set PROT_WRITE bit on, with mprotect(). ------(2)&lt;br /&gt;
     } else {                                           &lt;br /&gt;
       Do mmap() as usual.&lt;br /&gt;
     }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is very simple.&lt;br /&gt;
&lt;br /&gt;
Below is the description of how it works.&lt;br /&gt;
&lt;br /&gt;
When the XIP ELF shared library is dynamically linked at runtime,&lt;br /&gt;
because the PROT_WRITE bit is off ((1) above) when the section&lt;br /&gt;
is mmap'ed, the kernel assumes the linker is mapping an XIP text segment.&lt;br /&gt;
So the kernel builds a page directory table to map every physical&lt;br /&gt;
ROM page of the segment to the process virtual address space.&lt;br /&gt;
Each page table entry (PTE) is write-proctected.&lt;br /&gt;
&lt;br /&gt;
Then, becaused of the mprotect call setting PROT_WRITE on the mapped area,&lt;br /&gt;
the virtual memory area for the segment &lt;br /&gt;
has write permission (in the kernel vm_area_struct).&lt;br /&gt;
The write permission combination of PTE and vm_area_struct&lt;br /&gt;
is identical with a page which is enabled &amp;quot;copy on write&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
So, the the pages in the segment are mapped to ROM pages directly&lt;br /&gt;
until they are written.&lt;br /&gt;
&lt;br /&gt;
This is a kind of &amp;quot;fake&amp;quot; approach to support the feature with minimal&lt;br /&gt;
changes. So there are some pitfalls to this approach.&lt;br /&gt;
One problem we already notice is that get_user_pages() does&lt;br /&gt;
not work a segment mapped like this.&lt;br /&gt;
&lt;br /&gt;
The get_user_pages() function is used for mlock, ptrace and core dump by kernel.&lt;br /&gt;
So they don't work for the segment correctly with the current&lt;br /&gt;
implementation.&lt;br /&gt;
&lt;br /&gt;
However, the advantage was much enough for us, we decided to&lt;br /&gt;
use it.  I think the implementation needs to be cleaned up by adding&lt;br /&gt;
direct kernel support for this type of page mapping.&lt;br /&gt;
}}}&lt;br /&gt;
&lt;br /&gt;
== Documents ==&lt;br /&gt;
* Information about this technology is included in the Panasoinc presentation available [http://tree.celinuxforum.org/CelfPubWiki/ITJ2005Detail1_2d2?action=AttachFile&amp;amp;do=get&amp;amp;target=CELF_Technical_Jamboree_June13.pdf here]&lt;br /&gt;
** see pages 6 - 12 of the presentation&lt;br /&gt;
&lt;br /&gt;
== draft patch ==&lt;br /&gt;
This patch can be applied to the runtime linker [what program is this? ld-linux.so??]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;*** dl-load7.c    Mon Jul 11 21:26:47 2005&lt;br /&gt;
--- dl-load.c    Sat Jan  8 11:37:38 2005&lt;br /&gt;
***************&lt;br /&gt;
*** 801,819 ****&lt;br /&gt;
--- 801,849 ----&lt;br /&gt;
    if (! (locked_load_mode &amp;amp; (RTLD_LOCK_DEPENDENT_LIB_PAGES&lt;br /&gt;
                   | RTLD_LOCK_LIB_PAGES)))&lt;br /&gt;
      {&lt;br /&gt;
+      if((prot &amp;amp; PROT_WRITE) != 0 ){            &lt;br /&gt;
+     prot = (prot &amp;amp; ~PROT_WRITE);            &lt;br /&gt;
+       mapat = __mmap ((caddr_t) mapstart, len, prot,    &lt;br /&gt;
+               fixed|MAP_COPY|MAP_FILE,        &lt;br /&gt;
+               fd, offset);            &lt;br /&gt;
+         if (mapat != MAP_FAILED){            &lt;br /&gt;
+       prot = (prot | PROT_WRITE);            &lt;br /&gt;
+       if( __mprotect(mapat,len,prot)==-1){        &lt;br /&gt;
+         return N_(&amp;quot;failed to map segment from shared object&amp;quot;); &lt;br /&gt;
+       }                        &lt;br /&gt;
+     } else {                    &lt;br /&gt;
+       return N_(&amp;quot;failed to map segment from shared object&amp;quot;); &lt;br /&gt;
+     }                        &lt;br /&gt;
+      } else {                        &lt;br /&gt;
        mapat = __mmap ((caddr_t) mapstart, len, prot,&lt;br /&gt;
                fixed|MAP_COPY|MAP_FILE,&lt;br /&gt;
                fd, offset);&lt;br /&gt;
        if (mapat == MAP_FAILED)&lt;br /&gt;
      return N_(&amp;quot;failed to map segment from shared object&amp;quot;);&lt;br /&gt;
+      }                    &lt;br /&gt;
      }&lt;br /&gt;
    else if (locked_load_mode &amp;amp; RTLD_LOCK_MLOCK)&lt;br /&gt;
      {&lt;br /&gt;
+      if((prot &amp;amp; PROT_WRITE) != 0 ){            &lt;br /&gt;
+     prot = (prot &amp;amp; ~PROT_WRITE);            &lt;br /&gt;
+       mapat = __mmap ((caddr_t) mapstart, len, prot,    &lt;br /&gt;
+               fixed|MAP_COPY|MAP_FILE,        &lt;br /&gt;
+               fd, offset);            &lt;br /&gt;
+         if (mapat != MAP_FAILED){            &lt;br /&gt;
+       prot = (prot | PROT_WRITE);            &lt;br /&gt;
+       if( __mprotect(mapat,len,prot)==-1){        &lt;br /&gt;
+         return N_(&amp;quot;failed to map segment from shared object&amp;quot;); &lt;br /&gt;
+       }                        &lt;br /&gt;
+     } else {                    &lt;br /&gt;
+       return N_(&amp;quot;failed to map segment from shared object&amp;quot;); &lt;br /&gt;
+     }                        &lt;br /&gt;
+       } else {                        &lt;br /&gt;
        mapat = __mmap ((caddr_t) mapstart, len, prot,&lt;br /&gt;
                fixed|MAP_COPY|MAP_FILE,&lt;br /&gt;
                fd, offset);&lt;br /&gt;
        if (mapat == MAP_FAILED)&lt;br /&gt;
      return N_(&amp;quot;failed to map segment from shared object&amp;quot;);&lt;br /&gt;
+       }                            &lt;br /&gt;
        if (mlock((caddr_t) mapat, len) != 0)&lt;br /&gt;
      {&lt;br /&gt;
        return N_(&amp;quot;failed to memory lock segment from shared object&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>RBot</name></author>	</entry>

	</feed>