[PATCH] drm/i915: avoid flush_scheduled_work() usage

Jani Nikula jani.nikula at intel.com
Mon Mar 6 11:05:06 UTC 2023


On Fri, 03 Mar 2023, Tetsuo Handa <penguin-kernel at I-love.SAKURA.ne.jp> wrote:
> On 2023/03/03 19:11, Tetsuo Handa wrote:
>> @@ -79,6 +81,7 @@ static int __init i915_init(void)
>>  {
>>  	int err, i;
>>  
>> +	i915_wq = alloc_workqueue("i915", 0, 0);
>
> Oops. I forgot to add
>
> 	if (!i915_wq)
> 		return -ENOMEM;
>
> here. But I'd like to wait for your response for a while before submitting v2 patch.

Looks like accounting for every schedule_work() and friends that we have
is pretty difficult at this point, so I agree going for a local
workqueue and flushing that is probably the way to go. Work specific
cleanups can follow.

However, we really don't want to add new module globals, not for this,
not for anything. So for most things it would have to be i915 device
specific. And that, in turn, would have to be two workqueues, one for
display, one for other stuff. Don't want to mix the two.

BR,
Jani.









>
>
>>  	for (i = 0; i < ARRAY_SIZE(init_funcs); i++) {
>>  		err = init_funcs[i].init();
>>  		if (err < 0) {
>> @@ -86,6 +89,7 @@ static int __init i915_init(void)
>>  				if (init_funcs[i].exit)
>>  					init_funcs[i].exit();
>>  			}
>> +			destroy_workqueue(i915_wq);
>>  			return err;
>>  		} else if (err > 0) {
>>  			/*
>> @@ -113,6 +117,7 @@ static void __exit i915_exit(void)
>>  		if (init_funcs[i].exit)
>>  			init_funcs[i].exit();
>>  	}
>> +	destroy_workqueue(i915_wq);
>>  }
>>  
>>  module_init(i915_init);
>

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the dri-devel mailing list