Re: How does kvm support x2apic?

2014-06-11 Thread Zhang Haoyu
Hi, According to this: https://github.com/torvalds/linux/commit/0d1de2d901f4ba0972a3886496a44fb1d3300dbd It looks like kvm have been supporting x2apic since kernel 2.6.32, or even earlier. This patch is to emulate x2apic for guest, then guest can benefit from some advantages of x2apic,

Re: How does kvm support x2apic?

2014-06-11 Thread Jidong Xiao
On Wed, Jun 11, 2014 at 2:27 AM, Zhang Haoyu zhan...@sangfor.com wrote: Hi, According to this: https://github.com/torvalds/linux/commit/0d1de2d901f4ba0972a3886496a44fb1d3300dbd It looks like kvm have been supporting x2apic since kernel 2.6.32, or even earlier. This patch is to emulate

Re: [RFC v2] ARM VM System Specification

2014-06-11 Thread Christoffer Dall
On Tue, Jun 10, 2014 at 09:18:34PM +0200, Paolo Bonzini wrote: Il 10/06/2014 20:56, Paolo Bonzini ha scritto: Il 10/06/2014 20:08, Peter Maydell ha scritto: On 10 June 2014 18:04, Christopher Covington c...@codeaurora.org wrote: On 06/10/2014 10:42 AM, Peter Maydell wrote: I just noticed that

Re: [PATCH v7 4/4] arm: dirty page logging 2nd stage page fault handling support

2014-06-11 Thread Christoffer Dall
On Tue, Jun 10, 2014 at 11:23:17AM -0700, Mario Smarduch wrote: On 06/08/2014 05:05 AM, Christoffer Dall wrote: On Tue, Jun 03, 2014 at 04:19:27PM -0700, Mario Smarduch wrote: This patch adds support for handling 2nd stage page faults during migration, it disables faulting in huge pages,

Re: [RESEND PATCH v7 3/4] arm: dirty log write protect management support

2014-06-11 Thread Christoffer Dall
On Tue, Jun 10, 2014 at 11:08:24AM -0700, Mario Smarduch wrote: On 06/10/2014 02:22 AM, Christoffer Dall wrote: On Mon, Jun 09, 2014 at 06:47:12PM -0700, Mario Smarduch wrote: On 06/08/2014 05:05 AM, Christoffer Dall wrote: On Fri, Jun 06, 2014 at 10:33:41AM -0700, Mario Smarduch wrote:

Re: [RFC v2] ARM VM System Specification

2014-06-11 Thread Paolo Bonzini
Il 11/06/2014 08:54, Christoffer Dall ha scritto: The problem is that the most common user problem with ARM VMs are that they boot the thing, and then get no output. So we wanted some way to make sure we know that the kernel should be able to print to a console. UEFI does provide DBG2 output,

Re: [RFC PATCH 2/3] DMA, CMA: use general CMA reserved area management framework

2014-06-11 Thread Michal Nazarewicz
On Tue, Jun 10 2014, Joonsoo Kim iamjoonsoo@lge.com wrote: Without including device.h, build failure occurs. In dma-contiguous.h, we try to access to dev-cma_area, so we need device.h. In the past, we included it luckily by swap.h in drivers/base/dma-contiguous.c. Swap.h includes node.h

Re: How does kvm support x2apic?

2014-06-11 Thread Zhang Haoyu
Hi, According to this: https://github.com/torvalds/linux/commit/0d1de2d901f4ba0972a3886496a44fb1d3300dbd It looks like kvm have been supporting x2apic since kernel 2.6.32, or even earlier. This patch is to emulate x2apic for guest, then guest can benefit from some advantages of x2apic,

Re: [RFC v2] ARM VM System Specification

2014-06-11 Thread Arnd Bergmann
On Wednesday 11 June 2014 10:16:03 Paolo Bonzini wrote: If kernels actually do use the UEFI runtime services and have no need for direct access to an RTC when runing in a UEFI compliant system, then I agree with not specifying the hardware details. The RTC is not needed for ordinary

Re: [RFC v2] ARM VM System Specification

2014-06-11 Thread Stefano Stabellini
Although not in the ARM VM System Specification, Xen is certainly going to support a fast boot path without UEFI firmware. I guess KVM will too. You'll have to rely on hypervisor specific mechanisms to achieve it. In fact I wouldn't worry about UEFI when you need ACPI, that is not in this

Re: [RFC v2] ARM VM System Specification

2014-06-11 Thread Christoffer Dall
Agree with what Stefano says, and I strongly recommend you reconsider your position on FDT vs. ACPI for ARM VMs, but it's completely up to you of course :) -Christoffer On Wed, Jun 11, 2014 at 10:50:04AM +0100, Stefano Stabellini wrote: Although not in the ARM VM System Specification, Xen is

Re: [PATCH v11 06/16] qspinlock: prolong the stay in the pending bit path

2014-06-11 Thread Peter Zijlstra
On Fri, May 30, 2014 at 11:43:52AM -0400, Waiman Long wrote: --- kernel/locking/qspinlock.c | 18 -- 1 files changed, 16 insertions(+), 2 deletions(-) diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c index fc7fd8c..7f10758 100644 ---

Re: [RFC v2] ARM VM System Specification

2014-06-11 Thread Arnd Bergmann
On Wednesday 11 June 2014 10:50:04 Stefano Stabellini wrote: Although not in the ARM VM System Specification, Xen is certainly going to support a fast boot path without UEFI firmware. I guess KVM will too. You'll have to rely on hypervisor specific mechanisms to achieve it. In fact I

[PATCH 1/6] PPC: Add asm helpers for BE 32bit load/store

2014-06-11 Thread Alexander Graf
From assembly code we might not only have to explicitly BE access 64bit values, but sometimes also 32bit ones. Add helpers that allow for easy use of lwzx/stwx in their respective byte-reverse or native form. Signed-off-by: Alexander Graf ag...@suse.de CC: Benjamin Herrenschmidt

[PATCH 3/6] KVM: PPC: Book3S HV: Access guest VPA in BE

2014-06-11 Thread Alexander Graf
There are a few shared data structures between the host and the guest. Most of them get registered through the VPA interface. These data structures are defined to always be in big endian byte order, so let's make sure we always access them in big endian. Signed-off-by: Alexander Graf

[PATCH 5/6] KVM: PPC: Book3S HV: Access XICS in BE

2014-06-11 Thread Alexander Graf
On the exit path from the guest we check what type of interrupt we received if we received one. This means we're doing hardware access to the XICS interrupt controller. However, when running on a little endian system, this access is byte reversed. So let's make sure to swizzle the bytes back

[PATCH 4/6] KVM: PPC: Book3S HV: Access host lppaca and shadow slb in BE

2014-06-11 Thread Alexander Graf
Some data structures are always stored in big endian. Among those are the LPPACA fields as well as the shadow slb. These structures might be shared with a hypervisor. So whenever we access those fields, make sure we do so in big endian byte order. Signed-off-by: Alexander Graf ag...@suse.de ---

[PATCH 0/6] KVM: PPC: Book3S HV: Enable on little endian hosts

2014-06-11 Thread Alexander Graf
So far we've been able to successfully run HV KVM on big endian hosts, but once you dive into little endian land things start to fall apart. This patch set enables HV KVM for little endian hosts. This should be the final piece left missing to get little endian systems fully en par with big endian

[PATCH 6/6] KVM: PPC: Book3S HV: Enable for little endian hosts

2014-06-11 Thread Alexander Graf
Now that we've fixed all the issues that HV KVM code had on little endian hosts, we can enable it in the kernel configuration for users to play with. Signed-off-by: Alexander Graf ag...@suse.de --- arch/powerpc/kvm/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git

[PATCH 2/6] KVM: PPC: Book3S HV: Make HTAB code LE host aware

2014-06-11 Thread Alexander Graf
When running on an LE host all data structures are kept in little endian byte order. However, the HTAB still needs to be maintained in big endian. So every time we access any HTAB we need to make sure we do so in the right byte order. Fix up all accesses to manually byte swap. Signed-off-by:

Re: [RFC v2] ARM VM System Specification

2014-06-11 Thread Grant Likely
On 10 Jun 2014 17:45, Claudio Fontana claudio.font...@huawei.com wrote: Hello all, I just wanted to share with you guys how we are using virtualization on ARM64 over here for the OSv project. I don't know if that's something that could be useful for your specification effort. In OSv,

Re: [RFC v2] ARM VM System Specification

2014-06-11 Thread Grant Likely
On Wed, Jun 11, 2014 at 10:55 AM, Christoffer Dall christoffer.d...@linaro.org wrote: Agree with what Stefano says, and I strongly recommend you reconsider your position on FDT vs. ACPI for ARM VMs, but it's completely up to you of course :) Not entirely. The plan right now is to only support

Re: [RFC v2] ARM VM System Specification

2014-06-11 Thread Grant Likely
On Tue, Jun 10, 2014 at 7:56 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 10/06/2014 20:08, Peter Maydell ha scritto: On 10 June 2014 18:04, Christopher Covington c...@codeaurora.org wrote: On 06/10/2014 10:42 AM, Peter Maydell wrote: I just noticed that this doesn't mandate that the

Re: [PATCH v11 09/16] qspinlock, x86: Allow unfair spinlock in a virtual guest

2014-06-11 Thread Peter Zijlstra
On Wed, Jun 11, 2014 at 12:54:02PM +0200, Peter Zijlstra wrote: @@ -252,6 +260,18 @@ void queue_spin_lock_slowpath(struct qspinlock *lock, u32 val) BUILD_BUG_ON(CONFIG_NR_CPUS = (1U _Q_TAIL_CPU_BITS)); +#ifdef CONFIG_VIRT_UNFAIR_LOCKS + /* +* A simple test and set

Re: [RFC v2] ARM VM System Specification

2014-06-11 Thread Arnd Bergmann
On Wednesday 11 June 2014 12:33:30 Grant Likely wrote: On Tue, Jun 10, 2014 at 7:56 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 10/06/2014 20:08, Peter Maydell ha scritto: On 10 June 2014 18:04, Christopher Covington c...@codeaurora.org wrote: On 06/10/2014 10:42 AM, Peter Maydell

Re: [RFC v2] ARM VM System Specification

2014-06-11 Thread Grant Likely
On Wed, Jun 11, 2014 at 12:58 PM, Arnd Bergmann a...@arndb.de wrote: On Wednesday 11 June 2014 12:33:30 Grant Likely wrote: On Tue, Jun 10, 2014 at 7:56 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 10/06/2014 20:08, Peter Maydell ha scritto: On 10 June 2014 18:04, Christopher Covington

Re: [RFC v2] ARM VM System Specification

2014-06-11 Thread Christoffer Dall
On Wed, Jun 11, 2014 at 12:28:40PM +0100, Grant Likely wrote: On Wed, Jun 11, 2014 at 10:55 AM, Christoffer Dall christoffer.d...@linaro.org wrote: Agree with what Stefano says, and I strongly recommend you reconsider your position on FDT vs. ACPI for ARM VMs, but it's completely up to you

[PULL] vhost: infrastructure changes for 3.16

2014-06-11 Thread Michael S. Tsirkin
Hi Linus, Please pull the following. Please note this needs to be merged before merging target-pending PULL which Nicholas will be sending out shortly. Thanks! The following changes since commit 1860e379875dfe7271c649058aeddffe5afd9d0d: Linux 3.15 (2014-06-08 11:19:54 -0700) are available in

[PATCH v5 00/19] kvm-unit-tests/arm: initial drop

2014-06-11 Thread Andrew Jones
This is a v5 of a series that introduces arm to kvm-unit-tests. First, it does some tidying up of the repo. Then, it adds support for device trees (libfdt), and for virtio-testdev[1]. Next, it adds the basic infrastructure for booting a test case (guest), and adds a first test case, a self-test to

[PATCH v5 02/19] makefile and run_tests tweaks

2014-06-11 Thread Andrew Jones
- remove a redundant '-display none' - remove a redundant -g from CFLAGS - remove a useless -I../include/x86 from CFLAGS - remove lib autodep files on make clean Signed-off-by: Andrew Jones drjo...@redhat.com Acked-by: Christoffer Dall christoffer.d...@linaro.org --- v4: no change other than

[PATCH v5 14/19] printf: support field padding

2014-06-11 Thread Andrew Jones
Support format flags for field padding, such as %08x, allowing register dumps to be easier on the eyes. Signed-off-by: Andrew Jones drjo...@redhat.com Reviewed-by: Christoffer Dall christoffer.d...@linaro.org --- lib/printf.c | 82 +--- 1

[PATCH v5 16/19] arm: Add spinlock implementation

2014-06-11 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 v5 17/19] arm: Add IO accessors to avoid register-writeback

2014-06-11 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 v5 12/19] Introduce virtio-testdev

2014-06-11 Thread Andrew Jones
virtio-testdev is a communication channel to qemu through virtio that can be used by test code to send commands. The only command currently implemented is EXIT, which allows the test code to exit with a given status code. Signed-off-by: Andrew Jones drjo...@redhat.com Reviewed-by: Christoffer

[PATCH v5 13/19] libcflat: clean up libcflat.h and add string.h

2014-06-11 Thread Andrew Jones
Use libgcc's stddef.h and stdint.h, and then remove the redundant defines from libcflat.h. Also separate out the string function declarations into a new file string.h. These changes have no affect on code including libcflat.h, but are needed in order to compile an unmodified libfdt for

[PATCH v5 09/19] libcflat: add abort() and assert()

2014-06-11 Thread Andrew Jones
The test framework may have external dependencies. assert() provides the ability to abort when those dependencies aren't met. However, assert() should only be used for unlikely conditions. We can provide more informative messages with printf() for the more likely problems. Signed-off-by: Andrew

