[Xenomai] suspending kernel thread

Nihar Unadkat Nihar at deltatau.com
Wed Jan 31 02:09:17 CET 2018


Hi 

I am using ipipe-ipipe-core-4.1.18-arm-9 which is patched with xenomai-2.6.5

I am getting an error 
Xenomai: suspending kernel thread 7f8c2cb8 ('xxxx') at 0x7f89d6e8 after exception #0x8

Where ('xxxx') is our function name.

So I searched for where this message comes from and  I found it in the file pod.c and the function that is causing this error is 

/*!
 * \fn void xnpod_trap_fault(xnarch_fltinfo_t *fltinfo);
 * \brief Default fault handler.
 *
 * This is the default handler which is called whenever an uncontrolled
 * exception or fault is caught. If the fault is caught on behalf of a
 * real-time thread, the fault is not propagated to the host system.
 * Otherwise, the fault is unhandled by the nucleus and simply propagated.
 *
 * @param fltinfo An opaque pointer to the arch-specific buffer
 * describing the fault. The actual layout is defined by the
 * xnarch_fltinfo_t type in each arch-dependent layer file.
 *
 */

int xnpod_trap_fault(xnarch_fltinfo_t *fltinfo)
{
	xnthread_t *curr;

	if (!xnpod_active_p() ||
	    (!xnpod_interrupt_p() && xnpod_idle_p()))
		return 0;

	curr = xnpod_current_thread();

	trace_mark(xn_nucleus, thread_fault,
		   "thread %p thread_name %s ip %p type 0x%x",
		   curr, xnthread_name(curr),
		   (void *)xnarch_fault_pc(fltinfo),
		   xnarch_fault_trap(fltinfo));

#ifdef __KERNEL__
	if (xnarch_fault_fpu_p(fltinfo)) {
		if (__xnpod_fault_init_fpu(curr))
			return 1;
		print_symbol("invalid use of FPU in Xenomai context at %s\n",
			     xnarch_fault_pc(fltinfo));
	}

	if (!xnpod_userspace_p()) {
		xnprintf
		    ("suspending kernel thread %p ('%s') at 0x%lx after exception #0x%x\n",
		     curr, curr->name, xnarch_fault_pc(fltinfo),
		     xnarch_fault_trap(fltinfo));

		xnpod_suspend_thread(curr, XNSUSP, XN_INFINITE, XN_RELATIVE, NULL);
		return 1;
	}

#ifdef CONFIG_XENO_OPT_PERVASIVE
	/* If we experienced a trap on behalf of a shadow thread, just
	   move the second to the Linux domain, so that the host O/S
	   (e.g. Linux) can attempt to process the exception. This is
	   especially useful in order to handle user-space errors or debug
	   stepping properly. */

	if (xnpod_shadow_p()) {
#if XENO_DEBUG(NUCLEUS)
		if (!xnarch_fault_um(fltinfo)) {
			xnarch_trace_panic_freeze();
			xnprintf
			    ("Switching %s to secondary mode after exception #%u in "
			     "kernel-space at 0x%lx (pid %d)\n", curr->name,
			     xnarch_fault_trap(fltinfo),
			     xnarch_fault_pc(fltinfo),
			     xnthread_current_user_pid(curr));
			xnarch_trace_panic_dump();
		} else if (xnarch_fault_notify(fltinfo))	/* Don't report debug traps */
			xnprintf
			    ("Switching %s to secondary mode after exception #%u from "
			     "user-space at 0x%lx (pid %d)\n", curr->name,
			     xnarch_fault_trap(fltinfo),
			     xnarch_fault_pc(fltinfo),
			     xnthread_current_user_pid(curr));
#endif /* XENO_DEBUG(NUCLEUS) */
		if (xnarch_fault_pf_p(fltinfo))
			/* The page fault counter is not SMP-safe, but it's a
			   simple indicator that something went wrong wrt memory
			   locking anyway. */
			xnstat_counter_inc(&curr->stat.pf);

		xnshadow_relax(xnarch_fault_notify(fltinfo),
			       SIGDEBUG_MIGRATE_FAULT);
	}
#endif /* CONFIG_XENO_OPT_PERVASIVE */
#endif /* __KERNEL__ */

	return 0;
}
EXPORT_SYMBOL_GPL(xnpod_trap_fault);


The only way for me to bypass the error Xenomai: suspending kernel thread 7f8c2cb8 ('xxxx') at 0x7f89d6e8 after exception #0x8
Was to comment out the section given below and everything works ok.

/*	if (!xnpod_userspace_p()) {
		xnprintf
		    ("suspending kernel thread %p ('%s') at 0x%lx after exception #0x%x\n",
		     curr, curr->name, xnarch_fault_pc(fltinfo),
		     xnarch_fault_trap(fltinfo));

		xnpod_suspend_thread(curr, XNSUSP, XN_INFINITE, XN_RELATIVE, NULL);
		return 1;
	}
*/

My question are
1) What does this function do? 
2) why am I getting that error.
3) What is your advice or suggestion on this.

Thank you 

Nihar Unadkat  
Senior Firmware Engineer
Direct: 818-444-5206
nihar at deltatau.com

OMRON DELTA TAU 
21314 Lassen Street, Chatsworth, CA 91311
deltatau.com 
youtube.com/DeltaTauDataSystems




More information about the Xenomai mailing list