Re: [RFC 3/3] drm/i915: Add the truncation logic for Stolen objects.

Gupta, Sourab
2014-03-05T19:24:38Z

Hi Chris,

We have assumed the following lifecycle of the (stolen)object, w.r.t the truncation usecase:

1) The user creates the (non-cpu mappable)object --> the gem object is created. Shmem filep is allocated. No backing storage present
2) GPU operations performed (after mmap_gtt ) --> object is moved to stolen memory and the backing pages are allocated from stolen mem area.
3) Object is marked as purgeable (by madvise_ioctl)--> here two scenarios can occur:
a) Object has not yet been processed by GPU. In this case it will be in the active list. So, madvise_ioctl will mark it as purgeable and return.
Subsequently, when the retire handler runs, and object is being moved to inactive list, then, the purgeable object is truncated and marked as purged.
b) Object is already processed by the GPU. In this case, it will be in the inactive list. So, madvise_ioctl will do the object truncation and mark it as purged.
4) If object is not marked as purgeable, the backing pages of the object will remain.
5) When object is freed, backing pages are released, if the object has not been purged already.

Is the object being in the inactive list, the necessary and sufficient condition of it not being in use?
We may be missing out on some condition regarding when the object will be in use.
Can you please point us to the flaws in above assumption regarding when we can truncate the object.

Thanks and Regards,
Sourab

-----Original Message-----
From: Chris Wilson [mailto:chris@chris-wilson.co.uk]
Sent: Wednesday, March 05, 2014 6:15 PM
To: Gupta, Sourab
Cc: intel-gfx@lists.freedesktop.org; Vetter, Daniel; Barnes, Jesse; Wilson, Chris; Goel, Akash
Subject: Re: [RFC 3/3] drm/i915: Add the truncation logic for Stolen objects.

On Wed, Mar 05, 2014 at 12:26:26PM +0000, Gupta, Sourab wrote:
> Hi Chris,
>
> Can you please through some light on the bug here, so that we're able to handle it.
> Is it about the handling required for the pread/pwrite ioctls, or is it about the format of mentioning the testcase?

You truncate the stolen region whilst it is still in use and then hand it out ot a new object. Rinse and repeat.
-Chris

--
Chris Wilson, Intel Open Source Technology Centre