From sacadmin Fri Jul 21 17:01:08 2006
Received: from zion.eng.sun.com (zion.SFBay.Sun.COM [129.146.17.75])
	by sac.sfbay.sun.com (8.13.6+Sun/8.13.6) with ESMTP id k6M018L3017771
	for <psarc@sac.eng.sun.com>; Fri, 21 Jul 2006 17:01:08 -0700 (PDT)
Received: from zion.eng.sun.com (localhost [127.0.0.1])
	by zion.eng.sun.com (8.13.7+Sun/8.13.7) with ESMTP id k6M017bP012551;
	Fri, 21 Jul 2006 17:01:07 -0700 (PDT)
Received: (from ahl@localhost)
	by zion.eng.sun.com (8.13.7+Sun/8.13.7/Submit) id k6M017tn012550;
	Fri, 21 Jul 2006 17:01:07 -0700 (PDT)
Date: Fri, 21 Jul 2006 17:01:07 -0700
From: Adam Leventhal <ahl@eng.sun.com>
To: psarc@sac.sfbay.sun.com
Cc: Adam Leventhal <ahl@eng.sun.com>, Vitezslav.Batrla@sun.com
Subject: PSARC 2006/447 LWP support for prun(1) and pstop(1)
Message-ID: <20060722000107.GR3313@eng.sun.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.10i
Status: RO
Content-Length: 2728

I'm sponsoring the following fasttrack on behalf of Vita Batrla. This case
introduces new ways of invoking the prun(1) and pstop(1) commands so that
they apply only to particular LWPs. This uses the same methodology that was
introduced in PSARC 2004/258 for utilities such as pstack(1). The stability
it Evolving and the binding is Patch. The timer is set for 7/28/2006.

Adam

---8<---

A. Introduction

Our prun(1) and pstop(1) tools are used to stop and run processes. These tools
currently operate on whole process. In some situations one may need to to stop
and run only particular thread(s)/lwp(s) in the process. Similar enhancement was
done in the past for truss(1), pstack(1) and pflags(1) tools, see PSARC
2004/258.

B. Proposed Changes

This case proposes per-thread modes for prun(1) and pstop(1) to allow users to
stop selected threads using pstop(1) and set them running back using prun(1).

The syntax for selecting threads is the same as in PSARC 2004/258:

	pstop 100123/2	# stop thread 2 in process 100123
	pstop 100123/2,3-5	# stop threads 2, 3, 4, and 5
	pstop 100123/-7	# stop threads whose IDs are 7 or below
	pstop 100123/8-	# stop threads whose IDs are 8 or above
	pstop 100123/8- 321/3	# stop threads whose IDs are 8 or above in
				# process 100123 and stop thread 3 in
				# process 321

The thread specification is considered as a mask - prun(1)/pstop(1) will iterate
over all threads in the process and stop/set running only threads whose ID will
match the mask. For example: if the user does "prun 100123/2,3-5" and thread
with ID 2 and 4 will not exist in the process, then no error will be printed,
and threads 3 and 5 will be set running. If the user has provided thread
specification, which did not match any thread, an error will be printed.  This
behaviour is consistent with pstack(1).

C. Man page changes
proc(1)

--- /tmp/proc.1.orig    Fri Jun 30 13:24:23 2006
+++ /tmp/proc.1 Fri Jun 30 13:26:56 2006
@@ -29,9 +29,9 @@

      /usr/bin/pwdx pid...

-     /usr/bin/pstop pid...
+     /usr/bin/pstop pid[/lwps] ...

-     /usr/bin/prun pid...
+     /usr/bin/prun pid[/lwps] ...

      /usr/bin/pwait [-v] pid...

YY. Stability

  _____________________________________________________________________         
  | Interface                           | Classification    | Binding |         
  |_____________________________________|___________________|_________|         
  | prun(1) per-thread mode             | Evolving          | Minor   |         
  | pstop(1) per-thread mode            | Evolving          | Minor   |         
  |_____________________________________|___________________|_________|     

-- 
Adam Leventhal, Solaris Kernel Development       http://blogs.sun.com/ahl

From sacadmin Fri Jul 21 17:24:03 2006
Received: from jurassic.eng.sun.com (jurassic.SFBay.Sun.COM [129.146.224.130])
	by sac.sfbay.sun.com (8.13.6+Sun/8.13.6) with ESMTP id k6M0O3FN018231
	for <psarc@sac.sfbay.sun.com>; Fri, 21 Jul 2006 17:24:03 -0700 (PDT)
Received: from [129.146.11.163] (sr1-umpk-05.SFBay.Sun.COM [129.146.11.163])
	by jurassic.eng.sun.com (8.13.7+Sun/8.13.6) with ESMTP id k6M0O2nX111051;
	Fri, 21 Jul 2006 17:24:02 -0700 (PDT)
Message-ID: <44C17022.50707@Sun.COM>
Date: Fri, 21 Jul 2006 17:24:02 -0700
From: Kais Belgaied <Kais.Belgaied@Sun.COM>
User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.7) Gecko/20050530
X-Accept-Language: ar-eg, en-us, en, ar, ar-dz, ar-bh, ar-iq, ar-jo, ar-kw, ar-lb, ar-ly, ar-ma, ar-om, ar-qa, ar-sa, ar-sy, ar-tn, ar-ae, ar-ye
MIME-Version: 1.0
To: Adam Leventhal <ahl@eng.sun.com>
CC: psarc@sac.sfbay.sun.com, Vitezslav.Batrla@Sun.COM
Subject: Re: PSARC 2006/447 LWP support for prun(1) and pstop(1)
References: <20060722000107.GR3313@eng.sun.com>
In-Reply-To: <20060722000107.GR3313@eng.sun.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Status: RO
Content-Length: 729



Adam Leventhal wrote On 07/21/06 17:01,:

>
>The thread specification is considered as a mask - prun(1)/pstop(1) will iterate
>over all threads in the process and stop/set running only threads whose ID will
>match the mask. For example: if the user does "prun 100123/2,3-5" and thread
>with ID 2 and 4 will not exist in the process, then no error will be printed,
>and threads 3 and 5 will be set running. If the user has provided thread
>specification, which did not match any thread, an error will be printed.  This
>behaviour is consistent with pstack(1).
>  
>

what will ps -l show for the state of a process with some of its threads 
being stopped and some
being runnable? 'T' (for being "partially"  traced?)


    Kais

From sacadmin Tue Jul 25 03:06:31 2006
Received: from sfbaymail1sca.SFBay.Sun.COM (sfbaymail1sca.SFBay.Sun.COM [129.145.154.35])
	by sac.sfbay.sun.com (8.13.6+Sun/8.13.6) with ESMTP id k6PA6Vqw015320
	for <psarc@sac.sfbay.sun.com>; Tue, 25 Jul 2006 03:06:31 -0700 (PDT)
Received: from gmpea-pix-1.sun.com (gmpes-gis-mail-2.UK.Sun.COM [129.156.42.6])
	by sfbaymail1sca.SFBay.Sun.COM (8.13.6+Sun/8.13.6/ENSMAIL,v2.2) with ESMTP id k6PA6Uok003666
	for <psarc@sac.sfbay.sun.com>; Tue, 25 Jul 2006 03:06:31 -0700 (PDT)
Received: from d1-emea-10.sun.com ([192.18.2.120])
	by gmpea-pix-1.sun.com (8.13.6+Sun/8.12.9) with ESMTP id k6PA6Osj015528
	for <psarc@sac.sfbay.sun.com>; Tue, 25 Jul 2006 11:06:25 +0100 (BST)
Received: from conversion-daemon.d1-emea-10.sun.com by d1-emea-10.sun.com
 (Sun Java System Messaging Server 6.2-4.02 (built Sep  9 2005))
 id <0J2Y00G01ENQAW00@d1-emea-10.sun.com>
 (original mail from Vitezslav.Batrla@Sun.COM) for psarc@sac.sfbay.sun.com;
 Tue, 25 Jul 2006 11:06:24 +0100 (BST)
Received: from 129.157.18.72 ([129.157.18.72])
 by d1-emea-10.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep  9
 2005)) with ESMTPSA id <0J2Y00456EQIV4ZS@d1-emea-10.sun.com>; Tue,
 25 Jul 2006 11:06:24 +0100 (BST)
Date: Tue, 25 Jul 2006 12:06:01 +0200
From: Vita Batrla <Vitezslav.Batrla@Sun.COM>
Subject: Re: PSARC 2006/447 LWP support for prun(1) and pstop(1)
In-reply-to: <44C17022.50707@Sun.COM>
Sender: Vitezslav.Batrla@Sun.COM
To: Kais Belgaied <Kais.Belgaied@Sun.COM>
Cc: Adam Leventhal <ahl@eng.sun.com>, psarc@sac.sfbay.sun.com
Message-id: <1153821961.4500.14.camel@cml>
MIME-version: 1.0
X-Mailer: Ximian Evolution 1.4.6.331
Content-type: text/plain
Content-transfer-encoding: 7BIT
References: <20060722000107.GR3313@eng.sun.com> <44C17022.50707@Sun.COM>
Status: RO
Content-Length: 1340

Hi Kais,

The current behavior is: the output of *ps -l* doesn't show state 'T'
until all threads are stopped. If some threads are stopped and some are
running/sleeping, then 'R'/'S' is displayed, etc. The command *ps -lL*
displays status per lwp and shows correctly 'T' for stopped threads.

This behavior is not new. The ability to run/stop the individual LWP
already exists in /proc filesystem, see man proc(4). You can run/stop
the particular LWP in the process by writing to
/proc/<pid>/lwp/<lwpid>/lwpctl file.

Vita

On Sat, 2006-07-22 at 02:24, Kais Belgaied wrote:
> Adam Leventhal wrote On 07/21/06 17:01,:
> 
> >
> >The thread specification is considered as a mask - prun(1)/pstop(1) will iterate
> >over all threads in the process and stop/set running only threads whose ID will
> >match the mask. For example: if the user does "prun 100123/2,3-5" and thread
> >with ID 2 and 4 will not exist in the process, then no error will be printed,
> >and threads 3 and 5 will be set running. If the user has provided thread
> >specification, which did not match any thread, an error will be printed.  This
> >behaviour is consistent with pstack(1).
> >  
> >
> 
> what will ps -l show for the state of a process with some of its threads 
> being stopped and some
> being runnable? 'T' (for being "partially"  traced?)
> 
> 
>     Kais


From sacadmin Tue Jul 25 06:09:17 2006
Received: from localhost.east.sun.com (punchin-sommerfeld.East.Sun.COM [129.148.19.3])
	by sac.sfbay.sun.com (8.13.6+Sun/8.13.6) with ESMTP id k6PD9Gr7019027
	for <psarc@sac.sfbay.sun.com>; Tue, 25 Jul 2006 06:09:17 -0700 (PDT)
Received: from localhost.east.sun.com (localhost [127.0.0.1])
	by localhost.east.sun.com (8.13.6+Sun/8.13.6) with ESMTP id k6PD95hK003696;
	Tue, 25 Jul 2006 13:09:06 GMT
Received: (from sommerfeld@localhost)
	by localhost.east.sun.com (8.13.6+Sun/8.13.6/Submit) id k6PD950V003695;
	Tue, 25 Jul 2006 09:09:05 -0400 (EDT)
X-Authentication-Warning: localhost.east.sun.com: sommerfeld set sender to sommerfeld@sun.com using -f
Subject: Re: PSARC 2006/447 LWP support for prun(1) and pstop(1)
From: Bill Sommerfeld <sommerfeld@sun.com>
To: Adam Leventhal <ahl@eng.sun.com>
Cc: psarc@sac.sfbay.sun.com, Vitezslav.Batrla@sun.com
In-Reply-To: <20060722000107.GR3313@eng.sun.com>
References: <20060722000107.GR3313@eng.sun.com>
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Message-Id: <1153832945.2948.28.camel@localhost>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.4.6.340 
Date: Tue, 25 Jul 2006 09:09:05 -0400
Status: RO
Content-Length: 1332

On Fri, 2006-07-21 at 20:01, Adam Leventhal wrote:
> I'm sponsoring the following fasttrack on behalf of Vita Batrla. This case
> introduces new ways of invoking the prun(1) and pstop(1) commands so that
> they apply only to particular LWPs. This uses the same methodology that was
> introduced in PSARC 2004/258 for utilities such as pstack(1). The stability
> it Evolving and the binding is Patch. The timer is set for 7/28/2006.

Adding this functionality is great but it seems to me that it would be
worthwhile to enhance the existing cautions in the proc(1) man page.

For instance, in the "WARNINGS" section, you could change most instances
of "process" to "process or thread"...

nit: 
at the top you say:

	"The stability i[s] Evolving and the binding is Patch."

