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 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

[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 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

[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 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 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 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 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 ++

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 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 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

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 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; >&

[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

[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

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: >>>>

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-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: [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

[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

[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

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

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 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

[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

[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

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 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 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

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 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

[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

[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 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 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 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 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 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 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 1/6] swiotlb: define new enumerated type

2021-02-03 Thread Dongli Zhang
This is just to define new enumerated type without functional change. The 'SWIOTLB_LO' is to index legacy 32-bit swiotlb buffer, while the 'SWIOTLB_HI' is to index the 64-bit buffer. This is to prepare to enable 64-bit swiotlb. Cc: Joe Jin Signed-off-by: Dongli Zhang

Re: [PATCH v2] xen-blkback: fix compatibility bug with single page rings

2021-01-29 Thread Dongli Zhang
On 1/29/21 12:13 AM, Paul Durrant wrote: >> -Original Message- >> From: Jürgen Groß >> Sent: 29 January 2021 07:35 >> To: Dongli Zhang ; Paul Durrant ; xen- >> de...@lists.xenproject.org; linux-bl...@vger.kernel.org; >> linux-ker...@vger.ker

Re: [PATCH v2] xen-blkback: fix compatibility bug with single page rings

2021-01-28 Thread Dongli Zhang
en/blkback: rework connect_ring() to avoid > inconsistent xenstore 'ring-page-order' set by malicious blkfront") > Signed-off-by: Paul Durrant > --- > Cc: Konrad Rzeszutek Wilk > Cc: "Roger Pau Monné" > Cc: Jens Axboe > Cc: Dongli Zhang > > v2:

Re: [PATCH] xen-blkback: fix compatibility bug with single page rings

2021-01-27 Thread Dongli Zhang
tead of reading 'ring-ref', xen-blkback will read the stale > 'ring-ref0' left around by the previous frontend will try to map the wrong > grant reference. > > This patch restores the original behaviour. > > Fixes: 4a8c31a1c6f5 ("xen/blkback: re

[PATCH 1/1] xen/manage: enable C_A_D to force reboot

2020-05-13 Thread Dongli Zhang
oe Jin Cc: Boris Ostrovsky Signed-off-by: Dongli Zhang --- drivers/xen/manage.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index cd046684e0d1..3190d0ecb52e 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c @@ -204,6 +204,13 @@ s

Re: Live migration and PV device handling

2020-04-03 Thread Dongli Zhang
old design, the scope of domid_t is shared by a cluster of server in new design? That is, the domid should be unique in the cluster of all servers if we expect non-cooperative migration always succeed? Thank you very much! Dongli Zhang

[Xen-devel] [PATCH v3 2/2] xenbus: req->err should be updated before req->state

2020-03-03 Thread Dongli Zhang
This patch adds the barrier to guarantee that req->err is always updated before req->state. Otherwise, read_reply() would not return ERR_PTR(req->err) but req->body, when process_writes()->xb_write() is failed. Signed-off-by: Dongli Zhang --- drivers/xen/xenbus/xenbus_comms.c

[Xen-devel] [PATCH v3 1/2] xenbus: req->body should be updated before req->state

2020-03-03 Thread Dongli Zhang
p_radix+0x6/0x60 The virt_rmb() is added in the 'true' path of test_reply(). The "while" is changed to "do while" so that test_reply() is used as a read memory barrier. Signed-off-by: Dongli Zhang --- Changed since v1: - change "barrier()" to "virt_

Re: [Xen-devel] [PATCH v2 1/2] xenbus: req->body should be updated before req->state

2020-03-03 Thread dongli . zhang
On 3/3/20 11:37 AM, Julien Grall wrote: > Hi, > > On 03/03/2020 18:47, Dongli Zhang wrote: >> The req->body should be updated before req->state is updated and the >> order should be guaranteed by a barrier. >> >> Otherwise, read_reply() might return

[Xen-devel] [PATCH v2 2/2] xenbus: req->err should be updated before req->state

2020-03-03 Thread Dongli Zhang
This patch adds the barrier to guarantee that req->err is always updated before req->state. Otherwise, read_reply() would not return ERR_PTR(req->err) but req->body, when process_writes()->xb_write() is failed. Signed-off-by: Dongli Zhang --- drivers/xen/xenbus/xenbus_comms.c

[Xen-devel] [PATCH v2 1/2] xenbus: req->body should be updated before req->state

2020-03-03 Thread Dongli Zhang
p_radix+0x6/0x60 The barrier() in test_reply() is changed to virt_rmb(). The "while" is changed to "do while" so that test_reply() is used as a read memory barrier. Signed-off-by: Dongli Zhang --- Changed since v1: - change "barrier()" to "virt_rmb()&q

Re: [Xen-devel] [PATCH 1/2] xenbus: req->body should be updated before req->state

2020-03-03 Thread dongli . zhang
On 3/3/20 1:40 AM, Julien Grall wrote: > Hi, > > On 03/03/2020 01:58, Dongli Zhang wrote: >> The req->body should be updated before req->state is updated and the >> order should be guaranteed by a barrier. >> >> Otherwise, read_reply() might return

[Xen-devel] [PATCH 2/2] xenbus: req->err should be updated before req->state

2020-03-02 Thread Dongli Zhang
This patch adds the barrier to guarantee that req->err is always updated before req->state. Otherwise, read_reply() would not return ERR_PTR(req->err) but req->body, when process_writes()->xb_write() is failed. Signed-off-by: Dongli Zhang --- drivers/xen/xenbus/xenbus_comms.c

[Xen-devel] [PATCH 1/2] xenbus: req->body should be updated before req->state

2020-03-02 Thread Dongli Zhang
p_radix+0x6/0x60 The "while" is changed to "do while" so that wait_event() is used as a barrier. Signed-off-by: Dongli Zhang --- drivers/xen/xenbus/xenbus_comms.c | 2 ++ drivers/xen/xenbus/xenbus_xs.c| 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --g

[Xen-devel] [PATCH v2 1/1] xen-netfront: do not use ~0U as error return value for xennet_fill_frags()

2019-10-01 Thread Dongli Zhang
ad4f15dc2c70 ("xen/netfront: don't bug in case of too many frags") Signed-off-by: Dongli Zhang --- Changed since v1: - Always update queue->rx.rsp_cons inside xennet_fill_frags() so we do not need to add extra argument to xennet_fill_frags(). drivers/net/xen-netfro

[Xen-devel] [PATCH 1/1] xen-netfront: do not use ~0U as error return value for xennet_fill_frags()

2019-09-30 Thread Dongli Zhang
fixed in commit 00b368502d18 ("xen-netfront: do not assume sk_buff_head list is empty in error handling"). This patch uses an extra argument to help return if there is error in xennet_fill_frags(). Fixes: ad4f15dc2c70 ("xen/netfront: don't bug in case of too many frags") Signe

[Xen-devel] [PATCH 1/1] xen-netfront: do not assume sk_buff_head list is empty in error handling

2019-09-15 Thread Dongli Zhang
xes: ad4f15dc2c70 ("xen/netfront: don't bug in case of too many frags") Signed-off-by: Dongli Zhang --- drivers/net/xen-netfront.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 8d33970..5f5722b 100644

Re: [Xen-devel] Question on xen-netfront code to fix a potential ring buffer corruption

2019-08-26 Thread Dongli Zhang
Hi Juergen, On 8/27/19 2:13 PM, Juergen Gross wrote: > On 18.08.19 10:31, Dongli Zhang wrote: >> Hi, >> >> Would you please help confirm why the condition at line 908 is ">="? >> >> In my opinion, we would only hit "skb_shinfo(skb)->nr_frag

[Xen-devel] Question on xen-netfront code to fix a potential ring buffer corruption

2019-08-18 Thread Dongli Zhang
r_frags >= MAX_SKB_FRAGS)), but not just "==". Perhaps __pskb_pull_tail() may fail although pull_to is less than skb_headlen(skb). Thank you very much! Dongli Zhang ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH 1/1] xen/gnttab: print log at level XENLOG_ERR before panic

2019-04-25 Thread Dongli Zhang
Hi Andrew, On 04/23/2019 06:37 PM, Andrew Cooper wrote: > On 22/04/2019 13:39, Dongli Zhang wrote: >> Print log at level XENLOG_ERR (instead XENLOG_INFO) as domain_crash() >> indicates there is fatal error. >> >> Signed-off-by: Dongli Zhang >> --- >> xen

[Xen-devel] [PATCH 1/1] xen/gnttab: print log at level XENLOG_ERR before panic

2019-04-22 Thread Dongli Zhang
Print log at level XENLOG_ERR (instead XENLOG_INFO) as domain_crash() indicates there is fatal error. Signed-off-by: Dongli Zhang --- xen/common/grant_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 80728ea

Re: [Xen-devel] Question regarding swiotlb-xen in Linux kernel

2019-04-19 Thread Dongli Zhang
> Another topic is the question whether we should really call > xen_destroy_contiguous_region() when freeing the memory if there was no > need to use xen_create_contiguous_region() when allocating it. What would happen if guest domain is malicious? That is, guest (including dom0) my allocate unlimited MFN continuous memory and never exchange them back to xen. Would MFN continuous memory be used up? As a result, xen may not be able to boot new VM. Is this a sort of DoS attack? Dongli Zhang ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

[Xen-devel] [PATCH 1/1] xen-netback: add reference from xenvif to backend_info to facilitate coredump analysis

2019-04-11 Thread Dongli Zhang
callstack of xenwatch (e.g., netback_remove() or frontend_changed()). This patch adds a reference from xenvif to backend_info so that it would be much more easier to obtain backend_info during coredump analysis. Signed-off-by: Dongli Zhang --- drivers/net/xen-netback/common.h | 18

Re: [Xen-devel] [PATCH v4.9 1/1] jiffies: use jiffies64_to_nsecs() to fix 100% steal usage for xen vcpu hotplug

2019-03-12 Thread Dongli Zhang
On 3/12/19 8:56 PM, Greg KH wrote: > On Wed, Mar 06, 2019 at 03:35:40PM +0800, Dongli Zhang wrote: >> Thanks to Joe Jin's reminding, this patch is applicable to mainline linux >> kernel, although there is no issue due to this kind of bug in mainline >> kernel. &g

Re: [Xen-devel] [PATCH v4.9 1/1] jiffies: use jiffies64_to_nsecs() to fix 100% steal usage for xen vcpu hotplug

2019-03-05 Thread Dongli Zhang
ue is reproduced on xen? This would help synchronize stable with mainline better. Thank you very much! Dongli Zhang On 3/5/19 3:59 PM, Dongli Zhang wrote: > [ Not relevant upstream, therefore no upstream commit. ] > > To fix, use jiffies64_to_nsecs() directly instead of deriv

[Xen-devel] [PATCH v4.9 1/1] jiffies: use jiffies64_to_nsecs() to fix 100% steal usage for xen vcpu hotplug

2019-03-04 Thread Dongli Zhang
This version applies to the v4.9 series. Link: https://lkml.org/lkml/2019/2/28/1373 Suggested-by: Juergen Gross Signed-off-by: Dongli Zhang --- include/linux/jiffies.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h ind

Re: [Xen-devel] [BUG linux-4.9.x] xen hotplug cpu leads to 100% steal usage

2019-03-04 Thread Dongli Zhang
Hi Thomas, On 3/2/19 7:43 AM, Thomas Gleixner wrote: > On Thu, 28 Feb 2019, Dongli Zhang wrote: >> >> The root cause is that the return type of jiffies_to_usecs() is 'unsigned >> int', >> but not 'unsigned long'. As a result, the leading 32 bits

Re: [Xen-devel] [BUG linux-4.9.x] xen hotplug cpu leads to 100% steal usage

2019-03-04 Thread Dongli Zhang
Hi Juergen, On 3/4/19 4:14 PM, Juergen Gross wrote: > On 01/03/2019 03:35, Dongli Zhang wrote: >> This issue is only for stable 4.9.x (e.g., 4.9.160), while the root cause is >> still in the lasted mainline kernel. >> >> This is obviated by new feature patch set ended w

[Xen-devel] [BUG linux-4.9.x] xen hotplug cpu leads to 100% steal usage

2019-02-28 Thread Dongli Zhang
emove generic asm headers"). This is not reasonable for stable branch as the patch set involves lots of changes. Would you please let me know if there is any suggestion on this issue? Thank you very much! Dongli Zhang ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH v6 2/2] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront

2019-02-18 Thread Dongli Zhang
Hi Konrad, On 1/17/19 11:29 PM, Konrad Rzeszutek Wilk wrote: > On Tue, Jan 15, 2019 at 09:20:36AM +0100, Roger Pau Monné wrote: >> On Tue, Jan 15, 2019 at 12:41:44AM +0800, Dongli Zhang wrote: >>> The xenstore 'ring-page-order' is used globally for each blkback queue

Re: [Xen-devel] [admin] [Pkg-xen-devel] [BUG] task jbd2/xvda4-8:174 blocked for more than 120 seconds.

2019-02-17 Thread Dongli Zhang
On 2/18/19 5:29 AM, Samuel Thibault wrote: > Hello, > > Dongli Zhang, le mar. 12 févr. 2019 12:11:20 +0800, a ecrit: >> On 02/12/2019 06:10 AM, Samuel Thibault wrote: >>> Hans van Kranenburg, le lun. 11 févr. 2019 22:59:11 +0100, a ecrit: >>>> On

Re: [Xen-devel] [admin] [Pkg-xen-devel] [BUG] task jbd2/xvda4-8:174 blocked for more than 120 seconds.

2019-02-11 Thread Dongli Zhang
On 02/12/2019 06:10 AM, Samuel Thibault wrote: > Hans van Kranenburg, le lun. 11 févr. 2019 22:59:11 +0100, a ecrit: >> On 2/11/19 2:37 AM, Dongli Zhang wrote: >>> >>> On 2/10/19 12:35 AM, Samuel Thibault wrote: >>>> >>>> Hans van Kranen

Re: [Xen-devel] [admin] [Pkg-xen-devel] [BUG] task jbd2/xvda4-8:174 blocked for more than 120 seconds.

2019-02-10 Thread Dongli Zhang
I/O hang can be affected by the lack of grant entry. If to increase the max frame to 64 takes effect, it is weird why the I/O would hang when there are still 512 entries available. Dongli Zhang > >> With Xen 4.8, you can add gnttab_max_frames=64 (or another number, but >> higher t

Re: [Xen-devel] [PATCH 1/1] xen-blkback: do not wake up shutdown_wq after xen_blkif_schedule() is stopped

2019-01-17 Thread Dongli Zhang
Hi Roger, On 01/17/2019 04:20 PM, Roger Pau Monné wrote: > On Thu, Jan 17, 2019 at 10:10:00AM +0800, Dongli Zhang wrote: >> Hi Roger, >> >> On 2019/1/16 下午10:52, Roger Pau Monné wrote: >>> On Wed, Jan 16, 2019 at 09:47:41PM +0800, Dongli Zhang wrote: &g

Re: [Xen-devel] [PATCH 1/1] xen-blkback: do not wake up shutdown_wq after xen_blkif_schedule() is stopped

2019-01-16 Thread Dongli Zhang
Hi Roger, On 2019/1/16 下午10:52, Roger Pau Monné wrote: > On Wed, Jan 16, 2019 at 09:47:41PM +0800, Dongli Zhang wrote: >> There is no need to wake up xen_blkif_schedule() as kthread_stop() is able >> to already wake up the kernel thread. >> >> Signed-off-by: Dongli Zhan

Re: [Xen-devel] [PATCH v5 2/2] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront

2019-01-16 Thread Dongli Zhang
On 2019/1/17 上午12:32, Konrad Rzeszutek Wilk wrote: > On Tue, Jan 08, 2019 at 04:24:32PM +0800, Dongli Zhang wrote: >> oops. Please ignore this v5 patch. >> >> I just realized Linus suggested in an old email not use BUG()/BUG_ON() in >> the code. >> >> I

[Xen-devel] [PATCH 1/1] xen-blkback: do not wake up shutdown_wq after xen_blkif_schedule() is stopped

2019-01-16 Thread Dongli Zhang
There is no need to wake up xen_blkif_schedule() as kthread_stop() is able to already wake up the kernel thread. Signed-off-by: Dongli Zhang --- drivers/block/xen-blkback/xenbus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/block/xen-blkback/xenbus.c b

[Xen-devel] [PATCH v6 1/2] xen/blkback: add stack variable 'blkif' in connect_ring()

2019-01-14 Thread Dongli Zhang
As 'be->blkif' is used for many times in connect_ring(), the stack variable 'blkif' is added to substitute 'be-blkif'. Suggested-by: Paul Durrant Signed-off-by: Dongli Zhang Reviewed-by: Paul Durrant Reviewed-by: Roger Pau Monné --- driver

[Xen-devel] [PATCH v6 2/2] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront

2019-01-14 Thread Dongli Zhang
ing() to read xenstore 'ring-page-order' only once. Signed-off-by: Dongli Zhang --- Changed since v1: * change the order of xenstore read in read_per_ring_refs * use xenbus_read_unsigned() in connect_ring() Changed since v2: * simplify the condition check as "(err != 1 &

Re: [Xen-devel] [PATCH v4 2/2] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront

2019-01-08 Thread Dongli Zhang
Hi Roger, On 01/07/2019 11:27 PM, Roger Pau Monné wrote: > On Mon, Jan 07, 2019 at 10:07:34PM +0800, Dongli Zhang wrote: >> >> >> On 01/07/2019 10:05 PM, Dongli Zhang wrote: >>> >>> >>> On 01/07/2019 08:01 PM, Roger Pau Monné wrote: >>>

Re: [Xen-devel] [PATCH v5 2/2] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront

2019-01-08 Thread Dongli Zhang
oops. Please ignore this v5 patch. I just realized Linus suggested in an old email not use BUG()/BUG_ON() in the code. I will switch to the WARN() solution and resend again. Sorry for the junk email. Dongli Zhang On 2019/1/8 下午4:15, Dongli Zhang wrote: > The xenstore 'ring-page-o

[Xen-devel] [PATCH v5 2/2] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront

2019-01-08 Thread Dongli Zhang
ing() to read xenstore 'ring-page-order' only once. Signed-off-by: Dongli Zhang --- Changed since v1: * change the order of xenstore read in read_per_ring_refs * use xenbus_read_unsigned() in connect_ring() Changed since v2: * simplify the condition check as "(err != 1 &

[Xen-devel] [PATCH v5 1/2] xen/blkback: add stack variable 'blkif' in connect_ring()

2019-01-08 Thread Dongli Zhang
As 'be->blkif' is used for many times in connect_ring(), the stack variable 'blkif' is added to substitute 'be-blkif'. Suggested-by: Paul Durrant Signed-off-by: Dongli Zhang Reviewed-by: Paul Durrant Reviewed-by: Roger Pau Monné --- driver

Re: [Xen-devel] [PATCH v4 2/2] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront

2019-01-07 Thread Dongli Zhang
On 01/07/2019 10:05 PM, Dongli Zhang wrote: > > > On 01/07/2019 08:01 PM, Roger Pau Monné wrote: >> On Mon, Jan 07, 2019 at 01:35:59PM +0800, Dongli Zhang wrote: >>> The xenstore 'ring-page-order' is used globally for each blkback queue and >>> there

Re: [Xen-devel] [PATCH v4 2/2] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront

2019-01-07 Thread Dongli Zhang
On 01/07/2019 08:01 PM, Roger Pau Monné wrote: > On Mon, Jan 07, 2019 at 01:35:59PM +0800, Dongli Zhang wrote: >> The xenstore 'ring-page-order' is used globally for each blkback queue and >> therefore should be read from xenstore only once. However, it is obtained

[Xen-devel] [PATCH v4 1/2] xen/blkback: add stack variable 'blkif' in connect_ring()

2019-01-06 Thread Dongli Zhang
As 'be->blkif' is used for many times in connect_ring(), the stack variable 'blkif' is added to substitute 'be-blkif'. Suggested-by: Paul Durrant Signed-off-by: Dongli Zhang --- drivers/block/xen-blkback/xenbus.c | 27 ++- 1 file change

[Xen-devel] [PATCH v4 2/2] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront

2019-01-06 Thread Dongli Zhang
ing() to read xenstore 'ring-page-order' only once. Signed-off-by: Dongli Zhang --- Changed since v1: * change the order of xenstore read in read_per_ring_refs * use xenbus_read_unsigned() in connect_ring() Changed since v2: * simplify the condition check as "(err != 1 &

Re: [Xen-devel] [PATCH v3 1/1] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront

2019-01-03 Thread Dongli Zhang
Ping? Dongli Zhang On 12/19/2018 09:23 PM, Dongli Zhang wrote: > The xenstore 'ring-page-order' is used globally for each blkback queue and > therefore should be read from xenstore only once. However, it is obtained > in read_per_ring_refs() which might be called multip

[Xen-devel] [PATCH v3 1/1] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront

2018-12-19 Thread Dongli Zhang
ing() to read xenstore 'ring-page-order' only once. Signed-off-by: Dongli Zhang --- Changed since v1: * change the order of xenstore read in read_per_ring_refs * use xenbus_read_unsigned() in connect_ring() Changed since v2: * simplify the condition check as "(err != 1 &

Re: [Xen-devel] [PATCH v2 1/1] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront

2018-12-18 Thread Dongli Zhang
On 12/18/2018 11:13 PM, Roger Pau Monné wrote: > On Tue, Dec 18, 2018 at 07:31:59PM +0800, Dongli Zhang wrote: >> Hi Roger, >> >> On 12/18/2018 05:33 PM, Roger Pau Monné wrote: >>> On Tue, Dec 18, 2018 at 08:55:38AM +0800, Dongli Zhang wrote: >>>> The x

Re: [Xen-devel] [PATCH v2 1/1] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront

2018-12-18 Thread Dongli Zhang
Hi Roger, On 12/18/2018 05:33 PM, Roger Pau Monné wrote: > On Tue, Dec 18, 2018 at 08:55:38AM +0800, Dongli Zhang wrote: >> The xenstore 'ring-page-order' is used globally for each blkback queue and >> therefore should be read from xenstore only once. Howe

[Xen-devel] [PATCH v2 1/1] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront

2018-12-17 Thread Dongli Zhang
ing() to read xenstore 'ring-page-order' only once. Signed-off-by: Dongli Zhang --- Changed since v1: * change the order of xenstore read in read_per_ring_refs(suggested by Roger Pau Monne) * use xenbus_read_unsigned() in connect_ring() (suggested by Roger Pau Monne

Re: [Xen-devel] [PATCH 1/1] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront

2018-12-07 Thread Dongli Zhang
On 12/07/2018 11:15 PM, Paul Durrant wrote: >> -Original Message- >> From: Dongli Zhang [mailto:dongli.zh...@oracle.com] >> Sent: 07 December 2018 15:10 >> To: Paul Durrant ; linux-ker...@vger.kernel.org; >> xen-devel@lists.xenproject.org; linux-b

Re: [Xen-devel] [PATCH 1/1] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront

2018-12-07 Thread Dongli Zhang
Hi Paul, On 12/07/2018 05:39 PM, Paul Durrant wrote: >> -Original Message- >> From: Xen-devel [mailto:xen-devel-boun...@lists.xenproject.org] On Behalf >> Of Dongli Zhang >> Sent: 07 December 2018 04:18 >> To: linux-ker...@vger.kernel.org; xen-devel@list

  1   2   >