public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Oleksandr Andrushchenko <andr2000@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>,
	xen-devel@lists.xenproject.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Dave Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel.vetter@intel.com>,
	Sean Paul <seanpaul@chromium.org>,
	Gustavo Padovan <gustavo@padovan.org>,
	Juergen Gross <jgross@suse.com>,
	boris.ostrovsky@oracle.com,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	"Oleksandr_Andrushchenko@epam.com"
	<Oleksandr_Andrushchenko@epam.com>
Subject: Re: [PATCH RESEND v2 1/2] drm/xen-front: Add support for Xen PV display frontend
Date: Tue, 20 Mar 2018 14:47:16 +0100	[thread overview]
Message-ID: <20180320134715.GT14155@phenom.ffwll.local> (raw)
In-Reply-To: <7c4e0f8f-9ec0-e38b-7b37-264241df4ba5@gmail.com>

On Tue, Mar 20, 2018 at 01:58:01PM +0200, Oleksandr Andrushchenko wrote:
> On 03/19/2018 05:28 PM, Daniel Vetter wrote:
> > There should be no difference between immediate removal and delayed
> > removal of the drm_device from the xenbus pov. The lifetimes of the
> > front-end (drm_device) and backend (the xen bus thing) are entirely
> > decoupled:
> Well, they are not decoupled for simplicity of handling,
> please see below
> > 
> > So for case 2 you only have 1 case:
> > 
> > - drm_dev_unplug
> > - tear down the entire xenbus backend completely
> > - all xenbus access will be caught with drm_dev_entre/exit (well right
> > now drm_dev_is_unplugged) checks, including any access to your private
> > drm_device data
> > - once drm_device->open_count == 0 the core will tear down the
> > drm_device instance and call your optional drm_driver->release
> > callback.
> > 
> > So past drm_dev_unplug the drm_device is in zombie state and the only
> > thing that will happen is a) it rejects all ioctls and anything else
> > userspace might ask it to do and b) gets releases once the last
> > userspace reference is gone.
> I have re-worked the driver with this in mind [1]
> So, I now use drm_dev_unplug and destroy the DRM device
> on drm_driver.release.
> In context of unplug work I also merged xen_drm_front_drv.c and
> xen_drm_front.c as these are too coupled together now.
> 
> Could you please take a look and tell me if this is what you mean?
> > 
> > If the backend comes up again, you create a _new_ drm_device instance
> > (while the other one is still in the process of eventually getting
> > released).
> We only have a single xenbus instance, so this way I'll need
> to handle list of such zombies. For that reason I prefer to
> wait until the DRM device is destroyed, telling the backend
> to hold on until then (via going into XenbusStateReconfiguring state).

Why exactly do you need to keep track of your drm_devices from the xenbus?
Once unplugged, there should be no connection with the "hw" for your
device, in neither direction. Maybe I need to look again, but this still
smells funny and not like something you should ever do.

> Another drawback of such approach is that I'll have different
> minors at run-time, e.g. card0, card1, etc.
> For software which has /dev/dri/card0 hardcoded it may be a problem.
> But this is minor, IMO

Fix userspace :-)

But yeah unlikely this is a problem, hotplugging is fairly old thing.

> > In short, your driver code should never have a need to look at
> > drm_device->open_count. I hope this explains it a bit better.
> > -Daniel
> > 
> Yes, you are correct: at [1] I am not touching drm_device->open_count
> anymore and everything just happens synchronously

> [1] https://github.com/andr2000/linux/commits/drm_tip_pv_drm_v3

Please just resend, makes it easier to comment inline.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2018-03-20 13:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13 16:21 [PATCH RESEND v2 0/2] drm/xen-front: Add support for Xen PV display frontend Oleksandr Andrushchenko
2018-03-13 16:21 ` [PATCH RESEND v2 1/2] " Oleksandr Andrushchenko
2018-03-14  0:09   ` kbuild test robot
2018-03-14  0:09   ` [RFC PATCH] drm/xen-front: xen_drm_front_platform_info can be static kbuild test robot
2018-03-16  8:23   ` [PATCH RESEND v2 1/2] drm/xen-front: Add support for Xen PV display frontend Daniel Vetter
2018-03-16 10:52     ` Oleksandr Andrushchenko
2018-03-19 13:51       ` Daniel Vetter
2018-03-19 14:19         ` Oleksandr Andrushchenko
2018-03-19 15:28           ` Daniel Vetter
2018-03-20 11:58             ` Oleksandr Andrushchenko
2018-03-20 13:47               ` Daniel Vetter [this message]
2018-03-21  8:37                 ` Oleksandr Andrushchenko
2018-03-13 16:21 ` [PATCH RESEND v2 2/2] drm/xen-front: Provide kernel documentation Oleksandr Andrushchenko
2018-03-19 23:23 ` [PATCH RESEND v2 0/2] drm/xen-front: Add support for Xen PV display frontend Boris Ostrovsky
2018-03-20  6:32   ` Oleksandr Andrushchenko

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=20180320134715.GT14155@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=Oleksandr_Andrushchenko@epam.com \
    --cc=airlied@linux.ie \
    --cc=andr2000@gmail.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo@padovan.org \
    --cc=jgross@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seanpaul@chromium.org \
    --cc=xen-devel@lists.xenproject.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