All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: anthony.perard@citrix.com, stefano.stabellini@eu.citrix.com,
	ian.jackson@eu.citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH 3/5] libxl: use new QEMU xenstore protocol
Date: Thu, 19 Mar 2015 10:55:51 +0000	[thread overview]
Message-ID: <1426762551.610.29.camel@citrix.com> (raw)
In-Reply-To: <20150319103617.GC16267@zion.uk.xensource.com>

On Thu, 2015-03-19 at 10:36 +0000, Wei Liu wrote:
> On Wed, Mar 18, 2015 at 01:30:40PM +0000, Ian Campbell wrote:
> > On Fri, 2015-03-13 at 10:34 +0000, Wei Liu wrote:
> > > diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> > > index 3dedad4..4a38455 100644
> > > --- a/tools/libxl/libxl_dm.c
> > > +++ b/tools/libxl/libxl_dm.c
> > > @@ -998,7 +998,7 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
> > >      libxl_device_vfb *vfb;
> > >      libxl_device_vkb *vkb;
> > >      char **args;
> > > -    struct xs_permissions perm[2];
> > > +    struct xs_permissions perm[1];
> > >      xs_transaction_t t;
> > >  
> > >      /* convenience aliases */
> > > @@ -1106,16 +1106,16 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
> > >      }
> > >      xs_set_target(ctx->xsh, dm_domid, guest_domid);
> > >  
> > > -    perm[0].id = dm_domid;
> > > -    perm[0].perms = XS_PERM_NONE;
> > > -    perm[1].id = guest_domid;
> > > -    perm[1].perms = XS_PERM_READ;
> > > +    perm[0].id = guest_domid;
> > > +    perm[0].perms = XS_PERM_READ;
> > 
> > This will make the node owned by the guest (and hence r/w to the guest)
> > and set the perms for everyone else to r/o. I don't think this is what
> > you meant?
> > 
> > (The way perms are specified is a bit confusing, check out
> > http://wiki.xen.org/wiki/XenBus#Permissions )
> > 
> 
> Oh man! I completely misunderstood the semantics.

In fairness, they are insanely confusing, at least when encoded as an
array...

>  After reading that
> wiki page, I don't think I need to touch this permission bit because the
> original setting does what I need.
> 
> The content of that wiki page section should really be transferred to
> the comment before xs_set_permissions (which at the moment is extremely
> terse). I will send a patch to do that.

Awesome, thanks.

> > > -    return GCSPRINTF("/local/domain/0/device-model/%d/physmap/%s/%s",
> > > -            domid, phys_offset, node);
> > > +    return GCSPRINTF("/local/domain/%d/device-model/%d/physmap/%s/%s",
> > > +                     dm_domid, domid, phys_offset, node);
> > 
> > This sort of thing might imply that the helper takes the tail of the
> > path?
> 
> What do you mean? Sorry I don't follow.

I suggested before having a helper to return
"/local/domain/0/device-model/%d/", this hunk made me wonder if perhaps
that helper should take a "const char *fmt, ..." which it appends, so
you would call it as:

     foo(dm_domid, domid, "physmap/%s/%s", phys_offset, node)

or if you just want the base path for some reason
     foo(dm_domid, domid, "") (or NULL as the last parameter).

(I'm unclear if dm_domid and domid are both needed or if the funcution
can call get_stubdom_id(domid) internally, I'm sure you know...).

> > > SPRINTF(
> > > -                "/local/domain/0/device-model/%d/physmap", domid), &num);
> > > +                "/local/domain/%d/device-model/%d/physmap",
> > 
> > I only just noticed, but I think you want %u not %d (since dm_domid is
> > unsigned), although given the existing domid one is wrong too maybe you
> > don't want to bother...
> > 
> 
> Yes, I noticed but didn't bother to do that. "%d" is all over the place
> that it should be fixed all in one go...

Ack.

  reply	other threads:[~2015-03-19 10:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-13 10:34 [PATCH 0/5] Fix QEMU startup protocol Wei Liu
2015-03-13 10:34 ` [PATCH 1/5] libxl: remove DM path in libxl__device_model_destroy Wei Liu
2015-03-18 13:21   ` Ian Campbell
2015-03-18 13:23     ` Ian Campbell
2015-03-13 10:34 ` [PATCH 2/5] libxl: use LIBXL_TOOLSTACK_DOMID Wei Liu
2015-03-18 13:21   ` Ian Campbell
2015-03-13 10:34 ` [PATCH 3/5] libxl: use new QEMU xenstore protocol Wei Liu
2015-03-18 13:30   ` Ian Campbell
2015-03-19 10:36     ` Wei Liu
2015-03-19 10:55       ` Ian Campbell [this message]
2015-03-19 11:04         ` Wei Liu
2015-03-13 10:34 ` [PATCH 4/5] libxl: wait for stubdom to be ready Wei Liu
2015-03-16 17:55   ` Wei Liu
2015-03-18 13:35   ` Ian Campbell
2015-03-19 10:46     ` Wei Liu
2015-03-13 10:34 ` [PATCH 5/5] Revert "x86/hvm: wait for at least one ioreq server to be enabled" Wei Liu
2015-03-13 11:32   ` Paul Durrant
2015-03-13 10:38 ` [PATCH] xenstore: use relative path for device-model node Wei Liu
2015-03-13 10:46   ` Ian Campbell
2015-03-13 11:01     ` Wei Liu
2015-03-13 11:04   ` Stefano Stabellini
2015-03-18 13:24   ` Ian Campbell
2015-03-19 10:54     ` Wei Liu
2015-03-19 11:04       ` Ian Campbell
2015-03-24 17:16   ` Ian Jackson

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=1426762551.610.29.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.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.