All of lore.kernel.org
 help / color / mirror / Atom feed
From: Francisco Jerez <currojerez-sGOZH3hwPm2sTnJN9+BGXg@public.gmane.org>
To: Luca Barbieri <luca-Ukmtq+NC3rhBHFWNQifrYwC/G2K4zDHf@public.gmane.org>
Cc: "airlied-cv59FeDIM0c@public.gmane.org"
	<airlied-cv59FeDIM0c@public.gmane.org>,
	"nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	Thomas Hellstrom
	<thellstrom-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>,
	"dri-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org"
	<dri-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	Thomas Hellstrom <thomas-4+hqylr40dJg9hUCZPvPmw@public.gmane.org>
Subject: Re: [PATCH] drm/ttm: Fix race condition in ttm_bo_delayed_delete
Date: Thu, 21 Jan 2010 15:07:55 +0100	[thread overview]
Message-ID: <87vdeveekk.fsf@riseup.net> (raw)
In-Reply-To: <ff13bc9a1001210540t7dc2b7a7p38359ca82b8b3eb4-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> (Luca Barbieri's message of "Thu, 21 Jan 2010 14:40:42 +0100")


[-- Attachment #1.1.1: Type: text/plain, Size: 3292 bytes --]

Luca Barbieri <luca-Ukmtq+NC3rhBHFWNQifrYwC/G2K4zDHf@public.gmane.org> writes:

>> At a first glance:
>>
>> 1) We probably *will* need a delayed destroyed workqueue to avoid wasting
>> memory that otherwise should be freed to the system. At the very least, the
>> delayed delete process should optionally be run by a system shrinker.
> You are right. For VRAM we don't care since we are the only user,
> while for system backed memory some delayed destruction will be
> needed.
> The logical extension of the scheme would be for the Linux page
> allocator/swapper to check for TTM buffers to destroy when it would
> otherwise shrink caches, try to swap and/or wait on swap to happen.
> Not sure whether there are existing hooks for this or where exactly to
> hook this code.
>
>> 2) Fences in TTM are currently not necessarily strictly ordered, and
>> sequence numbers are hidden from the bo code. This means, for a given FIFO,
>> fence sequence 3 may expire before fence sequence 2, depending on the usage
>> of the buffer.
>
> My definition of "channel" (I sometimes used FIFO incorrectly as a
> synonym of that) is exactly a set of fences that are strictly ordered.
> If the card has multiple HW engines, each is considered a different
> channel (so that a channel becomes a (fifo, engine) pair).
>
> We may need however to add the concept of a "sync domain" that would
> be a set of channels that support on-GPU synchronization against each
> other.
> This would model hardware where channels with the same FIFO can be
> synchronized together but those with different FIFOs don't, and also
> multi-core GPUs where synchronization might be available only inside
> each core and not across cores.
>
> To sum it up, a GPU consists of a set of sync domains, each consisting
> of a set of channels, each consisting of a sequence of fences, with
> the following rules:
> 1. Fences within the same channel expire in order
> 2. If channels A and B belong to the same sync domain, it's possible
> to emit a fence on A that is guaranteed to expire after an arbitrary
> fence of B
>
> Whether channels have the same FIFO or not is essentially a driver
> implementation detail, and what TTM cares about is if they are in the
> same sync domain.
>
> [I just made up "sync domain" here: is there a standard term?]
>
> This assumes that the "synchronizability" graph is a disjoint union of
> complete graphs. Is there any example where it is not so?
> Also, does this actually model correctly Poulsbo, or am I wrong?
>
> Note that we could use CPU mediation more than we currently do.
> For instance now Nouveau, to do inter-channel synchronization, simply
> waits on the fence with the CPU immediately synchronously, while it
> could instead queue the commands in software, and with an
> interrupt/delayed mechanism submit them to hardware once the fence to
> be waited for is expired.

Nvidia cards have a synchronization primitive that could be used to
synchronize several FIFOs in hardware (AKA semaphores, see [1] for an
example).

> _______________________________________________
> Nouveau mailing list
> Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> http://lists.freedesktop.org/mailman/listinfo/nouveau

[1] http://lists.freedesktop.org/archives/nouveau/2009-December/004514.html

