dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Qiang Yu <yuq825@gmail.com>
Cc: Simon Shields <simon@lineageos.org>, Marek Vasut <marex@denx.de>,
	Connor Abbott <cwabbott0@gmail.com>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Andrei Paulau <7134956@gmail.com>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Vasily Khoruzhick <anarsoul@gmail.com>,
	Erico Nunes <nunes.erico@gmail.com>
Subject: Re: [PATCH RFC 05/24] Revert "drm: Nerf the preclose callback for modern drivers"
Date: Wed, 23 May 2018 22:31:02 +0200	[thread overview]
Message-ID: <CAKMK7uFW70KFkUHYWkWrB_WaE2ivnnPxcoS298vMGSA_ECkdaQ@mail.gmail.com> (raw)
In-Reply-To: <CAKGbVbvhJuQEND1zhsqrpm6GZUyZBiuaHTTL8==OyR_nP4kmyg@mail.gmail.com>

On Wed, May 23, 2018 at 2:59 PM, Qiang Yu <yuq825@gmail.com> wrote:
> On Wed, May 23, 2018 at 5:04 PM, Daniel Vetter <daniel@ffwll.ch> wrote:
>> On Tue, May 22, 2018 at 09:04:17AM +0800, Qiang Yu wrote:
>>> On Tue, May 22, 2018 at 3:37 AM, Eric Anholt <eric@anholt.net> wrote:
>>> > Qiang Yu <yuq825@gmail.com> writes:
>>> >
>>> >> This reverts commit 45c3d213a400c952ab7119f394c5293bb6877e6b.
>>> >>
>>> >> lima driver need preclose to wait all task in the context
>>> >> created within closing file to finish before free all the
>>> >> buffer object. Otherwise pending tesk may fail and get
>>> >> noisy MMU fault message.
>>> >>
>>> >> Move this wait to each buffer object free function can
>>> >> achieve the same result but some buffer object is shared
>>> >> with other file context, but we only want to wait the
>>> >> closing file context's tasks. So the implementation is
>>> >> not that straight forword compared to the preclose one.
>>> >
>>> > You should just separate your MMU structures from drm_file, and have
>>> > drm_file and the jobs using it keep a reference on them.  This is what
>>> > I've done in V3D as well.
>>>
>>> It's not the VM/MMU struct that causes this problem, it's each buffer
>>> object that gets freed before task is done (postclose is after buffer free).
>>> If you mean I should keep reference of all buffers for tasks, that's not
>>> as simple as just waiting task done before free buffers.
>>
>> Why can't you do that waiting in the postclose hook? If it's the lack of
>> reference-counting in your driver for gem bo, then I'd say you need to
>> roll out some reference counting. Relying on the implicit reference
>> provided by the core is kinda not so great (which was the reason I've
>> thrown out the preclose hook). There's also per-bo open/close hooks.
>
> It's possible to not use preclose, but the implementation is not as simple
> and straight forward as the preclose I think. There're two method I can
> think of:
> 1. do wait when free buffers callback unmap buffer from this process's
>     lima VM (wait buffer reservation object), this is fine and simple, but
>     there's case that this buffer is shared between two processes, so the
>     best way should be only waiting fences from this process, so we'd
>     better do some record for fences for a "perfect waiting"
> 2. keep a reference of involved buffers for a task, unreference it when
>     task done, also keep a reference of the buffer mapping in this process's
>     lima VM (this is more complicated to implement)
>
> But if there's a preclose, just wait all this process's task done, then
> unmap/free buffers, it's simple and straight forward. I'd like to hear if
> there's other better way for only use postclose.

Refcount your buffers. Borrowing references from other places tends to
result in a maintenance headache with no end. So solution 2.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-05-23 20:31 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-19  6:52 [PATCH RFC 00/24] Lima DRM driver Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 01/24] ARM: dts: add gpu node to exynos4 Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 02/24] dt-bindings: add switch-delay property for mali-utgard Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 03/24] arm64/dts: add switch-delay for meson mali Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 04/24] " Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 05/24] Revert "drm: Nerf the preclose callback for modern drivers" Qiang Yu
2018-05-21 19:37   ` Eric Anholt
2018-05-22  1:04     ` Qiang Yu
2018-05-23  9:04       ` Daniel Vetter
2018-05-23 12:59         ` Qiang Yu
2018-05-23 20:31           ` Daniel Vetter [this message]
2018-05-24  1:18             ` Qiang Yu
2018-05-24  7:51               ` Daniel Vetter
2018-05-24  8:55                 ` Qiang Yu
2018-05-30 18:13                   ` Eric Anholt
2018-05-31 14:04                     ` Qiang Yu
2018-05-31 17:51                       ` Eric Anholt
2018-05-31 18:04                         ` Keith Packard
2018-06-01  2:03                           ` Qiang Yu
2018-06-01  1:58                         ` Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 06/24] drm/lima: add lima uapi header Qiang Yu
2018-05-21 19:51   ` Eric Anholt
2018-05-22  1:33     ` Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 07/24] drm/lima: add mali 4xx GPU hardware regs Qiang Yu
2018-05-19 11:20   ` Marek Vasut
2018-05-19  6:52 ` [PATCH RFC 08/24] drm/lima: add lima core driver Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 09/24] drm/lima: add GPU device functions Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 10/24] drm/lima: add PMU related functions Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 11/24] drm/lima: add L2 cache functions Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 12/24] drm/lima: add GP related functions Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 13/24] drm/lima: add PP " Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 14/24] drm/lima: add MMU " Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 15/24] drm/lima: add BCAST related function Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 16/24] drm/lima: add DLBU related functions Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 17/24] drm/lima: add GPU virtual memory space handing Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 18/24] drm/lima: add TTM subsystem functions Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 19/24] drm/lima: add buffer object functions Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 20/24] drm/lima: add GEM related functions Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 21/24] drm/lima: add GEM Prime " Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 22/24] drm/lima: add GPU schedule using DRM_SCHED Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 23/24] drm/lima: add context related functions Qiang Yu
2018-05-19  6:52 ` [PATCH RFC 24/24] drm/lima: add makefile and kconfig Qiang Yu
  -- strict thread matches above, loose matches on Subject: below --
2018-05-18  9:27 [PATCH RFC 00/24] Lima DRM driver Qiang Yu
2018-05-18  9:27 ` [PATCH RFC 05/24] Revert "drm: Nerf the preclose callback for modern drivers" Qiang Yu
2018-05-23  9:35   ` Christian König
2018-05-23 13:13     ` Qiang Yu
2018-05-23 13:41       ` Christian König
2018-05-24  1:38         ` Qiang Yu
2018-05-24  6:46           ` Christian König
2018-05-24  9:24             ` Qiang Yu
2018-05-24  9:41               ` Christian König
2018-05-24 12:54                 ` Qiang Yu

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=CAKMK7uFW70KFkUHYWkWrB_WaE2ivnnPxcoS298vMGSA_ECkdaQ@mail.gmail.com \
    --to=daniel@ffwll.ch \
    --cc=7134956@gmail.com \
    --cc=anarsoul@gmail.com \
    --cc=cwabbott0@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=marex@denx.de \
    --cc=narmstrong@baylibre.com \
    --cc=nunes.erico@gmail.com \
    --cc=simon@lineageos.org \
    --cc=yuq825@gmail.com \
    /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).