Re: [PATCH] powerpc: kvm: make the setup of hpte under the protection of KVMPPC_RMAP_LOCK_BIT

2014-07-27 Thread Benjamin Herrenschmidt
On Mon, 2014-07-28 at 14:09 +0800, Liu Ping Fan wrote: > In current code, the setup of hpte is under the risk of race with > mmu_notifier_invalidate, i.e we may setup a hpte with a invalid pfn. > Resolve this issue by sync the two actions by KVMPPC_RMAP_LOCK_BIT. Please describe the race you think

[PATCH] powerpc: kvm: make the setup of hpte under the protection of KVMPPC_RMAP_LOCK_BIT

2014-07-27 Thread Liu Ping Fan
In current code, the setup of hpte is under the risk of race with mmu_notifier_invalidate, i.e we may setup a hpte with a invalid pfn. Resolve this issue by sync the two actions by KVMPPC_RMAP_LOCK_BIT. Signed-off-by: Liu Ping Fan --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 15 ++- 1 f

Re: [PATCH v3 12/18] powerpc/iommu: Fix missing permission bits in iommu_put_tce_user_mode()

2014-07-27 Thread Benjamin Herrenschmidt
On Mon, 2014-07-28 at 14:32 +1000, Alexey Kardashevskiy wrote: > On 07/28/2014 11:19 AM, Benjamin Herrenschmidt wrote: > > On Thu, 2014-07-24 at 18:48 +1000, Alexey Kardashevskiy wrote: > >> This adds missing permission bits to the translated TCE. > > > > Is this a bug fix for existing stuff ? If

Re: [PATCH v3 03/18] KVM: PPC: Account TCE pages in locked_vm

2014-07-27 Thread Benjamin Herrenschmidt
On Mon, 2014-07-28 at 14:23 +1000, Alexey Kardashevskiy wrote: > On 07/28/2014 10:43 AM, Benjamin Herrenschmidt wrote: > > On Thu, 2014-07-24 at 18:47 +1000, Alexey Kardashevskiy wrote: > >> Signed-off-by: Alexey Kardashevskiy > >> --- > > > > You need a description. > > > >> arch/powerpc/kvm/b

Re: [PATCH v3 12/18] powerpc/iommu: Fix missing permission bits in iommu_put_tce_user_mode()

2014-07-27 Thread Alexey Kardashevskiy
On 07/28/2014 11:19 AM, Benjamin Herrenschmidt wrote: > On Thu, 2014-07-24 at 18:48 +1000, Alexey Kardashevskiy wrote: >> This adds missing permission bits to the translated TCE. > > Is this a bug fix for existing stuff ? If yes, submit it separately. There is 15/18 patch which fixes possible bu

Re: [PATCH v3 02/18] KVM: PPC: Use RCU when adding to arch.spapr_tce_tables

2014-07-27 Thread Benjamin Herrenschmidt
On Mon, 2014-07-28 at 14:11 +1000, Alexey Kardashevskiy wrote: > === > At the moment the spapr_tce_tables list is not protected against races > which may happen if the userspace issues the KVM_CREATE_SPAPR_TCE ioctl > to KVM from different threads. > > This makes use of _rcu helpers for list_add()

Re: [PATCH v3 03/18] KVM: PPC: Account TCE pages in locked_vm

2014-07-27 Thread Alexey Kardashevskiy
On 07/28/2014 10:43 AM, Benjamin Herrenschmidt wrote: > On Thu, 2014-07-24 at 18:47 +1000, Alexey Kardashevskiy wrote: >> Signed-off-by: Alexey Kardashevskiy >> --- > > You need a description. > >> arch/powerpc/kvm/book3s_64_vio.c | 35 ++- >> 1 file changed, 34

Re: [PATCH v3 10/18] powerpc/powernv: Convert/move set_bypass() callback to take_ownership()

2014-07-27 Thread Benjamin Herrenschmidt
On Mon, 2014-07-28 at 13:55 +1000, Alexey Kardashevskiy wrote: > On 07/28/2014 11:18 AM, Benjamin Herrenschmidt wrote: > > On Thu, 2014-07-24 at 18:48 +1000, Alexey Kardashevskiy wrote: > >> At the moment the iommu_table struct has a set_bypass() which enables/ > >> disables DMA bypass on IODA2 PHB

Re: [PATCH v3 02/18] KVM: PPC: Use RCU when adding to arch.spapr_tce_tables

2014-07-27 Thread Alexey Kardashevskiy
On 07/28/2014 10:40 AM, Benjamin Herrenschmidt wrote: > On Thu, 2014-07-24 at 18:47 +1000, Alexey Kardashevskiy wrote: >> Signed-off-by: Alexey Kardashevskiy >> Reviewed-by: Gavin Shan > > You need a much better changeset here, explaining what you are > protecting against and why just changing t

Re: [PATCH v3 10/18] powerpc/powernv: Convert/move set_bypass() callback to take_ownership()

