From: Daniel Vetter <daniel@ffwll.ch>
To: Lukas Wunner <lukas@wunner.de>
Cc: Alex Deucher <alexander.deucher@amd.com>,
intel-gfx <intel-gfx@lists.freedesktop.org>,
Ben Skeggs <bskeggs@redhat.com>,
dri-devel <dri-devel@lists.freedesktop.org>,
platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH v5 10/12] drm/i915: Defer probe if gmux is present but its driver isn't
Date: Fri, 19 Feb 2016 00:11:23 +0100 [thread overview]
Message-ID: <CAKMK7uFT5fUmvAXFWFtUyj9=DMwhVB5msB84sgD1vetLEqKr6A@mail.gmail.com> (raw)
In-Reply-To: <20160218222041.GB19128@wunner.de>
On Thu, Feb 18, 2016 at 11:20 PM, Lukas Wunner <lukas@wunner.de> wrote:
> Hi,
>
> On Thu, Feb 18, 2016 at 10:39:05PM +0100, Daniel Vetter wrote:
>> On Thu, Feb 18, 2016 at 9:34 PM, Lukas Wunner <lukas@wunner.de> wrote:
>> >
>> >> Ok, makes sense. I still think adding the check to the client_register
>> >> function would be good, just as a safety measure.
>> >
>> > Hm, the idea of calling vga_switcheroo_client_probe_defer() twice
>> > causes me pain in the stomach. It's surprising for drivers which
>> > just don't need it at the moment (amdgpu and snd_hda_intel) and
>> > it feels like overengineering and pampering driver developers
>> > beyond reasonable measure. Also while the single existing check is
>> > cheap, we might later on add checks that take more time and slow
>> > things down.
>>
>> It's motivated by Rusty's API Manifesto:
>>
>> http://sweng.the-davies.net/Home/rustys-api-design-manifesto
>
> Interesting, thank you.
>
>
>> With the mandatory check in _register we reach level 5 - it'll blow up
>> at runtime when we try to register it.
>
> The manifesto says "5. Do it right or it will always break at runtime".
>
> However even if we add a WARN_ON(vga_switcheroo_client_probe_defer(pdev))
> to register_client(), it will not *always* spew a stacktrace but only on
> the machines this concerns (MacBook Pros). Since failure to defer breaks
> GPU switching, level 5 is already reached. Chances are this won't go
> unnoticed by the user.
If we fail the register hopefully the driver checks for that and might
blow up somewhere in untested error handling code. But there's a good
chance it'll fail (we can encourage that more by adding must_check to
the function declaration). In that case you get a nice bug report with
splat from users hitting this.
Without this it'll silently work, and all the reports you get is
"linux is shit, gpu switching doesn't work".
In both cases it can sometimes succeed, which is not great indeed. But
I'm trying to fix that by injection EDEFER points artificially
somehow. Not yet figured out that one.
But irrespective of the precise failure mode making the defer check
mandatory by just including it in _register() is better since it makes
it impossible to forget to call it when its needed. So imo clearly the
more robust API. And that's my metric for evaluating new API - how
easy/hard is it to abuse/get wrong.
>> For more context: We have tons of fun with EPROBE_DEFER handling
>> between i915 and snd-hda
>
> I don't understand, there is currently not a single occurrence of
> EPROBE_DEFER in i915, apart from the one I added.
>
> In sound/ there are 88 occurrences of EPROBE_DEFER in soc/, plus 1 in
> ppc/ and that's it. So not a single one in pci/hda/ where hda_intel.c
> resides.
>
> Is the fun with EPROBE_DEFER handling caused by the lack thereof?
Yes, there's one instance where i915 shoudl defer missing. The real
trouble is that snd-hda has some really close ties with i915, and
resolves those with probe-defer. And blows up all the time since we
started using this, and with hdmi/dp you really always have to test
both together in CI, snd-hda is pretty much a part of the intel gfx
driver nowadays. Deferred probing is ime real trouble.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-02-18 23:11 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-11 19:09 [PATCH v5 00/12] Enable GPU switching on pre-retina MacBook Pro Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 01/12] vga_switcheroo: Add handler flags infrastructure Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 09/12] apple-gmux: Add helper for presence detect Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 05/12] drm/edid: Switch DDC when reading the EDID Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 12/12] drm/radeon: Defer probe if gmux is present but its driver isn't Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 07/12] drm/nouveau: Switch DDC when reading the EDID Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 02/12] vga_switcheroo: Add support for switching only the DDC Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 03/12] apple-gmux: Track switch state Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 04/12] apple-gmux: Add switch_ddc support Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 10/12] drm/i915: Defer probe if gmux is present but its driver isn't Lukas Wunner
2016-02-09 9:04 ` Daniel Vetter
2016-02-14 12:10 ` Lukas Wunner
2016-02-14 12:46 ` Daniel Vetter
2016-02-16 15:58 ` Lukas Wunner
2016-02-16 16:08 ` Daniel Vetter
2016-02-18 20:34 ` Lukas Wunner
2016-02-18 21:39 ` Daniel Vetter
2016-02-18 22:20 ` Lukas Wunner
2016-02-18 23:11 ` Daniel Vetter [this message]
2016-02-18 23:53 ` Deucher, Alexander
2016-01-11 19:09 ` [PATCH v5 06/12] drm/i915: Switch DDC when reading the EDID Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 08/12] drm/radeon: " Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 11/12] drm/nouveau: Defer probe if gmux is present but its driver isn't Lukas Wunner
[not found] ` <cover.1452525860.git.lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2016-02-01 22:49 ` [PATCH v5 00/12] Enable GPU switching on pre-retina MacBook Pro Lukas Wunner
2016-02-02 1:10 ` Dave Airlie
2016-02-02 1:19 ` Dave Airlie
2016-02-02 15:03 ` Lukas Wunner
[not found] ` <20160201224944.GA12944-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2016-02-02 6:33 ` Pierre Moreau
2016-02-08 18:10 ` Darren Hart
[not found] ` <20160208181000.GL1779-Z5kFBHtJu+EzCVHREhWfF0EOCMrvLtNR@public.gmane.org>
2016-02-09 9:01 ` Daniel Vetter
[not found] ` <loom.20160304T170007-454@post.gmane.org>
2016-03-05 14:16 ` [Intel-gfx] [PATCH v5 00/12] Enable GPU switching on pre-retina?MacBook Pro Lukas Wunner
2016-03-05 16:31 ` Bastien Nocera
2016-03-09 23:30 ` Dave Airlie
2016-03-10 15:29 ` Bastien Nocera
2016-03-10 15:33 ` Bastien Nocera
2016-03-14 12:41 ` [Intel-gfx] " Lukas Wunner
2016-03-14 13:37 ` Bastien Nocera
2016-03-15 7:51 ` Daniel Vetter
2016-03-15 11:10 ` [Intel-gfx] " Dave Airlie
2016-03-15 11:55 ` Bastien Nocera
2016-04-05 16:59 ` Bastien Nocera
2016-04-05 17:43 ` Lukas Wunner
2016-03-05 17:28 ` [Intel-gfx] " Bastien Nocera
2016-03-05 18:10 ` Alex Deucher
2016-03-15 17:54 ` Lukas Wunner
2016-03-15 18:33 ` Alex Deucher
2016-03-15 20:41 ` Lukas Wunner
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='CAKMK7uFT5fUmvAXFWFtUyj9=DMwhVB5msB84sgD1vetLEqKr6A@mail.gmail.com' \
--to=daniel@ffwll.ch \
--cc=alexander.deucher@amd.com \
--cc=bskeggs@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=lukas@wunner.de \
--cc=platform-driver-x86@vger.kernel.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).