Skip to contentSkip to conversation

Grant table version

DISCUSSION Vladimir 'φ-coder/phcoder' Serbinenko 4 participants 7 messages Oct 28, 2013 – Dec 15, 2013

lore
Share & tools
lore
#0 lore raw

Hello, all. I'm working on pvgrub2 and my problem is following:
When you first use grant tables you commit yourself to a particular grant table version. GRUB has to read from disk and hence use grant tables. By doing so it commits anything that it loads to the same version. Would it be possible to have a hypercall to reset grant table version? Of course, before doing such a call one would need to revoke all grants or this call would discard all current grants.

#1 lore raw
Quoted 7 lines · Vladimir 'φ-coder/phcoder' Serbinenko

Hello, all. I'm working on pvgrub2 and my problem is following:
When you first use grant tables you commit yourself to a particular grant table version. GRUB has to read from disk and hence use grant tables. By doing so it commits anything that it loads to the same version. Would it be possible to have a hypercall to reset grant table version? Of course, before doing such a call one would need to revoke all grants or this call would discard all current grants.

You can change back and forth with grant table versions using the GNTTABOP_set_version hypercall, so long as you have no active grants.

It is not possible to revoke a grant, as the grant ABI guarantees that a successful grant stays mapped until explicitly unmapped. Otherwise, a reset would cause unexpected pagefaults in the mapper domain.

For compatibility reasons it is not strictly required, but it is certainly expected that a new kernel explicitly chooses a gnttab version using the hypercall. There is certainly an area for problems if pvgrub2 uses grant v2, then leaves v2 active and hands off to an older kernel who expects v1 and doesn't explicitly set the version.

Quoted 1 line

From this point of view, the safe course of action is to use whichever

type of grants you want, then tear down all the front/back pairs, and reset the version to v1 before handing off.

~Andrew

Quoted 7 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#2 lore raw
Quoted 22 lines · Andrew Cooper
Quoted 7 lines · Vladimir 'φ-coder/phcoder' Serbinenko

Hello, all. I'm working on pvgrub2 and my problem is following:
When you first use grant tables you commit yourself to a particular grant table version. GRUB has to read from disk and hence use grant tables. By doing so it commits anything that it loads to the same version. Would it be possible to have a hypercall to reset grant table version? Of course, before doing such a call one would need to revoke all grants or this call would discard all current grants.

You can change back and forth with grant table versions using the GNTTABOP_set_version hypercall, so long as you have no active grants.

It is not possible to revoke a grant, as the grant ABI guarantees that a successful grant stays mapped until explicitly unmapped. Otherwise, a reset would cause unexpected pagefaults in the mapper domain.

For compatibility reasons it is not strictly required, but it is certainly expected that a new kernel explicitly chooses a gnttab version using the hypercall. There is certainly an area for problems if pvgrub2 uses grant v2, then leaves v2 active and hands off to an older kernel who expects v1 and doesn't explicitly set the version.

Quoted 4 lines

From this point of view, the safe course of action is to use whichever type of grants you want, then tear down all the front/back pairs, and reset the version to v1 before handing off.

Thank you, that's what I did now.

Quoted 10 lines

~Andrew

Quoted 7 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
In reply to Andrew Cooper
Quoted 22 lines · Andrew Cooper
Quoted 7 lines · Vladimir 'φ-coder/phcoder' Serbinenko

Hello, all. I'm working on pvgrub2 and my problem is following:
When you first use grant tables you commit yourself to a particular grant table version. GRUB has to read from disk and hence use grant tables. By doing so it commits anything that it loads to the same version. Would it be possible to have a hypercall to reset grant table version? Of course, before doing such a call one would need to revoke all grants or this call would discard all current grants.

You can change back and forth with grant table versions using the GNTTABOP_set_version hypercall, so long as you have no active grants.

It is not possible to revoke a grant, as the grant ABI guarantees that a successful grant stays mapped until explicitly unmapped. Otherwise, a reset would cause unexpected pagefaults in the mapper domain.

For compatibility reasons it is not strictly required, but it is certainly expected that a new kernel explicitly chooses a gnttab version using the hypercall. There is certainly an area for problems if pvgrub2 uses grant v2, then leaves v2 active and hands off to an older kernel who expects v1 and doesn't explicitly set the version.

Quoted 4 lines

From this point of view, the safe course of action is to use whichever type of grants you want, then tear down all the front/back pairs, and reset the version to v1 before handing off.

Thank you, that's what I did now.

Quoted 10 lines

~Andrew

Quoted 7 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw
Quoted 5 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 4 lines

From this point of view, the safe course of action is to use whichever type of grants you want, then tear down all the front/back pairs, and reset the version to v1 before handing off.

Thank you, that's what I did now.

FWIW I don't think there is any need for pvgrub to be using the sorts of advanced features enabled by gnttab v2. Even Linux doesn't use most (any?) of them ;-)

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw
In reply to Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 5 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 4 lines

From this point of view, the safe course of action is to use whichever type of grants you want, then tear down all the front/back pairs, and reset the version to v1 before handing off.

Thank you, that's what I did now.

FWIW I don't think there is any need for pvgrub to be using the sorts of advanced features enabled by gnttab v2. Even Linux doesn't use most (any?) of them ;-)

Ian.

#6 lore raw
Quoted 7 lines · Ian Campbell
Quoted 4 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 4 lines

From this point of view, the safe course of action is to use whichever type of grants you want, then tear down all the front/back pairs, and reset the version to v1 before handing off.

Quoted 5 lines
Quoted 1 line

Thank you, that's what I did now.

FWIW I don't think there is any need for pvgrub to be using the sorts of advanced features enabled by gnttab v2. Even Linux doesn't use most (any?) of them ;-)

Indeed. Vladimir, for maximum compatibility with various versions of Xen, it would probably be best to use gnttab v1 only.

--msw

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel