From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19636 invoked by alias); 3 Nov 2006 02:22:27 -0000 Received: (qmail 19626 invoked by uid 22791); 3 Nov 2006 02:22:26 -0000 X-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 03 Nov 2006 02:22:23 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by mga09.intel.com with ESMTP; 02 Nov 2006 18:22:22 -0800 Received: from bmao-mobl.ccr.corp.intel.com (HELO [10.239.13.100]) ([10.239.13.100]) by orsmga001.jf.intel.com with ESMTP; 02 Nov 2006 18:22:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: i="4.09,382,1157353200"; d="scan'208"; a="155234878:sNHT18582676" Message-ID: <454AA7DA.4070902@intel.com> Date: Fri, 03 Nov 2006 09:16:00 -0000 From: "bibo,mao" User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) MIME-Version: 1.0 To: Masami Hiramatsu CC: bibo mao , mingo@redhat.com, "Keshavamurthy, Anil S" , 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 References: <454A1FDA.5040209@hitachi.com> In-Reply-To: <454A1FDA.5040209@hitachi.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2006-q4/txt/msg00342.txt.bz2 Masami Hiramatsu wrote: > 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; I think that will be ok, it will be safe to free jump buffer at that time. thanks bibo,mao > --------------------------------------- > 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 >