[PATCH V2 3/10] KVM/MMU: Add last_level in the struct mmu_spte_page

2019-02-01 Thread lantianyu1986
From: Lan Tianyu This patch is to add last_level in the struct kvm_mmu_page. When build flush tlb range list, last_level will be used to identify whehter the page should be added into list. Signed-off-by: Lan Tianyu --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/mmu.c |

[PATCH V2 5/10] KVM/MMU: Flush tlb with range list in sync_page()

2019-02-01 Thread lantianyu1986
From: Lan Tianyu This patch is to flush tlb via flush list function. Put page into flush list when return value of set_spte() includes flag SET_SPTE_NEED_REMOTE_TLB_FLUSH. kvm_flush_remote_ tlbs_with_list() checks whether the flush list is empty or not. It also checks whether range tlb flush is

[PATCH V2 8/10] KVM: Use tlb range flush in the kvm_vm_ioctl_get/clear_dirty_log()

2019-02-01 Thread lantianyu1986
From: Lan Tianyu This patch is to use tlb range flush to flush memslot's in the kvm_vm_ioctl_get/clear_dirty_log() instead of flushing tlbs of entire ept page table when range flush is available. Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 8 +--- arch/x86/kvm/mmu.h | 7 +++

[PATCH V2 6/10] KVM/MMU: Flush tlb directly in the kvm_mmu_slot_gfn_write_protect()

2019-02-01 Thread lantianyu1986
From: Lan Tianyu This patch is to flush tlb directly in the kvm_mmu_slot_gfn_write_protect() when range flush is available. Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index

[PATCH V2 9/10] KVM: Add flush parameter for kvm_age_hva()

2019-02-01 Thread lantianyu1986
From: Lan Tianyu This patch is to add flush parameter for kvm_aga_hva() and move tlb flush from kvm_mmu_notifier_clear_flush_young() to kvm_age_hva(). kvm_age_hva() can check whether tlb flush is necessary when return value young is more than 0. Flush tlb if both conditions are met.

[PATCH V2 4/10] KVM/MMU: Introduce tlb flush with range list

2019-02-01 Thread lantianyu1986
From: Lan Tianyu This patch is to introduce tlb flush with range list interface and use struct kvm_mmu_page as list entry. Use flush list function in the kvm_mmu_commit_zap_page(). Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 25 - 1 file changed, 24

[PATCH V2 2/10] KVM/VMX: Fill range list in kvm_fill_hv_flush_list_func()

2019-02-01 Thread lantianyu1986
From: Lan Tianyu Populate ranges on the flush list into struct hv_guest_mapping_flush_list when flush list is available in the struct kvm_tlb_range. Signed-off-by: Lan Tianyu --- Change since v1: Make flush list as a "hlist" instead of a "list" in order to keep struct

[PATCH V2 1/10] X86/Hyper-V: Add parameter offset for hyperv_fill_flush_guest_mapping_list()

2019-02-01 Thread lantianyu1986
From: Lan Tianyu Add parameter offset to specify start position to add flush ranges in guest address list of struct hv_guest_mapping_flush_list. Signed-off-by: Lan Tianyu --- arch/x86/hyperv/nested.c| 4 ++-- arch/x86/include/asm/mshyperv.h | 2 +- arch/x86/kvm/vmx/vmx.c | 2

[PATCH V2 00/10] X86/KVM/Hyper-V: Add HV ept tlb range list flush support in KVM

2019-02-01 Thread lantianyu1986
From: Lan Tianyu This patchset is to introduce hv ept tlb range list flush function support in the KVM MMU component. Flushing ept tlbs of several address range can be done via single hypercall and new list flush function is used in the kvm_mmu_commit_zap_page() and FNAME(sync_page). This

Re: Re: [PATCH v3 1/3] KVM: arm/arm64: vgic: Make vgic_irq->irq_lock a raw_spinlock

2019-02-01 Thread Julia Cartwright
On Fri, Feb 01, 2019 at 03:30:58PM +, Julien Grall wrote: > Hi Julien, > > On 07/01/2019 15:06, Julien Thierry wrote: > > vgic_irq->irq_lock must always be taken with interrupts disabled as > > it is used in interrupt context. > > I am a bit confused with the reason here. The code mention

Re: [PATCH v3 1/3] KVM: arm/arm64: vgic: Make vgic_irq->irq_lock a raw_spinlock

