Skip to content

Commit

Permalink
xen: issue warning message when out of grant maptrack entries
Browse files Browse the repository at this point in the history
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]>
Reviewed-by: Boris Ostrovsky <[email protected]>
Signed-off-by: Boris Ostrovsky <[email protected]>
  • Loading branch information
jgross1 authored and Boris Ostrovsky committed Sep 19, 2018
1 parent 70513d5 commit d59f532
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions drivers/xen/grant-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,18 +1040,33 @@ 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__);
/* Test status in next loop iteration. */
i--;
break;

default:
break;
}
}

Expand Down

0 comments on commit d59f532

Please sign in to comment.