From nobody Tue Aug 1 17:29:12 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RFhth04tQz4pfQf; Tue, 1 Aug 2023 17:29:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RFhtJ5Zv8z4Rwn; Tue, 1 Aug 2023 17:29:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690910952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Oiv4RjRImAWpD3Mp7nYaSc8w5eYC+5Zt8LvJsG6NVo8=; b=msPWyaAa10OWMZNaw4I34jCK76YZ4cfyXRwn8/p5+eXOdzn6uUPE1C+cG4/51T3a0by0B0 6oND0krefDeKC6LNTfmRK8kev/ixBh5kdukhff/T4OSj8FFJ1PS0LjqCVlJO0RsbBiQjFZ 6Owv/lPEcbh+OnlsXsiVzNI8PgWZ8Su8P5iRO1cXy7q6MYV7jKVClGIb2Jjn2Fagkt3wQN qDvOD2owWIPTzRoGzf+HpKjaiG98RXSbP0yABDPxg+NE78tY/ep/Gmf1Lzy/3hNKlbTuW/ 8sPs/skXzkYygTJxrKiArRDPLYjh3ePff9EAf29Opw6WZgt5kYWx8AJAWhFpig== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1690910952; a=rsa-sha256; cv=none; b=ctQQX7fRbIa5dDJl8J8AYhrn9MxkYrtcPB4Hx9GGXMkfB6pS2qazDYf8612IzEnr3RqyWR eUyy7z+sjrA/6dzbOczoe7Qn7ZkzSz2j8TnOXXXzO0JnygrfIOftl74XqEsz5fHCE4WHj6 K//rhlXZDczoPL5pC7pW8w57et0GTIfKHt/trEpSEXLWNJ3SFXfPga+M914XCekrp2Vjb8 q2j0xWwGmsv6vo4f23x5iXtKjPphXbNVHy7QAHPqO3oJuWaV0gXZ1mkhqScNy1NffC029z chdv5dgRSBQPTdVl/berhMiJtCi8+I5SToLEsUBOX8eTtgeeKhesFHVhVMgmdQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690910952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Oiv4RjRImAWpD3Mp7nYaSc8w5eYC+5Zt8LvJsG6NVo8=; b=OBXyY1krZDXfvdsk20wPMcbMUzn4w8eknjWSzTEo7f0H0NPLQJ7Qheknu5d5EDWJhHfVB2 /uYlsngFb2z1K5akpX/sxK0yzBXh64TW09WyM/P6T5/7//BNF5SXxxXe7QQQO6+NTErmMB 7hiq2juOyKW6mF+p4McvrDrwUyCzQRTUnArI9Fp6gKCyK30kW0kxEZPU6mh2GZrzUW+4hg sDZGuwQzMa6qKjzGCNIZV/AJX8ZCPa6eUuXxSJqZALFyCIsMerAGNi4tJaREHzprRC1I29 iUdmPEgmcvGu8UCEmLkFF1lKuAqZFCFhQuJxWmD3uk1TNLz0hZg7E4aVdK8WgA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RFhtJ3kzWzm73; Tue, 1 Aug 2023 17:29:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 371HTCJ8046962; Tue, 1 Aug 2023 17:29:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 371HTCYQ046961; Tue, 1 Aug 2023 17:29:12 GMT (envelope-from git) Date: Tue, 1 Aug 2023 17:29:12 GMT Message-Id: <202308011729.371HTCYQ046961@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eric van Gyzen Subject: git: 1112883e19aa - main - dtrace: remove dead code for PR_REQUESTED List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vangyzen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1112883e19aaef24082f8d24f9b3bc214046caad Auto-Submitted: auto-generated The branch main has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=1112883e19aaef24082f8d24f9b3bc214046caad commit 1112883e19aaef24082f8d24f9b3bc214046caad Author: Eric van Gyzen AuthorDate: 2023-07-27 22:06:33 +0000 Commit: Eric van Gyzen CommitDate: 2023-08-01 17:28:50 +0000 dtrace: remove dead code for PR_REQUESTED libproc's PR_REQUESTED is not implemented on FreeBSD. Remove dead code in dtrace that would handle it. Reviewed by: markj MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D41225 --- .../opensolaris/lib/libdtrace/common/dt_proc.c | 95 ---------------------- lib/libproc/libproc.h | 2 +- 2 files changed, 1 insertion(+), 96 deletions(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c index 958d6ca34e85..b32dcea1f8ba 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c @@ -366,84 +366,6 @@ dt_proc_attach(dt_proc_t *dpr, int exec) } } -/* - * Wait for a stopped process to be set running again by some other debugger. - * This is typically not required by /proc-based debuggers, since the usual - * model is that one debugger controls one victim. But DTrace, as usual, has - * its own needs: the stop() action assumes that prun(1) or some other tool - * will be applied to resume the victim process. This could be solved by - * adding a PCWRUN directive to /proc, but that seems like overkill unless - * other debuggers end up needing this functionality, so we implement a cheap - * equivalent to PCWRUN using the set of existing kernel mechanisms. - * - * Our intent is really not just to wait for the victim to run, but rather to - * wait for it to run and then stop again for a reason other than the current - * PR_REQUESTED stop. Since PCWSTOP/Pstopstatus() can be applied repeatedly - * to a stopped process and will return the same result without affecting the - * victim, we can just perform these operations repeatedly until Pstate() - * changes, the representative LWP ID changes, or the stop timestamp advances. - * dt_proc_control() will then rediscover the new state and continue as usual. - * When the process is still stopped in the same exact state, we sleep for a - * brief interval before waiting again so as not to spin consuming CPU cycles. - */ -static void -dt_proc_waitrun(dt_proc_t *dpr) -{ - printf("%s:%s(%d): not implemented\n", __FUNCTION__, __FILE__, - __LINE__); -#ifdef DOODAD - struct ps_prochandle *P = dpr->dpr_proc; - const lwpstatus_t *psp = &Pstatus(P)->pr_lwp; - - int krflag = psp->pr_flags & (PR_KLC | PR_RLC); - timestruc_t tstamp = psp->pr_tstamp; - lwpid_t lwpid = psp->pr_lwpid; - - const long wstop = PCWSTOP; - int pfd = Pctlfd(P); - - assert(DT_MUTEX_HELD(&dpr->dpr_lock)); - assert(psp->pr_flags & PR_STOPPED); - assert(Pstate(P) == PS_STOP); - - /* - * While we are waiting for the victim to run, clear PR_KLC and PR_RLC - * so that if the libdtrace client is killed, the victim stays stopped. - * dt_proc_destroy() will also observe this and perform PRELEASE_HANG. - */ - (void) Punsetflags(P, krflag); - Psync(P); - - (void) pthread_mutex_unlock(&dpr->dpr_lock); - - while (!dpr->dpr_quit) { - if (write(pfd, &wstop, sizeof (wstop)) == -1 && errno == EINTR) - continue; /* check dpr_quit and continue waiting */ - - (void) pthread_mutex_lock(&dpr->dpr_lock); - (void) Pstopstatus(P, PCNULL, 0); - psp = &Pstatus(P)->pr_lwp; - - /* - * If we've reached a new state, found a new representative, or - * the stop timestamp has changed, restore PR_KLC/PR_RLC to its - * original setting and then return with dpr_lock held. - */ - if (Pstate(P) != PS_STOP || psp->pr_lwpid != lwpid || - bcmp(&psp->pr_tstamp, &tstamp, sizeof (tstamp)) != 0) { - (void) Psetflags(P, krflag); - Psync(P); - return; - } - - (void) pthread_mutex_unlock(&dpr->dpr_lock); - (void) poll(NULL, 0, MILLISEC / 2); - } - - (void) pthread_mutex_lock(&dpr->dpr_lock); -#endif -} - typedef struct dt_proc_control_data { dtrace_hdl_t *dpcd_hdl; /* DTrace handle */ dt_proc_t *dpcd_proc; /* proccess to control */ @@ -532,23 +454,6 @@ dt_proc_control(void *arg) dt_dprintf("pid %d: proc stopped showing %d/%d\n", pid, psp->pr_why, psp->pr_what); - /* - * If the process stops showing PR_REQUESTED, then the - * DTrace stop() action was applied to it or another - * debugging utility (e.g. pstop(1)) asked it to stop. - * In either case, the user's intention is for the - * process to remain stopped until another external - * mechanism (e.g. prun(1)) is applied. So instead of - * setting the process running ourself, we wait for - * someone else to do so. Once that happens, we return - * to our normal loop waiting for an event of interest. - */ - if (psp->pr_why == PR_REQUESTED) { - dt_proc_waitrun(dpr); - (void) pthread_mutex_unlock(&dpr->dpr_lock); - continue; - } - /* * If the process stops showing one of the events that * we are tracing, perform the appropriate response. diff --git a/lib/libproc/libproc.h b/lib/libproc/libproc.h index e9a2f3935d84..3d46396c6da8 100644 --- a/lib/libproc/libproc.h +++ b/lib/libproc/libproc.h @@ -111,7 +111,7 @@ typedef enum { typedef struct lwpstatus { int pr_why; -#define PR_REQUESTED 1 +#define PR_REQUESTED 1 /* not implemented */ #define PR_FAULTED 2 #define PR_SYSENTRY 3 #define PR_SYSEXIT 4