xen-blkback: only attach blkback if the required features are met
Subsystems (3)
PATCH 1/1 xen-blkback: only attach blkback if the required features are met
Blkback cannot work properly on auto-translated guests if Xen doesn't update the IOMMU when performing grant maps/unmaps, so only attach if the newly introduced XENFEAT_hvm_gntmap_supports_iommu is found.
--- drivers/block/xen-blkback/blkback.c | 12 ++++++++++++ include/xen/interface/features.h | 6 ++++++ 2 files changed, 18 insertions(+), 0 deletions(-)
drivers/block/xen-blkback/blkback.c +12 -0
@@ -1381,6 +1381,18 @@ static int __init xen_blkif_init(void)if (!xen_domain ())return -ENODEV ; +#ifdef CONFIG_X86 +if (xen_feature (XENFEAT_auto_translated_physmap) && + !xen_feature (XENFEAT_hvm_gntmap_supports_iommu)) { +/* +* blkback cannot work properly on auto-translated guests +* if grant table mappings don't update the IOMMU entries. +*/ +pr_debug (DRV_PFX "Disabling blkback because Xen is missing feature XENFEAT_hvm_gntmap_supports_iommu\n" ); +return -ENODEV ; + } +#endif /* CONFIG_X86 */ + rc =xen_blkif_interface_init ();if (rc) goto failed_init;
include/xen/interface/features.h +6 -0
@@ -53,6 +53,12 @@/* operation as Dom0 is supported */ #define XENFEAT_dom0 11 +/* +* If set, GNTTABOP_map_grant_ref sets the proper IOMMU mappings so the +* resulting mapped page can be used for IO with hardware devices. +*/ +#define XENFEAT_hvm_gntmap_supports_iommu 12 +#define XENFEAT_NR_SUBMAPS 1#endif /* __XEN_PUBLIC_FEATURES_H__ */
Signature · 1 line
1.7.7.5 (Apple Git-26)
Quoted 3 lines · Roger Pau Monne
Blkback cannot work properly on auto-translated guests if Xen doesn't update the IOMMU when performing grant maps/unmaps, so only attach if the newly introduced
XENFEAT_hvm_gntmap_supports_iommuis found.
Can you explain the problem in more detail and which guest configurations are affected?
This isn't a problem that is specific to blkback, but any backend that grant maps and passes the foreign pages to a device so there needs to be a generic solution.
Why can't this be fixed by having the swiotlb bounce foreign pages?
Quoted 7 lines
drivers/block/xen-blkback/blkback.c +1
-0@@ -1381,6 +1381,18 @@ static int __init xen_blkif_init(void)if (!xen_domain ())return -ENODEV ; +#ifdef CONFIG_X86
drivers/block/xen-blkback/blkback.c static int __init xen_blkif_init(void) · line 1394
Quoted 10 lines
drivers/block/xen-blkback/blkback.c +10
-0+if (xen_feature (XENFEAT_auto_translated_physmap) && + !xen_feature (XENFEAT_hvm_gntmap_supports_iommu)) { +/* +* blkback cannot work properly on auto-translated guests +* if grant table mappings don't update the IOMMU entries. +*/ +pr_debug (DRV_PFX "Disabling blkback because Xen is missing feature XENFEAT_hvm_gntmap_supports_iommu\n" ); +return -ENODEV ; + } +#endif /* CONFIG_X86 */
Why CONFIG_X86?
David
Quoted 3 lines · Roger Pau Monne
Blkback cannot work properly on auto-translated guests if Xen doesn't update the IOMMU when performing grant maps/unmaps, so only attach if the newly introduced
XENFEAT_hvm_gntmap_supports_iommuis found.
Can you explain the problem in more detail and which guest configurations are affected?
This isn't a problem that is specific to blkback, but any backend that grant maps and passes the foreign pages to a device so there needs to be a generic solution.
Why can't this be fixed by having the swiotlb bounce foreign pages?
Quoted 7 lines
drivers/block/xen-blkback/blkback.c +1
-0@@ -1381,6 +1381,18 @@ static int __init xen_blkif_init(void)if (!xen_domain ())return -ENODEV ; +#ifdef CONFIG_X86
drivers/block/xen-blkback/blkback.c static int __init xen_blkif_init(void) · line 1394
Quoted 10 lines
drivers/block/xen-blkback/blkback.c +10
-0+if (xen_feature (XENFEAT_auto_translated_physmap) && + !xen_feature (XENFEAT_hvm_gntmap_supports_iommu)) { +/* +* blkback cannot work properly on auto-translated guests +* if grant table mappings don't update the IOMMU entries. +*/ +pr_debug (DRV_PFX "Disabling blkback because Xen is missing feature XENFEAT_hvm_gntmap_supports_iommu\n" ); +return -ENODEV ; + } +#endif /* CONFIG_X86 */
Why CONFIG_X86?
David
Quoted 5 lines · David Vrabel
Quoted 3 lines · Roger Pau Monne
Blkback cannot work properly on auto-translated guests if Xen doesn't update the IOMMU when performing grant maps/unmaps, so only attach if the newly introduced
XENFEAT_hvm_gntmap_supports_iommuis found.
Quoted 8 lines
Can you explain the problem in more detail and which guest configurations are affected?
This isn't a problem that is specific to blkback, but any backend that grant maps and passes the foreign pages to a device so there needs to be a generic solution.
Why can't this be fixed by having the swiotlb bounce foreign pages?
Yes, it could be fixed with that, FreeBSD has been doing it for a long time.
But since nobody has complained about this, and the issue has been there for a long time, I'm not sure it's worth adding all the bounce buffer code for what seems to be an unused configuration.
Also, since Linux also supports PV, I would just say that if you want to use driver domains you are forced to use PV guests (or have a recent Xen version that properly updates the IOMMU on grant map/unmap).
Quoted 6 lines
Quoted 6 lines
drivers/block/xen-blkback/blkback.c +0
-0@@ -1381,6 +1381,18 @@ static int __init xen_blkif_init(void)if (!xen_domain ())return -ENODEV ;
Quoted 13 lines
drivers/block/xen-blkback/blkback.c static int __init xen_blkif_init(void) · line 1394
Quoted 11 lines
drivers/block/xen-blkback/blkback.c +11
-0+#ifdef CONFIG_X86 +if (xen_feature (XENFEAT_auto_translated_physmap) && + !xen_feature (XENFEAT_hvm_gntmap_supports_iommu)) { +/* +* blkback cannot work properly on auto-translated guests +* if grant table mappings don't update the IOMMU entries. +*/ +pr_debug (DRV_PFX "Disabling blkback because Xen is missing feature XENFEAT_hvm_gntmap_supports_iommu\n" ); +return -ENODEV ; + } +#endif /* CONFIG_X86 */ Why
CONFIG_X86?
ARM has a bounce buffer for foreign pages, so this is not needed.
Quoted 3 lines
David
Quoted 13 lines · Roger Pau Monné
Quoted 12 lines · David Vrabel
Quoted 3 lines · Roger Pau Monne
Blkback cannot work properly on auto-translated guests if Xen doesn't update the IOMMU when performing grant maps/unmaps, so only attach if the newly introduced
XENFEAT_hvm_gntmap_supports_iommuis found.Can you explain the problem in more detail and which guest configurations are affected?
This isn't a problem that is specific to blkback, but any backend that grant maps and passes the foreign pages to a device so there needs to be a generic solution.
Quoted 7 lines
Quoted 1 line
Why can't this be fixed by having the swiotlb bounce foreign pages?
Yes, it could be fixed with that, FreeBSD has been doing it for a long time.
But since nobody has complained about this, and the issue has been there for a long time, I'm not sure it's worth adding all the bounce buffer code for what seems to be an unused configuration.
Ok. Now that netback also grant maps. Can you make this a generic function and call from netback and blkback?
David
Quoted 13 lines · Roger Pau Monné
Quoted 12 lines · David Vrabel
Quoted 3 lines · Roger Pau Monne
Blkback cannot work properly on auto-translated guests if Xen doesn't update the IOMMU when performing grant maps/unmaps, so only attach if the newly introduced
XENFEAT_hvm_gntmap_supports_iommuis found.Can you explain the problem in more detail and which guest configurations are affected?
This isn't a problem that is specific to blkback, but any backend that grant maps and passes the foreign pages to a device so there needs to be a generic solution.
Quoted 7 lines
Quoted 1 line
Why can't this be fixed by having the swiotlb bounce foreign pages?
Yes, it could be fixed with that, FreeBSD has been doing it for a long time.
But since nobody has complained about this, and the issue has been there for a long time, I'm not sure it's worth adding all the bounce buffer code for what seems to be an unused configuration.
Ok. Now that netback also grant maps. Can you make this a generic function and call from netback and blkback?
David
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 5 lines · David Vrabel
Quoted 3 lines · Roger Pau Monne
Blkback cannot work properly on auto-translated guests if Xen doesn't update the IOMMU when performing grant maps/unmaps, so only attach if the newly introduced
XENFEAT_hvm_gntmap_supports_iommuis found.
Quoted 8 lines
Can you explain the problem in more detail and which guest configurations are affected?
This isn't a problem that is specific to blkback, but any backend that grant maps and passes the foreign pages to a device so there needs to be a generic solution.
Why can't this be fixed by having the swiotlb bounce foreign pages?
Yes, it could be fixed with that, FreeBSD has been doing it for a long time.
But since nobody has complained about this, and the issue has been there for a long time, I'm not sure it's worth adding all the bounce buffer code for what seems to be an unused configuration.
Also, since Linux also supports PV, I would just say that if you want to use driver domains you are forced to use PV guests (or have a recent Xen version that properly updates the IOMMU on grant map/unmap).
Quoted 6 lines
Quoted 6 lines
drivers/block/xen-blkback/blkback.c +0
-0@@ -1381,6 +1381,18 @@ static int __init xen_blkif_init(void)if (!xen_domain ())return -ENODEV ;
Quoted 13 lines
drivers/block/xen-blkback/blkback.c static int __init xen_blkif_init(void) · line 1394
Quoted 11 lines
drivers/block/xen-blkback/blkback.c +11
-0+#ifdef CONFIG_X86 +if (xen_feature (XENFEAT_auto_translated_physmap) && + !xen_feature (XENFEAT_hvm_gntmap_supports_iommu)) { +/* +* blkback cannot work properly on auto-translated guests +* if grant table mappings don't update the IOMMU entries. +*/ +pr_debug (DRV_PFX "Disabling blkback because Xen is missing feature XENFEAT_hvm_gntmap_supports_iommu\n" ); +return -ENODEV ; + } +#endif /* CONFIG_X86 */ Why
CONFIG_X86?
ARM has a bounce buffer for foreign pages, so this is not needed.
Quoted 3 lines
David
Quoted 3 lines · Roger Pau Monne
Blkback cannot work properly on auto-translated guests if Xen doesn't update the IOMMU when performing grant maps/unmaps, so only attach if the newly introduced
XENFEAT_hvm_gntmap_supports_iommuis found.
Could you point to the git commit that introduces it in the patch please?
Quoted 53 lines
Signed-off-by Roger Pau Monné <[email protected]>Cc Konrad Rzeszutek Wilk <[email protected]>Cc David Vrabel <[email protected]>Cc Boris Ostrovsky <[email protected]>--- drivers/block/xen-blkback/blkback.c | 12 ++++++++++++ include/xen/interface/features.h | 6 ++++++ 2 files changed, 18 insertions(+), 0 deletions(-)drivers/block/xen-blkback/blkback.c +12
-0@@ -1381,6 +1381,18 @@ static int __init xen_blkif_init(void)if (!xen_domain ())return -ENODEV ; +#ifdef CONFIG_X86 +if (xen_feature (XENFEAT_auto_translated_physmap) && + !xen_feature (XENFEAT_hvm_gntmap_supports_iommu)) { +/* +* blkback cannot work properly on auto-translated guests +* if grant table mappings don't update the IOMMU entries. +*/ +pr_debug (DRV_PFX "Disabling blkback because Xen is missing feature XENFEAT_hvm_gntmap_supports_iommu\n" ); +return -ENODEV ; + } +#endif /* CONFIG_X86 */ + rc =xen_blkif_interface_init ();if (rc) goto failed_init;include/xen/interface/features.h +6
-0@@ -53,6 +53,12 @@/* operation as Dom0 is supported */ #define XENFEAT_dom0 11 +/* +* If set, GNTTABOP_map_grant_ref sets the proper IOMMU mappings so the +* resulting mapped page can be used for IO with hardware devices. +*/ +#define XENFEAT_hvm_gntmap_supports_iommu 12 +#define XENFEAT_NR_SUBMAPS 1#endif /* __XEN_PUBLIC_FEATURES_H__ */ Signature · 1 line
1.7.7.5 (Apple Git-26)
Quoted 3 lines · Roger Pau Monne
Blkback cannot work properly on auto-translated guests if Xen doesn't update the IOMMU when performing grant maps/unmaps, so only attach if the newly introduced
XENFEAT_hvm_gntmap_supports_iommuis found.
Could you point to the git commit that introduces it in the patch please?
Quoted 53 lines
Signed-off-by Roger Pau Monné <[email protected]>Cc Konrad Rzeszutek Wilk <[email protected]>Cc David Vrabel <[email protected]>Cc Boris Ostrovsky <[email protected]>--- drivers/block/xen-blkback/blkback.c | 12 ++++++++++++ include/xen/interface/features.h | 6 ++++++ 2 files changed, 18 insertions(+), 0 deletions(-)drivers/block/xen-blkback/blkback.c +12
-0@@ -1381,6 +1381,18 @@ static int __init xen_blkif_init(void)if (!xen_domain ())return -ENODEV ; +#ifdef CONFIG_X86 +if (xen_feature (XENFEAT_auto_translated_physmap) && + !xen_feature (XENFEAT_hvm_gntmap_supports_iommu)) { +/* +* blkback cannot work properly on auto-translated guests +* if grant table mappings don't update the IOMMU entries. +*/ +pr_debug (DRV_PFX "Disabling blkback because Xen is missing feature XENFEAT_hvm_gntmap_supports_iommu\n" ); +return -ENODEV ; + } +#endif /* CONFIG_X86 */ + rc =xen_blkif_interface_init ();if (rc) goto failed_init;include/xen/interface/features.h +6
-0@@ -53,6 +53,12 @@/* operation as Dom0 is supported */ #define XENFEAT_dom0 11 +/* +* If set, GNTTABOP_map_grant_ref sets the proper IOMMU mappings so the +* resulting mapped page can be used for IO with hardware devices. +*/ +#define XENFEAT_hvm_gntmap_supports_iommu 12 +#define XENFEAT_NR_SUBMAPS 1#endif /* __XEN_PUBLIC_FEATURES_H__ */ Signature · 1 line
1.7.7.5 (Apple Git-26)