From patchwork Thu May 12 15:25:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamas K Lengyel X-Patchwork-Id: 9083121 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D6896BF29F for ; Thu, 12 May 2016 15:30:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0357F2024D for ; Thu, 12 May 2016 15:30:13 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1A6752009C for ; Thu, 12 May 2016 15:30:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0sX8-0004Xw-Bj; Thu, 12 May 2016 15:28:14 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0sX7-0004Xm-9N for xen-devel@lists.xenproject.org; Thu, 12 May 2016 15:28:13 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 37/56-09532-C01A4375; Thu, 12 May 2016 15:28:12 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBIsWRWlGSWpSXmKPExsVyMXThEV2ehSb hBq8OcFt83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBl33j5lK5gnUHH99AWWBsZ5PF2MnBxCAjMY JbqOh3cxcnFICPSzSvw8dIodJCEhECNxr282K4RdKXH86ToWiAYNids3G9lBGoQEvjFKnH95i AkkwSagLdH2ehdYg4iAksS9VZOZQIqYBbYwSnzesgWsSFjAQ+LerROMIDaLgKpE982VQHEODl 4BZ4kzM7MglslJXJ7+gA3E5hRwkZh6cyMjxGJniQ/r1rJNYORfwMiwilG9OLWoLLVI10gvqSg zPaMkNzEzR9fQwEwvN7W4ODE9NScxqVgvOT93EyMwfBiAYAfjsr9OhxglOZiURHn5qk3ChfiS 8lMqMxKLM+KLSnNSiw8xynBwKEnw3psPlBMsSk1PrUjLzAEGMkxagoNHSYT3GUiat7ggMbc4M x0idYrRmGPL72trmTi2Tb23lkmIJS8/L1VKnFd6AVCpAEhpRmke3CBYhF1ilJUS5mUEOk2Ipy C1KDezBFX+FaM4B6OSMO8lkIU8mXklcPteAZ3CBHRK9XUjkFNKEhFSUg2Mm2ZM+ePB3RgWX7F nYonnyrQW2/Sk43UlfXfMdso1M5+YYZOcYBv3oMQqjJMlKkN08uMlTzl9Xyzn/qeULS0z49u0 LVxP47+fD3wfIr9mlZrGoXnSvZteLBEwY/bfmHLPPi+jU2lBtrzQu+s6++Idt5o7386YYxx0+ GKD2fYz1eHP8x7MPWOjxFKckWioxVxUnAgAvTVzyasCAAA= X-Env-Sender: tamas.k.lengyel@gmail.com X-Msg-Ref: server-15.tower-21.messagelabs.com!1463066891!13889154!1 X-Originating-IP: [209.85.161.196] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 14501 invoked from network); 12 May 2016 15:28:12 -0000 Received: from mail-yw0-f196.google.com (HELO mail-yw0-f196.google.com) (209.85.161.196) by server-15.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 12 May 2016 15:28:12 -0000 Received: by mail-yw0-f196.google.com with SMTP id v81so7999341ywa.2 for ; Thu, 12 May 2016 08:28:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=R69eeAU20lfANiKBEuHYaMocFRIdPqDcHN+BYxJNlpI=; b=BZTmiu83RXNxzz+AvpOUyd0LeTqwr9rKCdA090ivjAm+aW+XJ1IvUyenJ3frIM8Ow+ 8odvBrKAkSK+RgXuGInK3sZTEiQHLCOap663rPamLRbkEhUjE/153gB+2FG9w+hebZTi A07W8qrQCgm3tKsrb4dhQh3u1Dk2R3PE5Q/6Y3t61V3ekv3WdohlIKfCNKoInf8JsA6N EMRd9mW8O27MLn/cY40WIEXReVCo203sS2B7WjvchXzU0zaSXaLOt/5nvN8m0kd9/uHu /NTKkE1VAlntyITmOmPjqytKu6HECDAV9XMtKsUachwuvSdzoBChXRD1ezY+jxmc7y2Z AgNQ== X-Gm-Message-State: AOPr4FXLdomCQez7NiVxsnlVJZ6XeiVWkupWFFOd080JOSe6L/CKlIavk1CkPZsQSN1dPA== X-Received: by 10.157.42.199 with SMTP id e65mr5307102otb.96.1463066759895; Thu, 12 May 2016 08:25:59 -0700 (PDT) Received: from l1.UTSARR.NET ([129.115.2.246]) by smtp.gmail.com with ESMTPSA id 90sm3365374otj.15.2016.05.12.08.25.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 May 2016 08:25:58 -0700 (PDT) From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Thu, 12 May 2016 09:25:52 -0600 Message-Id: <1463066752-23969-2-git-send-email-tamas@tklengyel.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1463066752-23969-1-git-send-email-tamas@tklengyel.com> References: <1463066752-23969-1-git-send-email-tamas@tklengyel.com> Cc: Tamas K Lengyel , Ian Jackson , Ian Campbell , Stefano Stabellini Subject: [Xen-devel] [PATCH v3 2/2] tests/mem-sharing: Add bulk option to memshrtool X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add the bulk option to the test tool to perform complete deduplication between domains. Signed-off-by: Tamas K Lengyel Acked-by: Wei Liu --- Cc: Ian Jackson Cc: Stefano Stabellini Cc: Ian Campbell --- 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 - Nominate a page for sharing.\n"); printf(" share \n"); printf(" - Share two pages.\n"); + printf(" bulk \n"); + printf(" - Share all pages between domains.\n"); printf(" unshare - Unshare a page by grabbing a writable map.\n"); printf(" add-to-physmap \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; }