Received: from eggs.gnu.org ([208.118.235.92]:60682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHZq9-0003Sp-RV for qemu-devel@nongnu.org; Mon, 18 Mar 2013 09:11:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UHZq8-0000d9-1J for qemu-devel@nongnu.org; Mon, 18 Mar 2013 09:11:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20509) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHZq7-0000cq-O8 for qemu-devel@nongnu.org; Mon, 18 Mar 2013 09:10:59 -0400 From: Markus Armbruster References: <1361987275-26289-1-git-send-email-stefanb@linux.vnet.ibm.com> <1361987275-26289-2-git-send-email-stefanb@linux.vnet.ibm.com> <87obel867v.fsf@blackfin.pond.sub.org> <51432221.3050609@linux.vnet.ibm.com> Date: Mon, 18 Mar 2013 14:10:55 +0100 In-Reply-To: <51432221.3050609@linux.vnet.ibm.com> (Stefan Berger's message of "Fri, 15 Mar 2013 09:29:05 -0400") Message-ID: <87li9k7t0g.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH V27 1/7] Support for TPM command line options List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Berger Cc: Luiz Capitulino , qemu-devel@nongnu.org, anthony@codemonkey.ws, mst@redhat.com Stefan Berger writes: > On 03/15/2013 03:36 AM, Markus Armbruster wrote: >> I missed this one, because it wasn't cc'ed to QMP maintainers, the >> subject mentions only command line, not QMP, and even the body talks >> only about the human monitor command, not QMP. Noticed it only when >> git-pull touched qapi-schema.json. Please try harder to help Luiz and >> me keep track of QMP changes. > > I apologize for that. > >> >> I gave the QMP interface and its documentation a look-over now. It's >> just a look-over, because passthrough requires a box with TPM enabled, >> which I don't have handy, so I can't test anything. >> >> A few comments inline. >> >> Stefan Berger writes: >> + >> +@item -tpmdev @var{backend} ,id=@var{id} [,@var{options}] >> +@findex -tpmdev >> +Backend type must be: >> + >> +The specific backend type will determine the applicable options. >> +The @code{-tpmdev} option requires a @code{-device} option. >> You mean -tpmdev creates just a backend, so for a usable device you also >> need to create a frontend with -device? > > Yes, just like any other device. Okay. Corey already posted a patch to clarify the documentation here. Appreciated! [...] > +{ > + if (qemu_opts_foreach(qemu_find_opts("tpmdev"), > + tpm_init_tpmdev, NULL, 1) != 0) { > + return -1; > + } > + > + atexit(tpm_cleanup); > >> Routine atexit() question: what happens when the program terminates >> abnormally? atext() callbacks don't run then. Impact of not doing >> cleanup on the system? > > In case the TPM is currently not operating on a command there will be > no impact. In case the TPM is operating on a command, it will hold the > thread inside /dev/tpm0 until the command has finished. The solution > here is to write a byte into sysfs file to terminate the TPM from > further executing the command and return; this code exists and is > being invoked in all other cases than abnormal termination obviously. Unlike other kernel resources such as file descriptors, this one isn't tied to a process and cleaned up automatically on process termination. Correct? Therefore, we try to clean it up manually. Actual cleanup code is tpm_passthrough_cancel_cmd(). Correct? The only existing cleanup function tpm_passthrough_destroy() does a whole lot more. Just to make sure I understand what's going on: everything but tpm_passthrough_cancel_cmd() is effectively a no-op there, correct? > What other choices do we have? Do we need a signal handler that runs > on SIGSEGV and provide a registration function for those functions > that need to run on abnormal termination? Not worth it.