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] Export Multicore information

To: "Emmanuel Ackaouy" <ack@xxxxxxxxxxxxx>
Subject: RE: [Xen-devel] [PATCH] Export Multicore information
From: "Kamble, Nitin A" <nitin.a.kamble@xxxxxxxxx>
Date: Wed, 13 Dec 2006 16:32:05 -0800
Cc: "Yu, Wilfred" <wilfred.yu@xxxxxxxxx>, Ian Pratt <m+Ian.Pratt@xxxxxxxxxxxx>, Xen devel list <xen-devel@xxxxxxxxxxxxxxxxxxx>, "Nakajima, Jun" <jun.nakajima@xxxxxxxxx>, "Mallick, Asit K" <asit.k.mallick@xxxxxxxxx>, "Yang, Fred" <fred.yang@xxxxxxxxx>, Keir Fraser <keir@xxxxxxxxxxxxx>
Delivery-date: Wed, 13 Dec 2006 16:32:20 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Accermg+g/a+9IGDSyGBjIiFR8lpjAAaK1qw
Thread-topic: [Xen-devel] [PATCH] Export Multicore information
Hi Emmanuel,
  Good catch. I will incorporate your suggestion in the next patch.

Thanks & Regards,
Nitin 
Open Source Technology Center, Intel Corporation.
------------------------------------------------------------------------
-
The mind is like a parachute; it works much better when it's open.

>-----Original Message-----
>From: Emmanuel Ackaouy [mailto:ack@xxxxxxxxxxxxx]
>Sent: Wednesday, December 13, 2006 4:01 AM
>To: Kamble, Nitin A
>Cc: Keir Fraser; Ian Pratt; Mallick, Asit K; Yu, Wilfred; Xen devel
list;
>Yang, Fred; Nakajima, Jun
>Subject: Re: [Xen-devel] [PATCH] Export Multicore information
>
>On Tue, Dec 12, 2006 at 03:39:22PM -0800, Kamble, Nitin A wrote:
>> I think I should have added some documentation comments in the code
>> there mentioning the usage of count. It would make more sense if you
>> look at the code which is calling this interface in the xc.c. There
are
>> 2 conventions for calling this sysctl function.
>>
>> 1. With count = 0, and the array_list = NULL
>>
>> 2. Here user space allocates the space for array_list of count size,
and
>> passes it to the sysctl.
>
>(2) is the case I'm talking about.
>
>From your patch in sysctl.c:
>
>+        count = min((int)pi->count, num_possible_cpus());
>
>    ^^^^^^^^^^ You grab "count" correctly.
>
>+
>+        if ( guest_handle_is_null(pi->cpuinfo_list) ) {
>+            printk("sysctl XEN_SYSCTL_cpuinfo: guest handle is null
\n");
>+            ret = -EFAULT;
>+            break;
>+        }
>+
>+        j = 0;
>+        for_each_cpu(i) {
>+            extern int cpu_2_node[];
>+
>+            cl.cpu_id = i;
>+            cl.core_id = cpu_core_id[i];
>+            cl.package_id = phys_proc_id[i];
>+            cl.node_id = cpu_2_node[i];
>+            cl.thread_siblings_map = cpus_addr(cpu_sibling_map[i])[0];
>+            cl.core_siblings_map = cpus_addr(cpu_core_map[i])[0];
>+
>+            if ( copy_to_guest_offset(pi->cpuinfo_list, j, &cl, 1) ) {
>+                printk("sysctl XEN_SYSCTL_cpuinfo: copy to guest
>(cpuinfo_list)
> failed \n");
>+                ret -EFAULT;
>+                break;
>+            }
>+            j++;
>
>        ^^^^^^^^^^^ We never check that 'j' goes >= 'count'.
>
>+        }
>
>
>As a matter of fact, it looks to me like 'count' is a dead
>variable as soon as it's set?

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