public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/1] stp: rt: force to enable preempt
  2015-10-26  7:08 stp: rt: force to enable preempt Zhu Yanjun
@ 2015-10-26  7:08 ` Zhu Yanjun
  2015-10-26 14:21   ` Frank Ch. Eigler
  0 siblings, 1 reply; 4+ messages in thread
From: Zhu Yanjun @ 2015-10-26  7:08 UTC (permalink / raw)
  To: sshukla, systemtap

-rt mode preempt lead to __might_sleep calltrace.
Enabling preempt solves the problem.

Call Trace:
 [<ffffffff818d83f1>] dump_stack+0x19/0x1b
 [<ffffffff81070e3f>] __might_sleep+0xef/0x160
 [<ffffffff818de710>] rt_spin_lock+0x20/0x50
 [<ffffffff81178699>] d_path+0x79/0x1a0
 [<ffffffffa0058ae9>] __stp_get_mm_path.constprop.80+0x49/0x90 [stap_9e04047d79e94b52d0e35b78e6537085_2077]
 [<ffffffffa005e1a7>] __stp_utrace_attach_match_tsk.isra.54+0x77/0x1a0 [stap_9e04047d79e94b52d0e35b78e6537085_2077]
 [<ffffffffa005e30c>] __stp_utrace_task_finder_report_exec+0x3c/0x50 [stap_9e04047d79e94b52d0e35b78e6537085_2077]
 [<ffffffffa0058a59>] utrace_report_exec+0xb9/0x100 [stap_9e04047d79e94b52d0e35b78e6537085_2077]
 [<ffffffff811674b2>] search_binary_handler+0x332/0x380
 [<ffffffff81168d0c>] do_execve_common.isra.24+0x55c/0x640
 [<ffffffff81168e08>] do_execve+0x18/0x20
 [<ffffffff81169082>] SyS_execve+0x32/0x50
 [<ffffffff818e6979>] stub_execve+0x69/0xa0

After this patch is applied, the above backtrace disappears.

Signed-off-by: Zhu Yanjun <yanjun.zhu@windriver.com>
---
 runtime/stp_utrace.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/runtime/stp_utrace.c b/runtime/stp_utrace.c
index c69dec1..ba858a3 100644
--- a/runtime/stp_utrace.c
+++ b/runtime/stp_utrace.c
@@ -1979,6 +1979,9 @@ static void utrace_report_exec(void *cb_data __attribute__ ((unused)),
 {
 	struct utrace *utrace;
 
+#ifdef CONFIG_PREEMPT_RT_FULL
+	preempt_enable();
+#endif
 	if (atomic_read(&utrace_state) != __UTRACE_REGISTERED)
 		return;
 	utrace = task_utrace_struct(task);
@@ -1990,6 +1993,9 @@ static void utrace_report_exec(void *cb_data __attribute__ ((unused)),
 		REPORT(task, utrace, &report, UTRACE_EVENT(EXEC),
 		       report_exec, NULL, NULL, NULL /* regs */);
 	}
+#ifdef CONFIG_PREEMPT_RT_FULL
+	preempt_disable();
+#endif
 }
 
 #if 0
-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 4+ messages in thread

* stp: rt: force to enable preempt
@ 2015-10-26  7:08 Zhu Yanjun
  2015-10-26  7:08 ` [PATCH 1/1] " Zhu Yanjun
  0 siblings, 1 reply; 4+ messages in thread
From: Zhu Yanjun @ 2015-10-26  7:08 UTC (permalink / raw)
  To: sshukla, systemtap


Hi, Shukla

Please help to review this patch. Thanks a lot.

Zhu Yanjun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] stp: rt: force to enable preempt
  2015-10-26  7:08 ` [PATCH 1/1] " Zhu Yanjun
@ 2015-10-26 14:21   ` Frank Ch. Eigler
  2015-10-27  2:31     ` yzhu1
  0 siblings, 1 reply; 4+ messages in thread
From: Frank Ch. Eigler @ 2015-10-26 14:21 UTC (permalink / raw)
  To: Zhu Yanjun; +Cc: sshukla, systemtap

Zhu Yanjun <yanjun.zhu@windriver.com> writes:

> -rt mode preempt lead to __might_sleep calltrace.
> Enabling preempt solves the problem.
> [...]
> After this patch is applied, the above backtrace disappears.

Could you elaborate why this change is a good idea, beyond defeating
the kernel warning?  (It is possible that the warning is less bad than
a race condition or something that preemption in that area might
enable.)

- FChE

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] stp: rt: force to enable preempt
  2015-10-26 14:21   ` Frank Ch. Eigler
@ 2015-10-27  2:31     ` yzhu1
  0 siblings, 0 replies; 4+ messages in thread
From: yzhu1 @ 2015-10-27  2:31 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: sshukla, systemtap

On 10/26/2015 10:21 PM, Frank Ch. Eigler wrote:
> Zhu Yanjun <yanjun.zhu@windriver.com> writes:
>
>> -rt mode preempt lead to __might_sleep calltrace.
>> Enabling preempt solves the problem.
>> [...]
>> After this patch is applied, the above backtrace disappears.
> Could you elaborate why this change is a good idea, beyond defeating
> the kernel warning?  (It is possible that the warning is less bad than
> a race condition or something that preemption in that area might
> enable.)
>
> - FChE
>
Hi,

Thanks for your reply.

Yes, this patch will introduce the race condition risk. But if this is 
not enabled,
-rt system can not get the preemption.

In a -rt system, I think it is the first. Compared with the race 
condition risk, I think
preemption is more important.

Sometimes we can not get the both(less race condition risk and better rt 
preemption),
we have to pay more attention to one side.

This patch pays more attention to rt preemption. So maybe the race 
condition is payed less
attention.

Best Regards!
Zhu Yanjun

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-27  2:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-26  7:08 stp: rt: force to enable preempt Zhu Yanjun
2015-10-26  7:08 ` [PATCH 1/1] " Zhu Yanjun
2015-10-26 14:21   ` Frank Ch. Eigler
2015-10-27  2:31     ` yzhu1

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).