[dvsim] Kill subprocesses more gracefully
[dvsim] Kill subprocesses more gracefully

Before this patch, we just used subprocess.Popen.kill(), which sends a
SIGKILL signal. This doesn't work well if the process has some child
processes, because it doesn't have a chance to clean up. This patch
sends a SIGTERM first, waits up to a couple of seconds for the process
to terminate, and then sends a SIGKILL if necessary. Hopefully, this
will leave fewer simv processes lying around.

Signed-off-by: Rupert Swarbrick <290093e2ad2515ed2f14d749293c8cf8e02ca274@lowrisc.org>

lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan