current qemu-kvm doesn't work with vhost

2011-06-09 Thread Amos Kong
host kernel: 2.6.39-rc2+ qemu-kvm : 05f1737582ab6c075476bde931c5eafbc62a9349 (gdb) r -monitor stdio -m 800 ~/RHEL-Server-6.0-64-virtio.qcow2 -snapshot -device virtio-net-pci,netdev=he -netdev tap,vhost=on,id=he (qemu) [New Thread 0x7fffbe7dd700 (LWP 10410)] [New Thread 0x7fffbdfdc700 (LWP 10411)

[PATCH 1/3] virtio: Correct error message of unavailable index

2011-06-15 Thread Amos Kong
'head' is an index of VirtQueueElement, it should less than vring.num Signed-off-by: Amos Kong --- hw/virtio.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/virtio.c b/hw/virtio.c index 6e8814c..a3d0eee 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -27

[PATCH 2/3] virtio: Strictly check queue_size when adding virtqueue

2011-06-15 Thread Amos Kong
Qemu should abort when 'queue_size' is less than or equals to zero. Signed-off-by: Amos Kong --- hw/virtio.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/hw/virtio.c b/hw/virtio.c index a3d0eee..855fe54 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -61

[PATCH 3/3] virtio: Define max_nr_ports to unsigned

2011-06-15 Thread Amos Kong
ble. Signed-off-by: Amos Kong --- hw/virtio-serial-bus.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c index 9a12104..aae8456 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -727,7 +727,8 @

Re: [PATCH 2/3] virtio: Strictly check queue_size when adding virtqueue

2011-06-15 Thread Amos Kong
On Wed, Jun 15, 2011 at 11:36:02PM +0300, Michael S. Tsirkin wrote: > On Wed, Jun 15, 2011 at 10:25:33PM +0800, Amos Kong wrote: > > Qemu should abort when 'queue_size' is less than or equals to zero. > > > > Signed-off-by: Amos Kong > > BTW, these patche

Re: [PATCH 1/3] virtio: Correct error message of unavailable index

2011-06-15 Thread Amos Kong
On Wed, Jun 15, 2011 at 11:30:32PM +0300, Michael S. Tsirkin wrote: > On Wed, Jun 15, 2011 at 10:25:24PM +0800, Amos Kong wrote: > > 'head' is an index of VirtQueueElement, it should less than vring.num > > > > Signed-off-by: Amos Kong > > --- > > hw

[PATCH v2] virtio: Define queue_size to unsigned

2011-06-15 Thread Amos Kong
It's not valid for queue_size to be negative, then the type ought to be unsigned. Changes from V1: - drop the check and just define it to unsigned. Signed-off-by: Amos Kong --- hw/virtio.c |2 +- hw/virtio.h |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH] kvm: add detail error message when fail to add ioeventfd

2013-05-21 Thread Amos Kong
I try to hotplug 28 * 8 multiple-function devices to guest with old host kernel, ioeventfds in host kernel will be exhausted, then qemu fails to allocate ioeventfds for blk/nic devices. It's better to add detail error here. Signed-off-by: Amos Kong --- kvm-all.c |4 1 files chang

Re: [PATCH] kvm: add detail error message when fail to add ioeventfd

2013-05-22 Thread Amos Kong
On Wed, May 22, 2013 at 11:32:27AM +0200, Stefan Hajnoczi wrote: > On Wed, May 22, 2013 at 12:57:35PM +0800, Amos Kong wrote: > > I try to hotplug 28 * 8 multiple-function devices to guest with > > old host kernel, ioeventfds in host kernel will be exhausted, then > > q

Re: [PATCH] kvm: add detail error message when fail to add ioeventfd

2013-05-24 Thread Amos Kong
On Thu, May 23, 2013 at 09:46:07AM +0200, Stefan Hajnoczi wrote: > On Wed, May 22, 2013 at 09:48:21PM +0800, Amos Kong wrote: > > On Wed, May 22, 2013 at 11:32:27AM +0200, Stefan Hajnoczi wrote: > > > On Wed, May 22, 2013 at 12:57:35PM +0800, Amos Kong wrote: > > >

[PATCH] kvm: exclude ioeventfd from counting kvm_io_range limit

2013-05-24 Thread Amos Kong
pit, pic, ioapic, coalesced_mmio. They couldn't be limited by maximum file descriptor. Currently only ioeventfds take too much kvm_io_bus devices, so just exclude it from counting kvm_io_range limit. Also fixed one indent issue in kvm_host.h Signed-off-by: Amos Kong --- include/linux/kvm_h

When I boot two virtio-rng devices, guest will hang

2014-07-28 Thread Amos Kong
QEMU commandline: ./x86_64-softmmu/qemu-system-x86_64 --enable-kvm -m 2000 -drive file=/images/nolvm.qcow2 --kernel /home/devel/linux/arch/x86/boot/bzImage -append "ro root=/dev/sda1 console=ttyS0,115200" -monitor unix:/tmp/m,nowait,server -device virtio-net-pci,netdev=h0,vectors=17,mq=on,i

Re: When I boot two virtio-rng devices, guest will hang

2014-07-28 Thread Amos Kong
On Mon, Jul 28, 2014 at 01:25:14PM +0530, Amit Shah wrote: > On (Mon) 28 Jul 2014 [15:32:42], Amos Kong wrote: > > QEMU commandline: > > > > ./x86_64-softmmu/qemu-system-x86_64 --enable-kvm -m 2000 -drive > > file=/images/nolvm.qcow2 --kernel /home/devel/

Re: When I boot two virtio-rng devices, guest will hang

2014-07-28 Thread Amos Kong
On Mon, Jul 28, 2014 at 02:42:13PM +0530, Amit Shah wrote: > On (Mon) 28 Jul 2014 [16:49:20], Amos Kong wrote: > > On Mon, Jul 28, 2014 at 01:25:14PM +0530, Amit Shah wrote: > > > On (Mon) 28 Jul 2014 [15:32:42], Amos Kong wrote: > > > > QEMU commandline: > >

Re: When I boot two virtio-rng devices, guest will hang

2014-08-05 Thread Amos Kong
3.16 (guest hangs with two rng devices) 3.16 + quick fix (can startup with two rng devices) (hotplug issue 1 + hotplug issue 2 exist) lates torvalds/linux.git + amit 4 patches (can startup with two rng devices) (only hotplug issue 2 exists) However, the 4 patches also fixed the hang issue, the h

[PATCH] virtio-rng: complete have_data completion in removing device

2014-08-05 Thread Amos Kong
When we try to hot-remove a busy virtio-rng device from QEMU monitor, the device can't be hot-removed. Because virtio-rng driver hangs at wait_for_completion_killable(). This patch fixed the hang by completing have_data completion before unregistering a virtio-rng device. Signed-off-by:

Re: When I boot two virtio-rng devices, guest will hang

2014-08-05 Thread Amos Kong
On Tue, Aug 05, 2014 at 06:28:54PM +0800, Amos Kong wrote: > 3.16 (guest hangs with two rng devices) > 3.16 + quick fix (can startup with two rng devices) (hotplug issue 1 + > hotplug issue 2 exist) > lates torvalds/linux.git + amit 4 patches (can startup with two rng devices) >

Re: [PATCH] virtio-rng: complete have_data completion in removing device

2014-08-06 Thread Amos Kong
On Wed, Aug 06, 2014 at 01:35:15AM +0800, Amos Kong wrote: > When we try to hot-remove a busy virtio-rng device from QEMU monitor, > the device can't be hot-removed. Because virtio-rng driver hangs at > wait_for_completion_killable(). > > This patch fixed the hang by

[PATCH RFC] virtio-pci: share config interrupt between virtio devices

2014-08-31 Thread Amos Kong
One VM only has 128 msix interrupt, virtio-config interrupt has less workload. This patch shares one normal interrupt for configuration between virtio devices. Signed-off-by: Amos Kong --- drivers/virtio/virtio_pci.c | 41 - 1 file changed, 16 insertions

Re: [PATCH RFC] virtio-pci: share config interrupt between virtio devices

2014-09-01 Thread Amos Kong
On Mon, Sep 01, 2014 at 09:37:30AM +0300, Michael S. Tsirkin wrote: > Hi Michael, > On Mon, Sep 01, 2014 at 01:41:54PM +0800, Amos Kong wrote: > > One VM only has 128 msix interrupt, virtio-config interrupt > > has less workload. This patch shares one normal interrupt Tha

Re: [PATCH] virtio-rng: complete have_data completion in removing device

2014-09-08 Thread Amos Kong
On Wed, Aug 06, 2014 at 01:55:29PM +0530, Amit Shah wrote: > On (Wed) 06 Aug 2014 [16:05:41], Amos Kong wrote: > > On Wed, Aug 06, 2014 at 01:35:15AM +0800, Amos Kong wrote: > > > When we try to hot-remove a busy virtio-rng device from QEMU monitor, > > > the device ca

Re: [PATCH] virtio-rng: complete have_data completion in removing device

2014-09-09 Thread Amos Kong
On Mon, Sep 08, 2014 at 11:29:51PM +0800, Amos Kong wrote: > On Wed, Aug 06, 2014 at 01:55:29PM +0530, Amit Shah wrote: > > On (Wed) 06 Aug 2014 [16:05:41], Amos Kong wrote: > > > On Wed, Aug 06, 2014 at 01:35:15AM +0800, Amos Kong wrote: > > > > When we try to hot-r

[PATCH v2] virtio-rng: fix stuck of hot-unplugging busy device

2014-09-09 Thread Amos Kong
core use wrong buffer bytes. Before real unregistering we should return -ENODEV for reading. When we hot-unplug the device, dd process in guest will exit. $ dd if=/dev/hwrng of=/dev/null dd: error reading ‘/dev/hwrng’: No such device Signed-off-by: Amos Kong Cc: sta...@vger.kernel.org -

mutex

2014-09-09 Thread Amos Kong
Hi Amit, Rusty RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1127062 steps: - Read random data by 'dd if=/dev/hwrng of=/dev/null' in guest - check sysfs files in the same time, 'cat /sys/class/misc/hw_random/rng_*' Result: cat process will get stuck, it will return if we kill dd process. We

RFC virtio-rng: fail to read sysfs of a busy device

2014-09-09 Thread Amos Kong
(Resend to fix the subject) Hi Amit, Rusty RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1127062 steps: - Read random data by 'dd if=/dev/hwrng of=/dev/null' in guest - check sysfs files in the same time, 'cat /sys/class/misc/hw_random/rng_*' Result: cat process will get stuck, it will retur

[PATCH v3 0/2] virtio-rng: fix hotunplug

2014-09-09 Thread Amos Kong
ading. Thanks for the help of Amit. Cc: sta...@vger.kernel.org V2: reset data_avail (Amit) adjust unregister order V3: split patch, update commitlog Amos Kong (2): virtio-rng: fix stuck of hot-unplugging busy device virtio-rng: skip reading when we start to remove the device drivers/char/hw_r

[PATCH v3 1/2] virtio-rng: fix stuck of hot-unplugging busy device

2014-09-09 Thread Amos Kong
core use wrong buffer bytes. Signed-off-by: Amos Kong Cc: sta...@vger.kernel.org --- drivers/char/hw_random/virtio-rng.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index 2e3139e..849b228 100644 --- a/drivers

[PATCH v3 2/2] virtio-rng: skip reading when we start to remove the device

2014-09-09 Thread Amos Kong
Before we really unregister the hwrng device, reading will get stuck if the virtio device is reset. We should return error for reading when we start to remove the device. Signed-off-by: Amos Kong Cc: sta...@vger.kernel.org --- drivers/char/hw_random/virtio-rng.c | 5 + 1 file changed, 5

Re: [PATCH v2] virtio-rng: fix stuck of hot-unplugging busy device

2014-09-09 Thread Amos Kong
On Wed, Sep 10, 2014 at 11:04:54AM +0530, Amit Shah wrote: > Hi Amos, > > On (Tue) 09 Sep 2014 [19:14:02], Amos Kong wrote: > > When we try to hot-remove a busy virtio-rng device from QEMU monitor, > > the device can't be hot-removed. Because

Re: RFC virtio-rng: fail to read sysfs of a busy device

2014-09-09 Thread Amos Kong
On Wed, Sep 10, 2014 at 11:22:12AM +0530, Amit Shah wrote: > On (Tue) 09 Sep 2014 [23:23:07], Amos Kong wrote: > > (Resend to fix the subject) > > > > Hi Amit, Rusty > > > > RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1127062 > > steps: > > -

Re: RFC virtio-rng: fail to read sysfs of a busy device

2014-09-10 Thread Amos Kong
On Wed, Sep 10, 2014 at 02:49:38PM +0800, Amos Kong wrote: > On Wed, Sep 10, 2014 at 11:22:12AM +0530, Amit Shah wrote: > > On (Tue) 09 Sep 2014 [23:23:07], Amos Kong wrote: > > > (Resend to fix the subject) > > > > > > Hi Amit, Rusty > > > > >

[PATCH 2/2] virtio-rng: fix stuck in catting hwrng attributes

2014-09-10 Thread Amos Kong
() is executing in user context. This patch removed need_resched() and increase delay to 10 jiffies, then other tasks can have chance to execute protected code. Delaying 1 jiffy also works, but 10 jiffies is safer. Signed-off-by: Amos Kong --- drivers/char/hw_random/core.c | 3 +-- 1 file chang

[PATCH 1/2] virtio-rng cleanup: move some code out of mutex protection

2014-09-10 Thread Amos Kong
It doesn't save too much cpu time as expected, just a cleanup. Signed-off-by: Amos Kong --- drivers/char/hw_random/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index aa30a25..c591d7e 100644

[PATCH 0/2] fix stuck in catting hwrng attributes

2014-09-10 Thread Amos Kong
to execute protected code, the problem is resolved. Thanks. Amos Kong (2): virtio-rng cleanup: move some code out of mutex protection virtio-rng: fix stuck in catting hwrng attributes drivers/char/hw_random/core.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) -- 1.9.3

Re: [PATCH 2/2] virtio-rng: fix stuck in catting hwrng attributes

2014-09-13 Thread Amos Kong
On Thu, Sep 11, 2014 at 09:08:03PM +0930, Rusty Russell wrote: > Amos Kong writes: > > When I check hwrng attributes in sysfs, cat process always gets > > stuck if guest has only 1 vcpu and uses a slow rng backend. > > > > Currently we check if there is any tasks waiti

Re: [PATCH 2/2] virtio-rng: fix stuck in catting hwrng attributes

2014-09-13 Thread Amos Kong
On Sun, Sep 14, 2014 at 01:12:58AM +0800, Amos Kong wrote: > On Thu, Sep 11, 2014 at 09:08:03PM +0930, Rusty Russell wrote: > > Amos Kong writes: > > > When I check hwrng attributes in sysfs, cat process always gets > > > stuck if guest has only 1 vcpu

Re: [PATCH 2/2] virtio-rng: fix stuck in catting hwrng attributes

2014-09-13 Thread Amos Kong
On Thu, Sep 11, 2014 at 11:38:38AM +0530, Amit Shah wrote: > On (Wed) 10 Sep 2014 [17:07:07], Amos Kong wrote: > > When I check hwrng attributes in sysfs, cat process always gets > > stuck if guest has only 1 vcpu and uses a slow rng backend. > > > > Currently we

Re: [PATCH 2/2] virtio-rng: fix stuck in catting hwrng attributes

2014-09-13 Thread Amos Kong
On Sun, Sep 14, 2014 at 09:12:08AM +0800, Amos Kong wrote: ... > > > > diff --git a/drivers/char/hw_random/core.c > > > > b/drivers/char/hw_random/core.c > > > > index c591d7e..b5d1b6f 100644 > > > > --- a/drivers/char/hw_random/co

[PATCH v2 1/3] virtio-rng cleanup: move some code out of mutex protection

2014-09-15 Thread Amos Kong
It doesn't save too much cpu time as expected, just a cleanup. Signed-off-by: Amos Kong --- drivers/char/hw_random/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index aa30a25..c591d7e 100644

[PATCH v2 3/3] hw_random: increase schedule timeout in rng_dev_read()

2014-09-15 Thread Amos Kong
This patch increases the schedule timeout to 10 jiffies, it's more appropriate, then other takes can easy to hold the mutex lock. Signed-off-by: Amos Kong --- drivers/char/hw_random/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/hw_random/cor

[PATCH v2 0/3] fix stuck in accessing hwrng attributes

2014-09-15 Thread Amos Kong
the issue by changing rng_dev_read() to always schedule 10 jiffies after release mutex lock, then cat process can have chance to get the lock and execute protected code without stuck. Thanks. V2: update commitlog to describe PATCH 2, split second patch. Amos Kong (3): virtio-rng cleanup: move

[PATCH v2 2/3] hw_random: fix stuck in catting hwrng attributes

2014-09-15 Thread Amos Kong
e here. This patch removed need_resched() and always schedule other tasks then other tasks can have chance to hold the lock and execute protected code. Signed-off-by: Amos Kong --- drivers/char/hw_random/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/char

Re: [PATCH v2 3/3] hw_random: increase schedule timeout in rng_dev_read()

2014-09-15 Thread Amos Kong
On Mon, Sep 15, 2014 at 06:13:31PM +0200, Michael Büsch wrote: > On Tue, 16 Sep 2014 00:02:29 +0800 > Amos Kong wrote: > > > This patch increases the schedule timeout to 10 jiffies, it's more > > appropriate, then other takes can easy to hold the mutex lock. > &g

Re: [PATCH v2 1/3] virtio-rng cleanup: move some code out of mutex protection

2014-09-15 Thread Amos Kong
On Mon, Sep 15, 2014 at 06:13:20PM +0200, Michael Büsch wrote: > On Tue, 16 Sep 2014 00:02:27 +0800 > Amos Kong wrote: > > > It doesn't save too much cpu time as expected, just a cleanup. > > > > Signed-off-by: Amos Kong > > --- > > drivers/char/hw_

Re: [PATCH 2/2] virtio-rng: fix stuck in catting hwrng attributes

2014-09-15 Thread Amos Kong
CC linux-kernel Original thread: http://comments.gmane.org/gmane.linux.kernel.virtualization/22775 On Mon, Sep 15, 2014 at 06:48:46PM +0200, Radim Krčmář wrote: > 2014-09-14 10:25+0800, Amos Kong: > > On Sun, Sep 14, 2014 at 09:12:08AM +0800, Amos Kong wrote: > > > > ... &

Re: [PATCH 2/5] hw_random: use reference counts on each struct hwrng.

2014-09-18 Thread Amos Kong
On Thu, Sep 18, 2014 at 12:18:23PM +0930, Rusty Russell wrote: > current_rng holds one reference, and we bump it every time we want > to do a read from it. > > This means we only hold the rng_mutex to grab or drop a reference, > so accessing /sys/devices/virtual/misc/hw_random/rng_current doesn't

[PATCH v2 6/6] hw_random: don't init list element we're about to add to list.

2014-09-18 Thread Amos Kong
From: Rusty Russell Another interesting anti-pattern. Signed-off-by: Rusty Russell --- drivers/char/hw_random/core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 6420409..12187dd 100644 --- a/drivers/char/hw_random/core.

[PATCH v2 2/6] hw_random: move some code out mutex_lock for avoiding underlying deadlock

2014-09-18 Thread Amos Kong
In next patch, we use reference counting for each struct hwrng, changing reference count also needs to take mutex_lock. Before releasing the lock, if we try to stop a kthread that waits to take the lock to reduce the referencing count, deadlock will occur. Signed-off-by: Amos Kong --- drivers

[PATCH v2 4/6] hw_random: fix unregister race.

2014-09-18 Thread Amos Kong
From: Rusty Russell The previous patch added one potential problem: we can still be reading from a hwrng when it's unregistered. Add a wait for zero in the hwrng_unregister path. Signed-off-by: Rusty Russell --- drivers/char/hw_random/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git

[PATCH v2 5/6] hw_random: don't double-check old_rng.

2014-09-18 Thread Amos Kong
From: Rusty Russell Interesting anti-pattern. Signed-off-by: Rusty Russell --- drivers/char/hw_random/core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 9f6f5bb..6420409 100644 --- a/drivers/char/h

[PATCH v2 3/6] hw_random: use reference counts on each struct hwrng.

2014-09-18 Thread Amos Kong
ty Russell Signed-off-by: Amos Kong --- drivers/char/hw_random/core.c | 136 +- include/linux/hw_random.h | 2 + 2 files changed, 95 insertions(+), 43 deletions(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index a0905c

[PATCH v2 0/6] fix hw_random stuck

2014-09-18 Thread Amos Kong
deadlock, update current patch 3 to fix reference counting issue Amos Kong (1): hw_random: move some code out mutex_lock for avoiding underlying deadlock Rusty Russell (5): hw_random: place mutex around read functions and buffers. hw_random: use reference counts on each struct hwrng.

[PATCH v2 1/6] hw_random: place mutex around read functions and buffers.

2014-09-18 Thread Amos Kong
From: Rusty Russell There's currently a big lock around everything, and it means that we can't query sysfs (eg /sys/devices/virtual/misc/hw_random/rng_current) while the rng is reading. This is a real problem when the rng is slow, or blocked (eg. virtio_rng with qemu's default /dev/random backen

Re: [PATCH v2 2/3] hw_random: fix stuck in catting hwrng attributes

2014-09-18 Thread Amos Kong
On Thu, Sep 18, 2014 at 12:13:08PM +0930, Rusty Russell wrote: > Amos Kong writes: > > > I started a QEMU (non-smp) guest with one virtio-rng device, and read > > random data from /dev/hwrng by dd: > > > > # dd if=/dev/hwrng of=/dev/null & > > > >

Re: [PATCH v2 3/6] hw_random: use reference counts on each struct hwrng.

2014-09-18 Thread Amos Kong
On Thu, Sep 18, 2014 at 08:37:44PM +0800, Amos Kong wrote: > From: Rusty Russell > > current_rng holds one reference, and we bump it every time we want > to do a read from it. > > This means we only hold the rng_mutex to grab or drop a reference, > so accessing /sys

Re: [PATCH v2 3/6] hw_random: use reference counts on each struct hwrng.

2014-10-19 Thread Amos Kong
On Mon, Oct 20, 2014 at 10:42:11AM +1030, Rusty Russell wrote: > Amos Kong writes: > > We got a warning in boot stage when above set_current_rng() is executed, > > it can be fixed by init rng->ref in hwrng_init(). > > > > > > @@ -166,6 +169,8 @@ static inl

Re: [PATCH v2 4/6] hw_random: fix unregister race.

2014-11-02 Thread Amos Kong
On Fri, Oct 31, 2014 at 03:23:21PM +0800, Herbert Xu wrote: > On Fri, Oct 31, 2014 at 10:28:00AM +1030, Rusty Russell wrote: > > Herbert Xu writes: > > > On Thu, Sep 18, 2014 at 08:37:45PM +0800, Amos Kong wrote: > > >> From: Rusty Russell > > >> >

Re: [PATCH v2 4/6] hw_random: fix unregister race.

2014-11-02 Thread Amos Kong
On Sun, Nov 02, 2014 at 11:08:09PM +0800, Herbert Xu wrote: > On Sun, Nov 02, 2014 at 11:06:13PM +0800, Amos Kong wrote: > > On Fri, Oct 31, 2014 at 03:23:21PM +0800, Herbert Xu wrote: > > > On Fri, Oct 31, 2014 at 10:28:00AM +1030, Rusty Russell wrote: > > > > Herber

Re: [PATCH 3/5] hw_random: fix unregister race.

2014-11-03 Thread Amos Kong
On Tue, Oct 21, 2014 at 10:15:23PM +0800, Herbert Xu wrote: > On Thu, Sep 18, 2014 at 12:18:24PM +0930, Rusty Russell wrote: > > The previous patch added one potential problem: we can still be > > reading from a hwrng when it's unregistered. Add a wait for zero > > in the hwrng_unregister path. >

[PATCH v4 6/6] hw_random: don't init list element we're about to add to list.

2014-11-03 Thread Amos Kong
From: Rusty Russell Another interesting anti-pattern. Signed-off-by: Rusty Russell --- drivers/char/hw_random/core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index fc5de7d..b2cc8a1 100644 --- a/drivers/char/hw_random/core.

[PATCH v4 2/6] hw_random: move some code out mutex_lock for avoiding underlying deadlock

2014-11-03 Thread Amos Kong
In next patch, we use reference counting for each struct hwrng, changing reference count also needs to take mutex_lock. Before releasing the lock, if we try to stop a kthread that waits to take the lock to reduce the referencing count, deadlock will occur. Signed-off-by: Amos Kong --- drivers

[PATCH v4 0/6] fix hw_random stuck

2014-11-03 Thread Amos Kong
ed by Herbert V3: initialize kref to 1 V2: added patch 2 to fix a deadlock, update current patch 3 to fix reference counting issue Amos Kong (1): hw_random: move some code out mutex_lock for avoiding underlying deadlock Rusty Russell (5): hw_random: place mutex around read functions and buff

[PATCH v4 3/6] hw_random: use reference counts on each struct hwrng.

2014-11-03 Thread Amos Kong
ef (thanks Amos Kong) v2: fix missing put_rng() on exit path (thanks Amos Kong) Signed-off-by: Rusty Russell Signed-off-by: Amos Kong --- drivers/char/hw_random/core.c | 142 +- include/linux/hw_random.h | 2 + 2 files changed, 101 insertions(+), 43

[PATCH v4 1/6] hw_random: place mutex around read functions and buffers.

2014-11-03 Thread Amos Kong
From: Rusty Russell There's currently a big lock around everything, and it means that we can't query sysfs (eg /sys/devices/virtual/misc/hw_random/rng_current) while the rng is reading. This is a real problem when the rng is slow, or blocked (eg. virtio_rng with qemu's default /dev/random backen

[PATCH v4 4/6] hw_random: fix unregister race.

2014-11-03 Thread Amos Kong
From: Rusty Russell The previous patch added one potential problem: we can still be reading from a hwrng when it's unregistered. Add a wait for zero in the hwrng_unregister path. v4: add cleanup_done flag to insure that cleanup is done Signed-off-by: Rusty Russell Signed-off-by: Amos

[PATCH v4 5/6] hw_random: don't double-check old_rng.

2014-11-03 Thread Amos Kong
From: Rusty Russell Interesting anti-pattern. Signed-off-by: Rusty Russell --- drivers/char/hw_random/core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index c31bf91..fc5de7d 100644 --- a/drivers/char/h

Re: [PATCH v4 3/6] hw_random: use reference counts on each struct hwrng.

2014-11-17 Thread Amos Kong
On Wed, Nov 12, 2014 at 02:11:23PM +1030, Rusty Russell wrote: > Amos Kong writes: > > From: Rusty Russell > > > > current_rng holds one reference, and we bump it every time we want > > to do a read from it. > > > > This means we only hold the rng_mu

Re: [PATCH v4 4/6] hw_random: fix unregister race.

2014-11-24 Thread Amos Kong
On Wed, Nov 12, 2014 at 02:33:00PM +1030, Rusty Russell wrote: > Amos Kong writes: > > From: Rusty Russell > > > > The previous patch added one potential problem: we can still be > > reading from a hwrng when it's unregistered. Add a wait for zero > > in

Re: [PATCH v4 4/6] hw_random: fix unregister race.

2014-12-05 Thread Amos Kong
On Wed, Nov 12, 2014 at 02:33:00PM +1030, Rusty Russell wrote: > Amos Kong writes: > > From: Rusty Russell > > > > The previous patch added one potential problem: we can still be > > reading from a hwrng when it's unregistered. Add a wait for zero > > in

[PATCH v5 4/6] hw_random: fix unregister race.

2014-12-05 Thread Amos Kong
that cleanup is done Signed-off-by: Rusty Russell Signed-off-by: Amos Kong --- drivers/char/hw_random/core.c | 12 include/linux/hw_random.h | 1 + 2 files changed, 13 insertions(+) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 83516cb..06

[PATCH v5 6/6] hw_random: don't init list element we're about to add to list.

2014-12-05 Thread Amos Kong
From: Rusty Russell Another interesting anti-pattern. Signed-off-by: Rusty Russell --- drivers/char/hw_random/core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index a9286bf..4d13ac5 100644 --- a/drivers/char/hw_random/core.

[PATCH v5 5/6] hw_random: don't double-check old_rng.

2014-12-05 Thread Amos Kong
From: Rusty Russell Interesting anti-pattern. Signed-off-by: Rusty Russell --- drivers/char/hw_random/core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 067270b..a9286bf 100644 --- a/drivers/char/h

[PATCH v5 3/6] hw_random: use reference counts on each struct hwrng.

2014-12-05 Thread Amos Kong
he cleanup v3: initialize kref (thanks Amos Kong) v2: fix missing put_rng() on exit path (thanks Amos Kong) Signed-off-by: Rusty Russell Signed-off-by: Amos Kong --- drivers/char/hw_random/core.c | 135 -- include/linux/hw_random.h | 2 + 2 files c

[PATCH v5 0/6] fix hw_random stuck

2014-12-05 Thread Amos Kong
e patch 4 to fix corrupt, decrease last reference for triggering the cleanup, fix unregister race pointed by Herbert V3: initialize kref to 1 V2: added patch 2 to fix a deadlock, update current patch 3 to fix reference counting issue Amos Kong (1): hw_random: move some code out mutex_l

[PATCH v5 2/6] hw_random: move some code out mutex_lock for avoiding underlying deadlock

2014-12-05 Thread Amos Kong
In next patch, we use reference counting for each struct hwrng, changing reference count also needs to take mutex_lock. Before releasing the lock, if we try to stop a kthread that waits to take the lock to reduce the referencing count, deadlock will occur. Signed-off-by: Amos Kong --- drivers

[PATCH v5 1/6] hw_random: place mutex around read functions and buffers.

2014-12-05 Thread Amos Kong
From: Rusty Russell There's currently a big lock around everything, and it means that we can't query sysfs (eg /sys/devices/virtual/misc/hw_random/rng_current) while the rng is reading. This is a real problem when the rng is slow, or blocked (eg. virtio_rng with qemu's default /dev/random backen

[PATCH v5 REPOST 6/6] hw_random: don't init list element we're about to add to list.

2014-12-08 Thread Amos Kong
From: Rusty Russell Another interesting anti-pattern. Signed-off-by: Rusty Russell --- drivers/char/hw_random/core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index a9286bf..4d13ac5 100644 --- a/drivers/char/hw_random/core.

[PATCH v5 REPOST 3/6] hw_random: use reference counts on each struct hwrng.

2014-12-08 Thread Amos Kong
he cleanup v3: initialize kref (thanks Amos Kong) v2: fix missing put_rng() on exit path (thanks Amos Kong) Signed-off-by: Rusty Russell Signed-off-by: Amos Kong --- drivers/char/hw_random/core.c | 135 -- include/linux/hw_random.h | 2 + 2 files c

[PATCH v5 REPOST 2/6] hw_random: move some code out mutex_lock for avoiding underlying deadlock

2014-12-08 Thread Amos Kong
In next patch, we use reference counting for each struct hwrng, changing reference count also needs to take mutex_lock. Before releasing the lock, if we try to stop a kthread that waits to take the lock to reduce the referencing count, deadlock will occur. Signed-off-by: Amos Kong --- drivers

[PATCH v5 REPOST 1/6] hw_random: place mutex around read functions and buffers.

2014-12-08 Thread Amos Kong
From: Rusty Russell There's currently a big lock around everything, and it means that we can't query sysfs (eg /sys/devices/virtual/misc/hw_random/rng_current) while the rng is reading. This is a real problem when the rng is slow, or blocked (eg. virtio_rng with qemu's default /dev/random backen

[PATCH v5 REPOST 0/6] fix hw_random stuck

2014-12-08 Thread Amos Kong
e patch 4 to fix corrupt, decrease last reference for triggering the cleanup, fix unregister race pointed by Herbert V3: initialize kref to 1 V2: added patch 2 to fix a deadlock, update current patch 3 to fix reference counting issue Amos Kong (1): hw_random: move some code out mutex_l

[PATCH v5 REPOST 5/6] hw_random: don't double-check old_rng.

2014-12-08 Thread Amos Kong
From: Rusty Russell Interesting anti-pattern. Signed-off-by: Rusty Russell --- drivers/char/hw_random/core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 067270b..a9286bf 100644 --- a/drivers/char/h

[PATCH v5 REPOST 4/6] hw_random: fix unregister race.

2014-12-08 Thread Amos Kong
that cleanup is done Signed-off-by: Rusty Russell Signed-off-by: Amos Kong --- drivers/char/hw_random/core.c | 12 include/linux/hw_random.h | 1 + 2 files changed, 13 insertions(+) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 83516cb..06

Re: [kvm:next 1/1] arch/x86/kvm/emulate.c:232 writeback_registers() error: buffer overflow 'ctxt->_regs' 9 <= 15

2012-09-11 Thread Amos Kong
On 11/09/12 22:31, Fengguang Wu wrote: Hi Avi, In the kvm/next branch, sparse warns about arch/x86/kvm/emulate.c:232 writeback_registers() error: buffer overflow 'ctxt->_regs' 9 <= 15 This is because the array definition is ctxt._regs[NR_VCPU_REGS] where NR_VCPU_REGS=9 for i386 and 17 for x86

Re: qemu-kvm: remove "boot=on|off" drive parameter compatibility

2012-09-30 Thread Amos Kong
{ > .name = "copy-on-read", > .type = QEMU_OPT_BOOL, > .help = "copy read data from backing file into image > file", > - },{ > -.name = "boot", > -.type = QEMU_OPT_B

Re: [PATCH 1/1] kvmclock: fix guest stop notification

2012-09-30 Thread Amos Kong
- Original Message - > On Thu, Sep 20, 2012 at 09:46:41AM -0300, Marcelo Tosatti wrote: > > On Thu, Sep 20, 2012 at 01:55:20PM +0530, Amit Shah wrote: > > > Commit f349c12c0434e29c79ecde89029320c4002f7253 added the guest > > > stop In commitlog of f349c12c0434e29c79ecde89029320c4002f7253:

Re: RFC: sharing config interrupt between virtio devices for saving MSI

2014-04-27 Thread Amos Kong
On Sat, Apr 19, 2014 at 12:08:15PM +0800, Amos Kong wrote: > > Hi all, > > I'm working on this item in Upstream Networking todolist: > > | - Sharing config interrupts > |Support more devices by sharing a single msi vector > |between multiple virtio devices.

Re: RFC: sharing config interrupt between virtio devices for saving MSI

2014-04-27 Thread Amos Kong
On Sun, Apr 27, 2014 at 06:03:04PM +0300, Michael S. Tsirkin wrote: > On Sun, Apr 27, 2014 at 10:35:41PM +0800, Amos Kong wrote: > > On Sat, Apr 19, 2014 at 12:08:15PM +0800, Amos Kong wrote: > > > > > > Hi all, > > > > > > I'm wo

[PATCH] fix an error of undefine variable

2009-09-22 Thread Amos Kong
y", line 86, in _autotest_logging_handle_error 09/23 09:50:27 ERROR| traceback:0013| traceback.print_stack() 09/23 09:50:27 ERROR|setup_modu:0087| Future logging formatting exceptions disabled. 09/23 09:50:27 ERROR| kvm:0067| Test failed: global name 'root_module_name' is not def

[KVM-AUTOTEST PATCH] fix an error of undefine variable

2009-09-22 Thread Amos Kong
0087| Future logging formatting exceptions disabled. 09/23 09:50:27 ERROR| kvm:0067| Test failed: global name 'root_module_name' is not defined Signed-off-by: Amos Kong --- client/setup_modules.py |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/cl

[PATCH] Test 802.1Q vlan of nic

2009-09-23 Thread Amos Kong
Test 802.1Q vlan of nic, config it by vconfig command. 1) Create two VMs 2) Setup guests in different vlan by vconfig and test communication by ping using hard-coded ip address 3) Setup guests in same vlan and test communication by ping 4) Recover the vlan config Signed-off-by: Amos Kong

Got bash 'Resource temporarily unavailable' when testing linux_s3 (kvm)

2009-10-02 Thread Amos Kong
uted before 'chvt 1' took full effect? (Just my wild guess.) I'll appreciate your help. Regards, -- Amos Kong Quality Engineer Raycom Office(Beijing), Red Hat Inc. Phone: +86-10-62608183 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH] VGA Bios allow 1920x1080

2010-04-17 Thread Amos Kong
2010/4/18 Øyvind Sæther : >> > The patch lets me run 1920x1080 resolution, some displays are only that >> > and not 1920x1200 these days. Gentoos ebuild doesn't seem to make the >> > vgabios and only uses /pc-bios/vgabios.bin, making kvm/vgabios and >> > replace vgabios.bin with the VGABIOS-lgpl-la

Re: Startup of multiple Guests

2010-05-02 Thread Amos Kong
On Sun, May 2, 2010 at 9:14 PM, Dan Johansson wrote: > Hi, It's me again. > > After some time with a lot to do outside the computer world, I am now > continuing my "KVM-Project". I have gotten all my KVM-Guest to run separately, > but when I try to start more then one at the same time I get the fo

Re: KVM on RHEL5.5

2010-05-14 Thread Amos Kong
On Fri, May 14, 2010 at 4:33 PM, Alexander Graf wrote: > On 14.05.2010, at 10:10, TianJing wrote: >> Hi all, >> >> i am trying to install kvm on RHEL5.5, the server is power leader >> S5000VSA, the CPU is intel E5335, and i check that it support vm. >> when i run the commamd:  modprobe kvm_intel >

About offload function of Virtio Nic

2010-05-30 Thread Amos Kong
Hello all, Can I ask some question of the offloading function with Virtio-NIC? I'm interested in KVM virtualization. The virtual NIC is different from real hardward. And there is also a big distance between Virtio-NIC and E1000-NIC. The offloading function of Virtio-NIC close related with the fun

Re: About offload function of Virtio Nic

2010-05-30 Thread Amos Kong
On Mon, May 31, 2010 at 7:44 AM, Amos Kong wrote: > Hello all, > > Can I ask some question of the offloading function with Virtio-NIC? > > I'm interested in KVM virtualization. The virtual NIC is different > from real hardward. And there is also a big distance between >

[PATCH] KVM: Fix a build error

2010-03-20 Thread Amos Kong
/x86.c:3367: error: expected expression before ‘)’ token Signed-off-by: Amos Kong --- arch/x86/kvm/x86.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index bb9a24a..097ad3a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86

[PATCH] qemu-kvm: jaso-parser: Output the content of invalid keyword

2010-03-24 Thread Amos Kong
When input some invialid words in QMP port, qemu outputs this error message: "parse error: invalid keyword `%s'" This patch makes qemu output the content. Signed-off-by: Amos Kong --- json-parser.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/

[PATCH v2 00/17] Patchset of network related subtests

2010-08-23 Thread Amos Kong
This patchset contains 11 network related subtests, welcome more suggestions about correctness, design and enhancement. This is the version 2, thanks your comments. --- Amos Kong (17): KVM-test: Add a new macaddress pool algorithm Add a get_ifname function KVM Test: Add a

<    1   2   3   4   >