<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#333333" bgcolor="#FFFFFF">
> Given that the
userspace wait fence ioctl has not way to know which command
buffer it is really waiting after then kernel has no knowledge
of if this user fence will signal at all.
<br>
We could pass BO handle as parameter in the "fence ioctl" to rely
on it so kernel will know which BO it is waiting.<br>
<br>
<br>
> So a malicious user space (we always have to assume this thing
exist) could create
a big VRAM BO and effectively pin it in VRAM leading to a GPU
DOS (denial of service).
<br>
This problem always exists. Malicious user space could allocate big
BO and then submit shader running in loop which read/write from this
BO. It could also spawn processes which will do the same thing.
IMHO the only way to improve situation is to have GPU Scheduler to
allow "unloading" such application.<br>
<br>
Sincerely yours,<br>
Serguei Sagalovitch<br>
<br>
<div class="moz-cite-prefix">On 15-04-13 11:39 AM, Jerome Glisse
wrote:<br>
</div>
<blockquote cite="mid:20150413153935.GB29334@gmail.com" type="cite">
<pre wrap="">On Mon, Apr 13, 2015 at 11:25:30AM -0400, Serguei Sagalovitch wrote:
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">the BO to be kept in the same place while it is mapped inside the kernel
</pre>
</blockquote>
<pre wrap="">page table
...
</pre>
<blockquote type="cite">
<pre wrap="">So this requires that we pin down the BO for the duration of the wait
</pre>
</blockquote>
<pre wrap="">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?
</pre>
</blockquote>
<pre wrap="">
No this is how things works. But we want to avoid pinning buffer.
One use case for this userspace fence is i assume same BO same
user fence use accross several command buffer. Given that the
userspace wait fence ioctl has not way to know which command
buffer it is really waiting after then kernel has no knowledge
of if this user fence will signal at all. So a malicious user
space (we always have to assume this thing exist) could create
a big VRAM BO and effectively pin it in VRAM leading to a GPU
DOS (denial of service).
By the way Christian, i would add a timeout to this ioctl and
return eagain to userspace on timeout so that userspace can
resumit. That way a malicious userspace will just keep exhausting
its cpu timeslot.
Cheers,
Jérôme
</pre>
</blockquote>
<br>
</body>
</html>