All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Wu <peter@lekensteyn.nl>
To: Fubo Chen <fubo.chen@gmail.com>
Cc: airlied@redhat.com, kraxel@redhat.com,
	alan.christopher.jenkins@gmail.com,
	virtualization@lists.linux-foundation.org,
	dri-devel@lists.freedesktop.org,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] qxl: fix null-pointer crash during suspend
Date: Mon, 1 Oct 2018 22:33:22 +0200	[thread overview]
Message-ID: <20181001203322.GA13696@al> (raw)
In-Reply-To: <CAJAFBLBhAjEtoCegy7QzG65PoxM-DZA2xki9SwfrZ6af=0fvUQ@mail.gmail.com>

On Mon, Oct 01, 2018 at 01:13:59PM -0700, Fubo Chen wrote:
> On Tue, Sep 4, 2018 at 2:10 PM Peter Wu <peter@lekensteyn.nl> wrote:
> >
> > "crtc->helper_private" is not initialized by the QXL driver and thus the
> > "crtc_funcs->disable" call would crash (resulting in suspend failure).
> > Fix this by converting the suspend/resume functions to use the
> > drm_mode_config_helper_* helpers.
> >
> > Tested system sleep with QEMU 3.0 using "echo mem > /sys/power/state".
> > During suspend the following message is visible from QEMU:
> >
> >     spice/server/display-channel.c:2425:display_channel_validate_surface: canvas address is 0x7fd05da68308 for 0 (and is NULL)
> >     spice/server/display-channel.c:2426:display_channel_validate_surface: failed on 0
> >
> > This seems to be triggered by QXL_IO_NOTIFY_CMD after
> > QXL_IO_DESTROY_PRIMARY_ASYNC, but aside from the warning things still
> > seem to work (tested with both the GTK and -spice options).
> >
> > Signed-off-by: Peter Wu <peter@lekensteyn.nl>
> 
> Is this a new issue or something that was introduced a long time ago?
> In the latter case, please consider adding a "Cc:
> <stable@vger.kernel.org>" tag to this patch.

I am not sure exactly when the issue was introduced, but the original
code was added in v3.10-rc7-800-gd84300bf7934 while the new
drm_mode_config_helper_suspend API was added in 4.16.

The intended call chain to initialize the private object seems to be:
drm_crtc_helper_add
<- qdev_crtc_init
<- qxl_modeset_init
<- qxl_pci_probe

If any error occurs along the callchain, then the helper_private pointer
will remain NULL. Or if the crtc is obtained in a different way (not
sure how).

Not sure if it is worth backporting, suspend/resume does not seem an
important use case for VMs using QXL and the fix was not validated for
older kernels.
-- 
Kind regards,
Peter Wu
https://lekensteyn.nl

  reply	other threads:[~2018-10-01 20:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-04 20:27 [PATCH] qxl: fix null-pointer crash during suspend Peter Wu
2018-09-04 20:27 ` Peter Wu
2018-10-01 20:13 ` Fubo Chen
2018-10-01 20:33   ` Peter Wu [this message]
2018-10-02  8:14 ` Daniel Vetter
2018-10-02  8:14 ` Daniel Vetter
2018-10-02 10:05   ` Laurent Pinchart
2018-10-02 10:05     ` Laurent Pinchart
2018-10-02 10:05   ` Laurent Pinchart

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=20181001203322.GA13696@al \
    --to=peter@lekensteyn.nl \
    --cc=airlied@redhat.com \
    --cc=alan.christopher.jenkins@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fubo.chen@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.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.