Re: [PATCH v7] xen/grant-table: Avoid m2p_override during mapping
On 04/02/14 06:36, Matt Wilson wrote: On Mon, Feb 03, 2014 at 01:24:58PM +, Zoltan Kiss wrote: Signed-off-by: Zoltan Kiss Suggested-by: David Vrabel You're still forgetting that this was originally proposed by Anthony Liguori . https://lkml.kernel.org/r/1384307336-5328-1-git-send-email-anth...@codemonkey.ws Sure, sorry. I've talked with David, I will add Anthony as Original-by, instead of David's Suggested-by line. Zoli -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v7] xen/grant-table: Avoid m2p_override during mapping
On 04/02/14 06:36, Matt Wilson wrote: On Mon, Feb 03, 2014 at 01:24:58PM +, Zoltan Kiss wrote: Signed-off-by: Zoltan Kiss zoltan.k...@citrix.com Suggested-by: David Vrabel david.vra...@citrix.com You're still forgetting that this was originally proposed by Anthony Liguori aligu...@amazon.com. https://lkml.kernel.org/r/1384307336-5328-1-git-send-email-anth...@codemonkey.ws Sure, sorry. I've talked with David, I will add Anthony as Original-by, instead of David's Suggested-by line. Zoli -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v7] xen/grant-table: Avoid m2p_override during mapping
On Mon, Feb 03, 2014 at 01:24:58PM +, Zoltan Kiss wrote: > The grant mapping API does m2p_override unnecessarily: only gntdev needs it, > for blkback and future netback patches it just cause a lock contention, as > those pages never go to userspace. Therefore this series does the following: > - the original functions were renamed to __gnttab_[un]map_refs, with a new > parameter m2p_override > - based on m2p_override either they follow the original behaviour, or just set > the private flag and call set_phys_to_machine > - gnttab_[un]map_refs are now a wrapper to call __gnttab_[un]map_refs with > m2p_override false > - a new function gnttab_[un]map_refs_userspace provides the old behaviour > > It also removes a stray space from page.h and change ret to 0 if > XENFEAT_auto_translated_physmap, as that is the only possible return value > there. > > v2: > - move the storing of the old mfn in page->index to gnttab_map_refs > - move the function header update to a separate patch > > v3: > - a new approach to retain old behaviour where it needed > - squash the patches into one > > v4: > - move out the common bits from m2p* functions, and pass pfn/mfn as parameter > - clear page->private before doing anything with the page, so > m2p_find_override > won't race with this > > v5: > - change return value handling in __gnttab_[un]map_refs > - remove a stray space in page.h > - add detail why ret = 0 now at some places > > v6: > - don't pass pfn to m2p* functions, just get it locally > > v7: > - the previous version broke build on ARM, as there is no need for those p2m > changes. I've put them into arch specific functions, which are stubs on arm > > Signed-off-by: Zoltan Kiss > Suggested-by: David Vrabel You're still forgetting that this was originally proposed by Anthony Liguori . https://lkml.kernel.org/r/1384307336-5328-1-git-send-email-anth...@codemonkey.ws --msw -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v7] xen/grant-table: Avoid m2p_override during mapping
The grant mapping API does m2p_override unnecessarily: only gntdev needs it, for blkback and future netback patches it just cause a lock contention, as those pages never go to userspace. Therefore this series does the following: - the original functions were renamed to __gnttab_[un]map_refs, with a new parameter m2p_override - based on m2p_override either they follow the original behaviour, or just set the private flag and call set_phys_to_machine - gnttab_[un]map_refs are now a wrapper to call __gnttab_[un]map_refs with m2p_override false - a new function gnttab_[un]map_refs_userspace provides the old behaviour It also removes a stray space from page.h and change ret to 0 if XENFEAT_auto_translated_physmap, as that is the only possible return value there. v2: - move the storing of the old mfn in page->index to gnttab_map_refs - move the function header update to a separate patch v3: - a new approach to retain old behaviour where it needed - squash the patches into one v4: - move out the common bits from m2p* functions, and pass pfn/mfn as parameter - clear page->private before doing anything with the page, so m2p_find_override won't race with this v5: - change return value handling in __gnttab_[un]map_refs - remove a stray space in page.h - add detail why ret = 0 now at some places v6: - don't pass pfn to m2p* functions, just get it locally v7: - the previous version broke build on ARM, as there is no need for those p2m changes. I've put them into arch specific functions, which are stubs on arm Signed-off-by: Zoltan Kiss Suggested-by: David Vrabel --- arch/arm/include/asm/xen/page.h | 15 ++- arch/x86/include/asm/xen/page.h |7 +++- arch/x86/xen/p2m.c | 49 --- drivers/block/xen-blkback/blkback.c | 15 +++ drivers/xen/gntdev.c| 13 +++--- drivers/xen/grant-table.c | 75 +-- include/xen/grant_table.h |8 +++- 7 files changed, 136 insertions(+), 46 deletions(-) diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h index 3759cac..97fa5f9 100644 --- a/arch/arm/include/asm/xen/page.h +++ b/arch/arm/include/asm/xen/page.h @@ -97,13 +97,26 @@ static inline pte_t *lookup_address(unsigned long address, unsigned int *level) return NULL; } +static inline int set_foreign_p2m_mapping(struct page *page, unsigned long mfn) +{ + return 0; +} + static inline int m2p_add_override(unsigned long mfn, struct page *page, struct gnttab_map_grant_ref *kmap_op) { return 0; } -static inline int m2p_remove_override(struct page *page, bool clear_pte) +static inline int restore_foreign_p2m_mapping(struct page *page, + unsigned long mfn) +{ + return 0; +} + +static inline int m2p_remove_override(struct page *page, + struct gnttab_map_grant_ref *kmap_op, + unsigned long mfn) { return 0; } diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h index b913915..e3fa4b8 100644 --- a/arch/x86/include/asm/xen/page.h +++ b/arch/x86/include/asm/xen/page.h @@ -49,10 +49,13 @@ extern bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn); extern unsigned long set_phys_range_identity(unsigned long pfn_s, unsigned long pfn_e); +extern int set_foreign_p2m_mapping(struct page *page, unsigned long mfn); extern int m2p_add_override(unsigned long mfn, struct page *page, struct gnttab_map_grant_ref *kmap_op); +extern int restore_foreign_p2m_mapping(struct page *page, unsigned long mfn); extern int m2p_remove_override(struct page *page, - struct gnttab_map_grant_ref *kmap_op); + struct gnttab_map_grant_ref *kmap_op, + unsigned long mfn); extern struct page *m2p_find_override(unsigned long mfn); extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn); @@ -121,7 +124,7 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn) pfn = m2p_find_override_pfn(mfn, ~0); } - /* + /* * pfn is ~0 if there are no entries in the m2p for mfn or if the * entry doesn't map back to the mfn and m2p_override doesn't have a * valid entry for it. diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index 2ae8699..524ace6 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c @@ -870,6 +870,22 @@ static unsigned long mfn_hash(unsigned long mfn) return hash_long(mfn, M2P_OVERRIDE_HASH_SHIFT); } +int set_foreign_p2m_mapping(struct page *page, unsigned long mfn) +{ + unsigned long pfn = page_to_pfn(page); + + WARN_ON(PagePrivate(page)); + SetPagePrivate(page); + set_page_private(page, mfn);
[PATCH v7] xen/grant-table: Avoid m2p_override during mapping
The grant mapping API does m2p_override unnecessarily: only gntdev needs it, for blkback and future netback patches it just cause a lock contention, as those pages never go to userspace. Therefore this series does the following: - the original functions were renamed to __gnttab_[un]map_refs, with a new parameter m2p_override - based on m2p_override either they follow the original behaviour, or just set the private flag and call set_phys_to_machine - gnttab_[un]map_refs are now a wrapper to call __gnttab_[un]map_refs with m2p_override false - a new function gnttab_[un]map_refs_userspace provides the old behaviour It also removes a stray space from page.h and change ret to 0 if XENFEAT_auto_translated_physmap, as that is the only possible return value there. v2: - move the storing of the old mfn in page-index to gnttab_map_refs - move the function header update to a separate patch v3: - a new approach to retain old behaviour where it needed - squash the patches into one v4: - move out the common bits from m2p* functions, and pass pfn/mfn as parameter - clear page-private before doing anything with the page, so m2p_find_override won't race with this v5: - change return value handling in __gnttab_[un]map_refs - remove a stray space in page.h - add detail why ret = 0 now at some places v6: - don't pass pfn to m2p* functions, just get it locally v7: - the previous version broke build on ARM, as there is no need for those p2m changes. I've put them into arch specific functions, which are stubs on arm Signed-off-by: Zoltan Kiss zoltan.k...@citrix.com Suggested-by: David Vrabel david.vra...@citrix.com --- arch/arm/include/asm/xen/page.h | 15 ++- arch/x86/include/asm/xen/page.h |7 +++- arch/x86/xen/p2m.c | 49 --- drivers/block/xen-blkback/blkback.c | 15 +++ drivers/xen/gntdev.c| 13 +++--- drivers/xen/grant-table.c | 75 +-- include/xen/grant_table.h |8 +++- 7 files changed, 136 insertions(+), 46 deletions(-) diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h index 3759cac..97fa5f9 100644 --- a/arch/arm/include/asm/xen/page.h +++ b/arch/arm/include/asm/xen/page.h @@ -97,13 +97,26 @@ static inline pte_t *lookup_address(unsigned long address, unsigned int *level) return NULL; } +static inline int set_foreign_p2m_mapping(struct page *page, unsigned long mfn) +{ + return 0; +} + static inline int m2p_add_override(unsigned long mfn, struct page *page, struct gnttab_map_grant_ref *kmap_op) { return 0; } -static inline int m2p_remove_override(struct page *page, bool clear_pte) +static inline int restore_foreign_p2m_mapping(struct page *page, + unsigned long mfn) +{ + return 0; +} + +static inline int m2p_remove_override(struct page *page, + struct gnttab_map_grant_ref *kmap_op, + unsigned long mfn) { return 0; } diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h index b913915..e3fa4b8 100644 --- a/arch/x86/include/asm/xen/page.h +++ b/arch/x86/include/asm/xen/page.h @@ -49,10 +49,13 @@ extern bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn); extern unsigned long set_phys_range_identity(unsigned long pfn_s, unsigned long pfn_e); +extern int set_foreign_p2m_mapping(struct page *page, unsigned long mfn); extern int m2p_add_override(unsigned long mfn, struct page *page, struct gnttab_map_grant_ref *kmap_op); +extern int restore_foreign_p2m_mapping(struct page *page, unsigned long mfn); extern int m2p_remove_override(struct page *page, - struct gnttab_map_grant_ref *kmap_op); + struct gnttab_map_grant_ref *kmap_op, + unsigned long mfn); extern struct page *m2p_find_override(unsigned long mfn); extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn); @@ -121,7 +124,7 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn) pfn = m2p_find_override_pfn(mfn, ~0); } - /* + /* * pfn is ~0 if there are no entries in the m2p for mfn or if the * entry doesn't map back to the mfn and m2p_override doesn't have a * valid entry for it. diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index 2ae8699..524ace6 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c @@ -870,6 +870,22 @@ static unsigned long mfn_hash(unsigned long mfn) return hash_long(mfn, M2P_OVERRIDE_HASH_SHIFT); } +int set_foreign_p2m_mapping(struct page *page, unsigned long mfn) +{ + unsigned long pfn = page_to_pfn(page); + + WARN_ON(PagePrivate(page)); +
Re: [PATCH v7] xen/grant-table: Avoid m2p_override during mapping
On Mon, Feb 03, 2014 at 01:24:58PM +, Zoltan Kiss wrote: The grant mapping API does m2p_override unnecessarily: only gntdev needs it, for blkback and future netback patches it just cause a lock contention, as those pages never go to userspace. Therefore this series does the following: - the original functions were renamed to __gnttab_[un]map_refs, with a new parameter m2p_override - based on m2p_override either they follow the original behaviour, or just set the private flag and call set_phys_to_machine - gnttab_[un]map_refs are now a wrapper to call __gnttab_[un]map_refs with m2p_override false - a new function gnttab_[un]map_refs_userspace provides the old behaviour It also removes a stray space from page.h and change ret to 0 if XENFEAT_auto_translated_physmap, as that is the only possible return value there. v2: - move the storing of the old mfn in page-index to gnttab_map_refs - move the function header update to a separate patch v3: - a new approach to retain old behaviour where it needed - squash the patches into one v4: - move out the common bits from m2p* functions, and pass pfn/mfn as parameter - clear page-private before doing anything with the page, so m2p_find_override won't race with this v5: - change return value handling in __gnttab_[un]map_refs - remove a stray space in page.h - add detail why ret = 0 now at some places v6: - don't pass pfn to m2p* functions, just get it locally v7: - the previous version broke build on ARM, as there is no need for those p2m changes. I've put them into arch specific functions, which are stubs on arm Signed-off-by: Zoltan Kiss zoltan.k...@citrix.com Suggested-by: David Vrabel david.vra...@citrix.com You're still forgetting that this was originally proposed by Anthony Liguori aligu...@amazon.com. https://lkml.kernel.org/r/1384307336-5328-1-git-send-email-anth...@codemonkey.ws --msw -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/