Skip to contentSkip to conversation

Input: xen-kbdfront - free grant table entry in xenkbd_disconnect_backend

PATCH Applied [email protected] 3 participants 5 messages Oct 16, 2014 Input drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: xen-kbdfront - free grant table entry in xenkbd_disconnect_backend

From: Chang Huaixin <[email protected]>

xenkbd_disconnect_backend doesn't free grant table entry. This bug affects live migration.

xenkbd_disconnect_backend uses gnttab_end_foreign_access_ref to handle grant table entry which doesn't really free an entry.

Thus every time we do xenkbd_resume, grant table entry increses by one. As an grant table entry occupies 8 bytes, an grant table page has at most 512 entries. Every 512 times we do xenkdb_resume, grant table pages increses by one.

After around 3500 times of live migration, grant table pages will increase by 7, causing too many pages to populate and hitting max_pages limit when assigning pages.Thus assign_pages will fail, so will live migration.

---
 drivers/input/misc/xen-kbdfront.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/misc/xen-kbdfront.c +2 -2
index fbfdc10..e2ecfc6 100644
@@ -285,7 +285,7 @@ static int xenkbd_connect_backend(struct xenbus_device *dev,
  error_evtchan:
 	xenbus_free_evtchn(dev, evtchn);
  error_grant:
-	gnttab_end_foreign_access_ref(info->gref, 0);
+	gnttab_end_foreign_access(info->gref, 0, 0UL);
 	info->gref = -1;
 	return ret;
 }
@@ -296,7 +296,7 @@ static void xenkbd_disconnect_backend(struct xenkbd_info *info)
 		unbind_from_irqhandler(info->irq, info);
 	info->irq = -1;
 	if (info->gref >= 0)
-		gnttab_end_foreign_access_ref(info->gref, 0);
+		gnttab_end_foreign_access(info->gref, 0, 0UL);
 	info->gref = -1;
 }
 
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · On 16/10/14 02:46, [email protected] wrote:

From: Chang Huaixin <[email protected]>

xenkbd_disconnect_backend doesn't free grant table entry. This bug affects live migration.

xenkbd_disconnect_backend uses gnttab_end_foreign_access_ref to handle grant table entry which doesn't really free an entry.

Thus every time we do xenkbd_resume, grant table entry increses by one. As an grant table entry occupies 8 bytes, an grant table page has at most 512 entries. Every 512 times we do xenkdb_resume, grant table pages increses by one.

Quoted 4 lines

After around 3500 times of live migration, grant table pages will increase by 7, causing too many pages to populate and hitting max_pages limit when assigning pages.Thus assign_pages will fail, so will live migration.

This need to be send to the input subsystem maintainers.

David

Acked-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 13 lines · On 16/10/14 02:46, [email protected] wrote:

From: Chang Huaixin <[email protected]>

xenkbd_disconnect_backend doesn't free grant table entry. This bug affects live migration.

xenkbd_disconnect_backend uses gnttab_end_foreign_access_ref to handle grant table entry which doesn't really free an entry.

Thus every time we do xenkbd_resume, grant table entry increses by one. As an grant table entry occupies 8 bytes, an grant table page has at most 512 entries. Every 512 times we do xenkdb_resume, grant table pages increses by one.

Quoted 4 lines

After around 3500 times of live migration, grant table pages will increase by 7, causing too many pages to populate and hitting max_pages limit when assigning pages.Thus assign_pages will fail, so will live migration.

This need to be send to the input subsystem maintainers.

David

maintainer Applied
#3 lore raw
Quoted 14 lines · David Vrabel
Quoted 13 lines · On 16/10/14 02:46, [email protected] wrote:

From: Chang Huaixin <[email protected]>

xenkbd_disconnect_backend doesn't free grant table entry. This bug affects live migration.

xenkbd_disconnect_backend uses gnttab_end_foreign_access_ref to handle grant table entry which doesn't really free an entry.

Thus every time we do xenkbd_resume, grant table entry increses by one. As an grant table entry occupies 8 bytes, an grant table page has at most 512 entries. Every 512 times we do xenkdb_resume, grant table pages increses by one.

Quoted 8 lines
Quoted 4 lines

After around 3500 times of live migration, grant table pages will increase by 7, causing too many pages to populate and hitting max_pages limit when assigning pages.Thus assign_pages will fail, so will live migration.

This need to be send to the input subsystem maintainers.

Applied, thank you.

Signature · 1 line
Dmitry
maintainer Applied
#4 lore raw
In reply to David Vrabel
Quoted 14 lines · David Vrabel
Quoted 13 lines · On 16/10/14 02:46, [email protected] wrote:

From: Chang Huaixin <[email protected]>

xenkbd_disconnect_backend doesn't free grant table entry. This bug affects live migration.

xenkbd_disconnect_backend uses gnttab_end_foreign_access_ref to handle grant table entry which doesn't really free an entry.

Thus every time we do xenkbd_resume, grant table entry increses by one. As an grant table entry occupies 8 bytes, an grant table page has at most 512 entries. Every 512 times we do xenkdb_resume, grant table pages increses by one.

Quoted 8 lines
Quoted 4 lines

After around 3500 times of live migration, grant table pages will increase by 7, causing too many pages to populate and hitting max_pages limit when assigning pages.Thus assign_pages will fail, so will live migration.

This need to be send to the input subsystem maintainers.

Applied, thank you.

Signature · 1 line
Dmitry