[PATCH RFC v1 0/6] swiotlb: 64-bit DMA buffer

2021-02-03 Thread Dongli Zhang
vm# cat /sys/kernel/debug/swiotlb/io_tlb_nslabs 65536 vm# cat /sys/kernel/debug/swiotlb/io_tlb_used 0 vm# cat /sys/kernel/debug/swiotlb/io_tlb_nslabs-highmem 1048576 vm# cat /sys/kernel/debug/swiotlb/io_tlb_used-highmem 64647 Please let me know if there is any feedback for this idea and RFC. Don

[PATCH RFC v1 3/6] swiotlb: introduce swiotlb_get_type() to calculate swiotlb buffer type

2021-02-03 Thread Dongli Zhang
This patch introduces swiotlb_get_type() in order to calculate which swiotlb buffer the given DMA address is belong to. This is to prepare to enable 64-bit swiotlb. Cc: Joe Jin Signed-off-by: Dongli Zhang --- include/linux/swiotlb.h | 14 ++ kernel/dma/swiotlb.c| 2 ++ 2

[PATCH RFC v1 2/6] swiotlb: convert variables to arrays

2021-02-03 Thread Dongli Zhang
- no_iotlb_memory There is no functional change and this is to prepare to enable 64-bit swiotlb. Cc: Joe Jin Signed-off-by: Dongli Zhang --- arch/powerpc/platforms/pseries/svm.c | 6 +- drivers/xen/swiotlb-xen.c| 4 +- include/linux/swiotlb.h | 5 +- kernel/dma/swiotlb.c

[PATCH RFC v1 4/6] swiotlb: enable 64-bit swiotlb

2021-02-03 Thread Dongli Zhang
el will be able to allocate >4GB swiotlb buffer. This patch is only for swiotlb, not including xen-swiotlb. Cc: Joe Jin Signed-off-by: Dongli Zhang --- arch/mips/cavium-octeon/dma-octeon.c | 3 +- arch/powerpc/kernel/dma-swiotlb.c| 2 +- arch/powerpc/platforms/pseries/svm.

[PATCH RFC v1 5/6] xen-swiotlb: convert variables to arrays

2021-02-03 Thread Dongli Zhang
enable 64-bit xen-swiotlb. Cc: Joe Jin Signed-off-by: Dongli Zhang --- drivers/xen/swiotlb-xen.c | 75 +-- 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 662638093542..e18cae693cdc 100644

[PATCH RFC v1 6/6] xen-swiotlb: enable 64-bit xen-swiotlb

2021-02-03 Thread Dongli Zhang
This patch is to enable the 64-bit xen-swiotlb buffer. For Xen PVM DMA address, the 64-bit device will be able to allocate from 64-bit swiotlb buffer. Cc: Joe Jin Signed-off-by: Dongli Zhang --- drivers/xen/swiotlb-xen.c | 117 -- 1 file changed, 74

[PATCH 1/1] xen/blkfront: fix comment for need_copy

2022-03-17 Thread Dongli Zhang
The 'need_copy' is set when rq_data_dir(req) returns WRITE, in order to copy the written data to persistent page. ".need_copy = rq_data_dir(req) && info->feature_persistent," Signed-off-by: Dongli Zhang --- drivers/block/xen-blkfront.c | 2 +- 1 file chan

Re: [PATCH 12/15] swiotlb: provide swiotlb_init variants that remap the buffer

2022-04-04 Thread Dongli Zhang
; > nslabs = SLABS_PER_PAGE << order; > bytes = nslabs << IO_TLB_SHIFT; > @@ -323,6 +343,16 @@ int swiotlb_init_late(size_t size, gfp_t gfp_mask) > (PAGE_SIZE << order) >> 20); > nslabs = SLABS_PER_PAGE <<

[PATCH 0/2] Fix the Xen HVM kdump/kexec boot panic issue

2021-10-12 Thread Dongli Zhang
read_mandatory: xenstore read failed: `/libxl/1/type': No such file or directory libxl: warning: libxl_dom.c:53:libxl__domain_type: unable to get domain type for domid=1, assuming HVM Thank you very much! Dongli Zhang

[PATCH xen 2/2] xen: update system time immediately when VCPUOP_register_vcpu_info

2021-10-12 Thread Dongli Zhang
drift at the VM side if the VM accesses the clocksource immediately after VCPUOP_register_vcpu_info(). Cc: Joe Jin Signed-off-by: Dongli Zhang --- xen/common/domain.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/common/domain.c b/xen/common/domain.c index 40d67ec342..c879f6723b 100644

[PATCH linux 1/2] xen: delay xen_hvm_init_time_ops() if kdump is boot on vcpu>=32

2021-10-12 Thread Dongli Zhang
boot vcpu is registered when the boot vcpu is >= 32. This issue can be reproduced on purpose via below command at the guest side when kdump/kexec is enabled: "taskset -c 33 echo c > /proc/sysrq-trigger" Cc: Joe Jin Signed-off-by: Dongli Zhang --- arch/x86/xen/enlighten_hvm

Re: [PATCH xen 2/2] xen: update system time immediately when VCPUOP_register_vcpu_info

2021-10-12 Thread Dongli Zhang
Hi Jan, On 10/12/21 1:40 AM, Jan Beulich wrote: > On 12.10.2021 09:24, Dongli Zhang wrote: >> The guest may access the pv vcpu_time_info immediately after >> VCPUOP_register_vcpu_info. This is to borrow the idea of >> VCPUOP_register_vcpu_time_m

Re: [PATCH 0/2] Fix the Xen HVM kdump/kexec boot panic issue

2021-10-12 Thread Dongli Zhang
Hi Juergen, On 10/12/21 1:47 AM, Juergen Gross wrote: > On 12.10.21 09:24, Dongli Zhang wrote: >> When the kdump/kexec is enabled at HVM VM side, to panic kernel will trap >> to xen side with reason=soft_reset. As a result, the xen will reboot the VM >> with the kdump kernel

Re: [PATCH xen 2/2] xen: update system time immediately when VCPUOP_register_vcpu_info

2021-10-12 Thread Dongli Zhang
Hi Jan, On 10/12/21 8:49 AM, Jan Beulich wrote: > On 12.10.2021 17:43, Dongli Zhang wrote: >> Hi Jan, >> >> On 10/12/21 1:40 AM, Jan Beulich wrote: >>> On 12.10.2021 09:24, Dongli Zhang wrote: >>>> The guest may access the pv vcpu_time_info immediately

[PATCH 1/1] xen/netfront: stop tx queues during live migration

2021-10-22 Thread Dongli Zhang
to access netfront_info->queues -> err = xennet_create_queues(info, &num_queues); The idea is borrowed from virtio-net. Cc: Joe Jin Signed-off-by: Dongli Zhang --- Since I am not able to reproduce the corner case on purpose, I create a patch to reproduce. https://raw.githubuserc

Re: [PATCH linux 1/2] xen: delay xen_hvm_init_time_ops() if kdump is boot on vcpu>=32

2021-10-24 Thread Dongli Zhang
Hi Boris, On 10/12/21 10:17 AM, Boris Ostrovsky wrote: > > On 10/12/21 3:24 AM, Dongli Zhang wrote: >> The sched_clock() can be used very early since upstream >> commit 857baa87b642 ("sched/clock: Enable sched clock early"). In addition, >> with upstream

[PATCH v2 1/1] xen: update system time immediately when VCPUOP_register_vcpu_info

2021-10-25 Thread Dongli Zhang
drift at the VM side if the VM accesses the clocksource immediately after VCPUOP_register_vcpu_info(). Reference: https://lists.xenproject.org/archives/html/xen-devel/2021-10/msg00571.html Cc: Joe Jin Signed-off-by: Dongli Zhang --- Changed since v1: - Implement force_update_vcpu_system_time() for

[PATCH v2 1/1] xen: delay xen_hvm_init_time_ops() if kdump is boot on vcpu>=32

2021-10-27 Thread Dongli Zhang
skset -c 33 echo c > /proc/sysrq-trigger" Reference: https://lists.xenproject.org/archives/html/xen-devel/2021-10/msg00571.html Cc: Joe Jin Signed-off-by: Dongli Zhang --- Changed since v1: - Add commit message to explain why xen_hvm_init_time_ops() is delayed for any vcp

Re: [PATCH v2 1/1] xen: delay xen_hvm_init_time_ops() if kdump is boot on vcpu>=32

2021-11-04 Thread Dongli Zhang
Hi Boris, On 11/1/21 10:34 AM, Boris Ostrovsky wrote: > > On 10/27/21 9:25 PM, Dongli Zhang wrote: >> The sched_clock() can be used very early since >> commit 857baa87b642 ("sched/clock: Enable sched clock early"). In addition, >> with commit 38669ba205d1 (&qu

Re: [PATCH] cpu/hotplug: Allow the CPU in CPU_UP_PREPARE state to be brought up again.

2021-11-23 Thread Dongli Zhang
Tested-by: Dongli Zhang The bug fixed by commit 53fafdbb8b21 ("KVM: x86: switch KVMCLOCK base to monotonic raw clock") may leave the cpu_hotplug_state at CPU_UP_PREPARE. As a result, to online this CPU again (even after removal) is always failed. I have tested that this patch wor

Re: [PATCH] cpu/hotplug: Allow the CPU in CPU_UP_PREPARE state to be brought up again.

2021-11-23 Thread Dongli Zhang
On 11/23/21 3:50 PM, Longpeng (Mike, Cloud Infrastructure Service Product Dept.) wrote: > > >> -Original Message----- >> From: Dongli Zhang [mailto:dongli.zh...@oracle.com] >> Sent: Wednesday, November 24, 2021 5:22 AM >> To: Sebastian Andrzej S

[PATCH v3 0/1] xen: fix HVM kexec kernel panic

2022-02-24 Thread Dongli Zhang
img-5.17.0-rc4xen-00054-gf71077a4d84b-dirty \ --reuse-cmdline # kexec -e Thank you very much! Dongli Zhang

[PATCH v3 1/1] xen: delay xen_hvm_init_time_ops() to xen_hvm_smp_prepare_boot_cpu()

2022-02-24 Thread Dongli Zhang
only with HVM guest on old xen hypervisor where 'soft_reset' is working. The bugfix for PVM is not implemented due to the lack of testing environment. Cc: Joe Jin Signed-off-by: Dongli Zhang --- Changed since v1: - Add commit message to explain why xen_hvm_init_time_ops() is delayed

[BUG REPORT] soft_reset (kexec/kdump) does not work with mainline xen

2022-02-24 Thread Dongli Zhang
1077a4d84b-dirty --reuse-cmdline # kexec -e or # taskset -c 0 echo c > /proc/sysrq-trigger Thank you very much! Dongli Zhang

Re: [BUG REPORT] soft_reset (kexec/kdump) does not work with mainline xen

2022-02-25 Thread Dongli Zhang
Hi Jan, On 2/24/22 11:15 PM, Jan Beulich wrote: > On 24.02.2022 23:27, Dongli Zhang wrote: >> Hello, >> >> This is to report that the soft_reset (kexec/kdump) has not been working for >> me >> since long time ago. >> >> I have tested again with the

Re: [PATCH v3 0/1] xen: fix HVM kexec kernel panic

2022-02-25 Thread Dongli Zhang
Hi Boris, On 2/25/22 2:39 PM, Boris Ostrovsky wrote: > > On 2/24/22 4:50 PM, Dongli Zhang wrote: >> This is the v3 of the patch to fix xen kexec kernel panic issue when the >> kexec is triggered on VCPU >= 32. >> >> PANIC: early exception 0x0e IP 10:

Re: [PATCH v3 0/1] xen: fix HVM kexec kernel panic

2022-02-28 Thread Dongli Zhang
Hi Boris, On 2/28/22 12:45 PM, Boris Ostrovsky wrote: > > > On 2/25/22 8:17 PM, Dongli Zhang wrote: >> Hi Boris, >> >> On 2/25/22 2:39 PM, Boris Ostrovsky wrote: >>> >>> On 2/24/22 4:50 PM, Dongli Zhang wrote: >>>> This is the v3

Re: [PATCH v3 0/1] xen: fix HVM kexec kernel panic

2022-02-28 Thread Dongli Zhang
Hi Boris, On 2/28/22 5:18 PM, Dongli Zhang wrote: > Hi Boris, > > On 2/28/22 12:45 PM, Boris Ostrovsky wrote: >> >> >> On 2/25/22 8:17 PM, Dongli Zhang wrote: >>> Hi Boris, >>> >>> On 2/25/22 2:39 PM, Boris Ostrovsky wrote: >>>>

[PATCH v4 1/2] x86/xen/time: fix indentation issue

2022-03-02 Thread Dongli Zhang
No functional change. Signed-off-by: Dongli Zhang --- arch/x86/xen/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index d9c945ee1100..55b3407358a9 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c @@ -45,7 +45,7

[PATCH v4 0/2] xen: fix HVM kexec kernel panic

2022-03-02 Thread Dongli Zhang
works after I reset d->creation_reset as suggested by Jan Beulich. https://lore.kernel.org/all/d3814109-f4ba-9edb-1575-ab94faaeb...@suse.com/ Thank you very much! Dongli Zhang

[PATCH v4 2/2] xen: delay xen_hvm_init_time_ops() if kdump is boot on vcpu>=32

2022-03-02 Thread Dongli Zhang
istered when the boot vcpu is >= 32. This issue can be reproduced on purpose via below command at the guest side when kdump/kexec is enabled: "taskset -c 33 echo c > /proc/sysrq-trigger" The bugfix for PVM is not implemented due to the lack of testing environment. Cc: Joe Jin S

Re: [PATCH v4 2/2] xen: delay xen_hvm_init_time_ops() if kdump is boot on vcpu>=32

2022-03-02 Thread Dongli Zhang
Hi Boris, On 3/2/22 4:20 PM, Boris Ostrovsky wrote: > > On 3/2/22 11:40 AM, Dongli Zhang wrote: >>   void __init xen_hvm_init_time_ops(void) >>   { >> +    static bool hvm_time_initialized; >> + >> +    if (hvm_time_initialized) >> +    return; >&

Re: [PATCH v4 2/2] xen: delay xen_hvm_init_time_ops() if kdump is boot on vcpu>=32

2022-03-02 Thread Dongli Zhang
Hi Boris, On 3/2/22 6:11 PM, Boris Ostrovsky wrote: > > On 3/2/22 7:31 PM, Dongli Zhang wrote: >> Hi Boris, >> >> On 3/2/22 4:20 PM, Boris Ostrovsky wrote: >>> On 3/2/22 11:40 AM, Dongli Zhang wrote: >>>>    void __init xen_hvm_init_t

Re: [PATCH 10/12] swiotlb: add a SWIOTLB_ANY flag to lift the low memory restriction

2022-03-04 Thread Dongli Zhang
ted DMA patchset is going to supports 64-bit (or high memory) DMA. Is this what you are looking for? Dongli Zhang > > Michael > > [1] > https://urldefense.com/v3/__https://lore.kernel.org/lkml/20220209122302.213882-1-ltyker...@gmail.com/__;!!ACWV5N9M2RV99hQ!fUx4fMgdQIrqJDDy-pbv

[PATCH RFC v2 1/1] wiotlb: split buffer into 32-bit default and 64-bit extra zones

2022-08-20 Thread Dongli Zhang
extra 327552 Would you mind helping if this is the right direction to go? Thank you very much! Cc: Konrad Wilk Cc: Joe Jin Signed-off-by: Dongli Zhang --- arch/arm/xen/mm.c | 2 +- arch/mips/pci/pci-octeon.c | 5 +- arch/x86/include/asm/xen/swiot

Re: [PATCH RFC v1 4/7] swiotlb: to implement io_tlb_high_mem

2022-06-10 Thread Dongli Zhang
otice it is the default 'io_tlb_default_mem', but will not be able to know if it is allocated from 32-bit or 64-bit buffer. Thank you very much for the feedback. Dongli Zhang

[PATCH RFC 1/1] x86/paravirt: introduce param to disable pv sched_clock

2023-10-18 Thread Dongli Zhang
kport to old kernel version. References: [1] https://lore.kernel.org/all/20230926230649.67852-1-dongli.zh...@oracle.com/ [2] https://lore.kernel.org/all/20231018195638.1898375-1-sea...@google.com/ [3] https://lore.kernel.org/all/20231002211651.ga3...@noisy.programming.kicks-ass.net/ Thank you very mu

Re: [PATCH RFC 1/1] x86/paravirt: introduce param to disable pv sched_clock

2023-10-19 Thread Dongli Zhang
Hi Vitaly, Sean and David, On 10/19/23 08:40, Sean Christopherson wrote: > On Thu, Oct 19, 2023, Vitaly Kuznetsov wrote: >> Dongli Zhang writes: >> >>> As mentioned in the linux kernel development document, "sched_clock() is >>> used for scheduling and t

[PATCH RFC v1 5/7] swiotlb: add interface to set dev->dma_io_tlb_mem

2022-06-08 Thread Dongli Zhang
The interface re-configures dev->dma_io_tlb_mem conditionally, if the 'io_tlb_high_mem' is active. Cc: Konrad Wilk Cc: Joe Jin Signed-off-by: Dongli Zhang --- include/linux/swiotlb.h | 6 ++ kernel/dma/swiotlb.c| 10 ++ 2 files changed, 16 insertions(+) diff --

[PATCH RFC v1 2/7] swiotlb: change the signature of remap function

2022-06-08 Thread Dongli Zhang
Add new argument 'high' to remap function, so that it will be able to remap the swiotlb buffer based on whether the swiotlb is 32-bit or 64-bit. Currently the only remap function is xen_swiotlb_fixup(). Cc: Konrad Wilk Cc: Joe Jin Signed-off-by: Dongli Zhang --- arch/x86/inclu

[PATCH RFC v1 6/7] virtio: use io_tlb_high_mem if it is active

2022-06-08 Thread Dongli Zhang
When the swiotlb is enforced (e.g., when amd sev is involved), the virito driver will not be able to use 4+ GB memory. Therefore, the virtio driver uses 'io_tlb_high_mem' as swiotlb. Cc: Konrad Wilk Cc: Joe Jin Signed-off-by: Dongli Zhang --- drivers/virtio/virtio.c | 8 ++

[PATCH RFC v1 4/7] swiotlb: to implement io_tlb_high_mem

2022-06-08 Thread Dongli Zhang
em.nslabs) returns true. Cc: Konrad Wilk Cc: Joe Jin Signed-off-by: Dongli Zhang --- arch/powerpc/kernel/dma-swiotlb.c | 8 ++- arch/x86/kernel/pci-dma.c | 5 +- include/linux/swiotlb.h | 2 +- kernel/dma/swiotlb.c | 103 +- 4 file

[PATCH RFC v1 3/7] swiotlb-xen: support highmem for xen specific code

2022-06-08 Thread Dongli Zhang
Wilk Cc: Joe Jin Signed-off-by: Dongli Zhang --- drivers/xen/swiotlb-xen.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 339f46e21053..d15321e9f9db 100644 --- a/drivers/xen/swiotlb-xen.c +++ b

[PATCH RFC v1 7/7] swiotlb: fix the slot_addr() overflow

2022-06-08 Thread Dongli Zhang
n a value smaller than the expected one. As a result, the swiotlb_bounce() will access a wrong swiotlb slot. Cc: Konrad Wilk Cc: Joe Jin Signed-off-by: Dongli Zhang --- kernel/dma/swiotlb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/dma/swiotlb.c b/

[PATCH RFC v1 1/7] swiotlb: introduce the highmem swiotlb buffer

2022-06-08 Thread Dongli Zhang
mmand line "swiotlb=32768,3145728,force" is to allocate 64MB for default swiotlb, and 6GB for the extra highmem swiotlb. Cc: Konrad Wilk Cc: Joe Jin Signed-off-by: Dongli Zhang --- include/linux/swiotlb.h | 2 ++ kernel/dma/swiotlb.c| 16 2 files changed,

[PATCH RFC v1 0/7] swiotlb: extra 64-bit buffer for dev->dma_io_tlb_mem

2022-06-08 Thread Dongli Zhang
/kernel/debug/swiotlb/swiotlb-hi/io_tlb_nslabs 3145728 $ cat /sys/kernel/debug/swiotlb/swiotlb-hi/io_tlb_used 8960 Dongli Zhang (7): swiotlb: introduce the highmem swiotlb buffer swiotlb: change the signature of remap function swiotlb-xen: support highmem for xen specific code swiotlb: to imp

<    1   2