Skip to contentSkip to conversation

Crash calling ipipe_register_domain on Atom architecture

Adeos-main giuseppe 1 participant 1 message Feb 15, 2012

lore
Share & tools
lore

giuseppe

author
#0 lore raw

Hi,

i need to use adeos-ipipe just at the interrupt level. In trying to achieve my goal I've been able both to succeed and fail, somewhat randomly.

So I decided to play it in steps starting from the very basic one, i.e. registering the HEAD domain and doing nothing with it.

Here is the simple module I used.

--------------------------------------------------------------------
#include <linux/module.h>

#include <linux/ipipe.h>

MODULE_LICENSE("GPL");

static struct ipipe_domain head_domain;

static void head_domain_entry(void)

{
        printk("\n***** HEAD_DOMAIN_ENTRY has been called *****\n");
}

int domain_init(void)

{
        struct ipipe_domain_attr attr;
        int retval;

        ipipe_init_attr(&attr);
        attr.name     = "MYHEAD";
        attr.domid    = 0xabcdef;
        attr.entry    = head_domain_entry;
        attr.priority = IPIPE_HEAD_PRIORITY;
        retval = ipipe_register_domain(&head_domain, &attr);
        printk("***** IPIPE_REGISTER_DOMAIN returned %d *****\n", retval);
        return 0;
}

void domain_exit(void)

{
        ipipe_unregister_domain(&head_domain);
        return;
}

module_init(domain_init);
module_exit(domain_exit);
--------------------------------------------------------------------

The above module works with 2.6.32.11 patched with adeos-ipipe-2.6.32.11-x86-2.6-03.patch but when used with 2.6.35.9 and adeos-ipipe-2.6.35.9-x86-2.8-04.patch it simply locks the machine.

(For your information it works also with kernel 2.6.32.20 with adeos-ipipe-2.6.32.20-x86-2.7-03.patch)

Following those locks I tried a silly brute force debugging by anticipating the exiting from ipipe_register_domain at various points.

By so doing I found that the following:

		 .
		 .
		 .
         /*
          * Finally, allow the new domain to perform its initialization
          * duties.
          */
         local_irq_save_hw_smp(flags);
         __ipipe_current_domain = ipd;
         local_irq_restore_hw_smp(flags);
         attr->entry();
		 return 123456;
		 .
		 .
		 .

avoids the locking and let me read the following with dmesg:

-----------------------------------------------------------------------
I-pipe: Domain MYHEAD registered.

BUG: Unhandled exception over domain MYHEAD at 0x805d1df - switching to ROOT

***** HEAD_DOMAIN_ENTRY has been called ***** ***** IPIPE_REGISTER_DOMAIN returned 123456 *****
Pid: 751, comm: udevd Not tainted 2.6.35.9-adeos #3

Call Trace:
 [<c1015dbb>] __ipipe_handle_exception+0x165/0x1af
 [<c13f7b6b>] error_code+0x63/0x70
-----------------------------------------------------------------------

Following it I discovered that the fault can be avoided by commenting a single instruction as for:

		 .
		 .
		 .
         /*
          * Finally, allow the new domain to perform its initialization
          * duties.
          */
         local_irq_save_hw_smp(flags);
//        __ipipe_current_domain = ipd;
         local_irq_restore_hw_smp(flags);
         attr->entry();
		 .
		 .
		 .

and letting the function finish normally.

I've been unable to understand why such an assignment causes the reported trap.

So: what am I doing wrong?

My hardware is based on an AXIOM industrial grade CPU SHB212 with an Intel Atom D425 CPU @1.8GHz. The system chipset is an Intel ICH8M.
The kernel is compiled without SMP support configurated for a Pentium III CPU.
I tried also defining an Atom CPU but I had the same result.
Local APIC and IO-APIC support enabled.
HPET Timer disabled.

I tried also to put some barrier() and wmb() calls in the ipipe_register_domain in many points around the critical parts without success.

Giuseppe.