2019-02-01 Thread Julien Grall
Hi Julia, On 01/02/2019 17:36, Julia Cartwright wrote: On Fri, Feb 01, 2019 at 03:30:58PM +, Julien Grall wrote: Hi Julien, On 07/01/2019 15:06, Julien Thierry wrote: vgic_irq->irq_lock must always be taken with interrupts disabled as it is used in interrupt context. I am a bit

Re: [PATCH v3 1/3] KVM: arm/arm64: vgic: Make vgic_irq->irq_lock a raw_spinlock

2019-02-01 Thread Julien Grall
Hi Julien, On 07/01/2019 15:06, Julien Thierry wrote: vgic_irq->irq_lock must always be taken with interrupts disabled as it is used in interrupt context. I am a bit confused with the reason here. The code mention that ap_list_lock could be taken from the timer interrupt handler interrupt. I

[PATCH V2 00/10] X86/KVM/Hyper-V: Add HV ept tlb range list flush support in KVM

2019-02-01 Thread lantianyu1986
From: Lan Tianyu This patchset is to introduce hv ept tlb range list flush function support in the KVM MMU component. Flushing ept tlbs of several address range can be done via single hypercall and new list flush function is used in the kvm_mmu_commit_zap_page() and FNAME(sync_page). This

Re: [PATCH v8 18/26] ACPI / APEI: Make GHES estatus header validation more user friendly

2019-02-01 Thread Borislav Petkov
On Tue, Jan 29, 2019 at 06:48:54PM +, James Morse wrote: > ghes_read_estatus() checks various lengths in the top-level header to > ensure the CPER records to be read aren't obviously corrupt. > > Take the opportunity to make this more user-friendly, printing a > (ratelimited) message about

Re: [PATCH v8 09/26] ACPI / APEI: Generalise the estatus queue's notify code

