All of lore.kernel.org
 help / color / mirror / Atom feed
From: Serguei Sagalovitch <serguei.sagalovitch@amd.com>
To: "Christian König" <deathsimple@vodafone.de>,
	dri-devel@lists.freedesktop.org
Subject: Re: [RFC] drm/radeon: userfence IOCTL
Date: Mon, 13 Apr 2015 11:37:42 -0400	[thread overview]
Message-ID: <552BE2C6.4080700@amd.com> (raw)
In-Reply-To: <552BE228.3020207@vodafone.de>


[-- Attachment #1.1: Type: text/plain, Size: 3550 bytes --]

 >  Another alternative would be to use the userspace mapping to check 
the BO value
This is what I was thinking.

Sincerely yours,
Serguei Sagalovitch

On 15-04-13 11:35 AM, Christian König wrote:
> On 13.04.2015 17:25, Serguei Sagalovitch wrote:
>> > the BO to be kept in the same place while it is mapped inside the 
>> kernel page table
>> ...
>> > So this requires that we pin down the BO for the duration of the 
>> wait IOCTL.
>>
>> But my understanding is that it should be not duration of "wait" 
>> IOCTL but "duration" of command buffer execution.
>>
>> BTW: I would assume that this is not the new scenario.
>>
>>  This is scenario:
>>     - User allocate BO
>>     - User get CPU address for BO
>>     - User submit command buffer to write to BO
>>     - User could "poll" / "read" or "write" BO data by CPU
>>
>> So when  TTM needs  to move BO to another location it should also 
>> update CPU "mapping" correctly so user will always read / write the 
>> correct data.
>>
>> Did I miss anything?
>
> The problem is that kernel mappings are not updated when TTM moves the 
> buffer around. In the case of a swapped out buffer that wouldn't even 
> be possible cause kernel mappings aren't pageable.
>
> You just can't map the BO into kernel space unless you have it pinned 
> down, so you can't check the current value written in the BO in your 
> IOCTL.
>
> One alternative is to send all interrupts in question unfiltered to 
> user space and let userspace do the check if the right value was 
> written or not. But I assume that this would be rather bad for 
> performance.
>
> Another alternative would be to use the userspace mapping to check the 
> BO value, but this approach isn't compatible with a GPU scheduler. 
> E.g. you can't really do cross process space memory access in device 
> drivers.
>
> Regards,
> Christian.
>
>>
>>
>> Sincerely yours,
>> Serguei Sagalovitch
>>
>> On 15-04-13 10:52 AM, Christian König wrote:
>>> Hello everyone,
>>>
>>> we have a requirement for a bit different kind of fence handling. Currently we handle fences completely inside the kernel, but in the future we would like to emit multiple fences inside the same IB as well.
>>>
>>> This works by adding multiple fence commands into an IB which just write their value to a specific location inside a BO and trigger the appropriate hardware interrupt.
>>>
>>> The user part of the driver stack should then be able to call an IOCTL to wait for the interrupt and block for the value (or something larger) to be written to the specific location.
>>>
>>> This has the advantage that you can have multiple synchronization points in the same IB and don't need to split up your draw commands over several IBs so that the kernel can insert kernel fences in between.
>>>
>>> The following set of patches tries to implement exactly this IOCTL. The big problem with that IOCTL is that TTM needs the BO to be kept in the same place while it is mapped inside the kernel page table. So this requires that we pin down the BO for the duration of the wait IOCTL.
>>>
>>> This practically gives userspace a way of pinning down BOs for as long as it wants, without the ability for the kernel for intervention.
>>>
>>> Any ideas how to avoid those problems? Or better ideas how to handle the new requirements?
>>>
>>> Please note that the patches are only hacked together quick&dirty to demonstrate the problem and not very well tested.
>>>
>>> Best regards,
>>> Christian.
>>
>


[-- Attachment #1.2: Type: text/html, Size: 4806 bytes --]

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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2015-04-13 17:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13 14:52 [RFC] drm/radeon: userfence IOCTL Christian König
2015-04-13 14:52 ` [PATCH 1/3] drm/radeon: wait for BO move to finish on kmap Christian König
2015-04-13 14:52 ` [PATCH 2/3] drm/radeon: cleanup radeon_cs_get_ring Christian König
2015-04-13 14:52 ` [PATCH 3/3] drm/radeon: add userfence IOCTL Christian König
2015-04-13 17:23   ` Daniel Vetter
2015-04-13 17:51     ` Jerome Glisse
2015-04-13 18:26       ` Christian König
2015-04-13 19:48         ` Jerome Glisse
2015-04-14  8:17           ` Daniel Vetter
2015-04-13 17:27   ` Daniel Vetter
2015-04-13 15:25 ` [RFC] drm/radeon: " Serguei Sagalovitch
2015-04-13 15:35   ` Christian König
2015-04-13 15:37     ` Serguei Sagalovitch [this message]
2015-04-13 15:46     ` Jerome Glisse
2015-04-13 15:39   ` Jerome Glisse
2015-04-13 15:47     ` Christian König
2015-04-13 15:52     ` Serguei Sagalovitch
2015-04-13 16:13       ` Jerome Glisse
2015-04-13 15:31 ` Jerome Glisse
2015-04-13 15:45   ` Christian König
2015-04-13 16:08     ` Jerome Glisse
2015-04-13 16:55       ` Christian König
2015-04-13 17:46         ` Jerome Glisse

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=552BE2C6.4080700@amd.com \
    --to=serguei.sagalovitch@amd.com \
    --cc=deathsimple@vodafone.de \
    --cc=dri-devel@lists.freedesktop.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.