From: Markus Armbruster Subject: Re: [PATCH] xenfb: make restartable Date: Fri, 15 Aug 2008 18:53:01 -0400 Message-ID: References: <48A40B17.2090701@redhat.com> <20080814111520.GH4590@implementation.uk.xensource.com> <48A4232B.6040500@redhat.com> <20080814122931.GL4590@implementation.uk.xensource.com> <48A43EAD.7040701@redhat.com> <20080814142849.GS4590@implementation.uk.xensource.com> <48A44967.4060401@redhat.com> <20080814151359.GT4590@implementation.uk.xensource.com> <20080814180251.GD4590@implementation.uk.xensource.com> <20080815222346.GE5198@implementation> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20080815222346.GE5198@implementation> (Samuel Thibault's message of "Fri\, 15 Aug 2008 23\:23\:46 +0100") List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Samuel Thibault Cc: Xen Development Mailing List , Gerd Hoffmann List-Id: xen-devel@lists.xenproject.org Samuel Thibault writes: > Markus Armbruster, le Fri 15 Aug 2008 08:39:06 -0400, a =C3=A9crit : >> > + if (!strcmp(dev->devicetype, "vfb")) { >> > + if (dev->xenfb->pixels) { >> > + munmap(dev->xenfb->pixels, dev->xenfb->fb_len); >> > + dev->xenfb->pixels =3D NULL; >> > + } >> > + } >> > } >> >=20=20 >> >=20=20 >>=20 >> The check for vfb is ugly. The only alternative I can see is fb =3D=3D >> dev->xenfb->fb. Matter of taste. > > Hum, that was what I had written previously actually. I don't see why > it is "ugly", in that pixels is a device resource. It should probably > be in xenfb->fb actually. struct xenfb_device captures stuff that both devices have. By "is ugly" I meant to say that checking for vfb by testing its devicetype string looks ugly to me. But fb =3D=3D dev->xenfb->fb isn't exactly the acme of elegance either. >> > @@ -653,6 +656,16 @@ static int xenfb_on_state_change(struct=20 >> > not much point in us continuing. */ >> > return -1; >> > case XenbusStateInitialising: >> > + if (dev->state !=3D XenbusStateClosed) >> > + /* Do not let a domain make us skip the closing state */ >> > + return 0; >>=20 >> Why does this work? > > It's meant to not work. If the frontend is not playing well (going > through the closing state), then ignore what it's doing until it plays > well. An alternative could be to just shut down. In any case, we don't > want to let it drive us to remapping something else without unmapping > the previous fb. We need to make up our mind how to handle invalid state transitions. Is silently ignoring guest misbehavior smart? I'd rather log it. [...]