direct-io.hg

changeset 14394:809f36b1b685

Add two arch hooks to gnttab_release_mappings().
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author kfraser@localhost.localdomain
date Thu Mar 15 10:43:13 2007 +0000 (2007-03-15)
parents 8fa17d1560a9
children 9ff349bde23a 1584263f9fc5
files xen/common/grant_table.c xen/include/asm-ia64/grant_table.h xen/include/asm-powerpc/grant_table.h xen/include/asm-x86/grant_table.h
line diff
     1.1 --- a/xen/common/grant_table.c	Thu Mar 15 10:38:58 2007 +0000
     1.2 +++ b/xen/common/grant_table.c	Thu Mar 15 10:43:13 2007 +0000
     1.3 @@ -1392,8 +1392,7 @@ gnttab_release_mappings(
     1.4              {
     1.5                  BUG_ON(!(act->pin & GNTPIN_hstr_mask));
     1.6                  act->pin -= GNTPIN_hstr_inc;
     1.7 -                /* Done implicitly when page tables are destroyed. */
     1.8 -                /* put_page(mfn_to_page(act->frame)); */
     1.9 +                gnttab_release_put_page(mfn_to_page(act->frame));
    1.10              }
    1.11          }
    1.12          else
    1.13 @@ -1409,8 +1408,7 @@ gnttab_release_mappings(
    1.14              {
    1.15                  BUG_ON(!(act->pin & GNTPIN_hstw_mask));
    1.16                  act->pin -= GNTPIN_hstw_inc;
    1.17 -                /* Done implicitly when page tables are destroyed. */
    1.18 -                /* put_page_and_type(mfn_to_page(act->frame)); */
    1.19 +                gnttab_release_put_page_and_type(mfn_to_page(act->frame));
    1.20              }
    1.21  
    1.22              if ( (act->pin & (GNTPIN_devw_mask|GNTPIN_hstw_mask)) == 0 )
     2.1 --- a/xen/include/asm-ia64/grant_table.h	Thu Mar 15 10:38:58 2007 +0000
     2.2 +++ b/xen/include/asm-ia64/grant_table.h	Thu Mar 15 10:43:13 2007 +0000
     2.3 @@ -64,4 +64,7 @@ static inline void gnttab_clear_flag(uns
     2.4  	clear_bit(nr, addr);
     2.5  }
     2.6  
     2.7 +#define gnttab_release_put_page(page)           put_page((page))
     2.8 +#define gnttab_release_put_page_and_type(page)  put_page_and_type((page))
     2.9 +
    2.10  #endif /* __ASM_GRANT_TABLE_H__ */
     3.1 --- a/xen/include/asm-powerpc/grant_table.h	Thu Mar 15 10:38:58 2007 +0000
     3.2 +++ b/xen/include/asm-powerpc/grant_table.h	Thu Mar 15 10:43:13 2007 +0000
     3.3 @@ -69,4 +69,17 @@ static inline uint cpu_foreign_map_order
     3.4      /* 16 GiB */
     3.5      return 34 - PAGE_SHIFT;
     3.6  }
     3.7 +
     3.8 +#if 0
     3.9 +/*
    3.10 + * without put_page()/put_page_and_type() page might be leaked.
    3.11 + * with put_page()/put_page_and_type() freed page might be accessed.
    3.12 + */
    3.13 +#define gnttab_release_put_page(page)           put_page((page))
    3.14 +#define gnttab_release_put_page_and_type(page)  put_page_and_type((page))
    3.15 +#else
    3.16 +#define gnttab_release_put_page(page)           do { } while (0)
    3.17 +#define gnttab_release_put_page_and_type(page)  do { } while (0)
    3.18 +#endif
    3.19 +
    3.20  #endif  /* __ASM_PPC_GRANT_TABLE_H__ */
     4.1 --- a/xen/include/asm-x86/grant_table.h	Thu Mar 15 10:38:58 2007 +0000
     4.2 +++ b/xen/include/asm-x86/grant_table.h	Thu Mar 15 10:43:13 2007 +0000
     4.3 @@ -38,4 +38,14 @@ static inline void gnttab_clear_flag(uns
     4.4      clear_bit(nr, addr);
     4.5  }
     4.6  
     4.7 +#define gnttab_release_put_page(page)                           \
     4.8 +    do {                                                        \
     4.9 +        /* Done implicitly when page tables are destroyed. */   \
    4.10 +    } while (0)
    4.11 +
    4.12 +#define gnttab_release_put_page_and_type(page)                  \
    4.13 +    do {                                                        \
    4.14 +        /* Done implicitly when page tables are destroyed. */   \
    4.15 +    } while (0)
    4.16 +
    4.17  #endif /* __ASM_GRANT_TABLE_H__ */