All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tamas K Lengyel <tamas@tklengyel.com>
To: xen-devel@lists.xenproject.org
Cc: Tamas K Lengyel <tamas@tklengyel.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH v5 2/2] tests/mem-sharing: Add bulk option to memshrtool
Date: Sat, 11 Jun 2016 17:24:41 -0600	[thread overview]
Message-ID: <1465687481-10095-2-git-send-email-tamas@tklengyel.com> (raw)
In-Reply-To: <1465687481-10095-1-git-send-email-tamas@tklengyel.com>

Add the bulk option to the test tool to perform complete deduplication
between domains.

Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
---
 tools/tests/mem-sharing/memshrtool.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/tools/tests/mem-sharing/memshrtool.c b/tools/tests/mem-sharing/memshrtool.c
index 437c7c9..3e8f467 100644
--- a/tools/tests/mem-sharing/memshrtool.c
+++ b/tools/tests/mem-sharing/memshrtool.c
@@ -24,6 +24,8 @@ static int usage(const char* prog)
     printf("  nominate <domid> <gfn>  - Nominate a page for sharing.\n");
     printf("  share <domid> <gfn> <handle> <source> <source-gfn> <source-handle>\n");
     printf("                          - Share two pages.\n");
+    printf("  bulk <source-domid> <destination-domid>\n");
+    printf("                          - Share all pages between domains.\n");
     printf("  unshare <domid> <gfn>   - Unshare a page by grabbing a writable map.\n");
     printf("  add-to-physmap <domid> <gfn> <source> <source-gfn> <source-handle>\n");
     printf("                          - Populate a page in a domain with a shared page.\n");
@@ -180,6 +182,26 @@ int main(int argc, const char** argv)
         }
         printf("Audit returned %d errors.\n", rc);
     }
+    else if( !strcasecmp(cmd, "bulk") )
+    {
+        domid_t sdomid, cdomid;
+        int rc;
+        unsigned long shared;
+
+        if( argc != 4 )
+            return usage(argv[0]);
+
+        sdomid = strtol(argv[2], NULL, 0);
+        cdomid = strtol(argv[3], NULL, 0);
 
+        rc = xc_memshr_bulk_share(xch, sdomid, cdomid, &shared);
+        if ( rc < 0 )
+        {
+            printf("error executing xc_memshr_bulk_dedup: %s\n", strerror(errno));
+            return rc;
+        }
+
+        printf("Successfully shared %lu pages between the domains\n", shared);
+    }
     return 0;
 }
-- 
2.8.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-06-11 23:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-11 23:24 [PATCH v5 1/2] x86/mem-sharing: Bulk mem-sharing entire domains Tamas K Lengyel
2016-06-11 23:24 ` Tamas K Lengyel [this message]
2016-06-12  0:08 ` Tamas K Lengyel
2016-06-14  9:56 ` Jan Beulich
2016-06-14 16:33 ` Konrad Rzeszutek Wilk
     [not found]   ` <CABfawhmqhAsEk=J5F3y0tAvd74xfi1_2-A+tfKzwCapcmL1zPg@mail.gmail.com>
     [not found]     ` <CABfawh=Hw-mZi+d751pRhA-C-wLOJ3TQPkW6rLAYp+GGGbxx1Q@mail.gmail.com>
     [not found]       ` <CABfawhnZVFt2Hwrfb+DNH3ft3gbB3Bc4+h7EpJfXbf=1_P-LWQ@mail.gmail.com>
     [not found]         ` <CABfawhkTvytb7NvHJ-AHJBCxA3wJ5Fo-ciV66JpSY-xdK+3v5Q@mail.gmail.com>
2016-06-14 16:42           ` Tamas K Lengyel
2016-06-15  8:14   ` Jan Beulich
2016-06-15 14:02     ` Konrad Rzeszutek Wilk
2016-06-22 15:38 ` George Dunlap
2016-06-23 15:42   ` Tamas K Lengyel
2016-07-05 14:35     ` George Dunlap
2016-07-05 14:58       ` Tamas K Lengyel
2016-07-05 14:59       ` Jan Beulich

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=1465687481-10095-2-git-send-email-tamas@tklengyel.com \
    --to=tamas@tklengyel.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.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.