lkml.org 
[lkml]   [2017]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v6 04/18] xen/pvcalls: xenbus state handling
    From
    Date
    On 03/07/17 23:08, Stefano Stabellini wrote:
    > Introduce the code to handle xenbus state changes.
    >
    > Implement the probe function for the pvcalls backend. Write the
    > supported versions, max-page-order and function-calls nodes to xenstore,
    > as required by the protocol.
    >
    > Introduce stub functions for disconnecting/connecting to a frontend.
    >
    > Signed-off-by: Stefano Stabellini <stefano@aporeto.com>
    > Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    > CC: boris.ostrovsky@oracle.com
    > CC: jgross@suse.com
    > ---
    > drivers/xen/pvcalls-back.c | 152 +++++++++++++++++++++++++++++++++++++++++++++
    > 1 file changed, 152 insertions(+)
    >
    > diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
    > index 9044cf2..7bce750 100644
    > --- a/drivers/xen/pvcalls-back.c
    > +++ b/drivers/xen/pvcalls-back.c
    > @@ -25,20 +25,172 @@
    > #include <xen/xenbus.h>
    > #include <xen/interface/io/pvcalls.h>
    >
    > +#define PVCALLS_VERSIONS "1"
    > +#define MAX_RING_ORDER XENBUS_MAX_RING_GRANT_ORDER
    > +
    > struct pvcalls_back_global {
    > struct list_head frontends;
    > struct semaphore frontends_lock;
    > } pvcalls_back_global;
    >
    > +static int backend_connect(struct xenbus_device *dev)
    > +{
    > + return 0;
    > +}
    > +
    > +static int backend_disconnect(struct xenbus_device *dev)
    > +{
    > + return 0;
    > +}
    > +
    > static int pvcalls_back_probe(struct xenbus_device *dev,
    > const struct xenbus_device_id *id)
    > {
    > + int err, abort;
    > + struct xenbus_transaction xbt;
    > +
    > +again:
    > + abort = 1;
    > +
    > + err = xenbus_transaction_start(&xbt);
    > + if (err) {
    > + pr_warn("%s cannot create xenstore transaction\n", __func__);
    > + return err;
    > + }
    > +
    > + err = xenbus_printf(xbt, dev->nodename, "versions", "%s",
    > + PVCALLS_VERSIONS);
    > + if (err) {
    > + pr_warn("%s write out 'version' failed\n", __func__);

    s/version/versions/ ?

    > + goto abort;
    > + }
    > +
    > + err = xenbus_printf(xbt, dev->nodename, "max-page-order", "%u",
    > + MAX_RING_ORDER);
    > + if (err) {
    > + pr_warn("%s write out 'max-page-order' failed\n", __func__);
    > + goto abort;
    > + }
    > +
    > + err = xenbus_printf(xbt, dev->nodename, "function-calls",
    > + XENBUS_FUNCTIONS_CALLS);
    > + if (err) {
    > + pr_warn("%s write out 'function-calls' failed\n", __func__);
    > + goto abort;
    > + }
    > +
    > + abort = 0;
    > +abort:
    > + err = xenbus_transaction_end(xbt, abort);
    > + if (err) {
    > + if (err == -EAGAIN && !abort)

    Hmm, while I don't think xenbus_transaction_end() will ever
    return -EAGAIN in the abort case I'm not sure you should limit
    the retry loop to the non-abort case.

    > + goto again;
    > + pr_warn("%s cannot complete xenstore transaction\n", __func__);
    > + return err;
    > + }
    > +
    > + xenbus_switch_state(dev, XenbusStateInitWait);

    I don't think you should switch state in case of abort set, no?


    Juergen

    \
     
     \ /
      Last update: 2017-07-04 10:03    [W:5.278 / U:0.116 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site