2014-07-27 Thread Alexey Kardashevskiy
On 07/28/2014 11:18 AM, Benjamin Herrenschmidt wrote: > On Thu, 2014-07-24 at 18:48 +1000, Alexey Kardashevskiy wrote: >> At the moment the iommu_table struct has a set_bypass() which enables/ >> disables DMA bypass on IODA2 PHB. This is exposed to POWERPC IOMMU code >> which calls this callback wh

[PATCH] Add Michael Ellerman as powerpc co-maintainer

2014-07-27 Thread Benjamin Herrenschmidt
Michael has been backing me up and helping will all aspects of maintainership for a while now, let's make it official. Signed-off-by: Benjamin Herrenschmidt -- Linus: I'll put this patch in powerpc-next, I'm just CC'ing you so you are aware, in case I'm not available and Michael starts sending yo

[git pull] Please pull powerpc.git merge branch

2014-07-27 Thread Benjamin Herrenschmidt
Hi Linus ! Here are 3 more small powerpc fixes that should still go into .16. One is a recent regression (MMCR2 business), the other is a trivial endian fix without which FW updates won't work on LE in IBM machines, and the 3rd one turns a BUG_ON into a WARN_ON which is definitely a LOT more frien

Re: [PATCH] powerpc: fixing endianness of flash_block_list in rtas_flash

2014-07-27 Thread Michael Ellerman
Hi Thomas, On Fri, 2014-07-25 at 12:47 -0500, Thomas Falcon wrote: > [PATCH] powerpc: fixing endianness of flash_block_list in rtas_flash Minor nit, but the commit title should use the imperative mood, so eg: [PATCH] powerpc: Fix endianness of flash_block_list in rtas_flash > The function rta

Re: [PATCH v3 12/18] powerpc/iommu: Fix missing permission bits in iommu_put_tce_user_mode()

2014-07-27 Thread Benjamin Herrenschmidt
On Thu, 2014-07-24 at 18:48 +1000, Alexey Kardashevskiy wrote: > This adds missing permission bits to the translated TCE. Is this a bug fix for existing stuff ? If yes, submit it separately. > Signed-off-by: Alexey Kardashevskiy > --- > arch/powerpc/kernel/iommu.c | 1 + > 1 file changed, 1 ins

Re: [PATCH v3 10/18] powerpc/powernv: Convert/move set_bypass() callback to take_ownership()

2014-07-27 Thread Benjamin Herrenschmidt
On Thu, 2014-07-24 at 18:48 +1000, Alexey Kardashevskiy wrote: > At the moment the iommu_table struct has a set_bypass() which enables/ > disables DMA bypass on IODA2 PHB. This is exposed to POWERPC IOMMU code > which calls this callback when external IOMMU users such as VFIO are > about to get ove

Re: [PATCH v3 13/18] powerpc/iommu: Extend ppc_md.tce_build(_rm) to return old TCE values

2014-07-27 Thread Benjamin Herrenschmidt
On Thu, 2014-07-24 at 18:48 +1000, Alexey Kardashevskiy wrote: > The tce_build/tce_build_rm callbacks are used to implement H_PUT_TCE/etc > hypercalls. The PAPR spec does not allow to fail if the TCE is not empty. > However we cannot just overwrite the existing TCE value with the new one > as we st

Re: [PATCH v3 13/18] powerpc/iommu: Extend ppc_md.tce_build(_rm) to return old TCE values

2014-07-27 Thread Benjamin Herrenschmidt
On Thu, 2014-07-24 at 18:48 +1000, Alexey Kardashevskiy wrote: > The tce_build/tce_build_rm callbacks are used to implement H_PUT_TCE/etc > hypercalls. The PAPR spec does not allow to fail if the TCE is not empty. > However we cannot just overwrite the existing TCE value with the new one > as we st

Re: [PATCH v3 04/18] vfio: powerpc: Move locked_vm accounting to a helper

2014-07-27 Thread Benjamin Herrenschmidt
On Thu, 2014-07-24 at 18:47 +1000, Alexey Kardashevskiy wrote: > Additional DMA windows support is coming and accounting will include them > so let's move this code to a helper for reuse. This code looks a LOT like the one you added in the previous patch (ie. kvmppc_account_memlimit()), though in

Re: [PATCH v3 03/18] KVM: PPC: Account TCE pages in locked_vm

2014-07-27 Thread Benjamin Herrenschmidt
On Thu, 2014-07-24 at 18:47 +1000, Alexey Kardashevskiy wrote: > Signed-off-by: Alexey Kardashevskiy > --- You need a description. > arch/powerpc/kvm/book3s_64_vio.c | 35 ++- > 1 file changed, 34 insertions(+), 1 deletion(-) > > diff --git a/arch/powerpc/kvm/bo

Re: [PATCH v3 02/18] KVM: PPC: Use RCU when adding to arch.spapr_tce_tables

2014-07-27 Thread Benjamin Herrenschmidt
On Thu, 2014-07-24 at 18:47 +1000, Alexey Kardashevskiy wrote: > Signed-off-by: Alexey Kardashevskiy > Reviewed-by: Gavin Shan You need a much better changeset here, explaining what you are protecting against and why just changing that one list_add is sufficient. Cheers, Ben. > --- > arch/pow