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

2014-09-10 Thread Amos Kong
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1121540 When we try to hot-unplugging a busy virtio-rng device, the device can't be removed. And the reading process in guest gets stuck. Those two patches fixed this issue by completing have_data completion and preventing invalid reading.

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

2014-09-10 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 ak...@redhat.com Cc: sta...@vger.kernel.org --- drivers/char/hw_random/virtio-rng.c | 5 + 1

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

2014-09-10 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 exits the waiting by completing have_data completion before unregistering, resets data_avail to avoid the hwrng core

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

2014-09-10 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 virtio-rng driver hangs at wait_for_completion_killable().

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

2014-09-10 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: - Read random data by 'dd if=/dev/hwrng of=/dev/null' in guest

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

2014-09-10 Thread Amit Shah
On (Wed) 10 Sep 2014 [14:11:36], 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 exits the waiting by completing have_data completion before

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

2014-09-10 Thread Amit Shah
On (Wed) 10 Sep 2014 [14:11:37], Amos Kong wrote: 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 ak...@redhat.com Cc: sta...@vger.kernel.org

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 RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1127062 steps:

[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 ak...@redhat.com --- 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

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

2014-09-10 Thread Amos Kong
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 waiting to be run on current cpu in rng_dev_read() by need_resched(). But need_resched() doesn't work because rng_dev_read() is

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

2014-09-10 Thread Amos Kong
If we read hwrng by long-running dd process, it takes too much cpu time. When we check hwrng attributes from sysfs by cat, it gets stuck. The problem can only be reproduced with non-smp guest with slow backend. This patchset changed hwrng core to always delay 10 jiffies, cat process have chance

Re: [PATCH] virtio_blk: merge S/G list entries by default

2014-09-10 Thread Paolo Bonzini
Il 07/09/2014 12:32, Ming Lei ha scritto: It is a good idea to disable SG merge for vq incapable of indirect because there are very limited direct descriptors. I think you mean _enabling_ SG merge if indirect descriptors are not there. For vq capable of indirect, it should be better to not do

Re: [PATCH] virtio_blk: merge S/G list entries by default

2014-09-10 Thread Ming Lei
On Wed, Sep 10, 2014 at 11:18 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 07/09/2014 12:32, Ming Lei ha scritto: It is a good idea to disable SG merge for vq incapable of indirect because there are very limited direct descriptors. I think you mean _enabling_ SG merge if indirect

Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

2014-09-10 Thread Christopher Covington
On 09/04/2014 10:57 PM, Andy Lutomirski wrote: On Thu, Sep 4, 2014 at 7:31 PM, Rusty Russell ru...@rustcorp.com.au wrote: Andy Lutomirski l...@amacapital.net writes: On Sep 2, 2014 11:53 PM, Rusty Russell ru...@rustcorp.com.au wrote: Andy Lutomirski l...@amacapital.net writes: There really

Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

2014-09-10 Thread Andy Lutomirski
On Wed, Sep 10, 2014 at 8:36 AM, Christopher Covington c...@codeaurora.org wrote: On 09/04/2014 10:57 PM, Andy Lutomirski wrote: There's a third option: try to make virtio-mmio work everywhere (except s390), at least in the long run. This other benefits: it makes minimal hypervisors simpler,

Re: [PATCH] virtio_blk: merge S/G list entries by default

2014-09-10 Thread Michael S. Tsirkin
On Mon, Sep 08, 2014 at 10:15:57PM +0200, Christoph Hellwig wrote: On Mon, Sep 08, 2014 at 11:18:30AM +0300, Michael S. Tsirkin wrote: Could you respond to Ming Lei's mail, who benchmarked the patch, please? I don't really have any additional data or disagreement, not sure what I should

Rusty away 18th September -- 11th October

2014-09-10 Thread Rusty Russell
Hi all, Probably won't read mail. Linus, I'll have pull requests early next week; if there's anything needed I'm sure Michael Tsirkin can handle it. Cheers, Rusty. PS. England and Italy for a holiday; my daughter chose them (somehow I forgot to inform her of the existence of Euro