Skip to contentSkip to conversation

xen/grant-table: fix suspend for non-PV guests

PATCH In review David Vrabel 2 participants 4 messages Jun 16, 2014 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/grant-table: fix suspend for non-PV guests

Commit aa8532c32216ae07c3813b9aeb774517878a7573 (xen: refactor suspend pre/post hooks) broke resuming PVHVM (auto-translated physmap) guests.

The gnttab_suspend() would clear the mapping for the grant table frames, but the ->unmap_frames() call is only applicable to PV guests.

---
 drivers/xen/grant-table.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/xen/grant-table.c +2 -1
index 6d325bd..5d4de88 100644
@@ -1168,7 +1168,8 @@ int gnttab_resume(void)
 
 int gnttab_suspend(void)
 {
-	gnttab_interface->unmap_frames();
+	if (!xen_feature(XENFEAT_auto_translated_physmap))
+		gnttab_interface->unmap_frames();
 	return 0;
 }
 
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 7 lines · David Vrabel

Commit aa8532c32216ae07c3813b9aeb774517878a7573 (xen: refactor suspend pre/post hooks) broke resuming PVHVM (auto-translated physmap) guests.

The gnttab_suspend() would clear the mapping for the grant table frames, but the ->unmap_frames() call is only applicable to PV guests.

You forgot:

However, if the code is structured like this, should we just make the 'unmap_frames' be a NOP for HVM and instead have:

if (gnttab_interface->unmap_frames)

	gnttab_interface->unmap_frames();

And the HVM path will make sure that 'unmap_frames' is set to NULL?

Maybe even change the name to 'unmap_frames_pv' ?

Quoted 21 lines
---
 drivers/xen/grant-table.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/xen/grant-table.c +2 -1
index 6d325bd..5d4de88 100644
@@ -1168,7 +1168,8 @@ int gnttab_resume(void)
 
 int gnttab_suspend(void)
 {
-	gnttab_interface->unmap_frames();
+	if (!xen_feature(XENFEAT_auto_translated_physmap))
+		gnttab_interface->unmap_frames();
 	return 0;
 }
 
Signature · 1 line
1.7.10.4
#2 lore raw
Quoted 4 lines · Konrad Rzeszutek Wilk
Quoted 3 lines · David Vrabel

Commit aa8532c32216ae07c3813b9aeb774517878a7573 (xen: refactor suspend pre/post hooks) broke resuming PVHVM (auto-translated physmap) guests.

Quoted 8 lines
Quoted 4 lines

The gnttab_suspend() would clear the mapping for the grant table frames, but the ->unmap_frames() call is only applicable to PV guests.

You forgot:

I'm more interested in a Tested-by, any chance of one?

Quoted 10 lines

However, if the code is structured like this, should we just make the 'unmap_frames' be a NOP for HVM and instead have:

if (gnttab_interface->unmap_frames)

	gnttab_interface->unmap_frames();

And the HVM path will make sure that 'unmap_frames' is set to NULL?

Maybe even change the name to 'unmap_frames_pv' ?

That may be useful as part of a wider refactor. But the use of the feature test mirrors the use in gnttab_setup() (as called by gnttab_resume()) so I think it is clearer.

David

#3 lore raw
In reply to David Vrabel
Quoted 7 lines · David Vrabel

Commit aa8532c32216ae07c3813b9aeb774517878a7573 (xen: refactor suspend pre/post hooks) broke resuming PVHVM (auto-translated physmap) guests.

The gnttab_suspend() would clear the mapping for the grant table frames, but the ->unmap_frames() call is only applicable to PV guests.

When I do 'v3.15' + 'stable/for-linus-3.16' merge it fixes the issue I had seen. You can pluck:

Thank you.

Quoted 21 lines
---
 drivers/xen/grant-table.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/xen/grant-table.c +2 -1
index 6d325bd..5d4de88 100644
@@ -1168,7 +1168,8 @@ int gnttab_resume(void)
 
 int gnttab_suspend(void)
 {
-	gnttab_interface->unmap_frames();
+	if (!xen_feature(XENFEAT_auto_translated_physmap))
+		gnttab_interface->unmap_frames();
 	return 0;
 }
 
Signature · 1 line
1.7.10.4