Skip to content

Commit 318ce71

Browse files
a-darwishPeter Zijlstra
authored andcommitted
dma-buf: Remove custom seqcount lockdep class key
Commit 3c3b177 ("reservation: add support for read-only access using rcu") introduced a sequence counter to manage updates to reservations. Back then, the reservation object initializer reservation_object_init() was always inlined. Having the sequence counter initialization inlined meant that each of the call sites would have a different lockdep class key, which would've broken lockdep's deadlock detection. The aforementioned commit thus introduced, and exported, a custom seqcount lockdep class key and name. The commit 8735f16 ("dma-buf: cleanup reservation_object_init...") transformed the reservation object initializer to a normal non-inlined C function. seqcount_init(), which automatically defines the seqcount lockdep class key and must be called non-inlined, can now be safely used. Remove the seqcount custom lockdep class key, name, and export. Use seqcount_init() inside the dma reservation object initializer. Signed-off-by: Ahmed S. Darwish <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Sebastian Andrzej Siewior <[email protected]> Acked-by: Daniel Vetter <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent ec8702d commit 318ce71

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

drivers/dma-buf/dma-resv.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@
5151
DEFINE_WD_CLASS(reservation_ww_class);
5252
EXPORT_SYMBOL(reservation_ww_class);
5353

54-
struct lock_class_key reservation_seqcount_class;
55-
EXPORT_SYMBOL(reservation_seqcount_class);
56-
57-
const char reservation_seqcount_string[] = "reservation_seqcount";
58-
EXPORT_SYMBOL(reservation_seqcount_string);
59-
6054
/**
6155
* dma_resv_list_alloc - allocate fence list
6256
* @shared_max: number of fences we need space for
@@ -135,9 +129,8 @@ subsys_initcall(dma_resv_lockdep);
135129
void dma_resv_init(struct dma_resv *obj)
136130
{
137131
ww_mutex_init(&obj->lock, &reservation_ww_class);
132+
seqcount_init(&obj->seq);
138133

139-
__seqcount_init(&obj->seq, reservation_seqcount_string,
140-
&reservation_seqcount_class);
141134
RCU_INIT_POINTER(obj->fence, NULL);
142135
RCU_INIT_POINTER(obj->fence_excl, NULL);
143136
}

include/linux/dma-resv.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@
4646
#include <linux/rcupdate.h>
4747

4848
extern struct ww_class reservation_ww_class;
49-
extern struct lock_class_key reservation_seqcount_class;
50-
extern const char reservation_seqcount_string[];
5149

5250
/**
5351
* struct dma_resv_list - a list of shared fences

0 commit comments

Comments
 (0)