This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [RFC][PATCH][kprobe] enabling booster on the preemptible kernel, take 2
- From: Masami Hiramatsu <masami dot hiramatsu dot pt at hitachi dot com>
- To: bibo mao <bibo dot mao at gmail dot com>
- Cc: mingo at redhat dot com, anil dot s dot keshavamurthy at intel dot com, ananth at in dot ibm dot com, prasanna at in dot ibm dot com, systemtap at sources dot redhat dot com, soshima at redhat dot com, haoki at redhat dot com, yumiko dot sugita dot yf at hitachi dot com
- Date: Fri, 03 Nov 2006 01:42:02 +0900
- Subject: Re: [RFC][PATCH][kprobe] enabling booster on the preemptible kernel, take 2
- Organization: Systems Development Lab., Hitachi, Ltd., Japan
- References: <fbd277f20611010440s12788720oeaae8ad1daa3e1d6@mail.gmail.com>
Hi Bibo,
bibo mao wrote:
> I am not familiar with freeze_processes(), I only view code.
> And I write simple program(though buggy) to test:
[...]
> it seems that many threads are not frozen even freeze_processes
> return 0.
I think the most important issue is whether those threads are
preempted (suddenly scheduled out) or not.
Those preempted threads might be preempted on the instruction
buffer or on the middle of the target instructions. In that
case, we cannot free the buffer or overwrite a jump code.
But, if those threads are sleeping at the known places, we can
ensure safety of freeing/overwriting.
Therefore, I think it is necessary to check whether all
non-frozen threads are sleeping or not, like as below;
---------------------------------------
int check_safety(void)
{
int ret = 0;
struct task_struct *g, *p;
if (freeze_processes()) {
goto Thaw;
}
do_each_thread(g, p) {
if (frozen(p))
continue;
if (p->state == TASK_RUNNING) {
ret = -EAGAIN;
break;
}
} while_each_thread(g, p);
Thaw:
thaw_processes();
return ret;
}
Thanks,
--
Masami HIRAMATSU
Linux Technology Center
Hitachi, Ltd., Systems Development Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com