Re: [RFC] kvmtool: add support for modern virtio-pci

2015-11-19 Thread Sasha Levin
On 11/19/2015 02:21 AM, Gerd Hoffmann wrote: > On Mi, 2015-11-18 at 23:01 -0500, Sasha Levin wrote: >> On 11/18/2015 11:00 PM, Sasha Levin wrote: >>> Anyways, I debugged it for a bit a found that seabios attempts to write to >>> the notification BAR, I look further

Re: [RFC] kvmtool: add support for modern virtio-pci

2015-11-18 Thread Sasha Levin
On 11/18/2015 03:22 AM, Gerd Hoffmann wrote: > /me goes undust the kvmtool patches for seabios. > > (see https://www.kraxel.org/cgit/seabios/commit/?h=kvmtool, > build with CONFIG_KVMTOOL=y + CONFIG_DEBUG_LEVEL=9) > > nilsson kraxel ~# ~kraxel/projects/kvmtool/lkvm run --name seabios >

Re: [RFC] kvmtool: add support for modern virtio-pci

2015-11-18 Thread Sasha Levin
On 11/18/2015 11:00 PM, Sasha Levin wrote: > Anyways, I debugged it for a bit a found that seabios attempts to write to > the notification BAR, I look further tomorrow to narrow it down and fix it. Err, *read*, obviously. I've never implemented that because the kernel doesn't try

Re: [RFC] kvmtool: add support for modern virtio-pci

2015-11-18 Thread Sasha Levin
On 11/18/2015 12:52 PM, Gerd Hoffmann wrote: > Hi, > >> Thanks for testing! I didn't even thing about seabios as a testing target. > > Not surprising, support isn't upstream, ran into a bunch of issues[1][2] > last time I tried to combine the two, ran into some issues and nobody > seemed to

[RFC] kvmtool: add support for modern virtio-pci

2015-11-17 Thread Sasha Levin
ice. Feedback is very welcome! Signed-off-by: Sasha Levin <sasha.le...@oracle.com> --- Makefile | 1 + builtin-run.c | 4 + include/kvm/kvm-config.h | 1 + include/

Re: [PATCH 2/2] kvmtool: assume dead vcpus are paused too

2015-11-05 Thread Sasha Levin
On 11/05/2015 09:41 AM, Will Deacon wrote: > On Wed, Nov 04, 2015 at 06:51:12PM -0500, Sasha Levin wrote: >> > On 11/04/2015 06:51 AM, Will Deacon wrote: >>> > > + mutex_lock(_lock); >>> > > + >>> > > + /* The kvm->cpus

Re: [PATCH 2/2] kvmtool: assume dead vcpus are paused too

2015-11-04 Thread Sasha Levin
On 11/04/2015 06:51 AM, Will Deacon wrote: > + mutex_lock(_lock); > + > + /* The kvm->cpus array contains a null pointer in the last location */ > + for (i = 0; ; i++) { > + if (kvm->cpus[i]) > + pthread_kill(kvm->cpus[i]->thread, SIGKVMEXIT); > +

Re: sanitizing kvmtool

2015-10-25 Thread Sasha Levin
On 10/25/2015 11:19 AM, Paolo Bonzini wrote: > > > On 21/10/2015 19:07, Sasha Levin wrote: >> On 10/19/2015 11:15 AM, Dmitry Vyukov wrote: >>> But still: if result of a racy read is passed to guest, that can leak >>> arbitrary host data into guest. >> &g

Re: sanitizing kvmtool

2015-10-21 Thread Sasha Levin
On 10/19/2015 11:15 AM, Dmitry Vyukov wrote: > On Mon, Oct 19, 2015 at 5:08 PM, Sasha Levin <sasha.le...@oracle.com> wrote: >> > On 10/19/2015 10:47 AM, Dmitry Vyukov wrote: >>>> >>> Right, the memory areas that are accessed both by the hypervisor and

Re: Network hangs when communicating with host

2015-10-20 Thread Sasha Levin
On 10/20/2015 09:42 AM, Dmitry Vyukov wrote: > I now have another issue. My binary fails to mmap a file within lkvm > sandbox. The same binary works fine on host and in qemu. I've added > strace into sandbox script, and here is the output: > > [pid 837] openat(AT_FDCWD,

Re: sanitizing kvmtool

2015-10-19 Thread Sasha Levin
On 10/19/2015 04:37 AM, Dmitry Vyukov wrote: >> So in this case (and most of the other data race cases described in the full >> log) it >> > seems like ThreadSanitizer is mixing with different accesses by the guest >> > to one underlying >> > block of memory on the host. >> > >> > Here, for

Re: Network hangs when communicating with host

2015-10-19 Thread Sasha Levin
On 10/19/2015 05:28 AM, Dmitry Vyukov wrote: > On Mon, Oct 19, 2015 at 11:22 AM, Andre Przywara <andre.przyw...@arm.com> > wrote: >> Hi Dmitry, >> >> On 19/10/15 10:05, Dmitry Vyukov wrote: >>> On Fri, Oct 16, 2015 at 7:25 PM, Sasha Levin <sasha.le...@o

Re: sanitizing kvmtool

2015-10-19 Thread Sasha Levin
On 10/19/2015 10:47 AM, Dmitry Vyukov wrote: >> Right, the memory areas that are accessed both by the hypervisor and the >> guest >> > should be treated as untrusted input, but the hypervisor is supposed to >> > validate >> > the input carefully before using it - so I'm not sure how data races

Re: sanitizing kvmtool

2015-10-19 Thread Sasha Levin
On 10/19/2015 10:24 AM, Dmitry Vyukov wrote: > On Mon, Oct 19, 2015 at 4:19 PM, Sasha Levin <sasha.le...@oracle.com> wrote: >> > On 10/19/2015 04:37 AM, Dmitry Vyukov wrote: >>>> >>> So in this case (and most of the other data race cases described in >

Re: sanitizing kvmtool

2015-10-17 Thread Sasha Levin
On 10/15/2015 06:21 AM, Dmitry Vyukov wrote: > Hello, > > I've run a set of sanitizers on > git://git.kernel.org/pub/scm/linux/kernel/git/will/kvmtool.git commit > 3695adeb227813d96d9c41850703fb53a23845eb. I've just booted a VM and > shut it down. > > AddressSanitizer detected a

Re: Network hangs when communicating with host

2015-10-16 Thread Sasha Levin
On 10/15/2015 04:20 PM, Dmitry Vyukov wrote: > Hello, > > I am trying to run a program in lkvm sandbox so that it communicates > with a program on host. I run lkvm as: > > ./lkvm sandbox --disk sandbox-test --mem=2048 --cpus=4 --kernel > /arch/x86/boot/bzImage --network mode=user -- /my_prog >

Re: kvm: odd time values since kvmclock: set scheduler clock stable

2015-05-26 Thread Sasha Levin
On 05/26/2015 09:21 AM, Luiz Capitulino wrote: Sasha, Can you give the suggested patch (hypervisor patch...) a try please? (with a patched guest, obviously). KVM: x86: zero kvmclock_offset when vcpu0 initializes kvmclock system MSR I've tried your v2, it works for me. My test-case

[added to the 3.18 stable tree] KVM: MIPS: Fix trace event to save PC directly

2015-03-14 Thread Sasha Levin
mtosa...@redhat.com Signed-off-by: Sasha Levin sasha.le...@oracle.com --- arch/mips/kvm/trace.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/mips/kvm/trace.h b/arch/mips/kvm/trace.h index c1388d4..bd6437f 100644 --- a/arch/mips/kvm/trace.h +++ b/arch/mips/kvm/trace.h

Re: stand-alone kvmtool

2015-02-19 Thread Sasha Levin
On 02/13/2015 05:39 AM, Andre Przywara wrote: Hi, as I found it increasingly inconvenient to use kvmtool[1] as part of a Linux repository, I decided to give it a go and make it a stand-alone project. So I filtered all the respective commits, adjusted the paths in there (while keeping

Re: [PATCH V5] x86 spinlock: Fix memory corruption on completing completions

2015-02-17 Thread Sasha Levin
] Reported-by: Sasha Levin sasha.le...@oracle.com Suggested-by: Linus Torvalds torva...@linux-foundation.org Signed-off-by: Raghavendra K T raghavendra...@linux.vnet.ibm.com --- Sasha, Hope this addresses invalid read concern you had with latest xadd based implementation. (Think we need

Re: [PATCH] x86 spinlock: Fix memory corruption on completing completions

2015-02-10 Thread Sasha Levin
On 02/10/2015 04:30 AM, Raghavendra K T wrote: So I think Raghavendra's last version (which hopefully fixes the lockup problem that Sasha reported) together with changing that V2 did pass the stress, but getting confirmation Sasha would help. I've been running it for the last two days, and

Re: [PATCH] x86 spinlock: Fix memory corruption on completing completions

2015-02-06 Thread Sasha Levin
On 02/06/2015 02:42 PM, Davidlohr Bueso wrote: On Fri, 2015-02-06 at 08:25 -0800, Linus Torvalds wrote: On Fri, Feb 6, 2015 at 6:49 AM, Raghavendra K T raghavendra...@linux.vnet.ibm.com wrote: Paravirt spinlock clears slowpath flag after doing unlock. [ fix edited out ] So I'm not going to

Re: [PATCH] x86 spinlock: Fix memory corruption on completing completions

2015-02-06 Thread Sasha Levin
, viz., slowpath still could be set when somebody does arch_trylock. Handle that too by ignoring slowpath flag during lock availability check. Reported-by: Sasha Levin sasha.le...@oracle.com Suggested-by: Linus Torvalds torva...@linux-foundation.org Signed-off-by: Raghavendra K T raghavendra

Re: [PATCH] x86 spinlock: Fix memory corruption on completing completions

2015-02-06 Thread Sasha Levin
On 02/06/2015 09:49 AM, Raghavendra K T wrote: static __always_inline void arch_spin_unlock(arch_spinlock_t *lock) { if (TICKET_SLOWPATH_FLAG - static_key_false(paravirt_ticketlocks_enabled)) { - arch_spinlock_t prev; +

Re: [PATCH 3/4] mm: gup: use get_user_pages_fast and get_user_pages_unlocked

2014-10-01 Thread Sasha Levin
Hi Andrea, On 10/01/2014 04:56 AM, Andrea Arcangeli wrote: diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 8f5330d..6606c10 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -881,7 +881,7 @@ static int lookup_node(struct mm_struct *mm, unsigned long addr) struct page *p;

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

2014-09-21 Thread Sasha Levin
On 09/21/2014 04:09 AM, Michael S. Tsirkin wrote: The virtio 0.9.5 spec says that ISR is unused when in MSI-X mode. I don't think that you can depend on the device to set the configuration changed bit. The virtio 1.0 spec seems to have fixed that. Yes, virtio 0.9.5 has this bug. But in

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

2014-09-21 Thread Sasha Levin
On 09/21/2014 11:02 AM, Michael S. Tsirkin wrote: On Sun, Sep 21, 2014 at 09:47:51AM -0400, Sasha Levin wrote: On 09/21/2014 04:09 AM, Michael S. Tsirkin wrote: The virtio 0.9.5 spec says that ISR is unused when in MSI-X mode. I don't think that you can depend on the device to set

[PATCH] KVM: MMU: Use hashtable for MMU page hash

2014-08-04 Thread Sasha Levin
Use the kernel hashtable interface instead of the hlist interface. This allows us to eliminate some unneeded code and make the code simpler. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- arch/x86/include/asm/kvm_host.h |4 ++-- arch/x86/kvm/mmu.c | 16

Re: [PATCH 8/9] PCI: Ignore BAR contents when firmware left decoding disabled

2014-03-21 Thread Sasha Levin
On 03/21/2014 04:07 PM, Bjorn Helgaas wrote: I think I figured out what the problem is. In virtio_pci__init(), we allocate some address space with pci_get_io_space_block(), save its address in vpci-mmio_addr, and hook that address space up to virtio_pci__io_mmio_callback with

[PATCH] kvm tools: treat uids and gids in stat structure properly

2014-03-19 Thread Sasha Levin
Upstream commit 9p: Modify the stat structures to use kuid_t and kgid_t has modified the type of uid and gid in the stat structure, which breaks build for us. This is a rather trivial conversion from u32 to kuid_t and kgid_t. Reported-by: Ingo Molnar mi...@kernel.org Signed-off-by: Sasha Levin

[PATCH] kvm tools: mark our PCI card as PIO and MMIO able

2014-03-05 Thread Sasha Levin
-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/virtio/pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/kvm/virtio/pci.c b/tools/kvm/virtio/pci.c index fa7aa00..665d492 100644 --- a/tools/kvm/virtio/pci.c +++ b/tools/kvm/virtio/pci.c @@ -360,6 +360,7 @@ int virtio_pci__init

[PATCH] kvm: mmu: delay mmu audit activation

2013-11-19 Thread Sasha Levin
We should not be using jump labels before they were initialized. Push back the callback to until after jump label initialization. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- arch/x86/kvm/mmu_audit.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm

Re: lkvm issue: --network mode=user,trans=mmio doesn't work

2013-10-12 Thread Sasha Levin
On 10/12/2013 05:49 AM, Pekka Enberg wrote: Hi Peter, (Adding bunch of CCs.) On 10/12/13 11:05 AM, Péter Szabó wrote: First, thank you very much for writing lkvm, it's awesome, and very easy to set up. If sending an e-mail to you is not the right way to report lkvm issues, please tell me how

Re: [PATCH v2 2/3] kvm tools: remove periodic tick in favour of a polling thread

2013-09-07 Thread Sasha Levin
On 09/05/2013 12:39 PM, Jonathan Austin wrote: Hi Sasha, On 04/09/13 19:01, Sasha Levin wrote: On 09/04/2013 01:48 PM, Pekka Enberg wrote: On Wed, Sep 4, 2013 at 8:40 PM, Jonathan Austin jonathan.aus...@arm.com wrote: 'top' works on ARM with virtio console. I've just done some new testing

Re: [PATCH v2 2/3] kvm tools: remove periodic tick in favour of a polling thread

2013-09-04 Thread Sasha Levin
On 09/04/2013 01:48 PM, Pekka Enberg wrote: On Wed, Sep 4, 2013 at 8:40 PM, Jonathan Austin jonathan.aus...@arm.com wrote: 'top' works on ARM with virtio console. I've just done some new testing and with the serial console emulation and I see the same as you're reporting. Previously with the

[PATCH v2] kvm tools: fix boot of guests with more than 4gb of ram

2013-07-07 Thread Sasha Levin
referred to a memory area above 4gb. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/include/kvm/virtio.h | 6 ++ tools/kvm/virtio/9p.c | 2 +- tools/kvm/virtio/balloon.c | 2 +- tools/kvm/virtio/blk.c | 2 +- tools/kvm/virtio/console.c | 2 +- tools

Re: [RFC 0/5] Introduce VM Sockets virtio transport

2013-06-27 Thread Sasha Levin
Hi Asias, Looks nice! Some comments inline below (I've removed anything that mst already commented on). On 06/27/2013 03:59 AM, Asias He wrote: Hello guys, In commit d021c344051af91 (VSOCK: Introduce VM Sockets), VMware added VM Sockets support. VM Sockets allows communication between virtual

Re: [PATCH] kvm tools: fix boot of guests with more than 4gb of ram

2013-06-25 Thread Sasha Levin
On 06/24/2013 08:58 PM, Michael Ellerman wrote: On Sun, 2013-06-23 at 21:23 -0400, Sasha Levin wrote: Commit kvm tools: virtio: remove hardcoded assumptions about guest page size has introduced a bug that prevented guests with more than 4gb of ram from booting. The issue is that 'pfn

[PATCH] kvm tools: fix boot of guests with more than 4gb of ram

2013-06-23 Thread Sasha Levin
referred to a memory area above 4gb. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/virtio/9p.c | 2 +- tools/kvm/virtio/balloon.c | 2 +- tools/kvm/virtio/blk.c | 2 +- tools/kvm/virtio/console.c | 2 +- tools/kvm/virtio/net.c | 2 +- tools/kvm/virtio/rng.c | 2

Re: [PATCH] kvm tools: add status notification hook to virtio-mmio

2013-05-26 Thread Sasha Levin
any form of networking. Not good. Bring virtio-mmio into this brave new notified world, and feel the power of being able to ping again. Cc: Sasha Levin sasha.le...@oracle.com Cc: Will Deacon will.dea...@arm.com Signed-off-by: Marc Zyngier marc.zyng...@arm.com --- tools/kvm/virtio/mmio.c

Re: [RFC v2 0/2] virtio_balloon: auto-ballooning support

2013-05-16 Thread Sasha Levin
On 05/09/2013 10:53 AM, Luiz Capitulino wrote: Hi, This series is a respin of automatic ballooning support I started working on last year. Patch 2/2 contains all relevant technical details and performance measurements results. This is in RFC state because it's a work in progress. Hi

Re: [RFC PATCH 04/11] kvm tools: console: unconditionally output to any console

2013-05-06 Thread Sasha Levin
On 05/03/2013 12:09 PM, Will Deacon wrote: On Fri, May 03, 2013 at 05:02:14PM +0100, Sasha Levin wrote: On 05/03/2013 05:19 AM, Pekka Enberg wrote: On Wed, May 1, 2013 at 6:50 PM, Will Deacon will.dea...@arm.com wrote: From: Marc Zyngier marc.zyng...@arm.com Kvmtool suppresses any output

Re: [RFC PATCH 04/11] kvm tools: console: unconditionally output to any console

2013-05-03 Thread Sasha Levin
On 05/03/2013 05:19 AM, Pekka Enberg wrote: On Wed, May 1, 2013 at 6:50 PM, Will Deacon will.dea...@arm.com wrote: From: Marc Zyngier marc.zyng...@arm.com Kvmtool suppresses any output to a console that has not been elected as *the* console. While this makes sense on the input side (we want

[PATCH 2/8] kvm tools: fix vhost interaction with ctrl vq

2013-05-03 Thread Sasha Levin
We broke networking using vhost with the introduction of a ctrl vq, make sure that that queue get treated like a special case. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/virtio/net.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tools

[PATCH 1/8] kvm tools: pass virtio header size to uip_init

2013-05-03 Thread Sasha Levin
We want to make the size of the virtio net header opaque to uip. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/include/kvm/uip.h | 1 + tools/kvm/net/uip/core.c| 8 tools/kvm/net/uip/tcp.c | 2 +- tools/kvm/net/uip/udp.c | 2 +- tools/kvm/virtio/net.c

[PATCH 3/8] kvm tools: add status notification hook for virtio

2013-05-03 Thread Sasha Levin
Some devices want to know their status, use this hook to allow them to get that notification. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/include/kvm/virtio.h | 1 + tools/kvm/virtio/pci.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/tools/kvm/include/kvm

[PATCH 7/8] kvm tools: use iovec functions in uip_rx

2013-05-03 Thread Sasha Levin
Simplifies the code a lot. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/include/kvm/uip.h | 4 ++-- tools/kvm/net/uip/core.c| 47 +++-- 2 files changed, 5 insertions(+), 46 deletions(-) diff --git a/tools/kvm/include/kvm/uip.h b

[PATCH 5/8] kvm tools: use correct vnet header size for mergable rx buffers

2013-05-03 Thread Sasha Levin
vnet header size depends on whether we use mergable rx buffers. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/virtio/net.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/kvm/virtio/net.c b/tools/kvm/virtio/net.c index 2dbca09..15dbde3 100644

[PATCH 8/8] kvm tools: virtio-net mergable rx buffers

2013-05-03 Thread Sasha Levin
Support mergable rx buffers for virtio-net. This helps reduce the amount of memory the guest kernel has to allocate per rx vq. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/include/kvm/uip.h | 2 +- tools/kvm/net/uip/core.c| 2 +- tools/kvm/virtio/net.c | 42

[PATCH 6/8] kvm tools: steal iovec handling routines from the kernel

2013-05-03 Thread Sasha Levin
They're hidden inside net/core/iovec.c. It'd be nice to just link to that but they're not too generic and come with tons of net/ specific code we don't want. So we just copy over the relevant parts. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/Makefile | 1

[PATCH 4/8] kvm tools: init network devices only when the virtio driver is ready to go

2013-05-03 Thread Sasha Levin
We may need to know what features are supported before we can init the network on the host side. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/virtio/net.c | 30 -- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/tools/kvm/virtio/net.c

Re: [PATCH] kvm tools: virtio-net mergable rx buffers

2013-04-28 Thread Sasha Levin
? On Wed, Apr 24, 2013 at 5:51 AM, Sasha Levin sasha.le...@oracle.com wrote: We usually try to keep backward compatibility, but in this case mergable RX buffers are about 5 years old now, so it's safe to assume they'll be running in any guest. Unless there is a specific reason

Re: [PATCH] kvm tools: remove arbitrary minimum RAM limitation

2013-04-24 Thread Sasha Levin
On 04/24/2013 04:25 AM, Michael Ellerman wrote: On Tue, 2013-04-23 at 10:57 -0400, Sasha Levin wrote: We don't really need 64MB of RAM to boot, it's a nice default if we don't have anything else - but it's not actually required for anything: Nice, I am carrying something similar locally so I

Re: [PATCH] virtio-net: fill only rx queues which are being used

2013-04-23 Thread Sasha Levin
On 04/23/2013 03:08 AM, Michael S. Tsirkin wrote: On Mon, Apr 22, 2013 at 08:35:36PM -0400, Sasha Levin wrote: Due to MQ support we may allocate a whole bunch of rx queues but never use them. With this patch we'll safe the space used by the receive buffers until they are actually in use: sh

[PATCH] kvm tools: remove arbitrary minimum RAM limitation

2013-04-23 Thread Sasha Levin
4.2M -/+ buffers/cache:11M 8.3M Swap: 0B 0B 0B Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/builtin-run.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c index c6f5862..4d7fbf9d

Re: [PATCH] kvm tools: virtio-net mergable rx buffers

2013-04-23 Thread Sasha Levin
(off list) On 04/22/2013 08:32 PM, Sasha Levin wrote: Support mergable rx buffers for virtio-net. This helps reduce the amount of memory the guest kernel has to allocate per rx vq. One of the benefits of this is that even one virtio-net device with just one pair of vqs will require much less

[PATCH v2] virtio-net: fill only rx queues which are being used

2013-04-23 Thread Sasha Levin
0B 0B 4.1M -/+ buffers/cache: 158M 331M Swap: 0B 0B 0B Signed-off-by: Sasha Levin sasha.le...@oracle.com --- drivers/net/virtio_net.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/virtio_net.c b

Re: [PATCH] kvm tools: virtio-net mergable rx buffers

2013-04-23 Thread Sasha Levin
. Unless there is a specific reason to allow working without them I'd rather keep the code simple in this case. On Mon, Apr 22, 2013 at 5:32 PM, Sasha Levin sasha.le...@oracle.com wrote: + copied = memcpy_toiovecend(iov, in, buffer, len

Re: virtio-net mq vq initialization

2013-04-22 Thread Sasha Levin
On 04/15/2013 01:58 AM, Jason Wang wrote: Initializing them only when they're actually needed will do the trick here. I don't see so much memory allocation with qemu, the main problem I guess here is kvmtool does not support mergeable rx buffers ( does it? ). So guest must allocate 64K per

[PATCH] kvm tools: virtio-net mergable rx buffers

2013-04-22 Thread Sasha Levin
Support mergable rx buffers for virtio-net. This helps reduce the amount of memory the guest kernel has to allocate per rx vq. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/include/kvm/uip.h | 4 ++-- tools/kvm/include/kvm/util.h | 3 +++ tools/kvm/net/uip/core.c | 54

[PATCH] virtio-net: fill only rx queues which are being used

2013-04-22 Thread Sasha Levin
0B 0B 4.1M -/+ buffers/cache: 158M 331M Swap: 0B 0B 0B Signed-off-by: Sasha Levin sasha.le...@oracle.com --- drivers/net/virtio_net.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/virtio_net.c

Re: [PATCH] virtio-net: fill only rx queues which are being used

2013-04-22 Thread Sasha Levin
On 04/23/2013 12:13 AM, Rusty Russell wrote: Sasha Levin sasha.le...@oracle.com writes: Due to MQ support we may allocate a whole bunch of rx queues but never use them. With this patch we'll safe the space used by the receive buffers until they are actually in use: Idea is good

Re: [PATCH] x86: Add a Kconfig shortcut for a kvm-bootable kernel

2013-04-16 Thread Sasha Levin
On 04/16/2013 12:18 PM, Borislav Petkov wrote: On Sun, Apr 14, 2013 at 01:03:20PM +0200, Borislav Petkov wrote: On Sun, Apr 14, 2013 at 12:31:12PM +0300, Pekka Enberg wrote: I obviously support having something like this in mainline. I wonder though if we could just call this default

Re: virtio-net mq vq initialization

2013-04-14 Thread Sasha Levin
On 04/14/2013 06:01 AM, Michael S. Tsirkin wrote: On Sat, Apr 13, 2013 at 05:23:41PM -0400, Sasha Levin wrote: On 04/12/2013 07:36 AM, Rusty Russell wrote: Sasha Levin sasha.le...@oracle.com writes: On 04/11/2013 12:36 PM, Will Deacon wrote: Hello folks, Here's the latest round of ARM fixes

Re: virtio-net mq vq initialization

2013-04-14 Thread Sasha Levin
On 04/14/2013 11:53 AM, Michael S. Tsirkin wrote: Initializing them only when they're actually needed will do the trick here. Not initializing, adding the buffers. In the current spec, initialization is always done before DRIVER_OK. Yeah, that's better, but we're going to need a spec

[PATCH] virtio-spec: document virtio-9p

2013-04-14 Thread Sasha Levin
Add basic documentation for virtio-9p. I can expand more on device operation, but I don't think there's anything significant enough for the spec to be mentioned there. Please let me know if I'm wrong. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- virtio-spec.lyx | 206

Re: virtio-net mq vq initialization

2013-04-13 Thread Sasha Levin
On 04/12/2013 07:36 AM, Rusty Russell wrote: Sasha Levin sasha.le...@oracle.com writes: On 04/11/2013 12:36 PM, Will Deacon wrote: Hello folks, Here's the latest round of ARM fixes and updates for kvmtool. Most of this is confined to the arm/ subdirectory, with the exception of a fix

[PATCH] kvm tools: make virtio-net mq max queues configurable

2013-04-13 Thread Sasha Levin
multiqueuing. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/include/kvm/virtio-net.h | 1 + tools/kvm/virtio/net.c | 19 +-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/tools/kvm/include/kvm/virtio-net.h b/tools/kvm/include/kvm/virtio

Re: [PATCH 0/5] Usual batch of random ARM fixes for kvmtool

2013-04-11 Thread Sasha Levin
On 04/11/2013 12:36 PM, Will Deacon wrote: Without multi-queue, we can boot Debian Wheezy to a prompt in 38MB. With the new changes, that increases to 170MB! Any chance we can try and tackle this regression please? I keep getting bitten by the OOM killer :( That's definitely unwanted. I'll

Re: kvmtool : [PATCH] PowerPc : Fix compilation for ppc64

2013-04-11 Thread Sasha Levin
On 04/11/2013 12:53 PM, Prerna Saxena wrote: On 04/10/2013 09:05 PM, Sasha Levin wrote: Hm, what would LD create before this patch? I thought that the default would be to create a binary that corresponds to the platform you're building in, so if you build on ppc64 you'd get ppc64 binaries

virtio-net mq vq initialization (was: [PATCH 0/5] Usual batch of random ARM fixes for kvmtool)

2013-04-11 Thread Sasha Levin
On 04/11/2013 12:36 PM, Will Deacon wrote: Hello folks, Here's the latest round of ARM fixes and updates for kvmtool. Most of this is confined to the arm/ subdirectory, with the exception of a fix to the virtio-mmio vq definitions due to the multi-queue work from Sasha. I'm not terribly

[PATCH 1/3] kvm tools: Increase amount of possible interrupts per PCI device

2013-04-08 Thread Sasha Levin
We've limited the amount of interrupts per PCI device to be the maximum amount of VQs. Now that the maximum amount of VQs has increased, time to increase this as well. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/include/kvm/virtio-pci.h | 2 +- 1 file changed, 1 insertion

[PATCH 2/3] kvm-tools: support virtio-net ctrl queue

2013-04-08 Thread Sasha Levin
We don't need much out of it at this point, but we will need it for virtio-net mq patch. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/virtio/net.c | 34 -- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/tools/kvm/virtio/net.c b

[PATCH 3/3] kvm tools: virtio-net multiqueue support

2013-04-08 Thread Sasha Levin
: ethtool -L eth0 combined 2 Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/virtio/net.c | 155 +++-- 1 file changed, 84 insertions(+), 71 deletions(-) diff --git a/tools/kvm/virtio/net.c b/tools/kvm/virtio/net.c index 253d167

Re: [PATCH v4 3/6] KVM: Initialize irqfd from kvm_init().

2013-04-02 Thread Sasha Levin
On 02/28/2013 04:22 AM, Cornelia Huck wrote: Currently, eventfd introduces module_init/module_exit functions to initialize/cleanup the irqfd workqueue. This only works, however, if no other module_init/module_exit functions are built into the same module. Let's just move the initialization

[PATCH] kvm tools: remove unneeded checks in qcow code

2012-12-20 Thread Sasha Levin
We already know q!=NULL at that point, no need to retest. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/disk/qcow.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/kvm/disk/qcow.c b/tools/kvm/disk/qcow.c index ee2992e..64a2550 100644 --- a/tools

[PATCH] kvm tools: correctly compare pointer with NULL instead of 0

2012-12-20 Thread Sasha Levin
Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/hw/pci-shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/kvm/hw/pci-shmem.c b/tools/kvm/hw/pci-shmem.c index 00e5d93..ec3f771 100644 --- a/tools/kvm/hw/pci-shmem.c +++ b/tools/kvm/hw/pci-shmem.c

[PATCH] kvm tools: remove unneeded check from disk code

2012-12-20 Thread Sasha Levin
We already know 'disk' is non-null. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/disk/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/kvm/disk/core.c b/tools/kvm/disk/core.c index dd59751..4e9bda0 100644 --- a/tools/kvm/disk/core.c +++ b/tools

Re: [PATCH v2 1/8] rbtree: include linux/compiler.h for definition of __always_inline

2012-11-22 Thread Sasha Levin
On 11/22/2012 10:58 AM, Will Deacon wrote: Commit 29fc7c5a4f516d388fb6e1f6d24bfb04b8093e54 upstream. rb_erase_augmented() is a static function annotated with __always_inline. This causes a compile failure when attempting to use the rbtree implementation as a library (e.g. kvm tool):

Re: [RFC PATCH 13/16] kvm tools: keep track of registered memory banks in struct kvm

2012-11-20 Thread Sasha Levin
On 11/20/2012 12:15 PM, Will Deacon wrote: Hi Sasha, On Tue, Nov 13, 2012 at 04:37:38AM +, Sasha Levin wrote: On 11/12/2012 06:57 AM, Will Deacon wrote: struct kvm { struct kvm_arch arch; struct kvm_config cfg; @@ -49,6 +56,7 @@ struct kvm { u64

[PATCH] kvm tools: disable LTO by default

2012-11-19 Thread Sasha Levin
A bug only seen with LTO enabled was reported by Ron Minnich. Since the issue appears to be a linker issue, we disable LTO by default until it's more stable. We can still run LTO builds by setting LTO=1. Reported-by: Ron Minnich rminn...@gmail.com Signed-off-by: Sasha Levin sasha.le

Re: [RFC PATCH 13/16] kvm tools: keep track of registered memory banks in struct kvm

2012-11-13 Thread Sasha Levin
On 11/13/2012 07:16 AM, Will Deacon wrote: On Tue, Nov 13, 2012 at 04:37:38AM +, Sasha Levin wrote: On 11/12/2012 06:57 AM, Will Deacon wrote: +struct kvm_mem_bank { + struct list_headlist; + unsigned long guest_phys_addr; + void*host_addr

Re: [RFC PATCH 08/16] kvm tools: add generic device registration mechanism

2012-11-12 Thread Sasha Levin
On 11/12/2012 06:57 AM, Will Deacon wrote: PCI devices are currently registered into the pci_devices array via the pci__register function, which can then be indexed later by architecture code to construct device tree nodes. For MMIO devices, there is no such utility. Rather than invent a

Re: [RFC PATCH 13/16] kvm tools: keep track of registered memory banks in struct kvm

2012-11-12 Thread Sasha Levin
On 11/12/2012 06:57 AM, Will Deacon wrote: When registering memory banks for a guest, it is useful to keep the range information around for translating between guest and host address spaces. This patch adds a list of kvm_mem_bank structures to struct kvm, which is updated when a new bank is

Re: [RFC PATCH 14/16] kvm tools: teach guest_flat_to_host about memory banks starting above 0

2012-11-12 Thread Sasha Levin
On 11/12/2012 06:57 AM, Will Deacon wrote: Running a guest with multiple banks of memory based above 0 causes the guest_flat_to_host address conversion to fail, as it is assumed that guest memory addresses are offset linearly from 0. This patch changes the translation function so that the

Re: [PATCH v11] kvm: notify host when the guest is panicked

2012-11-09 Thread Sasha Levin
On Mon, Nov 5, 2012 at 8:58 PM, Hu Tao hu...@cn.fujitsu.com wrote: But in the case of panic notification, more dependency means more chances of failure of panic notification. Say, if we use a virtio device to do panic notification, then we will fail if: virtio itself has problems, virtio for

Re: [PATCH v11] kvm: notify host when the guest is panicked

2012-10-30 Thread Sasha Levin
On Tue, Oct 30, 2012 at 9:48 PM, Wen Congyang we...@cn.fujitsu.com wrote: At 10/31/2012 09:12 AM, Marcelo Tosatti Wrote: It has been asked earlier why a simple virtio device is not usable for this (with no response IIRC). 1. We can't use virtio device when the kernel is booting. So the issue

[PATCH] kvm tools: don't crash on virtio MSI-X reset

2012-10-29 Thread Sasha Levin
Handle VIRTIO_MSI_NO_VECTOR by not trying to use it as a valid vector. We still need to remove the GSI and everything, but this is enough to prevent crashes and keep everything working properly for now. Reported-by: Kirill A. Shutemov kirill.shute...@linux.intel.com Signed-off-by: Sasha Levin

Re: [RFC 2/3] lockdep: be nice about compiling from userspace

2012-10-25 Thread Sasha Levin
On 10/25/2012 04:05 AM, Ingo Molnar wrote: * Sasha Levin sasha.le...@oracle.com wrote: We can rather easily make lockdep work from userspace, although 3 issues remain which I'm not sure about: - Kernel naming - we can just wrap init_utsname() to return kvmtool related utsname

Re: [PATCH 1/5] kvm tools: check ioctl return value for msi signal

2012-10-25 Thread Sasha Levin
On Thu, Oct 25, 2012 at 5:15 AM, William Dauchy will...@gandi.net wrote: On Oct25 10:01, Pekka Enberg wrote: Is this something that happens on your machine? I wonder if it makes more sense to return the error from virtio_pci__signal_vq() and virtio_pci__signal_config() and make the callers

Re: [RFC 2/3] lockdep: be nice about compiling from userspace

2012-10-25 Thread Sasha Levin
On 10/25/2012 01:06 PM, Ingo Molnar wrote: * Sasha Levin sasha.le...@oracle.com wrote: Yes, we can wrap both static_obj() and debug_show_all_locks() with #ifndefs and let kvmtool provide it's own version of those two. Only static_obj() - I see no immediate reason why you shouldn't

Re: [PATCH 2/5] kvm tools: use the correct config vector interrupt

2012-10-25 Thread Sasha Levin
]); + virtio_pci__signal_msi(kvm, vpci, vpci-config_vector); else kvm__irq_trigger(kvm, vpci-config_gsi); } else { Sasha? Indeed, we tried signaling the config vector by signaling vq0, woops. Acked-by: Sasha Levin levinsasha...@gmail.com

Re: [BUG] lkvm crash on crashkernel boot

2012-10-25 Thread Sasha Levin
On Thu, Oct 25, 2012 at 8:16 AM, Kirill A. Shutemov kirill.shute...@linux.intel.com wrote: On Thu, Oct 25, 2012 at 10:17:27AM +0300, Pekka Enberg wrote: On Wed, Oct 24, 2012 at 6:27 PM, Kirill A. Shutemov kirill.shute...@linux.intel.com wrote: Hi, I've tried to play with kexec using lkvm.

[PATCH 2/2] kvm tools: name threads

2012-10-24 Thread Sasha Levin
Give threads a meaningful name. This makes debugging much easier, and everything else much prettier. Suggested-by: Ingo Molnar mi...@kernel.org Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/disk/core.c | 2 ++ tools/kvm/include/kvm/kvm.h | 7 +++ tools/kvm/ioeventfd.c

[PATCH 1/2] kvm tools: use correct init group for the PCI controller

2012-10-24 Thread Sasha Levin
PCI controller is what deals with PCI devices, and it depends on vcpus being there, so it should be in the dev_base group. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/kvm/pci.c b/tools/kvm

[RFC 1/3] kvm tools: use mutex abstraction instead of pthread mutex

2012-10-24 Thread Sasha Levin
We already have something to wrap pthread with mutex_[init,lock,unlock] calls. This patch creates a new struct mutex abstraction and moves everything to work with it. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/hw/serial.c | 10 +- tools/kvm/include/kvm

[RFC 2/3] lockdep: be nice about compiling from userspace

2012-10-24 Thread Sasha Levin
sounds wrong as well. - debug_show_all_locks() - we don't actually call it from userspace yet, but I think we might want to, so I'm not sure how to make it pretty using existing kernel code. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- kernel/lockdep.c | 9 +++-- 1 file changed, 7

[RFC 3/3] kvm tools: use lockdep to detect locking issues

2012-10-24 Thread Sasha Levin
[0x40c411] ./vm(lock_acquire+0x3e)[0x426eee] ./vm[0x41219e] ./vm(kvm_cmd_run+0x5a)[0x426dda] ./vm(handle_command+0x41)[0x420611] /lib64/libc.so.6(__libc_start_main+0xf5)[0x7fd640ab76c5] ./vm[0x40985d] Signed-off-by: Sasha Levin sasha.le...@oracle.com --- tools/kvm/Makefile| 14

Re: [PATCH 3/5] kvm tools: correctly handle mem ballooning

2012-10-24 Thread Sasha Levin
This one was actually correct originally. When we inflate (-i) the balloon we increase num_pages, which is a counter of how many pages the balloon has. Thanks, Sasha On Wed, Oct 24, 2012 at 8:51 AM, William Dauchy will...@gandi.net wrote: from the virtio_balloon.h: num_pages is the number of

[PATCH] kvm, async_pf: exit idleness when handling KVM_PV_REASON_PAGE_NOT_PRESENT

2012-10-19 Thread Sasha Levin
] [81139c25] ? prepare_to_wait+0x25/0x90 [ 732.790032] [810a3a66] do_async_page_fault+0x56/0xa0 [ 732.790032] [83a6a6e8] async_page_fault+0x28/0x30 Signed-off-by: Sasha Levin sasha.le...@oracle.com --- arch/x86/kernel/kvm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git

  1   2   3   4   5   6   7   8   9   10   >