[PATCH v5 01/21] gpu: host1x: Use different lock classes for each client

Dmitry Osipenko digetx at gmail.com
Mon Mar 22 14:48:46 UTC 2021


22.03.2021 17:46, Thierry Reding пишет:
> On Mon, Jan 11, 2021 at 02:59:59PM +0200, Mikko Perttunen wrote:
>> To avoid false lockdep warnings, give each client lock a different
>> lock class, passed from the initialization site by macro.
>>
>> Signed-off-by: Mikko Perttunen <mperttunen at nvidia.com>
>> ---
>>  drivers/gpu/host1x/bus.c | 7 ++++---
>>  include/linux/host1x.h   | 9 ++++++++-
>>  2 files changed, 12 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
>> index 347fb962b6c9..8fc79e9cb652 100644
>> --- a/drivers/gpu/host1x/bus.c
>> +++ b/drivers/gpu/host1x/bus.c
>> @@ -715,13 +715,14 @@ EXPORT_SYMBOL(host1x_driver_unregister);
>>   * device and call host1x_device_init(), which will in turn call each client's
>>   * &host1x_client_ops.init implementation.
>>   */
>> -int host1x_client_register(struct host1x_client *client)
>> +int __host1x_client_register(struct host1x_client *client,
>> +			   struct lock_class_key *key)
> 
> I've seen the kbuild robot warn about this because the kerneldoc is now
> out of date.
> 
>>  {
>>  	struct host1x *host1x;
>>  	int err;
>>  
>>  	INIT_LIST_HEAD(&client->list);
>> -	mutex_init(&client->lock);
>> +	__mutex_init(&client->lock, "host1x client lock", key);
> 
> Should we maybe attempt to make this unique? Could we use something like
> dev_name(client->dev) for this?

I'm curious who the lockdep warning could be triggered at all, I don't
recall ever seeing it. Mikko, could you please clarify how to reproduce
the warning?


More information about the dri-devel mailing list