qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Favre-Bulle <thomas.favre-bulle@bull.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Possible race condition when using TUN/TAP devices
Date: Wed, 16 Feb 2011 13:53:21 +0100	[thread overview]
Message-ID: <1297860801.1978.140.camel@daruma> (raw)

Hi,

I noticed the following error when trying to run multiple Qemu/KVM
instances:

------------
warning: could not open /dev/net/tun: no virtual network emulation
qemu-kvm: -netdev tap,id=hostnet0: Device 'tap' could not be initialized
------------

Tracing the error showed that returned errno is 16 (EBUSY) and happens
only when launching multiple instances in parallel.

In net/tap-linux.c line 40, qemu attempts to open /dev/net/tun (rw
mode). Then line 78, fcntl is called to set current file descriptor in
non blocking mode. IMHO, the problem is there, isn't it ?

Qemu/KVM version: 0.12.1.2 (also tested with 0.13.0)
System: RHEL6 GA (2.6.32-71)
Qemu command line: /usr/libexec/qemu-kvm -M rhel6.0.0 -enable-kvm -m
2048 -smp 8,sockets=8,cores=1,threads=1 -name vm5 -uuid
dbcc794b-cda6-44cb-b9f1-5a2024a4281d -rtc base=utc -boot order=cn
-chardev socket,id=monitor,port=15006,host=127.0.0.1,server,nowait -mon
chardev=monitor,mode=control -pidfile /var/run/vm5.pid -drive
file=/var/lib/libvirt/images/vm5.img,if=none,id=drive-ide0-0-0,boot=on
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0
-netdev tap,ifname=tap5,id=hostnet0 -device
virtio-net-pci,netdev=hostnet0,mac=52:54:99:12:34:45,bus=pci.0,addr=0x04
-chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -vnc
127.0.0.1:5 -vga cirrus -device virtio-balloon-pci,bus=pci.0,addr=0x03

more instances are run using a similar command line (only name, uuid,
mac address, etc. changes)
-- 
Thomas

                 reply	other threads:[~2011-02-16 12:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1297860801.1978.140.camel@daruma \
    --to=thomas.favre-bulle@bull.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).