Re: [PATCH 0/3] kvmtool: tiny init fox x86_64

2015-10-22 Thread Pekka Enberg

Hi Oleg,

On 10/19/2015 01:59 PM, Oleg Nesterov wrote:

Yesterday I discovered kvmtool and it looks really cool! Thanks!
Looks like, it does exactly what I need.

But the static /virt/init doesn't look good. This series lessens
the size of lkvm binary from 1045952 to 196200 bytes on x86_64,
but this is minor. I want to write my /virt/init in shell or perl
and this change can help.

I don't really know who should be cc'ed, I've picked some names
from git-log guest/init.c.


Will maintains the standalone kvmtool.git tree.

The series looks good to me:

Acked-by: Pekka Enberg <penb...@kernel.org>

- Pekka
--
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: stand-alone kvmtool

2015-03-01 Thread Pekka Enberg

On 2/26/15 1:02 PM, Alex Bennée wrote:

If you can have it all it would be nice to preserve buildability all
through your history for bisecting (and the moon on a stick please ;-)

Is the dependency on the kernel sources something that has been stable
over the projects history or something that's been declining/increasing
over time?


AFAICT, it's been mostly stable after the initial sweep to use 
kernel-provided data structures such as lists and rbtrees.


- Pekka
--
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: stand-alone kvmtool

2015-02-23 Thread Pekka Enberg

Hi,

On 2/18/15 5:50 PM, Will Deacon wrote:

Thanks for doing this. Since it looks unlikely that kvmtool will ever be
merged back into the kernel tree, it makes sense to cut the dependency
in my opinion.


I am certainly OK with a standalone repository which preserves the 
history. Will, would you like to take over the proposed new repository 
and put it somewhere on git.kernel.org, perhaps?


- Pekka
--
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 2/5] kvmtool: ARM64: Fix compile error for aarch64

2014-08-28 Thread Pekka Enberg

On 08/07/2014 12:12 PM, Will Deacon wrote:

Ok. Pekka, could you merge in 3.16 to the kvmtool master branch please?
You'll need my patch below to resolve some ARM build fallout.


Done.

- Pekka
--
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] KVM: x86: fix TSC matching

2014-08-26 Thread Pekka Enberg
On Sun, Aug 17, 2014 at 11:54 AM, Paolo Bonzini pbonz...@redhat.com wrote:
 Il 15/08/2014 18:54, Marcelo Tosatti ha scritto:

 Ping on integration.

 It's been in kvm/next for a while, and is now in Linus's tree:

Does this make sense for -stable too?

- Pekka
--
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 v3 00/12] kvm tools: Misc patches (mips support)

2014-05-30 Thread Pekka Enberg

On 05/28/2014 11:08 PM, Andreas Herrmann wrote:

Hi,

This is v3 of my patch set to run lkvm on MIPS.

It's rebased on v3.13-rc1-1436-g1fc83c5 of
git://github.com/penberg/linux-kvm.git



Applied, thanks!
--
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 v2 00/12] kvm tools: Misc patches (mips support)

2014-05-20 Thread Pekka Enberg

On 05/20/2014 02:20 PM, James Hogan wrote:

I don't know what Pekka's policy is for kvm tools, but to avoid
confusion I'd like to make clear that this patchset depends on a KVM
implementation (KVM_VM_TYPE==1 for VZ) which hasn't been accepted into
the mainline kernel yet.


Is that something that is likely to end up in mainline Linux in one form 
or another? If yes, we can merge early like we did with arm64.


- Pekka
--
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 v3 0/9] kvmtool: handle guests of a different endianness

2014-05-03 Thread Pekka Enberg

On 4/24/14 9:17 PM, Marc Zyngier wrote:

This patch series adds some infrastructure to kvmtool to allow a BE
guest to use virtio-mmio on a LE host, provided that the architecture
actually supports such madness.

Not all the backend have been converted, only those I actually cared
about. Converting them is pretty easy though, and will be done if the
method is deemed acceptable.

This has been tested on both arm and arm64 (I use this on a daily
basis to test BE code). The corresponding kernel changes have all been
merged.


Will, comments? I'm OK with this.

- Pekka
--
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 0/2] kvm tools: fix vhost-net broken since fa7226f88012713a73d0cba4955444ea109e9458

2013-11-04 Thread Pekka Enberg

On 11/01/2013 04:50 AM, Ying-Shiuan Pan wrote:

These patch series fix 2 vhost-net problems. There were 2 problems after
commit fa7226f88012713a73d0cba4955444ea109e9458.
(1) vhost-net requires tap_fd for VHOST_SET_BACKEND, but opening tap device
was postponed to VIRTIO_CONFIG_S_DRIVER_OK. The wrong order of initialization
caused vhost-net used a invalid tap_fd for ioctl.
(2) virtio-net of kvm tool started to support mergeable rx buffers since
commit 8c2684de6fb1afc95321e7e0f30550acdcc08186, but kvm tool did not tell
vhost-net that he is using mergeable rx buffers.

test script:
$ sudo ./lkvm run --kernel ../../arch/x86/boot/bzImage --no-dhcp --net 
mode=tap,vhost=1

Ying-Shiuan Pan (2):
   kvm tools: virtio-net has to open tap device before vhost-net init.
   kvm tools: vhost-net: setup mergeable rx buffers feature

  tools/kvm/virtio/net.c | 54 +++---
  1 file changed, 29 insertions(+), 25 deletions(-)



Asias, Sasha?
--
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: lkvm: virtio-net-rx general protection error

2013-10-21 Thread Pekka Enberg

On 10/21/13 1:35 PM, Milan Kocian wrote:

hi,

sorry for writing it directly to you but I didn't find better recipient.
Does exist some mailing-list about lkvm?

I found the crash in virtio-net-rx thread (I can reproduce it every time
by 'aptitude update' in VM):

traps: virtio-net-rx[28933] general protection ip:7f00dda3d107 sp:7f00c58f4de8 
error:0 in libc-2.17.so[7f00dd90f000+1a2000]

gdb backtrace:

(gdb) bt
#0  0x7fb6a548e107 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x0041259c in memcpy_toiovecend (iov=0x7fb68d346ea0, 
iov@entry=0x7fb68d345e90,
 kdata=optimized out, kdata@entry=0x7fb68d346e90 , offset=optimized out, 
len=optimized out)
 at util/iovec.c:70
#2  0x0040c66d in virtio_net_rx_thread (p=0x23688a0) at virtio/net.c:117
#3  0x7fb6a5b2ee0e in start_thread () from 
/lib/x86_64-linux-gnu/libpthread.so.0
#4  0x7fb6a54489ed in clone () from /lib/x86_64-linux-gnu/libc.so.6


I tried to add some printf to diagnose it but it isn't clear to me:

virtio_net_rx_thread: before memcpy_toiovecend; copied: 0, len: 18890, iovsize: 
4096, realiovsize: 4096
memcpy_toiovecend: offset: 0, len: 4096
memcpy_toiovecend: iov_len: 4096, len: 4096
virtio_net_rx_thread: before memcpy_toiovecend; copied: 4096, len: 18890, 
iovsize: 4096, realiovsize: 4096
memcpy_toiovecend: offset: 4096, len: 4096
memcpy_toiovecend: iov_len: 4096, len: 4096
memcpy_toiovecend: iov_len: 0, len: 4096
memcpy_toiovecend: iov_len: 0, len: 4096
.
N x memcpy_toiovecend: iov_len: 0, len: 4096
.
memcpy_toiovecend: iov_len: 0, len: 4096
memcpy_toiovecend: iov_len: 0, len: 4096
memcpy_toiovecend: iov_len: 1519143547641528320, len: 4096
memcpy_toiovecend: iov_len: 193827583623176, len: 4096
./runlkvm.sh: line 2: 16090 Segmentation fault


IMHO problem come when received len size is bigger than maximum
of the dst iovec (realiovsize). Only iovec size is copied and in the next
run isn't place to copy the rest of len size.

So solution may be increase dst iovec size or send data in dst iovec
to user (but i don't know how, I am not virtio expert :-)).


I'm CC'ing Asias, Sasha and others.

Pekka
--
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: lkvm issue: --network mode=user,trans=mmio doesn't work

2013-10-12 Thread Pekka Enberg

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 I should do it.


Sure, you can report problems to me and I'll do my best to
try to get them sorted out.


I'm using afdf92030c7c43b0f9b32b7edbe07ac3b13780f1 from
git://github.com/penberg/linux-kvm.git and Linux kernel 3.2.51:

config-3.2.51 (42 KB)
https://mega.co.nz/#!hgxB1TDJ!SdbX-jp_yr8E6EUJl7t7Tzrh1p4qKxkTHieoss8yu_Y
bzImage-3.2.51 (2.0 MB)
https://mega.co.nz/#!5lBVmDZL!WpPRWA7ZflevBIPPNGNM_FkkY-ErBNQMoEbw0XePi5I

Config:

$ grep -E 'VIRTIO|MMIO' .config
CONFIG_NET_9P_VIRTIO=y
CONFIG_VIRTIO_BLK=y
CONFIG_VIRTIO_NET=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_HW_RANDOM_VIRTIO=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_RING=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_MMIO=y
CONFIG_HAVE_MMIOTRACE_SUPPORT=y

I'm running `lkvm run --network mode=user,trans=mmio', and it fails to
create the eth0 device (`cat /proc/net/dev' doesn't show the device).
With `lkvm run --network mode=user' everything just works.

I have also tried kernels 3.0.99, 3.4.65 an 3.10.15, but they seem to
fail the same way.

Am I using it correctly?


Asias, Sasha, is mmio transport supported by virtio networking?

Pekka
--
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: lkvm issue: --console virtio keyboard doesn't work

2013-10-12 Thread Pekka Enberg

On 10/12/13 11:09 AM, Péter Szabó wrote:

I'm using afdf92030c7c43b0f9b32b7edbe07ac3b13780f1 from
git://github.com/penberg/linux-kvm.git and Linux kernel 3.2.51:

config-3.2.51 (42 KB)
https://mega.co.nz/#!hgxB1TDJ!SdbX-jp_yr8E6EUJl7t7Tzrh1p4qKxkTHieoss8yu_Y
bzImage-3.2.51 (2.0 MB)
https://mega.co.nz/#!5lBVmDZL!WpPRWA7ZflevBIPPNGNM_FkkY-ErBNQMoEbw0XePi5I

Config:

$ grep -E 'VIRTIO|MMIO' .config
CONFIG_NET_9P_VIRTIO=y
CONFIG_VIRTIO_BLK=y
CONFIG_VIRTIO_NET=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_HW_RANDOM_VIRTIO=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_RING=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_MMIO=y
CONFIG_HAVE_MMIOTRACE_SUPPORT=y

I'm running `lkvm run --console virtio'. I see all the kernel messages
and also the shell prompt (sh-2.05b#), but whatever I type gets
ignored, and the shell doesn't get it. Without the `--console virtio'
flag it works fine.

Am I using it incorrectly?


Virtio console should work but I wonder if your guest kernel
is too old. Sasha, Asias?

Pekka
--
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 2/2] kvm tools: arm: add support for ARM Cortex-A7

2013-09-30 Thread Pekka Enberg
On Mon, Sep 30, 2013 at 12:38 PM, Will Deacon will.dea...@arm.com wrote:
 However, we should hold off applying this to kvmtool until
 KVM_ARM_TARGET_CORTEX_A7 is defined in the kernel sources which it is
 shipped with. Do you have an ETA on this change going into the mainline
 kernel?

 (in the meantime, I'm happy to stage stuff in my kvmtool/arm tree).

OK, I'll just wait for you or someone else to resend at a later time.

   Pekka
--
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


[ANNOUNCE] OSv, an new operating system for the cloud, v0.01

2013-09-16 Thread Pekka Enberg
Hello,

We're proud to announce release 0.01 of OSv, a new operating system
for running applications on virtual machines. OSv is free software,
released under the BSD license, and you can find it in
https://github.com/cloudius-systems/osv and http://www.osv.io.

To build and run OSv under KVM/QEMU, first grab the latest source code
from Github:

  git clone g...@github.com:cloudius-systems/osv.git

Then install prerequisite packages:

   On Fedora:
 yum install ant autoconf automake boost-static gcc-c++ genromfs \
libvirt libtool zfs-fuse flex bison

   On Debian:
 apt-get install libboost-all-dev genromfs zfs-fuse autoconf

Make sure the zfs-fuse daemon is running:

   On Fedora:
 sudo systemctl start zfs-fuse.service
 sudo systemctl enable zfs-fuse.service # to have it start on reboot

   On Debian the daemon should be started automatically.

Fetch git submodules:

git submodule update --init

Finally, build OSv:

  make external all

You can then start a OSv guest under KVM/QEMU:

  sudo ./scripts/run.py -nv -m 2G

You can SSH into the guest with:

  ssh admin@192.168.122.89 # password: admin

The management web UI is at address:

  http://192.168.122.89:8080/

Alternatively, you can use prebuilt QEMU QCOW2 images of the release.
Instructions how to do that are on our Wiki:

https://github.com/cloudius-systems/osv/wiki/Running-OSv-under-KVM-QEMU

That's it!

Pekka
--
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] kvm tools: virtio-mmio: init_ioeventfd should use MMIO for ioeventfd__add_event()

2013-09-04 Thread Pekka Enberg

On 8/30/13 4:58 PM, Ying-Shiuan Pan wrote:

From: Ying-Shiuan Pan yingshiuan@gmail.com

This patch fixes a bug that vtirtio_mmio_init_ioeventfd() passed a wrong
value when it invoked ioeventfd__add_event(). True value of 2nd parameter
indicates the eventfd uses PIO bus which is used by virito-pci, however,
for virtio-mmio, the value should be false.

Signed-off-by: Ying-Shiuan Pan ys...@itri.org.tw


Will, Marc? It would probably be good to change the two boolean
arguments into one flags argument to avoid future bugs.


---
  tools/kvm/virtio/mmio.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/kvm/virtio/mmio.c b/tools/kvm/virtio/mmio.c
index afa2692..3838774 100644
--- a/tools/kvm/virtio/mmio.c
+++ b/tools/kvm/virtio/mmio.c
@@ -55,10 +55,10 @@ static int virtio_mmio_init_ioeventfd(struct kvm *kvm,
 * Vhost will poll the eventfd in host kernel side,
 * no need to poll in userspace.
 */
-   err = ioeventfd__add_event(ioevent, true, false);
+   err = ioeventfd__add_event(ioevent, false, false);
else
/* Need to poll in userspace. */
-   err = ioeventfd__add_event(ioevent, true, true);
+   err = ioeventfd__add_event(ioevent, false, true);
if (err)
return err;
  


--
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 0/3] kvm tools: remove periodic tick

2013-09-04 Thread Pekka Enberg

On 9/3/13 9:10 PM, Jonathan Austin wrote:

This patch series removes kvm tool's periodic tick function in favour of a
thread that blocks waiting for input. The paths used for handling input are the
same as when using a periodic tick, but they're not called unless there is
actually input to be processed.

On extremely slow platforms (eg FPGAs) the overhead involved in handling the
timer tick means it is possible to make progress at all inside the VM! This
patch addresses this problem.

In doing this there are a number of small tidyups/cleanups that made sense, too:
- Use a #define for maximum number of term devices
- Refactor the method by which the virtio console handles input in order not to
   - handle input too early
   - handle input multiple times if the worker thread didn't immediately start
 work.
- Rename the periodic_poll function to reflect the functional change

Jonathan Austin (3):
   kvm tools: use #define for maximum number of terminal devices
   kvm tools: remove periodic tick in favour of a polling thread
   kvm tools: stop virtio console doing unnecessary input handling

  tools/kvm/arm/kvm.c |2 +-
  tools/kvm/builtin-run.c |   13 ---
  tools/kvm/include/kvm/kvm.h |2 +-
  tools/kvm/kvm.c |   50 ---
  tools/kvm/powerpc/kvm.c |2 +-
  tools/kvm/term.c|   38 +---
  tools/kvm/virtio/console.c  |   23 +---
  tools/kvm/x86/kvm.c |2 +-
  8 files changed, 59 insertions(+), 73 deletions(-)


Seems reasonable to me. Marc, Will?

Pekka

--
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] kvm tools: virtio-mmio: init_ioeventfd should use MMIO for ioeventfd__add_event()

2013-09-04 Thread Pekka Enberg
On Wed, Sep 4, 2013 at 1:07 PM, Will Deacon will.dea...@arm.com wrote:
 Like this? It gets a bit confusing, because there is a KVM_IOEVENTFD_FLAG_*
 namespace as part of the kernel KVM API, but which doesn't have the flags we
 need (e.g. userspace polling).

Looks good. I applied the fix so can you please redo this on top of tip?
--
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] kvm tools: ioeventfd: replace bool parameters to __add_event with flags

2013-09-04 Thread Pekka Enberg
On Wed, Sep 4, 2013 at 1:27 PM, Will Deacon will.dea...@arm.com wrote:
 A recent fix to virtio MMIO (72a7541ce305 [kvm tools: virtio-mmio:
 init_ioeventfd should use MMIO for ioeventfd__add_event()]) highlighted
 the confusing parameters expected by ioeventfd__add_event.

 As per Pekka's suggestion, replace the bool parameters to this function
 with a single `flags' argument instead.

 Cc: Ying-Shiuan Pan yingshiuan@gmail.com
 Signed-off-by: Will Deacon will.dea...@arm.com

Applied, thanks a lot!
--
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 v2 2/3] kvm tools: remove periodic tick in favour of a polling thread

2013-09-04 Thread Pekka Enberg
Hi Jonathan,

On Wed, Sep 4, 2013 at 4:25 PM, Jonathan Austin jonathan.aus...@arm.com wrote:
 Currently the only use of the periodic timer tick in kvmtool is to
 handle reading from stdin. Though functional, this periodic tick can be
 problematic on slow (eg FPGA) platforms and can cause low interactivity or
 even stop the execution from progressing at all.

 This patch removes the periodic tick in favour of a dedicated thread blocked
 waiting for input from the console. In order to reflect the new behaviour,
 the old 'kvm__arch_periodic_tick' function is renamed to 
 'kvm__arch_read_term'.

 Signed-off-by: Jonathan Austin jonathan.aus...@arm.com
 Acked-by: Marc Zyngier marc.zyng...@arm.com

I'm afraid this breaks top on x86. Does it work on arm?

When I start it up, it seems as if it's stuck but whenever I press a
key, it prints
part of the screen.

Pekka
--
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 v2 2/3] kvm tools: remove periodic tick in favour of a polling thread

2013-09-04 Thread Pekka Enberg
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 8250 emulation I'd booted to a prompt but didn't actually
 test top...

 I'm looking in to fixing this now... Looks like I need to find the right place
 from which to call serial8250_flush_tx now that it isn't getting called every 
 tick.

 I've done the following and it works fixes 'top' with serial8250:
 ---8--
 diff --git a/tools/kvm/hw/serial.c b/tools/kvm/hw/serial.c
 index 931067f..a71e68d 100644
 --- a/tools/kvm/hw/serial.c
 +++ b/tools/kvm/hw/serial.c
 @@ -260,6 +260,7 @@ static bool serial8250_out(struct ioport *ioport, struct 
 kvm *kvm, u16 port,
 dev-lsr = ~UART_LSR_TEMT;
 if (dev-txcnt == FIFO_LEN / 2)
 dev-lsr = ~UART_LSR_THRE;
 +   serial8250_flush_tx(kvm, dev);
 } else {
 /* Should never happpen */
 dev-lsr = ~(UART_LSR_TEMT | UART_LSR_THRE);

 -8---

 I guess it's a shame that we'll be printing each character (admittedly the 
 rate will always be
 relatively low...) rather than flushing the buffer in a batch. Without a 
 timer, though, I'm
 not sure I see a better option - every N chars doesn't seem like a good one 
 to me.

 If you think that looks about right then I'll fold that in to the patch 
 series, probably also
 removing the call to serial8250_flush_tx() in serial8250__receive.

Yeah, looks good to me and makes top work again.

Pekka
--
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] kvm tools: powerpc: Fix init order for xics

2013-08-27 Thread Pekka Enberg
On Tue, Aug 20, 2013 at 6:28 AM, Michael Neuling mi...@neuling.org wrote:
 xics_init() assumes kvm-nrcpus is already setup.  kvm-nrcpus is setup
 in kvm_cpu_init()

 Unfortunately xics_init() and kvm_cpu_init() both use base_init().  So
 depending on the order randomly determined by the compiler, xics_init()
 may initialised see kvm-nrcpus as 0 and not setup any of the icp VCPU
 pointers.  This manifests itself later in boot when trying to raise an
 IRQ resulting in a null pointer deference/segv.

 This moves xics_init() to use dev_base_init() to ensure it happens after
 kvm_cpu_init().

 Signed-off-by: Michael Neuling mi...@neuling.org

Applied, thanks a lot!
--
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] kvm tools: powerpc: Fix init order for xics

2013-08-27 Thread Pekka Enberg
On Tue, Aug 20, 2013 at 6:28 AM, Michael Neuling mi...@neuling.org wrote:
 xics_init() assumes kvm-nrcpus is already setup.  kvm-nrcpus is setup
 in kvm_cpu_init()

 Unfortunately xics_init() and kvm_cpu_init() both use base_init().  So
 depending on the order randomly determined by the compiler, xics_init()
 may initialised see kvm-nrcpus as 0 and not setup any of the icp VCPU
 pointers.  This manifests itself later in boot when trying to raise an
 IRQ resulting in a null pointer deference/segv.

 This moves xics_init() to use dev_base_init() to ensure it happens after
 kvm_cpu_init().

 Signed-off-by: Michael Neuling mi...@neuling.org

Applied, thanks a lot!
--
To unsubscribe from this list: send the line unsubscribe kvm-ppc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] kvm tools: powerpc: Implement system-reboot RTAS call

2013-08-13 Thread Pekka Enberg
On Tue, Aug 13, 2013 at 8:48 AM, Michael Ellerman
mich...@ellerman.id.au wrote:
 On some powerpc systems, reboot is implemented by an RTAS call by the
 name of system-reboot. Currently we don't implement it in kvmtool,
 which means instead the guest prints an error and spins.

 This is particularly annoying because when the guest kernel panics it
 will try to reboot, and end up spinning in the guest.

 We can't implement reboot properly, ie. causing a reboot, but it's still
 preferable to implement it as halt rather than not implementing it at
 all.

 Signed-off-by: Michael Ellerman mich...@ellerman.id.au

Applied, thanks Michael!
--
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] kvm tools: Fix build of guest init with biarch powerpc compilers

2013-08-10 Thread Pekka Enberg
On Wed, Aug 7, 2013 at 11:46 AM, Michael Ellerman
mich...@ellerman.id.au wrote:
 On powerpc we build kvmtool as a 64bit binary. We do that by setting
 -m64 in our CFLAGS. For most things we just call $(CC) and it passes
 that info onto the linker.

 However there is one place where we explicitly call the linker, in the
 build of guest/init - and in that case we need to tell the linker to
 build 64bit.

 We have gotten away with this so far because we have been building with
 a 64bit only toolchain. However if you build with a biarch toolchain,
 which generally defaults to 32bit, we fail to link.

 The fix is to defined LDFLAGS appropriately and pass it to LD.

 Tested on powerpc and x86-64.

 Signed-off-by: Michael Ellerman mich...@ellerman.id.au

Applied, thanks a lot!
--
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] kvm tools: plug race between uip_init and virtio_net_rx_thread

2013-08-10 Thread Pekka Enberg
On Tue, Aug 6, 2013 at 9:13 PM, Marc Zyngier marc.zyng...@arm.com wrote:
 When fa7226f (kvm tools: init network devices only when the virtio
 driver is ready to go) was introduced, a tiny detail was overlooked:

 - Initialization of the uip layer is now coming in very late (only
   when the guest driver says it is ready).
 - In parallel, the rx thread is created quite early (as soon as the
   queues are allocated).

 This cause the rx thread to call uip_rx, which calls uip_buf_get_used,
 which starts to use buf_lock mutex/the buf_used_cond, which haven't
 been initialized yet. Tears and devastation follow, not to mention a
 certain lack of network connectivity for the unsuspecting guest.

 The (not so pretty) fix is to split uip_init:
 - uip_static_init: initialize the lists, mutexes and conditions,
   called from virtio_net__init_one.
 - uip_init: perform the dynamic memory allocations, called from
   notify_status.

 This allows the network to be safely initialized.

 Cc: Sasha Levin sasha.le...@oracle.com
 Cc: Pekka Enberg penb...@kernel.org
 Cc: Will Deacon will.dea...@arm.com
 Signed-off-by: Marc Zyngier marc.zyng...@arm.com

Applied, thanks a lot!
--
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 v2] kvm tools: fix boot of guests with more than 4gb of ram

2013-07-09 Thread Pekka Enberg

On 07/08/2013 01:58 PM, Will Deacon wrote:

Hi guys,

On Mon, Jul 08, 2013 at 09:12:26AM +0100, Pekka Enberg wrote:

On Sun, Jul 7, 2013 at 7:00 PM, Sasha Levin sasha.le...@oracle.com 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' is a 32bit integer, so when multiplying
it by page size to get the actual page will cause an overflow if
the pfn referred to a memory area above 4gb.

Signed-off-by: Sasha Levin sasha.le...@oracle.com


Will, Michael, Asias, good to merge?


I'm at a conference at the moment, so unable to test this patch, but it
looks simple and correct enough to me:

   Acked-by: Will Deacon will.dea...@arm.com


Applied, thanks a lot!

Pekka

--
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 v2] kvm tools: fix boot of guests with more than 4gb of ram

2013-07-08 Thread Pekka Enberg
On Sun, Jul 7, 2013 at 7:00 PM, Sasha Levin sasha.le...@oracle.com 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' is a 32bit integer, so when multiplying
 it by page size to get the actual page will cause an overflow if
 the pfn referred to a memory area above 4gb.

 Signed-off-by: Sasha Levin sasha.le...@oracle.com

Will, Michael, Asias, good to merge?
--
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] kvm tools: fix boot of guests with more than 4gb of ram

2013-07-07 Thread Pekka Enberg
On Mon, Jun 24, 2013 at 1:06 PM, Michael Tokarev m...@tls.msk.ru wrote:
 24.06.2013 05:23, Sasha Levin wrote:
   queue   = p9dev-vqs[vq];
   queue-pfn  = pfn;
 - p   = guest_flat_to_host(kvm, queue-pfn * page_size);
 + p   = guest_flat_to_host(kvm, (u64)queue-pfn * page_size);

 Maybe it's worth to use a common function for this,
 something like guest_queue_to_host(kvm, queue) ?

Sasha, care to do something like this and resend the patch?
--
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] kvm tools: add status notification hook to virtio-mmio

2013-06-10 Thread Pekka Enberg
On Mon, Jun 10, 2013 at 5:22 PM, Will Deacon will.dea...@arm.com wrote:
 Can you pick this one up please Pekka? If it helps:

   Acked-by: Will Deacon will.dea...@arm.com

CC'ing me helped even more! ;-) Applied, thanks guys!
--
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 2/2] tools: lkvm - Filter out cpu vendor string

2013-06-08 Thread Pekka Enberg
Applied, thanks a lot!
--
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 2/2] tools: lkvm - Filter out cpu vendor string

2013-06-07 Thread Pekka Enberg

On 06/07/2013 11:17 AM, Asias He wrote:

Ping! Is there someone out there who has a AMD box they could test this on?


I tested it on AMD box.  Guest boots with this patch, guest does not
boot without it.  I am not seeing the msr warning in both cases.


That's pretty interesting. Can you please provide your /proc/cpuinfo so 
I can include it in the changelog?


Pekka

--
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 2/2] tools: lkvm - Filter out cpu vendor string

2013-06-06 Thread Pekka Enberg
On Tue, May 28, 2013 at 2:49 PM, Cyrill Gorcunov gorcu...@openvz.org wrote:
 If cpuvendor string is not filetered in case of host
 amd machine we get unhandled msr reads

 | [1709265.368464] kvm: 25706: cpu6 unhandled rdmsr: 0xc0010048
 | [1709265.397161] kvm: 25706: cpu7 unhandled rdmsr: 0xc0010048
 | [1709265.425774] kvm: 25706: cpu8 unhandled rdmsr: 0xc0010048

 thus provide own string and kernel will use generic cpu init.

 Reported-by: Ingo Molnar mi...@kernel.org
 CC: Pekka Enberg penb...@kernel.org
 CC: Sasha Levin sasha.le...@oracle.com
 CC: Asias He as...@redhat.com
 Signed-off-by: Cyrill Gorcunov gorcu...@openvz.org
 ---
  tools/kvm/x86/cpuid.c |8 
  1 file changed, 8 insertions(+)

 Index: linux-2.6.git/tools/kvm/x86/cpuid.c
 ===
 --- linux-2.6.git.orig/tools/kvm/x86/cpuid.c
 +++ linux-2.6.git/tools/kvm/x86/cpuid.c
 @@ -12,6 +12,7 @@

  static void filter_cpuid(struct kvm_cpuid2 *kvm_cpuid)
  {
 +   unsigned int signature[3];
 unsigned int i;

 /*
 @@ -21,6 +22,13 @@ static void filter_cpuid(struct kvm_cpui
 struct kvm_cpuid_entry2 *entry = kvm_cpuid-entries[i];

 switch (entry-function) {
 +   case 0:
 +   /* Vendor name */
 +   memcpy(signature, LKVMLKVMLKVM, 12);
 +   entry-ebx = signature[0];
 +   entry-ecx = signature[1];
 +   entry-edx = signature[2];
 +   break;
 case 1:
 /* Set X86_FEATURE_HYPERVISOR */
 if (entry-index == 0)

Ping! Is there someone out there who has a AMD box they could test this on?
--
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: kvm tools: why SDL window does not exit on poweroff?

2013-05-23 Thread Pekka Enberg

Hello,

On 04/15/2013 10:11 AM, Lin Ming wrote:

On Mon, Apr 15, 2013 at 2:48 PM, Pekka Enberg penb...@kernel.org wrote:

Hello,


Hi,



On Mon, Apr 15, 2013 at 5:27 AM, Lin Ming min...@gmail.com wrote:

Will BIOS support be added in kvmtool in the future?


Yes, I expect that to happen eventually. Various patchsets have been
started by multiple people to support SeaBIOS but there hasn't been a
focused effort to push them forward.


Could you show me the links to these patchsets?
I'd like to read and try it.


I managed to track down the work thanks to Asias and I uploaded it here:

https://github.com/penberg/seabios

Pekka
--
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: [RFC PATCH 00/11] kvm tools: allow ioport emulation to be used on ARM

2013-05-14 Thread Pekka Enberg
On Fri, May 3, 2013 at 9:53 AM, Michael Ellerman mich...@ellerman.id.au wrote:
 On Wed, 2013-05-01 at 16:50 +0100, Will Deacon wrote:
 Hi guys,

 This RFC series does a number of things, but the main goal is to allow
 re-use of the emulation code under hw/ on architectures other than x86.
 It also comes about after discussions concerning virtio-console for
 earlyprintk:

   
 http://lists.infradead.org/pipermail/linux-arm-kernel/2013-April/165605.html

 The first 5 patches in this series allow the 8250 emulation to be used
 for earlyprintk (i.e. output only) on aarch64 platforms. The remaining 7
 patches generalise this to potentially any ioport devices, with DT node
 generation and interrupt routing.

 All comments welcome,

 I have nothing to add on the content, but they build on powerpc so I'm
 happy :)

I applied the series. Thanks guys!
--
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 1/8] kvm tools: pass virtio header size to uip_init

2013-05-14 Thread Pekka Enberg
I applied the series. Thanks a lot Sasha!
--
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: [RFC PATCH 04/11] kvm tools: console: unconditionally output to any console

2013-05-03 Thread Pekka Enberg
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 the input to be sent
 to one console driver only), it seems to be the wrong thing to do on
 the output side, as it effectively prevents the guest from switching
 from one console to another (think earlyprintk using 8250 to virtio
 console).

 After all, the guest *does* poke this device and outputs something
 there.

 Just remove the kvm-cfg.active_console test from the output paths.

 Signed-off-by: Marc Zyngier marc.zyng...@arm.com
 Signed-off-by: Will Deacon will.dea...@arm.com

Seems reasonable. Asias, Sasha?
--
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] kvm tools: virtio-net mergable rx buffers

2013-04-24 Thread Pekka Enberg
Hi,

On 04/23/2013 12:35 PM, Eric Northup wrote:
 Do you care about guests with drivers that don't negotiate
 VIRTIO_NET_F_MRG_RXBUF?

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 to allow working without them
 I'd rather keep the code simple in this case.

Are there such guests around? What's the failure scenario for them
after this patch?

Pekka
--
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] kvm tools: remove arbitrary minimum RAM limitation

2013-04-24 Thread Pekka Enberg

On 04/23/2013 05:57 PM, 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:

sh-4.2# free -h
  total   used   free sharedbuffers cached
Mem:   20M15M   4.2M 0B 0B   4.2M
-/+ buffers/cache:11M   8.3M
Swap:   0B 0B 0B

Signed-off-by: Sasha Levin sasha.le...@oracle.com


Applied, thanks!

Pekka

--
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] kvm tools: virtio-net mergable rx buffers

2013-04-23 Thread Pekka Enberg
On Tue, Apr 23, 2013 at 3:32 AM, Sasha Levin sasha.le...@oracle.com wrote:
 @@ -94,4 +95,6 @@ struct kvm;
  void *mmap_hugetlbfs(struct kvm *kvm, const char *htlbfs_path, u64 size);
  void *mmap_anon_or_hugetlbfs(struct kvm *kvm, const char *hugetlbfs_path, 
 u64 size);

 +int memcpy_toiovecend(const struct iovec *iov, int iovlen, unsigned char 
 *kdata, size_t len);
 +

I hate the name. Maybe append_to_iovec or something?

Otherwise looks OK to me. Asias?

Pekka
--
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: kvm tools: why SDL window does not exit on poweroff?

2013-04-15 Thread Pekka Enberg
Hello,

On Mon, Apr 15, 2013 at 5:27 AM, Lin Ming min...@gmail.com wrote:
 Will BIOS support be added in kvmtool in the future?

Yes, I expect that to happen eventually. Various patchsets have been
started by multiple people to support SeaBIOS but there hasn't been a
focused effort to push them forward.

Pekka
--
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] kvm tools: make virtio-net mq max queues configurable

2013-04-15 Thread Pekka Enberg

On 04/15/2013 12:19 PM, Will Deacon wrote:

Hi Sasha,

On Sun, Apr 14, 2013 at 01:20:44AM +0100, Sasha Levin wrote:

This patch makes the maximum amount of vqs configurable. To use it pass a 'mq'
option to network device configuration. For example:

vm run -n mode=tap,mq=4

Will allow up to 4 queue pairs for that network device.

Note that not specifiying mq, or setting mq=0 will disable virtio-net
multiqueuing.


This works a treat, thanks for addressing it so quickly!

   Acked-by: Will Deacon will.dea...@arm.com
   Tested-by: Will Deacon will.dea...@arm.com


Applied, thanks guys!

Pekka

--
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 0/5] Usual batch of random ARM fixes for kvmtool

2013-04-12 Thread Pekka Enberg

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 :(


On 04/11/2013 07:45 PM, Sasha Levin wrote:

That's definitely unwanted.

I'll look into it and try sending something out today/tomorrow.


That's very unfortunate. Can you please confirm that reverting commit 
e026314820acc3cc967308355f3746aca238fda4 (kvm tools: virtio-net 
multiqueue support) fixes it? If fixing the issue turns out to be 
difficult, we should just take multi-queue out until the issues is resolved.


Pekka
--
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] kvm tools: set done to true on SDL window close

2013-04-12 Thread Pekka Enberg

On 04/12/2013 09:49 AM, Lin Ming wrote:

Currently, SDL doesn't exit on window close because it stuck in
sdl__stop because done is not set to true.

Fix it by setting done to true on window close.

Signed-off-by: Lin Ming min...@gmail.com


Applied, thanks!

--
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 0/5] Usual batch of random ARM fixes for kvmtool

2013-04-12 Thread Pekka Enberg

On 04/11/2013 07:36 PM, Will Deacon wrote:

Here's the latest round of ARM fixes and updates for kvmtool.


Applied, thanks a lot Will!

Pekka

--
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: kvm tools: why SDL window does not exit on poweroff?

2013-04-12 Thread Pekka Enberg
On Fri, Apr 12, 2013 at 10:42 AM, Lin Ming min...@gmail.com wrote:
 I run poweroff or halt in SDL window, but the window does not exit
 although guest is already halted. But qemu can exit properly.

 Is it because hlt instruction is not emulated?
 Or other reason?

 Any hint to fix it?

IIRC, poweroff is supposed to happen via some dedicated ioport on x86.
Cyrill, didn't you look into this at some point?

Pekka
--
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: kvmtool : [PATCH] PowerPc : Fix compilation for ppc64

2013-04-10 Thread Pekka Enberg
On Tue, Apr 9, 2013 at 8:29 PM, Prerna Saxena pre...@linux.vnet.ibm.com wrote:
 'lkvm' compilation on ppc64 fails with the following error :
 ...[snip]..
   LINK guest/init
   LINK lkvm
 /usr/bin/ld: powerpc:common architecture of input file `guest/guest_init.o'
 is incompatible with powerpc:common64 output
 collect2: ld returned 1 exit status
 make: *** [lkvm] Error 1

 This patch corrects the error above, and enables 'lkvm' to compile on ppc64
 architecture.

 Signed-off-by: Prerna Saxena pre...@linux.vnet.ibm.com
 ---
  tools/kvm/Makefile |4 
  1 file changed, 4 insertions(+)

 diff --git a/tools/kvm/Makefile b/tools/kvm/Makefile
 index 0c59faa..269e29e 100644
 --- a/tools/kvm/Makefile
 +++ b/tools/kvm/Makefile
 @@ -335,7 +335,11 @@ $(PROGRAM_ALIAS): $(PROGRAM)
  $(GUEST_INIT): guest/init.c
 $(E)   LINK $@
 $(Q) $(CC) -static guest/init.c -o $@
 +ifeq ($(ARCH), powerpc)
 +   $(Q) $(LD) -r -b binary --oformat elf64-powerpc -o guest/guest_init.o 
 $(GUEST_INIT)
 +else
 $(Q) $(LD) -r -b binary -o guest/guest_init.o $(GUEST_INIT)
 +endif

  $(DEPS):

 --
 1.7.10.4

Michael, Sasha, comments?
--
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 1/6] kvm tools: Return error status in lkvm list

2013-02-06 Thread Pekka Enberg
Applied all patches, thanks a lot Michael!
--
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] kvm tools: arm: fix GIC #defines to match latest kvm code

2013-02-06 Thread Pekka Enberg
On Wed, Feb 6, 2013 at 2:12 PM, Will Deacon will.dea...@arm.com wrote:
 During the review process for the KVM ARM patches, the GIC device
 registration was subjected to some minor renaming, so update kvm tool
 appropriately.

 Signed-off-by: Will Deacon will.dea...@arm.com

Applied, thanks Will!
--
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] kvm tools: Fix powerpc build after kvm__dump_mem() change

2013-02-04 Thread Pekka Enberg
On Mon, Feb 4, 2013 at 2:17 PM, Michael Ellerman mich...@ellerman.id.au wrote:
 Commit 21692d1 (Beautify debug output) broke the powerpc build because
 it changed the signature for kvm__dump_mem() but didn't update all callers.

 Signed-off-by: Michael Ellerman mich...@ellerman.id.au

Applied, thanks Michael!
--
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] kvm tools: Fix powerpc build after kvm__dump_mem() change

2013-02-04 Thread Pekka Enberg
On Mon, Feb 4, 2013 at 3:37 PM, Will Deacon will.dea...@arm.com wrote:
 D'oh! I was about to post a patch to fix this (arm is also broken)... I've
 dropped the powerpc hunk from my patch (see below).

Applied, thanks Will!
--
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] kvm tools: Fix SDL and VNC by setting vidmode correctly

2013-01-26 Thread Pekka Enberg
Applied both patches. Thanks Asias!
--
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 v2] kvm tools: remove redundant if condition

2013-01-22 Thread Pekka Enberg
On Sat, Jan 19, 2013 at 12:27 PM, Cong Ding ding...@gmail.com wrote:
 On Sat, Jan 19, 2013 at 10:58:33AM +0200, Pekka Enberg wrote:
 On Wed, Jan 16, 2013 at 6:52 PM, Cong Ding ding...@gmail.com wrote:
  After we check (state.kcount != 0), state.kcount has to be 0 in all the 
  else
  branchs.
 
  Signed-off-by: Cong Ding ding...@gmail.com
  ---
   tools/kvm/hw/i8042.c |2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
 
  diff --git a/tools/kvm/hw/i8042.c b/tools/kvm/hw/i8042.c
  index 9f8be6a..9035732 100644
  --- a/tools/kvm/hw/i8042.c
  +++ b/tools/kvm/hw/i8042.c
  @@ -189,7 +189,7 @@ static u32 kbd_read_data(void)
  state.mcount--;
  kvm__irq_line(state.kvm, AUX_IRQ, 0);
  kbd_update_irq();
  -   } else if (state.kcount == 0) {
  +   } else {
  i = state.kread - 1;
  if (i  0)
  i = QUEUE_SIZE;

 This doesn't look right. The 'kcount' field is an int so the value can
 be negative.
 But the former check is state.kcount != 0 as I described in the commit
 message. Notice the difference between variable names in the if condition: 
 the
 first one is kcount, the second one is mcount, and the third one is same as 
 the
 first one kcount.

 Ok, the original code is
 if (state.kcount != 0) {
 /* do something when (state.kcount != 0) */
 } else if (state.mcount  0) {
 /* do something when (state.kcount == 0  state.mount  0) */
 } else if (state.kcount == 0) {
 /* do something when (state.kcount == 0  state.mount = 0) 
 */
 }
 For the third branch, it runs when state.kcount == 0 and state.mount = 0,
 it's not necessary to ensure state.kcount == 0 again.

Right you are. Applied, thanks!
--
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 v2] kvm tools: close opened file

2013-01-19 Thread Pekka Enberg
On Wed, Jan 16, 2013 at 6:51 PM, Cong Ding ding...@gmail.com wrote:
 The file should be closed before return.

 Signed-off-by: Cong Ding ding...@gmail.com

Applied, thanks!
--
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 v2] kvm tools: remove redundant if condition

2013-01-19 Thread Pekka Enberg
On Wed, Jan 16, 2013 at 6:52 PM, Cong Ding ding...@gmail.com wrote:
 After we check (state.kcount != 0), state.kcount has to be 0 in all the else
 branchs.

 Signed-off-by: Cong Ding ding...@gmail.com
 ---
  tools/kvm/hw/i8042.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/tools/kvm/hw/i8042.c b/tools/kvm/hw/i8042.c
 index 9f8be6a..9035732 100644
 --- a/tools/kvm/hw/i8042.c
 +++ b/tools/kvm/hw/i8042.c
 @@ -189,7 +189,7 @@ static u32 kbd_read_data(void)
 state.mcount--;
 kvm__irq_line(state.kvm, AUX_IRQ, 0);
 kbd_update_irq();
 -   } else if (state.kcount == 0) {
 +   } else {
 i = state.kread - 1;
 if (i  0)
 i = QUEUE_SIZE;

This doesn't look right. The 'kcount' field is an int so the value can
be negative.
--
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 0/4] ARM updates for kvmtool

2013-01-09 Thread Pekka Enberg
On Mon, Jan 7, 2013 at 8:14 PM, Will Deacon will.dea...@arm.com wrote:
 Hello kvm hackers,

 This patch series introduces some updates to the ARM (AArch32) kvm tools
 code:

 - virtio mmio fixes to deal with guest page sizes != 4k (in
   preparation for AArch64, which I will post separately).
 - .dtb dumping via the lkvm command line
 - Support for PSCI firmware as a replacement to the spin-table
   based SMP boot code

 The last option was implemented after discussion on the linux-arm-kernel
 list when adding support for the mach-virt platform. I hope to upstream
 the kernel-side part of the implementation for 3.9 and expect the kvm
 bits to follow once that has been merged.

 All feedback welcome.

Applied, thanks Will!
--
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 0/2] Add support for ARMv8 CPUs to kvmtool

2013-01-09 Thread Pekka Enberg
Hi Will,

On Mon, Jan 7, 2013 at 8:43 PM, Will Deacon will.dea...@arm.com wrote:
 Hello again,

 These two patches add support for ARMv8 processors running an AArch64 instance
 of kvm to kvmtool. Both AArch32 and AArch64 guests are supported and, in the
 case of the latter, the guest page size may be either 64k or 4k.

 This depends on the ARM updates series I just posted:

   https://lists.cs.columbia.edu/pipermail/kvmarm/2013-January/004505.html

 Feedback welcome,

So will ARMv7 continue to work after this patch even without the ARM
updates? If so, I'm happy to merge the patch before the updates hit
v3.9.

Pekka
--
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 0/2] Add support for ARMv8 CPUs to kvmtool

2013-01-09 Thread Pekka Enberg
On Wed, Jan 9, 2013 at 1:33 PM, Will Deacon will.dea...@arm.com wrote:
 I think we're getting our wires crossed a bit here, so I'll try to explain
 my madness:

 - Mainline ARM kernels cannot be booted by kvmtool yet, you
   currently have to use my virt/mach branch from

 git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git

   I hope to upstream this for 3.9 (it has gone through the necessary
   review on the ARM kernel list).

 - As part of the review mentioned above, some kvmtool changes were
   required to support SMP with the latest virt/mach. You just merged
   these in my ARM updates series.

 - The ARMv8 kvmtool code builds on top of the series you just merged
   and won't apply without it. Applying it won't have any adverse
   effects on ARMv7 (AArch32). In fact, the two series sit together
   on my kvmtool/arm branch from

 git://git.kernel.org/pub/scm/linux/kernel/git/will/kvmtool.git

   but I posted them separately to avoid holding up the ARM updates.

 Does that answer you question or have I made things worse?!

Yes, it answers my question. I'll go ahead and apply the ARMv8 patches.
--
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 1/3] kvm-tool: ARM: set interrupt priority mask in secondary boot path

2012-12-09 Thread Pekka Enberg
On Wed, 5 Dec 2012, Will Deacon wrote:
 From: Marc Zyngier marc.zyng...@arm.com
 
 A bug in the KVM GIC init code set the priority mask to the
 highest possible value, while the reset value should be zero.
 
 Now that the kernel bug is fixed, kvm-tool must properly configure
 its GIC CPU interface in order to receive the boot IPI.  Just set
 the GICC_PMR register to the maximum value (0xff), and it just works.
 
 Cc: Pekka Enberg penb...@kernel.org
 Signed-off-by: Marc Zyngier marc.zyng...@arm.com
 [will: added #define for PMR offset]
 Signed-off-by: Will Deacon will.dea...@arm.com

Applied all three patches, thanks Will!
--
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] kvm tools: powerpc: convert spapr pci to new device iterators

2012-11-30 Thread Pekka Enberg
On Wed, 28 Nov 2012, Matt Evans wrote:
 On 2012-11-27 13:00, Will Deacon wrote:
  Commit 8d35d32d0148 (kvm tools: add generic device registration
  mechanism) introduced a tree-based device lookup-by-bus mechanism as
  well as iterators to enumerate the devices on a particular bus.
  
  Whilst both x86 and ppc were converted by the original patch, the spapr
  pci changes were incomplete, so include the required changes here.
  
  Compile-tested only on ppc64 970mp. Note that I had to hack the Makefile
  in order to build guest_init.o with a toolchain defaulting to ppc:
  
   $(GUEST_INIT): guest/init.c
  $(E)   LINK $@
  -   $(Q) $(CC) -static guest/init.c -o $@
  -   $(Q) $(LD) -r -b binary -o guest/guest_init.o $(GUEST_INIT)
  +   $(Q) $(CC) -m64 -static guest/init.c -o $@
  +   $(Q) $(LD) -m elf64ppc -r -b binary -o guest/guest_init.o
  $(GUEST_INIT)
  
   $(DEPS):
  
  Cc: Matt Evans m...@ozlabs.org
  Signed-off-by: Will Deacon will.dea...@arm.com
 
 I lack PPC
 But this patch appears too good
 To be left aside
 
 Acked-by: Matt Evans m...@ozlabs.org

Applied, thanks!
--
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] kvm-tool: fix zombie reaping in guest/init.c

2012-11-30 Thread Pekka Enberg
On Thu, 29 Nov 2012, Marc Zyngier wrote:
 init.c is not very kind with processes that get reparented when
 their own parent die, leaving them hanging around. Looking at the
 code, it only seem to care about its own flesh and blood. Bad init.
 
 Teach it some basic zombie reaping skills.
 
 Cc: Pekka Enberg penb...@kernel.org
 Signed-off-by: Marc Zyngier marc.zyng...@arm.com

Applied, thanks Marc!
--
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 v3] kvm tools: add support for ARMv7 processors

2012-11-24 Thread Pekka Enberg
On Fri, Nov 23, 2012 at 4:50 PM, Marc Zyngier marc.zyng...@arm.com wrote:
 On 23/11/12 14:40, Will Deacon wrote:
 This patch adds initial support for ARMv7 processors (more specifically,
 Cortex-A15) to kvmtool.

 Everything is driven by FDT, including dynamic generation of virtio nodes
 for MMIO devices (PCI is not used due to lack of a suitable host-bridge).

 The virtual timers and virtual interrupt controller (VGIC) are provided
 by the kernel and require very little in terms of userspace code.

 Signed-off-by: Will Deacon will.dea...@arm.com

 FWIW:

 Tested-by: Marc Zyngier marc.zyng...@arm.com

Applied, thanks guys!
--
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 v2 0/8] kvm tools: add support for ARMv7 processors

2012-11-23 Thread Pekka Enberg
On Thu, 22 Nov 2012, Will Deacon wrote:
 Hello,
 
 This is version two of the patches I originally posted here:
 
   http://www.spinics.net/lists/kvm/msg82447.html
 
 Changes since version one include:
 
   - MAX_MEMORY no longer needlessly page-aligned for ARM
   - Use xread instead of read for reading the kernel image
   - Limit virtual CPUs to 8 due to hardware limitations of the GIC
   - Use hugetlbfs_path instead of NULL
   - Improved member type consistency between kvm_mem_bank and
 kvm_userspace_memory_region
   - New tree-based device registration which moves device number
 allocation out of the arch-dependent IRQ registration code
   - Included dependency from mainline kernel to use rbtrees without
 including linux/compiler.h
   - SMP secondary boot now initialises the GIC CPU interface (this
 worked by fluke previously due to a bug in kvm)
   - Added a dummy set_size_vq function to the balloon driver,
 which I accidentally missed in the original patch (now merged)
   - Fixed header guard consistency
   - Dropped the RFC tag
   - Rebased onto latest kvmtool code
 
 As usual, all comments welcome.

I applied patches 1-7. I'll wait for a new revision of the final 
patch. Thanks, Will!

Pekka
--
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: [RFC PATCH 05/16] kvm tools: don't bother including linux/compiler.h

2012-11-19 Thread Pekka Enberg
Hi Will,

On Mon, 19 Nov 2012, Will Deacon wrote:
   I'm struggling to reproduce this with my tree. Can you confirm whether or
   not you have commit 29fc7c5a4f51 (rbtree: include linux/compiler.h for
   definition of __always_inline) in your *kernel* sources please?
  
  No, I don't. I can cherry-pick that to my tree if necessary.
 
 Aha, that's probably the issue then since you won't have a definition of
 __always_inline from linux/compiler.h. If you cherry-pick that patch, then
 this one should work as intended. If you prefer, I can include that patch
 in v2 of my series.

Please just include the patch in your series.

Pekka
--
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: [RFC PATCH 05/16] kvm tools: don't bother including linux/compiler.h

2012-11-16 Thread Pekka Enberg
On Fri, 16 Nov 2012, Will Deacon wrote:
  I'm seeing the following breakage with this patch applied:
  
  [penberg@tux kvm]$ make
CC   hw/rtc.o
CC   ioport.o
CC   kvm-cpu.o
CC   kvm.o
  In file included from include/kvm/rbtree-interval.h:4:0,
   from include/kvm/ioport.h:4,
   from hw/rtc.c:3:
  ../../include/linux/rbtree_augmented.h:125:24: error: expected ‘=’, ‘,’, 
  ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
  In file included from include/kvm/rbtree-interval.h:4:0,
   from include/kvm/ioport.h:4,
   from ioport.c:1:
  ../../include/linux/rbtree_augmented.h:125:24: error: expected ‘=’, ‘,’, 
  ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
  make: *** [hw/rtc.o] Error 1
  make: *** Waiting for unfinished jobs
  make: *** [ioport.o] Error 1
 
 I'm struggling to reproduce this with my tree. Can you confirm whether or
 not you have commit 29fc7c5a4f51 (rbtree: include linux/compiler.h for
 definition of __always_inline) in your *kernel* sources please?

No, I don't. I can cherry-pick that to my tree if necessary.

Pekka

Re: [RFC PATCH 16/16] kvm tools: add support for ARMv7 processors

2012-11-13 Thread Pekka Enberg
On Tue, Nov 13, 2012 at 12:21 PM, Matt Evans matt.ev...@arm.com wrote:
 I *think* Will was going to make some small changes, if you've already merged 
 it then a follow-up set perhaps?

I only merged the non-ARM specific changes which looked good to me.
But sure, please send an incremental patch if you need to fix them up,
Will.
--
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: [RFC PATCH 05/16] kvm tools: don't bother including linux/compiler.h

2012-11-12 Thread Pekka Enberg
On Mon, 12 Nov 2012, Will Deacon wrote:

 linux/compiler.h will never give us a definition for __compiler_offsetof
 because __KERNEL__ isn't defined, so just use the simple definition that
 we have already.
 
 This patch removes the redundant code.
 
 Signed-off-by: Will Deacon will.dea...@arm.com
 ---
  tools/kvm/include/linux/stddef.h |6 --
  1 files changed, 0 insertions(+), 6 deletions(-)
 
 diff --git a/tools/kvm/include/linux/stddef.h 
 b/tools/kvm/include/linux/stddef.h
 index 60ea512..39da808 100644
 --- a/tools/kvm/include/linux/stddef.h
 +++ b/tools/kvm/include/linux/stddef.h
 @@ -1,16 +1,10 @@
  #ifndef _LINUX_STDDEF_H
  #define _LINUX_STDDEF_H
  
 -#include linux/compiler.h
 -
  #undef NULL
  #define NULL ((void *)0)
  
  #undef offsetof
 -#ifdef __compiler_offsetof
 -#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
 -#else
  #define offsetof(TYPE, MEMBER) ((size_t) ((TYPE *)0)-MEMBER)
 -#endif
  
  #endif

I'm seeing the following breakage with this patch applied:

[penberg@tux kvm]$ make
  CC   hw/rtc.o
  CC   ioport.o
  CC   kvm-cpu.o
  CC   kvm.o
In file included from include/kvm/rbtree-interval.h:4:0,
 from include/kvm/ioport.h:4,
 from hw/rtc.c:3:
../../include/linux/rbtree_augmented.h:125:24: error: expected ‘=’, ‘,’, ‘;’, 
‘asm’ or ‘__attribute__’ before ‘void’
In file included from include/kvm/rbtree-interval.h:4:0,
 from include/kvm/ioport.h:4,
 from ioport.c:1:
../../include/linux/rbtree_augmented.h:125:24: error: expected ‘=’, ‘,’, ‘;’, 
‘asm’ or ‘__attribute__’ before ‘void’
make: *** [hw/rtc.o] Error 1
make: *** Waiting for unfinished jobs
make: *** [ioport.o] Error 1


Re: [RFC PATCH 00/16] kvm tools: add support for ARMv7 processors

2012-11-12 Thread Pekka Enberg
On Mon, 12 Nov 2012, Will Deacon wrote:
 This patch series adds support for ARMv7 processors (Cortex-A15) to kvm
 tool. The majority of the series consists of small changes in
 preparation for ARM support, which is added by the final patch. I can
 try to split this up further, but given that there is no current support
 for ARM, the sub-patches wouldn't be especially meaningful.

I cherry-picked the easy ones from this series and merged them. Thanks a 
lot, Will!

Pekka
--
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: [RFC PATCH 16/16] kvm tools: add support for ARMv7 processors

2012-11-12 Thread Pekka Enberg
On Mon, 12 Nov 2012, Will Deacon wrote:
 This patch adds initial support for ARMv7 processors (more specifically,
 Cortex-A15) to kvmtool.
 
 Everything is driven by FDT, including dynamic generation of virtio nodes
 for MMIO devices (PCI is not used due to lack of a suitable host-bridge).
 
 The virtual timers and virtual interrupt controller (VGIC) are provided
 by the kernel and require very little in terms of userspace code.
 
 Signed-off-by: Will Deacon will.dea...@arm.com

I'm happy with this but I'm not really an ARM guy. Is there anyone in the 
ARM/KVM community who is interested in reviewing this?

Pekka
--
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: [BUG] lkvm crash on crashkernel boot

2012-10-31 Thread Pekka Enberg
On Thu, 25 Oct 2012, Kirill A. Shutemov wrote:
 vec is 0x in virtio_pci__specific_io_out() on crash.
 
 Let's add proper bounds checking there. It doesn't not solves the issue
 with booting crashkernel, but fix lkvm crash.

There's no sign-off for the patch. Kirill, care to update the patch 
description and send it my way?
--
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 -next] kvm tools: remove duplicated include from builtin-setup.c

2012-10-26 Thread Pekka Enberg
On Fri, 26 Oct 2012, Wei Yongjun wrote:

 From: Wei Yongjun yongjun_...@trendmicro.com.cn
 
 Remove duplicated include.
 
 dpatch engine is used to auto generate this patch.
 (https://github.com/weiyj/dpatch)
 
 Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn
 ---
  tools/kvm/builtin-setup.c | 4 
  1 file changed, 4 deletions(-)
 
 diff --git a/tools/kvm/builtin-setup.c b/tools/kvm/builtin-setup.c
 index 1b865b7..c5b0566 100644
 --- a/tools/kvm/builtin-setup.c
 +++ b/tools/kvm/builtin-setup.c
 @@ -13,11 +13,7 @@
  #include string.h
  #include unistd.h
  #include stdio.h
 -#include sys/types.h
  #include sys/mman.h
 -#include sys/stat.h
 -#include string.h
 -#include unistd.h
  #include fcntl.h
  
  extern char _binary_guest_init_start;

Applied, thanks!
--
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 2/5] kvm tools: use the correct config vector interrupt

2012-10-26 Thread Pekka Enberg
On Thu, 25 Oct 2012, Sasha Levin wrote:
 On Thu, Oct 25, 2012 at 3:03 AM, Pekka Enberg penb...@kernel.org wrote:
  On Wed, 24 Oct 2012, William Dauchy wrote:
  when registering the config interrupt, the later is registered in
  vcpi-config_vector and not in vpci-vq_vector
 
  introduced in:
  a841f15 kvm tools: Use the new KVM_SIGNAL_MSI ioctl to inject
  interrupts directly.
 
  Signed-off-by: William Dauchy will...@gandi.net
  ---
   tools/kvm/virtio/pci.c |2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
 
  diff --git a/tools/kvm/virtio/pci.c b/tools/kvm/virtio/pci.c
  index ab1119a..f4ea3c9 100644
  --- a/tools/kvm/virtio/pci.c
  +++ b/tools/kvm/virtio/pci.c
  @@ -288,7 +288,7 @@ int virtio_pci__signal_config(struct kvm *kvm, struct 
  virtio_device *vdev)
}
 
if (vpci-features  VIRTIO_PCI_F_SIGNAL_MSI)
  - virtio_pci__signal_msi(kvm, vpci, 
  vpci-vq_vector[vpci-config_vector]);
  + 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

Applied, thanks guys!
--
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: [BUG] lkvm crash on crashkernel boot

2012-10-26 Thread Pekka Enberg
On Thu, 25 Oct 2012, Sasha Levin wrote:
 I think we're seeing that because we don't handle VIRTIO_MSI_NO_VECTOR 
 properly.
 
 We need to deal with the ability to remove GSI  friends as well. I've
 added it to my workqueue (unless someone deals with it first).

Any reason I shouldn't apply Kirill's patch before someone find the time 
to do that?

Pekka
--
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


[PATCH] kvm tools: Fix reported RTC century and year

2012-10-25 Thread Pekka Enberg
Commit 13d5097 (kvm tools: Fix reported year in RTC emulation)
attempted to fix wrongly reported RTC year. However, as pointed out by
hpa the proper way to deal with this is to support the RTC century
field.

Suggested-by: H. Peter Anvin h...@zytor.com
Cc: Ingo Molnar mi...@kernel.org
Cc: H. Peter Anvin h...@zytor.com
Cc: Ron Minnich rminn...@gmail.com
Cc: Asias He asias.he...@gmail.com
Cc: Cyrill Gorcunov gorcu...@openvz.org
Cc: Sasha Levin levinsasha...@gmail.com
Signed-off-by: Pekka Enberg penb...@kernel.org
---
 tools/kvm/hw/rtc.c |   30 ++
 1 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/tools/kvm/hw/rtc.c b/tools/kvm/hw/rtc.c
index 4a862d6..5232bd7 100644
--- a/tools/kvm/hw/rtc.c
+++ b/tools/kvm/hw/rtc.c
@@ -18,6 +18,7 @@
 #define RTC_DAY_OF_MONTH   0x07
 #define RTC_MONTH  0x08
 #define RTC_YEAR   0x09
+#define RTC_CENTURY0x32
 
 #define RTC_REG_A  0x0A
 #define RTC_REG_B  0x0B
@@ -40,7 +41,6 @@ static bool cmos_ram_data_in(struct ioport *ioport, struct 
kvm *kvm, u16 port, v
 {
struct tm *tm;
time_t ti;
-   int year;
 
time(ti);
 
@@ -65,18 +65,24 @@ static bool cmos_ram_data_in(struct ioport *ioport, struct 
kvm *kvm, u16 port, v
case RTC_MONTH:
ioport__write8(data, bin2bcd(tm-tm_mon + 1));
break;
-   case RTC_YEAR:
-   /*
-* The gmtime() function returns time since 1900. The CMOS
-* standard is time since 2000. If the year is  100, do
-* nothing; if it is  100, subtract 100; this is the best fit
-* with the twisted CMOS logic.
-*/
-   year = tm-tm_year;
-   if (year  99)
-   year -= 100;
-   ioport__write8(data, bin2bcd(year));
+   case RTC_YEAR: {
+   int year;
+
+   year = tm-tm_year + 1900;
+
+   ioport__write8(data, bin2bcd(year % 100));
+
break;
+   }
+   case RTC_CENTURY: {
+   int year;
+
+   year = tm-tm_year + 1900;
+
+   ioport__write8(data, bin2bcd(year / 100));
+
+   break;
+   }
default:
ioport__write8(data, rtc.cmos_data[rtc.cmos_idx]);
break;
-- 
1.7.7.6

--
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: [RFC 1/3] kvm tools: use mutex abstraction instead of pthread mutex

2012-10-25 Thread Pekka Enberg
On Wed, 24 Oct 2012, Sasha Levin wrote:

 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

I applied this patch from the RFC series, thanks Sasha!
--
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 1/5] kvm tools: check ioctl return value for msi signal

2012-10-25 Thread Pekka Enberg
On Wed, 24 Oct 2012, William Dauchy wrote:
 Signed-off-by: William Dauchy will...@gandi.net
 ---
  tools/kvm/virtio/pci.c |4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/tools/kvm/virtio/pci.c b/tools/kvm/virtio/pci.c
 index b6ac571..ab1119a 100644
 --- a/tools/kvm/virtio/pci.c
 +++ b/tools/kvm/virtio/pci.c
 @@ -245,7 +245,9 @@ static void virtio_pci__signal_msi(struct kvm *kvm, 
 struct virtio_pci *vpci, int
   .data = vpci-msix_table[vec].msg.data,
   };
  
 - ioctl(kvm-vm_fd, KVM_SIGNAL_MSI, msi);
 + if (ioctl(kvm-vm_fd, KVM_SIGNAL_MSI, msi)  0) {
 + pr_warning(Config pci device error: %s, strerror(errno));
 + }
  }

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 deal with it.

Pekka
--
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 2/5] kvm tools: use the correct config vector interrupt

2012-10-25 Thread Pekka Enberg
On Wed, 24 Oct 2012, William Dauchy wrote:
 when registering the config interrupt, the later is registered in
 vcpi-config_vector and not in vpci-vq_vector
 
 introduced in:
 a841f15 kvm tools: Use the new KVM_SIGNAL_MSI ioctl to inject
 interrupts directly.
 
 Signed-off-by: William Dauchy will...@gandi.net
 ---
  tools/kvm/virtio/pci.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/tools/kvm/virtio/pci.c b/tools/kvm/virtio/pci.c
 index ab1119a..f4ea3c9 100644
 --- a/tools/kvm/virtio/pci.c
 +++ b/tools/kvm/virtio/pci.c
 @@ -288,7 +288,7 @@ int virtio_pci__signal_config(struct kvm *kvm, struct 
 virtio_device *vdev)
   }
  
   if (vpci-features  VIRTIO_PCI_F_SIGNAL_MSI)
 - virtio_pci__signal_msi(kvm, vpci, 
 vpci-vq_vector[vpci-config_vector]);
 + virtio_pci__signal_msi(kvm, vpci, vpci-config_vector);
   else
   kvm__irq_trigger(kvm, vpci-config_gsi);
   } else {

Sasha?
--
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 4/5] kvm tools: initialize msi flags to zero even is not used yet

2012-10-25 Thread Pekka Enberg
On Wed, 24 Oct 2012, William Dauchy wrote:
 kvm explictly checks if msi flags is equal to zero before going
 further; just make sure it is correctly initialized.
 
 Signed-off-by: William Dauchy will...@gandi.net
 ---
  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 f4ea3c9..02970fc 100644
 --- a/tools/kvm/virtio/pci.c
 +++ b/tools/kvm/virtio/pci.c
 @@ -243,6 +243,7 @@ static void virtio_pci__signal_msi(struct kvm *kvm, 
 struct virtio_pci *vpci, int
   .address_lo = vpci-msix_table[vec].msg.address_lo,
   .address_hi = vpci-msix_table[vec].msg.address_hi,
   .data = vpci-msix_table[vec].msg.data,
 + .flags = 0,
   };
  
   if (ioctl(kvm-vm_fd, KVM_SIGNAL_MSI, msi)  0) {

It is initialized to zero by default as per C struct initialization, isn't 
it? Does this fix a problem you are experiencing?

Pekka
--
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 5/5] kvm tools: specify the amount to balloon is in MB

2012-10-25 Thread Pekka Enberg

 Signed-off-by: William Dauchy will...@gandi.net
 ---
  tools/kvm/builtin-balloon.c |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/tools/kvm/builtin-balloon.c b/tools/kvm/builtin-balloon.c
 index 5bd2291..d158ace 100644
 --- a/tools/kvm/builtin-balloon.c
 +++ b/tools/kvm/builtin-balloon.c
 @@ -22,8 +22,8 @@ static const struct option balloon_options[] = {
   OPT_GROUP(Instance options:),
   OPT_STRING('n', name, instance_name, name, Instance name),
   OPT_GROUP(Balloon options:),
 - OPT_U64('i', inflate, inflate, Amount to inflate),
 - OPT_U64('d', deflate, deflate, Amount to deflate),
 + OPT_U64('i', inflate, inflate, Amount to inflate (in MB)),
 + OPT_U64('d', deflate, deflate, Amount to deflate (in MB)),
   OPT_END(),
  };

Applied, thanks!

Btw, looks like tools/kvm/virtio/ballon.c::handle_mem() is broken on 
architectures that don't use 4K pages. I'm happy to apply a patch that 
fixes it :-)

Pekka
--
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: [BUG] lkvm crash on crashkernel boot

2012-10-25 Thread Pekka Enberg
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. Unfortunately, lkvm crashes when
 I try to switch to crashkernel.

 I use Linus tree + penberg/kvmtool/next + one x86 mm patch[1].

 Kernel is defconfig + kvmconfig. I use the same kernel image for system and
 crash env.

 Host:

 % lkvm run --cpus 1 -m 1024 --params 'crashkernel=256M loglevel=8'

 Guest:

 # kexec -p bzImage --reuse-cmdline
 # echo c  /proc/sysrq-trigger
 ...
 [0.947984] loop: module loaded
 [0.950078] virtio-pci :00:01.0: irq 40 for MSI/MSI-X
 [0.950925] virtio-pci :00:01.0: irq 41 for MSI/MSI-X
 [0.952944] virtio-pci :00:01.0: irq 42 for MSI/MSI-X
 zsh: segmentation fault (core dumped)  lkvm run --cpus 1 -m 1024 --params 
 'crashkernel=256M loglevel=8'

This seems to work OK on my machine.

 Guest kernel is somewhere in virtio_net initialization (for the second
 time). I'm too lazy to find exact line.

 Backtrace:

 0  irq__add_msix_route (kvm=kvm@entry=0xbf8010, msg=0xe3d090) at x86/irq.c:210
 #1  0x0041b3bf in virtio_pci__specific_io_out.isra.5 
 (offset=optimized out,
 data=optimized out, kvm=0xbf8010) at virtio/pci.c:150
 #2  virtio_pci__io_out.9406 (ioport=optimized out, kvm=0xbf8010, 
 port=optimized out,
 data=optimized out, size=optimized out) at virtio/pci.c:208
 #3  0x0040f8c3 in kvm__emulate_io (count=optimized out, size=2, 
 direction=1,
 data=optimized out, port=25108, kvm=0xbf8010) at ioport.c:165
 #4  kvm_cpu__start (cpu=optimized out) at x86/include/kvm/kvm-cpu-arch.h:41
 #5  0x00416ca2 in kvm_cpu_thread.2824 (arg=optimized out) at 
 builtin-run.c:176
 #6  0x7f701ebd0b50 in start_thread (arg=optimized out) at 
 pthread_create.c:304
 #7  0x7f701e1fe70d in clone () at 
 ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
 #8  0x in ?? ()

Looks like vpci-msix_table might not be initialized properly. Sasha,
Asias, care to take a look at this?

Pekka
--
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] kvm tools: Fix SDL and VNC by adding default vidmode

2012-10-21 Thread Pekka Enberg
On Sun, 21 Oct 2012, Asias He wrote:
 In commit d73b168b3145f7bfe3f0e5d968653a1125b93a4e (kvm tools: ui
 improvements), the code to set a default vidmode was killed
 accidentally. This makes SDL and VNC not working unless '--vidmode'
 option is added, e.g lkvm run --sdl --vidmode 786.
 
 Signed-off-by: Asias He asias.he...@gmail.com

Applied, thanks Asias!

 ---
  tools/kvm/builtin-run.c | 10 +-
  1 file changed, 9 insertions(+), 1 deletion(-)
 
 diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
 index 50495a3..709ed33 100644
 --- a/tools/kvm/builtin-run.c
 +++ b/tools/kvm/builtin-run.c
 @@ -593,9 +593,17 @@ static struct kvm *kvm_cmd_run_init(int argc, const char 
 **argv)
   if (!kvm-cfg.script)
   kvm-cfg.script = DEFAULT_SCRIPT;
  
 - if (!kvm-cfg.vnc  !kvm-cfg.sdl)
 + if (!kvm-cfg.vidmode)
   kvm-cfg.vidmode = -1;
  
 + /* vidmode should be either specified or set by default */
 + if (kvm-cfg.vnc || kvm-cfg.sdl) {
 + if (kvm-cfg.vidmode == -1)
 + kvm-cfg.vidmode = 0x312;
 + } else {
 + kvm-cfg.vidmode = 0;
 + }
 +
   if (!kvm-cfg.network)
  kvm-cfg.network = DEFAULT_NETWORK;
  
 -- 
 1.7.11.7
 
 
--
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] kvm tools: fix help output for run command

2012-10-16 Thread Pekka Enberg
On Fri, 12 Oct 2012, William Dauchy wrote:
 This dummy patch remove tabs in help output.
 Introduced in commit:
 ae9ec23 kvm tools: generate command line options dynamically
 
 Signed-off-by: William Dauchy wdau...@gmail.com

Applied, thanks William!
--
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 1/3] kvm tools: Fix powerpc build errors caused by recent changes

2012-10-05 Thread Pekka Enberg
Applied all three patches, thanks Michael!
--
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 1/3] kvm tools: Fix powerpc build errors caused by recent changes

2012-10-05 Thread Pekka Enberg
Applied all three patches, thanks Michael!
--
To unsubscribe from this list: send the line unsubscribe kvm-ppc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] kvm tools: Export DISPLAY ENV as our default host ip address

2012-09-05 Thread Pekka Enberg
On 08/24/2012 02:29 PM, Asias He wrote:
 It is useful to run a X program in guest and display it on host.

 1) Make host's x server listen to localhost:6000
host_shell$ socat -d -d TCP-LISTEN:6000,fork,bind=localhost \
UNIX-CONNECT:/tmp/.X11-unix/X0

 2) Start the guest and run X program
host_shell$ lkvm run -k /boot/bzImage
   guest_shell$ xlogo

On Tue, Sep 4, 2012 at 4:07 PM, Avi Kivity a...@redhat.com wrote:
 Note, this is insecure, don't do this with untrusted guests.

Asias, can we add a command line argument that enables this? It'd be
safer to keep it disabled by default.
--
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 00/33] Cleanups and automatic init/exit calls

2012-09-05 Thread Pekka Enberg
On Wed, Sep 5, 2012 at 11:31 AM, Sasha Levin levinsasha...@gmail.com wrote:
 This patch series is mostly about cleanups:

  - Clean all the global variables we have to store configuration options.
  - Remove externed config options between objects.
  - Adding several exit routines to clean up on exit.
  - Remove the global 'kvm' object.
  - Contain arch specific init/exit calls within the corresponding non-arch
  specific code instead of the global init.

 This patch series also adds a method to call init/exit functions automatically
 after we've finished intializing config options.

 Doing so clears out a big chunk of repetetive code in our builtin-run init
 function, and makes adding new modules easier since there's now no need to
 link them to builtin-run.

I'm getting an instant SIGSEGV for vm run with these patches:

  [penberg@tux kvm]$ gdb --args ./lkvm run
  GNU gdb (GDB) Fedora (7.3.50.20110722-13.fc16)
  Copyright (C) 2011 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.  Type show copying
  and show warranty for details.
  This GDB was configured as x86_64-redhat-linux-gnu.
  For bug reporting instructions, please see:
  http://www.gnu.org/software/gdb/bugs/...
  Reading symbols from /home/penberg/linux/tools/kvm/lkvm...done.
  (gdb) r
  Starting program: /home/penberg/linux/tools/kvm/lkvm run
  [Thread debugging using libthread_db enabled]
  Using host libthread_db library /lib64/libthread_db.so.1.
# lkvm run -k ../../arch/x86/boot/bzImage -m 448 -c 4 --name guest-6703
  [New Thread 0x7fffdbfd5700 (LWP 6707)]
  [New Thread 0x7fffdb7d4700 (LWP 6708)]
  warning: Range for type (null) has invalid bounds 0..-109

  Program received signal SIGSEGV, Segmentation fault.
  0x0040fb14 in kvm__pause (kvm=0x712010) at kvm.c:419
  419   if (!kvm-cpus[0] || kvm-cpus[0]-thread == 0)
  Missing separate debuginfos, use: debuginfo-install
SDL-1.2.14-13.fc16.x86_64 glibc-2.14.90-24.fc16.7.x86_64
zlib-1.2.5-6.fc16.x86_64
  (gdb) bt
  #0  0x0040fb14 in kvm__pause (kvm=0x712010) at kvm.c:419
  #1  0x0040f898 in ioport__register (kvm=0x712010, port=3324,
ops=0x638ce0, count=4, param=0x0) at ioport.c:63
  #2  0x0040f6c4 in pci__init (kvm=0x712010) at pci.c:194
  #3  0x00414f94 in init_list__init (kvm=0x712010) at util/init.c:41
  #4  0x0041dc4e in kvm_cmd_run_init.2726 (argc=0,
argv=0x7fffe168) at builtin-run.c:655
  #5  0x00419d8e in kvm_cmd_run (argc=0, argv=0x7fffe168,
prefix=0x0) at builtin-run.c:689
  #6  0x004198ce in handle_command (command=0x6396e0, argc=1,
argv=0x7fffe160) at kvm-cmd.c:84
  #7  0x00419797 in handle_kvm_command.5445 (argc=1,
argv=0x7fffe160) at main.c:11
  #8  0x0042753e in main (argc=2, argv=0x7fffe158) at main.c:18
--
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 5/7] kvm tools: enable LTO

2012-08-30 Thread Pekka Enberg
On Thu, Aug 30, 2012 at 10:36 AM, Sasha Levin levinsasha...@gmail.com wrote:
 Build with -flto set, which should enable link-time-optimizations.

 I'm not sure if it provides a significant performance increase, but
 it's probably just worth it for catching issues which it may cause.

 Signed-off-by: Sasha Levin levinsasha...@gmail.com

Ingo, any objections to this?

 ---
  tools/kvm/Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/tools/kvm/Makefile b/tools/kvm/Makefile
 index 8aa0125..0e2fa66 100644
 --- a/tools/kvm/Makefile
 +++ b/tools/kvm/Makefile
 @@ -243,7 +243,7 @@ DEFINES += -DKVMTOOLS_VERSION='$(KVMTOOLS_VERSION)'
  DEFINES+= -DBUILD_ARCH='$(ARCH)'

  KVM_INCLUDE := include
 -CFLAGS += $(CPPFLAGS) $(DEFINES) -I$(KVM_INCLUDE) -I$(ARCH_INCLUDE) 
 -I$(KINCL_PATH)/include -I$(KINCL_PATH)/arch/$(ARCH)/include/ -O2 
 -fno-strict-aliasing -g
 +CFLAGS += $(CPPFLAGS) $(DEFINES) -I$(KVM_INCLUDE) -I$(ARCH_INCLUDE) 
 -I$(KINCL_PATH)/include -I$(KINCL_PATH)/arch/$(ARCH)/include/ -O2 
 -fno-strict-aliasing -g -flto

  WARNINGS += -Wall
  WARNINGS += -Wcast-align
 --
 1.7.12

 --
 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
--
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 5/7] kvm tools: enable LTO

2012-08-30 Thread Pekka Enberg
On Thu, Aug 30, 2012 at 11:22 AM, Cyrill Gorcunov gorcu...@openvz.org wrote:
 Maybe we could enable it via some make option?
 Say make LTO=1 or something?

That is not going to help much in catching LTO issues early.
--
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 1/7] kvm tools: add HOME env var to hostfs

2012-08-30 Thread Pekka Enberg
On Thu, Aug 30, 2012 at 12:44 PM, Sasha Levin levinsasha...@gmail.com wrote:
 On 08/30/2012 09:50 AM, Cyrill Gorcunov wrote:
 On Thu, Aug 30, 2012 at 09:36:37AM +0200, Sasha Levin wrote:
 +char *new_env[] = { TERM=linux, DISPLAY=192.168.33.1:0,
 +HOME=/virt/home, NULL };
 +
 +mkdir(/virt/home, 0755);

 Please add check for mkdir error code. Frankly, this is a bad habbit
 to assume that mkdir never fails (this could be done on top of this
 series I think but should not be leaved without attention).

 This is actually supposed to fail most of the times, since it runs as part of
 the init :)

You could check for errno == EEXISTS, no?

On Thu, Aug 30, 2012 at 12:44 PM, Sasha Levin levinsasha...@gmail.com wrote:
 There's not much we can do if it fails though, and even at that point - this
 failure isn't serious enough to even justify any further action on our end.

I'm pretty sure users would appreciate a friendly warning explaining
that we are not running in normal state.
--
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 1/2] kvm tools: Respect guest tcp window size

2012-08-23 Thread Pekka Enberg
On Thu, Aug 23, 2012 at 4:26 AM, Asias He asias.he...@gmail.com wrote:
 Respect guest tcp window size and stop sending tcp segments to guest
 if guest's receive window is closed.

 This fixes the TCP hang I'm seeing where guest and host are transferring
 big chuck of data.

Awesome!

 This problem was not triggered when guest and external host
 communicates, probably because guest to external host communication
 walks through real network and is much slower than guest and host
 communication. Thus, guest's receive window has little chance to be
 closed.

 Signed-off-by: Asias He asias.he...@gmail.com
 ---
  tools/kvm/include/kvm/uip.h |  1 +
  tools/kvm/net/uip/tcp.c | 28 ++--
  2 files changed, 23 insertions(+), 6 deletions(-)

 diff --git a/tools/kvm/include/kvm/uip.h b/tools/kvm/include/kvm/uip.h
 index 4497f6a..191029b 100644
 --- a/tools/kvm/include/kvm/uip.h
 +++ b/tools/kvm/include/kvm/uip.h
 @@ -235,6 +235,7 @@ struct uip_tcp_socket {
 pthread_t thread;
 u32 dport, sport;
 u32 guest_acked;
 +   u16 window_size;
 /*
  * Initial Sequence Number
  */
 diff --git a/tools/kvm/net/uip/tcp.c b/tools/kvm/net/uip/tcp.c
 index 586a45c..cf46bac 100644
 --- a/tools/kvm/net/uip/tcp.c
 +++ b/tools/kvm/net/uip/tcp.c
 @@ -167,25 +167,38 @@ static int uip_tcp_payload_send(struct uip_tcp_socket 
 *sk, u8 flag, u16 payload_
  static void *uip_tcp_socket_thread(void *p)
  {
 struct uip_tcp_socket *sk;
 -   u8 *payload;
 -   int ret;
 +   u8 *payload, *pos;
 +   int len, left, ret;

 sk = p;

 payload = malloc(UIP_MAX_TCP_PAYLOAD);
 -   sk-payload = payload;
 -   if (!sk-payload)
 +   if (!payload)
 goto out;

 while (1) {
 +   pos = payload;

 ret = read(sk-fd, payload, UIP_MAX_TCP_PAYLOAD);

 if (ret = 0 || ret  UIP_MAX_TCP_PAYLOAD)
 goto out;

 -   uip_tcp_payload_send(sk, UIP_TCP_FLAG_ACK, ret);
 +   left = ret;
 +
 +   while (left  0) {
 +   while ((len = sk-guest_acked + sk-window_size - 
 sk-seq_server) = 0)
 +   usleep(100);

So what exactly is this piece of code trying to accomplish? Surely
there's some more reasonable way to handle it?

 +   sk-payload = pos;
 +   if (len  left)
 +   len = left;
 +   if (len  UIP_MAX_TCP_PAYLOAD)
 +   len = UIP_MAX_TCP_PAYLOAD;
 +   left -= len;

 +   pos += len;
 +   uip_tcp_payload_send(sk, UIP_TCP_FLAG_ACK, len);
 +   }
 }

  out:
 @@ -199,7 +212,7 @@ out:

 sk-read_done = 1;

 -   free(sk-payload);
 +   free(payload);
 pthread_exit(NULL);

 return NULL;
 @@ -250,6 +263,8 @@ int uip_tx_do_ipv4_tcp(struct uip_tx_arg *arg)
 if (!sk)
 return -1;

 +   sk-window_size = ntohs(tcp-win);
 +
 /*
  * Setup ISN number
  */
 @@ -276,6 +291,7 @@ int uip_tx_do_ipv4_tcp(struct uip_tx_arg *arg)
 if (!sk)
 return -1;

 +   sk-window_size = ntohs(tcp-win);
 sk-guest_acked = ntohl(tcp-ack);

 if (uip_tcp_is_fin(tcp)) {
 --
 1.7.11.4

 --
 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
--
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 1/2] kvm tools: Respect guest tcp window size

2012-08-23 Thread Pekka Enberg
On Thu, Aug 23, 2012 at 12:36 PM, Asias He asias.he...@gmail.com wrote:
 while (1) {
 +   pos = payload;

 ret = read(sk-fd, payload, UIP_MAX_TCP_PAYLOAD);

 if (ret = 0 || ret  UIP_MAX_TCP_PAYLOAD)
 goto out;

 -   uip_tcp_payload_send(sk, UIP_TCP_FLAG_ACK, ret);
 +   left = ret;
 +
 +   while (left  0) {
 +   while ((len = sk-guest_acked + sk-window_size - 
 sk-seq_server) = 0)
 +   usleep(100);

 So what exactly is this piece of code trying to accomplish? Surely
 there's some more reasonable way to handle it?

 Wait until the guest is available to receive some more tcp data.

 Yes, we can introduce some sync ops here to do this. But for now, I'd
 prefer this simple method ;-)

It doesn't look all that simple and since there's no locking, it's not
safe. Can we use pthread condition variables here?

Pekka
--
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 V2] kvm tools: Add initial virtio-scsi support

2012-08-20 Thread Pekka Enberg
On Fri, Aug 17, 2012 at 1:04 PM, Pekka Enberg penb...@kernel.org wrote:
 Looks good to me. I'll sit on this for a little while if the
 virtio-scsi folks want to comment on the code.

Applied, thanks Asias!
--
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 V2] kvm tools: Add initial virtio-scsi support

2012-08-17 Thread Pekka Enberg
On Fri, Aug 17, 2012 at 12:26 PM, Asias He asias.he...@gmail.com wrote:
 This patch brings virito-scsi support to kvm tool.

 With the introduce of tcm_vhost (vhost-scsi)

tcm_vhost: Initial merge for vhost level target fabric driver

 we can implement virito-scsi by simply having vhost-scsi to handle the
 SCSI command.

 Howto use:
 1) Setup the tcm_vhost target through /sys/kernel/config

[Stefan Hajnoczi, Thanks for the script to setup tcm_vhost]

** Setup wwpn and tpgt
$ wwpn=naa.0
$ tpgt=/sys/kernel/config/target/vhost/$wwpn/tpgt_0
$ nexus=$tpgt/nexus
$ mkdir -p $tpgt
$ echo -n $wwpn  $nexus

** Setup lun using /dev/ram
$ n=0
$ lun=$tpgt/lun/lun_${n}
$ data=/sys/kernel/config/target/core/iblock_0/data_${n}
$ ram=/dev/ram${n}
$ mkdir -p $lun
$ mkdir -p $data
$ echo -n udev_path=${ram}  $data/control
$ echo -n 1  $data/enable
$ ln -s $data $lun

 2) Run kvm tool with the new disk option '-d scsi:$wwpn:$tpgt', e.g
$ lkvm run -k /boot/bzImage -d ~/img/sid.img -d scsi:naa.0:0

 Signed-off-by: Asias He asias.he...@gmail.com
 Cc: Nicholas A. Bellinger n...@linux-iscsi.org
 Cc: Stefan Hajnoczi stefa...@linux.vnet.ibm.com
 Cc: Paolo Bonzini pbonz...@redhat.com

Looks good to me. I'll sit on this for a little while if the
virtio-scsi folks want to comment on the code.

Pekka
--
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


perf uncore lkvm woes

2012-08-16 Thread Pekka Enberg
Hello,
[0.248962] Pid: 0, comm: swapper/0 Not tainted 3.6.0-rc1+ #24
[penberg@tux ~]$ cat perf-kvmtool-issue
Hello,

Has anyone seen this? It's kvmtool/next with 3.6.0-rc1. Looks like we
are doing uncore_init() on virtualized CPU which breaks boot.

Pekka

[penberg@tux kvm]$ ./vm run
  # lkvm run -k ../../arch/x86/boot/bzImage -m 448 -c 4 --name guest-30425
early console in decompress_kernel

Decompressing Linux... Parsing ELF... done.
Booting the kernel.
[0.00] Initializing cgroup subsys cpuset
[0.00] Initializing cgroup subsys cpu
[0.00] Linux version 3.6.0-rc1+ (penberg@tux) (gcc version
4.6.3 20120306 (Red Hat 4.6.3-2) (GCC) ) #24 SMP Thu Aug 16 09:55:41
EEST 2012
[0.00] Command line: noapic noacpi pci=conf1 reboot=k panic=1
i8042.direct=1 i8042.dumbkbd=1 i8042.nopnp=1 console=ttyS0
earlyprintk=serial i8042.noaux=1  root=/dev/root rw
rootflags=rw,trans=virtio,version=9p2000.L rootfstype=9p
init=/virt/init  ip=dhcp
[0.00] e820: BIOS-provided physical RAM map:
[0.00] BIOS-e820: [mem 0x-0x0009fbff] usable
[0.00] BIOS-e820: [mem 0x0009fc00-0x0009] reserved
[0.00] BIOS-e820: [mem 0x000f-0x000e] reserved
[0.00] BIOS-e820: [mem 0x0010-0x1bff] usable
[0.00] bootconsole [earlyser0] enabled
[0.00] NX (Execute Disable) protection: active
[0.00] DMI not present or invalid.
[0.00] No AGP bridge found
[0.00] e820: last_pfn = 0x1c000 max_arch_pfn = 0x4
[0.00] x86 PAT enabled: cpu 0, old 0x70106, new 0x7010600070106
[0.00] CPU MTRRs all blank - virtualized system.
[0.00] found SMP MP-table at [mem 0x000f0370-0x000f037f]
mapped at [880f0370]
[0.00] init_memory_mapping: [mem 0x-0x1bff]
[0.00] ACPI BIOS Bug: Error: A valid RSDP was not found
(20120711/tbxfroot-219)
[0.00] No NUMA configuration found
[0.00] Faking a node at [mem 0x-0x1bff]
[0.00] Initmem setup node 0 [mem 0x-0x1bff]
[0.00]   NODE_DATA [mem 0x1bffc000-0x1bff]
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x0001-0x00ff]
[0.00]   DMA32[mem 0x0100-0x]
[0.00]   Normal   empty
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x0001-0x0009efff]
[0.00]   node   0: [mem 0x0010-0x1bff]
[0.00] Intel MultiProcessor Specification v1.4
[0.00] MPTABLE: OEM ID: KVMCPU00
[0.00] MPTABLE: Product ID: 0.1
[0.00] MPTABLE: APIC at: 0xFEE0
[0.00] Processor #0 (Bootup-CPU)
[0.00] Processor #1
[0.00] Processor #2
[0.00] Processor #3
[0.00] IOAPIC[0]: apic_id 5, version 17, address 0xfec0, GSI 0-23
[0.00] Processors: 4
[0.00] smpboot: Allowing 4 CPUs, 0 hotplug CPUs
[0.00] PM: Registered nosave memory: 0009f000 - 000a
[0.00] PM: Registered nosave memory: 000a - 000f
[0.00] PM: Registered nosave memory: 000f - 000ff000
[0.00] PM: Registered nosave memory: 000ff000 - 0010
[0.00] e820: [mem 0x1c00-0x] available for PCI devices
[0.00] setup_percpu: NR_CPUS:64 nr_cpumask_bits:64
nr_cpu_ids:4 nr_node_ids:1
[0.00] PERCPU: Embedded 27 pages/cpu @88001bc0 s78272
r8192 d24128 u524288
[0.00] Built 1 zonelists in Node order, mobility grouping on.
Total pages: 112777
[0.00] Policy zone: DMA32
[0.00] Kernel command line: noapic noacpi pci=conf1 reboot=k
panic=1 i8042.direct=1 i8042.dumbkbd=1 i8042.nopnp=1 console=ttyS0
earlyprintk=serial i8042.noaux=1  root=/dev/root rw
rootflags=rw,trans=virtio,version=9p2000.L rootfstype=9p
init=/virt/init  ip=dhcp
[0.00] PID hash table entries: 2048 (order: 2, 16384 bytes)
[0.00] __ex_table already sorted, skipping sort
[0.00] xsave: enabled xstate_bv 0x7, cntxt size 0x340
[0.00] Checking aperture...
[0.00] No AGP bridge found
[0.00] Memory: 434972k/458752k available (7288k kernel code,
452k absent, 23328k reserved, 5691k data, 600k init)
[0.00] SLUB: Genslabs=15, HWalign=64, Order=0-3, MinObjects=0,
CPUs=4, Nodes=1
[0.00] Hierarchical RCU implementation.
[0.00]  RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=4.
[0.00] NR_IRQS:4352 nr_irqs:712 16
[0.00] Console: colour *CGA 80x25
[0.00] console [ttyS0] enabled, bootconsole disabled
[0.00] console [ttyS0] enabled, bootconsole disabled
[0.00] tsc: Fast TSC calibration using PIT
[0.00] tsc: Detected 2691.428 MHz processor
[0.003002] Calibrating delay loop (skipped), value calculated
using timer 

Re: perf uncore lkvm woes

2012-08-16 Thread Pekka Enberg
On Thu, Aug 16, 2012 at 10:01:58AM +0300, Pekka Enberg wrote:
  Hello,
  [0.248962] Pid: 0, comm: swapper/0 Not tainted 3.6.0-rc1+ #24
  [penberg@tux ~]$ cat perf-kvmtool-issue
  Hello,
  
  Has anyone seen this? It's kvmtool/next with 3.6.0-rc1. Looks like we
  are doing uncore_init() on virtualized CPU which breaks boot.

On Thu, 16 Aug 2012, Cyrill Gorcunov wrote:
 Hi, I guess some cpuid/msr bit is not cleared again ;) I'll take a look
 once time permit.

Alternative fix would be to change our CPUID name to KVMKVMKVM or 
something to avoid going through these code paths.

Ingo?

Pekka
--
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: perf uncore lkvm woes

2012-08-16 Thread Pekka Enberg
On 08/16/2012 03:19 PM, Peter Zijlstra wrote:
 On Thu, 2012-08-16 at 10:01 +0300, Pekka Enberg wrote:
 Has anyone seen this? It's kvmtool/next with 3.6.0-rc1. Looks like we
 are doing uncore_init() on virtualized CPU which breaks boot.

 I think you're the first.. I don't normally use kvm if I can at all
 avoid it.

 But I think its a 'simple' matter of kvm not emulating the entire
 hardware. Afaik the uncore isn't enumerated and we simply assume MSR
 presence based on cpu model.

On Thu, Aug 16, 2012 at 10:38 AM, Yan, Zheng
zheng.z@linux.intel.com wrote:
 The Intel uncore doc does not specify how to check if uncore exist.
 How about disabling uncore on virtualized CPU?

(CC'ing Avi.)
--
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: perf uncore lkvm woes

2012-08-16 Thread Pekka Enberg
On Thu, Aug 16, 2012 at 12:06 PM, Cyrill Gorcunov gorcu...@openvz.org wrote:
 Most users just install a distro, they don't mess with kernel command lines.

 The command line option might be added implicitly in qemu/lkvm.

That does not make sense for QEMU and we want less mandatory command line
options for LKVM too.

Pekka
--
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] kvm tools: Fix segfault on lkvm run

2012-08-15 Thread Pekka Enberg
On Tue, Aug 14, 2012 at 11:47 AM, Paul Neumann paul1...@yahoo.de wrote:
 Looks good to me.  Paul, can you tell how the segfault
 is triggered as
 well? Thanks.

 The segfault is triggered by just running lkvm run. On my system, it
 does not find any kernel, so kvm_cmd_run_init() returns EINVAL which
 fails the (r  0) check in kvm_cmd_run().
 Since kvm_cmd_run_init() does not get to initialize the cpus, kvm_cpus
 gets mistakenly dereferenced in kvm_cmd_run_work().

Applied with improved changelog. Thanks!
--
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] kvm tools: Add initial virtio-scsi support

2012-08-13 Thread Pekka Enberg
On Thu, Aug 9, 2012 at 3:51 AM, Asias He asias.he...@gmail.com wrote:
 This patch brings virito-scsi support to kvm tool.

 With the introduce of tcm_vhost (vhost-scsi)

tcm_vhost: Initial merge for vhost level target fabric driver

 we can implement virito-scsi by simply having vhost-scsi to handle the
 SCSI command.

 Howto use:
 1) Setup the tcm_vhost target through /sys/kernel/config

[Stefan Hajnoczi, Thanks for the script to setup tcm_vhost]

** Setup wwpn and tpgt
$ wwpn=naa.0
$ tpgt=/sys/kernel/config/target/vhost/$wwpn/tpgt_0
$ nexus=$tpgt/nexus
$ mkdir -p $tpgt
$ echo -n $wwpn  $nexus

** Setup lun using /dev/ram
$ n=0
$ lun=$tpgt/lun/lun_${n}
$ data=/sys/kernel/config/target/core/iblock_0/data_${n}
$ ram=/dev/ram${n}
$ mkdir -p $lun
$ mkdir -p $data
$ echo -n udev_path=${ram}  $data/control
$ echo -n 1  $data/enable
$ ln -s $data $lun

 2) Run kvm tool with the new disk option '-d scsi:$wwpn:$tpgt', e.g
$ lkvm run -k /boot/bzImage -d ~/img/sid.img -d scsi:naa.0:0

 Signed-off-by: Asias He asias.he...@gmail.com
 Cc: Nicholas A. Bellinger n...@linux-iscsi.org
 Cc: Stefan Hajnoczi stefa...@linux.vnet.ibm.com
 Cc: Paolo Bonzini pbonz...@redhat.com

I've included some comments below but overall, looks good to me. Sasha?

 ---
 diff --git a/tools/kvm/include/kvm/disk-image.h 
 b/tools/kvm/include/kvm/disk-image.h
 index 7ae17f8..54e4047 100644
 --- a/tools/kvm/include/kvm/disk-image.h
 +++ b/tools/kvm/include/kvm/disk-image.h
 @@ -41,6 +41,8 @@ struct disk_image_operations {

  struct disk_image_params {
 const char *filename;
 +   const char *wwpn;
 +   const char *tpgt;

Maybe it's just me but wwpn and tpgt really could use a comment
explaining what they are...

 bool readonly;
 bool direct;
  };
 @@ -57,6 +59,8 @@ struct disk_image {
  #ifdef CONFIG_HAS_AIO
 io_context_tctx;
  #endif
 +   const char  *wwpn;
 +   const char  *tpgt;
  };

  struct disk_image *disk_image__open(const char *filename, bool readonly, 
 bool direct);
 diff --git a/tools/kvm/virtio/blk.c b/tools/kvm/virtio/blk.c
 index 1fb969f..740442a 100644
 --- a/tools/kvm/virtio/blk.c
 +++ b/tools/kvm/virtio/blk.c
 @@ -290,6 +290,8 @@ int virtio_blk__init(struct kvm *kvm)
 int i, r = 0;

 for (i = 0; i  kvm-nr_disks; i++) {
 +   if (kvm-disks[i]-wwpn)
 +   continue;
 r = virtio_blk__init_one(kvm, kvm-disks[i]);
 if (r  0)
 goto cleanup;
 diff --git a/tools/kvm/virtio/scsi.c b/tools/kvm/virtio/scsi.c
 new file mode 100644
 index 000..5bcb00c
 --- /dev/null
 +++ b/tools/kvm/virtio/scsi.c
 @@ -0,0 +1,332 @@
 +#include kvm/virtio-scsi.h
 +#include kvm/virtio-pci-dev.h
 +#include kvm/disk-image.h
 +#include kvm/kvm.h
 +#include kvm/pci.h
 +#include kvm/ioeventfd.h
 +#include kvm/guest_compat.h
 +#include kvm/virtio-pci.h
 +#include kvm/virtio.h
 +
 +#include linux/kernel.h
 +#include linux/virtio_scsi.h
 +#include linux/vhost.h
 +
 +/**/
 +/* TODO: Remove this when tcm_vhost goes upstream */
 +#define TRANSPORT_IQN_LEN  224
 +#define VHOST_SCSI_ABI_VERSION 0
 +struct vhost_scsi_target {
 +   int abi_version;
 +   unsigned char vhost_wwpn[TRANSPORT_IQN_LEN];
 +   unsigned short vhost_tpgt;
 +};
 +/* VHOST_SCSI specific defines */
 +#define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct 
 vhost_scsi_target)
 +#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct 
 vhost_scsi_target)
 +#define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, struct 
 vhost_scsi_target)
 +/**/

You might as well move the above block into a small helper header file.

 +
 +
 +#define VIRTIO_SCSI_QUEUE_SIZE 128
 +#define NUM_VIRT_QUEUES3
 +
 +static LIST_HEAD(sdevs);
 +static int compat_id = -1;
 +
 +struct scsi_dev {
 +   struct virt_queue   vqs[NUM_VIRT_QUEUES];
 +   struct virtio_scsi_config   scsi_config;
 +   struct vhost_scsi_targettarget;
 +   u32 features;
 +   int vhost_fd;
 +   struct virtio_devicevdev;
 +   struct list_headlist;
 +   struct kvm  *kvm;
 +};
 +
 +static void set_config(struct kvm *kvm, void *dev, u8 data, u32 offset)
 +{
 +   struct scsi_dev *sdev = dev;
 +
 +   ((u8 *)(sdev-scsi_config))[offset] = data;

Can you introduce a helper function for this, please?

 +}
 +
 +static u8 get_config(struct kvm *kvm, void *dev, u32 offset)
 +{
 +   struct scsi_dev *sdev = dev;
 +
 +   return ((u8 *)(sdev-scsi_config))[offset];

Ditto.

 +}
 +
--
To unsubscribe from this list: send the line unsubscribe 

Re: [PATCH 2/2] kvm tools: Check for unknown parameters in network option handling

2012-08-13 Thread Pekka Enberg
On Mon, Aug 13, 2012 at 6:31 AM, Michael Ellerman
mich...@ellerman.id.au wrote:
  diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
  index a36bd00..9e5c1d4 100644
  --- a/tools/kvm/builtin-run.c
  +++ b/tools/kvm/builtin-run.c
  @@ -257,7 +257,8 @@ static int set_net_param(struct virtio_net_params *p, 
  const char *param,
  p-vhost = atoi(val);
  } else if (strcmp(param, fd) == 0) {
  p-fd = atoi(val);
  -   }
  +   } else
  +   die(Unknown network parameter %s, param);

 we need braces here:

 We don't _need_ braces, but I assume you mean you'd prefer braces?

This is Linux coding style so we don't prefer them either.
--
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] kvm tools: Fix crash when /etc/resolv.conf doesn't exist

2012-08-13 Thread Pekka Enberg
I've applied all Michal's patches. Thanks guys!
--
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


  1   2   3   4   5   6   7   8   >