what's the "futex" thread doing when create a kvm guest ?

drago01 drago01 at gmail.com
Sun Feb 22 22:17:51 UTC 2015


On Sun, Feb 22, 2015 at 1:36 PM, Hu Jun <jhu_com at 163.com> wrote:
> Hi guys:
>
> env:
> [root at cloudf ~]# uname -a
> Linux cloudf.fedora.com 3.18.7-100.fc20.x86_64 #1 SMP Wed Feb 11 19:01:50
> UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
> [root at cloudf ~]# rpm -q qemu-kvm
> qemu-kvm-1.6.2-13.fc20.x86_64
>
> I found there is a "futex" thead after creating a kvm guest by the
> command:"/usr/bin/qemu-system-x86_64 -machine accel=kvm -hda
> /opt/todaygoods_SLES_11_SP3_JeOS.x86_64-0.0.2.raw -vnc 192.168.0.110:6"
>
> root at cloudf task]# ps aux | grep qemu
> root     13111  0.3  2.8 546760 227340 pts/3   S+   18:26   0:12 gdb
> qemu-system-x86_64
> root     14379 85.2  2.0 699004 165496 pts/3   tl   18:49  31:12
> /usr/bin/qemu-system-x86_64 -machine accel=kvm -hda
> /opt/todaygoods_SLES_11_SP3_JeOS.x86_64-0.0.2.raw -vnc 192.168.0.110:6
>
> the process 14379 has three threads, I'm familiar with the two of them
> except the third thread (lwp :14418)
>
> [root at cloudf 14379]# cd /proc/14379/
> [root at cloudf 14379]# cat task/14
> 14379/ 14416/ 14418/
> [root at cloudf 14379]# cat task/14379/stack
> [<ffffffff8121d1e9>] poll_schedule_timeout+0x49/0x70
> [<ffffffff8121e8e4>] do_sys_poll+0x484/0x5c0
> [<ffffffff8121eb24>] SyS_poll+0x74/0x110
> [<ffffffff8174cfa9>] system_call_fastpath+0x12/0x17
> [<ffffffffffffffff>] 0xffffffffffffffff
> [root at cloudf 14379]# cat task/14416/stack
> [<ffffffffa05cf92d>] kvm_arch_vcpu_ioctl_run+0xb0d/0x1280 [kvm]
> [<ffffffffa05b7bb2>] kvm_vcpu_ioctl+0x292/0x5c0 [kvm]
> [<ffffffff8121c710>] do_vfs_ioctl+0x2e0/0x4a0
> [<ffffffff8121c951>] SyS_ioctl+0x81/0xa0
> [<ffffffff8174cfa9>] system_call_fastpath+0x12/0x17
> [<ffffffffffffffff>] 0xffffffffffffffff
> [root at cloudf 14379]# cat task/14418/stack
> [<ffffffff8110b6e0>] futex_wait_queue_me+0xd0/0x130
> [<ffffffff8110b9e6>] futex_wait+0x176/0x270
> [<ffffffff8110dc7e>] do_futex+0x10e/0xac0
> [<ffffffff8110e6b0>] SyS_futex+0x80/0x180
> [<ffffffff8174cfa9>] system_call_fastpath+0x12/0x17
> [<ffffffffffffffff>] 0xffffffffffffffff
>
> what's the "futex" thread doing  when create a kvm guest ?  I deeped into
> the qemu code , but I failed to find where call "futex" system call.

It is unlikely that you will find any call to "futex" in the source
code of an application. It doesn't even have glibc interface.
Most of the time it is an implementation detail for something else.
For instance pthread_join is implemented using the futex system call.

But the question here is ... what is the problem that you are trying to solve?


More information about the kernel mailing list