All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Ian Campbell <Ian.Campbell@citrix.com>
Subject: Re: [PATCH 1/6] xc: use XENMEM_claim_pages hypercall during guest creation.
Date: Fri, 29 Mar 2013 09:12:21 -0400	[thread overview]
Message-ID: <20130329131221.GD31356@phenom.dumpdata.com> (raw)
In-Reply-To: <20820.28271.651677.268634@mariner.uk.xensource.com>

On Thu, Mar 28, 2013 at 04:23:11PM +0000, Ian Jackson wrote:
> Konrad Rzeszutek Wilk writes ("[PATCH 1/6] xc: use XENMEM_claim_pages hypercall during guest creation."):
> > We add an extra parameter to the structures passed to the
> > PV routine (arch_setup_meminit) and HVM routine (setup_guest)
> > that determines whether the claim hypercall is to be done.
> 
> This looks plausible to me, except that you seem to have missed a
> comment of Ian Campbell's on the hypercall buffers.
> 
> > +int xc_domain_claim_pages(xc_interface *xch,
> > +                               uint32_t domid,
> > +                               unsigned long nr_pages)
> > +{
> > +    int err;
> > +    struct xen_memory_reservation reservation = {
> > +        .nr_extents   = nr_pages,
> > +        .extent_order = 0,
> > +        .mem_flags    = 0, /* no flags */
> > +        .domid        = domid
> > +    };
> > +
> > +    set_xen_guest_handle(reservation.extent_start, HYPERCALL_BUFFER_NULL);
> 
> In response to which Ian C wrote in
> <1363170195.32410.124.camel@zakaz.uk.xensource.com>:
> 
>    This is unused? I think you just need:
>      set_xen_guest_handle(reservation.extent_start,HYPERCALL_BUFFER_NULL);
>    and drop the declaration of the bounce above.

I think that is what I did?

The original patch (v11 posting) had this:

[Also available here: http://xenbits.xen.org/gitweb/?p=people/konradwilk/xen.git;a=blobdiff;f=tools/libxc/xc_domain.c;h=af7ef66c041652309b44f0437ab402a4dfa18ad7;hp=480ce91500dd4e90a420e0407387205f76128752;hb=2430df20d51ad1a53a47831396ba6257f2e732ec;hpb=1a5757996a197abb5660d159fba843eb5e7aa5af in the claim.v11 branch]

int xc_domain_claim_pages(xc_interface *xch,
+                               uint32_t domid,
+                               unsigned long nr_pages,
+                               unsigned int claim_flag)
+{
+    int err;
+    xen_pfn_t *extent_start = NULL;
+    DECLARE_HYPERCALL_BOUNCE(extent_start, 0, XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
+    struct xen_memory_reservation reservation = {
+        .nr_extents   = nr_pages,
+        .extent_order = 0,
+        .mem_flags    = claim_flag,
+        .domid        = domid
+    };
+
+    set_xen_guest_handle(reservation.extent_start, extent_start);
+
+    err = do_memory_op(xch, XENMEM_claim_pages, &reservation, sizeof(reservation));
+    return err;
+}

And he suggested that I drop the bounce and just use the BUFFER_NULL.
The patch I posted (v12 and this v13) does this:

int xc_domain_claim_pages(xc_interface *xch,
+                               uint32_t domid,
+                               unsigned long nr_pages)
+{
+    int err;
+    struct xen_memory_reservation reservation = {
+        .nr_extents   = nr_pages,
+        .extent_order = 0,
+        .mem_flags    = 0, /* no flags */
+        .domid        = domid
+    };
+
+    set_xen_guest_handle(reservation.extent_start, HYPERCALL_BUFFER_NULL);
+
+    err = do_memory_op(xch, XENMEM_claim_pages, &reservation, sizeof(reservation));
+    /* Ignore it if the hypervisor does not support the call. */
+    if (err == -1 && errno == ENOSYS)
+        err = errno = 0;
+    return err;
+}

Which I believe does what he suggested? I also added the check for err and errno
as he suggested in another review.

  reply	other threads:[~2013-03-29 13:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-27 20:55 [PATCH v13] claim and its friends for allocating multiple self-ballooning guests Konrad Rzeszutek Wilk
2013-03-27 20:55 ` [PATCH 1/6] xc: use XENMEM_claim_pages hypercall during guest creation Konrad Rzeszutek Wilk
2013-03-28 16:23   ` Ian Jackson
2013-03-29 13:12     ` Konrad Rzeszutek Wilk [this message]
2013-03-27 20:55 ` [PATCH 2/6] xl: Implement XENMEM_claim_pages support via 'claim_mode' global config Konrad Rzeszutek Wilk
2013-03-28 16:39   ` Ian Jackson
2013-03-29 19:30     ` Konrad Rzeszutek Wilk
2013-03-27 20:55 ` [PATCH 3/6] xend: Implement XENMEM_claim_pages support via 'claim-mode' " Konrad Rzeszutek Wilk
2013-03-28 16:41   ` Ian Jackson
2013-03-29 13:27     ` Konrad Rzeszutek Wilk
2013-03-29 20:17       ` Konrad Rzeszutek Wilk
2013-03-27 20:55 ` [PATCH 4/6] xc: export outstanding_pages value in xc_dominfo structure Konrad Rzeszutek Wilk
2013-03-28 16:43   ` Ian Jackson
2013-03-27 20:55 ` [PATCH 5/6] xl: export 'outstanding_pages' value from xcinfo Konrad Rzeszutek Wilk
2013-03-28 16:44   ` Ian Jackson
2013-03-29 20:07     ` Konrad Rzeszutek Wilk
2013-03-27 20:55 ` [PATCH 6/6] xl: 'xl info' print outstanding claims if enabled (claim_mode=1 in xl.conf) Konrad Rzeszutek Wilk
2013-03-28 16:47   ` Ian Jackson
2013-03-29 13:31     ` Konrad Rzeszutek Wilk
2013-03-28 16:17 ` [PATCH v13] claim and its friends for allocating multiple self-ballooning guests Ian Jackson
2013-03-28 16:50 ` Ian Jackson
2013-04-02 11:10   ` George Dunlap
  -- strict thread matches above, loose matches on Subject: below --
2013-04-10 19:59 [PATCH v15] " Konrad Rzeszutek Wilk
2013-04-10 19:59 ` [PATCH 1/6] xc: use XENMEM_claim_pages hypercall during guest creation Konrad Rzeszutek Wilk
2013-04-12 15: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=20130329131221.GD31356@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=dan.magenheimer@oracle.com \
    --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.