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-ia64-devel

RE: [Xen-ia64-devel] stack corruption creating idle domain

To: "Alex Williamson" <alex.williamson@xxxxxx>, <xen-ia64-devel@xxxxxxxxxxxxxxxxxxx>
Subject: RE: [Xen-ia64-devel] stack corruption creating idle domain
From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
Date: Wed, 25 Jan 2006 09:54:07 +0800
Delivery-date: Wed, 25 Jan 2006 02:02:41 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcYhGxtyzk7wcA3fQyW9dHQhduZlZQANkqKQ
Thread-topic: [Xen-ia64-devel] stack corruption creating idle domain
>From: Alex Williamson
>Sent: 2006年1月25日 3:16
>
>   I've been debugging a hang that I see on current xen-unstable.hg and
>I'm looking for suggestions.  The hang occurs just after xen prints
>"About to call scheduler_init()".  I've traced the problem with ski and
>it appears that in init_switch_stack we blow away the stack with the
>memset of the switch_stack and pt_regs area.  The problem seems to be
>that we're setting idle_vcpu[0] to the address in r13 (back in
>start_kernel), but we haven't set r13 to anything that necessarily has
>enough space for idle_vcpu[0].  Am I missing the setup of r13?  The

Hi, Alex,
        I don't quite catch you in above sentence. What's the problematic value 
for r13 in your case? Ideally r13 is initialized to init_task in very early 
setup in head.S. Then later it's referred further as idle_vcpu[0]. It's 
harmless to clear switch stack and pt_regs area for idle vcpu0 at that point. 
So you may need to figure out where r13 is getting changed before that point.

Thanks,
Kevin

>trivial patch below works around the problem, but perhaps I'm
>overlooking some intricacy about how this is supposed to work.
>
>   BTW, I only see this problem when using gcc-3.3.5.  That compiler
>decides to use the stack in init_switch_stack causing us to infinitely
>page fault when we get back from the memset.  I have observed in ski
>that a xen image compiled with gcc-4.0 also overwrites the stack, but
>nothing critical seems to be using it.  What's the correct fix here?
>Thanks,
>
>       Alex
>
>--
>Alex Williamson                             HP Linux & Open Source Lab
>
>--- a/xen/arch/ia64/xen/xensetup.c      Mon Jan 23 15:27:00 2006
>+++ b/xen/arch/ia64/xen/xensetup.c      Tue Jan 24 05:59:04 2006
>@@ -148,6 +148,8 @@
>     .stop_bits = 1
> };
>
>+struct vcpu idlevcpu0;
>+
> void start_kernel(void)
> {
>     unsigned char *cmdline;
>@@ -280,7 +282,8 @@
>
> printk("About to call scheduler_init()\n");
>     scheduler_init();
>-    idle_vcpu[0] = (struct vcpu*) ia64_r13;
>+    ia64_r13 = (void *)&idlevcpu0;
>+    idle_vcpu[0] = &idlevcpu0;
>     idle_domain = domain_create(IDLE_DOMAIN_ID, 0);
>     BUG_ON(idle_domain == NULL);
>
>
>
>
>_______________________________________________
>Xen-ia64-devel mailing list
>Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
>http://lists.xensource.com/xen-ia64-devel

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