Re: [Letux-kernel] BUG: drivers/pinctrl/core: races in pinctrl_groups and deferred probing

From: H. Nikolaus Schaller
Date: Mon Jun 18 2018 - 05:29:49 EST



> Am 18.06.2018 um 11:14 schrieb Tony Lindgren <tony@xxxxxxxxxxx>:
>
> * Andy Shevchenko <andy.shevchenko@xxxxxxxxx> [180618 08:25]:
>> On Sat, Jun 16, 2018 at 2:08 PM H. Nikolaus Schaller <hns@xxxxxxxxxxxxx> wrote:
>>> But it looks as if we still have duplicate assignments by deferred probing, i.e. some cleanup is
>>> missing (or is this intended behaviour?).
>>
>>> But I think the fundamental problem is that the same driver assigns multiple slots if
>>> probing is deferred.
>>
>> Indeed.
>>
>> I think there is a simple way to clean up pinctrl stuff on failed probe. See
>> https://elixir.bootlin.com/linux/v4.18-rc1/source/drivers/base/dd.c#L416
>>
>> We only bind pins, and do not perform any actions when failure happens later on.
>
> Yup seems like a good approach. I'll take a look if we can just
> check if the function or group name already exists and return
> the existing selector in that case.

Ok, that would also solve the duplication issue.

On the other hand we still have a stale entry if the probing process
finally fails after several attempts.

This may happen if a driver with a valid DT entry is blacklisted in
/etc/modprobe.d/blacklist.conf. Then, the kernel will try to modprobe
it several times through udev until it gives up. The reason seems to
be that the deferred probing thread does not know why the driver did
not probe successfully.

BR and thanks,
Nikolaus

>
> Regards,
>
> Tony