From: Markus Armbruster <armbru@redhat.com>
To: Steven Smith <sos22-xen@srcf.ucam.org>
Cc: xen-devel@lists.xensource.com, sos22@srcf.ucam.org
Subject: Re: [PATCH 2/2] PV framebuffer
Date: Tue, 14 Nov 2006 15:01:30 +0100 [thread overview]
Message-ID: <87velijfet.fsf@pike.pond.sub.org> (raw)
In-Reply-To: <20061112142045.GC2014@cam.ac.uk> (Steven Smith's message of "Sun, 12 Nov 2006 14:20:45 +0000")
Steven Smith <sos22-xen@srcf.ucam.org> writes:
>> PV framebuffer frontend. Derived from http://hg.codemonkey.ws/vncfb
> This is the backend, isn't it?
>
>> diff -r 2e35cf028ff0 tools/python/xen/xend/XendDevices.py
>> --- a/tools/python/xen/xend/XendDevices.py Thu Nov 09 15:43:24 2006 +0000
>> +++ b/tools/python/xen/xend/XendDevices.py Thu Nov 09 17:58:26 2006 +0100
>> @@ -41,6 +41,8 @@ class XendDevices:
>> 'irq': irqif.IRQController,
>> 'usb': usbif.UsbifController,
>> 'tap': BlktapController,
>> + 'vfb': vfbif.VfbifController,
>> + 'vkbd': vfif.VkbdifController,
> Typo? Should this be:
>
> + 'vkbd': vfbif.VkbdifController,
>
> ?
Yes. Thanks!
>> diff -r 2e35cf028ff0 tools/xenfb/vncfb.c
>> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
>> +++ b/tools/xenfb/vncfb.c Thu Nov 09 10:18:58 2006 +0100
>
>> +int main(int argc, char **argv)
>> +{
>> + rfbScreenInfoPtr server;
>> + char *fake_argv[7] = { "vncfb", "-rfbport", "5901",
>> + "-desktop", "xen-vncfb",
>> + "-listen", "0.0.0.0" };
> HVM VNC server defaults to listening on 127.0.0.1 now. You might want
> to make this do the same thing.
Okay.
>> diff -r 2e35cf028ff0 tools/xenfb/xenfb.c
>> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
>> +++ b/tools/xenfb/xenfb.c Thu Nov 09 10:22:36 2006 +0100
>
>> +static int xenfb_hotplug(struct xs_handle *xsh, const char *backdir)
>> +{
>> + if (xenfb_xs_printf(xsh, backdir, "hotplug-status", "connected"))
>> + return -1;
>> +
>> + if (!xs_watch(xsh, backdir, ""))
>> + return -1;
>> +
>> + switch (xenfb_wait_for_state(xsh, backdir,
>> +#if 1 /* TODO fudging state to permit restarting; to be removed */
>> + (1 << XenbusStateInitialising)
>> + | (1 << XenbusStateInitWait)
>> + | (1 << XenbusStateConnected)
>> +#else
>> + 1 << XenbusStateInitialising,
>> +#endif
> I'm not sure what you're trying to do here. It looks like you're
> waiting for the backend to go to state Initialising (or InitWait, or
> Connected), but this is the backend, so if it isn't there already
> you're going to wait forever.
Part of the crude hacks that let me kill and restart the backend
without disturbing the front end.
Here we wait for xend to create the initial xenstore nodes for us, by
waiting for the transition to XenbusStateInitialising. If we
reconnect, we're already past that state.
Should go away when we implement reconnect cleanly.
>> +bool xenfb_attach_dom(struct xenfb *xenfb_pub, int domid)
>> +{
> ...
>> + if (xenfb_hotplug(xsh, vfb_backdir) < 0)
>> + goto error;
>> + if (xenfb_hotplug(xsh, vkbd_backdir) < 0)
>> + goto error;
>> +
>> + if (xenfb_xs_printf(xsh, vkbd_backdir, "feature-abs-pointer", "1"))
>> + goto error;
>> + if (xenfb_xs_printf(xsh, vfb_backdir, "state", "%d",
>> + XenbusStateInitWait))
>> + goto error;
>> + if (xenfb_xs_printf(xsh, vkbd_backdir, "state", "%d",
>> + XenbusStateInitWait))
>> + goto error;
>> +
> I'd probably reorder this a little to look more like this:
>
> (1) Set feature-abs-pointer
> (2) Set state to InitWait
> (3) Set hotplug status
>
> The only actual *required* constraint is (1) before (2), so that the
> frontend doesn't initialise before we've set the feature and
> potentially miss it.
>
> (2) before (3) is kind of nice, in that it makes sure that the backend
> is ready before xend unpauses the domain, and so the frontend'll be
> able to connect the first time it tries, but that's a lot less
> important here than for e.g. block devices.
Based on our previous discussions, I designed the startup protocol
this way:
backend frontend
------------------------------------------------------------------
hotplug_status = connected
[makes xend populate xenstore, set fe and be state = Initialising]
wait for be state = Initialising
[i.e. wait for xend]
write xs: feature-abs-pointer write xs: feature-update
be state = InitWait fe state = Initialised
------------------------------ sync ------------------------------
wait for fe state = Initialised wait for be state = InitWait
------------------------------ sync ------------------------------
read xs: feature-update read xs: feature-abs-pointer
write xs: request-update write xs: request-abs-pointer
be state = Connected fe state = Connected
------------------------------ sync ------------------------------
wait for fe state = Connected wait for be state = Connected
------------------------------ sync ------------------------------
read xs: request-abs-pointer read xs: request-update
The symmetry made sense to me.
If this is not the right way to do it, please explain it to me once
again. A diagram like the one I provided above might be more precise
and thus useful than prose, even if it's just as crude as mine.
>> + error:
>> + serrno = errno;
>> + if (xenfb->fb)
>> + munmap(xenfb->fb, xenfb->fb_len);
>> + if (fbmfns)
>> + munmap(fbmfns, n_fbdirs * XC_PAGE_SIZE);
>> + if (xenfb->kbd_info)
>> + munmap(xenfb->kbd_info, XC_PAGE_SIZE);
>> + if (xenfb->fb_info)
>> + munmap(xenfb->fb_info, XC_PAGE_SIZE);
>> + if (xenfb->kbd_port);
>> + xc_evtchn_unbind(xenfb->evt_xch, xenfb->kbd_port);
>> + if (xenfb->fbdev_port)
>> + xc_evtchn_unbind(xenfb->evt_xch, xenfb->fbdev_port);
>> + if (xsh)
>> + xs_daemon_close(xsh);
>> + errno = serrno;
> It'd be good to set an error in xenbus when this fails. Look at
> xenbus_dev_fatal and _dev_error in drivers/xen/xenbus/xenbus_client.c
> to see how to do this.
Thanks, I'll look into that.
>> + return false;
>> +}
>> +
>
> Steven.
next prev parent reply other threads:[~2006-11-14 14:01 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-10 8:54 [PATCH 2/2] PV framebuffer Markus Armbruster
2006-11-12 14:20 ` Steven Smith
2006-11-14 14:01 ` Markus Armbruster [this message]
2006-11-15 12:18 ` Steven Smith
2006-11-15 17:46 ` Markus Armbruster
2006-11-16 16:13 ` Markus Armbruster
2006-11-17 13:23 ` Markus Armbruster
2006-11-17 13:26 ` Markus Armbruster
2006-11-22 11:49 ` [PATCH] Re: [Xen-devel] " Atsushi SAKAI
2006-11-22 13:46 ` [PATCH] " Markus Armbruster
2006-11-24 5:00 ` [PATCH] Re: [Xen-devel] " Atsushi SAKAI
2006-11-24 8:10 ` [PATCH] " Markus Armbruster
2006-11-24 8:48 ` [PATCH] Re: [Xen-devel] " Atsushi SAKAI
2006-11-28 13:04 ` Atsushi SAKAI
2006-11-28 13:55 ` [PATCH] " Markus Armbruster
2006-11-29 13:08 ` [PATCH] Re: [Xen-devel] " Atsushi SAKAI
2006-12-01 12:35 ` Atsushi SAKAI
2006-12-01 18:03 ` [PATCH] " Markus Armbruster
2006-12-04 8:46 ` [PATCH] Re: [Xen-devel] " Atsushi SAKAI
2006-12-04 19:44 ` [PATCH] " Markus Armbruster
2006-12-05 12:01 ` [PATCH] Re: [Xen-devel] " Atsushi SAKAI
2006-12-05 17:32 ` [PATCH] " Markus Armbruster
2006-12-07 0:55 ` [PATCH] Re: [Xen-devel] " Atsushi SAKAI
2006-12-07 7:58 ` [PATCH] " Markus Armbruster
2006-12-12 11:54 ` [PATCH] Re: [Xen-devel] " Atsushi SAKAI
2006-12-12 12:23 ` [PATCH] " Markus Armbruster
2006-12-13 2:18 ` Atsushi SAKAI
2006-12-14 10:58 ` [PATCH] Re: [Xen-devel] " Atsushi SAKAI
2006-12-14 11:30 ` [PATCH] " Keir Fraser
2006-12-14 12:37 ` Markus Armbruster
2006-12-14 13:30 ` Keir Fraser
2006-12-15 16:38 ` [PATCH][PVFB][LINUX] Fix possible sleep while holding spinlock Markus Armbruster
2006-12-15 18:06 ` Keir Fraser
2006-12-15 18:35 ` Markus Armbruster
2006-12-19 2:52 ` Atsushi SAKAI
2006-12-19 7:49 ` Markus Armbruster
2006-12-19 8:17 ` Atsushi SAKAI
2007-01-10 8:50 ` Markus Armbruster
2006-11-28 15:36 ` [PATCH] Re: Re: [PATCH 2/2] PV framebuffer Stephen C. Tweedie
2006-11-24 8:05 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87velijfet.fsf@pike.pond.sub.org \
--to=armbru@redhat.com \
--cc=sos22-xen@srcf.ucam.org \
--cc=sos22@srcf.ucam.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.