From: Steven Smith Subject: Re: Re: [PATCH] xen: reduce severity of message about using v1 grant tables. Date: Thu, 3 Dec 2009 14:47:34 +0000 Message-ID: <20091203144734.GA30428@weybridge.uk.xensource.com> References: <1259782098-32180-1-git-send-email-Ian.Campbell@citrix.com> <4B16C103.9070105@goop.org> <1259783682.31045.22.camel@localhost.localdomain> <1259836124.23698.10393.camel@zakaz.uk.xensource.com> <20091203120116.GA15460@weybridge.uk.xensource.com> <1259842556.23698.10824.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1729546805==" Return-path: In-Reply-To: <1259842556.23698.10824.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Campbell Cc: Steven Smith , Jeremy Fitzhardinge , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --===============1729546805== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+HP7ph2BbKc20aGI" Content-Disposition: inline --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > > > Oh, I see what you meant... in the proper resume case (as opposed to = the > > > cancelled suspend/checkpoint case I was thinking of) there should be = no > > > grant tables in use at this point so most devices should, in theory, = be > > > able to reconnect using v1 grants, any drivers which require v2 grant > > > tables need to check for them in their resume hook as well as at start > > > of day. > > >=20 > > > Unfortunately frontend devices tear down their grant entries after the > > > resume rather than before the suspend (I presume this has to do with > > > faster checkpointing?) which means they could be trying to clear an > > > entry of the wrong layout, leading the unbounded badness that the > > > comment refers to. > > Actually, I think that'd be okay. Drivers should be clearing grant > > table entries through the gnttab_end_* functions, which always check > > grant_table_version and do the right thing. > In the case where you have gone v1->v2 then the entries would have been > setup while grante_table_version=3D=3D1 layout but by the time gnttab_end= _* > is called grant_table_version=3D=3D2 and the wrong thing happens. Hmm... I still think we're probably okay (in the narrowest possible sense). Changing grant table version memset()s the shared tables to zero, which effectively revokes all the grants, so all we need is for the gnttab_end_*_ref operations to be no-ops when applied to zeroed grant table slots, and a quick check of the code suggests that they are. But, yeah, it's not something we want to be doing anyway, whether it's safe or not. > > > I think the choices are basically: > > > * Always latch to either v1 or v2 at start of day, if we can't = get > > > the version we want then panic (this is a stronger restriction > > > than the current code which will try to upgrade to v2 on resu= me) > > Yeah, that probably counts as a bug in the current code. If we boot > > on a Xen which only supports v1 tabled then we should probably stick > > with v1 until we shut down. > >=20 > > panic()ing when v2 isn't available sounds like overkill, though. > It's only if you've already used v2 in this guest. Ah, okay. > > Would something like this work? >=20 > I don't think so, because I don't think changing the grant table layout > is safe. >=20 > I'm experimenting with this: >=20 > Subject: xen: latch grant-table layout at start of day. >=20 > It is not possible to switch grant table layout over a save restore > since entries setup before with the old layout cannot be torn down under > the new layout. >=20 > Also add a grant_table.version parameter to allow the user to force a > particular layout (e.g. if they know they need to migrate to v1 only > hosts) >=20 > Signed-off-by: Ian Campbell Acked-by: Steven Smith Steven. --+HP7ph2BbKc20aGI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFLF8+GvAgSWYI3DVMRAn7ZAJ9zJxBG5xQS6TT5GFqjET0PrNzRhwCdEjGV lWeEWjBdrpOoAs7N6ug5QQo= =rp07 -----END PGP SIGNATURE----- --+HP7ph2BbKc20aGI-- --===============1729546805== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1729546805==--