mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@kernel.org>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>,
	dri-devel@lists.freedesktop.org,
	 Eric Auger <eric.auger@redhat.com>,
	David Airlie <airlied@redhat.com>,
	 Gurchetan Singh <gurchetansingh@chromium.org>,
	Chia-I Wu <olvaffe@gmail.com>,
	 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	 Simona Vetter <simona@ffwll.ch>,
	"open list:VIRTIO GPU DRIVER" <virtualization@lists.linux.dev>,
	 open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/virtio: implement virtio_gpu_shutdown
Date: Mon, 19 May 2025 10:43:27 +0200	[thread overview]
Message-ID: <20250519-crazy-wisteria-mule-ef8e28@houat> (raw)
In-Reply-To: <20250518175332-mutt-send-email-mst@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 2052 bytes --]

On Sun, May 18, 2025 at 05:53:59PM -0400, Michael S. Tsirkin wrote:
> On Tue, May 13, 2025 at 12:18:44PM +0200, Gerd Hoffmann wrote:
> > > > diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c
> > > > index e32e680c7197..71c6ccad4b99 100644
> > > > --- a/drivers/gpu/drm/virtio/virtgpu_drv.c
> > > > +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
> > > > @@ -130,10 +130,10 @@ static void virtio_gpu_remove(struct virtio_device *vdev)
> > > >  
> > > >  static void virtio_gpu_shutdown(struct virtio_device *vdev)
> > > >  {
> > > > -	/*
> > > > -	 * drm does its own synchronization on shutdown.
> > > > -	 * Do nothing here, opt out of device reset.
> > > > -	 */
> > > > +	struct drm_device *dev = vdev->priv;
> > > > +
> > > > +	/* stop talking to the device */
> > > > +	drm_dev_unplug(dev);
> > > 
> > > I'm not necessarily opposed to using drm_dev_unplug() here, but it's
> > > still pretty surprising to me. It's typically used in remove, not
> > > shutdown. The typical helper to use at shutdown is
> > > drm_atomic_helper_shutdown.
> > > 
> > > So if the latter isn't enough or wrong, we should at least document why.
> > 
> > The intention of this is to make sure the driver stops talking to the
> > device (as the comment already says).
> > 
> > There are checks in place in the virt queue functions which will make
> > sure the driver will not try place new requests in the queues after
> > drm_dev_unplug() has been called.  Which why I decided to implement it
> > that way.
> > 
> > drm_atomic_helper_shutdown() tears down all outputs according to the
> > documentation.  Which is something different.  I don't think calling
> > drm_atomic_helper_shutdown() will do what I need here.  Calling it in
> > addition to drm_dev_unplug() might make sense, not sure.
> > 
> > Suggestions are welcome.
> > 
> > take care,
> >   Gerd
> 
> 
> I suggest adding comments in code explaining why it's approriate here.
> Want to try?

Yes, that would be great

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

  reply	other threads:[~2025-05-19  8:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-07  8:28 Gerd Hoffmann
2025-05-10  9:59 ` Maxime Ripard
2025-05-13 10:18   ` Gerd Hoffmann
2025-05-18 21:53     ` Michael S. Tsirkin
2025-05-19  8:43       ` Maxime Ripard [this message]
2025-05-26 15:48 ` Dmitry Osipenko

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=20250519-crazy-wisteria-mule-ef8e28@houat \
    --to=mripard@kernel.org \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eric.auger@redhat.com \
    --cc=gurchetansingh@chromium.org \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mst@redhat.com \
    --cc=olvaffe@gmail.com \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=virtualization@lists.linux.dev \
    /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

all inboxes | Powered by JetHome®