ia64/xen-unstable

changeset 4023:2c4150137150

bitkeeper revision 1.1236.12.12 (422e2f94y48ELm2z25jB8lJCOUxZgw)

grant tables: page ref counting fixes.
author cwc22@centipede.cl.cam.ac.uk
date Tue Mar 08 23:04:52 2005 +0000 (2005-03-08)
parents b74c86e36644
children 7d769527a546
files xen/arch/x86/domain.c xen/arch/x86/mm.c xen/common/grant_table.c xen/include/asm-x86/mm.h xen/include/xen/grant_table.h
line diff
     1.1 --- a/xen/arch/x86/domain.c	Tue Mar 08 17:48:59 2005 +0000
     1.2 +++ b/xen/arch/x86/domain.c	Tue Mar 08 23:04:52 2005 +0000
     1.3 @@ -19,6 +19,7 @@
     1.4  #include <xen/smp.h>
     1.5  #include <xen/delay.h>
     1.6  #include <xen/softirq.h>
     1.7 +#include <xen/grant_table.h>
     1.8  #include <asm/regs.h>
     1.9  #include <asm/mc146818rtc.h>
    1.10  #include <asm/system.h>
    1.11 @@ -956,6 +957,9 @@ void domain_relinquish_memory(struct dom
    1.12      /* Ensure that noone is running over the dead domain's page tables. */
    1.13      synchronise_pagetables(~0UL);
    1.14  
    1.15 +    /* Release mappings of other domains */
    1.16 +    gnttab_release_all_mappings( d->grant_table );
    1.17 +
    1.18      /* Exit shadow mode before deconstructing final guest page table. */
    1.19      shadow_mode_disable(d);
    1.20  
     2.1 --- a/xen/arch/x86/mm.c	Tue Mar 08 17:48:59 2005 +0000
     2.2 +++ b/xen/arch/x86/mm.c	Tue Mar 08 23:04:52 2005 +0000
     2.3 @@ -1060,14 +1060,14 @@ void free_page_type(struct pfn_info *pag
     2.4  }
     2.5  
     2.6  
     2.7 -void put_page_types(struct pfn_info *page, u32 decrement)
     2.8 +void put_page_type(struct pfn_info *page)
     2.9  {
    2.10      u32 nx, x, y = page->u.inuse.type_info;
    2.11  
    2.12   again:
    2.13      do {
    2.14          x  = y;
    2.15 -        nx = x - decrement;
    2.16 +        nx = x - 1;
    2.17  
    2.18          ASSERT((x & PGT_count_mask) != 0);
    2.19  
     3.1 --- a/xen/common/grant_table.c	Tue Mar 08 17:48:59 2005 +0000
     3.2 +++ b/xen/common/grant_table.c	Tue Mar 08 23:04:52 2005 +0000
     3.3 @@ -658,8 +658,6 @@ do_grant_table_op(
     3.4  {
     3.5      long rc;
     3.6  
     3.7 -    DPRINTK("Grant: table operation (%u) count: (%u)\n", cmd, count);
     3.8 -
     3.9      if ( count > 512 )
    3.10          return -EINVAL;
    3.11  
    3.12 @@ -846,7 +844,7 @@ grant_table_create(
    3.13      return -ENOMEM;
    3.14  }
    3.15  
    3.16 -static void
    3.17 +void
    3.18  gnttab_release_all_mappings(grant_table_t *gt)
    3.19  {
    3.20      grant_mapping_t        *map;
    3.21 @@ -895,9 +893,10 @@ gnttab_release_all_mappings(grant_table_
    3.22                         ((act->pin & GNTPIN_devw_mask) >> GNTPIN_devw_shift);
    3.23  
    3.24              if ( pincount > 0 )
    3.25 -                put_page_types(&frame_table[frame], pincount);
    3.26 +                put_page_type(&frame_table[frame]);
    3.27  
    3.28 -            put_page(&frame_table[frame]);
    3.29 +            if (act->pin)
    3.30 +                put_page(&frame_table[frame]);
    3.31  
    3.32              act->pin = 0;
    3.33  
    3.34 @@ -906,6 +905,8 @@ gnttab_release_all_mappings(grant_table_
    3.35  
    3.36              spin_unlock(&rd->grant_table->lock);
    3.37  
    3.38 +            map->ref_and_flags = 0;
    3.39 +
    3.40              put_domain(rd);
    3.41          }
    3.42      }
     4.1 --- a/xen/include/asm-x86/mm.h	Tue Mar 08 17:48:59 2005 +0000
     4.2 +++ b/xen/include/asm-x86/mm.h	Tue Mar 08 23:04:52 2005 +0000
     4.3 @@ -182,14 +182,9 @@ static inline int get_page(struct pfn_in
     4.4      return 1;
     4.5  }
     4.6  
     4.7 -void put_page_types(struct pfn_info *page, u32 decrement);
     4.8 +void put_page_type(struct pfn_info *page);
     4.9  int  get_page_type(struct pfn_info *page, u32 type);
    4.10  
    4.11 -static inline void put_page_type(struct pfn_info *page)
    4.12 -{
    4.13 -    put_page_types(page, 1);
    4.14 -}
    4.15 -
    4.16  static inline void put_page_and_type(struct pfn_info *page)
    4.17  {
    4.18      put_page_type(page);
     5.1 --- a/xen/include/xen/grant_table.h	Tue Mar 08 17:48:59 2005 +0000
     5.2 +++ b/xen/include/xen/grant_table.h	Tue Mar 08 23:04:52 2005 +0000
     5.3 @@ -105,4 +105,9 @@ void
     5.4  gnttab_notify_transfer(
     5.5      struct domain *rd, grant_ref_t ref, unsigned long frame);
     5.6  
     5.7 +/* Pre-domain destruction release of all mappings of other domains */
     5.8 +void
     5.9 +gnttab_release_all_mappings(grant_table_t *gt);
    5.10 +
    5.11 +
    5.12  #endif /* __XEN_GRANT_H__ */