[libvirt] [PATCH v8 11/18] qemu: Add swtpm to emulator cgroup
Ján Tomko
jtomko at redhat.com
Sat Jun 2 13:31:04 UTC 2018
On Thu, May 24, 2018 at 04:26:07PM -0400, Stefan Berger wrote:
>Add the external swtpm to the emulator cgroup so that upper limits of CPU
>usage can be enforced on the emulated TPM.
>
>To enable this we need to have the swtpm write its process id (pid) into a
>file. We then read it from the file to configure the emulator cgroup.
>
>The PID file is created in /var/run/libvirt/qemu/swtpm:
>
>[root at localhost swtpm]# ls -lZ /var/run/libvirt/qemu/swtpm/
>total 4
>-rw-r--r--. 1 tss tss system_u:object_r:qemu_var_run_t:s0 5 Apr 10 12:26 1-testvm-swtpm.pid
>srw-rw----. 1 qemu qemu system_u:object_r:svirt_image_t:s0:c597,c632 0 Apr 10 12:26 1-testvm-swtpm.sock
>
>The swtpm command line now looks as follows:
>
>root at localhost testvm]# ps auxZ | grep swtpm | grep socket | grep -v grep
>system_u:system_r:virtd_t:s0:c597,c632 tss 18697 0.0 0.0 28172 3892 ? Ss 16:46 0:00 /usr/bin/swtpm socket --daemon --ctrl type=unixio,path=/var/run/libvirt/qemu/swtpm/1-testvm-swtpm.sock,mode=0600 --tpmstate dir=/var/lib/libvirt/swtpm/485d0004-a48f-436a-8457-8a3b73e28568/tpm1.2/ --log file=/var/log/swtpm/libvirt/qemu/testvm-swtpm.log --pid file=/var/run/libvirt/qemu/swtpm/1-testvm-swtpm.pid
>
>Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
>Reviewed-by: John Ferlan <jferlan at redhat.com>
>---
> src/qemu/qemu_cgroup.c | 35 ++++++++++++
> src/qemu/qemu_cgroup.h | 2 +
> src/qemu/qemu_extdevice.c | 26 +++++++++
> src/qemu/qemu_extdevice.h | 6 +++
> src/qemu/qemu_process.c | 4 ++
> src/qemu/qemu_tpm.c | 135 ++++++++++++++++++++++++++++++++++++++++++++--
> src/qemu/qemu_tpm.h | 6 +++
> 7 files changed, 211 insertions(+), 3 deletions(-)
>
Reviewed-by: Ján Tomko <jtomko at redhat.com>
Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180602/ceb66014/attachment-0001.sig>
More information about the libvir-list
mailing list