Deleted Added
full compact
subr_witness.c (227588) subr_witness.c (228424)
1/*-
2 * Copyright (c) 2008 Isilon Systems, Inc.
3 * Copyright (c) 2008 Ilya Maykov <ivmaykov@gmail.com>
4 * Copyright (c) 1998 Berkeley Software Design, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 71 unchanged lines hidden (view full) ---

80 * you have two threads T1 and T2 and a sleepable lock X. Suppose that T1
81 * acquires X and blocks on Giant. Then suppose that T2 acquires Giant and
82 * blocks on X. When T2 blocks on X, T2 will release Giant allowing T1 to
83 * execute. Thus, acquiring Giant both before and after a sleepable lock
84 * will not result in a lock order reversal.
85 */
86
87#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2008 Isilon Systems, Inc.
3 * Copyright (c) 2008 Ilya Maykov <ivmaykov@gmail.com>
4 * Copyright (c) 1998 Berkeley Software Design, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 71 unchanged lines hidden (view full) ---

80 * you have two threads T1 and T2 and a sleepable lock X. Suppose that T1
81 * acquires X and blocks on Giant. Then suppose that T2 acquires Giant and
82 * blocks on X. When T2 blocks on X, T2 will release Giant allowing T1 to
83 * execute. Thus, acquiring Giant both before and after a sleepable lock
84 * will not result in a lock order reversal.
85 */
86
87#include <sys/cdefs.h>
88__FBSDID("$FreeBSD: head/sys/kern/subr_witness.c 227588 2011-11-16 21:51:17Z pjd $");
88__FBSDID("$FreeBSD: head/sys/kern/subr_witness.c 228424 2011-12-11 21:02:01Z avg $");
89
90#include "opt_ddb.h"
91#include "opt_hwpmc_hooks.h"
92#include "opt_stack.h"
93#include "opt_witness.h"
94
95#include <sys/param.h>
96#include <sys/bus.h>

--- 2060 unchanged lines hidden (view full) ---

2157
2158void
2159witness_save(struct lock_object *lock, const char **filep, int *linep)
2160{
2161 struct lock_list_entry *lock_list;
2162 struct lock_instance *instance;
2163 struct lock_class *class;
2164
89
90#include "opt_ddb.h"
91#include "opt_hwpmc_hooks.h"
92#include "opt_stack.h"
93#include "opt_witness.h"
94
95#include <sys/param.h>
96#include <sys/bus.h>

--- 2060 unchanged lines hidden (view full) ---

2157
2158void
2159witness_save(struct lock_object *lock, const char **filep, int *linep)
2160{
2161 struct lock_list_entry *lock_list;
2162 struct lock_instance *instance;
2163 struct lock_class *class;
2164
2165 /*
2166 * This function is used independently in locking code to deal with
2167 * Giant, SCHEDULER_STOPPED() check can be removed here after Giant
2168 * is gone.
2169 */
2170 if (SCHEDULER_STOPPED())
2171 return;
2165 KASSERT(witness_cold == 0, ("%s: witness_cold", __func__));
2166 if (lock->lo_witness == NULL || witness_watch == -1 || panicstr != NULL)
2167 return;
2168 class = LOCK_CLASS(lock);
2169 if (class->lc_flags & LC_SLEEPLOCK)
2170 lock_list = curthread->td_sleeplocks;
2171 else {
2172 if (witness_skipspin)

--- 10 unchanged lines hidden (view full) ---

2183
2184void
2185witness_restore(struct lock_object *lock, const char *file, int line)
2186{
2187 struct lock_list_entry *lock_list;
2188 struct lock_instance *instance;
2189 struct lock_class *class;
2190
2172 KASSERT(witness_cold == 0, ("%s: witness_cold", __func__));
2173 if (lock->lo_witness == NULL || witness_watch == -1 || panicstr != NULL)
2174 return;
2175 class = LOCK_CLASS(lock);
2176 if (class->lc_flags & LC_SLEEPLOCK)
2177 lock_list = curthread->td_sleeplocks;
2178 else {
2179 if (witness_skipspin)

--- 10 unchanged lines hidden (view full) ---

2190
2191void
2192witness_restore(struct lock_object *lock, const char *file, int line)
2193{
2194 struct lock_list_entry *lock_list;
2195 struct lock_instance *instance;
2196 struct lock_class *class;
2197
2198 /*
2199 * This function is used independently in locking code to deal with
2200 * Giant, SCHEDULER_STOPPED() check can be removed here after Giant
2201 * is gone.
2202 */
2203 if (SCHEDULER_STOPPED())
2204 return;
2191 KASSERT(witness_cold == 0, ("%s: witness_cold", __func__));
2192 if (lock->lo_witness == NULL || witness_watch == -1 || panicstr != NULL)
2193 return;
2194 class = LOCK_CLASS(lock);
2195 if (class->lc_flags & LC_SLEEPLOCK)
2196 lock_list = curthread->td_sleeplocks;
2197 else {
2198 if (witness_skipspin)

--- 628 unchanged lines hidden ---
2205 KASSERT(witness_cold == 0, ("%s: witness_cold", __func__));
2206 if (lock->lo_witness == NULL || witness_watch == -1 || panicstr != NULL)
2207 return;
2208 class = LOCK_CLASS(lock);
2209 if (class->lc_flags & LC_SLEEPLOCK)
2210 lock_list = curthread->td_sleeplocks;
2211 else {
2212 if (witness_skipspin)

--- 628 unchanged lines hidden ---