diff options
author | jhb <jhb@FreeBSD.org> | 2001-06-28 04:03:29 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-06-28 04:03:29 +0000 |
commit | b3565b0fc99c1039f2e3bb4741fc982a6a6ee740 (patch) | |
tree | b4fdf5d2480868db6b4e1aa410082e953dafe414 /sys/i386/include/profile.h | |
parent | 0bd9d86c0af02f2998bfd0eaf5b4dd49683dbc90 (diff) | |
download | FreeBSD-src-b3565b0fc99c1039f2e3bb4741fc982a6a6ee740.zip FreeBSD-src-b3565b0fc99c1039f2e3bb4741fc982a6a6ee740.tar.gz |
Get kernel profiling on SMP systems closer to working by replacing the
mcount spin mutex with a very simple non-recursive spinlock implemented
using atomic operations.
Diffstat (limited to 'sys/i386/include/profile.h')
-rw-r--r-- | sys/i386/include/profile.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/i386/include/profile.h b/sys/i386/include/profile.h index 5f2a780..883daf5 100644 --- a/sys/i386/include/profile.h +++ b/sys/i386/include/profile.h @@ -64,10 +64,11 @@ #else #define MCOUNT_DECL(s) u_long s; #ifdef SMP -#define MCOUNT_ENTER(s) { s = read_eflags(); \ - __asm __volatile("cli" : : : "memory"); \ - mtx_lock(&mcount_mtx); } -#define MCOUNT_EXIT(s) { mtx_unlock(&mcount_mtx); write_eflags(s); } +#define MCOUNT_ENTER(s) { s = read_eflags(); disable_intr(); \ + while (!atomic_cmpset_acq_int(&mcount_lock, 0, 1) \ + /* nothing */ ; } +#define MCOUNT_EXIT(s) { atomic_store_rel_int(&mcount_lock, 0); \ + write_eflags(s); } #else #define MCOUNT_ENTER(s) { s = read_eflags(); disable_intr(); } #define MCOUNT_EXIT(s) (write_eflags(s)) |