From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH 7/8] xen/arm: Set foreign page type to p2m_map_foreign Date: Mon, 09 Dec 2013 02:14:28 +0000 Message-ID: <52A52784.8010706@linaro.org> References: <1386258131-755-1-git-send-email-julien.grall@linaro.org> <1386258131-755-8-git-send-email-julien.grall@linaro.org> <1386261264.20047.117.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VpqMj-0004Vb-0g for xen-devel@lists.xenproject.org; Mon, 09 Dec 2013 02:14:33 +0000 Received: by mail-wg0-f41.google.com with SMTP id y10so2823475wgg.2 for ; Sun, 08 Dec 2013 18:14:30 -0800 (PST) In-Reply-To: <1386261264.20047.117.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: xen-devel@lists.xenproject.org, tim@xen.org, stefano.stabellini@citrix.com, patches@linaro.org List-Id: xen-devel@lists.xenproject.org On 12/05/2013 04:34 PM, Ian Campbell wrote: > On Thu, 2013-12-05 at 15:42 +0000, Julien Grall wrote: >> Xen needs to know that the current page belongs to another domain. Also take >> the refcount to this page. >> >> Signed-off-by: Julien Grall >> --- >> xen/arch/arm/mm.c | 14 +++++++++----- >> 1 file changed, 9 insertions(+), 5 deletions(-) >> >> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c >> index 960c872..bf383a7 100644 >> --- a/xen/arch/arm/mm.c >> +++ b/xen/arch/arm/mm.c >> @@ -977,6 +977,7 @@ static int xenmem_add_to_physmap_one( >> { >> unsigned long mfn = 0; >> int rc; >> + p2m_type_t t = p2m_ram_rw; > > Can we set this explicitly on a per-mapspace basis please, so the > compiler will complain about an uninitialised variable if we forget to > add the type for a new map space, instead of silently creating writable > ram mappings. Actually, GCC compiler won't complain if t is not set in one of the case. If have tried this following dummy function on several version of GCC (the most recent is 4.8.2) and they don't emit any warning. ================================================================= int f (int a) { int b; switch (a) { case 1: b = 1; break; case 2: /* b is unset */ break; } return b; } ==================================================================== I have also tried clang, and I effectively get an error. But we don't yet support clang for Xen ARM port. I have found a bug report opened in 2004 for this kind of bug, but never fixed... (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18501). -- Julien Grall