public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: bibo mao <bibo.mao@gmail.com>
Cc: mingo@redhat.com, anil.s.keshavamurthy@intel.com,
		ananth@in.ibm.com, prasanna@in.ibm.com,
	systemtap@sources.redhat.com, 	soshima@redhat.com,
	haoki@redhat.com, yumiko.sugita.yf@hitachi.com
Subject: Re: [RFC][PATCH][kprobe] enabling booster on the preemptible kernel,  take 2
Date: Thu, 02 Nov 2006 18:51:00 -0000	[thread overview]
Message-ID: <454A1FDA.5040209@hitachi.com> (raw)
In-Reply-To: <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


  reply	other threads:[~2006-11-02 16:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-01 17:01 bibo mao
2006-11-02 18:51 ` Masami Hiramatsu [this message]
2006-11-03  9:16   ` bibo,mao
2006-11-06 18:52     ` [RFC][PATCH][kprobe] enabling booster on the preemptible kernel, take 3 Masami Hiramatsu
  -- strict thread matches above, loose matches on Subject: below --
2006-10-16 13:14 [RFC][PATCH][kprobe] enabling booster on the preemptible kernel, take 2 Masami Hiramatsu
2006-10-30  6:37 ` bibo,mao
2006-10-30 14:07   ` Masami Hiramatsu
2006-10-31  9:14     ` bibo,mao
2006-10-31 13:47       ` Masami Hiramatsu
2006-10-31 13:49         ` Ingo Molnar
2006-10-31 14:13         ` Ingo Molnar
2006-10-31 16:39           ` Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=454A1FDA.5040209@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi.com \
    --cc=ananth@in.ibm.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=bibo.mao@gmail.com \
    --cc=haoki@redhat.com \
    --cc=mingo@redhat.com \
    --cc=prasanna@in.ibm.com \
    --cc=soshima@redhat.com \
    --cc=systemtap@sources.redhat.com \
    --cc=yumiko.sugita.yf@hitachi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).