Re: [PATCH 2/2] KVM: Create debugfs dir and stat files for each VM

2015-11-27 Thread Tyler Baker
On 27 November 2015 at 00:54, Christian Borntraeger wrote: > On 11/26/2015 09:47 PM, Christian Borntraeger wrote: >> On 11/26/2015 05:17 PM, Tyler Baker wrote: >>> Hi Christian, >>> >>> The kernelci.org bot recently has been reporting kvm guest boot >>> failures[1] on

[PATCH v2 13/21] arm64: KVM: Implement TLB handling

2015-11-27 Thread Marc Zyngier
Implement the TLB handling as a direct translation of the assembly code version. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp/Makefile | 1 + arch/arm64/kvm/hyp/tlb.c| 72 + 2 files changed, 73 insertions(+) create

[PATCH v2 14/21] arm64: KVM: HYP mode entry points

2015-11-27 Thread Marc Zyngier
Add the entry points for HYP mode (both for hypercalls and exception handling). Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp/Makefile| 1 + arch/arm64/kvm/hyp/hyp-entry.S | 198 + 2 files changed, 199 insertions(+)

[PATCH v2 06/21] arm64: KVM: Implement system register save/restore

2015-11-27 Thread Marc Zyngier
Implement the system registe save restore as a direct translation of the assembly code version. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp/Makefile| 1 + arch/arm64/kvm/hyp/hyp.h | 3 ++ arch/arm64/kvm/hyp/sysreg-sr.c | 90

[PATCH v2 15/21] arm64: KVM: Add panic handling

2015-11-27 Thread Marc Zyngier
Add the panic handler, together with the small bits of assembly code to call the kernel's panic implementation. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp/hyp-entry.S | 11 ++- arch/arm64/kvm/hyp/hyp.h | 1 + arch/arm64/kvm/hyp/switch.c| 30

[PATCH v2 20/21] arm64: KVM: Cleanup asm-offset.c

2015-11-27 Thread Marc Zyngier
As we've now rewritten most of our code-base in C, most of the KVM-specific code in asm-offset.c is useless. Delete-time again! Signed-off-by: Marc Zyngier --- arch/arm64/kernel/asm-offsets.c | 39 --- 1 file changed, 39 deletions(-)

[PATCH v2 11/21] arm64: KVM: Implement the core world switch

2015-11-27 Thread Marc Zyngier
Implement the core of the world switch in C. Not everything is there yet, and there is nothing to re-enter the world switch either. But this already outlines the code structure well enough. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp/Makefile | 1 +

[PATCH v2 08/21] arm64: KVM: Implement debug save/restore

2015-11-27 Thread Marc Zyngier
Implement the debug save restore as a direct translation of the assembly code version. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp/Makefile | 1 + arch/arm64/kvm/hyp/debug-sr.c | 130 ++ arch/arm64/kvm/hyp/hyp.h | 9

[PATCH v2 19/21] arm64: KVM: Turn system register numbers to an enum

2015-11-27 Thread Marc Zyngier
Having the system register numbers as #defines has been a pain since day one, as the ordering is pretty fragile, and moving things around leads to renumbering and epic conflict resolutions. Now that we're mostly acessing the sysreg file in C, an enum is a much better type to use, and we can clean

[PATCH v2 00/21] arm64: KVM: world switch in C

2015-11-27 Thread Marc Zyngier
Once upon a time, the KVM/arm64 world switch was a nice, clean, lean and mean piece of hand-crafted assembly code. Over time, features have crept in, the code has become harder to maintain, and the smallest change is a pain to introduce. The VHE patches are a prime example of why this doesn't work

[PATCH v2 03/21] arm64: KVM: Implement vgic-v2 save/restore

2015-11-27 Thread Marc Zyngier
Implement the vgic-v2 save restore (mostly) as a direct translation of the assembly code version. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/Makefile | 1 + arch/arm64/kvm/hyp/Makefile | 5 +++ arch/arm64/kvm/hyp/hyp.h| 3 ++

[PATCH v2 02/21] arm64: KVM: Add a HYP-specific header file

2015-11-27 Thread Marc Zyngier
In order to expose the various EL2 services that are private to the hypervisor, add a new hyp.h file. So far, it only contains mundane things such as section annotation and VA manipulation. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp/hyp.h | 31

[PATCH v2 01/21] arm64: Add macros to read/write system registers

2015-11-27 Thread Marc Zyngier
From: Mark Rutland Rather than crafting custom macros for reading/writing each system register provide generics accessors, read_sysreg and write_sysreg, for this purpose. Unlike read_cpuid, calls to read_exception_reg are never expected to be optimized away or replaced

[PATCH v2 09/21] arm64: KVM: Implement guest entry

2015-11-27 Thread Marc Zyngier
Contrary to the previous patch, the guest entry is fairly different from its assembly counterpart, mostly because it is only concerned with saving/restoring the GP registers, and nothing else. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp/Makefile | 1 +

[PATCH v2 05/21] arm64: KVM: Implement timer save/restore

