From c615845d22acca309ef4193308980e79725989d0 Mon Sep 17 00:00:00 2001 From: Wengang Wang Date: Wed, 5 Jul 2017 10:42:41 -0700 Subject: [PATCH] xen/grant-table: log the lack of grants Orabug: 26324349 log a message when we enter this situation: 1) we already allocated the max number of available grants from hypervisor and 2) we still need more (but the request fails because of 1)). Sometimes the lack of grants causes IO hangs in xen_blkfront devices. Adding this log would help debuging. Signed-off-by: Wengang Wang Reviewed-by: Konrad Rzeszutek Wilk Reviewed-by: Junxiao Bi --- drivers/xen/grant-table.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index effbaf91791f..f6087f754e76 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -1073,8 +1074,14 @@ static int gnttab_expand(unsigned int req_entries) cur = nr_grant_frames; extra = ((req_entries + (grefs_per_grant_frame-1)) / grefs_per_grant_frame); - if (cur + extra > gnttab_max_grant_frames()) + if (cur + extra > gnttab_max_grant_frames()) { + pr_warn_ratelimited("xen/grant-table: max_grant_frames reached" + " cur=%u extra=%u limit=%u" + " gnttab_free_count=%u req_entries=%u\n", + cur, extra, gnttab_max_grant_frames(), + gnttab_free_count, req_entries); return -ENOSPC; + } rc = gnttab_map(cur, cur + extra - 1); if (rc == 0) -- 2.50.1