From patchwork Wed Sep 28 09:42:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 9353657 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D11126077A for ; Wed, 28 Sep 2016 09:44:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDD422946E for ; Wed, 28 Sep 2016 09:44:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B28512947C; Wed, 28 Sep 2016 09:44:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id F0C5A29478 for ; Wed, 28 Sep 2016 09:44:39 +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 1bpBO1-0008W5-1D; Wed, 28 Sep 2016 09:42:45 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpBO0-0008VV-1S for xen-devel@lists.xenproject.org; Wed, 28 Sep 2016 09:42:44 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id 1B/4E-29421-3909BE75; Wed, 28 Sep 2016 09:42:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBLMWRWlGSWpSXmKPExsUyZ7p8oO7kCa/ DDW7eZbL4vmUykwOjx+EPV1gCGKNYM/OS8isSWDOeNH1mLzgoWfHwTSNbA+M/kS5GLg4hgYlM Ej19+5kgnG+MEhcXXGWFcDYySvxrOQOVmcAoseDIY+YuRg4ONgETiTerHLsYOTlEBEwltk88y QJiMwu4SRw+/5EdxBYWcJe4NuM6WDmLgKrE/rUqIGFeoJKW//NZQMISAvISz27Xg5icQNX3D/ uCVAgBVXxveAw2UELAUOLzxqXMExj5FjAyrGJUL04tKkst0jXWSyrKTM8oyU3MzNE1NDDTy00 tLk5MT81JTCrWS87P3cQIDBEGINjB2PHP6RCjJAeTkijv5vDX4UJ8SfkplRmJxRnxRaU5qcWH GGU4OJQkeBf2A+UEi1LTUyvSMnOAwQqTluDgURLhjQRJ8xYXJOYWZ6ZDpE4xKkqJ81aCJARAE hmleXBtsAi5xCgrJczLCHSIEE9BalFuZgmq/CtGcQ5GJWHexSBTeDLzSuCmvwJazAS0eOmJFy CLSxIRUlINjKn/u1O2Fm4wOrch4tlmc+bHbowRx/VszvNIF4TMc90e5vd3lUT/jNz515xNaz6 t8RPN4Yp7kF9k5u+wdvWuW/N2CwbHarqWzJnyTJXN0jni77qSy7XFvY/ffly0NiKNc4Zgerbb pGbh+Y2P/zInzJv4Tn369ZU8lpUrjnFuOZGUmiR/w/mUoxJLcUaioRZzUXEiAAuZxbOLAgAA X-Env-Sender: konrad.wilk@oracle.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1475055761!61911154!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 41226 invoked from network); 28 Sep 2016 09:42:42 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-5.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 28 Sep 2016 09:42:42 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u8S9gcrV020918 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Sep 2016 09:42:39 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u8S9gcd2009206 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 28 Sep 2016 09:42:38 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u8S9gaSV019402; Wed, 28 Sep 2016 09:42:37 GMT Received: from localhost.localdomain.com (/209.6.196.81) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 28 Sep 2016 02:42:36 -0700 From: Konrad Rzeszutek Wilk To: xen-devel@lists.xenproject.org, konrad@kernel.org Date: Wed, 28 Sep 2016 05:42:18 -0400 Message-Id: <1475055746-22401-5-git-send-email-konrad.wilk@oracle.com> X-Mailer: git-send-email 2.4.11 In-Reply-To: <1475055746-22401-1-git-send-email-konrad.wilk@oracle.com> References: <1475055746-22401-1-git-send-email-konrad.wilk@oracle.com> X-Source-IP: userv0022.oracle.com [156.151.31.74] Cc: Konrad Rzeszutek Wilk Subject: [Xen-devel] [PATCH v1 04/12] tmem: Wrap tmem tze code with CONFIG_TMEM_TZE 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-Virus-Scanned: ClamAV using ClamSMTP . which is actually dependent on CONFIG_TMEM_DEDUP Signed-off-by: Konrad Rzeszutek Wilk --- v1: First submission. --- xen/common/tmem.c | 12 ++++++++++-- xen/common/tmem_xen.c | 4 ++++ xen/include/xen/tmem_xen.h | 4 ++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/xen/common/tmem.c b/xen/common/tmem.c index 8327218..b673120 100644 --- a/xen/common/tmem.c +++ b/xen/common/tmem.c @@ -96,7 +96,9 @@ struct tmem_page_content_descriptor { union { struct page_info *pfp; /* Page frame pointer. */ char *cdata; /* If compression_enabled. */ +#ifdef CONFIG_TMEM_TZE char *tze; /* If !compression_enabled, trailing zeroes eliminated. */ +#endif }; #ifdef CONFIG_TMEM_DEDUP struct list_head pgp_list; @@ -2424,8 +2426,14 @@ static int __init init_tmem(void) #else 0, #endif - tmem_tze_enabled()); -#ifdef CONFIG_TMEM_DEDUP +#ifdef CONFIG_TMEM_TZE + tmem_tze_enabled() +#else + 0 +#endif + ); + +#if defined(CONFIG_TMEM_DEDUP) && defined(CONFIG_TMEM_TZE) if ( tmem_dedup_enabled()&&tmem_compression_enabled()&&tmem_tze_enabled() ) { tmem_tze_disable(); diff --git a/xen/common/tmem_xen.c b/xen/common/tmem_xen.c index 9a2bfed..d42deef 100644 --- a/xen/common/tmem_xen.c +++ b/xen/common/tmem_xen.c @@ -25,8 +25,10 @@ bool_t __read_mostly opt_tmem_dedup = 0; boolean_param("tmem_dedup", opt_tmem_dedup); #endif +#ifdef CONFIG_TMEM_TZE bool_t __read_mostly opt_tmem_tze = 0; boolean_param("tmem_tze", opt_tmem_tze); +#endif bool_t __read_mostly opt_tmem_shared_auth = 0; boolean_param("tmem_shared_auth", opt_tmem_shared_auth); @@ -218,6 +220,7 @@ int tmem_decompress_to_client(xen_pfn_t cmfn, void *tmem_va, return 1; } +#ifdef CONFIG_TMEM_TZE int tmem_copy_tze_to_client(xen_pfn_t cmfn, void *tmem_va, pagesize_t len) { @@ -239,6 +242,7 @@ int tmem_copy_tze_to_client(xen_pfn_t cmfn, void *tmem_va, smp_mb(); return 1; } +#endif /****************** XEN-SPECIFIC HOST INITIALIZATION ********************/ static int dstmem_order, workmem_order; diff --git a/xen/include/xen/tmem_xen.h b/xen/include/xen/tmem_xen.h index 52f87b1..3be8001 100644 --- a/xen/include/xen/tmem_xen.h +++ b/xen/include/xen/tmem_xen.h @@ -49,6 +49,7 @@ static inline bool_t tmem_dedup_enabled(void) } #endif +#ifdef CONFIG_TMEM_TZE extern bool_t opt_tmem_tze; static inline bool_t tmem_tze_enabled(void) { @@ -59,6 +60,7 @@ static inline void tmem_tze_disable(void) { opt_tmem_tze = 0; } +#endif extern bool_t opt_tmem_shared_auth; static inline bool_t tmem_shared_auth(void) @@ -340,7 +342,9 @@ int tmem_compress_from_client(xen_pfn_t, void **, size_t *, int tmem_copy_from_client(struct page_info *, xen_pfn_t, tmem_cli_va_param_t); int tmem_copy_to_client(xen_pfn_t, struct page_info *, tmem_cli_va_param_t); +#ifdef CONFIG_TMEM_TZE extern int tmem_copy_tze_to_client(xen_pfn_t cmfn, void *tmem_va, pagesize_t len); +#endif #define tmem_client_err(fmt, args...) printk(XENLOG_G_ERR fmt, ##args) #define tmem_client_warn(fmt, args...) printk(XENLOG_G_WARNING fmt, ##args)