From patchwork Tue Jun 27 09:33:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 106412 Delivered-To: patch@linaro.org Received: by 10.140.101.48 with SMTP id t45csp1001276qge; Tue, 27 Jun 2017 02:35:34 -0700 (PDT) X-Received: by 10.107.130.229 with SMTP id m98mr5699254ioi.140.1498556134306; Tue, 27 Jun 2017 02:35:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498556134; cv=none; d=google.com; s=arc-20160816; b=LtWNoHjV50lMOHWY2FqAIJzBKleamwFxw+7tcVBoP16qXTchWUXQEHIFBNsUQGiRyk xrhBoMKiArHYv8E77YA6H4ST3VhVBGcmZ1eovKpISkzSHRF9r/5lXcId+2Czq73M6hB8 xEXEzmmrFrBNpFn39cgrtUyNp38ft/gYpJyMyKxTgXyPCMT0W1OIGvvzeFhDVvexUSgS GZuBrUjc5PyNy6zB2AW/t0FmYZzlM6FQ/BKRZTuOBGVvHZ/IWiEpXpaJSab+efOnrLqT wBl5TY50j6vLNar9VRQituHrV3mQLHLScXnXiTAn//Lv2VPdLbvQ/f1TXTw319Dp5xtm iFvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:message-id:date:to:from :arc-authentication-results; bh=rSKgXiZHihnXxHJSpnsDI49iOOZsjw3vgB+QUirZhLo=; b=CztUczCVZ4jTnZoVEde0KiiRuhFp1qRwEWiUo19Y69DOr0AgGo2Ac3SktCH0GthIG3 qTxgRpm29LeRaerea7xEWXGqvIc+P0WkX/e8uhvPAreoGru63WsAmiVz8vmw5/MhAi3r gAk1JLtgexqvC7U5r2u9jJmblCIS4BQ1euQQLK1sAhFIpswnyCsdTOQC4pcpPkmAPEU+ spKU36HQ6JFkuLOFHUYdsaEK+WJOdl2yvBrVB2f/rqhuc8343pmjLCbvpVfV3sXhMSw4 qFJ+4dBJyfqp3w2YGt9VRJnYd32P3nhfxLfQXI0tM5BWL0KThFeS8qIvdt9jrBTPhGH/ w13w== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id e84si2498500ioi.227.2017.06.27.02.35.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Jun 2017 02:35:34 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dPmsG-0003zQ-4q; Tue, 27 Jun 2017 09:33:32 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dPmsE-0003zJ-Nu for xen-devel@lists.xen.org; Tue, 27 Jun 2017 09:33:30 +0000 Received: from [85.158.143.35] by server-8.bemta-6.messagelabs.com id 44/C7-03696-96622595; Tue, 27 Jun 2017 09:33:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHLMWRWlGSWpSXmKPExsVysyfVTTdTLSj S4N58YYslHxezODB6HN39mymAMYo1My8pvyKBNePdzlamggmcFasn3WdqYDzG3sXIxSEksJFR YuGvi8xdjJxAzmlGiXV/LEFsNgFNiTufPzGB2CIC0hLXPl9mBGlgFnjOKDGpZQYrSEJYIFDi/ 9EzbCA2i4CqxPEt78EG8QpYSNw4PAmsWUJAXmJX20XWCYycCxgZVjGqF6cWlaUW6VrqJRVlpm eU5CZm5ugaGpjp5aYWFyemp+YkJhXrJefnbmIE+osBCHYw3t0UcIhRkoNJSZR3tURQpBBfUn5 KZUZicUZ8UWlOavEhRhkODiUJXjNVoJxgUWp6akVaZg4wcGDSEhw8SiK8ZccDI4V4iwsSc4sz 0yFSpxgVpcR5/6sA9QmAJDJK8+DaYMF6iVFWSpiXEegQIZ6C1KLczBJU+VeM4hyMSsK8R0Cm8 GTmlcBNfwW0mAloMcu8AJDFJYkIKakGxukX0pPqd3OI7W825bLnLPh7nJcjvK6aa7aZcpfQ0h PHN/CklixhDakwu7v7QVyL3bNsIbH7VuJmPGvzew/dOpLGaNTyOfzn0rY34ea7DQ0mr+n8LhD Ff10mvLKEedPdb33GeZuOPo9dcuzHXq0lsT/aOVknOJzsXrvyffCW75alyXqRl3zYlViKMxIN tZiLihMBT4pSHlECAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-11.tower-21.messagelabs.com!1498556008!75724513!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 4734 invoked from network); 27 Jun 2017 09:33:29 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-11.tower-21.messagelabs.com with SMTP; 27 Jun 2017 09:33:29 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4CB982B; Tue, 27 Jun 2017 02:33:28 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B1E223F581; Tue, 27 Jun 2017 02:33:26 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 27 Jun 2017 10:33:19 +0100 Message-Id: <20170627093320.9811-1-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 Cc: sstabellini@kernel.org, wei.liu2@citrix.com, George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, tim@xen.org, Julien Grall , jbeulich@suse.com Subject: [Xen-devel] [PATCH 1/2] Revert "mm: don't use _{g, m}fn for defining INVALID_{G, M}FN" 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" This reverts commit 725039d39ef10c6e3c59ba4a2511188281133b19. The change was intended to solve compilation when using INVALID_{G,M}FN for global variables. However, due to a compiler bug this will not work for GCC up to 5.0 (see [1]). [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856 Signed-off-by: Julien Grall --- xen/include/xen/mm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 1025a56231..0050fba498 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -56,7 +56,7 @@ TYPE_SAFE(unsigned long, mfn); #define PRI_mfn "05lx" -#define INVALID_MFN ((const mfn_t){ ~0UL }) +#define INVALID_MFN _mfn(~0UL) #ifndef mfn_t #define mfn_t /* Grep fodder: mfn_t, _mfn() and mfn_x() are defined above */ @@ -89,7 +89,7 @@ static inline bool_t mfn_eq(mfn_t x, mfn_t y) TYPE_SAFE(unsigned long, gfn); #define PRI_gfn "05lx" -#define INVALID_GFN ((const gfn_t){ ~0UL }) +#define INVALID_GFN _gfn(~0UL) #ifndef gfn_t #define gfn_t /* Grep fodder: gfn_t, _gfn() and gfn_x() are defined above */ From patchwork Tue Jun 27 09:33:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 106413 Delivered-To: patch@linaro.org Received: by 10.140.101.48 with SMTP id t45csp1001283qge; Tue, 27 Jun 2017 02:35:35 -0700 (PDT) X-Received: by 10.107.48.142 with SMTP id w136mr5344787iow.12.1498556135020; Tue, 27 Jun 2017 02:35:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498556135; cv=none; d=google.com; s=arc-20160816; b=I1g5KNYgMu6UQUEa8SDfhEAeQC7SO4ABNe9dsZ+oypmEQhEM+lguGpN0QlFXP2MEBt +8MaNfWkJYfk2+8fyz+hevY78sjzWjLCgvF367VsHRkF/XHl9EEDRboiuz+1PgoYAJph 5NeNEhw1BT7lGS90qMqt7deoS/H7F/e60L1Eg0Mk3AL/9cYh4ZU1ZnUkTsdEKtgFQogc wBnIfZRZPd0k4jVmd3LgLYe2ptTvsn1hn3LsQPGdUWaC0fvOg0F5hpU8EskmwIf9XzLM AheAjP3MTRFt/mzeYclD42nZBIMXe/QN1EckLNmKnC0t9yRhUOvuXQZ9QH2bWlMRUchi CNyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=ybIeTlagJYks65b6YrsczUzd9saBwBuojt+7uGZf/6Q=; b=ooF/elOxLNNypHALvogibOEXBsyBbI/rHp8KnHC9Jvvs8Z2XUSKOtelOLYWgXahhmR V8siMLyW4R2u+zNyj9xtOVH05Xd5wGx3ruOcWflJP4Gwm5+dKYfMl1XQz//VNBL6slR+ LMxjk45vyp63vGWpcXc0J0uX2Bndk05Kplq4ZxBbthT1Nnq+cDmCSudqd+6cHwElvfQ5 M/XJiK2RGVbpvORw4hXn8fro/Fu/Kn5Ry29mUfhmAO7A9HaCNMumAAZivPNi44Bai0bo A8PLq/IaBwKj2TuoC0rXTSbW7d5JKpmAirKXuN/9DiqrVBEdYsC6ZOmVw7GwnvZsC3O4 cjhw== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id l139si1947970itb.116.2017.06.27.02.35.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Jun 2017 02:35:35 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dPmsI-0003zg-Bs; Tue, 27 Jun 2017 09:33:34 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dPmsG-0003zP-AL for xen-devel@lists.xen.org; Tue, 27 Jun 2017 09:33:32 +0000 Received: from [85.158.139.211] by server-16.bemta-5.messagelabs.com id 19/71-01752-B6622595; Tue, 27 Jun 2017 09:33:31 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBLMWRWlGSWpSXmKPExsVysyfVTTdLLSj S4G+XpcWSj4tZHBg9ju7+zRTAGMWamZeUX5HAmrFlzxe2gje8FZ+vL2RtYFzN3cXIxSEksJlR 4t/1K2wQzmlGiQsTtrB2MXJysAloStz5/IkJxBYRkJa49vkyI0gRs8BzRolJLTPAioQFnCT+L vzODGKzCKhKHPz4ih3E5hWwkOi8cZIRxJYQkJfY1XYRrJ5TwFLiR+sVsHohoJpFc1pYJzByL2 BkWMWoUZxaVJZapGtkrJdUlJmeUZKbmJmja2hgqpebWlycmJ6ak5hUrJecn7uJEejjegYGxh2 MO9r9DjFKcjApifKulgiKFOJLyk+pzEgszogvKs1JLT7EKMPBoSTBa6YKlBMsSk1PrUjLzAEG G0xagoNHSYS37HhgpBBvcUFibnFmOkTqFKOilDhvFUifAEgiozQPrg0W4JcYZaWEeRkZGBiEe ApSi3IzS1DlXzGKczAqCfO+B5nCk5lXAjf9FdBiJqDFLPMCQBaXJCKkpBoYs1nn9DnVbNl427 Pgx6+zcpdO2hxrd95czi7b8EIi1eKU/t94062HKq79fFJzlzl9Ns+cdV4KCucDpUubCz53bZp y1Jopvbr9e+KPetPi9N337tzKX/j81nm1poywqyv988uyzvVqtWqud3507aZDOVv6/4mnZaIe MpRKFzmI29+dwq3dob9PiaU4I9FQi7moOBEAAr5JymsCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-206.messagelabs.com!1498556010!101654428!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15404 invoked from network); 27 Jun 2017 09:33:30 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-3.tower-206.messagelabs.com with SMTP; 27 Jun 2017 09:33:30 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 21AC81596; Tue, 27 Jun 2017 02:33:30 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 87E583F581; Tue, 27 Jun 2017 02:33:28 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 27 Jun 2017 10:33:20 +0100 Message-Id: <20170627093320.9811-2-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170627093320.9811-1-julien.grall@arm.com> References: <20170627093320.9811-1-julien.grall@arm.com> Cc: sstabellini@kernel.org, wei.liu2@citrix.com, George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, tim@xen.org, Julien Grall , jbeulich@suse.com Subject: [Xen-devel] [PATCH 2/2] xen/mm: Introduce {G, M}FN_INVALID_INITIALIZER 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" The current implementation of {G,M}FN_INVALID cannot be used to initialize global variable because the initializer element is not a constant. Due to a bug in GCC 4.9 and older ([1]), it is not easy to find a common value to initialize a variable and directly passed as an argument. Introduce 2 news define {G,M}FN_INVALID_INITIALIZER to be used for initializing a variable. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856 Signed-off-by: Julien Grall Acked-by: Tim Deegan (and Ack for the revert too) --- Build tested it with: * ARM: GCC 4.9.4, 5.1, 4.3, 6.1.1, 7.1.0 * x86: Clang 3.5.0, 3.6.0, 3.6.2, 3.8.0, 3.9.0, 4.0.0 With introducing a dummy global variable common/mm.c: mfn_t foo = INVALID_MFN_INITIALIZER --- xen/include/xen/mm.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 0050fba498..251db4ffa1 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -57,6 +57,11 @@ TYPE_SAFE(unsigned long, mfn); #define PRI_mfn "05lx" #define INVALID_MFN _mfn(~0UL) +/* + * To be used for global variable initialization. This workaround a bug + * in GCC < 5.0. + */ +#define INVALID_MFN_INITIALIZER {~0UL} #ifndef mfn_t #define mfn_t /* Grep fodder: mfn_t, _mfn() and mfn_x() are defined above */ @@ -90,6 +95,11 @@ static inline bool_t mfn_eq(mfn_t x, mfn_t y) TYPE_SAFE(unsigned long, gfn); #define PRI_gfn "05lx" #define INVALID_GFN _gfn(~0UL) +/* + * To be used for global variable initialization. This workaround a bug + * in GCC < 5.0 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856 + */ +#define INVALID_GFN_INITIALIZER { ~0UL } #ifndef gfn_t #define gfn_t /* Grep fodder: gfn_t, _gfn() and gfn_x() are defined above */