[PATCH v2] device-dax: use fallback nid when numa node is invalid

2021-09-10 Thread Jia He
led with error -22 This fixes it by using fallback memory_add_physaddr_to_nid() as nid. Suggested-by: David Hildenbrand Signed-off-by: Jia He --- v2: - rebase it based on David's "memory group" patch. - drop the changes in dev_dax_kmem_remove() since nid had been removed in

[PATCH] KVM: arm64: Fix unaligned addr case in mmu walking

2021-03-03 Thread Jia He
userspace "segment fault" error can be easily triggered by running simple gVisor runsc cases on an Ampere Altra server: docker run --runtime=runsc -it --rm ubuntu /bin/bash In container: for i in `seq 1 100`;do ls;done Reported-by: Howard Zhang Signed-off-by: Jia He ---

[RFC PATCH 1/2] arm64/cpuinfo: Move init_cpu_features() ahead of setup.c::early_fixmap_init()

2021-01-12 Thread Jia He
nds on static key enable api. Percpu helpers should be avoided in cpuinfo_store_boot_cpu() before percpu init at main.c::setup_per_cpu_areas() Signed-off-by: Jia He --- arch/arm64/include/asm/cpu.h | 1 + arch/arm64/kernel/cpuinfo.c | 13 ++--- arch/arm64/kernel/setup.c|

[RFC PATCH 0/2] Avoid booting stall caused by

2021-01-12 Thread Jia He
ecause I want to resolve any other points which I have misconerned. Jia He (2): arm64/cpuinfo: Move init_cpu_features() ahead of early_fixmap_init() arm64: kpti: Update arm64_use_ng_mappings before pagetable mapping arch/arm64/include/asm/cpu.h | 1 + arch/arm64/kernel/cpuinfo.c | 13 ++--

[RFC PATCH 2/2] arm64: kpti: Update arm64_use_ng_mappings before pagetable mapping

2021-01-12 Thread Jia He
earlier than before. Hence we can avoid this stall by updating arm64_use_ng_mappings. Signed-off-by: Jia He --- arch/arm64/kernel/setup.c | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index e078ab068f3b..51098ceb7159 100644 --- a/arch

[PATCH] vfio iommu type1: Bypass the vma permission check in vfio_pin_pages_remote()

2020-11-19 Thread Jia He
EMAG server: "VFIO_MAP_DMA failed: Bad address" [1] https://gitlab.com/virtio-fs/qemu/-/blob/virtio-fs-dev/hw/virtio/vhost-user-fs.c#L502 Signed-off-by: Jia He --- drivers/vfio/vfio_iommu_type1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/vfio

[PATCH] gpio: dwapb: Fix missing conversion to GPIO-lib-based IRQ-chip

2020-10-16 Thread Jia He
ause a panic. Fixes: 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip") Signed-off-by: Jia He --- drivers/gpio/gpio-dwapb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c in

[RFC PATCH 1/6] mm/memory_hotplug: remove redundant memory block size alignment check

2020-07-28 Thread Jia He
The alignment check has been done by check_hotplug_memory_range(). Hence the redundant one in create_memory_block_devices() can be removed. The similar redundant check is removed in remove_memory_block_devices(). Signed-off-by: Jia He --- drivers/base/memory.c | 8 1 file changed, 8

[RFC PATCH 2/6] resource: export find_next_iomem_res() helper

2020-07-28 Thread Jia He
The helper is to find the lowest iomem resource that covers part of [@start..@end] It is useful when relaxing the alignment check for dax pmem kmem. Signed-off-by: Jia He --- include/linux/ioport.h | 3 +++ kernel/resource.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff

[RFC PATCH 3/6] mm/memory_hotplug: allow pmem kmem not to align with memory_block_size

2020-07-28 Thread Jia He
which causes big memory space wasting. This changes it by relaxing the alignment check for dax pmem kmem in the path of online/offline memory blocks. Signed-off-by: Jia He --- drivers/base/memory.c | 16 mm/memory_hotplug.c | 39 ++- 2 files

[RFC PATCH 6/6] arm64: fall back to vmemmap_populate_basepages if not aligned with PMD_SIZE

2020-07-28 Thread Jia He
) is fe0007e9. Without this patch, vmemmap_populate(fe0007e9, ...) will incorrectly create a pmd mapping [fe0007e0, fe000800] which contains fe0007e9. This adds the check and then falls back to vmemmap_populate_basepages() Signed-off-by: Jia He --- arch/arm64/mm

[RFC PATCH 4/6] mm/page_alloc: adjust the start,end in dax pmem kmem case

2020-07-28 Thread Jia He
range. Without this patch, the check of __init_single_page when doing online memory will be failed because those pages haven't been mapped in mmu(not present from mmu's point of view). Signed-off-by: Jia He --- mm/page_alloc.c | 14 ++ 1 file changed, 14 insertions(+) diff --git

[RFC PATCH 5/6] device-dax: relax the memblock size alignment for kmem_start

2020-07-28 Thread Jia He
y hotplug added. This patches remove the tight alignment constraint of memory_block_size_bytes(), but still keep the constraint from online_pages_range(). Signed-off-by: Jia He --- drivers/dax/kmem.c | 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/dr

[RFC PATCH 0/6] decrease unnecessary gap due to pmem kmem alignment

2020-07-28 Thread Jia He
/lkml.org/lkml/2020/7/8/1546 Jia He (6): mm/memory_hotplug: remove redundant memory block size alignment check resource: export find_next_iomem_res() helper mm/memory_hotplug: allow pmem kmem not to align with memory_block_size mm/page_alloc: adjust the start,end in dax pmem kmem case d

[PATCH 1/2] mm/memory_hotplug: introduce default dummy memory_add_physaddr_to_nid()

2020-07-09 Thread Jia He
to set a fallback value for dev_dax->target_node. Reviewed-by: David Hildenbrand Signed-off-by: Jia He --- arch/arm64/mm/numa.c | 10 -- arch/ia64/mm/numa.c | 2 -- arch/sh/mm/init.c| 9 - arch/x86/mm/numa.c | 1 - mm/memory_hotplug.c | 10 ++ 5 files chan

[PATCH 2/2] mm/memory_hotplug: fix unpaired mem_hotplug_begin/done

2020-07-09 Thread Jia He
device_release_driver_internal+0x100/0x1c0 driver_detach+0x4c/0x8f bus_remove_driver+0x5c/0xd0 driver_unregister+0x31/0x50 dax_pmem_exit+0x10/0xfe0 [dax_pmem] Fixes: f1037ec0cc8a ("mm/memory_hotplug: fix remove_memory() lockdep splat") Cc: sta...@vger.kernel.org # v5.6+ Signed-off-

[PATCH v4 0/2] Fix and enable pmem as RAM device on arm64

2020-07-09 Thread Jia He
ecific one - fix an uninitialization bug in v2 device-dax patch v2: https://lkml.org/lkml/2020/7/7/71 - Drop unnecessary patch to harden try_offline_node - Use new solution(by David) to fix dev->target_node=-1 during probing - Refine the mem_hotplug_begin/done patch v1: https://lkml.org/lkml/

[PATCH v3 5/6] device-dax: use fallback nid when numa_node is invalid

2020-07-08 Thread Jia He
-22 This fixes it by using fallback memory_add_physaddr_to_nid() as nid. Suggested-by: David Hildenbrand Signed-off-by: Jia He --- drivers/dax/kmem.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c index 275aa5f87

[PATCH v3 6/6] mm/memory_hotplug: fix unpaired mem_hotplug_begin/done

2020-07-08 Thread Jia He
device_release_driver_internal+0x100/0x1c0 driver_detach+0x4c/0x8f bus_remove_driver+0x5c/0xd0 driver_unregister+0x31/0x50 dax_pmem_exit+0x10/0xfe0 [dax_pmem] Fixes: f1037ec0cc8a ("mm/memory_hotplug: fix remove_memory() lockdep splat") Cc: sta...@vger.kernel.org # v5.6+ Signed-off-

[PATCH v3 4/6] mm: don't export memory_add_physaddr_to_nid in arch specific directory

2020-07-08 Thread Jia He
. Previous export was in vmlinux Suggested-by: David Hildenbrand Signed-off-by: Jia He --- arch/ia64/mm/numa.c | 2 -- arch/x86/mm/numa.c | 1 - 2 files changed, 3 deletions(-) diff --git a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c index 5e1015eb6d0d..f34964271101 100644 --- a/arch/ia64/mm

[PATCH v3 1/6] mm/memory_hotplug: introduce default dummy memory_add_physaddr_to_nid()

2020-07-08 Thread Jia He
This is to introduce a general dummy helper. memory_add_physaddr_to_nid() is a fallback option to get the nid in case NUMA_NO_NID is detected. After this patch, arm64/sh/s390 can simply use the general dummy version. PowerPC/x86/ia64 will still use their specific version. Signed-off-by: Jia He

[PATCH v3 2/6] arm64/mm: use default dummy memory_add_physaddr_to_nid()

2020-07-08 Thread Jia He
After making default memory_add_physaddr_to_nid() in mm/memory_hotplug, it is no use defining a similar one in arch specific directory. Signed-off-by: Jia He --- arch/arm64/mm/numa.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c index

[PATCH v3 3/6] sh/mm: use default dummy memory_add_physaddr_to_nid()

2020-07-08 Thread Jia He
After making default memory_add_physaddr_to_nid in mm/memory_hotplug, there is no use to define a similar one in arch specific directory. Signed-off-by: Jia He --- arch/sh/mm/init.c | 9 - 1 file changed, 9 deletions(-) diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index

[PATCH v3 0/6] Fix and enable pmem as RAM device on arm64

2020-07-08 Thread Jia He
hotplug_begin/done patch v1: https://lkml.org/lkml/2020/7/5/381 Jia He (6): mm/memory_hotplug: introduce default dummy memory_add_physaddr_to_nid() arm64/mm: use default dummy memory_add_physaddr_to_nid() sh/mm: use default dummy memory_add_physaddr_to_nid() mm:

[PATCH v2 0/3] Fix and enable pmem as RAM device on arm64

2020-07-07 Thread Jia He
to harden try_offline_node - Use new solution(by David) to fix dev->target_node=-1 during probing - Refine the mem_hotplug_begin/done patch v1: https://lkml.org/lkml/2020/7/5/381 Jia He (3): arm64/numa: export memory_add_physaddr_to_nid as EXPORT_SYMBOL_GPL device-dax: use fallback nid w

