diff options
author | John Levon <john.levon@joyent.com> | 2018-08-15 13:52:29 +0000 |
---|---|---|
committer | John Levon <john.levon@joyent.com> | 2018-08-15 13:52:29 +0000 |
commit | 005d090d5d39829784302a3c8574b81b88fc69d0 (patch) | |
tree | 3583e1eb4c1de6265db97c3683d8da8d78e44b53 /usr/src/cmd | |
parent | c6493650bb8171db31ebebfa92d9a19dd0fe3e82 (diff) | |
download | illumos-joyent-release-20180816.tar.gz |
OS-5852 kmdb tortures via single-step miscellaneous traprelease-20180816
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>
Diffstat (limited to 'usr/src/cmd')
-rw-r--r-- | usr/src/cmd/mdb/common/kmdb/kaif_start.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/usr/src/cmd/mdb/common/kmdb/kaif_start.c b/usr/src/cmd/mdb/common/kmdb/kaif_start.c index 6c0fc810bb..c6ecd84b70 100644 --- a/usr/src/cmd/mdb/common/kmdb/kaif_start.c +++ b/usr/src/cmd/mdb/common/kmdb/kaif_start.c @@ -21,10 +21,9 @@ /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2018 Joyent, Inc. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * The main CPU-control loops, used to control masters and slaves. */ @@ -248,7 +247,7 @@ kaif_slave_loop(kaif_cpusave_t *cpusave) } else if (slavecmd == KAIF_SLAVE_CMD_ACK) { cpusave->krs_cpu_acked = 1; } else if (cpusave->krs_cpu_acked && - slavecmd == KAIF_SLAVE_CMD_SPIN) { + slavecmd == KAIF_SLAVE_CMD_SPIN) { cpusave->krs_cpu_acked = 0; #endif } @@ -292,13 +291,31 @@ kaif_main_loop(kaif_cpusave_t *cpusave) int cmd; if (kaif_master_cpuid == KAIF_MASTER_CPUID_UNSET) { + + /* + * Special case: Unload requested before first debugger entry. + * Don't stop the world, as there's nothing to clean up that + * can't be handled by the running kernel. + */ if (!kmdb_dpi_resume_requested && kmdb_kdi_get_unload_request()) { - /* - * Special case: Unload requested before first debugger - * entry. Don't stop the world, as there's nothing to - * clean up that can't be handled by the running kernel. - */ + cpusave->krs_cpu_state = KAIF_CPU_STATE_NONE; + return (KAIF_CPU_CMD_RESUME); + } + + /* + * We're a slave with no master, so just resume. This can + * happen if, prior to this, two CPUs both raced through + * kdi_cmnint() - for example, a breakpoint on a frequently + * called function. The loser will be redirected to the slave + * loop; note that the event itself is lost at this point. + * + * The winner will then cross-call that slave, but it won't + * actually be received until the slave returns to the kernel + * and enables interrupts. We'll then come back in via + * kdi_slave_entry() and hit this path. + */ + if (cpusave->krs_cpu_state == KAIF_CPU_STATE_SLAVE) { cpusave->krs_cpu_state = KAIF_CPU_STATE_NONE; return (KAIF_CPU_CMD_RESUME); } |