WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

Re: [Xen-ia64-devel] [patch] alloc_page_dir() should return a virtual ad

To: Jes Sorensen <jes@xxxxxxx>
Subject: Re: [Xen-ia64-devel] [patch] alloc_page_dir() should return a virtual address
From: Kouya SHIMURA <kouya@xxxxxxxxxxxxxx>
Date: Thu, 21 Sep 2006 19:32:24 +0900
Cc: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 21 Sep 2006 03:32:46 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <451255A3.1060603@xxxxxxx>
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
References: <451255A3.1060603@xxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi Jes,

I wrote the patch corresponding to discontig. You are wrong.
alloc_dir_page() must return a physical address because the page table
walker for frame_table runs under off-state of data-address-translation.
(i.e. psr.dt=0)

p*d_populate() functions never be called while handling TLB miss to
frame_table. The page table walker for frame_table is written in
assembler in xen/arch/ia64/xen/ivt.S. See the code between
'GLOBAL_ENTRY(frametable_miss)' and 'END(frametable_miss)'

You'd better have a look at the thread below:
http://lists.xensource.com/archives/html/xen-ia64-devel/2006-04/msg00014.html

Thanks,
Kouya

Jes Sorensen writes:
 > Hi,
 > 
 > I sent this patch to Alex last week, but it didn't make it onto the list
 > because it's wrongly configured, so here we go again.
 > 
 > I know that this patch is causing problems on ZX1, but I have looked at
 > it over and over again and I feel pretty certain it is correct. In fact
 > I cannot understand that Xen could boot on any ia64 platform prior to
 > this at all.
 > 
 > I would be very interested in hearing how this patch affects other
 > platforms such as DIG and Fujitsu's machines (if they are not DIG :)
 > 
 > Any input or comments on this is most welcome - if you think I am wrong
 > about this patch, please tell me, I really want to understand why this
 > worked in the past.
 > 
 > Thanks,
 > Jes
 > 
 > alloc_dir_page() must return a virtual address so it can handle being
 > passed to the p*d_populate() functions which do a __pa() on the address
 > before sticking them into the page tables.
 > 
 > To match this it is also necessary to correctly check the faulting
 > address for being in the virtual frame table range, otherwise page
 > faults for this space weren't being served at all.
 > 
 > This could probably be done more efficiently, but for now I think it's
 > better to keep the code explicit.
 > 
 > Signed-off-by: Jes Sorensen <jes@xxxxxxx>
 > 
 > diff -r 3e4fa8b5b245 xen/arch/ia64/xen/ivt.S
 > --- a/xen/arch/ia64/xen/ivt.S        Tue Sep 12 11:43:22 2006 -0600
 > +++ b/xen/arch/ia64/xen/ivt.S        Wed Sep 20 14:56:37 2006 +0200
 > @@ -542,8 +542,16 @@ late_alt_dtlb_miss:
 >      ;;
 >  #ifdef CONFIG_VIRTUAL_FRAME_TABLE
 >      shr r22=r16,56          // Test for the address of virtual frame_table
 > +#if 1
 > +    mov r23=VIRT_FRAME_TABLE_ADDR>>56
 > +    ;;
 > +    xor r23=r22,r23
 > +    ;;
 > +    cmp.eq p8,p0=r23,r0
 > +#else
 >      ;;
 >      cmp.eq p8,p0=((VIRT_FRAME_TABLE_ADDR>>56)&0xff)-0x100,r22
 > +#endif
 >  (p8)        br.cond.sptk frametable_miss ;;
 >  #endif
 >      // If it is not a Xen address, handle it via page_fault.
 > diff -r 3e4fa8b5b245 xen/arch/ia64/xen/xenmem.c
 > --- a/xen/arch/ia64/xen/xenmem.c     Tue Sep 12 11:43:22 2006 -0600
 > +++ b/xen/arch/ia64/xen/xenmem.c     Wed Sep 20 17:14:01 2006 +0200
 > @@ -76,13 +76,13 @@ alloc_dir_page(void)
 >  alloc_dir_page(void)
 >  {
 >      unsigned long mfn = alloc_boot_pages(1, 1);
 > -    unsigned long dir;
 > +    unsigned char *virtual;
 >      if (!mfn)
 >              panic("Not enough memory for virtual frame table!\n");
 >      ++table_size;
 > -    dir = mfn << PAGE_SHIFT;
 > -    memset(__va(dir), 0, PAGE_SIZE);
 > -    return (void *)dir;
 > +    virtual = __va(mfn << PAGE_SHIFT);
 > +    memset(virtual, 0, PAGE_SIZE);
 > +    return virtual;
 >  }
 >  
 >  static inline unsigned long
 > _______________________________________________
 > Xen-ia64-devel mailing list
 > Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
 > http://lists.xensource.com/xen-ia64-devel


_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel