Re: [PATCH v7 13/17] KVM: Add an arch specific hooks in 'struct kvm_kernel_irqfd'

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > +void kvm_arch_irqfd_init(struct kvm_kernel_irqfd *irqfd) > +{ > + irqfd->arch_update = kvm_arch_update_pi_irte; > +} > + > EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_exit); > EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_inj_virq); > EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_page_fa

Re: [PATCH v7 12/17] KVM: Implement IRQ bypass consumer callbacks for x86

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > + struct kvm_kernel_irqfd *irqfd = > + container_of(cons, struct kvm_kernel_irqfd, consumer); > + > + irqfd->producer = prod; This assignment should be under "if (kvm_x86_ops->update_pi_irte)". > + return kvm_arch_update_pi_irte(irqf

Re: [PATCH v7 10/17] KVM: x86: Update IRTE for posted-interrupts

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > +int kvm_arch_update_pi_irte(struct kvm *kvm, unsigned int host_irq, > + uint32_t guest_irq, bool set) Please move all of this code to a vmx.c callback instead of adding get_pi_desc_addr. Check if this makes the pi_set_sn and pi_clear

Re: [PATCH v7 03/17] KVM: Define a new interface kvm_intr_is_single_vcpu()

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > This patch defines a new interface kvm_intr_is_single_vcpu(), > which can returns whether the interrupt is for single-CPU or not. > > It is used by VT-d PI, since now we only support single-CPU > interrupts, For lowest-priority interrupts, if user configures

Re: [PATCH v7 02/17] KVM: Add some helper functions for Posted-Interrupts

2015-09-11 Thread Paolo Bonzini
pi_desc) > +{ > + return test_bit(POSTED_INTR_SN, > + (unsigned long *)&pi_desc->control); > +} > + > struct vcpu_vmx { > struct kvm_vcpu vcpu; > unsigned long host_rsp; > Reviewed-by: Paolo Bonzini -- 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 V4 0/4] Fast MMIO eventfd fixes

2015-09-11 Thread Paolo Bonzini
On 11/09/2015 10:15, Michael S. Tsirkin wrote: > I think we should add a capability for fast mmio. > This way, userspace can avoid crashing buggy kernels. I agree. Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More

Re: [PATCH V4 3/4] kvm: fix zero length mmio searching

2015-09-11 Thread Paolo Bonzini
On 11/09/2015 05:17, Jason Wang wrote: > + int len = r2->len ? r1->len : 0; > + > if (r1->addr < r2->addr) > return -1; > - if (r1->addr + r1->len > r2->addr + r2->len) > + if (r1->addr + len > r2->addr + r2->len) > return 1; Perhaps better:

Re: [PATCH V4 1/4] kvm: factor out core eventfd assign/deassign logic

2015-09-11 Thread Paolo Bonzini
On 11/09/2015 09:39, Cornelia Huck wrote: > > +static int > > +kvm_deassign_ioeventfd_idx(struct kvm *kvm, enum kvm_bus bus_idx, > > + struct kvm_ioeventfd *args) > > While this file uses newline before function name quite often, putting > it on the same line seems more comm

Re: [kvm-unit-tests RFC PATCH 0/2] try another approach for uapi headers

2015-09-10 Thread Paolo Bonzini
On 10/09/2015 13:31, Andrew Jones wrote: > Rather than import uapi headers, just include them. I've put an RFC on > this series because it will now require kernel headers to be installed on > the build machine. I'm guessing that's not a big problem, but before we > commit to it, it'd be good to h

[PATCH kvm-unit-tests] x86: ioapic: test TMR behavior

2015-09-10 Thread Paolo Bonzini
: Jun Nakajima Cc: Steve Rutherford Signed-off-by: Paolo Bonzini --- lib/x86/apic.c | 7 lib/x86/apic.h | 1 + x86/ioapic.c | 114 - 3 files changed, 121 insertions(+), 1 deletion(-) diff --git a/lib/x86/apic.c b/lib/x86/apic.c

[GIT PULL] Second batch of KVM changes for 4.3

2015-09-10 Thread Paolo Bonzini
ction of a mapped interrupt KVM: arm/arm64: timer: Allow the timer to control the active state Mario Smarduch (2): arm64: KVM: Optimize arm64 skip 30-50% vfp/simd save/restore on exits arm: KVM: keep arm vfp/simd exit handling consistent with arm64 Paolo Bonzini (3): Merge

Re: [PATCH 3/9] KVM: x86: add pcommit support

2015-09-08 Thread Paolo Bonzini
On 08/09/2015 16:17, Xiao Guangrong wrote: > > BTW, the spec saied: > > | IA32_VMX_PROCBASED_CTLS2[53] (which enumerates support for the > 1-setting of “PCOMMIT exiting”) is > | always the same as CPUID.07H:EBX.PCOMMIT[bit 22]. Thus, software can > set “PCOMMIT exiting” to 1 > | if and only if

Re: [PATCH 8/9] KVM: VMX: introduce set_clear_2nd_exec_ctrl()

2015-09-08 Thread Paolo Bonzini
On 08/09/2015 16:24, Xiao Guangrong wrote: >> >> The second argument is always true. > > No... > > There are 3 places calling this function with set=false: > nested_release_vmcs12(), vmx_disable_pml() and > vmx_cpuid_update() You're right. It's always constant---I don't know why I wrote it's

Re: [PATCH] kvm: irqchip: fix memory leak

2015-09-07 Thread Paolo Bonzini
On 02/09/2015 09:03, Sudip Mukherjee wrote: > We were taking the exit path after checking ue->flags and return value > of setup_routing_entry(), but 'e' was not freed incase of a failure. > > Signed-off-by: Sudip Mukherjee > --- > virt/kvm/irqchip.c | 8 ++-- > 1 file changed, 6 insertions

Re: [PATCH] virtio-blk: use VIRTIO_BLK_F_WCE and VIRTIO_BLK_F_CONFIG_WCE in virtio1

2015-09-07 Thread Paolo Bonzini
On 22/08/2015 00:53, Paolo Bonzini wrote: > VIRTIO_BLK_F_CONFIG_WCE is important in order to achieve good performance > (up to 2x, though more realistically +30-40%) in latency-bound workloads. > However, it was removed by mistake together with VIRTIO_BLK_F_FLUSH. > > It will be

Re: [PATCH v3 0/5] KVM: optimize userspace exits with a new ioctl

2015-09-07 Thread Paolo Bonzini
On 02/09/2015 12:31, Christian Borntraeger wrote: > As far as I can see this should also work for s390 (when we implement > REQ_EXIT handling) > > To double check my understanding: these improvements come with a changed > userspace that does not use KVM_SET_SIGNAL_MASK and therefore this > cond

Re: 答复: I'm now looking into kvm-unit-tests and encounted with some problems.

2015-09-07 Thread Paolo Bonzini
On 02/09/2015 05:33, Guoyanjuan wrote: > Hi, I found my code is old and I git the latest code from > https://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git, > some problems are solved but one. > > when I run emulate unittest, it fa

Re: [PATCH 5/5] KVM: nVMX: VMWRITE emulation: remove unnecessary check for compatibility mode

2015-09-07 Thread Paolo Bonzini
On 20/08/2015 21:38, Eugene Korenevsky wrote: > VMWRITE instruction is not valid in compatibility mode. This is > checked by nested_vmx_check_permission() function which throws #UD if CS.L=0. > The additional check in is_64_bit_mode() for CS.L=0 is useless. This is true, and it matches what hand

Re: [PATCH 4/5] KVM: nVMX: fix limit checking: memory operand size varies for different VMX instructions

2015-09-07 Thread Paolo Bonzini
On 20/08/2015 21:37, Eugene Korenevsky wrote: > When checking limits for VMX opcodes in protected mode, different sizes of > memory operands must be taken into account. > For VMREAD and VMWRITE instructions, memory operand size is 32 or 64 bits > depending on CPU mode. For VMON, VMCLEAR, VMPTRST,

Re: [PATCH 3/5] KVM: nVMX: add limit check for expand-down segments

2015-09-07 Thread Paolo Bonzini
On 20/08/2015 21:37, Eugene Korenevsky wrote: > Add limit checking for expand-down data segments. For such segments, the > effective limit specifies the last address that is not allowed to be accessed > within the segment. I.e. offset <= limit means means limit exceeding. > > Signed-off-by: Euge

Re: [PATCH 1/5] KVM: nVMX: refactor segment checks, make the code more clean and straightforward

2015-09-07 Thread Paolo Bonzini
On 20/08/2015 21:36, Eugene Korenevsky wrote: > Prepare for subsequent changes. Extract calls for segment checking in > protected > and 64-bit mode. This should be done to avoid overbloating of > get_vmx_mem_address() function, even if kvm_queue_exception_e() is called > twice. The idea behind

Re: [PATCH 6/9] KVM: VMX: simplify invpcid handling in vmx_cpuid_update()

2015-09-07 Thread Paolo Bonzini
On 21/08/2015 06:50, Xiao Guangrong wrote: > + if (vmx_invpcid_supported() && (!best || Please start the "(" subexpression on a new line. Paolo > + !(best->ebx & bit(X86_FEATURE_INVPCID)) || > + !guest_cpuid_has_pcid(vcpu))) { -- To unsubscribe from this list: send the line

Re: [PATCH 8/9] KVM: VMX: introduce set_clear_2nd_exec_ctrl()

2015-09-07 Thread Paolo Bonzini
On 21/08/2015 06:50, Xiao Guangrong wrote: > > +static void set_clear_2nd_exec_ctrl(u32 ctrls, bool set) > +{ > + u32 exec_ctrl = vmcs_read32(SECONDARY_VM_EXEC_CONTROL); > + > + if (set) > + exec_ctrl |= ctrls; > + else > + exec_ctrl &= ~ctrls; > + > + vm

Re: [PATCH 3/9] KVM: x86: add pcommit support

2015-09-07 Thread Paolo Bonzini
On 21/08/2015 06:50, Xiao Guangrong wrote: > Pass PCOMMIT CPU feature to guest to enable PCOMMIT instruction > > Currently we do not catch pcommit instruction for L1 guest and > allow L1 to catch this instruction for L2 > > The specification locates at: > https://software.intel.com/sites/defaul

Re: [PATCH] vfio: Enable VFIO device for powerpc

2015-09-07 Thread Paolo Bonzini
On 26/08/2015 20:54, Paul Mackerras wrote: > On Wed, Aug 26, 2015 at 11:34:26AM +0200, Alexander Graf wrote: >> >> >> On 13.08.15 03:15, David Gibson wrote: >>> ec53500f "kvm: Add VFIO device" added a special KVM pseudo-device which is >>> used to handle any necessary interactions between KVM and

Re: [TRIVIAL PATCH kvm-unit-tests] x86: desc: fix typo

2015-09-07 Thread Paolo Bonzini
On 26/08/2015 11:46, Levente Kurusa wrote: > It should be 'exception' instead of 'excecption'. > > Signed-off-by: Levente Kurusa > --- > lib/x86/desc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lib/x86/desc.c b/lib/x86/desc.c > index 3237778..e3bf175 100644

Re: [PATCH V3 1/3] kvm: use kmalloc() instead of kzalloc() during iodev register/unregister

2015-09-07 Thread Paolo Bonzini
On 25/08/2015 11:05, Jason Wang wrote: > All fields of kvm_io_range were initialized or copied explicitly > afterwards. So switch to use kmalloc(). > > Cc: Gleb Natapov > Cc: Paolo Bonzini > Cc: Michael S. Tsirkin > Signed-off-by: Jason Wang > --- > virt/kvm/kv

Re: [GIT PULL] Please pull my kvm-ppc-next branch

2015-09-07 Thread Paolo Bonzini
On 05/09/2015 09:45, Paul Mackerras wrote: > Paolo, > > Please pull the commits listed below into your tree. I would like > them to go in for 4.3 as they are all small bug fixes not new > features, and they all can only affect HV-mode KVM on IBM server > machines (in fact one has no effect on c

Re: [PATCH v7 0/3] KVM: Dynamic Halt-Polling

2015-09-06 Thread Paolo Bonzini
On 03/09/2015 16:07, Wanpeng Li wrote: > v6 -> v7: > * explicit signal (set a bool) > * fix the tracepoint > > v5 -> v6: > * fix wait_ns and poll_ns > > v4 -> v5: > * set base case 10us and max poll time 500us > * handle short/long halt, idea from David, many thanks David > > v3 -> v4:

Re: [PATCH v7 1/3] KVM: make halt_poll_ns per-vCPU

2015-09-06 Thread Paolo Bonzini
On 03/09/2015 16:07, Wanpeng Li wrote: > Change halt_poll_ns into per-VCPU variable, seeded from module parameter, > to allow greater flexibility. > > Signed-off-by: Wanpeng Li > --- > include/linux/kvm_host.h | 1 + > virt/kvm/kvm_main.c | 5 +++-- > 2 files changed, 4 insertions(+), 2 d

Re: [PATCH v7 2/3] KVM: dynamic halt-polling

2015-09-06 Thread Paolo Bonzini
On 05/09/2015 00:38, Wanpeng Li wrote: >> >> @@ -1940,11 +1975,16 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) >>* arrives. >>*/ >> if (kvm_vcpu_check_block(vcpu) < 0) { >> +polled = true; >> ++vcpu->stat.halt_succes

Re: [PATCH] kvm: compile process_smi_save_seg_64() only for x86_64

2015-09-06 Thread Paolo Bonzini
On 06/09/2015 15:35, Alexander Kuleshov wrote: > The process_smi_save_seg_64() function called only in the > process_smi_save_state_64() if the CONFIG_X86_64 is set. This > patch adds #ifdef CONFIG_X86_64 around process_smi_save_seg_64() > to prevent following warning message: > > arch/x86/kvm/x

Re: [PATCH 1/2] KVM: x86: set TMR when the interrupt is accepted

2015-09-03 Thread Paolo Bonzini
On 03/09/2015 07:18, Nakajima, Jun wrote: > On Wed, Sep 2, 2015 at 3:38 PM, Steve Rutherford > wrote: >> On Thu, Aug 13, 2015 at 09:31:48AM +0200, Paolo Bonzini wrote: >> Pinging this thread. >> >> Should I put together a patch to make split irqchip work properly

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-03 Thread Paolo Bonzini
On 02/09/2015 21:23, David Matlack wrote: > > I actually wasn't thinking about vcpu->halt_poll_ns though. If > single_task_running() breaks us out of the loop we will "goto out" instead > of scheduling. My suspicion is this will cause us to loop calling > kvm_vcpu_block and starve the waiting ta

Re: [PATCH 11/12] cpu: Add crash_occurred flag into CPUState

2015-09-02 Thread Paolo Bonzini
On 03/07/2015 14:01, Denis V. Lunev wrote: > From: Andrey Smetanin > > CPUState::crash_occurred field inside CPUState marks > that guest crash occurred. This value is added into > cpu common migration subsection. > > Signed-off-by: Andrey Smetanin > Signed-off-by: Den

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-02 Thread Paolo Bonzini
On 02/09/2015 20:09, David Matlack wrote: > On Wed, Sep 2, 2015 at 12:29 AM, Wanpeng Li wrote: >> There is a downside of always-poll since poll is still happened for idle >> vCPUs which can waste cpu usage. This patch adds the ability to adjust >> halt_poll_ns dynamically, to grow halt_poll_ns w

Re: [PATCH v6 0/3] KVM: Dynamic Halt-Polling

2015-09-02 Thread Paolo Bonzini
On 02/09/2015 09:29, Wanpeng Li wrote: > v5 -> v6: > * fix wait_ns and poll_ns > > v4 -> v5: > * set base case 10us and max poll time 500us > * handle short/long halt, idea from David, many thanks David ;-) > > v3 -> v4: > * bring back grow vcpu->halt_poll_ns when interrupt arrives and shr

Re: [GIT PULL] Early batch of KVM changes for 4.3 merge window

2015-09-01 Thread Paolo Bonzini
On 01/09/2015 07:45, Xiao Guangrong wrote: > > > Actually i triggered this warning in my another box and posted a patch > to fix it which can be found at: > http://lkml.iu.edu/hypermail/linux/kernel/1508.2/02771.html > I guess Paolo is currently busy with KVM forum so the patch has not been > r

Re: [GIT PULL] Early batch of KVM changes for 4.3 merge window

2015-09-01 Thread Paolo Bonzini
On 01/09/2015 02:47, Linus Torvalds wrote: > Hmm: > > On Fri, Aug 14, 2015 at 4:57 PM, Paolo Bonzini wrote: >> >> Xiao Guangrong (9): >> KVM: MMU: fully check zero bits for sptes > > The above commit causes an annoying new compiler warning. > >

Re: [PULL 00/12] ppc patch queue 2015-08-22

2015-08-24 Thread Paolo Bonzini
On 24/08/2015 06:49, Alexander Graf wrote: > > > Hi Paolo, > > > > > > This is my current patch queue for ppc. Please pull. > > > > Done, but this queue has not been in linux-next. Please push to > > kvm-ppc-next on your github Linux tree as well; please keep an eye on > > Ah, sorry. I pushed

Re: [Bug 103321] New: NPT page attribute support causes extreme slowdown

2015-08-23 Thread Paolo Bonzini
On 23/08/2015 11:53, Sebastian Schütte wrote: >> What version of SeaBIOS? > 1.8.2 stable, from the Arch repo >> Can you try cherry-picking commit 5492830370171b6a4ede8a3bfba687a8d0f25fa5? > Tried that, but it doesn't seem to make a difference. >> If that fails, can you trace the execution of the

Re: [PULL 00/12] ppc patch queue 2015-08-22

2015-08-22 Thread Paolo Bonzini
On 22/08/2015 02:21, Alexander Graf wrote: > Hi Paolo, > > This is my current patch queue for ppc. Please pull. Done, but this queue has not been in linux-next. Please push to kvm-ppc-next on your github Linux tree as well; please keep an eye on Steven Rothwell's messages in the next few days

Re: [PATCH v3 2/5] KVM: add KVM_REQ_EXIT request for userspace exit

2015-08-22 Thread Paolo Bonzini
On 19/08/2015 20:55, Wanpeng Li wrote: >> The disadvantage is that it adds an overhead of one bit check for all >> kernel exits. A quick tracing shows that the ratio of userspace exits >> after boot is about 1/5 and in subsequent run of nmap and kernel compile >> has about 1/60, so the check sho

Re: [GIT PULL] KVM/ARM pull request for 4.3

2015-08-22 Thread Paolo Bonzini
On 20/08/2015 09:28, Marc Zyngier wrote: > Hi Paolo, > > This is the KVM/ARM pull request for Linux 4.3. Some rather major > things this time around (guest debug, management of interrupt active > state, lazy FP save/restore). > > Thanks! > > M. > > The following changes since commit bc0

[PATCH] virtio-blk: use VIRTIO_BLK_F_WCE and VIRTIO_BLK_F_CONFIG_WCE in virtio1

2015-08-21 Thread Paolo Bonzini
same in Linux. Signed-off-by: Paolo Bonzini --- drivers/block/virtio_blk.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index d4d05f064d39..ea2c17c66dfb 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block

[PATCH kvm-unit-tests 2/2] x86: get ACPI port addresses from FADT

2015-08-21 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- x86/s3.c | 5 +++-- x86/vmexit.c | 9 - 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/x86/s3.c b/x86/s3.c index 72467a2..8bf71da 100644 --- a/x86/s3.c +++ b/x86/s3.c @@ -1,5 +1,5 @@ #include "libcflat.h" -#include "ac

[PATCH kvm-unit-tests 0/2] x86: get ACPI port addresses from FADT

2015-08-21 Thread Paolo Bonzini
addresses solves both problems. Paolo Paolo Bonzini (2): x86: add small library to find ACPI tables x86: get ACPI port addresses from FADT config/config-x86-common.mak | 1 + lib/x86/acpi.c | 52 + lib/x86/acpi.h | 104

[PATCH kvm-unit-tests 1/2] x86: add small library to find ACPI tables

2015-08-21 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- config/config-x86-common.mak | 1 + lib/x86/acpi.c | 52 ++ lib/x86/acpi.h | 104 +++ x86/s3.c | 127 ++- 4 files changed

Re: IRQ affinity on Linux guest

2015-08-21 Thread Paolo Bonzini
On 21/08/2015 05:33, Mihai Neagu wrote: > Radim, > > Thanks for your answer. Indeed setting IRQ affinity to a specific core > seems to be respected. > > However, on software emulation and on the real machine, while IRQ > affinity defaults to 3, all interrupts go on CPU0, while on KVM they go >

Re: [PATCH v2 4/5] KVM: add KVM_USER_EXIT vcpu ioctl for userspace exit

2015-08-18 Thread Paolo Bonzini
On 18/08/2015 11:30, Avi Kivity wrote: >> KVM_USER_EXIT in practice should be so rare (at least with in-kernel >> LAPIC) that I don't think this matters. KVM_USER_EXIT is relatively >> uninteresting, it only exists to provide an alternative to signals that >> doesn't require expensive atomics on

Re: [PATCH v2 4/5] KVM: add KVM_USER_EXIT vcpu ioctl for userspace exit

2015-08-17 Thread Paolo Bonzini
On 16/08/2015 13:27, Avi Kivity wrote: > On 08/05/2015 07:33 PM, Radim Krčmář wrote: >> The guest can use KVM_USER_EXIT instead of a signal-based exiting to >> userspace. Availability depends on KVM_CAP_USER_EXIT. >> Only x86 is implemented so far. >> >> Signed-off-by: Radim Krčmář >> --- >>

Re: x2APIC and number of the vcpu

2015-08-14 Thread Paolo Bonzini
On 15/08/2015 01:03, Ozgur O Kilic wrote: > My question is: is it possible theoretically or any one > tried it? and if it is I cheched my pc's hardware is support x2APIC > whıch version of KVM should I use for that? KVM doesn't support more than 256 VCPUs, even with x2APIC enabled in the guest

[GIT PULL] KVM patches for 4.2-rc7

2015-08-14 Thread Paolo Bonzini
ches. Haozhong Zhang (1): KVM: x86: Use adjustment in guest cycles when handling MSR_IA32_TSC_ADJUST Paolo Bonzini (1): KVM: x86: zero IDT limit on entry to SMM arch/x86/kvm/x86.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) -

Re: [PATCH 2/2] KVM: x86: fix edge EOI and IOAPIC reconfig race

2015-08-14 Thread Paolo Bonzini
On 14/08/2015 10:38, Radim Krčmář wrote: >> How do you reproduce the bug? > I run rhel4 (2.6.9) kernel on 2 VCPUs and frequently alternate > smp_affinity of "timer". The bug is hit within seconds. Nice, I'll try to make a unit test for it on the plane. :) Paolo -- To unsubscribe from this list

[GIT PULL] Early batch of KVM changes for 4.3 merge window

2015-08-14 Thread Paolo Bonzini
ng is always run successfully kvm: x86: Fix error handling in the function kvm_lapic_sync_from_vapic Paolo Bonzini (7): KVM: svm: handle KVM_X86_QUIRK_CD_NW_CLEARED in svm_get_mt_mask Merge tag 'kvm-s390-next-20150728' of git://git.kernel.org/.../kvms390/linux into

Re: [PATCH v3 0/5] KVM: optimize userspace exits with a new ioctl

2015-08-14 Thread Paolo Bonzini
t; include/linux/kvm_host.h | 15 +-- > include/uapi/linux/kvm.h | 4 > virt/kvm/kvm_main.c | 15 ++- > 7 files changed, 78 insertions(+), 9 deletions(-) > Reviewed-by: Paolo Bonzini ... however, we still need to decide wha

Re: [RFC/PATCH 1/3] x86/kvm: Rename VMX's segment access rights defines

2015-08-14 Thread Paolo Bonzini
On 13/08/2015 22:18, Andy Lutomirski wrote: > VMX encodes access rights differently from LAR, and the latter is > most likely what x86 people think of when they think of "access > rights". > > Rename them to avoid confusion. Good idea, I've gone ahead and applied it for 4.3. > Cc: kvm@vger.ker

Re: Help debugging a regression in KVM Module

2015-08-14 Thread Paolo Bonzini
- Original Message - > From: "Peter Lieven" > To: qemu-de...@nongnu.org, kvm@vger.kernel.org > Cc: "Paolo Bonzini" > Sent: Friday, August 14, 2015 1:11:34 PM > Subject: Help debugging a regression in KVM Module > > Hi, > > some time

Re: [PATCH 2/2] KVM: x86: fix edge EOI and IOAPIC reconfig race

2015-08-13 Thread Paolo Bonzini
On 13/08/2015 15:46, Radim Krčmář wrote: > 1) IOAPIC inject a vector from i8254 > 2) guest reconfigures that vector's VCPU and therefore eoi_exit_bitmap > on original VCPU gets cleared > 3) guest's handler for the vector does EOI > 4) KVM's EOI handler doesn't pass that vector to IOAPIC b

Re: [GIT PULL 0/2] KVM: s390: fix and feature for kvm/next (4.3)

2015-08-13 Thread Paolo Bonzini
- Original Message - > From: "Christian Borntraeger" > To: "Paolo Bonzini" > Cc: "Alexander Graf" , "KVM" , "Cornelia > Huck" , "Jens > Freimann" , "linux-s390" > , "Christian Borntraeger&q

Re: [PATCH v2 1/5] KVM: add kvm_has_request wrapper

2015-08-13 Thread Paolo Bonzini
On 13/08/2015 11:11, Radim Krčmář wrote: >> > for the new interface. maybe we can rename kvm_check_request in a separate >> > patch somewhen. > I wonder why haven't we copied the naming convention from bit operations > (or if programming would be better if German was its language), > > kvm_te

Re: [PATCH v2 5/5] KVM: refactor asynchronous vcpu ioctl dispatch

2015-08-13 Thread Paolo Bonzini
On 12/08/2015 22:03, Christian Borntraeger wrote: >> > #if defined(CONFIG_S390) || defined(CONFIG_PPC) || defined(CONFIG_MIPS) >> > - if (ioctl == KVM_S390_INTERRUPT || ioctl == KVM_S390_IRQ || ioctl == >> > KVM_INTERRUPT) >> > - return kvm_arch_vcpu_ioctl(filp, ioctl, arg); >> > + c

Re: [PATCH 1/2] KVM: x86: set TMR when the interrupt is accepted

2015-08-13 Thread Paolo Bonzini
On 13/08/2015 08:35, Zhang, Yang Z wrote: >> You may be right. It is safe if no future hardware plans to use >> it. Let me check with our hardware team to see whether it will be >> used or not in future. > > After checking with Jun, there is no guarantee that the guest running > on another CPU w

Re: Problem with error paths in various functions calling kvm_io_bus_unregister_dev

2015-08-12 Thread Paolo Bonzini
On 11/08/2015 16:02, nick wrote: > Our we to just assume > that calls to kvm_io_bug_unregister_dev always succeed as I disagree due to > it allocating memory in kernel space that can easily fail. In additon I > was wondering how the maintainers would like me to handle these calls as > it's diffic

Re: [PATCH v6 0/12] HyperV equivalent of pvpanic driver

2015-08-12 Thread Paolo Bonzini
On 12/08/2015 13:54, Denis V. Lunev wrote: > guys? > > we are going to move forward with other HyperV bits. Wait a second, 2.4 was released only a few hours ago... Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More

Re: [PATCH] kvm:x86:Fix error handling in the function ioapic_write_indirect

2015-08-12 Thread Paolo Bonzini
On 11/08/2015 19:39, Nicholas Krause wrote: > This fixes error handling in the function ioapic_write_indirect to > properly check if the call to the function ioapoc_service service > has failed by not returning the value zero to indicate success to > check if this occurs when calling this particu

Re: [KVM x86 vPMU Patch 0/2] Two vPMU Trivial Patches

2015-08-11 Thread Paolo Bonzini
On 07/08/2015 21:53, Wei Huang wrote: > These two trivial patches are related to x86 vPMU code. They were > actually suggested by Andrew Jones while he was reviewing the last > big vPMU patch set. > > These patches have been compiled and tested on AMD system using > a 64-bit guest VM with variou

Re: [PATCH] kvm:x86:Fix error handling in the function kvm_lapic_sync_to_vapic

2015-08-11 Thread Paolo Bonzini
On 10/08/2015 21:26, Nicholas Krause wrote: > This fixes error handling in the function kvm_lapic_sync_to_vapic > to check the value of the call to kvm_write_guest_cached to see if > it failed by returning a error code and if so execute WARN_ON to > allow the user to see in their logs the failure

Re: [PATCH] kvm:s390:Fix assumption that kvm_set_irq_routing is always run successfully

2015-08-10 Thread Paolo Bonzini
On 10/08/2015 17:21, nick wrote: > > Seems good. > > > > Paolo > > If it makes it easier for you to trust my patches I can show at least 10 bug > fixes for other subsystems > to prove that I am trying to do this correctly. That's up to those maintainers... I definitely see some improvement in

Re: rdtsc() in kvm-unit-tests on x86

2015-08-10 Thread Paolo Bonzini
On 10/08/2015 16:14, Jintack Lim wrote: >> > Yes, you just use the TSC. :) However, you first have to check that the >> > TSC is consistent across CPUs. On older machines it's not, but the >> > kernel can detect it. > Thanks, Paolo. > > What would be the best way to check if TSC is consistent

Re: rdtsc() in kvm-unit-tests on x86

2015-08-10 Thread Paolo Bonzini
On 10/08/2015 11:42, Christoffer Dall wrote: > > Thanks for the reply. > > On this note, is there an easy mechanism on x86 to obtain a TSC which is > synchronized across PCPUs and between the host and the guest? > > We can use the physical arch timer counter on arm64, but I'm not sure if > the

Re: rdtsc() in kvm-unit-tests on x86

2015-08-10 Thread Paolo Bonzini
On 07/08/2015 21:19, Jintack Lim wrote: > Hi all, > > While I was looking at rdtsc() code in kvm-unit-tests (e.g. x86/vmexit.c), > I was getting curious that out-of-order execution on the processor > may make rdtsc() executed not in the place we expect. > > Referring to this document from intel

Re: [PATCH] kvm:powerpc:Fix error handling in the function mpic_set_default_irq_routing

2015-08-07 Thread Paolo Bonzini
On 07/08/2015 15:47, Nicholas Krause wrote: > - kvm_set_irq_routing(opp->kvm, routing, 0, 0); > + ret = kvm_set_irq_routing(opp->kvm, routing, 0, 0); > + if (ret) { > + kfree(routing); > + return ret; > + } > > kfree(routing); > return 0; You

Re: [PATCH] KVM: x86: Use adjustment in guest cycles when handling MSR_IA32_TSC_ADJUST

2015-08-07 Thread Paolo Bonzini
On 07/08/2015 05:24, Haozhong Zhang wrote: > When kvm_set_msr_common() handles a guest's write to > MSR_IA32_TSC_ADJUST, it will calcuate an adjustment based on the data > written by guest and then use it to adjust TSC offset by calling a > call-back adjust_tsc_offset(). The 3rd parameter of adju

[PATCH] KVM: x86: zero IDT limit on entry to SMM

2015-08-07 Thread Paolo Bonzini
ix is easy. Signed-off-by: Paolo Bonzini --- arch/x86/kvm/x86.c | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 5ef2560075bf..c5e88a881899 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -6327,6 +6327,7 @@ s

Re: [edk2] apparent SMBASE relocation issue with noexec enabled [was: MdeModulePkg DxeIpl: Add stack NX support]

2015-08-07 Thread Paolo Bonzini
On 07/08/2015 01:02, Laszlo Ersek wrote: >> > The trace covers the full lifetime of the guest (I started tracing >> > before launching the guest, and I passed -no-reboot to qemu, so when the >> > guest crashed, QEMU exited.) >> > >> > This was on 3.10.0-299.el7.x86_64. > I repeated the test with

Re: [PATCH] kvm:powerpc:Fix error handling in the function mpic_set_default_irq_routing

2015-08-07 Thread Paolo Bonzini
On 06/08/2015 19:13, Nicholas Krause wrote: > diff --git a/arch/powerpc/kvm/mpic.c b/arch/powerpc/kvm/mpic.c > index 6249cdc..5a18859 100644 > --- a/arch/powerpc/kvm/mpic.c > +++ b/arch/powerpc/kvm/mpic.c > @@ -1641,13 +1641,16 @@ static void mpic_destroy(struct kvm_device *dev) > static int mpi

Re: [PATCH 8/9] KVM: x86: Add EOI exit bitmap inference

2015-08-07 Thread Paolo Bonzini
On 07/08/2015 09:46, Wu, Feng wrote: > If I understand it correctly, here you reserve the low part of the routing > table, and insert entries with KVM_IRQ_ROUTING_MSI type in them, > then you use this as a hint to KVM to set the EOI bit map. I have two > concerns: > > - Currently, GSI 2 is used

Re: [PATCH] kvm:x86:Call BUG_ON marco if calls to x86_set_memory_region fail in kvm_arch_destroy

2015-08-07 Thread Paolo Bonzini
On 06/08/2015 16:13, Nicholas Krause wrote: > This fixes the calls to x86_memory_region to trigger a kernel > oopes for tracing if a bug arises in the function kvm_arch_destroy > due to the failing of any of its internal calls to x86_set_memory_region. > > Signed-off-by: Nicholas Krause > --- >

Re: [PATCH 8/9] KVM: x86: Add EOI exit bitmap inference

2015-08-07 Thread Paolo Bonzini
On 07/08/2015 07:43, Wu, Feng wrote: >> > +#ifdef CONFIG_HAVE_KVM_IRQCHIP >> > +struct kvm_irq_routing_table { >> > + int chip[KVM_NR_IRQCHIPS][KVM_IRQCHIP_NUM_PINS]; >> > + struct kvm_kernel_irq_routing_entry *rt_entries; > This filed doesn't exist anymore. In fact, this changes is also in my

Re: [PATCH] kvm:s390:Fix assumption that kvm_set_irq_routing is always run successfully

2015-08-07 Thread Paolo Bonzini
On 06/08/2015 19:05, Nicholas Krause wrote: > This fixes the assumption that kvm_set_irq_routing is always run > successfully by instead making it equal to the variable r which > we use for returning in the function kvm_arch_vm_ioctl instead > of making r equal to zero when calling this particula

Re: apparent SMBASE relocation issue with noexec enabled [was: MdeModulePkg DxeIpl: Add stack NX support]

2015-08-06 Thread Paolo Bonzini
On 06/08/2015 16:31, Laszlo Ersek wrote: >> kvm_cpuid:func 8001 rax 6e8 rbx 0 rcx 0 rdx 10 >> kvm_enter_smm:vcpu 0: leaving SMM, smbase 0x7ffc >> kvm_entry:vcpu 0 >> kvm_exit: reason TRIPLE_FAULT rip 0x7ffdb6b2 info 0 0 >> kvm_userspace_exit

Re: [PATCH v2 4/5] KVM: add KVM_USER_EXIT vcpu ioctl for userspace exit

2015-08-06 Thread Paolo Bonzini
On 06/08/2015 15:44, Radim Krčmář wrote: >> > Can we just return EINVAL if the parameter is not NULL? > It complicates handling if we extend the ioctl, but removes the useless > clearing/copying/checking now ... Yes. > The two obvious extensions are flags to skip kvm_make_request() or > kvm_vcp

Re: [PATCH] kvm:arm:Fix error handling in the function vgic_v3_probe

2015-08-06 Thread Paolo Bonzini
On 06/08/2015 10:06, Marc Zyngier wrote: > > If this structure of function pointers can handle function pointers with a > > return type of > > void I will be glad to do what you request otherwise this would require a > > major rewrite > > of kvm arm subsystem for a very simple bug fix. > > Ju

Re: [PATCH 5/9] KVM: x86: unify handling of interrupt window

2015-08-06 Thread Paolo Bonzini
On 06/08/2015 08:50, Wu, Feng wrote: > Is it possible to adjust the code here and remove the later checking in x86.c? > In that case, we can avoid calling dm_request_for_irq_injection(vcpu) for > VM exit. No, see the dm_request_for_irq_injection() changes in patch 9. In that patch, you can get

Re: [PATCH] kvm:arm:Fix error handling in the function vgic_v3_probe

2015-08-05 Thread Paolo Bonzini
On 05/08/2015 18:48, Nicholas Krause wrote: > This fixes the error handling in the function vgic_v3_probe > for when calling the function kvm_register_device_ops to check > if the call to this function has returned a error code and if > so jump to the label out with goto to cleanup no longer requ

Re: [PATCH v2 4/5] KVM: add KVM_USER_EXIT vcpu ioctl for userspace exit

2015-08-05 Thread Paolo Bonzini
On 05/08/2015 18:33, Radim Krčmář wrote: > The guest can use KVM_USER_EXIT instead of a signal-based exiting to > userspace. Availability depends on KVM_CAP_USER_EXIT. > Only x86 is implemented so far. > > Signed-off-by: Radim Krčmář > --- > v2: > * use vcpu ioctl instead of vm one [4/5] >

[PATCH 2/9] KVM: x86: store IOAPIC-handled vectors in each VCPU

2015-08-05 Thread Paolo Bonzini
these interrupts anyway. This again limits the interactions between the IOAPIC and the LAPIC, making it easier to move the former to userspace. Inspired by a patch from Steve Rutherford. Signed-off-by: Paolo Bonzini --- arch/x86/include/asm/kvm_host.h | 3 ++- arch/x86/kvm/ioapic.c | 18

[PATCH 1/9] KVM: x86: set TMR when the interrupt is accepted

2015-08-05 Thread Paolo Bonzini
Do not compute TMR in advance. Instead, set the TMR just before the interrupt is accepted into the IRR. This limits the coupling between IOAPIC and LAPIC. Signed-off-by: Paolo Bonzini --- arch/x86/kvm/ioapic.c | 9 ++--- arch/x86/kvm/ioapic.h | 3 +-- arch/x86/kvm/lapic.c | 19

[PATCH 0/9] split irqchip series

2015-08-05 Thread Paolo Bonzini
I am going to push the memory barrier fixes to kvm/next. The rest of the series is here for review. This includes cleanups from myself and the bulk of the code from Steve. Paolo Paolo Bonzini (5): KVM: x86: set TMR when the interrupt is accepted KVM: x86: store IOAPIC-handled vectors in

[PATCH 5/9] KVM: x86: unify handling of interrupt window

2015-08-05 Thread Paolo Bonzini
/KVM_EXIT_IRQ_WINDOW_OPEN for dm_request_for_irq_injection). However, dm_request_for_irq_injection is basically dead code! Revive it by removing the checks in vmx.c and svm.c's vmexit handlers, and fixing the returned values for the dm_request_for_irq_injection case. Signed-off-by: Paolo Bonzini ---

[PATCH 3/9] KVM: x86: replace vm_has_apicv hook with cpu_uses_apicv

2015-08-05 Thread Paolo Bonzini
This will avoid an unnecessary trip to ->kvm and from there to the VPIC. Signed-off-by: Paolo Bonzini --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/irq.c | 2 +- arch/x86/kvm/lapic.c| 4 ++-- arch/x86/kvm/lapic.h| 4 ++-- arch/x86/kvm/sv

[PATCH 4/9] KVM: x86: introduce lapic_in_kernel

2015-08-05 Thread Paolo Bonzini
Avoid pointer chasing and memory barriers, and simplify the code when split irqchip (LAPIC in kernel, IOAPIC/PIC in userspace) is introduced. Signed-off-by: Paolo Bonzini --- arch/x86/kvm/irq.c | 6 +++--- arch/x86/kvm/irq.h | 8 arch/x86/kvm/lapic.c | 4 ++-- arch/x86/kvm/mmu.c

[PATCH 7/9] KVM: x86: Add KVM exit for IOAPIC EOIs

2015-08-05 Thread Paolo Bonzini
l x86. Signed-off-by: Steve Rutherford Signed-off-by: Paolo Bonzini --- Documentation/virtual/kvm/api.txt | 12 arch/x86/include/asm/kvm_host.h | 2 ++ arch/x86/kvm/lapic.c | 24 +--- arch/x86/kvm/x86.c| 11 +++ include/

[PATCH 8/9] KVM: x86: Add EOI exit bitmap inference

2015-08-05 Thread Paolo Bonzini
guest. This is a slight abuse of the notion of an MSI Route, given that MSIs classically bypass the IOAPIC. It might be worthwhile to add an additional route type to improve clarity. Compile tested for Intel x86. Signed-off-by: Steve Rutherford Signed-off-by: Paolo Bonzini --- Documentation

[PATCH 9/9] KVM: x86: Add support for local interrupt requests from userspace

2015-08-05 Thread Paolo Bonzini
-off-by: Steve Rutherford Signed-off-by: Paolo Bonzini --- Documentation/virtual/kvm/api.txt | 14 + arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/irq.c| 32 +++-- arch/x86/kvm/irq.h| 8 arch/x86/kvm/x86.c

[PATCH 6/9] KVM: x86: Split the APIC from the rest of IRQCHIP.

2015-08-05 Thread Paolo Bonzini
Suggested-by: Andrew Honig Signed-off-by: Paolo Bonzini --- Documentation/virtual/kvm/api.txt | 17 + arch/x86/include/asm/kvm_host.h | 2 ++ arch/x86/kvm/i8254.c | 4 +++- arch/x86/kvm/ioapic.h | 8 arch/x86/kvm/irq.h| 11

[GIT PULL] KVM changes for 4.2-rc6

2015-08-05 Thread Paolo Bonzini
simple patches. Alex Williamson (1): KVM: MTRR: Use default type for non-MTRR-covered gfn before WARN_ON Christian Borntraeger (1): KVM: s390: Fix hang VCPU hang/loop regression Paolo Bonzini (1): Merge tag 'kvm-s390-maste

Re: [PATCH] x86:kvm:Fix error handling in the function kvm_lapic_sync_from_vapic

2015-08-05 Thread Paolo Bonzini
On 05/08/2015 16:44, Nicholas Krause wrote: > This fixes error handling in the function kvm_lapic_sync_from_vapic > by checking if the call to kvm_read_guest_cached has returned a > error code to signal to its caller the call to this function has > failed and due to this we must immediately retur

Re: [PATCH 3/5] KVM: add KVM_USER_EXIT vm ioctl for userspace exit

2015-08-05 Thread Paolo Bonzini
On 05/08/2015 15:34, Radim Krčmář wrote: > 2015-08-05 15:29+0200, Paolo Bonzini: >> On 05/08/2015 15:21, Radim Krčmář wrote: >>> + kvm_for_each_vcpu(idx, vcpu, kvm) >>> + if (vcpu->vcpu_id == vcpu_id) { >>> +

<    1   2   3   4   5   6   7   8   9   10   >