[RFC PATCH v2 2/3] device-dax: use fallback nid when numa_node is invalid

2020-07-07 Thread Jia He
led with error -22 This fixes it by using fallback memory_add_physaddr_to_nid() as nid. Suggested-by: David Hildenbrand Signed-off-by: Jia He --- I noticed that on powerpc memory_add_physaddr_to_nid is not exported for module driver. Set it to RFC due to this concern. drivers/dax/kmem.c |

[PATCH v2 1/3] arm64/numa: export memory_add_physaddr_to_nid as EXPORT_SYMBOL_GPL

2020-07-07 Thread Jia He
This exports memory_add_physaddr_to_nid() for module driver to use. memory_add_physaddr_to_nid() is a fallback option to get the nid in case NUMA_NO_NID is detected. Suggested-by: David Hildenbrand Signed-off-by: Jia He --- arch/arm64/mm/numa.c | 5 +++-- 1 file changed, 3 insertions(+), 2

[PATCH v2 3/3] mm/memory_hotplug: fix unpaired mem_hotplug_begin/done

2020-07-06 Thread Jia He
device_release_driver_internal+0x100/0x1c0 driver_detach+0x4c/0x8f bus_remove_driver+0x5c/0xd0 driver_unregister+0x31/0x50 dax_pmem_exit+0x10/0xfe0 [dax_pmem] Fixes: f1037ec0cc8a ("mm/memory_hotplug: fix remove_memory() lockdep splat") Cc: sta...@vger.kernel.org # v5.6+ Signed-off-

[PATCH 3/3] mm/memory_hotplug: fix unpaired mem_hotplug_begin/done

2020-07-05 Thread Jia He
device_release_driver_internal+0x100/0x1c0 driver_detach+0x4c/0x8f bus_remove_driver+0x5c/0xd0 driver_unregister+0x31/0x50 dax_pmem_exit+0x10/0xfe0 [dax_pmem] This fixes it by moving mem_hotplug_done ahead of "done" Signed-off-by: Jia He --- mm/memory_hotplug.c | 2 +- 1 file changed, 1

[PATCH 0/3] Fix and enable pmem as RAM on arm64

2020-07-05 Thread Jia He
This fix a few issues when I tried to enable pmem as RAM device on arm64. Tested on ThunderX2 host/qemu "-M virt" guest. Jia He (3): arm64/numa: set numa_off to false when numa node is fake mm/memory_hotplug: harden try_offline_node against bogus nid mm/memory_hotplug: fi

[PATCH 1/3] arm64/numa: set numa_off to false when numa node is fake

2020-07-05 Thread Jia He
. Signed-off-by: Jia He --- arch/arm64/mm/numa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c index aafcee3e3f7e..7689986020d9 100644 --- a/arch/arm64/mm/numa.c +++ b/arch/arm64/mm/numa.c @@ -440,7 +440,8 @@ static int __init

[PATCH 2/3] mm/memory_hotplug: harden try_offline_node against bogus nid

2020-07-05 Thread Jia He
to numa_off, it is worth hardening the codes in try_offline_node(), quiting if !pgdat. Signed-off-by: Jia He --- mm/memory_hotplug.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index da374cd3d45b..e1e290577b45 100644 --- a/mm/memory_hotplug.c +++ b/mm

[PATCH v5] virtio_vsock: Fix race condition in virtio_transport_recv_pkt