while at the end you say:

  _____________________________________________________________________         
  | Interface                           | Classification    | Binding |         
  |_____________________________________|___________________|_________|         
  | prun(1) per-thread mode             | Evolving          | Minor   |         
  | pstop(1) per-thread mode            | Evolving          | Minor   |         
  |_____________________________________|___________________|_________|     

This looks Patch-eligible to me.

 
					- Bill



From sacadmin Tue Jul 25 09:34:10 2006
Received: from zion.eng.sun.com (zion.SFBay.Sun.COM [129.146.17.75])
	by sac.sfbay.sun.com (8.13.6+Sun/8.13.6) with ESMTP id k6PGY9ET025293
	for <psarc@sac.sfbay.sun.com>; Tue, 25 Jul 2006 09:34:09 -0700 (PDT)
Received: from zion.eng.sun.com (localhost [127.0.0.1])
	by zion.eng.sun.com (8.13.7+Sun/8.13.7) with ESMTP id k6PGY91W024307;
	Tue, 25 Jul 2006 09:34:09 -0700 (PDT)
Received: (from ahl@localhost)
	by zion.eng.sun.com (8.13.7+Sun/8.13.7/Submit) id k6PGY9Fj024306;
	Tue, 25 Jul 2006 09:34:09 -0700 (PDT)
Date: Tue, 25 Jul 2006 09:34:09 -0700
From: Adam Leventhal <ahl@eng.sun.com>
To: Bill Sommerfeld <sommerfeld@sun.com>
Cc: psarc@sac.sfbay.sun.com, Vitezslav.Batrla@sun.com
Subject: Re: PSARC 2006/447 LWP support for prun(1) and pstop(1)
Message-ID: <20060725163409.GE18073@eng.sun.com>
References: <20060722000107.GR3313@eng.sun.com> <1153832945.2948.28.camel@localhost>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1153832945.2948.28.camel@localhost>
User-Agent: Mutt/1.5.10i
Status: RO
Content-Length: 840

On Tue, Jul 25, 2006 at 09:09:05AM -0400, Bill Sommerfeld wrote:
> nit: 
> at the top you say:
> 
> 	"The stability i[s] Evolving and the binding is Patch."
> 
> while at the end you say:
> 
>   _____________________________________________________________________         
>   | Interface                           | Classification    | Binding |         
>   |_____________________________________|___________________|_________|         
>   | prun(1) per-thread mode             | Evolving          | Minor   |         
>   | pstop(1) per-thread mode            | Evolving          | Minor   |         
>   |_____________________________________|___________________|_________|     
> 
> This looks Patch-eligible to me.

Correct; the binding is Patch.

Adam

-- 
Adam Leventhal, Solaris Kernel Development       http://blogs.sun.com/ahl

From sacadmin Mon Jul 31 11:03:29 2006
Received: from zion.eng.sun.com (zion.SFBay.Sun.COM [129.146.17.75])
	by sac.sfbay.sun.com (8.13.6+Sun/8.13.6) with ESMTP id k6VI3T0X013494
	for <psarc@sac.eng.sun.com>; Mon, 31 Jul 2006 11:03:29 -0700 (PDT)
Received: from zion.eng.sun.com (localhost [127.0.0.1])
	by zion.eng.sun.com (8.13.7+Sun/8.13.7) with ESMTP id k6VI3SiS018701;
	Mon, 31 Jul 2006 11:03:29 -0700 (PDT)
Received: (from ahl@localhost)
	by zion.eng.sun.com (8.13.7+Sun/8.13.7/Submit) id k6VI3SNa018700;
	Mon, 31 Jul 2006 11:03:28 -0700 (PDT)
Date: Mon, 31 Jul 2006 11:03:28 -0700
From: Adam Leventhal <ahl@eng.sun.com>
To: psarc@sac.sfbay.sun.com
Cc: Vitezslav.Batrla@sun.com, Adam Leventhal <ahl@eng.sun.com>
Subject: Re: PSARC 2006/447 LWP support for prun(1) and pstop(1)
Message-ID: <20060731180328.GG12272@eng.sun.com>
References: <20060722000107.GR3313@eng.sun.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060722000107.GR3313@eng.sun.com>
User-Agent: Mutt/1.5.10i
Status: RO
Content-Length: 117

This case was approved on 7/26.

Adam

-- 
Adam Leventhal, Solaris Kernel Development       http://blogs.sun.com/ahl

