From: Ian Campbell <ian.campbell@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: lars.kurth@citrix.com, george.dunlap@eu.citrix.com,
Chun Yan Liu <cyliu@suse.com>,
xen-devel@lists.xen.org, ian.jackson@citrix.com,
caobosimon@gmail.com
Subject: Re: [PATCH V3 3/6] libxl: add pvusb API
Date: Wed, 20 May 2015 10:12:10 +0100 [thread overview]
Message-ID: <1432113130.12989.209.camel@citrix.com> (raw)
In-Reply-To: <20150520090407.GW26335@zion.uk.xensource.com>
On Wed, 2015-05-20 at 10:04 +0100, Wei Liu wrote:
> On Mon, May 18, 2015 at 09:20:43PM -0600, Chun Yan Liu wrote:
> [...]
> > >
> > > > + for (;;) {
> > > > + rc = libxl__xs_transaction_start(gc, &t);
> > > > + if (rc) goto out;
> > > > +
> > > > + rc = libxl__device_exists(gc, t, device);
> > > > + if (rc < 0) goto out;
> > > > + if (rc == 1) {
> > > > + /* already exists in xenstore */
> > > > + LOG(ERROR, "device already exists in xenstore");
> > > > + rc = ERROR_DEVICE_EXISTS;
> > > > + goto out;
> > > > + }
> > > > +
> > > > + rc = libxl__set_domain_configuration(gc, domid, &d_config);
> > > > + if (rc) goto out;
> > > > +
> > > > + libxl__device_generic_add(gc, t, device,
> > > > + libxl__xs_kvs_of_flexarray(gc, back,
> > > > + back->count),
> > > > + libxl__xs_kvs_of_flexarray(gc, front,
> > > > + front->count),
> > > > + NULL);
> > > > + libxl__usbport_add_xenstore(gc, t, domid, usbctrl);
> > > > + rc = libxl__xs_transaction_commit(gc, &t);
> > > > + if (!rc) break;
> > > > + if (rc < 0) goto out;
> > > > + }
> > > > +
> > >
> > > You don't have aodev so you cannot check update_json. Maybe you need
> > > aodev?
> > >
> > > That field update_json is set to true when doing hotplug. It's set to
> > > false during domain creation.
> > >
> > > The same comment applies to other add functions as well.
> >
> > Thanks, I'm updating that. But maybe like pci_add and pci_remove functions,
> > will add a 'starting' flag to indicate hotplug or creation.
> > Looking at DEFINE_DEVICE_ADD and DEFINE_DEVICE_REMOVE, usbctrl_add
> > and usb_add can use DEFINE_DEVICE_ADD; but usbctrl_remove and usb_remove
> > cannot use DEFINE_DEVICE_REMOVE directly, need some extra handling. So,
> > finally turned to not use these macros but refer to pci functions.
> >
>
> TBH I prefer to have only one way to deal with devices. I personally
> prefer the async style that every other devices use. Maybe that's just
> because I mostly worked with those.
>
> I don't know the full history of libxl_pci.c so I will wait for Ian and
> Ian's comments on which way to go.
libxl_pci.c should not be used as an example of the right way to do
things (to say the least).
> I think one merit of determining whether to use sync or async is that
> whether the operation is long running (slow). Long running one should be
> asyn. I guess usb passthrough is not slow so we are probably fine in
> this regard.
Device add/remove is expected to be async at least at the public API
level , all the others appear to be and it seems logical to me that they
would be.
next prev parent reply other threads:[~2015-05-20 9:12 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-19 3:50 [PATCH V3 0/6] libxl pvusb toolstack work Chunyan Liu
2015-04-19 3:50 ` [PATCH V3 1/6] libxl: export some functions for pvusb use Chunyan Liu
2015-04-20 16:25 ` Olaf Hering
2015-05-18 13:34 ` George Dunlap
2015-05-18 14:05 ` Wei Liu
2015-04-19 3:50 ` [PATCH V3 2/6] libxl_read_file_contents: fix reading sysfs file Chunyan Liu
2015-05-18 14:23 ` Ian Jackson
2015-05-18 14:28 ` Ian Campbell
2015-05-18 14:30 ` Wei Liu
2015-05-19 3:21 ` Chun Yan Liu
2015-05-18 14:25 ` Wei Liu
2015-04-19 3:50 ` [PATCH V3 3/6] libxl: add pvusb API Chunyan Liu
2015-04-20 5:53 ` Juergen Gross
2015-05-18 13:55 ` Olaf Hering
2015-05-18 18:07 ` Wei Liu
2015-05-19 3:20 ` Chun Yan Liu
2015-05-19 10:20 ` George Dunlap
2015-05-19 11:31 ` Jürgen Groß
2015-05-20 9:04 ` Wei Liu
2015-05-20 9:12 ` Ian Campbell [this message]
2015-05-20 9:30 ` Chun Yan Liu
2015-06-11 16:54 ` Ian Jackson
2015-05-19 18:06 ` George Dunlap
2015-05-19 18:24 ` Ian Campbell
2015-06-08 9:06 ` 答复: " Chun Yan Liu
2015-05-19 18:16 ` George Dunlap
2015-06-08 11:15 ` 答复: " Chun Yan Liu
2015-05-19 18:20 ` George Dunlap
2015-04-19 3:50 ` [PATCH V3 4/6] xl: add pvusb commands Chunyan Liu
2015-04-20 8:12 ` Juergen Gross
2015-04-21 2:21 ` Chun Yan Liu
2015-05-20 14:20 ` George Dunlap
2015-05-20 14:33 ` Juergen Gross
2015-05-20 14:41 ` George Dunlap
2015-05-20 14:55 ` Juergen Gross
2015-05-20 15:25 ` George Dunlap
2015-05-21 3:35 ` Juergen Gross
2015-05-21 10:37 ` George Dunlap
2015-05-21 10:52 ` Juergen Gross
2015-05-21 11:11 ` George Dunlap
2015-05-21 11:58 ` Juergen Gross
2015-05-21 13:01 ` George Dunlap
2015-05-21 13:08 ` Juergen Gross
2015-05-21 13:43 ` George Dunlap
2015-05-21 13:55 ` Juergen Gross
2015-05-21 14:00 ` George Dunlap
2015-05-21 14:14 ` Juergen Gross
2015-05-20 14:23 ` George Dunlap
2015-05-20 15:46 ` George Dunlap
2015-05-20 15:55 ` George Dunlap
2015-04-19 3:50 ` [PATCH V3 5/6] domcreate: support pvusb in configuration file Chunyan Liu
2015-04-19 3:50 ` [PATCH V3 6/6] refactor codes to unify pvusb and qemu emulated usb Chunyan Liu
2015-05-21 14:17 ` George Dunlap
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=1432113130.12989.209.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=caobosimon@gmail.com \
--cc=cyliu@suse.com \
--cc=george.dunlap@eu.citrix.com \
--cc=ian.jackson@citrix.com \
--cc=lars.kurth@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/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.