2019-02-01 Thread Borislav Petkov
On Tue, Jan 29, 2019 at 06:48:45PM +, James Morse wrote: > +static int ghes_in_nmi_spool_from_list(struct list_head *rcu_list) > +{ > + int err, ret = -ENOENT; > + struct ghes *ghes; > + > + rcu_read_lock(); > + list_for_each_entry_rcu(ghes, rcu_list, list) { > +

Re: [PATCH v2 1/4] KVM: arm64: Forbid kprobing of the VHE world-switch code

2019-02-01 Thread Marc Zyngier
On 24/01/2019 16:32, James Morse wrote: > On systems with VHE the kernel and KVM's world-switch code run at the > same exception level. Code that is only used on a VHE system does not > need to be annotated as __hyp_text as it can reside anywhere in the > kernel text. > > __hyp_text was also used

Re: [PATCH v8 04/26] ACPI / APEI: Make hest.c manage the estatus memory pool

2019-02-01 Thread Borislav Petkov
On Tue, Jan 29, 2019 at 06:48:40PM +, James Morse wrote: > ghes.c has a memory pool it uses for the estatus cache and the estatus > queue. The cache is initialised when registering the platform driver. > For the queue, an NMI-like notification has to grow/shrink the pool > as it is registered

[PATCH v2 2/4] Makefile: support -s switch

2019-02-01 Thread Andre Przywara
"make -s" suppresses normal output, just shows warnings and errors. But since we explicitly override the make output with our fancy concise version, we miss out on this feature. Do as the kernel does and explicitly suppress every normal output when -s is given. This helps to spot warnings that

[PATCH v2 1/4] arm: fdt: add stdout-path to /chosen node

2019-02-01 Thread Andre Przywara
The DT spec describes the stdout-path property in the /chosen node to contain the DT path for a default device usable for outputting characters. The Linux kernel uses this for earlycon (without further parameters), other DT users might rely on this as well. Add a stdout-path property pointing to

[PATCH v2 4/4] arm: Auto-detect guest GIC type

2019-02-01 Thread Andre Przywara
At the moment kvmtool always tries to instantiate a virtual GICv2 for the guest, and fails with some scary error message if that doesn't work. The user has then to manually specify "--irqchip=gicv3", which is not really obvious. With the advent of more GICv3-only machines, let's try to be more

[PATCH v2 3/4] Makefile: Remove echoing of kvmtools version file

2019-02-01 Thread Andre Przywara
On every build we report the kvmtool "version" number, which isn't meaningful at all anymore. Remove the line from the KVMTOOLS-VERSION-GEN script to drop a pointless message. Signed-off-by: Andre Przywara --- util/KVMTOOLS-VERSION-GEN | 1 - 1 file changed, 1 deletion(-) diff --git

[PATCH v2 0/4] Various convenience fixes

2019-02-01 Thread Andre Przywara
As I found myself using kvmtool more often in the last weeks, I got more and more annoyed by some smaller "ticks" that kvmtool shows. So this is an attempt to post various smaller fixes I gathered up over the years, but never found worth enough to send out. Version 2 drops the two patches that

Re: [PATCH v2 3/4] arm64: hyp-stub: Forbid kprobing of the hyp-stub

2019-02-01 Thread James Morse
Hi Christoffer, On 31/01/2019 08:04, Christoffer Dall wrote: > On Thu, Jan 24, 2019 at 04:32:56PM +, James Morse wrote: >> The hyp-stub is loaded by the kernel's early startup code at EL2 >> during boot, before KVM takes ownership later. The hyp-stub's >> text is part of the regular kernel

[kvm-unit-tests PATCH v2 3/5] lib: arm: Use ns16550a UART when --vmm=kvmtool

2019-02-01 Thread Alexandru Elisei
When kvm-unit-tests is configured with --vmm=kvmtool, use the address for the ns16550a UART that kvmtool emulates. When the virtual machine manager is QEMU, use the address for the pl011 UART, as before. Signed-off-by: Alexandru Elisei --- configure| 10 +++--- lib/arm/io.c | 27

[kvm-unit-tests PATCH v2 5/5] lib: arm: Fallback to psci_system_off() in exit()

2019-02-01 Thread Alexandru Elisei
On arm and arm64, kvm-unit-tests uses the QEMU chr-testdev device to shut down the virtual machine at the end of a test. The function psci_system_off() provides another mechanism for terminating the virtual machine. chr-testdev is implemented on top of virtio console. If the virtual machine

[kvm-unit-tests PATCH v2 4/5] lib: arm: Implement PSCI SYSTEM_OFF in psci_system_off()

2019-02-01 Thread Alexandru Elisei
A new function, psci_system_off(), is added which implements the PSCI SYSTEM_OFF function. A call causes the hypervisor to terminate the virtual machine. We take this opportunity to rename psci_sys_reset() to psci_system_reset() to match the name of the PSCI function SYSTEM_RESET that it

[kvm-unit-tests PATCH v2 1/5] lib: arm: Use UART address from generated config.h

2019-02-01 Thread Alexandru Elisei
Generate lib/config.h when configuring kvm-unit-tests. The file is empty for all architectures except for arm and arm64, where it is used to store the UART base address. This removes the hardcoded address from lib/arm/io.c and provides a mechanism for using different UART addresses in the future.

[kvm-unit-tests PATCH v2 2/5] configure: arm/arm64: Add --vmm option with no effect

2019-02-01 Thread Alexandru Elisei
Add configuration option --vmm to specify the virtual machine manager. Valid choices are 'qemu' and 'kvmtool', the default being 'qemu'. This option is only available for the arm and arm64 architectures and does nothing for now. Signed-off-by: Alexandru Elisei --- configure | 10 ++ 1

[kvm-unit-tests PATCH v2 0/5] arm/arm64: Add support for running under kvmtool

2019-02-01 Thread Alexandru Elisei
kvm-unit-tests is designed to be run with QEMU as the virtual machine monitor. It relies on devices emulated by QEMU (like isa-debug-exit or testdev) and it makes certain assumptions based on the implicit QEMU virtual environment configuration (like the serial base address). kvmtool [1] is a

Re: [PATCH kvmtool 2/6] arm: fdt: add stdout-path to /chosen node

2019-02-01 Thread Andre Przywara
On Fri, 1 Feb 2019 06:26:58 + Will Deacon wrote: Hi, > On Thu, Jan 31, 2019 at 02:57:11PM +, Andre Przywara wrote: > > On Wed, 30 Jan 2019 18:20:19 + > > Will Deacon wrote: > > > On Fri, Jan 25, 2019 at 06:07:57PM +, Andre Przywara wrote: > > > > The DT spec describes the

Re: [PATCH v2 1/4] KVM: arm64: Forbid kprobing of the VHE world-switch code

2019-02-01 Thread Christoffer Dall
On Thu, Jan 31, 2019 at 06:53:06PM +, James Morse wrote: > Hey Christoffer, > > On 31/01/2019 08:08, Christoffer Dall wrote: > > On Thu, Jan 24, 2019 at 04:32:54PM +, James Morse wrote: > >> On systems with VHE the kernel and KVM's world-switch code run at the > >> same exception level.