Re: [PATCH v3 0/7] Add virtio-iommu driver

2018-10-12 Thread Jean-Philippe Brucker
On 12/10/2018 18:00, Michael S. Tsirkin wrote: > This all looks good to me. Minor nits: > - I think DEBUG mode is best just removed for now > - Slightly wrong patch splitup causing a misaligned structure > in uapi until all patches are applied. Thanks a lot for the review, I'll fix these up and

Re: [PATCH v3 5/7] iommu: Add virtio-iommu driver

2018-10-12 Thread Jean-Philippe Brucker
On 12/10/2018 17:35, Michael S. Tsirkin wrote: >> +list_del(&req->list); >> +kfree(req); > > So with DEBUG set, this will actually free memory that device still > DMA's into. Hardly pretty. I think you want to mark device broken, > queue the request and then wait for device

Re: [PATCH v6 05/18] ACPI / APEI: Make estatus queue a Kconfig symbol

2018-10-12 Thread Borislav Petkov
On Fri, Oct 12, 2018 at 06:17:48PM +0100, James Morse wrote: > Ripping out the existing #ifdefs and replacing them with IS_ENABLED() would > let > the compiler work out the estatus stuff is unused, and saves us describing the > what-uses-it logic in Kconfig. > > But this does expose the x86 nmi s

Re: [PATCH v6 15/18] ACPI / APEI: Only use queued estatus entry during _in_nmi_notify_one()

2018-10-12 Thread Borislav Petkov
On Fri, Sep 21, 2018 at 11:17:02PM +0100, James Morse wrote: > Each struct ghes has an worst-case sized buffer for storing the > estatus. If an error is being processed by ghes_proc() in process > context this buffer will be in use. If the error source then triggers > an NMI-like notification, the

Re: [PATCH v6 14/18] ACPI / APEI: Split ghes_read_estatus() to read CPER length

2018-10-12 Thread Borislav Petkov
On Fri, Sep 21, 2018 at 11:17:01PM +0100, James Morse wrote: > ghes_read_estatus() reads the record address, then the record's > header, then performs some sanity checks before reading the > records into the provided estatus buffer. > > We either need to know the size of the records before we call

Re: [PATCH v6 07/18] arm64: KVM/mm: Move SEA handling behind a single 'claim' interface

2018-10-12 Thread James Morse
Hi Boris, On 12/10/2018 11:02, Borislav Petkov wrote: > On Fri, Sep 21, 2018 at 11:16:54PM +0100, James Morse wrote: >> To split up APEIs in_nmi() path, we need the nmi-like callers to always >> be in_nmi(). Add a helper to do the work and claim the notification. >> >> When KVM or the arch code ta

Re: [PATCH v6 06/18] KVM: arm/arm64: Add kvm_ras.h to collect kvm specific RAS plumbing

2018-10-12 Thread James Morse
Hi Boris, On 12/10/2018 10:57, Borislav Petkov wrote: > On Fri, Sep 21, 2018 at 11:16:53PM +0100, James Morse wrote: >> To split up APEIs in_nmi() path, we need any nmi-like callers to always >> be in_nmi(). KVM shouldn't have to know about this, pull the RAS plumbing >> out into a header file. >>

Re: [PATCH v6 05/18] ACPI / APEI: Make estatus queue a Kconfig symbol

2018-10-12 Thread James Morse
Hi Boris, On 04/10/2018 18:34, Borislav Petkov wrote: > On Wed, Oct 03, 2018 at 06:50:36PM +0100, James Morse wrote: >> I'm all in favour of letting the compiler work it out, but the existing ghes >> code has #ifdef/#else all over the place. This is 'keeping the style'. > > Yeah, but this "style"

Re: [PATCH v6 13/18] ACPI / APEI: Don't update struct ghes' flags in read/clear estatus

2018-10-12 Thread Borislav Petkov
On Fri, Sep 21, 2018 at 11:17:00PM +0100, James Morse wrote: > ghes_read_estatus() sets a flag in struct ghes if the buffer of > CPER records needs to be cleared once the records have been > processed. This global flags value is a problem if a struct ghes > can be processed concurrently, as happens

Re: [PATCH v3 0/7] Add virtio-iommu driver

