Skip to contentSkip to conversation

SIGXCPU with rt_mutex_release

Xenomai Mariusz Janiak 1 participant 1 message Jan 8, 2013

lore
Share & tools
lore
#0 lore raw

Dnia Wtorek, 8 Stycznia 2013 14:33 Jan Kiszka <[email protected]> napisał(a)

Quoted 4 lines · Mariusz Janiak
Quoted 3 lines

Hi GIlles,

As you suggested, I have prepared simple test case that demonstrate how Xenomai is utilized by OROCOS. This test case behaves exactly the same like helloword example. Scheduler is chosen before any mutex are processed, so in my opinion it is not the case which you defined. What is really surprising is that the replacing TM_NONBLOCK with TM_INFINITE, in one before last line, do magic and suppress signal generation. Furthermore, there is no call to 'rt_task_set_mode(0, T_WARNSW, NULL);' so

why

Quoted 25 lines
Quoted 1 line

signal is generated? If we enable T_WARNSW in the thread, SIGXCPU is generated when mutex is locked first time in the thread.

This should cure the issue (there was a check for XNTRAPSW missing):

ksrc/nucleus/synch.c +5 -4
index e10be47..c1465dc 100644
@@ -687,10 +687,11 @@ xnsynch_release_thread(struct xnsynch *synch, struct xnthread *lastowner)
 
 #ifdef CONFIG_XENO_OPT_PERVASIVE
 	if (xnthread_test_state(lastowner, XNOTHER)) {
-		if (xnthread_get_rescnt(lastowner) == 0)
-			xnshadow_send_sig(lastowner, SIGDEBUG,
-					  SIGDEBUG_MIGRATE_PRIOINV, 1);
-		else
+		if (xnthread_get_rescnt(lastowner) == 0) {
+			if (xnthread_test_state(lastowner, XNTRAPSW))
+				xnshadow_send_sig(lastowner, SIGDEBUG,
+						  SIGDEBUG_MIGRATE_PRIOINV, 1);
+		} else
 			xnthread_dec_rescnt(lastowner);
 	}
 #endif
Quoted 7 lines

Thanks for providing the test case.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux

Thank you, after this, unexpected SIGXCPU is no longer a problem for my test case and OROCOS helloword example, as well.

Best regards,
Mariusz