[-- Attachment #1.2: Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 181 bytes --]

_______________________________________________
Nouveau mailing list
Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

  parent reply	other threads:[~2010-01-21 14:07 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-18 18:47 [PATCH] drm/ttm: Fix race condition in ttm_bo_delayed_delete Luca Barbieri
2010-01-18 19:40 ` Thomas Hellstrom
     [not found]   ` <4B54B949.9010906-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
2010-01-18 22:33     ` Luca Barbieri
     [not found]       ` <ff13bc9a1001181433v1694e681l9f7ce9d880132dc3-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-20 11:28         ` Thomas Hellstrom
     [not found]           ` <4B56E8EE.8090706-4+hqylr40dJg9hUCZPvPmw@public.gmane.org>
2010-01-20 12:11             ` Thomas Hellstrom
2010-01-20 12:11               ` Thomas Hellstrom
     [not found]               ` <4B56F308.5090603-4+hqylr40dJg9hUCZPvPmw@public.gmane.org>
2010-01-20 12:16                 ` Thomas Hellstrom
2010-01-20 12:16                   ` Thomas Hellstrom
     [not found]                   ` <4B56F401.8070700-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
2010-01-20 19:22                     ` Luca Barbieri
     [not found]                       ` <ff13bc9a1001201122y110fb003k704bc6d05d2aea07-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-20 20:16                         ` Thomas Hellstrom
     [not found]                           ` <4B5764BA.7080801-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
2010-01-20 20:45                             ` Luca Barbieri
     [not found]                               ` <ff13bc9a1001201245g6ee25219q851b7989968f4c7b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-20 20:58                                 ` Luca Barbieri
     [not found]                                   ` <ff13bc9a1001201258i37ee7354gb305aa98afae3716-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-20 21:11                                     ` Thomas Hellstrom
2010-01-20 21:04                                 ` Thomas Hellstrom
     [not found]                                   ` <4B576FF5.9040907-4+hqylr40dJg9hUCZPvPmw@public.gmane.org>
2010-01-21  3:49                                     ` Luca Barbieri
     [not found]                                       ` <ff13bc9a1001201949l4691f202v2a2874b9cef86f37-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-21 12:29                                         ` Jerome Glisse
     [not found]                                           ` <20100121122920.GB3837-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-01-21 12:59                                             ` Thomas Hellstrom
     [not found]                                               ` <4B584FAE.8040801-4+hqylr40dJg9hUCZPvPmw@public.gmane.org>
2010-01-25  8:14                                                 ` Jerome Glisse
     [not found]                                                   ` <20100125081444.GA23124-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-01-25 20:51                                                     ` Thomas Hellstrom
2010-01-21 15:14                                             ` Luca Barbieri
     [not found]                                               ` <ff13bc9a1001210714m34c3976etc7680f056cb55453-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-25  8:20                                                 ` Jerome Glisse
2010-01-21 12:53                                         ` Thomas Hellstrom
     [not found]                                           ` <4B584E48.8020806-4+hqylr40dJg9hUCZPvPmw@public.gmane.org>
2010-01-21 13:40                                             ` Luca Barbieri
     [not found]                                               ` <ff13bc9a1001210540t7dc2b7a7p38359ca82b8b3eb4-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-21 14:07                                                 ` Francisco Jerez [this message]
     [not found]                                                   ` <87vdeveekk.fsf-sGOZH3hwPm2sTnJN9+BGXg@public.gmane.org>
2010-01-21 14:17                                                     ` Luca Barbieri
     [not found]                                                       ` <ff13bc9a1001210617qe37ab7at949d545216693608-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-21 14:44                                                         ` Francisco Jerez
     [not found]                                                           ` <87pr53ecwd.fsf-sGOZH3hwPm2sTnJN9+BGXg@public.gmane.org>
2010-01-21 15:36                                                             ` Luca Barbieri
     [not found]                                                               ` <ff13bc9a1001210736k71740417r7b129c70374fece3-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-21 16:18                                                                 ` Francisco Jerez
     [not found]                                                                   ` <87y6jrbfef.fsf-sGOZH3hwPm2sTnJN9+BGXg@public.gmane.org>
2010-01-21 16:30                                                                     ` Luca Barbieri
     [not found]                                                                       ` <ff13bc9a1001210830g2653f672r918f8cb90cbf6170-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-21 17:39                                                                         ` Francisco Jerez
2010-01-21 15:39                                                             ` Maarten Maathuis
     [not found]                                                               ` <6d4bc9fc1001210739r2bb8b4c4i18590376a1628d82-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-21 15:56                                                                 ` Luca Barbieri
     [not found]                                                                   ` <ff13bc9a1001210756r1e627146w89fb2138ca77e6b5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-21 16:02                                                                     ` Maarten Maathuis
2010-01-21 14:23                                                 ` Thomas Hellstrom

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=87vdeveekk.fsf@riseup.net \
    --to=currojerez-sgozh3hwpm2stnjn9+bgxg@public.gmane.org \
    --cc=airlied-cv59FeDIM0c@public.gmane.org \
    --cc=dri-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=luca-Ukmtq+NC3rhBHFWNQifrYwC/G2K4zDHf@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=thellstrom-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org \
    --cc=thomas-4+hqylr40dJg9hUCZPvPmw@public.gmane.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.