From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Kittel Subject: KVM freeze when using --serial Date: Wed, 07 Apr 2010 16:32:33 +0200 Message-ID: <4BBC9781.6030705@in.tum.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020306090504030903030509" Cc: qemu-devel@nongnu.org To: kvm@vger.kernel.org Return-path: Received: from atlas.fs.tum.de ([129.187.202.11]:44151 "EHLO atlas.fs.tum.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932604Ab0DGOjB (ORCPT ); Wed, 7 Apr 2010 10:39:01 -0400 Sender: kvm-owner@vger.kernel.org List-ID: This is a multi-part message in MIME format. --------------020306090504030903030509 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Hi there, I already posted this problem to #kvm on freenode. Please set me in CC: when replying to this mail, as I am not subscribed to this mailing lists right now. The Scenario is as follows: I got 2 VM processes in userspace. The first is started with the parameter --monitor pty. => This results in a file /dev/pts/x in the host, (crw--w---- 1 kittel tty 136, 3 2010-04-07 15:51 /dev/pts/3 on my system) Another VM is then started with the parameter --serial /dev/pts/3 => This results in /dev/ttyS0 inside the second VM. Both VMs are running debian lenny. The host (debian) uses qemu-kvm 0.12.3. "startvms.sh start" is used to start the VMs. Running the executable build from test.c in the second VM results in a freeze of this VM. (The test.c included uses /dev/ttyS1 as /dev/ttyS0 is the VMs serial console in my setup.) The process uses 100% CPU and is stuck in kvm_mutex_lock(). Trying to use the build in gdbserver didnīt work because it also locked. Is there a way to tunnel one VMs monitor console to another VM? Thanks Thomas --------------020306090504030903030509 Content-Type: text/x-csrc; name="test.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="test.c" #include #include #include #include #include void signal_handler(int signum){ pthread_exit(NULL); } void *readFile(void * ptr){ signal(SIGTERM, signal_handler); int fd; char buffer; fd = open("/dev/ttyS1", O_RDONLY); while(true){ read(fd, &buffer, 1); printf("%c", buffer); fflush(stdout); } close(fd); pthread_exit(NULL); } int main(int argc, char** argv){ pthread_t thread; pthread_create(&thread, NULL, &readFile, NULL); sleep(10); pthread_kill(thread, SIGTERM); pthread_join(thread, NULL); } --------------020306090504030903030509 Content-Type: application/x-sh; name="startvms.sh" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="startvms.sh" #!/bin/sh case $1 in start) KVM1="kvm -name ROOTKITVM -m 512 -hda rootkitvm/rootkitvm -serial pty -monitor pty -mem-path /tmp -mem-prealloc -pidfile rootkitvm/pid -daemonize" PTS1=`$KVM1 2>&1 | grep pts | awk '{ print $5 }' &` sleep 1 ROOTKITVMPID=`cat rootkitvm/pid` echo "Started Rootkit VM. PID = $ROOTKITVMPID" # RAMFILE=`ls -laF /tmp/kvm.$ROOTKITVMPID.* | sort | tail - -n1 | awk '{ print $8 }'` KVM2="kvm -name IDSVM -m 512 -hda idsvm/idsvm -hdb rootkitvm/rootkitvm --serial pty" for i in $PTS1 do KVM2="$KVM2 --serial $i " done # KVM2="$KVM2 --drive file=$RAMFILE,if=virtio" KVM2="$KVM2 -pidfile idsvm/pid -daemonize" PTS2=`$KVM2 2>&1 | grep pts | awk '{ print $5 }' &` echo "IDSVM Serial is $PTS2" sleep 1 IDSVMPID=`cat idsvm/pid` echo "Started IDS VM. PID = $IDSVMPID" ;; stop) ROOTKITVMPID=`cat rootkitvm/pid` kill -9 $ROOTKITVMPID rm -rf /tmp/kvm.$ROOTKITVMPID.* IDSVMPID=`cat idsvm/pid` kill -9 $IDSVMPID rm -rf /tmp/kvm.$IDSVMPID.* ;; restart) $0 stop sleep 2 $0 start ;; *) echo "No command given" ;; esac --------------020306090504030903030509--