Fw: when to mark reserved low memory pages

Linda Xie lxie at us.ibm.com
Thu Sep 30 18:37:29 EST 2004





The following is an updated version based on Dave's suggestion.

Paul, This patch was tested on a Power 5 partition running redhat 4 (kernel
src level 584). Please send it to
mainline if there are no objections.

This patch was originally created to fix the prolem that was found in PCI
Hot Plug testing on redhat 4.  The problem was
that rtas config-connector call failed because RedHat actively disabled
access to  /dev/mem ( for security/selinux reasons).
Disabling access to /dev/mem prevents  the RTAS pages from being mmaped. So
we have to mark the RTAS pages as
PG_reserved to allow mmap to pass.

Paul already verified my previous version.  He will review  this one and
push it  to mainline, if it is acceptable.


-Linda

diff -purN linux-2.6.8/arch/ppc64/mm/init.c
linux-2.6.8-linda/arch/ppc64/mm/init.c
--- linux-2.6.8/arch/ppc64/mm/init.c    1970-05-10 22:51:47.153000776 -0400
+++ linux-2.6.8-linda/arch/ppc64/mm/init.c      1970-05-10
23:36:33.774957608 -0400
@@ -706,7 +706,7 @@ void __init mem_init(void)
        int nid;
 #endif
        pg_data_t *pgdat;
-       unsigned long i;
+       unsigned long i, pfn, start_pfn, end_pfn;
        struct page *page;
        unsigned long reservedpages = 0, codesize, initsize, datasize,
bsssize;

@@ -749,8 +749,22 @@ void __init mem_init(void)
                bsssize >> 10,
                initsize >> 10);

+       /* Mark the RTAS pages as PG_reserved */
+       start_pfn = rtas_rmo_buf >> PAGE_SHIFT;
+       end_pfn = (rtas_rmo_buf + RTAS_RMOBUF_MAX) >>  PAGE_SHIFT;
+       for (pfn = start_pfn; pfn < end_pfn; pfn++) {
+                       SetPageReserved(pfn_to_page(pfn));
+       }
+
        mem_init_done = 1;

+
 #ifdef CONFIG_PPC_ISERIES
        iommu_vio_init();
 #endif

Signed-off-by: Linda Xie <lxie at us.ibm.com>




                                                                                                                                           
                      haveblue at us.ltcfwd.li                                                                                                
                      nux.ibm.com                  To:       Linda Xie/Austin/IBM at IBMUS                                                    
                                                   cc:       Benjamin Herrenschmidt <benh at kernel.crashing.org>, John Rose                  
                      09/29/2004 01:12 PM           <johnrose at austin.ibm.com>, linuxppc64-dev at ozlabs.org, Michael W                        
                                                    Wortman/Austin/IBM at IBMUS                                                               
                                                   Subject:  Re: Fw: when to mark reserved low memory pages                                
                                                                                                                                           




On Wed, 2004-09-29 at 09:26, Linda Xie wrote:
> Here is my final patch which will be submitted to redhat.

Might be nicer to do something like this instead of a whole bunch of
__va() operations.  page_to_pfn() is slightly lighter-weight than
virt_to_page() (doesn't really matter at init-time, though).

start_pfn = rtas_rmo_buf >> PAGE_SHIFT;
end_pfn = (rtas_rmo_buf + RTAS_RMOBUF_MAX) >> PAGE_SHIFT;
for (pfn = start_pfn; pfn < end_pfn; pfn++)
        SetPageReserved(page_to_pfn(pfn));

--
Dave Hansen
haveblue at us.ibm.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040930/7a813faa/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040930/7a813faa/attachment.gif 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecblank.gif
Type: image/gif
Size: 45 bytes
Desc: not available
Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040930/7a813faa/attachment-0001.gif 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic06243.gif
Type: image/gif
Size: 1255 bytes
Desc: not available
Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040930/7a813faa/attachment-0002.gif 


More information about the Linuxppc64-dev mailing list