<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Am 03.08.2018 um 16:54 schrieb Andrey
Grodzovsky:<br>
</div>
<blockquote type="cite"
cite="mid:e1cd09f1-287e-ab42-243a-133e67a4f3b2@amd.com">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<p>[SNIP] </p>
<blockquote type="cite"
cite="mid:0a7c28f9-e60e-74de-1c48-0089935bc4f7@amd.com">
<blockquote type="cite"
cite="mid:5d3ec8da-db2e-0aa2-0a7c-a55f27b27a04@amd.com"> <br>
<blockquote type="cite"
cite="mid:CAFd4ddwKJvfrTu5uAub1K517DhdcOZbZ8k=gyzPy6GVqx_PhtA@mail.gmail.com">
<div dir="ltr">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"> <br>
><br>
> Second of all, even after we removed the entity
from rq in <br>
> drm_sched_entity_flush to terminate any
subsequent submissions<br>
><br>
> to the queue the other thread doing push job can
just acquire again a <br>
> run queue<br>
><br>
> from drm_sched_entity_get_free_sched and continue
submission<br>
<br>
</blockquote>
<div>Hi Christian <br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
That is actually desired.<br>
<br>
When another process is now using the entity to submit
jobs adding it <br>
back to the rq is actually the right thing to do cause
the entity is <br>
still in use.<br>
</blockquote>
</div>
</div>
</blockquote>
<br>
Yes, no problem if it's another process. But what about
another thread from same process ? Is it a possible use case
that 2 threads from same process submit to same entity
concurrently ? If so and we specifically kill one, the other
will not stop event if we want him to because current code
makes him just require a rq for him self.<br>
</blockquote>
<br>
Well you can't kill a single thread of a process (you can only
interrupt it), a SIGKILL will always kill the whole process.<br>
</blockquote>
<br>
Is the following scenario possible and acceptable ? <br>
2 threads from same process working on same queue where thread A
currently in drm_sched_entity_flush->wait_event_timeout (the
process getting shut down because of SIGKILL sent by user)<br>
while thread B still inside drm_sched_entity_push_job before 'if
(reschedule)'. 'A' stopped waiting because queue became empty and
then removes the entity queue from scheduler's run queue while<br>
B goes inside 'reschedule' because it evaluates to true ('first'
is true and all the rest of the conditions), acquires new rq, and
later adds it back to scheduler (different one maybe) and keeps
submitting jobs as much as he likes and then can be stack for up
to 'timeout' timeĀ in his drm_sched_entity_flush waiting for them.<br>
</blockquote>
<br>
I'm not 100% sure but I don't think that can happen.<br>
<br>
See flushing the fd is done while dropping the fd, which happens
only after all threads of the process in question are killed.<br>
<br>
Otherwise the flushing wouldn't make to much sense. In other words
imagine an application where a thread does a write() on a fd which
is killed.<br>
<br>
The idea of the flush is to preserve the data and that won't work if
that isn't correctly ordered.<br>
<br>
<blockquote type="cite"
cite="mid:e1cd09f1-287e-ab42-243a-133e67a4f3b2@amd.com"> My
understanding was that introduction of entity->last is to force
immediate termination job submissions by any thread from the
terminating process.<br>
</blockquote>
<br>
We could consider reordering that once more. Going to play out all
scenarios in my head over the weekend :)<br>
<br>
Christian. <br>
<br>
<blockquote type="cite"
cite="mid:e1cd09f1-287e-ab42-243a-133e67a4f3b2@amd.com"> <br>
Andrey<br>
</blockquote>
<br>
</body>
</html>