2020-05-30 Thread Jia He
eck the data structure member "sk_shutdown" (suggested by Stefano) after a call of the function "lock_sock" since this field is set to "SHUTDOWN_MASK" under the protection of "lock_sock_nested". Fixes: 06a8fc78367d ("VSOCK: Introduce virtio_vsock_common.

[PATCH] virtio_vsock: Fix race condition in virtio_transport_recv_pkt

2020-05-30 Thread Jia He
eck the data structure member “sk_shutdown” (suggested by Stefano) after a call of the function “lock_sock” since this field is set to “SHUTDOWN_MASK” under the protection of “lock_sock_nested”. Fixes: 06a8fc78367d ("VSOCK: Introduce virtio_vsock_common.ko") Signed-off-by: Jia He Cc: sta

[PATCH v3] virtio_vsock: Fix race condition in virtio_transport_recv_pkt

2020-05-29 Thread Jia He
This fixes it by checking sk->sk_shutdown(suggested by Stefano) after lock_sock since sk->sk_shutdown is set to SHUTDOWN_MASK under the protection of lock_sock_nested. Signed-off-by: Jia He Cc: sta...@vger.kernel.org Reviewed-by: Stefano Garzarella --- v3: - describe the fix of race condition more cl

[PATCH v2] virtio_vsock: Fix race condition in virtio_transport_recv_pkt

2020-05-29 Thread Jia He
k_sock(). If there is __vsock_release() in another task, sk->sk_socket will be set to NULL inadvertently. This fixes it by checking sk->sk_shutdown. Signed-off-by: Jia He Cc: sta...@vger.kernel.org Cc: Stefano Garzarella --- v2: use lightweight checking suggested by Stefano Garzarella n

[PATCH] virtio_vsock: Fix race condition in virtio_transport_recv_pkt

2020-05-29 Thread Jia He
virtio_transport_recv_connecting sk->sk_socket->state (panic) This fixes it by checking vsk again whether it is in bound/connected table. Signed-off-by: Jia He Cc: sta...@vger.kernel.org --- net/vmw

Re: [PATCH V3 0/3] arm64: Enable vmemmap mapping from device memory

2020-05-21 Thread Jia He
to no fully support on arm64 qemu yet - Host nvdimm device hotplug Hence from above result, Tested-by: Jia He This series applies after latest (v14) arm64 memory hot remove series (https://lkml.org/lkml/2020/3/3/1746) on Linux 5.6. Pending Question: altmap_alloc_block_buf() does not have any other

[PATCH v2] vhost: vsock: kick send_pkt worker once device is started

2020-04-30 Thread Jia He
h vsock enabled) boot time is reduced from 3s to 1s on a ThunderX2 arm64 server. [1] https://github.com/kata-containers/runtime/issues/1917 Reported-by: Ning Bo Suggested-by: Stefano Garzarella Signed-off-by: Jia He --- v2: new solution suggested by Stefano Garzarella drivers/vhost/vsoc

[PATCH] vhost: add mutex_lock/unlock for vhost_vq_reset

2020-04-29 Thread Jia He
vq->mutex is to protect any vq accessing, hence adding mutex_lock/unlock makes sense to avoid potential race condition. Signed-off-by: Jia He --- drivers/vhost/vhost.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index d450e16c5

[PATCH] vhost: vsock: don't send pkt when vq is not started

2020-04-29 Thread Jia He
from 3s to 1s on ThunderX2 arm64 server. [1] https://github.com/kata-containers/runtime/issues/1917 Reported-by: Ning Bo Signed-off-by: Jia He --- drivers/vhost/vsock.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index e36aaf

Re: [PATCH v10 3/3] mm: fix double page fault on arm64 if PTE_AF is cleared

2019-10-18 Thread Jia He
:19:05AM +, Justin He (Arm Technology China) wrote: > > > On Mon, Sep 30, 2019 at 09:57:40AM +0800, Jia He wrote: > > > > diff --git a/mm/memory.c b/mm/memory.c > > > > index b1ca51a079f2..1f56b0118ef5 100644 > > > > --- a/mm/memory.c > >

[PATCH v12 3/4] x86/mm: implement arch_faults_on_old_pte() stub on x86

2019-10-11 Thread Jia He
arch_faults_on_old_pte is a helper to indicate that it might cause page fault when accessing old pte. But on x86, there is feature to setting pte access flag by hardware. Hence implement an overriding stub which always returns false. Signed-off-by: Jia He Suggested-by: Will Deacon --- arch/x86

[PATCH v12 0/4] fix double page fault in cow_user_page for pfn mapping

2019-10-11 Thread Jia He
me fix kbuild test failed v4: introduce cpu_has_hw_af (Suzuki) bail out if !pte_same (Kirill) v3: add vmf->ptl lock/unlock (Kirill A. Shutemov) add arch_faults_on_old_pte (Matthew, Catalin) v2: remove FAULT_FLAG_WRITE when setting pte access flag (Catalin) Jia He (4): arm64: cpufeatu

[PATCH v12 4/4] mm: fix double page fault on arm64 if PTE_AF is cleared

2019-10-11 Thread Jia He
rill). [1] https://github.com/pmem/pmdk/tree/master/src/test/vmmalloc_fork Signed-off-by: Jia He Reported-by: Yibo Cai Reviewed-by: Catalin Marinas Acked-by: Kirill A. Shutemov --- mm/memory.c | 104 1 file changed, 89 insertions(+), 15

[PATCH v12 2/4] arm64: mm: implement arch_faults_on_old_pte() on arm64

2019-10-11 Thread Jia He
on arm64 to indicate that it might cause page fault when accessing old pte. Signed-off-by: Jia He Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/pgtable.h | 14 ++ 1 file changed, 14 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h

[PATCH v12 1/4] arm64: cpufeature: introduce helper cpu_has_hw_af()

2019-10-11 Thread Jia He
on this path, we can turn it into a static label as with other CPU features. Signed-off-by: Jia He Suggested-by: Suzuki Poulose Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/cpufeature.h | 14 ++ 1 file changed, 14 insertions(+) diff --git a/arch/arm64/include/asm/cpufeature.h b

[PATCH v11 3/4] x86/mm: implement arch_faults_on_old_pte() stub on x86

2019-10-09 Thread Jia He
arch_faults_on_old_pte is a helper to indicate that it might cause page fault when accessing old pte. But on x86, there is feature to setting pte access flag by hardware. Hence implement an overriding stub which always returns false. Signed-off-by: Jia He Suggested-by: Will Deacon --- arch/x86

[PATCH v11 2/4] arm64: mm: implement arch_faults_on_old_pte() on arm64

2019-10-09 Thread Jia He
on arm64 to indicate that it might cause page fault when accessing old pte. Signed-off-by: Jia He Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/pgtable.h | 14 ++ 1 file changed, 14 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h

[PATCH v11 4/4] mm: fix double page fault on arm64 if PTE_AF is cleared