[PATCH v5 10/19] Introduce asm-generic/*.h files

2014-06-11 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 v5 18/19] arm: add useful headers from the Linux kernel

2014-06-11 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 v5 15/19] arm: initial drop

2014-06-11 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 virtio-testdev]

[PATCH v5 11/19] add minimal virtio support for devtree virtio-mmio

2014-06-11 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 --- v5: - use same virtio struct names as kernel - no need to alloc a new

[PATCH v5 08/19] add support for Linux device trees

2014-06-11 Thread Andrew Jones
Add some device tree functions, built on libfdt, 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 Documentation/devicetree/booting-without-of.txt.

[PATCH v5 07/19] libfdt: get libfdt to build

2014-06-11 Thread Andrew Jones
Add string functions needed for libfdt, and add a make target. Signed-off-by: Andrew Jones drjo...@redhat.com Acked-by: Christoffer Dall christoffer.d...@linaro.org --- v4: rewrite strchr w/out use of strlen, drop libfdt_env.h modifications --- Makefile | 21 +++--

[PATCH v5 19/19] arm: vectors support

2014-06-11 Thread Andrew Jones
Add support for tests to use exception handlers using install_exception_handler(). This patch also adds phys_start_usr(), which can be used to start a function in USR mode, using a stack set up in a new memregion. phys_start_usr() is used by new selftest tests that check the new vector support.

[PATCH v5 03/19] clean root dir of all x86-ness

2014-06-11 Thread Andrew Jones
Remove all references to x86 from the root dir (except from in configure). Also remove references from the root dir README by moving that documentation to the x86/README, and touch up the READMEs at the same time. Signed-off-by: Andrew Jones drjo...@redhat.com Acked-by: Christoffer Dall

[PATCH v5 05/19] add 'make cscope' support

2014-06-11 Thread Andrew Jones
Add a Makefile target to quickly generate arch-specific cscope for kvm-unit-tests. Assumes a mostly flat directory structure, i.e. uses '-maxdepth 1' in the file search. Signed-off-by: Andrew Jones drjo...@redhat.com Acked-by: Christoffer Dall christoffer.d...@linaro.org --- Makefile | 11

[PATCH v5 04/19] add distclean target and gitignore more

2014-06-11 Thread Andrew Jones
also add a check for config.mak in Makefile Signed-off-by: Andrew Jones drjo...@redhat.com Acked-by: Christoffer Dall christoffer.d...@linaro.org --- .gitignore | 5 + Makefile | 9 - 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index

Re: [RFC v2] ARM VM System Specification

2014-06-11 Thread Peter Maydell
On 11 June 2014 12:33, Grant Likely grant.lik...@linaro.org wrote: In practical terms, yes the VM needs to provide an RTC interface, but I don't think it needs to appear in this spec, even if the kernel accesses it directly. Portable images should use the UEFI service. I think it might helpful

Re: How does kvm support x2apic?

2014-06-11 Thread Jidong Xiao
On Wed, Jun 11, 2014 at 4:49 AM, Zhang Haoyu zhan...@sangfor.com wrote: Hi, According to this: https://github.com/torvalds/linux/commit/0d1de2d901f4ba0972a3886496a44fb1d3300dbd It looks like kvm have been supporting x2apic since kernel 2.6.32, or even earlier. This patch is to emulate

[PATCH] KVM: PPC: Book3s HV: Fix tlbie compile error

2014-06-11 Thread Alexander Graf
Some compilers complain about uninitialized variables in the compute_tlbie_rb function. When you follow the code path you'll realize that we'll never get to that point, but the compiler isn't all that smart. So just default to 4k page sizes for everything, making the compiler happy and the code

Re: [PATCH v11 06/16] qspinlock: prolong the stay in the pending bit path

2014-06-11 Thread Long, Wai Man
On 6/11/2014 6:26 AM, Peter Zijlstra wrote: On Fri, May 30, 2014 at 11:43:52AM -0400, Waiman Long wrote: --- kernel/locking/qspinlock.c | 18 -- 1 files changed, 16 insertions(+), 2 deletions(-) diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c index

Re: How does kvm support x2apic?

2014-06-11 Thread Zhang Haoyu
Hi, According to this: https://github.com/torvalds/linux/commit/0d1de2d901f4ba0972a3886496a44fb1d3300dbd It looks like kvm have been supporting x2apic since kernel 2.6.32, or even earlier. This patch is to emulate x2apic for guest, then guest can benefit from some advantages of x2apic,

Re: [PATCH v11 09/16] qspinlock, x86: Allow unfair spinlock in a virtual guest

2014-06-11 Thread Long, Wai Man
On 6/11/2014 6:54 AM, Peter Zijlstra wrote: On Fri, May 30, 2014 at 11:43:55AM -0400, Waiman Long wrote: Enabling this configuration feature causes a slight decrease the performance of an uncontended lock-unlock operation by about 1-2% mainly due to the use of a static key. However,

Re: [PATCH v7 4/4] arm: dirty page logging 2nd stage page fault handling support

2014-06-11 Thread Mario Smarduch
On 06/10/2014 11:58 PM, Christoffer Dall wrote: On Tue, Jun 10, 2014 at 11:23:17AM -0700, Mario Smarduch wrote: On 06/08/2014 05:05 AM, Christoffer Dall wrote: On Tue, Jun 03, 2014 at 04:19:27PM -0700, Mario Smarduch wrote: This patch adds support for handling 2nd stage page faults during

Re: [RESEND PATCH v7 3/4] arm: dirty log write protect management support

2014-06-11 Thread Mario Smarduch
Hi Paolo, for ARM dirty page logging we have couple functions that are generic. - kvm_vm_ioctl_get_dirty_log - is identical to x86 version - kvm_flush_remote_tlbs - ARM version does hardware broadcast it's different from the generic one in kvm_main.c How to proceed to make these generic?

Re: Using virtio for inter-VM communication

2014-06-11 Thread Rusty Russell
Henning Schild henning.sch...@siemens.com writes: Hi, i am working on the jailhouse[1] project and am currently looking at inter-VM communication. We want to connect guests directly with virtual consoles based on shared memory. The code complexity in the hypervisor should be minimal, it

[PATCH v2 04/10] DMA, CMA: support alignment constraint on cma region

2014-06-11 Thread Joonsoo Kim
ppc kvm's cma area management needs alignment constraint on cma region. So support it to prepare generalization of cma area management functionality. Additionally, add some comments which tell us why alignment constraint is needed on cma region. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com

[PATCH v2 03/10] DMA, CMA: separate core cma management codes from DMA APIs

2014-06-11 Thread Joonsoo Kim
To prepare future generalization work on cma area management code, we need to separate core cma management codes from DMA APIs. We will extend these core functions to cover requirements of ppc kvm's cma area management functionality in following patches. This separation helps us not to touch DMA

[PATCH v2 06/10] CMA: generalize CMA reserved area management functionality

2014-06-11 Thread Joonsoo Kim
Currently, there are two users on CMA functionality, one is the DMA subsystem and the other is the kvm on powerpc. They have their own code to manage CMA reserved area even if they looks really similar. From my guess, it is caused by some needs on bitmap management. Kvm side wants to maintain

[PATCH v2 08/10] mm, cma: clean-up cma allocation error path

2014-06-11 Thread Joonsoo Kim
We can remove one call sites for clear_cma_bitmap() if we first call it before checking error number. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/cma.c b/mm/cma.c index 1e1b017..01a0713 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -282,11 +282,12 @@ struct page *cma_alloc(struct

[PATCH v2 10/10] mm, cma: use spinlock instead of mutex

2014-06-11 Thread Joonsoo Kim
Currently, we should take the mutex for manipulating bitmap. This job may be really simple and short so we don't need to sleep if contended. So I change it to spinlock. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/cma.c b/mm/cma.c index 22a5b23..3085e8c 100644 --- a/mm/cma.c

[PATCH v2 09/10] mm, cma: move output param to the end of param list

2014-06-11 Thread Joonsoo Kim
Conventionally, we put output param to the end of param list. cma_declare_contiguous() doesn't look like that, so change it. Additionally, move down cma_areas reference code to the position where it is really needed. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git

[PATCH v2 07/10] PPC, KVM, CMA: use general CMA reserved area management framework

2014-06-11 Thread Joonsoo Kim
Now, we have general CMA reserved area management framework, so use it for future maintainabilty. There is no functional change. Acked-by: Michal Nazarewicz min...@mina86.com Acked-by: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git

[PATCH v2 00/10] CMA: generalize CMA reserved area management code

2014-06-11 Thread Joonsoo Kim
Currently, there are two users on CMA functionality, one is the DMA subsystem and the other is the kvm on powerpc. They have their own code to manage CMA reserved area even if they looks really similar. From my guess, it is caused by some needs on bitmap management. Kvm side wants to maintain

[PATCH v2 02/10] DMA, CMA: fix possible memory leak

2014-06-11 Thread Joonsoo Kim
We should free memory for bitmap when we find zone mis-match, otherwise this memory will leak. Additionally, I copy code comment from ppc kvm's cma code to notify why we need to check zone mis-match. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/drivers/base/dma-contiguous.c

[PATCH v2 05/10] DMA, CMA: support arbitrary bitmap granularity

2014-06-11 Thread Joonsoo Kim
ppc kvm's cma region management requires arbitrary bitmap granularity, since they want to reserve very large memory and manage this region with bitmap that one bit for several pages to reduce management overheads. So support arbitrary bitmap granularity for following generalization.

[PATCH v2 01/10] DMA, CMA: clean-up log message

2014-06-11 Thread Joonsoo Kim
We don't need explicit 'CMA:' prefix, since we already define prefix 'cma:' in pr_fmt. So remove it. And, some logs print function name and others doesn't. This looks bad to me, so I unify log format to print function name consistently. Lastly, I add one more debug log on cma_activate_area().

Re: How does kvm support x2apic?

2014-06-11 Thread Jidong Xiao
On Wed, Jun 11, 2014 at 8:42 PM, Zhang Haoyu zhan...@sangfor.com wrote: Hi, According to this: https://github.com/torvalds/linux/commit/0d1de2d901f4ba0972a3886496a44fb1d3300dbd It looks like kvm have been supporting x2apic since kernel 2.6.32, or even earlier. This patch is to emulate

Re: [PATCH] KVM: PPC: Book3s PR: Disable AIL mode with OPAL

2014-06-11 Thread Paul Mackerras
On Tue, Jun 10, 2014 at 07:23:00PM +0200, Alexander Graf wrote: When we're using PR KVM we must not allow the CPU to take interrupts in virtual mode, as the SLB does not contain host kernel mappings when running inside the guest context. To make sure we get good performance for non-KVM tasks

Re: [PATCH] KVM: PPC: Book3s HV: Fix tlbie compile error

2014-06-11 Thread Paul Mackerras
On Wed, Jun 11, 2014 at 05:16:02PM +0200, Alexander Graf wrote: Some compilers complain about uninitialized variables in the compute_tlbie_rb function. When you follow the code path you'll realize that we'll never get to that point, but the compiler isn't all that smart. So just default to

Re: [PATCH v2 01/10] DMA, CMA: clean-up log message

2014-06-11 Thread Aneesh Kumar K.V
Joonsoo Kim iamjoonsoo@lge.com writes: We don't need explicit 'CMA:' prefix, since we already define prefix 'cma:' in pr_fmt. So remove it. And, some logs print function name and others doesn't. This looks bad to me, so I unify log format to print function name consistently. Lastly, I

Re: [PATCH v2 02/10] DMA, CMA: fix possible memory leak

2014-06-11 Thread Aneesh Kumar K.V
Joonsoo Kim iamjoonsoo@lge.com writes: We should free memory for bitmap when we find zone mis-match, otherwise this memory will leak. Additionally, I copy code comment from ppc kvm's cma code to notify why we need to check zone mis-match. Signed-off-by: Joonsoo Kim

Re: [PATCH v2 03/10] DMA, CMA: separate core cma management codes from DMA APIs

2014-06-11 Thread Aneesh Kumar K.V
Joonsoo Kim iamjoonsoo@lge.com writes: To prepare future generalization work on cma area management code, we need to separate core cma management codes from DMA APIs. We will extend these core functions to cover requirements of ppc kvm's cma area management functionality in following

Re: [PATCH v2 04/10] DMA, CMA: support alignment constraint on cma region

2014-06-11 Thread Aneesh Kumar K.V
Joonsoo Kim iamjoonsoo@lge.com writes: ppc kvm's cma area management needs alignment constraint on cma region. So support it to prepare generalization of cma area management functionality. Additionally, add some comments which tell us why alignment constraint is needed on cma region.

Re: [PATCH v2 01/10] DMA, CMA: clean-up log message

2014-06-11 Thread Minchan Kim
Hi Joonsoo, On Thu, Jun 12, 2014 at 12:21:38PM +0900, Joonsoo Kim wrote: We don't need explicit 'CMA:' prefix, since we already define prefix 'cma:' in pr_fmt. So remove it. And, some logs print function name and others doesn't. This looks bad to me, so I unify log format to print function

Re: [PATCH v2 02/10] DMA, CMA: fix possible memory leak

2014-06-11 Thread Minchan Kim
On Thu, Jun 12, 2014 at 12:21:39PM +0900, Joonsoo Kim wrote: We should free memory for bitmap when we find zone mis-match, otherwise this memory will leak. Then, -stable stuff? Additionally, I copy code comment from ppc kvm's cma code to notify why we need to check zone mis-match.

Re: Using virtio for inter-VM communication

2014-06-11 Thread Jan Kiszka
On 2014-06-12 04:27, Rusty Russell wrote: Henning Schild henning.sch...@siemens.com writes: Hi, i am working on the jailhouse[1] project and am currently looking at inter-VM communication. We want to connect guests directly with virtual consoles based on shared memory. The code complexity in

Re: [PATCH v2 03/10] DMA, CMA: separate core cma management codes from DMA APIs

2014-06-11 Thread Minchan Kim
On Thu, Jun 12, 2014 at 12:21:40PM +0900, Joonsoo Kim wrote: To prepare future generalization work on cma area management code, we need to separate core cma management codes from DMA APIs. We will extend these core functions to cover requirements of ppc kvm's cma area management functionality

Re: [PATCH v2 01/10] DMA, CMA: clean-up log message

2014-06-11 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 10:11:19AM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: We don't need explicit 'CMA:' prefix, since we already define prefix 'cma:' in pr_fmt. So remove it. And, some logs print function name and others doesn't. This looks bad to

Re: [PATCH v11 09/16] qspinlock, x86: Allow unfair spinlock in a virtual guest

2014-06-11 Thread Peter Zijlstra
On Wed, Jun 11, 2014 at 09:37:55PM -0400, Long, Wai Man wrote: On 6/11/2014 6:54 AM, Peter Zijlstra wrote: On Fri, May 30, 2014 at 11:43:55AM -0400, Waiman Long wrote: Enabling this configuration feature causes a slight decrease the performance of an uncontended lock-unlock operation by

Re: [PATCH v2 01/10] DMA, CMA: clean-up log message

2014-06-11 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 02:18:53PM +0900, Minchan Kim wrote: Hi Joonsoo, On Thu, Jun 12, 2014 at 12:21:38PM +0900, Joonsoo Kim wrote: We don't need explicit 'CMA:' prefix, since we already define prefix 'cma:' in pr_fmt. So remove it. And, some logs print function name and others

Re: [PATCH v2 04/10] DMA, CMA: support alignment constraint on cma region

2014-06-11 Thread Minchan Kim
On Thu, Jun 12, 2014 at 12:21:41PM +0900, Joonsoo Kim wrote: ppc kvm's cma area management needs alignment constraint on cma region. So support it to prepare generalization of cma area management functionality. Additionally, add some comments which tell us why alignment constraint is needed

Re: [PATCH v2 02/10] DMA, CMA: fix possible memory leak

2014-06-11 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 02:25:43PM +0900, Minchan Kim wrote: On Thu, Jun 12, 2014 at 12:21:39PM +0900, Joonsoo Kim wrote: We should free memory for bitmap when we find zone mis-match, otherwise this memory will leak. Then, -stable stuff? I don't think so. This is just possible leak

Re: [RFC PATCH 2/3] DMA, CMA: use general CMA reserved area management framework

2014-06-11 Thread Michal Nazarewicz
On Tue, Jun 10 2014, Joonsoo Kim iamjoonsoo@lge.com wrote: Without including device.h, build failure occurs. In dma-contiguous.h, we try to access to dev-cma_area, so we need device.h. In the past, we included it luckily by swap.h in drivers/base/dma-contiguous.c. Swap.h includes node.h

[PATCH 0/6] KVM: PPC: Book3S HV: Enable on little endian hosts

2014-06-11 Thread Alexander Graf
So far we've been able to successfully run HV KVM on big endian hosts, but once you dive into little endian land things start to fall apart. This patch set enables HV KVM for little endian hosts. This should be the final piece left missing to get little endian systems fully en par with big endian

[PATCH 1/6] PPC: Add asm helpers for BE 32bit load/store

2014-06-11 Thread Alexander Graf
From assembly code we might not only have to explicitly BE access 64bit values, but sometimes also 32bit ones. Add helpers that allow for easy use of lwzx/stwx in their respective byte-reverse or native form. Signed-off-by: Alexander Graf ag...@suse.de CC: Benjamin Herrenschmidt

[PATCH 5/6] KVM: PPC: Book3S HV: Access XICS in BE

2014-06-11 Thread Alexander Graf
On the exit path from the guest we check what type of interrupt we received if we received one. This means we're doing hardware access to the XICS interrupt controller. However, when running on a little endian system, this access is byte reversed. So let's make sure to swizzle the bytes back

[PATCH 3/6] KVM: PPC: Book3S HV: Access guest VPA in BE

2014-06-11 Thread Alexander Graf
There are a few shared data structures between the host and the guest. Most of them get registered through the VPA interface. These data structures are defined to always be in big endian byte order, so let's make sure we always access them in big endian. Signed-off-by: Alexander Graf

[PATCH 6/6] KVM: PPC: Book3S HV: Enable for little endian hosts

2014-06-11 Thread Alexander Graf
Now that we've fixed all the issues that HV KVM code had on little endian hosts, we can enable it in the kernel configuration for users to play with. Signed-off-by: Alexander Graf ag...@suse.de --- arch/powerpc/kvm/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git

[PATCH 4/6] KVM: PPC: Book3S HV: Access host lppaca and shadow slb in BE

2014-06-11 Thread Alexander Graf
Some data structures are always stored in big endian. Among those are the LPPACA fields as well as the shadow slb. These structures might be shared with a hypervisor. So whenever we access those fields, make sure we do so in big endian byte order. Signed-off-by: Alexander Graf ag...@suse.de ---

[PATCH 2/6] KVM: PPC: Book3S HV: Make HTAB code LE host aware

2014-06-11 Thread Alexander Graf
When running on an LE host all data structures are kept in little endian byte order. However, the HTAB still needs to be maintained in big endian. So every time we access any HTAB we need to make sure we do so in the right byte order. Fix up all accesses to manually byte swap. Signed-off-by:

[PATCH] KVM: PPC: Book3s HV: Fix tlbie compile error

2014-06-11 Thread Alexander Graf
Some compilers complain about uninitialized variables in the compute_tlbie_rb function. When you follow the code path you'll realize that we'll never get to that point, but the compiler isn't all that smart. So just default to 4k page sizes for everything, making the compiler happy and the code

Re: [PATCH v10 3/3] drivers/vfio: EEH support for VFIO PCI device

2014-06-11 Thread Alex Williamson
On Tue, 2014-06-10 at 11:41 +1000, Gavin Shan wrote: The patch adds new IOCTL commands for sPAPR VFIO container device to support EEH functionality for PCI devices, which have been passed through from host to somebody else via VFIO. Signed-off-by: Gavin Shan gws...@linux.vnet.ibm.com

[PATCH v2 02/10] DMA, CMA: fix possible memory leak

2014-06-11 Thread Joonsoo Kim
We should free memory for bitmap when we find zone mis-match, otherwise this memory will leak. Additionally, I copy code comment from ppc kvm's cma code to notify why we need to check zone mis-match. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/drivers/base/dma-contiguous.c

[PATCH v2 06/10] CMA: generalize CMA reserved area management functionality

2014-06-11 Thread Joonsoo Kim
Currently, there are two users on CMA functionality, one is the DMA subsystem and the other is the kvm on powerpc. They have their own code to manage CMA reserved area even if they looks really similar. From my guess, it is caused by some needs on bitmap management. Kvm side wants to maintain

[PATCH v2 05/10] DMA, CMA: support arbitrary bitmap granularity

2014-06-11 Thread Joonsoo Kim
ppc kvm's cma region management requires arbitrary bitmap granularity, since they want to reserve very large memory and manage this region with bitmap that one bit for several pages to reduce management overheads. So support arbitrary bitmap granularity for following generalization.

[PATCH v2 10/10] mm, cma: use spinlock instead of mutex

2014-06-11 Thread Joonsoo Kim
Currently, we should take the mutex for manipulating bitmap. This job may be really simple and short so we don't need to sleep if contended. So I change it to spinlock. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/cma.c b/mm/cma.c index 22a5b23..3085e8c 100644 --- a/mm/cma.c

[PATCH v2 04/10] DMA, CMA: support alignment constraint on cma region

2014-06-11 Thread Joonsoo Kim
ppc kvm's cma area management needs alignment constraint on cma region. So support it to prepare generalization of cma area management functionality. Additionally, add some comments which tell us why alignment constraint is needed on cma region. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com

[PATCH v2 08/10] mm, cma: clean-up cma allocation error path

2014-06-11 Thread Joonsoo Kim
We can remove one call sites for clear_cma_bitmap() if we first call it before checking error number. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/cma.c b/mm/cma.c index 1e1b017..01a0713 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -282,11 +282,12 @@ struct page *cma_alloc(struct

[PATCH v2 07/10] PPC, KVM, CMA: use general CMA reserved area management framework

2014-06-11 Thread Joonsoo Kim
Now, we have general CMA reserved area management framework, so use it for future maintainabilty. There is no functional change. Acked-by: Michal Nazarewicz min...@mina86.com Acked-by: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git

[PATCH v2 01/10] DMA, CMA: clean-up log message

2014-06-11 Thread Joonsoo Kim
We don't need explicit 'CMA:' prefix, since we already define prefix 'cma:' in pr_fmt. So remove it. And, some logs print function name and others doesn't. This looks bad to me, so I unify log format to print function name consistently. Lastly, I add one more debug log on cma_activate_area().

  1   2   >