2015-11-27 Thread Marc Zyngier
Implement the timer save restore as a direct translation of the assembly code version. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp/Makefile | 1 + arch/arm64/kvm/hyp/hyp.h | 3 ++ arch/arm64/kvm/hyp/timer-sr.c| 71

[PATCH v2 17/21] arm64: KVM: Map the kernel RO section into HYP

2015-11-27 Thread Marc Zyngier
In order to run C code in HYP, we must make sure that the kernel's RO section in mapped into HYP (otherwise things break badly). Signed-off-by: Marc Zyngier --- arch/arm/kvm/arm.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/kvm/arm.c

[PATCH v2 16/21] arm64: KVM: Add compatibility aliases

2015-11-27 Thread Marc Zyngier
So far, we've implemented the new world switch with a completely different namespace, so that we could have both implementation compiled in. Let's take things one step further by adding weak aliases that have the same names as the original implementation. The weak attributes allows the new

[PATCH v2 04/21] arm64: KVM: Implement vgic-v3 save/restore

2015-11-27 Thread Marc Zyngier
Implement the vgic-v3 save restore as a direct translation of the assembly code version. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp/Makefile | 1 + arch/arm64/kvm/hyp/hyp.h| 3 + arch/arm64/kvm/hyp/vgic-v3-sr.c | 222

[PATCH v2 07/21] arm64: KVM: Implement 32bit system register save/restore

2015-11-27 Thread Marc Zyngier
Implement the 32bit system register save restore as a direct translation of the assembly code version. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp/hyp.h | 2 ++ arch/arm64/kvm/hyp/sysreg-sr.c | 41 + 2 files changed, 43

[PATCH v2 12/21] arm64: KVM: Implement fpsimd save/restore

2015-11-27 Thread Marc Zyngier
Implement the fpsimd save restore, keeping the lazy part in assembler (as returning to C would be overkill). Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp/Makefile| 1 + arch/arm64/kvm/hyp/entry.S | 32 +++-

[PATCH v2 18/21] arm64: KVM: Move away from the assembly version of the world switch

2015-11-27 Thread Marc Zyngier
This is it. We remove all of the code that has now been rewritten. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/Makefile |2 - arch/arm64/kvm/hyp.S| 1081 +-- arch/arm64/kvm/vgic-v2-switch.S | 134 -

[PATCH v2 21/21] arm64: KVM: Remove weak attributes

2015-11-27 Thread Marc Zyngier
As we've now switched to the new world switch implementation, remove the weak attributes, as nobody is supposed to override it anymore. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp/debug-sr.c | 5 ++--- arch/arm64/kvm/hyp/hyp-entry.S | 3 ---

[PATCH v2 10/21] arm64: KVM: Add patchable function selector

2015-11-27 Thread Marc Zyngier
KVM so far relies on code patching, and is likely to use it more in the future. The main issue is that our alternative system works at the instruction level, while we'd like to have alternatives at the function level. In order to cope with this, add the "hyp_alternate_select" macro that outputs a

Re: [PATCH 2/2] KVM: Create debugfs dir and stat files for each VM

2015-11-27 Thread Tyler Baker
On 27 November 2015 at 09:08, Tyler Baker wrote: > On 27 November 2015 at 00:54, Christian Borntraeger > wrote: >> On 11/26/2015 09:47 PM, Christian Borntraeger wrote: >>> On 11/26/2015 05:17 PM, Tyler Baker wrote: Hi Christian, The

RE: [PATCH v1 1/7] drivers/hv: Move HV_SYNIC_STIMER_COUNT into Hyper-V UAPI x86 header

2015-11-27 Thread KY Srinivasan
> -Original Message- > From: Andrey Smetanin [mailto:asmeta...@virtuozzo.com] > Sent: Wednesday, November 25, 2015 7:20 AM > To: kvm@vger.kernel.org > Cc: Gleb Natapov ; Paolo Bonzini > ; KY Srinivasan ; Haiyang > Zhang

RE: [PATCH v1 2/7] drivers/hv: Move struct hv_message into UAPI Hyper-V x86 header

2015-11-27 Thread KY Srinivasan
> -Original Message- > From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo > Bonzini > Sent: Friday, November 27, 2015 1:35 AM > To: Andrey Smetanin ; kvm@vger.kernel.org > Cc: Gleb Natapov ; KY Srinivasan

Re: [PATCH v1 0/5] KVM-UNIT-TESTS: Hyper-V SynIC timers test

2015-11-27 Thread Paolo Bonzini
On 26/11/2015 17:29, Andrey Smetanin wrote: > The test checks Hyper-V SynIC timers functionality. > The test runs on every vCPU and performs start/stop > of periodic/one-shot timers (with period=1ms) and checks > validity of received expiration messages in appropriate > ISR's. > >

Re: [PATCH v1 5/5] x86: Hyper-V SynIC timers test

2015-11-27 Thread Paolo Bonzini
On 27/11/2015 12:30, Andrey Smetanin wrote: >>> >>> + >>> +static void stimer_test_cleanup(void *ctx) >>> +{ >>> +irq_enable(); >> >> Why enable again? > I'll remove it. I guess you can remove the one in stimer_test_prepare too. If the interrupts are disabled you don't get the IPI either,

Re: [PATCH v1 2/7] drivers/hv: Move struct hv_message into UAPI Hyper-V x86 header

2015-11-27 Thread Andrey Smetanin
On 11/27/2015 12:34 PM, Paolo Bonzini wrote: On 25/11/2015 16:20, Andrey Smetanin wrote: This struct is required for Hyper-V SynIC timers implementation inside KVM and for upcoming Hyper-V VMBus support by userspace(QEMU). So place it into Hyper-V UAPI header. Signed-off-by: Andrey

Re: [PATCH v1 5/5] x86: Hyper-V SynIC timers test

2015-11-27 Thread Paolo Bonzini
The test logic is good, but the glue can be improved a bit so that the output is more useful if it breaks. On 26/11/2015 17:29, Andrey Smetanin wrote: > The test checks Hyper-V SynIC timers functionality. > The test runs on every vCPU and performs start/stop > of periodic/one-shot timers (with

Re: [PATCH v1 7/7] kvm/x86: Hyper-V SynIC timers

2015-11-27 Thread Andrey Smetanin
On 11/27/2015 01:49 PM, Paolo Bonzini wrote: On 27/11/2015 09:12, Roman Kagan wrote: + n = div64_u64(time_now - stimer->exp_time, stimer->count) + 1; + stimer->exp_time += n * stimer->count; This is actually just a reminder calculation so I'd rather do it directly with

Re: [PATCH v1 0/5] KVM-UNIT-TESTS: Hyper-V SynIC timers test

2015-11-27 Thread Andrey Smetanin
On 11/27/2015 02:17 PM, Paolo Bonzini wrote: On 26/11/2015 17:29, Andrey Smetanin wrote: The test checks Hyper-V SynIC timers functionality. The test runs on every vCPU and performs start/stop of periodic/one-shot timers (with period=1ms) and checks validity of received expiration messages

Re: [PATCH v1 5/5] x86: Hyper-V SynIC timers test

2015-11-27 Thread Andrey Smetanin
On 11/27/2015 02:17 PM, Paolo Bonzini wrote: The test logic is good, but the glue can be improved a bit so that the output is more useful if it breaks. Thanks for comments below. I'll redo this patch. On 26/11/2015 17:29, Andrey Smetanin wrote: The test checks Hyper-V SynIC timers

Re: [PATCH 2/2] KVM: Create debugfs dir and stat files for each VM

2015-11-27 Thread Tyler Baker
On 27 November 2015 at 10:53, Tyler Baker wrote: > On 27 November 2015 at 09:08, Tyler Baker wrote: >> On 27 November 2015 at 00:54, Christian Borntraeger >> wrote: >>> On 11/26/2015 09:47 PM, Christian Borntraeger wrote:

Re: [PATCH v1 2/7] drivers/hv: Move struct hv_message into UAPI Hyper-V x86 header

2015-11-27 Thread Paolo Bonzini
On 25/11/2015 16:20, Andrey Smetanin wrote: > This struct is required for Hyper-V SynIC timers implementation inside KVM > and for upcoming Hyper-V VMBus support by userspace(QEMU). So place it into > Hyper-V UAPI header. > > Signed-off-by: Andrey Smetanin >

Re: [PATCH v1 7/7] kvm/x86: Hyper-V SynIC timers

2015-11-27 Thread Roman Kagan
On Wed, Nov 25, 2015 at 06:20:21PM +0300, Andrey Smetanin wrote: > Per Hyper-V specification (and as required by Hyper-V-aware guests), > SynIC provides 4 per-vCPU timers. Each timer is programmed via a pair > of MSRs, and signals expiration by delivering a special format message > to the

Re: [PATCH v1 6/7] kvm/x86: Hyper-V SynIC message slot pending clearing at SINT ack

2015-11-27 Thread Roman Kagan
On Wed, Nov 25, 2015 at 06:20:20PM +0300, Andrey Smetanin wrote: > The SynIC message protocol mandates that the message slot is claimed > by atomically setting message type to something other than HVMSG_NONE. > If another message is to be delivered while the slot is still busy, > message pending

Re: [PATCH 2/2] KVM: Create debugfs dir and stat files for each VM

2015-11-27 Thread Christian Borntraeger
On 11/26/2015 09:47 PM, Christian Borntraeger wrote: > On 11/26/2015 05:17 PM, Tyler Baker wrote: >> Hi Christian, >> >> The kernelci.org bot recently has been reporting kvm guest boot >> failures[1] on various arm64 platforms in next-20151126. The bot >> bisected[2] the failures to the commit in

Re: [PATCH v1 7/7] kvm/x86: Hyper-V SynIC timers

2015-11-27 Thread Paolo Bonzini
On 27/11/2015 09:12, Roman Kagan wrote: >> > + n = div64_u64(time_now - stimer->exp_time, stimer->count) + 1; >> > + stimer->exp_time += n * stimer->count; > This is actually just a reminder calculation so I'd rather do it > directly with div64_u64_rem(). It took me a while to understand why