WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

RE: [Xen-devel] [PATCH] ioemu: unmap INTx interrupt on hot-remove

To: Simon Horman <horms@xxxxxxxxxxxx>, Yuji Shimada <shimada-yxb@xxxxxxxxxxxxxxx>
Subject: RE: [Xen-devel] [PATCH] ioemu: unmap INTx interrupt on hot-remove
From: "Cui, Dexuan" <dexuan.cui@xxxxxxxxx>
Date: Fri, 27 Mar 2009 15:29:58 +0800
Accept-language: zh-CN, en-US
Acceptlanguage: zh-CN, en-US
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 27 Mar 2009 00:32:03 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20090326212625.GA3769@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20090313134807.66F0.27C06F64@xxxxxxxxxxxxxxx> <20090326051238.GD24011@xxxxxxxxxxxx> <20090326170847.816E.27C06F64@xxxxxxxxxxxxxxx> <20090326212625.GA3769@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcmuWagx/0NGTq7GTN+hBrT44oW5ugAUk3hQ
Thread-topic: [Xen-devel] [PATCH] ioemu: unmap INTx interrupt on hot-remove
>  +char mapped_machine_irq[PT_NR_IRQS] = {0};
My understanding is:
This does ensure all the elements of the array are 0, no matter the array is 
global or local. Because in C99's  6.7.8 Initialization, we can find

19 The initialization shall occur in initializer list order, each initializer 
provided for a
particular subobject overriding any previously listed initializer for the same 
subobject; all
subobjects that are not initialized explicitly shall be initialized implicitly 
the same as
objects that have static storage duration.

And as we all know, the default initial values for objects with static storage 
duration is 0.

Considering the array mapped_machine_irq here, actually we don't need the "{0}" 
initializer as the array is global so its default initial values are just 0. I 
personally think adding a redundant "{0}" for a global array is somewhat 
misleading. :-)

Thanks,
-- Dexuan


-----Original Message-----
From: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx 
[mailto:xen-devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Simon Horman
Sent: 2009年3月27日 5:26
To: Yuji Shimada
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] [PATCH] ioemu: unmap INTx interrupt on hot-remove

On Thu, Mar 26, 2009 at 05:11:29PM +0900, Yuji Shimada wrote:
> On Thu, 26 Mar 2009 16:12:38 +1100
> Simon Horman <horms@xxxxxxxxxxxx> wrote:
> 
> > > +char mapped_machine_irq[PT_NR_IRQS] = {0};
> > 
> > This only initialises the first element of mapped_machine_irq[] to 0.
> 
> Do you have any issue relating to this code?
> I think remaining elements are initialized to 0.

My issue is that the code doesn't seem to be correct - though I have not
experienced any problems.

My understanding is that it may well be the case that the rest of the array
is initialised to zero, by virtue of being a page that hasn't been used
since being received from the kernel. But I don't believe that there are
any guarantees that it doesn't contain non-zero values.

If my assumptions are wrong and it is the case that the contents of the
array is guaranteed to be zeroed then the "{0}" seems to be misleading and
it could just be removed.

-- 
Simon Horman
  VA Linux Systems Japan K.K., Sydney, Australia Satellite Office
  H: www.vergenet.net/~horms/             W: www.valinux.co.jp/en


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel