subr_witness.c (298310) | subr_witness.c (298411) |
---|---|
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 298310 2016-04-19 23:48:27Z pfg $"); | 88__FBSDID("$FreeBSD: head/sys/kern/subr_witness.c 298411 2016-04-21 15:38:28Z pfg $"); |
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> --- 607 unchanged lines hidden (view full) --- 704 705#ifdef BLESSING 706/* 707 * Pairs of locks which have been blessed 708 * Don't complain about order problems with blessed locks 709 */ 710static struct witness_blessed blessed_list[] = { 711}; | 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> --- 607 unchanged lines hidden (view full) --- 704 705#ifdef BLESSING 706/* 707 * Pairs of locks which have been blessed 708 * Don't complain about order problems with blessed locks 709 */ 710static struct witness_blessed blessed_list[] = { 711}; |
712static int blessed_count = nitems(blessed_list); | |
713#endif 714 715/* 716 * This global is set to 0 once it becomes safe to use the witness code. 717 */ 718static int witness_cold = 1; 719 720/* --- 1333 unchanged lines hidden (view full) --- 2054 2055#ifdef BLESSING 2056static int 2057blessed(struct witness *w1, struct witness *w2) 2058{ 2059 int i; 2060 struct witness_blessed *b; 2061 | 712#endif 713 714/* 715 * This global is set to 0 once it becomes safe to use the witness code. 716 */ 717static int witness_cold = 1; 718 719/* --- 1333 unchanged lines hidden (view full) --- 2053 2054#ifdef BLESSING 2055static int 2056blessed(struct witness *w1, struct witness *w2) 2057{ 2058 int i; 2059 struct witness_blessed *b; 2060 |
2062 for (i = 0; i < blessed_count; i++) { | 2061 for (i = 0; i < nitems(blessed_list); i++) { |
2063 b = &blessed_list[i]; 2064 if (strcmp(w1->w_name, b->b_lock1) == 0) { 2065 if (strcmp(w2->w_name, b->b_lock2) == 0) 2066 return (1); 2067 continue; 2068 } 2069 if (strcmp(w1->w_name, b->b_lock2) == 0) 2070 if (strcmp(w2->w_name, b->b_lock1) == 0) --- 949 unchanged lines hidden --- | 2062 b = &blessed_list[i]; 2063 if (strcmp(w1->w_name, b->b_lock1) == 0) { 2064 if (strcmp(w2->w_name, b->b_lock2) == 0) 2065 return (1); 2066 continue; 2067 } 2068 if (strcmp(w1->w_name, b->b_lock2) == 0) 2069 if (strcmp(w2->w_name, b->b_lock1) == 0) --- 949 unchanged lines hidden --- |