drivers: xen: gnttab: process gnttabs in reverse order

The Xen extends domain grant tables every time domain requests gnttab
basing on gnttab idx. If idx > xen_current_max_gnttab_idx the Xen extends
grant table so that idx <= xen_current_max_gnttab_idx. The growing grant
tables on every hypercall is a bit costly operation and it also results in
the bunch of log messages:

(XEN) xen-source/xen/common/grant_table.c:1909:d0v0 Expanding d0 \
  grant table from 1 to 2 frames

This patch changes gnttab processing from gnttab max_idx to low_idx, so the
first hypercall has the largest index, ensuring that the grant table will
grow only once. It also reduces number of log messages.

Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
This commit is contained in:
Grygorii Strashko 2024-06-10 13:08:10 +03:00 committed by Benjamin Cabé
commit e549bc702a

View file

@ -342,7 +342,7 @@ static int gnttab_init(void)
gnttab.gref_list[gref] = gref + 1;
}
for (i = 0; i < CONFIG_NR_GRANT_FRAMES; i++) {
for (i = CONFIG_NR_GRANT_FRAMES - 1; i >= 0; i--) {
xatp.domid = DOMID_SELF;
xatp.size = 0;
xatp.space = XENMAPSPACE_grant_table;