2019-10-09 Thread Jia He
rill). [1] https://github.com/pmem/pmdk/tree/master/src/test/vmmalloc_fork Signed-off-by: Jia He Reported-by: Yibo Cai Reviewed-by: Catalin Marinas Acked-by: Kirill A. Shutemov --- mm/memory.c | 104 1 file changed, 89 insertions(+), 15

[PATCH v11 1/4] arm64: cpufeature: introduce helper cpu_has_hw_af()

2019-10-09 Thread Jia He
We unconditionally set the HW_AFDBM capability and only enable it on CPUs which really have the feature. But sometimes we need to know whether this cpu has the capability of HW AF. So decouple AF from DBM by a new helper cpu_has_hw_af(). Signed-off-by: Jia He Suggested-by: Suzuki Poulose

[PATCH v11 0/4] fix double page fault in cow_user_page for pfn mapping

2019-10-09 Thread Jia He
3: add vmf->ptl lock/unlock (Kirill A. Shutemov) add arch_faults_on_old_pte (Matthew, Catalin) v2: remove FAULT_FLAG_WRITE when setting pte access flag (Catalin) Jia He (4): arm64: cpufeature: introduce helper cpu_has_hw_af() arm64: mm: implement arch_faults_on_old_pte() on arm64 x86/

Re: [PATCH v10 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af()

2019-10-09 Thread Jia He
China) Subject: Re: [PATCH v10 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af() On Tue, 1 Oct 2019 13:54:47 +0100 Will Deacon wrote: On Mon, Sep 30, 2019 at 09:57:38AM +0800, Jia He wrote: We unconditionally set the HW_AFDBM capability and only enable it on CPUs which really have

[PATCH v10 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af()

2019-09-29 Thread Jia He
We unconditionally set the HW_AFDBM capability and only enable it on CPUs which really have the feature. But sometimes we need to know whether this cpu has the capability of HW AF. So decouple AF from DBM by new helper cpu_has_hw_af(). Signed-off-by: Jia He Suggested-by: Suzuki Poulose Reviewed

[PATCH v10 2/3] arm64: mm: implement arch_faults_on_old_pte() on arm64

2019-09-29 Thread Jia He
on arm64 to indicate that it might cause page fault when accessing old pte. Signed-off-by: Jia He Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/pgtable.h | 14 ++ 1 file changed, 14 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h

[PATCH v10 0/3] fix double page fault on arm64

2019-09-29 Thread Jia He
fix kbuild test failed v4: introduce cpu_has_hw_af (Suzuki) bail out if !pte_same (Kirill) v3: add vmf->ptl lock/unlock (Kirill A. Shutemov) add arch_faults_on_old_pte (Matthew, Catalin) v2: remove FAULT_FLAG_WRITE when setting pte access flag (Catalin) Jia He (3): arm64: cpufeatu

[PATCH v10 3/3] mm: fix double page fault on arm64 if PTE_AF is cleared

2019-09-29 Thread Jia He
vmf should be passed to cow_user_page() Add a WARN_ON_ONCE when __copy_from_user_inatomic() returns error in case there can be some obscure use-case.(by Kirill) [1] https://github.com/pmem/pmdk/tree/master/src/test/vmmalloc_fork Signed-off-by: Jia He Reported-by: Yibo Cai Reviewed-by: Catalin Mari

[PATCH v9 2/3] arm64: mm: implement arch_faults_on_old_pte() on arm64

2019-09-24 Thread Jia He
on arm64 to indicate that it might cause page fault when accessing old pte. Signed-off-by: Jia He Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/pgtable.h | 14 ++ 1 file changed, 14 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h

[PATCH v9 3/3] mm: fix double page fault on arm64 if PTE_AF is cleared

2019-09-24 Thread Jia He
vmf should be passed to cow_user_page() Add a WARN_ON_ONCE when __copy_from_user_inatomic() returns error in case there can be some obscure use-case.(by Kirill) [1] https://github.com/pmem/pmdk/tree/master/src/test/vmmalloc_fork Signed-off-by: Jia He Reported-by: Yibo Cai --- mm/mem

[PATCH v9 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af()

2019-09-24 Thread Jia He
We unconditionally set the HW_AFDBM capability and only enable it on CPUs which really have the feature. But sometimes we need to know whether this cpu has the capability of HW AF. So decouple AF from DBM by new helper cpu_has_hw_af(). Signed-off-by: Jia He Suggested-by: Suzuki Poulose Reported

[PATCH v9 0/3] fix double page fault on arm64

2019-09-24 Thread Jia He
3: add vmf->ptl lock/unlock (Kirill A. Shutemov) add arch_faults_on_old_pte (Matthew, Catalin) v2: remove FAULT_FLAG_WRITE when setting pte access flag (Catalin) Jia He (3): arm64: cpufeature: introduce helper cpu_has_hw_af() arm64: mm: implement arch_faults_on_old_pte() on arm64 m

Re: [PATCH v8 3/3] mm: fix double page fault on arm64 if PTE_AF is cleared

2019-09-24 Thread Jia He
Hi Catalin On 2019/9/24 18:33, Catalin Marinas wrote: On Tue, Sep 24, 2019 at 06:43:06AM +, Justin He (Arm Technology China) wrote: Catalin Marinas wrote: On Sat, Sep 21, 2019 at 09:50:54PM +0800, Jia He wrote: @@ -2151,21 +2163,53 @@ static inline void cow_user_page(struct page *dst

[PATCH v8 3/3] mm: fix double page fault on arm64 if PTE_AF is cleared

2019-09-21 Thread Jia He
vmf should be passed to cow_user_page() Add a WARN_ON_ONCE when __copy_from_user_inatomic() returns error in case there can be some obscure use-case.(by Kirill) [1] https://github.com/pmem/pmdk/tree/master/src/test/vmmalloc_fork Reported-by: Yibo Cai Signed-off-by: Jia He --- mm/mem

[PATCH v8 0/3] fix double page fault on arm64

2019-09-21 Thread Jia He
, Catalin) v2: remove FAULT_FLAG_WRITE when setting pte access flag (Catalin) Jia He (3): arm64: cpufeature: introduce helper cpu_has_hw_af() arm64: mm: implement arch_faults_on_old_pte() on arm64 mm: fix double page fault on arm64 if PTE_AF is cleared arch/arm64/include/asm/cpufeature.h | 10

[PATCH v8 2/3] arm64: mm: implement arch_faults_on_old_pte() on arm64

2019-09-21 Thread Jia He
on arm64 to indicate that it might cause page fault when accessing old pte. Signed-off-by: Jia He --- arch/arm64/include/asm/pgtable.h | 12 1 file changed, 12 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index e09760ece844..4a9939615e41

[PATCH v8 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af()

2019-09-21 Thread Jia He
Signed-off-by: Jia He --- arch/arm64/include/asm/cpufeature.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index c96ffa4722d3..46caf934ba4e 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch

Re: [PATCH v7 3/3] mm: fix double page fault on arm64 if PTE_AF is cleared

2019-09-21 Thread Jia He
[On behalf of justin...@arm.com] Hi Matthew On 2019/9/20 23:53, Matthew Wilcox wrote: On Fri, Sep 20, 2019 at 09:54:37PM +0800, Jia He wrote: -static inline void cow_user_page(struct page *dst, struct page *src, unsigned long va, struct vm_area_struct *vma) +static inline int cow_user_page

[PATCH v7 0/3] fix double page fault on arm64

2019-09-20 Thread Jia He
e access flag (Catalin) Jia He (3): arm64: cpufeature: introduce helper cpu_has_hw_af() arm64: mm: implement arch_faults_on_old_pte() on arm64 mm: fix double page fault on arm64 if PTE_AF is cleared arch/arm64/include/asm/cpufeature.h | 10 + arch/arm64/include/asm/pgtable.h|

[PATCH v7 3/3] mm: fix double page fault on arm64 if PTE_AF is cleared

2019-09-20 Thread Jia He
vmf should be passed to cow_user_page() Add a WARN_ON_ONCE when __copy_from_user_inatomic() returns error in case there can be some obscure use-case.(by Kirill) [1] https://github.com/pmem/pmdk/tree/master/src/test/vmmalloc_fork Reported-by: Yibo Cai Signed-off-by: Jia He --- mm/mem

[PATCH v7 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af()

2019-09-20 Thread Jia He
Signed-off-by: Jia He --- arch/arm64/include/asm/cpufeature.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index c96ffa4722d3..46caf934ba4e 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch

[PATCH v7 2/3] arm64: mm: implement arch_faults_on_old_pte() on arm64

2019-09-20 Thread Jia He
on arm64 to indicate that it might cause page fault when accessing old pte. Signed-off-by: Jia He --- arch/arm64/include/asm/pgtable.h | 12 1 file changed, 12 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index e09760ece844..4a9939615e41

[PATCH v6 3/3] mm: fix double page fault on arm64 if PTE_AF is cleared

2019-09-19 Thread Jia He
vmf should be passed to cow_user_page() Add a WARN_ON_ONCE when __copy_from_user_inatomic() returns error in case there can be some obscure use-case.(by Kirill) [1] https://github.com/pmem/pmdk/tree/master/src/test/vmmalloc_fork Reported-by: Yibo Cai Signed-off-by: Jia He --- mm/mem

[PATCH v6 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af()

2019-09-19 Thread Jia He
Signed-off-by: Jia He --- arch/arm64/include/asm/cpufeature.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index c96ffa4722d3..46caf934ba4e 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch

[PATCH v6 0/3] fix double page fault on arm64

2019-09-19 Thread Jia He
!pte_same fix kbuild test failed v4: introduce cpu_has_hw_af (Suzuki) bail out if !pte_same (Kirill) v3: add vmf->ptl lock/unlock (Kirill A. Shutemov) add arch_faults_on_old_pte (Matthew, Catalin) v2: remove FAULT_FLAG_WRITE when setting pte access flag (Catalin) Jia He (3): arm6

[PATCH v6 2/3] arm64: mm: implement arch_faults_on_old_pte() on arm64

2019-09-19 Thread Jia He
on arm64 to indicate that it might cause page fault when accessing old pte. Signed-off-by: Jia He --- arch/arm64/include/asm/pgtable.h | 12 1 file changed, 12 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index e09760ece844..4a9939615e41

[PATCH v5 2/3] arm64: mm: implement arch_faults_on_old_pte() on arm64

2019-09-19 Thread Jia He
on arm64 to indicate that it might cause page fault when accessing old pte. Signed-off-by: Jia He --- arch/arm64/include/asm/pgtable.h | 12 1 file changed, 12 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index e09760ece844..4a9939615e41

[PATCH v5 3/3] mm: fix double page fault on arm64 if PTE_AF is cleared

2019-09-19 Thread Jia He
vmf should be passed to cow_user_page() Add a WARN_ON_ONCE when __copy_from_user_inatomic() returns error in case there can be some obscure use-case.(by Kirill) [1] https://github.com/pmem/pmdk/tree/master/src/test/vmmalloc_fork Reported-by: Yibo Cai Signed-off-by: Jia He --- mm/mem

[PATCH v5 0/3] fix double page fault on arm64

2019-09-19 Thread Jia He
->ptl lock/unlock (by Kirill A. Shutemov) add arch_faults_on_old_pte (Matthew, Catalin) v2: remove FAULT_FLAG_WRITE when setting pte access flag (by Catalin) Jia He (3): arm64: cpufeature: introduce helper cpu_has_hw_af() arm64: mm: implement arch_faults_on_old_pte() on arm64 mm: fi

[PATCH v5 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af()

2019-09-19 Thread Jia He
Signed-off-by: Jia He --- arch/arm64/include/asm/cpufeature.h | 1 + arch/arm64/kernel/cpufeature.c | 10 ++ 2 files changed, 11 insertions(+) diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index c96ffa4722d3..206b6e3954cf 100644 --- a/arch

Re: [PATCH v4 3/3] mm: fix double page fault on arm64 if PTE_AF is cleared

2019-09-18 Thread Jia He
Hi Kirill [On behalf of justin...@arm.com because some mails are filted...] On 2019/9/18 22:00, Kirill A. Shutemov wrote: On Wed, Sep 18, 2019 at 09:19:14PM +0800, Jia He wrote: When we tested pmdk unit test [1] vmmalloc_fork TEST1 in arm64 guest, there will be a double page fault

[PATCH v4 3/3] mm: fix double page fault on arm64 if PTE_AF is cleared

2019-09-18 Thread Jia He
vmf should be passed to cow_user_page() [1] https://github.com/pmem/pmdk/tree/master/src/test/vmmalloc_fork Reported-by: Yibo Cai Signed-off-by: Jia He --- mm/memory.c | 35 ++- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/mm/memory.c b/mm/memo

[PATCH v4 2/3] arm64: mm: implement arch_faults_on_old_pte() on arm64

2019-09-18 Thread Jia He
on arm64 to indicate that it might cause page fault when accessing old pte. Signed-off-by: Jia He --- arch/arm64/include/asm/pgtable.h | 12 1 file changed, 12 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index e09760ece844..4a9939615e41

[PATCH v4 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af()

2019-09-18 Thread Jia He
We unconditionally set the HW_AFDBM capability and only enable it on CPUs which really have the feature. But sometimes we need to know whether this cpu has the capability of HW AF. So decouple AF from DBM by new helper cpu_has_hw_af(). Signed-off-by: Jia He Suggested-by: Suzuki Poulose

[PATCH v4 0/3] fix double page fault on arm64

2019-09-18 Thread Jia He
_pte (Matthew, Catalin) v2: remove FAULT_FLAG_WRITE when setting pte access flag (by Catalin) Jia He (3): arm64: cpufeature: introduce helper cpu_has_hw_af() arm64: mm: implement arch_faults_on_old_pte() on arm64 mm: fix double page fault on arm64 if PTE_AF is cleared arch/arm64/include/asm

[PATCH v3 1/2] arm64: mm: implement arch_faults_on_old_pte() on arm64

2019-09-13 Thread Jia He
on arm64 to indicate that it might cause page fault when accessing old pte. Signed-off-by: Jia He --- arch/arm64/include/asm/pgtable.h | 12 1 file changed, 12 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index e09760ece844..b41399d758df

[PATCH v3 2/2] mm: fix double page fault on arm64 if PTE_AF is cleared

2019-09-13 Thread Jia He
vmf should be passed to cow_user_page() [1] https://github.com/pmem/pmdk/tree/master/src/test/vmmalloc_fork Reported-by: Yibo Cai Signed-off-by: Jia He --- mm/memory.c | 30 +- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/mm/memory.c b/mm/memo

[PATCH v3 0/2] fix double page fault on arm64

2019-09-13 Thread Jia He
e access flag (by Catalin) Jia He (2): arm64: mm: implement arch_faults_on_old_pte() on arm64 mm: fix double page fault on arm64 if PTE_AF is cleared arch/arm64/include/asm/pgtable.h | 11 +++ mm/memory.c | 29 - 2 files changed, 35 ins

[PATCH v2] mm: fix double page fault on arm64 if PTE_AF is cleared

2019-09-06 Thread Jia He
vmf should be passed to cow_user_page() [1] https://github.com/pmem/pmdk/tree/master/src/test/vmmalloc_fork Reported-by: Yibo Cai Signed-off-by: Jia He --- Changes v2: remove FAULT_FLAG_WRITE when setting pte access flag (by Catalin) mm/memory.c | 21 - 1 file changed, 16

[PATCH] mm: fix double page fault on arm64 if PTE_AF is cleared

2019-09-03 Thread Jia He
. This patch fix it by calling pte_mkyoung. Also, the parameter is changed because vmf should be passed to cow_user_page() [1] https://github.com/pmem/pmdk/tree/master/src/test/vmmalloc_fork Reported-by: Yibo Cai Signed-off-by: Jia He --- mm/memory.c | 21 - 1 file changed, 16

[PATCH 0/2] Fix and support dax kmem on arm64

2019-08-16 Thread Jia He
This patch set is to fix some dax kmem driver issues and then it can support to use pmem as normal RAM in arm64 qemu guest. Jia He (2): drivers/dax/kmem: use default numa_mem_id if target_node is invalid drivers/dax/kmem: give a warning if CONFIG_DEV_DAX_PMEM_COMPAT is enabled drivers

[PATCH 2/2] drivers/dax/kmem: give a warning if CONFIG_DEV_DAX_PMEM_COMPAT is enabled

2019-08-16 Thread Jia He
/device_dax/unbind -bash: echo: write error: No such device This gives a warning to notify the user. Signed-off-by: Jia He --- drivers/dax/kmem.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c index ad62d551d94e..b77f0e880598 100644 --- a/drivers/dax/kmem

[PATCH 1/2] drivers/dax/kmem: use default numa_mem_id if target_node is invalid

2019-08-16 Thread Jia He
with it. Signed-off-by: Jia He --- drivers/dax/kmem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c index a02318c6d28a..ad62d551d94e 100644 --- a/drivers/dax/kmem.c +++ b/drivers/dax/kmem.c @@ -33,9 +33,9 @@ int dev_dax_kmem_probe(struct

[PATCH 1/2] vsprintf: Prevent crash when dereferencing invalid pointers for %pD

2019-08-08 Thread Jia He
n cause crash. This patch fixes it with introducing a new file_dentry_name. Signed-off-by: Jia He --- lib/vsprintf.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 63937044c57d..b4a119176fdb 100644 --- a/lib/vsprintf.c +++ b/l

[PATCH 2/2] lib/test_printf: add test of null/invalid pointer dereference for dentry

2019-08-08 Thread Jia He
This add some additional test cases of null/invalid pointer dereference for dentry and file (%pd and %pD) Signed-off-by: Jia He --- lib/test_printf.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/lib/test_printf.c b/lib/test_printf.c index 944eb50f3862..befedffeb476 100644

[PATCH] arm64: mm: add missing PTE_SPECIAL in pte_mkdevmap on arm64

2019-08-06 Thread Jia He
u mount with '-o dax'?\n"); return 1; } memset(addr, 0x55, 4096); if (munmap(addr, 4096) == -1) { perror("munmap"); return 1; } close(fd); return 0; } Fixes: 73b20c84d42d ("arm64: mm: implement pte_devmap support") Repo

Re: [RFC PATCH v2 2/3] arm64: mark all the GICC nodes in MADT as possible cpu

2019-07-04 Thread Jia He
) { + for_each_online_cpu(i) { Have you considered the case in non-acpi mode? and setting "maxcpus=n" in host kernel boot parameters? --- Cheers, Justin (Jia He) struct cpu *cpu = _cpu(cpu_data.cpu, i); cpu->hotpluggable = 1; regist

Re: [PATCH RFC 0/3] Support CPU hotplug for ARM64

2019-07-04 Thread Jia He
Hi Xiongfeng Sorry, I missed your latter mail, you used a emulated SCI interrupt --- Cheers, Justin (Jia He) On 2019/7/4 11:26, Xiongfeng Wang wrote: Hi Justin, On 2019/7/4 11:00, Jia He wrote: Hi Xiongfeng It is a little bit awkful that I am also  investigating acpi based cpu hotplug

Re: [PATCH RFC 0/3] Support CPU hotplug for ARM64

2019-07-03 Thread Jia He
Hi Xiongfeng On 2019/7/4 11:26, Xiongfeng Wang wrote: Hi Justin, On 2019/7/4 11:00, Jia He wrote: Hi Xiongfeng It is a little bit awkful that I am also  investigating acpi based cpu hotplug issue silimar with your idea. My question is your purpose to implement the vcpu hotplug in arm64

Re: [PATCH RFC 0/3] Support CPU hotplug for ARM64

2019-07-03 Thread Jia He
Hi Xiongfeng It is a little bit awkful that I am also  investigating acpi based cpu hotplug issue silimar with your idea. My question is your purpose to implement the vcpu hotplug in arm64 qemu? Thanks for the ellaboration --- Cheers, Justin (Jia He) On 2019/6/28 19:13, Xiongfeng Wang

Re: [PATCH v11 0/3] remain and optimize memblock_next_valid_pfn on arm and arm64

2019-06-11 Thread Jia He
(), and leading to this similar solution form Jia He, so I would like to bring this thread back, please see my detail test result below. On 2018/9/7 22:44, Will Deacon wrote: On Thu, Sep 06, 2018 at 01:24:22PM +0200, Ard Biesheuvel wrote: On 22 August 2018 at 05:07, Jia He wrote: Commit

  1   2   3   4   5   6   7   >