From: Lukas Wunner <lukas@wunner.de>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
intel-gfx@lists.freedesktop.org, stable@vger.kernel.org
Subject: Re: [PATCH] drm/i915/fbdev: Serialise early hotplug events with async fbdev config
Date: Sun, 26 Nov 2017 12:49:19 +0100 [thread overview]
Message-ID: <20171126114919.GA10063@wunner.de> (raw)
In-Reply-To: <20171125194155.355-1-chris@chris-wilson.co.uk>
On Sat, Nov 25, 2017 at 07:41:55PM +0000, Chris Wilson wrote:
> @@ -697,10 +697,8 @@ static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
>
> /* Due to peculiar init order wrt to hpd handling this is separate. */
> if (drm_fb_helper_initial_config(&ifbdev->helper,
> - ifbdev->preferred_bpp)) {
> + ifbdev->preferred_bpp))
> intel_fbdev_unregister(to_i915(ifbdev->helper.dev));
> - intel_fbdev_fini(to_i915(ifbdev->helper.dev));
> - }
> }
Hm, the race at hand would be solved by the intel_fbdev_sync() below,
or am I missing something? Still wondering why it's necessary to
leave the fbdev around...
> @@ -800,7 +798,11 @@ void intel_fbdev_output_poll_changed(struct drm_device *dev)
> {
> struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;
>
> - if (ifbdev)
> + if (!ifbdev)
> + return;
> +
> + intel_fbdev_sync(ifbdev);
> + if (ifbdev->vma)
> drm_fb_helper_hotplug_event(&ifbdev->helper);
> }
This hunk looks good, as you note the synchronization was already there
but had to be reverted because I failed to notice that a "+ 1" needs to
be added to the cookie. You did a much better job than me understanding
how the async API works with 43cee314345a.
However the "if (ifbdev->vma)" looks a bit fishy, ifbdev could be NULL
(e.g. if BIOS fb was too small but intelfb_alloc() failed) so I think
this might lead to a null pointer deref. Does it make a difference
if we check for ifbdev versus ifbdev->vma? I also notice that you
added a check for ifbdev->vma with 15727ed0d944 but Daniel later
removed it with 88be58be886f.
I guess a check *is* necessary here because fbdev initialization might
have failed, but I'd just check for "if (ifbdev)".
Thanks & have a pleasant Sunday afternoon.
Lukas
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Lukas Wunner <lukas@wunner.de>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
stable@vger.kernel.org
Subject: Re: [PATCH] drm/i915/fbdev: Serialise early hotplug events with async fbdev config
Date: Sun, 26 Nov 2017 12:49:19 +0100 [thread overview]
Message-ID: <20171126114919.GA10063@wunner.de> (raw)
In-Reply-To: <20171125194155.355-1-chris@chris-wilson.co.uk>
On Sat, Nov 25, 2017 at 07:41:55PM +0000, Chris Wilson wrote:
> @@ -697,10 +697,8 @@ static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
>
> /* Due to peculiar init order wrt to hpd handling this is separate. */
> if (drm_fb_helper_initial_config(&ifbdev->helper,
> - ifbdev->preferred_bpp)) {
> + ifbdev->preferred_bpp))
> intel_fbdev_unregister(to_i915(ifbdev->helper.dev));
> - intel_fbdev_fini(to_i915(ifbdev->helper.dev));
> - }
> }
Hm, the race at hand would be solved by the intel_fbdev_sync() below,
or am I missing something? Still wondering why it's necessary to
leave the fbdev around...
> @@ -800,7 +798,11 @@ void intel_fbdev_output_poll_changed(struct drm_device *dev)
> {
> struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;
>
> - if (ifbdev)
> + if (!ifbdev)
> + return;
> +
> + intel_fbdev_sync(ifbdev);
> + if (ifbdev->vma)
> drm_fb_helper_hotplug_event(&ifbdev->helper);
> }
This hunk looks good, as you note the synchronization was already there
but had to be reverted because I failed to notice that a "+ 1" needs to
be added to the cookie. You did a much better job than me understanding
how the async API works with 43cee314345a.
However the "if (ifbdev->vma)" looks a bit fishy, ifbdev could be NULL
(e.g. if BIOS fb was too small but intelfb_alloc() failed) so I think
this might lead to a null pointer deref. Does it make a difference
if we check for ifbdev versus ifbdev->vma? I also notice that you
added a check for ifbdev->vma with 15727ed0d944 but Daniel later
removed it with 88be58be886f.
I guess a check *is* necessary here because fbdev initialization might
have failed, but I'd just check for "if (ifbdev)".
Thanks & have a pleasant Sunday afternoon.
Lukas
next prev parent reply other threads:[~2017-11-26 11:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-25 19:41 [PATCH] drm/i915/fbdev: Serialise early hotplug events with async fbdev config Chris Wilson
2017-11-25 20:21 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-11-25 21:03 ` [PATCH] " Lukas Wunner
2017-11-26 9:43 ` Chris Wilson
2017-11-25 21:34 ` ✓ Fi.CI.IGT: success for " Patchwork
2017-11-26 11:49 ` Lukas Wunner [this message]
2017-11-26 11:49 ` [PATCH] " Lukas Wunner
2017-11-26 11:58 ` Chris Wilson
2017-11-26 12:15 ` Lukas Wunner
2017-11-26 12:20 ` Lukas Wunner
2017-11-26 12:20 ` Lukas Wunner
2017-11-26 12:48 ` Chris Wilson
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=20171126114919.GA10063@wunner.de \
--to=lukas@wunner.de \
--cc=chris@chris-wilson.co.uk \
--cc=daniel.vetter@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.