xen: issue warning message when out of grant maptrack entries
Juergen Gross
maintainerPATCH 1/1 xen: issue warning message when out of grant maptrack entries
When a driver domain (e.g. dom0) is running out of maptrack entries it can't map any more foreign domain pages. Instead of silently stalling the affected domUs issue a rate limited warning in this case in order to make it easier to detect that situation.
--- drivers/xen/grant-table.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
drivers/xen/grant-table.c +19 -6
@@ -1040,18 +1040,31 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,return ret;for (i =0 ; i < count; i++) { -/* Retry eagain maps */ -if (map_ops[i].status == GNTST_eagain) -gnttab_retry_eagain_gop (GNTTABOP_map_grant_ref, map_ops + i, - &map_ops[i].status, __func__); - -if (map_ops[i].status == GNTST_okay) { +switch (map_ops[i].status) { +case GNTST_okay: + {struct xen_page_foreign *foreign;SetPageForeign (pages[i]); foreign =xen_page_foreign (pages[i]); foreign->domid = map_ops[i].dom; foreign->gref = map_ops[i].ref; +break ; + } + +case GNTST_no_device_space: +pr_warn_ratelimited ("maptrack limit reached, can't map all guest pages\n" ); +break ; + +case GNTST_eagain: +/* Retry eagain maps */ +gnttab_retry_eagain_gop (GNTTABOP_map_grant_ref, + map_ops + i, + &map_ops[i].status, __func__); +break ; + +default : +break ; } }
Signature · 1 line
2.16.4
Quoted 41 lines · Juergen Gross
When a driver domain (e.g. dom0) is running out of maptrack entries it can't map any more foreign domain pages. Instead of silently stalling the affected domUs issue a rate limited warning in this case in order to make it easier to detect that situation.
Signed-off-by Juergen Gross <[email protected]>--- drivers/xen/grant-table.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)drivers/xen/grant-table.c +11
-6@@ -1040,18 +1040,31 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,return ret;for (i =0 ; i < count; i++) { -/* Retry eagain maps */ -if (map_ops[i].status == GNTST_eagain) -gnttab_retry_eagain_gop (GNTTABOP_map_grant_ref, map_ops + i, - &map_ops[i].status, __func__); - -if (map_ops[i].status == GNTST_okay) { +switch (map_ops[i].status) { +case GNTST_okay: + {struct xen_page_foreign *foreign;SetPageForeign (pages[i]); foreign =xen_page_foreign (pages[i]); foreign->domid = map_ops[i].dom; foreign->gref = map_ops[i].ref; +break ; + } + +case GNTST_no_device_space: +pr_warn_ratelimited ("maptrack limit reached, can't map all guest pages\n" ); +break ; + +case GNTST_eagain:
drivers/xen/grant-table.c int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, · line 1069
Quoted 10 lines
drivers/xen/grant-table.c +8
-0+/* Retry eagain maps */ +gnttab_retry_eagain_gop (GNTTABOP_map_grant_ref, + map_ops + i, + &map_ops[i].status, __func__); +break ; + +default : +break ; } }
Should we pass 'i' instead of count to set_foreign_p2m_mapping() below? The loop there will skip entries that are in error, but does it make sense to do the hypercall for kmap_ops with count>i ?
-boris
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 41 lines · Juergen Gross
When a driver domain (e.g. dom0) is running out of maptrack entries it can't map any more foreign domain pages. Instead of silently stalling the affected domUs issue a rate limited warning in this case in order to make it easier to detect that situation.
Signed-off-by Juergen Gross <[email protected]>--- drivers/xen/grant-table.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)drivers/xen/grant-table.c +11
-6@@ -1040,18 +1040,31 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,return ret;for (i =0 ; i < count; i++) { -/* Retry eagain maps */ -if (map_ops[i].status == GNTST_eagain) -gnttab_retry_eagain_gop (GNTTABOP_map_grant_ref, map_ops + i, - &map_ops[i].status, __func__); - -if (map_ops[i].status == GNTST_okay) { +switch (map_ops[i].status) { +case GNTST_okay: + {struct xen_page_foreign *foreign;SetPageForeign (pages[i]); foreign =xen_page_foreign (pages[i]); foreign->domid = map_ops[i].dom; foreign->gref = map_ops[i].ref; +break ; + } + +case GNTST_no_device_space: +pr_warn_ratelimited ("maptrack limit reached, can't map all guest pages\n" ); +break ; + +case GNTST_eagain:
drivers/xen/grant-table.c int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, · line 1069
Quoted 10 lines
drivers/xen/grant-table.c +8
-0+/* Retry eagain maps */ +gnttab_retry_eagain_gop (GNTTABOP_map_grant_ref, + map_ops + i, + &map_ops[i].status, __func__); +break ; + +default : +break ; } }
Should we pass 'i' instead of count to set_foreign_p2m_mapping() below? The loop there will skip entries that are in error, but does it make sense to do the hypercall for kmap_ops with count>i ?
-boris
Juergen Gross
maintainerQuoted 49 lines · Boris Ostrovsky
Quoted 48 lines · Juergen Gross
When a driver domain (e.g. dom0) is running out of maptrack entries it can't map any more foreign domain pages. Instead of silently stalling the affected domUs issue a rate limited warning in this case in order to make it easier to detect that situation.
Signed-off-by Juergen Gross <[email protected]>--- drivers/xen/grant-table.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)drivers/xen/grant-table.c +18
-6@@ -1040,18 +1040,31 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,return ret;for (i =0 ; i < count; i++) { -/* Retry eagain maps */ -if (map_ops[i].status == GNTST_eagain) -gnttab_retry_eagain_gop (GNTTABOP_map_grant_ref, map_ops + i, - &map_ops[i].status, __func__); - -if (map_ops[i].status == GNTST_okay) { +switch (map_ops[i].status) { +case GNTST_okay: + {struct xen_page_foreign *foreign;SetPageForeign (pages[i]); foreign =xen_page_foreign (pages[i]); foreign->domid = map_ops[i].dom; foreign->gref = map_ops[i].ref; +break ; + } + +case GNTST_no_device_space: +pr_warn_ratelimited ("maptrack limit reached, can't map all guest pages\n" ); +break ; + +case GNTST_eagain: +/* Retry eagain maps */ +gnttab_retry_eagain_gop (GNTTABOP_map_grant_ref, + map_ops + i, + &map_ops[i].status, __func__); +break ; + +default :
Quoted 8 lines
drivers/xen/grant-table.c int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, · line 1069
Quoted 3 lines
drivers/xen/grant-table.c +1
-0+break ; } }Should we pass 'i' instead of count to
set_foreign_p2m_mapping()below? The loop there will skip entries that are in error, but does it make sense to do the hypercall forkmap_opswith count>i ?
The loop is running until the end, so i == count for the call of kmap_ops().
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerQuoted 49 lines · Boris Ostrovsky
Quoted 48 lines · Juergen Gross
When a driver domain (e.g. dom0) is running out of maptrack entries it can't map any more foreign domain pages. Instead of silently stalling the affected domUs issue a rate limited warning in this case in order to make it easier to detect that situation.
Signed-off-by Juergen Gross <[email protected]>--- drivers/xen/grant-table.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)drivers/xen/grant-table.c +18
-6@@ -1040,18 +1040,31 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,return ret;for (i =0 ; i < count; i++) { -/* Retry eagain maps */ -if (map_ops[i].status == GNTST_eagain) -gnttab_retry_eagain_gop (GNTTABOP_map_grant_ref, map_ops + i, - &map_ops[i].status, __func__); - -if (map_ops[i].status == GNTST_okay) { +switch (map_ops[i].status) { +case GNTST_okay: + {struct xen_page_foreign *foreign;SetPageForeign (pages[i]); foreign =xen_page_foreign (pages[i]); foreign->domid = map_ops[i].dom; foreign->gref = map_ops[i].ref; +break ; + } + +case GNTST_no_device_space: +pr_warn_ratelimited ("maptrack limit reached, can't map all guest pages\n" ); +break ; + +case GNTST_eagain: +/* Retry eagain maps */ +gnttab_retry_eagain_gop (GNTTABOP_map_grant_ref, + map_ops + i, + &map_ops[i].status, __func__); +break ; + +default :
Quoted 8 lines
drivers/xen/grant-table.c int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, · line 1069
Quoted 3 lines
drivers/xen/grant-table.c +1
-0+break ; } }Should we pass 'i' instead of count to
set_foreign_p2m_mapping()below? The loop there will skip entries that are in error, but does it make sense to do the hypercall forkmap_opswith count>i ?
The loop is running until the end, so i == count for the call of kmap_ops().
Juergen
Boris Ostrovsky
Reviewed-byQuoted 2 lines · Juergen Gross
The loop is running until the end, so i == count for the call of
kmap_ops().
OK, so I can't read code.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Boris Ostrovsky
Reviewed-byQuoted 2 lines · Juergen Gross
The loop is running until the end, so i == count for the call of
kmap_ops().
OK, so I can't read code.
Quoted 45 lines · Juergen Gross
Quoted 44 lines · Boris Ostrovsky
Quoted 43 lines · Juergen Gross
When a driver domain (e.g. dom0) is running out of maptrack entries it can't map any more foreign domain pages. Instead of silently stalling the affected domUs issue a rate limited warning in this case in order to make it easier to detect that situation.
Signed-off-by Juergen Gross <[email protected]>--- drivers/xen/grant-table.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)drivers/xen/grant-table.c +13
-6@@ -1040,18 +1040,31 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,return ret;for (i =0 ; i < count; i++) { -/* Retry eagain maps */ -if (map_ops[i].status == GNTST_eagain) -gnttab_retry_eagain_gop (GNTTABOP_map_grant_ref, map_ops + i, - &map_ops[i].status, __func__); - -if (map_ops[i].status == GNTST_okay) { +switch (map_ops[i].status) { +case GNTST_okay: + {struct xen_page_foreign *foreign;SetPageForeign (pages[i]); foreign =xen_page_foreign (pages[i]); foreign->domid = map_ops[i].dom; foreign->gref = map_ops[i].ref; +break ; + } + +case GNTST_no_device_space: +pr_warn_ratelimited ("maptrack limit reached, can't map all guest pages\n" ); +break ; + +case GNTST_eagain: +/* Retry eagain maps */ + gnttab_retry_eagain_gop(GNTTABOP_map_grant_ref,
Quoted 8 lines
Quoted 8 lines
drivers/xen/grant-table.c int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, · line 1069
Quoted 8 lines
drivers/xen/grant-table.c +6
-0+ map_ops + i, + &map_ops[i].status, __func__); +break ; + +default : +break ; } }
After having a second look at this (and at the risk of embarrassing myself again with this patch) --- aren't we supposed to test status after gnttab_retry_eagain_gop() call, and then actually set foreign properties?
-boris
Quoted 8 lines
Quoted 4 lines
Should we pass 'i' instead of count to
set_foreign_p2m_mapping()below? The loop there will skip entries that are in error, but does it make sense to do the hypercall forkmap_opswith count>i ?The loop is running until the end, so i == count for the call of
kmap_ops().Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 45 lines · Juergen Gross
Quoted 44 lines · Boris Ostrovsky
Quoted 43 lines · Juergen Gross
When a driver domain (e.g. dom0) is running out of maptrack entries it can't map any more foreign domain pages. Instead of silently stalling the affected domUs issue a rate limited warning in this case in order to make it easier to detect that situation.
Signed-off-by Juergen Gross <[email protected]>--- drivers/xen/grant-table.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)drivers/xen/grant-table.c +13
-6@@ -1040,18 +1040,31 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,return ret;for (i =0 ; i < count; i++) { -/* Retry eagain maps */ -if (map_ops[i].status == GNTST_eagain) -gnttab_retry_eagain_gop (GNTTABOP_map_grant_ref, map_ops + i, - &map_ops[i].status, __func__); - -if (map_ops[i].status == GNTST_okay) { +switch (map_ops[i].status) { +case GNTST_okay: + {struct xen_page_foreign *foreign;SetPageForeign (pages[i]); foreign =xen_page_foreign (pages[i]); foreign->domid = map_ops[i].dom; foreign->gref = map_ops[i].ref; +break ; + } + +case GNTST_no_device_space: +pr_warn_ratelimited ("maptrack limit reached, can't map all guest pages\n" ); +break ; + +case GNTST_eagain: +/* Retry eagain maps */ + gnttab_retry_eagain_gop(GNTTABOP_map_grant_ref,
Quoted 8 lines
Quoted 8 lines
drivers/xen/grant-table.c int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, · line 1069
Quoted 8 lines
drivers/xen/grant-table.c +6
-0+ map_ops + i, + &map_ops[i].status, __func__); +break ; + +default : +break ; } }
After having a second look at this (and at the risk of embarrassing myself again with this patch) --- aren't we supposed to test status after gnttab_retry_eagain_gop() call, and then actually set foreign properties?
-boris
Quoted 8 lines
Quoted 4 lines
Should we pass 'i' instead of count to
set_foreign_p2m_mapping()below? The loop there will skip entries that are in error, but does it make sense to do the hypercall forkmap_opswith count>i ?The loop is running until the end, so i == count for the call of
kmap_ops().Juergen
Juergen Gross
maintainerQuoted 52 lines · Boris Ostrovsky
Quoted 51 lines · Juergen Gross
Quoted 50 lines · Boris Ostrovsky
Quoted 49 lines · Juergen Gross
When a driver domain (e.g. dom0) is running out of maptrack entries it can't map any more foreign domain pages. Instead of silently stalling the affected domUs issue a rate limited warning in this case in order to make it easier to detect that situation.
Signed-off-by Juergen Gross <[email protected]>--- drivers/xen/grant-table.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)drivers/xen/grant-table.c +19
-6@@ -1040,18 +1040,31 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,return ret;for (i =0 ; i < count; i++) { -/* Retry eagain maps */ -if (map_ops[i].status == GNTST_eagain) -gnttab_retry_eagain_gop (GNTTABOP_map_grant_ref, map_ops + i, - &map_ops[i].status, __func__); - -if (map_ops[i].status == GNTST_okay) { +switch (map_ops[i].status) { +case GNTST_okay: + {struct xen_page_foreign *foreign;SetPageForeign (pages[i]); foreign =xen_page_foreign (pages[i]); foreign->domid = map_ops[i].dom; foreign->gref = map_ops[i].ref; +break ; + } + +case GNTST_no_device_space: +pr_warn_ratelimited ("maptrack limit reached, can't map all guest pages\n" ); +break ; + +case GNTST_eagain: +/* Retry eagain maps */ +gnttab_retry_eagain_gop (GNTTABOP_map_grant_ref, + map_ops + i, + &map_ops[i].status, __func__); +break ; + +default : +break ;
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
drivers/xen/grant-table.c int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, · line 1069
Quoted 2 lines
drivers/xen/grant-table.c +0
-0} }After having a second look at this (and at the risk of embarrassing myself again with this patch) --- aren't we supposed to test status after
gnttab_retry_eagain_gop()call, and then actually set foreign properties?
Right. Thanks for catching that!
V2 coming soon...
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerQuoted 52 lines · Boris Ostrovsky
Quoted 51 lines · Juergen Gross
Quoted 50 lines · Boris Ostrovsky
Quoted 49 lines · Juergen Gross
When a driver domain (e.g. dom0) is running out of maptrack entries it can't map any more foreign domain pages. Instead of silently stalling the affected domUs issue a rate limited warning in this case in order to make it easier to detect that situation.
Signed-off-by Juergen Gross <[email protected]>--- drivers/xen/grant-table.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)drivers/xen/grant-table.c +19
-6@@ -1040,18 +1040,31 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,return ret;for (i =0 ; i < count; i++) { -/* Retry eagain maps */ -if (map_ops[i].status == GNTST_eagain) -gnttab_retry_eagain_gop (GNTTABOP_map_grant_ref, map_ops + i, - &map_ops[i].status, __func__); - -if (map_ops[i].status == GNTST_okay) { +switch (map_ops[i].status) { +case GNTST_okay: + {struct xen_page_foreign *foreign;SetPageForeign (pages[i]); foreign =xen_page_foreign (pages[i]); foreign->domid = map_ops[i].dom; foreign->gref = map_ops[i].ref; +break ; + } + +case GNTST_no_device_space: +pr_warn_ratelimited ("maptrack limit reached, can't map all guest pages\n" ); +break ; + +case GNTST_eagain: +/* Retry eagain maps */ +gnttab_retry_eagain_gop (GNTTABOP_map_grant_ref, + map_ops + i, + &map_ops[i].status, __func__); +break ; + +default : +break ;
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
drivers/xen/grant-table.c int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, · line 1069
Quoted 2 lines
drivers/xen/grant-table.c +0
-0} }After having a second look at this (and at the risk of embarrassing myself again with this patch) --- aren't we supposed to test status after
gnttab_retry_eagain_gop()call, and then actually set foreign properties?
Right. Thanks for catching that!
V2 coming soon...
Juergen