Skip to content

Commit 29d11cf

Browse files
Wengang-oraclejgross1
authored andcommitted
xen/grant-table: log the lack of grants
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 <[email protected]> Reviewed-by: Konrad Rzeszutek Wilk <[email protected]> Reviewed-by: Junxiao Bi <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Signed-off-by: Juergen Gross <[email protected]>
1 parent 0e4d394 commit 29d11cf

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/xen/grant-table.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include <linux/delay.h>
4343
#include <linux/hardirq.h>
4444
#include <linux/workqueue.h>
45+
#include <linux/ratelimit.h>
4546

4647
#include <xen/xen.h>
4748
#include <xen/interface/xen.h>
@@ -1072,8 +1073,14 @@ static int gnttab_expand(unsigned int req_entries)
10721073
cur = nr_grant_frames;
10731074
extra = ((req_entries + (grefs_per_grant_frame-1)) /
10741075
grefs_per_grant_frame);
1075-
if (cur + extra > gnttab_max_grant_frames())
1076+
if (cur + extra > gnttab_max_grant_frames()) {
1077+
pr_warn_ratelimited("xen/grant-table: max_grant_frames reached"
1078+
" cur=%u extra=%u limit=%u"
1079+
" gnttab_free_count=%u req_entries=%u\n",
1080+
cur, extra, gnttab_max_grant_frames(),
1081+
gnttab_free_count, req_entries);
10761082
return -ENOSPC;
1083+
}
10771084

10781085
rc = gnttab_map(cur, cur + extra - 1);
10791086
if (rc == 0)

0 commit comments

Comments
 (0)