Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Avoid taking lwp_lock when calling process_sstep() ...
details: https://anonhg.NetBSD.org/src/rev/cb0b13e63531
branches: trunk
changeset: 933548:cb0b13e63531
user: kamil <kamil%NetBSD.org@localhost>
date: Tue May 26 23:08:56 2020 +0000
description:
Avoid taking lwp_lock when calling process_sstep() for sibling LWPs
This makes the code consistend between single-threaded and multi-threaded
code.
diffstat:
sys/kern/sys_ptrace_common.c | 19 ++++++++-----------
1 files changed, 8 insertions(+), 11 deletions(-)
diffs (41 lines):
diff -r 0491a4edd04d -r cb0b13e63531 sys/kern/sys_ptrace_common.c
--- a/sys/kern/sys_ptrace_common.c Tue May 26 22:54:43 2020 +0000
+++ b/sys/kern/sys_ptrace_common.c Tue May 26 23:08:56 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_ptrace_common.c,v 1.81 2020/05/23 23:42:43 ad Exp $ */
+/* $NetBSD: sys_ptrace_common.c,v 1.82 2020/05/26 23:08:56 kamil Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.81 2020/05/23 23:42:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.82 2020/05/26 23:08:56 kamil Exp $");
#ifdef _KERNEL_OPT
#include "opt_ptrace.h"
@@ -1421,16 +1421,13 @@
* the requested thread, and clear it for other threads.
*/
LIST_FOREACH(lt2, &t->p_lwps, l_sibling) {
- if (ISSET(lt2->l_pflag, LP_SINGLESTEP)) {
- lwp_lock(lt2);
- process_sstep(lt2, 1);
- lwp_unlock(lt2);
- } else if (lt != lt2) {
- lwp_lock(lt2);
- process_sstep(lt2, 0);
- lwp_unlock(lt2);
- }
+ error = process_sstep(lt2,
+ ISSET(lt2->l_pflag, LP_SINGLESTEP));
+ if (error)
+ break;
}
+ if (error)
+ break;
error = process_sstep(lt,
ISSET(lt->l_pflag, LP_SINGLESTEP) || req == PT_STEP);
if (error)
Home |
Main Index |
Thread Index |
Old Index