From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juergen Gross Subject: per_cpu problem Date: Tue, 29 Dec 2009 13:45:55 +0100 Message-ID: <4B39FA03.4010705@ts.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org Hi, I've been playing a little bit with cpu-bound tasklets. For this purpose I defined a per_cpu list: static DEFINE_PER_CPU(struct list_head, tasklet_list_pcpu); The initialization is done in softirq_init: void __init softirq_init(void) { int i; for_each_possible_cpu ( i ) { INIT_LIST_HEAD(&per_cpu(tasklet_list_pcpu, i)); } tasklet_pcpu_inited = 1; open_softirq(TASKLET_SOFTIRQ, tasklet_action); } As soon as a cpu other than cpu 0 is accessing its tasklet_list_pcpu it is seeing a non-empty list (I've put a printk in tasklet_action): printk("tasklet_list_pcpu(%d) at %p not empty: %p\n", smp_processor_id(), &this_cpu(tasklet_list_pcpu), this_cpu(tasklet_list_pcpu).next); Prints out: (XEN) tasklet_list_pcpu(1) at ffff82c48026a100 not empty: ffff82c480268100 Somehow INIT_LIST_HEAD seems to put always the address of the list for cpu 0 in the list header. Could this be a compiler bug? Is this an artefact of the per_cpu macro? Am I missing something? Juergen -- Juergen Gross Principal Developer Operating Systems TSP ES&S SWE OS6 Telephone: +49 (0) 89 3222 2967 Fujitsu Technolgy Solutions e-mail: juergen.gross@ts.fujitsu.com Domagkstr. 28 Internet: ts.fujitsu.com D-80807 Muenchen Company details: ts.fujitsu.com/imprint.html