drm/i915: properly init lockdep class
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): 201711250649.n1NUHo79%[email protected]
PATCH 1/1 drm/i915: properly init lockdep class
The code has an ifdef and uses two functions to either init the bare spinlock or init it and set a lock-class. It is possible to do the same thing without an ifdef.
With this patch (in debug case) we first use the "default" lock class which is later overwritten to the supplied one. Without lockdep the set name/class function vanishes.
--- drivers/gpu/drm/i915/i915_gem_timeline.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_gem_timeline.c +1 -4
@@ -33,11 +33,8 @@ static void __intel_timeline_init(struct { tl->fence_context = context; tl->common = parent; -#ifdef CONFIG_DEBUG_SPINLOCK -__raw_spin_lock_init (&tl->lock.rlock, lockname, lockclass); -#else spin_lock_init (&tl->lock); -#endif +lockdep_set_class_and_name (&tl->lock, lockclass, lockname);init_request_active (&tl->last_request,NULL );INIT_LIST_HEAD (&tl->requests);i915_syncmap_init (&tl->sync);
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerQuoted 8 lines · Sebastian Andrzej Siewior
The code has an ifdef and uses two functions to either init the bare spinlock or init it and set a lock-class. It is possible to do the same thing without an ifdef.
With this patch (in debug case) we first use the "default" lock class which is later overwritten to the supplied one. Without lockdep the set name/class function vanishes.Reported-by kbuild test robot <[email protected]>
How exactly did kbuild test robot figure this out?
At least according to the source there doesn't seem to be clarity about what is the right thing to do, this being just one option.
Regards, Joonas
Quoted 14 lines
+++
b/drivers/gpu/drm/i915/i915_gem_timeline.cdrivers/gpu/drm/i915/i915_gem_timeline.c +1
-4@@ -33,11 +33,8 @@ static void __intel_timeline_init(struct { tl->fence_context = context; tl->common = parent; -#ifdef CONFIG_DEBUG_SPINLOCK -__raw_spin_lock_init (&tl->lock.rlock, lockname, lockclass); -#else spin_lock_init (&tl->lock); -#endif +lockdep_set_class_and_name (&tl->lock, lockclass, lockname);init_request_active (&tl->last_request,NULL );INIT_LIST_HEAD (&tl->requests);i915_syncmap_init (&tl->sync);
Signature · 7 lines
Joonas Lahtinen Open Source Technology Center Intel Corporation _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 11 lines · Joonas Lahtinen
Quoted 8 lines · Sebastian Andrzej Siewior
The code has an ifdef and uses two functions to either init the bare spinlock or init it and set a lock-class. It is possible to do the same thing without an ifdef.
With this patch (in debug case) we first use the "default" lock class which is later overwritten to the supplied one. Without lockdep the set name/class function vanishes.Reported-by kbuild test robot <[email protected]>How exactly did kbuild test robot figure this out?
I fixed it up for RT, then robot found a way to complain about it. Then I slapped myself for not submitting this patch in the first place.
Quoted 2 lines
At least according to the source there doesn't seem to be clarity about what is the right thing to do, this being just one option.
I don' think `ifdef CONFIG_DEBUG_SPINLOCK' is an option. Especially since the i915 driver here is the only user in tree doing this kind of thing.
Then we have lockdep_set_class_and_name() (which I promote here). This looks like the official way of doing lockdep related things and it has even more than ten users in tree.
Quoted 1 line
Regards, Joonas
Sebastian
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerQuoted 9 lines · Sebastian Andrzej Siewior
Quoted 8 lines · Joonas Lahtinen
Quoted 7 lines · Sebastian Andrzej Siewior
The code has an ifdef and uses two functions to either init the bare spinlock or init it and set a lock-class. It is possible to do the same thing without an ifdef.
With this patch (in debug case) we first use the "default" lock class which is later overwritten to the supplied one. Without lockdep the set name/class function vanishes.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Reported-by kbuild test robot <[email protected]>How exactly did kbuild test robot figure this out?
I fixed it up for RT, then robot found a way to complain about it. Then I slapped myself for not submitting this patch in the first place.
Right, I was kinda wondering if the robot has gained consciuousness and is developing new checks...
Quoted 9 lines
Quoted 2 lines
At least according to the source there doesn't seem to be clarity about what is the right thing to do, this being just one option.
I don' think `ifdef
CONFIG_DEBUG_SPINLOCK' is an option. Especially since the i915 driver here is the only user in tree doing this kind of thing.
Then we havelockdep_set_class_and_name()(which I promote here). This looks like the official way of doing lockdep related things and it has even more than ten users in tree.
I think it be worthwhile to suggest would be the addition of __spin_lock_init where you can pass in the the lockclass and name.
Regards, Joonas
Signature · 7 lines
Joonas Lahtinen Open Source Technology Center Intel Corporation _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
+peterz
context: http://www.spinics.net/lists/intel-gfx/msg149011.html
Quoted 9 lines · Joonas Lahtinen
Quoted 8 lines · Sebastian Andrzej Siewior
Quoted 7 lines · Joonas Lahtinen
Quoted 6 lines · Sebastian Andrzej Siewior
The code has an ifdef and uses two functions to either init the bare spinlock or init it and set a lock-class. It is possible to do the same thing without an ifdef.
With this patch (in debug case) we first use the "default" lock class which is later overwritten to the supplied one. Without lockdep the set name/class function vanishes.
…
Quoted 10 lines
Quoted 9 lines
Quoted 2 lines
At least according to the source there doesn't seem to be clarity about what is the right thing to do, this being just one option.
I don' think `ifdef
CONFIG_DEBUG_SPINLOCK' is an option. Especially since the i915 driver here is the only user in tree doing this kind of thing.
Then we havelockdep_set_class_and_name()(which I promote here). This looks like the official way of doing lockdep related things and it has even more than ten users in tree.
Quoted 2 lines
I think it be worthwhile to suggest would be the addition of
__spin_lock_initwhere you can pass in the the lockclass and name.
I don't due to the existing interface. However I don't call the shots here and added peterz instead :)
Quoted 1 line
Regards, Joonas
Sebastian
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Sebastian Andrzej Siewior
+peterz
context: http://www.spinics.net/lists/intel-gfx/msg149011.htmlQuoted 2 lines · Joonas Lahtinen
Quoted 1 line · Sebastian Andrzej Siewior
On 2017-12-13 16:00:49 [+0200], Joonas Lahtinen wrote:
Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines · Sebastian Andrzej Siewior
Quoted 6 lines
The code has an ifdef and uses two functions to either init the bare spinlock or init it and set a lock-class. It is possible to do the same thing without an ifdef.
With this patch (in debug case) we first use the "default" lock class which is later overwritten to the supplied one. Without lockdep the set name/class function vanishes.…
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
At least according to the source there doesn't seem to be clarity about what is the right thing to do, this being just one option.
The proposed patch is definitely the right thing to do. The fact that it doesn't require #ifdef is a very big clue.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx