[PATCH] kvm: ppc: booke: Restore SPRG3 when entering guest

2014-07-16 Thread Bharat Bhushan
SPRG3 is guest accessible and SPRG3 can be clobbered by host or another guest, So this need to be restored when loading guest state. Signed-off-by: Bharat Bhushan bharat.bhus...@freescale.com --- arch/powerpc/kvm/booke_interrupts.S | 2 ++ 1 file changed, 2 insertions(+) diff --git

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Gleb Natapov
On Tue, Jul 15, 2014 at 07:48:06PM -0700, Andy Lutomirski wrote: virtio-rng is both too complicated and insufficient for initial rng seeding. It's far too complicated to use for KASLR or any other early boot random number needs. It also provides /dev/random-style bits, which means that

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Daniel Borkmann
On 07/16/2014 08:41 AM, Gleb Natapov wrote: On Tue, Jul 15, 2014 at 07:48:06PM -0700, Andy Lutomirski wrote: virtio-rng is both too complicated and insufficient for initial rng seeding. It's far too complicated to use for KASLR or any other early boot random number needs. It also provides

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Gleb Natapov
On Wed, Jul 16, 2014 at 09:10:27AM +0200, Daniel Borkmann wrote: On 07/16/2014 08:41 AM, Gleb Natapov wrote: On Tue, Jul 15, 2014 at 07:48:06PM -0700, Andy Lutomirski wrote: virtio-rng is both too complicated and insufficient for initial rng seeding. It's far too complicated to use for KASLR

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Paolo Bonzini
Il 16/07/2014 09:10, Daniel Borkmann ha scritto: On 07/16/2014 08:41 AM, Gleb Natapov wrote: On Tue, Jul 15, 2014 at 07:48:06PM -0700, Andy Lutomirski wrote: virtio-rng is both too complicated and insufficient for initial rng seeding. It's far too complicated to use for KASLR or any other

[Bug 73331] Nested Virtualization, L2 cannot boot up on Ivybridge and Haswell

2014-07-16 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=73331 Zhou, Chao chao.z...@intel.com changed: What|Removed |Added CC||chao.z...@intel.com ---

[Bug 73331] Nested Virtualization, L2 cannot boot up on Ivybridge and Haswell

2014-07-16 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=73331 Paolo Bonzini bonz...@gnu.org changed: What|Removed |Added Status|NEW |RESOLVED

[Bug 73331] Nested Virtualization, L2 cannot boot up on Ivybridge and Haswell

2014-07-16 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=73331 robert...@intel.com changed: What|Removed |Added Status|RESOLVED|VERIFIED -- You are receiving this

KVM Test report, kernel 9f6226a7... qemu 0e162974...

2014-07-16 Thread Hu, Robert
Hi All, This is KVM upstream test result against kvm.git next branch and qemu.git master branch. kvm.git next branch: 9f6226a762c7ae02f6a23a3d4fc552dafa57ea23 based on kernel 3.16.0-rc1 qemu.git master branch: 0e16297461264b3ea8f7282d1195cf53aa8a707c We found no new bug and

[PATCH v7 00/14] kvm-unit-tests/arm: initial drop

2014-07-16 Thread Andrew Jones
This is v7 of a series that introduces arm to kvm-unit-tests. Three of the v6 patches were already merged, so this is the remainder. No new patches have been added, but some of the summaries have changed. This series first adds support for device trees (libfdt), and for chr-testdev (virtio).

[PATCH v7 06/14] lib/asm-generic: add page.h and virt_to_phys/phys_to_virt

2014-07-16 Thread Andrew Jones
Signed-off-by: Andrew Jones drjo...@redhat.com --- lib/asm-generic/io.h | 13 + lib/asm-generic/page.h | 28 2 files changed, 41 insertions(+) create mode 100644 lib/asm-generic/page.h diff --git a/lib/asm-generic/io.h b/lib/asm-generic/io.h index

[PATCH v7 03/14] Introduce asm-generic/*.h files

2014-07-16 Thread Andrew Jones
Architecture neutral code may need to call low-level io accessors, or use spinlocks. Create a generic io.h to ensure those accessors are defined, and a generic spinlock.h that complains when included, as we can't write a generic spinlock. These files can be overridden or extended by architecture

[PATCH v7 14/14] arm: vectors support

2014-07-16 Thread Andrew Jones
Add support for tests to use exception handlers using install_exception_handler(). This patch also adds start_usr(), which can be used to start a function in USR mode, using a given stack pointer. start_usr() is used by a new selftest test that checks the new vector support. Signed-off-by: Andrew

[PATCH v7 07/14] virtio: add minimal support for virtqueues

2014-07-16 Thread Andrew Jones
Currently only supports sending (outbufs), doesn't have any bells or whistles. Code adapted from the Linux Kernel. Signed-off-by: Andrew Jones drjo...@redhat.com --- v7: - {alloc,alloc_aligned} - {calloc,memalign} - changes now split between virtio.* and virtio-mmio.* files ---

[PATCH v7 11/14] arm: Add IO accessors to avoid register-writeback

2014-07-16 Thread Andrew Jones
From: Christoffer Dall christoffer.d...@linaro.org Add IO accessor functions to the arm library functions to avoid register-writeback IO accessors that are not yet supported by the kernel. Signed-off-by: Christoffer Dall christoffer.d...@linaro.org Signed-off-by: Andrew Jones drjo...@redhat.com

[PATCH v7 13/14] arm: add useful headers from the Linux kernel

2014-07-16 Thread Andrew Jones
We're going to need PSR bit defines and pt_regs. We'll also need pt_regs offsets in assembly code. This patch adapts the Linux kernel's ptrace.h and generated/asm-offsets.h to this framework. It also adapts cp15.h from the kernel, since we'll need bit defines from there too. Signed-off-by: Andrew

[PATCH v7 12/14] arm: Add arch-specific asm/page.h and __va/__pa

2014-07-16 Thread Andrew Jones
These are pretty much the same as the asm-generic version, but use phys_addr_t. Signed-off-by: Andrew Jones drjo...@redhat.com --- lib/arm/asm/io.h | 13 + lib/arm/asm/page.h | 34 +- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git

[PATCH v7 05/14] add minimal virtio support for devtree virtio-mmio

2014-07-16 Thread Andrew Jones
Support the bare minimum of virtio to enable access to the virtio-mmio config space of a device. Currently this implementation must use a device tree to find the device. Signed-off-by: Andrew Jones drjo...@redhat.com Reviewed-by: Christoffer Dall christoffer.d...@linaro.org --- v7: -

[PATCH v7 04/14] Introduce lib/alloc

2014-07-16 Thread Andrew Jones
alloc supplies three ingredients to the test framework that are all related to the support of dynamic memory allocation. The first is a set of alloc function wrappers for malloc and its friends. Using wrappers allows test code and common code to use the same interface for memory allocation at all

[PATCH v7 02/14] add support for Linux device trees

2014-07-16 Thread Andrew Jones
Build libfdt and add some device tree functions built on it to the arch-neutral lib code in order to facilitate the extraction of boot info and device base addresses. These functions should work on device trees conforming to section III of the kernel doc

[PATCH v7 08/14] Introduce chr-testdev

2014-07-16 Thread Andrew Jones
chr-testdev is a qemu backend that can be used by test code to send qemu commands. It communicates with qemu through a virtio-console device. The only command currently implemented is quit, which allows the test code to exit with a given status code, i.e. chr_testdev_exit(code). Signed-off-by:

[PATCH v7 10/14] arm: Add spinlock implementation

2014-07-16 Thread Andrew Jones
From: Christoffer Dall christoffer.d...@linaro.org Add simple busy-wait spinlock implementation for ARM. Signed-off-by: Christoffer Dall christoffer.d...@linaro.org Signed-off-by: Andrew Jones drjo...@redhat.com --- config/config-arm.mak | 3 ++- lib/arm/asm/spinlock.h | 9 ++---

[PATCH v7 09/14] arm: initial drop

2014-07-16 Thread Andrew Jones
This is the initial drop of the arm test framework and a first test that just checks that setup completed (a selftest). kvm isn't needed to run this test unless testing with smp 1. Try it out with yum install gcc-arm-linux-gnu export QEMU=[qemu with mach-virt and chr-testdev] ./configure

Re: [PATCH v7 09/14] arm: initial drop

2014-07-16 Thread Paolo Bonzini
diff --git a/arm/unittests.cfg b/arm/unittests.cfg new file mode 100644 index 0..da9dfd7b1f118 --- /dev/null +++ b/arm/unittests.cfg @@ -0,0 +1,18 @@ +# Define your new unittest following the convention: +# [unittest_name] +# file = foo.flat # Name of the flat file to be used +# smp

Re: [PATCH v7 08/14] Introduce chr-testdev

2014-07-16 Thread Levente Kurusa
- Original Message - [...] +void chr_testdev_exit(int code) +{ + char buf[8]; + int len; + + snprintf(buf, sizeof(buf), %dq, code); + len = strlen(buf); AFAIK, snprintf returns the number of characters written, so these two statements can be merged into one.

Re: [PATCH v7 09/14] arm: initial drop

2014-07-16 Thread Andrew Jones
On Wed, Jul 16, 2014 at 11:22:18AM +0200, Paolo Bonzini wrote: diff --git a/arm/unittests.cfg b/arm/unittests.cfg new file mode 100644 index 0..da9dfd7b1f118 --- /dev/null +++ b/arm/unittests.cfg @@ -0,0 +1,18 @@ +# Define your new unittest following the convention: +#

[PATCH] ensure guest's kvmclock never goes backwards when TSC jumps backward

2014-07-16 Thread Igor Mammedov
There are buggy hosts in the wild that advertise invariant TSC and as result host uses TSC as clocksource, but TSC on such host sometimes sporadically jumps backwards. This causes kvmclock to go backwards if host advertises PVCLOCK_TSC_STABLE_BIT, which turns off aggregated clock accumulator and

Re: [PATCH] ensure guest's kvmclock never goes backwards when TSC jumps backward

2014-07-16 Thread Paolo Bonzini
Il 16/07/2014 11:52, Igor Mammedov ha scritto: There are buggy hosts in the wild that advertise invariant TSC and as result host uses TSC as clocksource, but TSC on such host sometimes sporadically jumps backwards. This causes kvmclock to go backwards if host advertises PVCLOCK_TSC_STABLE_BIT,

Re: [PATCH v7 09/14] arm: initial drop

2014-07-16 Thread Paolo Bonzini
Il 16/07/2014 11:39, Andrew Jones ha scritto: PHYS_OFFSET is consistent with the kernel naming, so I'd like to keep that. I invented PHYS_END, as it can serve a nice utility (mem_size = PHYS_END - PHYS_OFFSET), and I wouldn't want to leave it as the odd one out by not granting it the privilege

Re: [PATCH] ensure guest's kvmclock never goes backwards when TSC jumps backward

2014-07-16 Thread Marcelo Tosatti
On Wed, Jul 16, 2014 at 12:18:37PM +0200, Paolo Bonzini wrote: Il 16/07/2014 11:52, Igor Mammedov ha scritto: There are buggy hosts in the wild that advertise invariant TSC and as result host uses TSC as clocksource, but TSC on such host sometimes sporadically jumps backwards. This causes

Re: [PATCH] ensure guest's kvmclock never goes backwards when TSC jumps backward

2014-07-16 Thread Igor Mammedov
On Wed, 16 Jul 2014 08:41:00 -0300 Marcelo Tosatti mtosa...@redhat.com wrote: On Wed, Jul 16, 2014 at 12:18:37PM +0200, Paolo Bonzini wrote: Il 16/07/2014 11:52, Igor Mammedov ha scritto: There are buggy hosts in the wild that advertise invariant TSC and as result host uses TSC as

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Andy Lutomirski
On Wed, Jul 16, 2014 at 12:36 AM, Paolo Bonzini pbonz...@redhat.com wrote: Il 16/07/2014 09:10, Daniel Borkmann ha scritto: On 07/16/2014 08:41 AM, Gleb Natapov wrote: On Tue, Jul 15, 2014 at 07:48:06PM -0700, Andy Lutomirski wrote: virtio-rng is both too complicated and insufficient for

Re: [PATCH] ensure guest's kvmclock never goes backwards when TSC jumps backward

2014-07-16 Thread Paolo Bonzini
Il 16/07/2014 15:55, Igor Mammedov ha scritto: On Wed, 16 Jul 2014 08:41:00 -0300 Marcelo Tosatti mtosa...@redhat.com wrote: On Wed, Jul 16, 2014 at 12:18:37PM +0200, Paolo Bonzini wrote: Il 16/07/2014 11:52, Igor Mammedov ha scritto: There are buggy hosts in the wild that advertise

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Paolo Bonzini
Il 16/07/2014 16:07, Andy Lutomirski ha scritto: This patch has nothing whatsoever to do with how much I trust the CPU vs the hypervisor. It's for the enormous installed base of machines without RDRAND. Ok. I think an MSR is fine, though I don't think it's useful for the guest to use it if

Re: [PATCH] ensure guest's kvmclock never goes backwards when TSC jumps backward

2014-07-16 Thread Igor Mammedov
On Wed, 16 Jul 2014 16:16:17 +0200 Paolo Bonzini pbonz...@redhat.com wrote: Il 16/07/2014 15:55, Igor Mammedov ha scritto: On Wed, 16 Jul 2014 08:41:00 -0300 Marcelo Tosatti mtosa...@redhat.com wrote: On Wed, Jul 16, 2014 at 12:18:37PM +0200, Paolo Bonzini wrote: Il 16/07/2014 11:52,

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Gleb Natapov
On Wed, Jul 16, 2014 at 04:32:19PM +0200, Paolo Bonzini wrote: Il 16/07/2014 16:07, Andy Lutomirski ha scritto: This patch has nothing whatsoever to do with how much I trust the CPU vs the hypervisor. It's for the enormous installed base of machines without RDRAND. Ok. I think an MSR is

Re: [PATCH] ensure guest's kvmclock never goes backwards when TSC jumps backward

2014-07-16 Thread Paolo Bonzini
Il 16/07/2014 16:51, Igor Mammedov ha scritto: I'm not sure that a per-CPU value is enough; your patch can make the problem much less frequent of course, but I'm not sure neither detection nor correction are 100% reliable. Your addition is basically a faster but less reliable version of the

Re: [PATCH] ensure guest's kvmclock never goes backwards when TSC jumps backward

2014-07-16 Thread Igor Mammedov
On Wed, 16 Jul 2014 16:55:37 +0200 Paolo Bonzini pbonz...@redhat.com wrote: Il 16/07/2014 16:51, Igor Mammedov ha scritto: I'm not sure that a per-CPU value is enough; your patch can make the problem much less frequent of course, but I'm not sure neither detection nor correction are 100%

[PATCH qemu] i386,linux-headers: Add support for kvm_get_rng_seed

2014-07-16 Thread Andy Lutomirski
This updates x86's kvm_para.h for the feature bit definition and target-i386/cpu.c for the feature name and default. Signed-off-by: Andy Lutomirski l...@amacapital.net --- linux-headers/asm-x86/kvm_para.h | 2 ++ target-i386/cpu.c| 5 +++-- 2 files changed, 5 insertions(+), 2

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Andy Lutomirski
On Wed, Jul 16, 2014 at 7:32 AM, Paolo Bonzini pbonz...@redhat.com wrote: Il 16/07/2014 16:07, Andy Lutomirski ha scritto: This patch has nothing whatsoever to do with how much I trust the CPU vs the hypervisor. It's for the enormous installed base of machines without RDRAND. Ok. I think

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread H. Peter Anvin
On 07/16/2014 07:07 AM, Andy Lutomirski wrote: This patch has nothing whatsoever to do with how much I trust the CPU vs the hypervisor. It's for the enormous installed base of machines without RDRAND. hpa suggested emulating RDRAND awhile ago, but I think that'll unusably slow -- the

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Paolo Bonzini
Il 16/07/2014 18:03, H. Peter Anvin ha scritto: I suggested emulating RDRAND *but not set the CPUID bit*. We already developed a protocol in KVM/Qemu to enumerate emulated features (created for MOVBE as I recall), specifically to service the semantic feature X will work but will be

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread H. Peter Anvin
On 07/16/2014 09:08 AM, Paolo Bonzini wrote: Il 16/07/2014 18:03, H. Peter Anvin ha scritto: I suggested emulating RDRAND *but not set the CPUID bit*. We already developed a protocol in KVM/Qemu to enumerate emulated features (created for MOVBE as I recall), specifically to service the

Re: [PATCH qemu] i386,linux-headers: Add support for kvm_get_rng_seed

2014-07-16 Thread Paolo Bonzini
Il 16/07/2014 17:52, Andy Lutomirski ha scritto: This updates x86's kvm_para.h for the feature bit definition and target-i386/cpu.c for the feature name and default. Signed-off-by: Andy Lutomirski l...@amacapital.net Thanks, looks good---assuming the kernel side will make it into 3.17, I'll

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Gleb Natapov
On Wed, Jul 16, 2014 at 09:13:23AM -0700, H. Peter Anvin wrote: On 07/16/2014 09:08 AM, Paolo Bonzini wrote: Il 16/07/2014 18:03, H. Peter Anvin ha scritto: I suggested emulating RDRAND *but not set the CPUID bit*. We already developed a protocol in KVM/Qemu to enumerate emulated features

[PATCH v2 1/5] x86,kvm: Add MSR_KVM_GET_RNG_SEED and a matching feature bit

2014-07-16 Thread Andy Lutomirski
This adds a simple interface to allow a guest to request 64 bits of host nonblocking entropy. This is independent of virtio-rng for a couple of reasons: - It's intended to be usable during early boot, when a trivial synchronous interface is needed. - virtio-rng gives blocking entropy, and

[PATCH v2 5/5] x86,kaslr: Use MSR_KVM_GET_RNG_SEED for KASLR if available

2014-07-16 Thread Andy Lutomirski
It's considerably better than any of the alternatives on KVM. Rather than reinventing all of the cpu feature query code, this fixes native_cpuid to work in PIC objects. I haven't combined it with boot/cpuflags.c's cpuid implementation: including asm/processor.h from boot/cpuflags.c results in a

[PATCH v2 4/5] random: Log how many bits we managed to seed with in init_std_data

2014-07-16 Thread Andy Lutomirski
This is useful for making sure that init_std_data is working correctly and for allaying fear when this happens: random: xyz urandom read with SMALL_NUMBER bits of entropy available Signed-off-by: Andy Lutomirski l...@amacapital.net --- drivers/char/random.c | 14 +++--- 1 file

[PATCH v2 2/5] random,x86: Add arch_get_slow_rng_u64

2014-07-16 Thread Andy Lutomirski
arch_get_slow_rng_u64 tries to get 64 bits of RNG seed data. Unlike arch_get_random_{bytes,seed}, etc., it makes no claims about entropy content. It's also likely to be much slower and should not be used frequently. That being said, it should be fast enough to call several times during boot

[PATCH v2 3/5] random: Seed pools from arch_get_slow_rng_u64 at startup

2014-07-16 Thread Andy Lutomirski
This should help solve the problem of guests starting out with predictable RNG state. Signed-off-by: Andy Lutomirski l...@amacapital.net --- drivers/char/random.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/char/random.c b/drivers/char/random.c index 0a7ac0a..e2c3d02

[PATCH v2 0/5] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Andy Lutomirski
virtio-rng is both too complicated and insufficient for initial rng seeding. It's far too complicated to use for KASLR or any other early boot random number needs. It also provides /dev/random-style bits, which means that making guest boot wait for virtio-rng is unacceptably slow, and doing it

Re: [PATCH v2 0/5] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Bandan Das
Andy Lutomirski l...@amacapital.net writes: virtio-rng is both too complicated and insufficient for initial rng seeding. It's far too complicated to use for KASLR or any other early boot random number needs. It also provides /dev/random-style bits, which means that making guest boot wait

Re: [PATCH v2 0/5] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Andy Lutomirski
On Wed, Jul 16, 2014 at 11:02 AM, Bandan Das b...@redhat.com wrote: Andy Lutomirski l...@amacapital.net writes: virtio-rng is both too complicated and insufficient for initial rng seeding. It's far too complicated to use for KASLR or any other early boot random number needs. It also

[PATCH 1/3] vfio-pci: Release devices with BusMaster disabled

2014-07-16 Thread Alex Williamson
Our current open/release path looks like this: vfio_pci_open vfio_pci_enable pci_enable_device pci_save_state pci_store_saved_state vfio_pci_release vfio_pci_disable pci_disable_device pci_restore_state pci_enable_device() doesn't modify PCI_COMMAND_MASTER, so if a

[PATCH 3/3] vfio-pci: Attempt bus/slot reset on release

2014-07-16 Thread Alex Williamson
Each time a device is released, mark whether a local reset was successful or whether a bus/slot reset is needed. If a reset is needed and all of the affected devices are bound to vfio-pci and unused, allow the reset. This is most useful when the userspace driver is killed and releases all the

[PATCH 0/3] vfio-pci: Reset improvements

2014-07-16 Thread Alex Williamson
This series is intended to improve the state of devices returned back to the host from vfio-pci or re-used by another user. First we make sure that busmaster is disabled in the saved state, so the device cannot continue to do DMA, then we add some serialization, move our reference counting under

[PATCH 2/3] vfio-pci: Use mutex around open, release, and remove

2014-07-16 Thread Alex Williamson
Serializing open/release allows us to fix a refcnt error if we fail to enable the device and lets us prevent devices from being unbound or opened, giving us an opportunity to do bus resets on release. No restriction added to serialize binding devices to vfio-pci while the mutex is held though.

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread H. Peter Anvin
On 07/16/2014 09:21 AM, Gleb Natapov wrote: On Wed, Jul 16, 2014 at 09:13:23AM -0700, H. Peter Anvin wrote: On 07/16/2014 09:08 AM, Paolo Bonzini wrote: Il 16/07/2014 18:03, H. Peter Anvin ha scritto: I suggested emulating RDRAND *but not set the CPUID bit*. We already developed a protocol

[patch V2 43/64] x86: kvm: Use ktime_get_boot_ns()

2014-07-16 Thread Thomas Gleixner
Use the new nanoseconds based interface and get rid of the timespec conversion dance. Signed-off-by: Thomas Gleixner t...@linutronix.de Cc: Gleb Natapov g...@kernel.org Cc: kvm@vger.kernel.org --- arch/x86/kvm/x86.c |6 +- 1 file changed, 1 insertion(+), 5 deletions(-) Index:

[patch V2 44/64] x86: kvm: Make kvm_get_time_and_clockread() nanoseconds based

2014-07-16 Thread Thomas Gleixner
Convert the relevant base data right away to nanoseconds instead of doing the conversion on every readout. Reduces text size by 160 bytes. Signed-off-by: Thomas Gleixner t...@linutronix.de Cc: Gleb Natapov g...@kernel.org Cc: kvm@vger.kernel.org --- arch/x86/kvm/x86.c | 44

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Andy Lutomirski
On Wed, Jul 16, 2014 at 1:20 PM, H. Peter Anvin h...@zytor.com wrote: On 07/16/2014 09:21 AM, Gleb Natapov wrote: On Wed, Jul 16, 2014 at 09:13:23AM -0700, H. Peter Anvin wrote: On 07/16/2014 09:08 AM, Paolo Bonzini wrote: Il 16/07/2014 18:03, H. Peter Anvin ha scritto: I suggested emulating

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread H. Peter Anvin
On 07/16/2014 02:32 PM, Andy Lutomirski wrote: On the theory that I see no legitimate reason to expose this to guest user space, I think we shouldn't expose it. If we wanted to add a get_random_bytes syscall, that would be an entirely different story, though. Should I send v3 as one

[PATCH v3 0/5] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Andy Lutomirski
This introduces and uses a very simple synchronous mechanism to get /dev/urandom-style bits appropriate for initial KVM PV guest RNG seeding. virtio-rng is not suitable for this purpose. It's too difficult to enumerate for use in early boot (e.g. KASLR, which runs before we even have an IDT).

[PATCH v3 3/5] random: Seed pools from arch_get_slow_rng_u64 at startup

2014-07-16 Thread Andy Lutomirski
This should help solve the problem of guests starting out with predictable RNG state. Signed-off-by: Andy Lutomirski l...@amacapital.net --- drivers/char/random.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/char/random.c b/drivers/char/random.c index 0a7ac0a..17ad33d

[PATCH v3 2/5] random,x86: Add arch_get_slow_rng_u64

2014-07-16 Thread Andy Lutomirski
arch_get_slow_rng_u64 tries to get 64 bits of RNG seed data. Unlike arch_get_random_{bytes,seed}, etc., it makes no claims about entropy content. It's also likely to be much slower and should not be used frequently. That being said, it should be fast enough to call several times during boot

[PATCH v3 5/5] x86,kaslr: Use MSR_KVM_GET_RNG_SEED for KASLR if available

2014-07-16 Thread Andy Lutomirski
It's considerably better than any of the alternatives on KVM. Rather than reinventing all of the cpu feature query code, this fixes native_cpuid to work in PIC objects. I haven't combined it with boot/cpuflags.c's cpuid implementation: including asm/processor.h from boot/cpuflags.c results in a

[PATCH v3 4/5] random: Log how many bits we managed to seed with in init_std_data

2014-07-16 Thread Andy Lutomirski
This is useful for making sure that init_std_data is working correctly and for allaying fear when this happens: random: xyz urandom read with SMALL_NUMBER bits of entropy available Signed-off-by: Andy Lutomirski l...@amacapital.net --- drivers/char/random.c | 15 --- 1 file

[PATCH v3 1/5] x86,kvm: Add MSR_KVM_GET_RNG_SEED and a matching feature bit

2014-07-16 Thread Andy Lutomirski
This adds a simple interface to allow a guest to request 64 bits of host nonblocking entropy. This is independent of virtio-rng for a couple of reasons: - It's intended to be usable during early boot, when a trivial synchronous interface is needed. - virtio-rng gives blocking entropy, and

Re: [PATCH v3 2/5] random,x86: Add arch_get_slow_rng_u64

2014-07-16 Thread H. Peter Anvin
On 07/16/2014 02:45 PM, Andy Lutomirski wrote: diff --git a/arch/x86/include/asm/archslowrng.h b/arch/x86/include/asm/archslowrng.h new file mode 100644 index 000..c8e8d0d --- /dev/null +++ b/arch/x86/include/asm/archslowrng.h @@ -0,0 +1,30 @@ +/* + * This file is part of the Linux

Re: [PATCH v3 2/5] random,x86: Add arch_get_slow_rng_u64

2014-07-16 Thread Andy Lutomirski
On Wed, Jul 16, 2014 at 2:59 PM, H. Peter Anvin h...@zytor.com wrote: On 07/16/2014 02:45 PM, Andy Lutomirski wrote: diff --git a/arch/x86/include/asm/archslowrng.h b/arch/x86/include/asm/archslowrng.h new file mode 100644 index 000..c8e8d0d --- /dev/null +++

[PATCH] KVM: x86: emulator injects #DB when RFLAGS.RF is set

2014-07-16 Thread Nadav Amit
If the RFLAGS.RF is set, then no #DB should occur on instruction breakpoints. However, the KVM emulator injects #DB regardless to RFLAGS.RF. This patch fixes this behavior. KVM, however, still appears not to update RFLAGS.RF correctly, regardless of this patch. Signed-off-by: Nadav Amit

Re: [PATCH v3 2/5] random,x86: Add arch_get_slow_rng_u64

2014-07-16 Thread Andy Lutomirski
On Wed, Jul 16, 2014 at 3:13 PM, Andy Lutomirski l...@amacapital.net wrote: My personal preference is to defer this until some user shows up. I think that even this would be too complicated for KASLR, which is the only extremely early-boot user that I found. Hmm. Does the prandom stuff want

Re: [PATCH v3 2/5] random,x86: Add arch_get_slow_rng_u64

2014-07-16 Thread H. Peter Anvin
On 07/16/2014 03:40 PM, Andy Lutomirski wrote: On Wed, Jul 16, 2014 at 3:13 PM, Andy Lutomirski l...@amacapital.net wrote: My personal preference is to defer this until some user shows up. I think that even this would be too complicated for KASLR, which is the only extremely early-boot user

Re: [PATCH v3 2/5] random,x86: Add arch_get_slow_rng_u64

2014-07-16 Thread Andy Lutomirski
On Jul 16, 2014 4:00 PM, H. Peter Anvin h...@zytor.com wrote: On 07/16/2014 03:40 PM, Andy Lutomirski wrote: On Wed, Jul 16, 2014 at 3:13 PM, Andy Lutomirski l...@amacapital.net wrote: My personal preference is to defer this until some user shows up. I think that even this would be too

Re: [PATCH v3 2/5] random,x86: Add arch_get_slow_rng_u64

2014-07-16 Thread H. Peter Anvin
On 07/16/2014 05:03 PM, Andy Lutomirski wrote: prandom is exactly the opposite; it is designed for when we need possibly low quality random numbers very quickly. RDRAND is actually too slow. I meant that prandom isn't using rdrand for early seeding. We should probably fix that.

[PATCH 2/3] KVM: nVMX: Fix fail to get nested ack intr's vector during nested vmexit

2014-07-16 Thread Wanpeng Li
WARNING: CPU: 9 PID: 7251 at arch/x86/kvm/vmx.c:8719 nested_vmx_vmexit+0xa4/0x233 [kvm_intel]() Modules linked in: tun nfsv3 nfs_acl auth_rpcgss oid_registry nfsv4 dns_resolver nfs fscache lockd sunrpc pci_stub netconsole kvm_intel kvm bridge stp llc autofs4 8021q ipv6 uinput joydev microcode

[PATCH 3/3] KVM: nVMX: Fix vmptrld fail and vmwrite error when L1 goes down

2014-07-16 Thread Wanpeng Li
This bug can be trigger by L1 goes down directly w/ enable_shadow_vmcs. [ 6413.158950] kvm: vmptrld (null)/7800 failed [ 6413.158954] vmwrite error: reg 401e value 4 (err 1) [ 6413.158957] CPU: 0 PID: 4840 Comm: qemu-system-x86 Tainted: G OE 3.16.0kvm+ #2 [

[PATCH 1/3] KVM: nVMX: Fix virtual interrupt delivery injection

2014-07-16 Thread Wanpeng Li
This patch fix bug reported in https://bugzilla.kernel.org/show_bug.cgi?id=73331, after the patch http://www.spinics.net/lists/kvm/msg105230.html applied, there is some progress and the L2 can boot up, however, slowly. The original idea of this fix vid injection patch is from Zhang, Yang Z

RE: [PATCH 2/3] KVM: nVMX: Fix fail to get nested ack intr's vector during nested vmexit

2014-07-16 Thread Zhang, Yang Z
Wanpeng Li wrote on 2014-07-17: WARNING: CPU: 9 PID: 7251 at arch/x86/kvm/vmx.c:8719 nested_vmx_vmexit+0xa4/0x233 [kvm_intel]() Modules linked in: tun nfsv3 nfs_acl auth_rpcgss oid_registry nfsv4 dns_resolver nfs fscache lockd sunrpc pci_stub netconsole kvm_intel kvm bridge stp llc autofs4

[PATCH] kvm: ppc: booke: Restore SPRG3 when entering guest

2014-07-16 Thread Bharat Bhushan
SPRG3 is guest accessible and SPRG3 can be clobbered by host or another guest, So this need to be restored when loading guest state. Signed-off-by: Bharat Bhushan bharat.bhus...@freescale.com --- arch/powerpc/kvm/booke_interrupts.S | 2 ++ 1 file changed, 2 insertions(+) diff --git

[PATCH v3] Use the POWER8 Micro Partition Prefetch Engine in KVM HV on POWER8

2014-07-16 Thread Stewart Smith
The POWER8 processor has a Micro Partition Prefetch Engine, which is a fancy way of saying has way to store and load contents of L2 or L2+MRU way of L3 cache. We initiate the storing of the log (list of addresses) using the logmpp instruction and start restore by writing to a SPR. The logmpp