devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomeu Vizoso <tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
To: Alexander Holler <holler-SXC+2es9fhnfWeYVQQPykw@public.gmane.org>
Cc: "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"Thierry Reding"
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Stéphane Marchesin"
	<marcheu-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	"Olof Johansson" <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
	"Grant Likely"
	<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"Rob Herring" <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"Mark Rutland" <mark.rutland-5wv7dgnIgG8@public.gmane.org>
Subject: Re: [RFC 00/12] On-demand device registration
Date: Wed, 29 Apr 2015 08:58:42 +0200	[thread overview]
Message-ID: <CAAObsKBQMY8NfzN3bfiDuy=QOsSV281punJGuEUPfMRRBwoA+g@mail.gmail.com> (raw)
In-Reply-To: <553FCECB.7040005-SXC+2es9fhnfWeYVQQPykw@public.gmane.org>

On 28 April 2015 at 20:17, Alexander Holler <holler-SXC+2es9fhnfWeYVQQPykw@public.gmane.org> wrote:
> Am 28.04.2015 um 14:49 schrieb Tomeu Vizoso:
>>
>> On 25 April 2015 at 01:15, Alexander Holler <holler-SXC+2es9fhnfWeYVQQPykw@public.gmane.org> wrote:
>>>
>>> Am 24.04.2015 um 16:47 schrieb Tomeu Vizoso:
>>>>
>>>> Hi,
>>>>
>>>> while reading the thread [0] that Alexander Holler started with his
>>>> series to make probing order deterministic, it occurred to me that it should
>>>> be possible to achieve the same by probing devices as they are referenced by
>>>> other devices.
>>>>
>>>> This basically reuses the information that is already embedded in the
>>>> probe() implementations, saving us from refactoring existing drivers or
>>>> adding information to DTBs.
>>>>
>>>> The main issue I see is that the registration code path in some
>>>> subsystems may not be reentrant, so some refactoring of the locking will be
>>>> needed. In my testing I have found this problem with regulators, as the
>>>> supply of a regulator might end up being registered during the registration
>>>> of the first one.
>>>>
>>>> Something I'm not completely happy with is that I have had to move the
>>>> population of the device tree after all platform drivers have been
>>>> registered. Otherwise I don't see how I could register drivers on demand as
>>>> we don't have yet each driver's compatible strings.
>>>>
>>>> I have done my testing on a Tegra124-based Chromebook, and these patches
>>>> were enough to eliminate all the deferred probes.
>>>
>>>
>>> First you have to solve a problem which is totally unrelated to DT or
>>> ACPI or x86 or ARM:
>>>
>>> I think as long as drivers don't register themself whithout any side
>>> effect, this problem isn't solvable. In order to make an ordered list of
>>> drivers to start, you need to know which drivers are actually available.
>>
>>
>> Yeah, I kind of side-stepped that issue by waiting until all drivers
>> have been registered before registering devices. I think someone
>> suggested doing so in your thread (maybe Grant?).
>
>
> That doesn't work. As said above, several drivers doing a lot more than just
> registering in their initcall. They might even crash if some prerequisits
> aren't given. And several of these prerequisits (init orders) are hardcoded
> by various means.

But aren't those dependencies being taken care currently by the
initcall level the driver is placed in? That remains the same in this
approach.

I have obviously spent less time thinking about all this than you, so
sorry if I'm missing too many points.

Regards,

Tomeu

>> There's lots of things that can be improved regarding driver and
>> device initialization, but we have to start somewhere :)
>
>
> That's what I've tried by marking good drivers as such (and by placing them
> in their own initcall level group).
>
> But as said, good luck. I've tried it already and nobody seemed interested.
> Some people even seem to panic if they see a patch which changes something
> in linux/init/ ;)
>
> Regards,
>
> Alexander Holler
>
>
>>
>> Thanks,
>>
>> Tomeu
>>
>>> And also drivers are registering themself with their initcall, they
>>> might do an awfull lot of stuff besides just registering themself. That
>>> means several drivers already have prerequisites and dependcies for
>>> their initcall. That means you can't just call their initcall to get and
>>> idea of which driver an initcall is even part of.
>>>
>>> That ends up with the fact that you just don't have a list of drivers
>>> you can sort, based on whatever algorithm you might have in mind.
>>>
>>> I've tried to solve that problem with marking drivers which don't have
>>> any prerequisits (and side effects) as "well done".
>>>
>>> The patch which did that was 5/9 in my series, this one:
>>>
>>> https://lkml.org/lkml/2014/5/12/414
>>>
>>> Unfortunately nobody seemed really interested and without one of the few
>>> "big guys" in your pocket, it's absolutely impossible to get such
>>> changes into the kernel.
>>>
>>> Not to speak about all the unavoidable discussions about absolutely
>>> silly things.
>>>
>>> But maybe I'm the problem here. No idea. I wish you more luck than I had
>>> in the past two or three years.
>>>
>>> Regards,
>>>
>>> Alexander Holler
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-kernel"
>>> in
>>> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>> Please read the FAQ at  http://www.tux.org/lkml/
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-04-29  6:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-24 14:47 [RFC 00/12] On-demand device registration Tomeu Vizoso
2015-04-24 14:47 ` [RFC 02/12] ARM: tegra: Add gpio-ranges property Tomeu Vizoso
2015-04-24 14:47 ` [RFC 03/12] of/platform: add of_platform_device_ensure() Tomeu Vizoso
2015-04-24 14:47 ` [RFC 05/12] gpio: Probe pinctrl devices on demand Tomeu Vizoso
2015-04-24 14:47 ` [RFC 06/12] regulator: core: Probe regulators " Tomeu Vizoso
2015-04-24 14:47 ` [RFC 07/12] drm: Probe panels " Tomeu Vizoso
     [not found] ` <1429886848-5843-1-git-send-email-tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2015-04-24 14:47   ` [RFC 01/12] ARM: tegra: Register drivers before devices Tomeu Vizoso
2015-04-24 14:47   ` [RFC 04/12] gpio: Probe GPIO drivers on demand Tomeu Vizoso
2015-04-24 14:47   ` [RFC 08/12] drm/tegra: Probe dpaux devices " Tomeu Vizoso
2015-04-24 14:47 ` [RFC 09/12] i2c: core: Probe i2c master " Tomeu Vizoso
2015-04-24 14:47 ` [RFC 10/12] pwm: Probe PWM chip " Tomeu Vizoso
2015-04-24 14:47 ` [RFC 11/12] backlight: Probe backlight " Tomeu Vizoso
2015-04-24 14:47 ` [RFC 12/12] usb: phy: Probe phy " Tomeu Vizoso
2015-04-24 23:15 ` [RFC 00/12] On-demand device registration Alexander Holler
2015-04-28 12:49   ` Tomeu Vizoso
2015-04-28 18:17     ` Alexander Holler
     [not found]       ` <553FCECB.7040005-SXC+2es9fhnfWeYVQQPykw@public.gmane.org>
2015-04-29  6:58         ` Tomeu Vizoso [this message]
2015-04-29  9:46           ` Alexander Holler
2015-04-30  7:44             ` Alexander Holler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAObsKBQMY8NfzN3bfiDuy=QOsSV281punJGuEUPfMRRBwoA+g@mail.gmail.com' \
    --to=tomeu.vizoso-zgy8ohtn/8qb+jhodadfcq@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=holler-SXC+2es9fhnfWeYVQQPykw@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=marcheu-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).