summaryrefslogtreecommitdiff
path: root/locking.h
blob: ddc40270b538cbed13941ede7b28983ec4f17cf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef LOCKING_H
#define LOCKING_H

#include <pthread.h>

struct spinlock {
	pthread_spinlock_t lock;
};

struct mutexlock {
	pthread_mutex_t lock;
};

#define MUTEXLOCK_INITIALIZER { .lock = PTHREAD_MUTEX_INITIALIZER }

struct rwlock {
	pthread_rwlock_t lock;
};

static inline int spinlock_init(struct spinlock *l)
{
	return -pthread_spin_init(&l->lock, 0);
}

static inline void spinlock_destroy(struct spinlock *l)
{
	pthread_spin_destroy(&l->lock);
}

static inline void spinlock_lock(struct spinlock *l)
{
	pthread_spin_lock(&l->lock);
}

static inline void spinlock_unlock(struct spinlock *l)
{
	pthread_spin_unlock(&l->lock);
}

static inline int mutexlock_init(struct mutexlock *l)
{
	return -pthread_mutex_init(&l->lock, 0);
}

static inline void mutexlock_destroy(struct mutexlock *l)
{
	pthread_mutex_destroy(&l->lock);
}

static inline void mutexlock_lock(struct mutexlock *l)
{
	pthread_mutex_lock(&l->lock);
}

static inline void mutexlock_unlock(struct mutexlock *l)
{
	pthread_mutex_unlock(&l->lock);
}

static inline int rwlock_init(struct rwlock *l)
{
	return -pthread_rwlock_init(&l->lock, 0);
}

static inline int rwlock_init2(struct rwlock *l,
			       pthread_rwlockattr_t *attr)
{
	return -pthread_rwlock_init(&l->lock, attr);
}

static inline void rwlock_destroy(struct rwlock *l)
{
	pthread_rwlock_destroy(&l->lock);
}

static inline void rwlock_rd_lock(struct rwlock *l)
{
	pthread_rwlock_rdlock(&l->lock);
}

static inline void rwlock_wr_lock(struct rwlock *l)
{
	pthread_rwlock_wrlock(&l->lock);
}

static inline void rwlock_unlock(struct rwlock *l)
{
	pthread_rwlock_unlock(&l->lock);
}

#endif /* LOCKING_H */
[c00000010cfef300] [c000000000f7bc80] init_net+0x0/0x1900 (unreliable) [ 142.278310] [c00000010cfef320] [c000000000706c78] peernet2id+0x58/0x80 [ 142.278316] [c00000010cfef370] [c00000000075caec] netlink_broadcast_filtered+0x30c/0x550 [ 142.278323] [c00000010cfef430] [c000000000459078] kobject_uevent_env+0x588/0x780 [ 142.278331] [c00000010cfef510] [d000000003163a6c] ipr_process_error+0x11c/0x240 [ipr] [ 142.278337] [c00000010cfef5c0] [d000000003152298] ipr_fail_all_ops+0x108/0x220 [ipr] [ 142.278343] [c00000010cfef670] [d0000000031643f8] ipr_reset_restore_cfg_space+0xa8/0x240 [ipr] [ 142.278350] [c00000010cfef6f0] [d000000003158a00] ipr_reset_ioa_job+0x80/0xe0 [ipr] [ 142.278356] [c00000010cfef720] [d000000003153f78] ipr_reset_timer_done+0xa8/0xe0 [ipr] [ 142.278363] [c00000010cfef770] [c000000000149c88] call_timer_fn+0x58/0x1c0 [ 142.278368] [c00000010cfef800] [c000000000149f60] expire_timers+0x140/0x200 [ 142.278373] [c00000010cfef870] [c00000000014a0e8] run_timer_softirq+0xc8/0x230 [ 142.278379] [c00000010cfef900] [c0000000000c0844] __do_softirq+0x164/0x3c0 [ 142.278384] [c00000010cfef9f0] [c0000000000c0f18] irq_exit+0x1a8/0x1c0 [ 142.278389] [c00000010cfefa20] [c000000000020b54] timer_interrupt+0xa4/0xe0 [ 142.278394] [c00000010cfefa50] [c000000000002414] decrementer_common+0x114/0x180 Signed-off-by: Brian King <brking@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat