Skip to content

Commit d59f532

Browse files
jgross1Boris Ostrovsky
authored andcommitted
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. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
1 parent 70513d5 commit d59f532

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

drivers/xen/grant-table.c

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,18 +1040,33 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
10401040
return ret;
10411041

10421042
for (i = 0; i < count; i++) {
1043-
/* Retry eagain maps */
1044-
if (map_ops[i].status == GNTST_eagain)
1045-
gnttab_retry_eagain_gop(GNTTABOP_map_grant_ref, map_ops + i,
1046-
&map_ops[i].status, __func__);
1047-
1048-
if (map_ops[i].status == GNTST_okay) {
1043+
switch (map_ops[i].status) {
1044+
case GNTST_okay:
1045+
{
10491046
struct xen_page_foreign *foreign;
10501047

10511048
SetPageForeign(pages[i]);
10521049
foreign = xen_page_foreign(pages[i]);
10531050
foreign->domid = map_ops[i].dom;
10541051
foreign->gref = map_ops[i].ref;
1052+
break;
1053+
}
1054+
1055+
case GNTST_no_device_space:
1056+
pr_warn_ratelimited("maptrack limit reached, can't map all guest pages\n");
1057+
break;
1058+
1059+
case GNTST_eagain:
1060+
/* Retry eagain maps */
1061+
gnttab_retry_eagain_gop(GNTTABOP_map_grant_ref,
1062+
map_ops + i,
1063+
&map_ops[i].status, __func__);
1064+
/* Test status in next loop iteration. */
1065+
i--;
1066+
break;
1067+
1068+
default:
1069+
break;
10551070
}
10561071
}
10571072

0 commit comments

Comments
 (0)