2018-10-12 Thread Michael S. Tsirkin
On Fri, Oct 12, 2018 at 03:59:10PM +0100, Jean-Philippe Brucker wrote: > Implement the virtio-iommu driver, following specification v0.8 [1]. > Changes since v2 [2]: > > * Patches 2-4 allow virtio-iommu to use the PCI transport, since QEMU > would like to phase out the MMIO transport. This produ

Re: [PATCH v6 11/18] ACPI / APEI: Remove silent flag from ghes_read_estatus()

2018-10-12 Thread Borislav Petkov
On Fri, Sep 21, 2018 at 11:16:58PM +0100, James Morse wrote: > Subsequent patches will split up ghes_read_estatus(), at which > point passing around the 'silent' flag gets annoying. This is to > suppress prink() messages, which prior to 42a0bb3f7138 ("printk/nmi: > generic solution for safe printk

Re: ARM64 KVM crash

2018-10-12 Thread Marc Zyngier
Hi Mikulas, On 12/10/18 17:20, Mikulas Patocka wrote: > Hi > > I report this crash that happened on ARM64 in the host kernel when running > a workload in a virtual machine. The crash is not reproducible. Kernel > 4.18.12, board MacchiatoBin. > > The call sequence that leads up to the crash: fi

Re: [PATCH v3 6/7] iommu/virtio: Add probe request

2018-10-12 Thread Michael S. Tsirkin
On Fri, Oct 12, 2018 at 03:59:16PM +0100, Jean-Philippe Brucker wrote: > When the device offers the probe feature, send a probe request for each > device managed by the IOMMU. Extract RESV_MEM information. When we > encounter a MSI doorbell region, set it up as a IOMMU_RESV_MSI region. > This will

Re: [PATCH v6 10/18] ACPI / APEI: preparatory split of ghes->estatus

2018-10-12 Thread Borislav Petkov
Nitpick: Subject: Re: [PATCH v6 10/18] ACPI / APEI: preparatory split of ghes->estatus Pls have an active formulation in your Subject and start it with a capital letter, i.e., something like: "Split ghes->estatus in preparation for... " On Fri, Sep 21, 2018 at 11:16:57PM +0100, James Mo

Re: [PATCH v3 5/7] iommu: Add virtio-iommu driver

2018-10-12 Thread Michael S. Tsirkin
On Fri, Oct 12, 2018 at 03:59:15PM +0100, Jean-Philippe Brucker wrote: > The virtio IOMMU is a para-virtualized device, allowing to send IOMMU > requests such as map/unmap over virtio transport without emulating page > tables. This implementation handles ATTACH, DETACH, MAP and UNMAP > requests. >

[PATCH v4 1/2] arm/arm64: KVM: rename function kvm_arch_dev_ioctl_check_extension()

2018-10-12 Thread Dongjiu Geng
Rename kvm_arch_dev_ioctl_check_extension() to kvm_arch_vm_ioctl_check_extension(), because it does not have any relationship with device. Renaming this function can make code readable. Cc: James Morse Reviewed-by: Suzuki K Poulose Signed-off-by: Dongjiu Geng --- I remeber James also mentioned

[PATCH v4 2/2] arm/arm64: KVM: enable 32 bits kvm vcpu events support

2018-10-12 Thread Dongjiu Geng
The commit 539aee0edb9f ("KVM: arm64: Share the parts of get/set events useful to 32bit") shares the get/set events helper for arm64 and arm32, but forgot to share the cap extension code. User space will check whether KVM supports vcpu events by checking the KVM_CAP_VCPU_EVENTS extension Cc: Jame

[PATCH v4 0/2] rename function name and enable 32bit vcpu events

2018-10-12 Thread Dongjiu Geng
Rename the kvm_arch_dev_ioctl_check_extension() to kvm_arch_vm_ioctl_check_extension, because the name is not readable; Enable the 32 bit vcpu events support. Change since v3: 1. Address James's comments to update the patch commit messages Change since v2: 1. Address Suzuki's comments to update

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Anton Ivanov
On 12/10/2018 15:37, Kirill A. Shutemov wrote: On Fri, Oct 12, 2018 at 03:09:49PM +0100, Anton Ivanov wrote: On 10/12/18 2:37 AM, Joel Fernandes (Google) wrote: Android needs to mremap large regions of memory during memory management related operations. The mremap system call can be really slow

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Kirill A. Shutemov
On Fri, Oct 12, 2018 at 03:09:49PM +0100, Anton Ivanov wrote: > On 10/12/18 2:37 AM, Joel Fernandes (Google) wrote: > > Android needs to mremap large regions of memory during memory management > > related operations. The mremap system call can be really slow if THP is > > not enabled. The bottlenec

Re: [PATCH v3 1/2] arm/arm64: KVM: rename function kvm_arch_dev_ioctl_check_extension()

2018-10-12 Thread James Morse
Hi Dongjiu Geng, On 11/10/2018 20:07, Dongjiu Geng wrote: > Rename kvm_arch_dev_ioctl_check_extension() to > kvm_arch_vm_ioctl_check_extension(), because it does > not have any relationship with device. > > Renaming this function can make code readable. Lots of things in the kernel are misnamed,

Re: [PATCH v3 2/2] arm/arm64: KVM: enable 32 bits kvm vcpu events support

2018-10-12 Thread gengdongjiu
Hi James, > Hi Dongjiu Geng, > > On 11/10/2018 20:07, Dongjiu Geng wrote: > > The commit 539aee0edb9f ("KVM: arm64: Share the parts of get/set > > events useful to 32bit") shares the get/set events helper for arm64 > > and arm32, > > Oops. I evidently didn't test this bit. Looks like I just depe

[PATCH v3 5/7] iommu: Add virtio-iommu driver

2018-10-12 Thread Jean-Philippe Brucker
The virtio IOMMU is a para-virtualized device, allowing to send IOMMU requests such as map/unmap over virtio transport without emulating page tables. This implementation handles ATTACH, DETACH, MAP and UNMAP requests. The bulk of the code transforms calls coming from the IOMMU API into correspondi

[PATCH v3 3/7] PCI: OF: Allow endpoints to bypass the iommu

2018-10-12 Thread Jean-Philippe Brucker
Using the iommu-map binding, endpoints in a given PCI domain can be managed by different IOMMUs. Some virtual machines may allow a subset of endpoints to bypass the IOMMU. In some case the IOMMU itself is presented as a PCI endpoint (e.g. AMD IOMMU and virtio-iommu). Currently, when a PCI root comp

[PATCH v3 7/7] iommu/virtio: Add event queue

2018-10-12 Thread Jean-Philippe Brucker
The event queue offers a way for the device to report access faults from endpoints. It is implemented on virtqueue #1. Whenever the host needs to signal a fault, it fills one of the buffers offered by the guest and interrupts it. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iomm

[PATCH v3 6/7] iommu/virtio: Add probe request

2018-10-12 Thread Jean-Philippe Brucker
When the device offers the probe feature, send a probe request for each device managed by the IOMMU. Extract RESV_MEM information. When we encounter a MSI doorbell region, set it up as a IOMMU_RESV_MSI region. This will tell other subsystems that there is no need to map the MSI doorbell in the virt

[PATCH v3 0/7] Add virtio-iommu driver

2018-10-12 Thread Jean-Philippe Brucker
Implement the virtio-iommu driver, following specification v0.8 [1]. Changes since v2 [2]: * Patches 2-4 allow virtio-iommu to use the PCI transport, since QEMU would like to phase out the MMIO transport. This produces a complex topology where the programming interface of the IOMMU could appea

[PATCH v3 4/7] PCI: OF: Initialize dev->fwnode appropriately

2018-10-12 Thread Jean-Philippe Brucker
For PCI devices that have an OF node, set the fwnode as well. This way drivers that rely on fwnode don't need the special case described by commit f94277af03ea ("of/platform: Initialise dev->fwnode appropriately"). Signed-off-by: Jean-Philippe Brucker --- drivers/pci/of.c | 7 +++ 1 file cha

[PATCH v3 2/7] dt-bindings: virtio: Add virtio-pci-iommu node

2018-10-12 Thread Jean-Philippe Brucker
Some systems implement virtio-iommu as a PCI endpoint. The operating systems needs to discover the relationship between IOMMU and masters long before the PCI endpoint gets probed. Add a PCI child node to describe the virtio-iommu device. The virtio-pci-iommu is conceptually split between a PCI pro

[PATCH v3 1/7] dt-bindings: virtio-mmio: Add IOMMU description

2018-10-12 Thread Jean-Philippe Brucker
The nature of a virtio-mmio node is discovered by the virtio driver at probe time. However the DMA relation between devices must be described statically. When a virtio-mmio node is a virtio-iommu device, it needs an "#iommu-cells" property as specified by bindings/iommu/iommu.txt. Otherwise, the v

[PATCH v2 1/2] treewide: remove unused address argument from pte_alloc functions

2018-10-12 Thread Joel Fernandes (Google)
This series speeds up mremap(2) syscall by copying page tables at the PMD level even for non-THP systems. There is concern that the extra 'address' argument that mremap passes to pte_alloc may do something subtle architecture related in the future, that makes the scheme not work. Also we find that

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Joel Fernandes
On Fri, Oct 12, 2018 at 02:30:56PM +0300, Kirill A. Shutemov wrote: > On Thu, Oct 11, 2018 at 06:37:56PM -0700, Joel Fernandes (Google) wrote: > > Android needs to mremap large regions of memory during memory management > > related operations. The mremap system call can be really slow if THP is > >

Re: [PATCH v2 1/2] treewide: remove unused address argument from pte_alloc functions

2018-10-12 Thread Kirill A. Shutemov
On Thu, Oct 11, 2018 at 06:37:55PM -0700, Joel Fernandes (Google) wrote: > diff --git a/arch/m68k/include/asm/mcf_pgalloc.h > b/arch/m68k/include/asm/mcf_pgalloc.h > index 12fe700632f4..4399d712f6db 100644 > --- a/arch/m68k/include/asm/mcf_pgalloc.h > +++ b/arch/m68k/include/asm/mcf_pgalloc.h > @@

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Kirill A. Shutemov
On Fri, Oct 12, 2018 at 05:50:46AM -0700, Joel Fernandes wrote: > On Fri, Oct 12, 2018 at 02:30:56PM +0300, Kirill A. Shutemov wrote: > > On Thu, Oct 11, 2018 at 06:37:56PM -0700, Joel Fernandes (Google) wrote: > > > Android needs to mremap large regions of memory during memory management > > > rel

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Anton Ivanov
On 10/12/18 2:37 AM, Joel Fernandes (Google) wrote: Android needs to mremap large regions of memory during memory management related operations. The mremap system call can be really slow if THP is not enabled. The bottleneck is move_page_tables, which is copying each pte at a time, and can be rea

Re: Timekeeping on ARM guests/hosts

2018-10-12 Thread Miriam Zimmerman
On Thu, Oct 11, 2018 at 8:21 AM Laszlo Ersek wrote: > > On 10/11/18 09:54, Marc Zyngier wrote: > > Hi Miriam, > > > > On Wed, 10 Oct 2018 19:38:47 +0100, > > Miriam Zimmerman wrote: > >> > >> (oops, sorry for lack of plaintext in the first email. must've > >> forgotten to click the button in my e

Re: [PATCH v2 1/2] treewide: remove unused address argument from pte_alloc functions

2018-10-12 Thread Anton Ivanov
On 10/12/18 2:37 AM, Joel Fernandes (Google) wrote: This series speeds up mremap(2) syscall by copying page tables at the PMD level even for non-THP systems. There is concern that the extra 'address' argument that mremap passes to pte_alloc may do something subtle architecture related in the fu

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Kirill A. Shutemov
On Thu, Oct 11, 2018 at 06:37:56PM -0700, Joel Fernandes (Google) wrote: > Android needs to mremap large regions of memory during memory management > related operations. The mremap system call can be really slow if THP is > not enabled. The bottleneck is move_page_tables, which is copying each > pt

Re: [PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Kirill A. Shutemov
On Fri, Oct 12, 2018 at 02:30:56PM +0300, Kirill A. Shutemov wrote: > On Thu, Oct 11, 2018 at 06:37:56PM -0700, Joel Fernandes (Google) wrote: > > @@ -239,7 +287,21 @@ unsigned long move_page_tables(struct vm_area_struct > > *vma, > > split_huge_pmd(vma, old_pmd, old_addr); > >

[PATCH v2 2/2] mm: speed up mremap by 500x on large regions

2018-10-12 Thread Joel Fernandes (Google)
Android needs to mremap large regions of memory during memory management related operations. The mremap system call can be really slow if THP is not enabled. The bottleneck is move_page_tables, which is copying each pte at a time, and can be really slow across a large map. Turning on THP may not be

Re: [PATCH v3 2/2] arm/arm64: KVM: enable 32 bits kvm vcpu events support

2018-10-12 Thread James Morse
Hi Dongjiu Geng, On 11/10/2018 20:07, Dongjiu Geng wrote: > The commit 539aee0edb9f ("KVM: arm64: Share the parts of > get/set events useful to 32bit") shares the get/set events > helper for arm64 and arm32, Oops. I evidently didn't test this bit. Looks like I just depended on the symbol to be d

Re: [PATCH v6 09/18] ACPI / APEI: Let the notification helper specify the fixmap slot

2018-10-12 Thread Borislav Petkov
On Fri, Sep 21, 2018 at 11:16:56PM +0100, James Morse wrote: > ghes_copy_tofrom_phys() uses a different fixmap slot depending on in_nmi(). > This doesn't work when we have multiple NMI-like notifications, that > can interrupt each other. > > As with the locking, move the chosen fixmap_idx to the n

Re: [PATCH v6 08/18] ACPI / APEI: Move locking to the notification helper

2018-10-12 Thread Borislav Petkov
On Fri, Sep 21, 2018 at 11:16:55PM +0100, James Morse wrote: > ghes_copy_tofrom_phys() takes different locks depending on in_nmi(). > This doesn't work when we have multiple NMI-like notifications, that > can interrupt each other. > > Now that NOTIFY_SEA is always called as an NMI, move the lock-t

Re: [PATCH v6 07/18] arm64: KVM/mm: Move SEA handling behind a single 'claim' interface

2018-10-12 Thread Borislav Petkov
On Fri, Sep 21, 2018 at 11:16:54PM +0100, James Morse wrote: > To split up APEIs in_nmi() path, we need the nmi-like callers to always > be in_nmi(). Add a helper to do the work and claim the notification. > > When KVM or the arch code takes an exception that might be a RAS > notification, it asks

Re: [PATCH v6 06/18] KVM: arm/arm64: Add kvm_ras.h to collect kvm specific RAS plumbing

2018-10-12 Thread Borislav Petkov
On Fri, Sep 21, 2018 at 11:16:53PM +0100, James Morse wrote: > To split up APEIs in_nmi() path, we need any nmi-like callers to always > be in_nmi(). KVM shouldn't have to know about this, pull the RAS plumbing > out into a header file. > > Currently guest synchronous external aborts are claimed a

Re: [PATCH v5 01/17] arm64: add pointer authentication register bits

2018-10-12 Thread Mark Rutland
On Fri, Oct 12, 2018 at 09:56:05AM +0100, Will Deacon wrote: > On Fri, Oct 12, 2018 at 09:53:54AM +0100, Mark Rutland wrote: > > On Thu, Oct 11, 2018 at 05:28:14PM +0100, Will Deacon wrote: > > > On Fri, Oct 05, 2018 at 09:47:38AM +0100, Kristina Martsenko wrote: > > > > > > +#define ESR_ELx_EC_PA

Re: [PATCH v5 01/17] arm64: add pointer authentication register bits

2018-10-12 Thread Will Deacon
On Fri, Oct 12, 2018 at 09:53:54AM +0100, Mark Rutland wrote: > On Thu, Oct 11, 2018 at 05:28:14PM +0100, Will Deacon wrote: > > On Fri, Oct 05, 2018 at 09:47:38AM +0100, Kristina Martsenko wrote: > > > > +#define ESR_ELx_EC_PAC (0x09) > > > > Really minor nit: but shouldn't this be ESR

Re: [PATCH v5 01/17] arm64: add pointer authentication register bits

2018-10-12 Thread Mark Rutland
On Thu, Oct 11, 2018 at 05:28:14PM +0100, Will Deacon wrote: > On Fri, Oct 05, 2018 at 09:47:38AM +0100, Kristina Martsenko wrote: > > +#define ESR_ELx_EC_PAC (0x09) > > Really minor nit: but shouldn't this be ESR_EL2_EC_PAC, since this trap > can't occur at EL1 afaict? It can also b