[PATCH RFC 0/1] To add HMP interface to dump PCI MSI-X table/PBA

2021-04-22 Thread Dongli Zhang
there any issue with output format? 3. Is it fine to add only for HMP, but not QMP? Thank you very much! Dongli Zhang

[PATCH RFC 1/1] msix: add hmp interface to dump MSI-X info

2021-04-22 Thread Dongli Zhang
: Dongli Zhang --- hmp-commands-info.hx | 13 +++ hw/pci/msix.c | 49 ++ include/hw/pci/msix.h | 2 ++ include/monitor/hmp.h | 1 + softmmu/qdev-monitor.c | 25 + 5 files changed, 90 insertions(+) diff --git a/hmp

Re: [PATCH RFC 0/1] To add HMP interface to dump PCI MSI-X table/PBA

2021-04-23 Thread Dongli Zhang
On 4/22/21 11:01 PM, Jason Wang wrote: > > 在 2021/4/23 下午12:47, Dongli Zhang 写道: >> This is inspired by the discussion with Jason on below patchset. >> >> https://urldefense.com/v3/__https://lists.gnu.org/archive/html/qemu-devel/2021-03/msg090

Re: [PATCH RFC 1/1] msix: add hmp interface to dump MSI-X info

2021-04-23 Thread Dongli Zhang
On 4/23/21 12:59 AM, Jason Wang wrote: > > 在 2021/4/23 下午12:47, Dongli Zhang 写道: >> This patch is to add the HMP interface to dump MSI-X table and PBA, in >> order to help diagnose the loss of IRQ issue in VM (e.g., if an MSI-X >> vector is erroneously masked permanent

Re: [PATCH RFC 1/1] msix: add hmp interface to dump MSI-X info

2021-04-25 Thread Dongli Zhang
On 4/24/21 8:36 PM, Jason Wang wrote: > > 在 2021/4/24 上午1:32, Dongli Zhang 写道: >> >> On 4/23/21 12:59 AM, Jason Wang wrote: >>> 在 2021/4/23 下午12:47, Dongli Zhang 写道: >>>> This patch is to add the HMP interface to dump MSI-X table and PBA, in >>>&

Re: [PATCH RFC 0/1] To add HMP interface to dump PCI MSI-X table/PBA

2021-04-27 Thread Dongli Zhang
Hi Jason, On 4/27/21 7:31 PM, Jason Wang wrote: > > 在 2021/4/27 下午4:53, Dr. David Alan Gilbert 写道: >> * Dongli Zhang (dongli.zh...@oracle.com) wrote: >>> >>> On 4/22/21 11:01 PM, Jason Wang wrote: >>>> 在 2021/4/23 下午12:47, Dongli Zhang 写道: >>>

Re: [PATCH RFC 0/1] To add HMP interface to dump PCI MSI-X table/PBA

2021-04-27 Thread Dongli Zhang
On 4/27/21 10:55 PM, Jason Wang wrote: > > 在 2021/4/28 下午1:10, Dongli Zhang 写道: >> Hi Jason, >> >> On 4/27/21 7:31 PM, Jason Wang wrote: >>> 在 2021/4/27 下午4:53, Dr. David Alan Gilbert 写道: >>>> * Dongli Zhang (dongli.zh...@oracle.com) wrote: >>

Re: [PATCH RFC 0/1] To add HMP interface to dump PCI MSI-X table/PBA

2021-04-28 Thread Dongli Zhang
On 4/28/21 1:45 AM, Dr. David Alan Gilbert wrote: > * Dongli Zhang (dongli.zh...@oracle.com) wrote: >> Hi Jason, >> >> On 4/27/21 7:31 PM, Jason Wang wrote: >>> >>> 在 2021/4/27 下午4:53, Dr. David Alan Gilbert 写道: >>>> * Dongli Zhang (dongli.zh

[PATCH RFC 1/2] qdev: add debug interface to kick/call eventfd

2021-01-14 Thread Dongli Zhang
(e.g., vhost-scsi) from QEMU/host to VM, while the 'kick' is to kick the doorbell on purpose by admin at QEMU/host side for a specific device. Signed-off-by: Dongli Zhang --- hmp-commands.hx| 14 ++ include/hw/qdev-core.h | 6 ++ include/

[PATCH RFC 0/2] Add debug interface to kick/call on purpose

2021-01-14 Thread Dongli Zhang
{ locked_pending = 0, tail = 0 } } } } } }, head = { next = 0xa104ae40d360, prev = 0xa104ae40d360 } }, count = 31, -> eventfd incremented to 31 !!! flags = 526336, id = 26 } Only the interface for vhost-scsi is implemented since this is RFC. I will implement for other types (e.g., eventfd or MSI-X) if the RFC is reasonable. Thank you very much! Dongli Zhang

[PATCH RFC 2/2] vhost-scsi: implement DeviceEvent

2021-01-14 Thread Dongli Zhang
ents": { "dev": "/machine/peripheral/vscsi0", "event": "kick", "queue": 1 } } Signed-off-by: Dongli Zhang --- hw/virtio/vhost-scsi-pci.c | 10 ++ hw/virtio/virtio.c | 19 +++ include

Re: [PATCH RFC 0/2] Add debug interface to kick/call on purpose

2021-01-19 Thread Dongli Zhang
On 1/18/21 8:59 AM, Dr. David Alan Gilbert wrote: > * Daniel P. Berrangé (berra...@redhat.com) wrote: >> On Thu, Jan 14, 2021 at 04:27:28PM -0800, Dongli Zhang wrote: >>> The virtio device/driver (e.g., vhost-scsi and indeed any device including >>> e1000e) may han

Re: [PATCH v3 1/3] msix/hmp: add hmp interface to dump MSI-X info

2021-07-14 Thread Dongli Zhang
Hi Markus, On 7/14/21 2:42 AM, Markus Armbruster wrote: > Dongli Zhang writes: > >> Hi Markus, >> >> On 7/13/21 10:46 PM, Markus Armbruster wrote: >>> Dongli Zhang writes: >>> >>>> This patch is to add the HMP interface to dump MSI-X tab

[PATCH v4 0/3] To add HMP interface to dump PCI MSI-X table/PBA

2021-07-14 Thread Dongli Zhang
+++ include/hw/pci/msix.h | 2 ++ include/hw/pci/pci.h | 3 ++ include/hw/virtio/virtio.h | 2 ++ include/monitor/hmp.h | 1 + softmmu/qdev-monitor.c | 36 +++ 10 files changed, 158 insertions(+) Thank you very much! Dongli Zhang

[PATCH v4 1/3] msix/hmp: add hmp interface to dump MSI-X info

2021-07-14 Thread Dongli Zhang
0x40d1 0x MSI-X PBA 0 0 0 0 0 0 0 Since this is just for debugging by humans, provide the command only in HMP, not in QMP. Cc: Jason Wang Cc: Joe Jin Signed-off-by: Dongli Zhang Acked-by: Dr. David Alan Gilbert Acked-by: Jason Wang --- Changed since v1/v2: - Add msix_present() to

[PATCH v4 2/3] msix/hmp: add interface to dump device specific info

2021-07-14 Thread Dongli Zhang
PCIDeviceClass->msix_info interface. Cc: Jason Wang Cc: Joe Jin Suggested-by: Jason Wang Signed-off-by: Dongli Zhang Acked-by: Jason Wang --- hmp-commands-info.hx | 7 --- include/hw/pci/pci.h | 3 +++ softmmu/qdev-monitor.c | 11 +++ 3 files changed, 18 insertions(+)

[PATCH v4 3/3] virtio-pci/hmp: implement device specific hmp interface

2021-07-14 Thread Dongli Zhang
2: 3 queue 3: 4 queue 4: 5 queue 5: 6 Cc: Jason Wang Cc: Joe Jin Suggested-by: Jason Wang Signed-off-by: Dongli Zhang Acked-by: Jason Wang --- hw/virtio/virtio-pci.c | 22 ++ hw/virtio/virtio.c | 10 ++ include/hw/virtio/virtio.h | 2 ++ 3 files

Re: [PATCH v2 1/1] hmp: synchronize cpu state for lapic info

2021-07-22 Thread Dongli Zhang
May I get feedback for this bugfix? So far the "info lapic " returns stale data and could not accurate reflect the status in KVM. Thank you very much! Dongli Zhang On 7/1/21 2:40 PM, Dongli Zhang wrote: > While the default "info lapic" always synchronizes cpu sta

[PATCH RESEND v2 2/3] msix/hmp: add interface to dump device specific info

2021-07-12 Thread Dongli Zhang
PCIDeviceClass->msix_info interface. Cc: Jason Wang Cc: Joe Jin Suggested-by: Jason Wang Signed-off-by: Dongli Zhang --- hmp-commands-info.hx | 7 --- include/hw/pci/pci.h | 3 +++ softmmu/qdev-monitor.c | 11 +++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --gi

[PATCH RESEND v2 0/3] To add HMP interface to dump PCI MSI-X table/PBA

2021-07-12 Thread Dongli Zhang
changed, 153 insertions(+) Thank you very much! Dongli Zhang

[PATCH RESEND v2 1/3] msix/hmp: add hmp interface to dump MSI-X info

2021-07-12 Thread Dongli Zhang
Wang Cc: Joe Jin Signed-off-by: Dongli Zhang Acked-by: Dr. David Alan Gilbert --- hmp-commands-info.hx | 13 + hw/pci/msix.c | 63 ++ include/hw/pci/msix.h | 2 ++ include/monitor/hmp.h | 1 + softmmu/qdev-monitor.c | 25

[PATCH RESEND v2 3/3] virtio-pci/hmp: implement device specific hmp interface

2021-07-12 Thread Dongli Zhang
2: 3 queue 3: 4 queue 4: 5 queue 5: 6 Cc: Jason Wang Cc: Joe Jin Suggested-by: Jason Wang Signed-off-by: Dongli Zhang --- hw/virtio/virtio-pci.c | 22 ++ hw/virtio/virtio.c | 10 ++ include/hw/virtio/virtio.h | 2 ++ 3 files changed, 34 insertions

[PATCH RESEND 1/1] multi-process: fix usage information

2021-07-12 Thread Dongli Zhang
>From source code, the 'devid' of x-remote-object should be one of devices in remote QEMU process. Signed-off-by: Dongli Zhang Reviewed-by: Jagannathan Raman --- Resend to be applied as trivial patch. I have verified by reading the code and playing with below orchestrator. https

Re: [PATCH RESEND v2 0/3] To add HMP interface to dump PCI MSI-X table/PBA

2021-07-13 Thread Dongli Zhang
On 7/13/21 1:59 PM, Michael S. Tsirkin wrote: > On Mon, Jul 12, 2021 at 04:58:09PM -0700, Dongli Zhang wrote: >> I have just rebased the v2 patchset on top of most recent qemu to resend. >> >> This patch is to introduce the new HMP command to dump the MSI-X table/PBA. >

[PATCH v3 0/3] To add HMP interface to dump PCI MSI-X table/PBA

2021-07-13 Thread Dongli Zhang
| 2 ++ include/monitor/hmp.h | 1 + softmmu/qdev-monitor.c | 36 +++ 10 files changed, 158 insertions(+) Thank you very much! Dongli Zhang

[PATCH v3 1/3] msix/hmp: add hmp interface to dump MSI-X info

2021-07-13 Thread Dongli Zhang
Wang Cc: Joe Jin Signed-off-by: Dongli Zhang Acked-by: Dr. David Alan Gilbert Acked-by: Jason Wang --- Changed since v1/v2: - Add msix_present() to pci-stub.c to avoid build error hmp-commands-info.hx | 13 + hw/pci/msix.c | 63

[PATCH v3 3/3] virtio-pci/hmp: implement device specific hmp interface

2021-07-13 Thread Dongli Zhang
2: 3 queue 3: 4 queue 4: 5 queue 5: 6 Cc: Jason Wang Cc: Joe Jin Suggested-by: Jason Wang Signed-off-by: Dongli Zhang Acked-by: Jason Wang --- hw/virtio/virtio-pci.c | 22 ++ hw/virtio/virtio.c | 10 ++ include/hw/virtio/virtio.h | 2 ++ 3 files

[PATCH v3 2/3] msix/hmp: add interface to dump device specific info

2021-07-13 Thread Dongli Zhang
PCIDeviceClass->msix_info interface. Cc: Jason Wang Cc: Joe Jin Suggested-by: Jason Wang Signed-off-by: Dongli Zhang Acked-by: Jason Wang --- hmp-commands-info.hx | 7 --- include/hw/pci/pci.h | 3 +++ softmmu/qdev-monitor.c | 11 +++ 3 files changed, 18 insertions(+)

Re: [PATCH v3 1/3] msix/hmp: add hmp interface to dump MSI-X info

2021-07-13 Thread Dongli Zhang
Hi Markus, On 7/13/21 10:46 PM, Markus Armbruster wrote: > Dongli Zhang writes: > >> This patch is to add the HMP interface to dump MSI-X table and PBA, in >> order to help diagnose the loss of IRQ issue in VM (e.g., if an MSI-X >> vector is erroneously masked permanent

Re: [PATCH v2 38/53] qapi: introduce x-query-lapic QMP command

2021-09-20 Thread Dongli Zhang
_dest & APIC_LOGDEST_XAPIC_ID); > +g_string_append_printf(buf, "(cluster %u: id %u)", > + s->log_dest >> APIC_LOGDEST_XAPIC_SHIFT, > + s->log_dest & APIC_LOGDEST_XAPIC_ID); > } &g

[PATCH RESEND v2 1/1] hmp: synchronize cpu state for lapic info

2021-09-08 Thread Dongli Zhang
ent. The cpu state should be synchronized when apic-id is available. Otherwise the "info lapic " always returns stale data. Cc: Joe Jin Signed-off-by: Dongli Zhang --- Changed since v1: - I sent out wrong patch version in v1 target/i386/monitor.c | 5 + 1 file changed, 5 insertions

[PATCH 1/1] hmp: synchronize cpu state for lapic info

2021-07-01 Thread Dongli Zhang
ent. The cpu state should be synchronized when apic-id is available. Otherwise the "info lapic " always returns stale data. Cc: Joe Jin Signed-off-by: Dongli Zhang --- target/i386/monitor.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/i386/monitor.c b/target/i386/monitor.c

Re: [PATCH 1/1] hmp: synchronize cpu state for lapic info

2021-07-01 Thread Dongli Zhang
Please ignore this patch. I sent out the wrong version without memory check. I will re-send again. Thank you very much! Dongli Zhang On 7/1/21 2:26 PM, Dongli Zhang wrote: > While the default "info lapic" always synchronizes cpu state ... > > mon_get_cpu() > -> m

[PATCH v2 1/1] hmp: synchronize cpu state for lapic info

2021-07-01 Thread Dongli Zhang
ent. The cpu state should be synchronized when apic-id is available. Otherwise the "info lapic " always returns stale data. Signed-off-by: Dongli Zhang --- Changed since v1: - I sent out wrong patch version in v1 target/i386/monitor.c | 5 + 1 file changed, 5 insertions(+) diff --

Re: [Qemu-devel] Following up questions related to QEMU and I/O Thread

2019-04-15 Thread Dongli Zhang
nly 2 queues available /sys/block/sda/mq/ https://lore.kernel.org/lkml/1553682995-5682-1-git-send-email-dongli.zh...@oracle.com/ I am just curious how increasing the num_queues from 2 to 4 would double the iops, while there are only 2 vcpus available... Dongli Zhang > > In addition, It se

Re: [Qemu-devel] high-level view of packet processing for virtio NIC?

2019-07-23 Thread Dongli Zhang
n-loop.c:512 #16 0x55a0beeb in main_loop () at vl.c:1970 #17 0x55a13230 in main (argc=15, argv=0x7fffe3a8, envp=0x7fffe428) at vl.c:4604 Dongli Zhang

[Qemu-devel] megasas: Unexpected response from lun 1 while scanning, scan aborted

2019-03-26 Thread Dongli Zhang
0:2:0:0: Unexpected response from lun 1 while scanning, scan aborted [0.540364] scsi host1: ata_piix [0.540780] scsi host2: ata_piix [0.702396] scsi 1:0:0:0: Direct-Access ATA QEMU HARDDISK2.5+ PQ: 0 ANSI: 5 When 'lun=1' is changed to 'lun=0', there is no issue. Thank you very much! Dongli Zhang

Re: [Qemu-devel] megasas: Unexpected response from lun 1 while scanning, scan aborted

2019-03-27 Thread Dongli Zhang
On 3/27/19 7:31 PM, Hannes Reinecke wrote: > On 3/26/19 5:47 PM, Dongli Zhang wrote: >> I am reporting an error that the scsi lun cannot initialize successfully >> when I >> am emulating megasas scsi controller with qemu. >> >> I am not sure if this is issue in

[PATCH 0/7] target/i386/kvm/pmu: Enhancement, Bugfix and Cleanup

2024-11-04 Thread Dongli Zhang
nto the VM kernel: [...] Uhhuh. NMI received for unknown reason 30 on CPU 0. To resolve these issues, we propose resetting AMD PMU registers during the VM reset process Dongli Zhang (7): target/i386: disable PerfMonV2 when PERFCORE unavailable target/i386/kvm: introduce 'pmu-cap-disabled&

[PATCH 1/7] target/i386: disable PerfMonV2 when PERFCORE unavailable

2024-11-04 Thread Dongli Zhang
idge perf ctrs = 0x0 (0) number of available UMC PMCs = 0x0 (0) active UMCs bitmask = 0x0 Disable PerfMonV2 in cpuid when PERFCORE is disabled. Fixes: 209b0ac12074 ("target/i386: Add PerfMonV2 feature bit") Signed-off-by: Dongli Zhang --- target/

[PATCH 5/7] target/i386/kvm: reset AMD PMU registers during VM reset

2024-11-04 Thread Dongli Zhang
sues, we propose resetting AMD PMU registers during the VM reset process. Signed-off-by: Dongli Zhang --- target/i386/cpu.h | 8 +++ target/i386/kvm/kvm.c | 156 +- 2 files changed, 161 insertions(+), 3 deletions(-) diff --git a/target/i386/cpu.h b/t

[PATCH 4/7] target/i386/kvm: rename architectural PMU variables

2024-11-04 Thread Dongli Zhang
, the meaning of has_pmu_version remains unchanged. For AMD processors: has_pmu_version == 1 corresponds to versions before AMD PerfMonV2. has_pmu_version == 2 corresponds to AMD PerfMonV2. Signed-off-by: Dongli Zhang --- target/i386/kvm/kvm.c | 49 --- 1

[PATCH 2/7] target/i386/kvm: introduce 'pmu-cap-disabled' to set KVM_PMU_CAP_DISABLE

2024-11-04 Thread Dongli Zhang
re currently supports only x86 hosts, as KVM_CAP_PMU_CAPABILITY is used exclusively for x86 systems. Signed-off-by: Dongli Zhang --- Another previous solution to re-use '-cpu host,-pmu': https://lore.kernel.org/all/20221119122901.2469-1-dongli.zh...@oracle.com/ accel/kvm/kvm-all.c

[PATCH 6/7] target/i386/kvm: support perfmon-v2 for reset

2024-11-04 Thread Dongli Zhang
tus. - MSR_CORE_PERF_GLOBAL_CTRL and MSR_AMD64_PERF_CNTR_GLOBAL_CTL both use env->msr_global_ctrl. - MSR_CORE_PERF_GLOBAL_OVF_CTRL and MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR both use env->msr_global_ovf_ctrl. No changes are needed for vmstate_msr_architectural_pmu or pmu_enable_needed(). Signed-off-by: Dongli Zhang --

[PATCH 7/7] target/i386/kvm: don't stop Intel PMU counters

2024-11-04 Thread Dongli Zhang
ode. No Fixed tag is going to be added for the commit 0d89436786b0 ("kvm: migrate vPMU state"), because this isn't a bugfix. Signed-off-by: Dongli Zhang --- target/i386/kvm/kvm.c | 9 - 1 file changed, 9 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm

[PATCH 3/7] target/i386/kvm: init PMU information only once

2024-11-04 Thread Dongli Zhang
n only once for the first vCPU. Additionally, the code extracted from kvm_x86_build_cpuid() is unrelated to the process of building the CPUID. Signed-off-by: Dongli Zhang --- target/i386/kvm/kvm.c | 71 +++ 1 file changed, 44 insertions(+), 27 deletions(-) diff -

Re: [PATCH 6/7] target/i386/kvm: support perfmon-v2 for reset

2024-11-08 Thread dongli . zhang
Hi Sandipan, On 11/8/24 5:09 AM, Sandipan Das wrote: > On 11/4/2024 3:10 PM, Dongli Zhang wrote: [snip] >> + * separate set of addresses for the selector and counter >> + * registers. Additionally, the address of the next selector or >> +

Re: [PATCH 3/7] target/i386/kvm: init PMU information only once

2024-11-12 Thread dongli . zhang
nction by other patches, including the initialization of both Intel and AMD PMU infortmation (PerfMonV2). Thank you very much! Dongli Zhang > >> if (((env->cpuid_version >> 8)&0xF) >= 6 >> && (env->features[FEAT_1_EDX] & (CPUID_MCE | CPUID_MCA)) == >> (CPUID_MCE | CPUID_MCA)) { >> -- >> 2.39.3 >>

Re: [PATCH 5/7] target/i386/kvm: reset AMD PMU registers during VM reset

2024-11-08 Thread dongli . zhang
Although the unsupported MSR write doesn't trigger any issue (thanks to msrs_to_save_pmu[]), I agree this is the bug that I will address in v2. Thanks to the reminder, indeed I have noticed another issue to be addressed in v2: something unexpected may happen if we migrate from old KVM to new KVM (assuming same QEMU versions). Suppose one user never notice "-pmu" doesn't work on old AMD KVM, but still add "-pmu" to QEMU command line. old AMD KVM: "-pmu" doesn't take effect, due to the lack of KVM_CAP_PMU_CAPABILITY. new AMD KVM: "-pmu" takes effect. After the migration, the vPMU won't work any longer from guest's perspective. > implementation without pmu-cap-disabled (which was suggested before) to save > guest-visible state during migration. Yes, I am going to revert back to my previous solution with "-pmu". Thanks everyone's suggestion on "-pmu" vs. "pmu-cap-disabled". To finalize the decision helps move forward. Would you mind clarify "without pmu-cap-disabled (which was suggested before) to save guest-visible state during migration."? Would you mean the compatibility issue between old QEMU version (without "pmu-cap-disabled") and new QEMU version (with "pmu-cap-disabled")? Thank you very much! Dongli Zhang

Re: [PATCH 5/7] target/i386/kvm: reset AMD PMU registers during VM reset

2024-11-06 Thread dongli . zhang
ith PerfMonV2). I will make it more readable in v2 following your suggestion. Thank you very much! Dongli Zhang

Re: [PATCH 1/7] target/i386: disable PerfMonV2 when PERFCORE unavailable

2024-11-06 Thread dongli . zhang
tatic int __init amd_core_pmu_init(void) 1404 { 1405 union cpuid_0x8022_ebx ebx; 1406 u64 even_ctr_mask = 0ULL; 1407 int i; 1408 1409 if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE)) 1410 return 0; If you don't mind, I will send the v2 with your Suggested-by. Thank you very much! Dongli Zhang

Re: [PATCH 2/7] target/i386/kvm: introduce 'pmu-cap-disabled' to set KVM_PMU_CAP_DISABLE

2024-11-07 Thread dongli . zhang
Hi Zhao, On 11/6/24 11:52 PM, Zhao Liu wrote: > (+Dapang & Zide) > > Hi Dongli, > > On Mon, Nov 04, 2024 at 01:40:17AM -0800, Dongli Zhang wrote: >> Date: Mon, 4 Nov 2024 01:40:17 -0800 >> From: Dongli Zhang >> Subject: [PATCH 2/7] target/i386/kvm

Re: [PATCH 5/7] target/i386/kvm: reset AMD PMU registers during VM reset

2024-11-07 Thread dongli . zhang
Hi Maksim, On 11/7/24 1:00 PM, Maksim Davydov wrote: > > > On 11/4/24 12:40, Dongli Zhang wrote: >> QEMU uses the kvm_get_msrs() function to save Intel PMU registers from KVM >> and kvm_put_msrs() to restore them to KVM. However, there is no support for >> A

Re: [PATCH 2/7] target/i386/kvm: introduce 'pmu-cap-disabled' to set KVM_PMU_CAP_DISABLE

2024-11-13 Thread dongli . zhang
5zZnDp1b1gVmO-DdpYxMvO1hlH9owAHV5UMT$ > > Thank you very much for the reminder! Dongli Zhang

Re: [PATCH 2/7] target/i386/kvm: introduce 'pmu-cap-disabled' to set KVM_PMU_CAP_DISABLE

2025-02-09 Thread dongli . zhang
de) >>>> >>>> Hi Dongli, >>>> >>>> On Mon, Nov 04, 2024 at 01:40:17AM -0800, Dongli Zhang wrote: >>>>> Date: Mon, 4 Nov 2024 01:40:17 -0800 >>>>> From: Dongli Zhang >>>>> Subject: [PATCH 2/7] target/i386/kvm

[PATCH 1/1] vhost-scsi: support VIRTIO_SCSI_F_HOTPLUG

2025-02-02 Thread Dongli Zhang
age02 Signed-off-by: Dongli Zhang --- hw/scsi/vhost-scsi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index 8039d13fd9..d3a260f6a7 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -359,6 +359,9 @@ static const Property v

[PATCH v3 07/10] target/i386/kvm: query kvm.enable_pmu parameter

2025-04-05 Thread Dongli Zhang
, if kvm.enable_pmu=N. In addition, return error when kvm.enable_pmu=N but the user wants to enable vPMU. Signed-off-by: Dongli Zhang --- Changed since v2: - Rework the code flow following Zhao's suggestion. - Return error when: (*kvm_enable_pmu == 'N' &&a

Re: [PATCH v2 08/10] target/i386/kvm: reset AMD PMU registers during VM reset

2025-04-05 Thread Dongli Zhang
t; Zhaoxin (including vendor "__shanghai__" and "centaurhauls")'s PMU is > compatible with Intel, so I have some advice for this patch. > > 在 2025/3/3 06:00, Dongli Zhang 写道: >> [snip] >> + >> +static bool is_same_vendor(CPUX86State *env)

Re: [PATCH 2/3] target/i386: Call KVM_CAP_PMU_CAPABILITY iotcl to enable/disable PMU

2025-03-26 Thread Dongli Zhang
tdp_mmu? Or the legacy perf-based vPMU is going to be purged from the most recent kernel? If they can coexist, how about add property to QEMU control between legacy/modern? i.e. by default use legacy and change to modern as default in the future once the feature is stable. Thank you very much! Dongli

Re: [PATCH v2 08/10] target/i386/kvm: reset AMD PMU registers during VM reset

2025-03-31 Thread Dongli Zhang
v3 patchset, it always follows the Intel path, if both guest and host are Intel or Zhaoxin. https://lore.kernel.org/qemu-devel/20250331013307.11937-9-dongli.zh...@oracle.com/ Thank you very much! Dongli Zhang

[PATCH v3 05/10] target/i386/kvm: extract unrelated code out of kvm_x86_build_cpuid()

2025-03-31 Thread Dongli Zhang
try() instead of cpu_x86_cpuid(), because CPUID has already been filled at this stage. Signed-off-by: Dongli Zhang --- Changed since v1: - Still extract the code, but call them for all CPUs. Changed since v2: - Use cpuid_find_entry() instead of cpu_x86_cpuid(). - Didn't add Reviewed-by fr

[PATCH v3 03/10] kvm: Introduce kvm_arch_pre_create_vcpu()

2025-04-01 Thread Dongli Zhang
: Gerd Hoffmann Signed-off-by: Dongli Zhang Reviewed-by: Zhao Liu --- Changed since v2: - Add my Signed-off-by. accel/kvm/kvm-all.c| 5 + include/system/kvm.h | 1 + target/arm/kvm.c | 5 + target/i386/kvm/kvm.c | 5 + target/loongarch/kvm/kvm.c | 5

[PATCH v4 08/11] target/i386/kvm: query kvm.enable_pmu parameter

2025-04-16 Thread Dongli Zhang
kvm.enable_pmu value from the module sysfs to give a chance to provide more information about vPMU enablement. Signed-off-by: Dongli Zhang --- Changed since v2: - Rework the code flow following Zhao's suggestion. - Return error when: (*kvm_enable_pmu == 'N' && X86_CPU(cp

Re: [PATCH v3 09/10] target/i386/kvm: support perfmon-v2 for reset

2025-04-10 Thread Dongli Zhang
Hi Zhao, On 4/10/25 1:21 AM, Zhao Liu wrote: > On Sun, Mar 30, 2025 at 06:32:28PM -0700, Dongli Zhang wrote: >> Date: Sun, 30 Mar 2025 18:32:28 -0700 >> From: Dongli Zhang >> Subject: [PATCH v3 09/10] target/i386/kvm: support perfmon-v2 for reset >> X-Mailer: git-se

Re: [PATCH v3 08/10] target/i386/kvm: reset AMD PMU registers during VM reset

2025-04-10 Thread Dongli Zhang
index = index - MSR_F15H_PERF_CTL0; >> +if (index & 0x1) { >> +env->msr_gp_counters[index] = msrs[i].data; >> +} else { >> +env->msr_gp_evtsel[index] = msrs[i].data; > > This msr_gp_evtsel[] array's size is 18: > > #define MAX_GP_COUNTERS(MSR_IA32_PERF_STATUS - MSR_P6_EVNTSEL0) > > This formula is based on Intel's MSR, it's best to add a note that the > current size also meets AMD's needs. (No need to adjust the size, as > it will affect migration). I will add a comment to target/i386/cpu.h, above the definition of MAX_GP_COUNTERS. Thank you very much! Dongli Zhang

Re: [PATCH v3 07/10] target/i386/kvm: query kvm.enable_pmu parameter

2025-04-10 Thread Dongli Zhang
* > + * KVM_PMU_CAP_DISABLE doesn't change the PMU > + * behavior on Intel platform because current "pmu" property > works > + * as expected. > + */ > +if ((pmu_cap & KVM_PMU_CAP_DISABLE)) { > +ret = kvm_vm_enable_cap(kvm_state, KVM_CAP_PMU_CAPABILITY, 0, > +KVM_PMU_CAP_DISABLE); > +if (ret < 0) { > +error_setg_errno(errp, -ret, > + "Failed to set KVM_PMU_CAP_DISABLE"); > +return ret; > } > } > } > Thank you very much! I will split based on (enable_pmu) and (!enable_pmu) following your suggestion. Dongli Zhang

[PATCH v4 06/11] target/i386/kvm: extract unrelated code out of kvm_x86_build_cpuid()

2025-04-16 Thread Dongli Zhang
try() instead of cpu_x86_cpuid(), because CPUID has already been filled at this stage. Signed-off-by: Dongli Zhang Reviewed-by: Zhao Liu --- Changed since v1: - Still extract the code, but call them for all CPUs. Changed since v2: - Use cpuid_find_entry() instead of cpu_x86_cpuid(). - Didn't

Re: [PATCH v3 07/10] target/i386/kvm: query kvm.enable_pmu parameter

2025-04-16 Thread Dongli Zhang
nable_pmu, NULL, NULL)) { > -if (*kvm_enable_pmu == 'N' && X86_CPU(cpu)->enable_pmu) { > -error_setg(errp, "Failed to enable PMU since " > +if (*kvm_enable_pmu == 'N') { > +warn_report("

[PATCH v4 05/11] target/i386/kvm: set KVM_PMU_CAP_DISABLE if "-pmu" is configured

2025-04-16 Thread Dongli Zhang
any CPUID bit to indicate PMU availability. To address this, KVM_CAP_PMU_CAPABILITY is used to set KVM_PMU_CAP_DISABLE when "-pmu" is configured. Signed-off-by: Dongli Zhang Reviewed-by: Xiaoyao Li Reviewed-by: Zhao Liu --- Changed since v1: - Switch back to the initial implementation

[PATCH v4 07/11] target/i386/kvm: rename architectural PMU variables

2025-04-16 Thread Dongli Zhang
, the meaning of pmu_version remains unchanged. For AMD processors: pmu_version == 1 corresponds to versions before AMD PerfMonV2. pmu_version == 2 corresponds to AMD PerfMonV2. Signed-off-by: Dongli Zhang Reviewed-by: Dapeng Mi Reviewed-by: Zhao Liu --- Changed since v2: - Change

[PATCH v4 00/11] target/i386/kvm/pmu: PMU Enhancement, Bugfix and Cleanup

2025-04-16 Thread Dongli Zhang
omment. - Bring back global static variable 'kvm_pmu_disabled' read from /sys/module/kvm/parameters/enable_pmu. Zhao Liu (1): i386/cpu: Consolidate the helper to get Host's vendor [Don't merge] Xiaoyao Li (1): kvm: Introduce kvm_arch_pre_create_vcpu() Dongli Zhang (9)

[PATCH v4 11/11] target/i386/kvm: don't stop Intel PMU counters

2025-04-16 Thread Dongli Zhang
ting PMC. This approach is true since Linux kernel commit 68fb4757e867 ("KVM: x86/pmu: Defer reprogram_counter() to kvm_pmu_handle_event"), that is, v6.2. No Fixed tag is going to be added for the commit 0d89436786b0 ("kvm: migrate vPMU state"), because this isn't a bug

[PATCH v4 02/11] target/i386: disable PerfMonV2 when PERFCORE unavailable

2025-04-16 Thread Dongli Zhang
idge perf ctrs = 0x0 (0) number of available UMC PMCs = 0x0 (0) active UMCs bitmask = 0x0 Disable PerfMonV2 in CPUID when PERFCORE is disabled. Suggested-by: Zhao Liu Fixes: 209b0ac12074 ("target/i386: Add PerfMonV2 feature bit") Signed-off-by: D

[PATCH v4 09/11] target/i386/kvm: reset AMD PMU registers during VM reset

2025-04-16 Thread Dongli Zhang
sues, we propose resetting AMD PMU registers during the VM reset process. Signed-off-by: Dongli Zhang --- Changed since v1: - Modify "MSR_K7_EVNTSEL0 + 3" and "MSR_K7_PERFCTR0 + 3" by using AMD64_NUM_COUNTERS (suggested by Sandipan Das). - Use "AMD64_NUM_COUNTERS_COR

[PATCH v4 04/11] kvm: Introduce kvm_arch_pre_create_vcpu()

2025-04-16 Thread Dongli Zhang
Acked-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrangé Signed-off-by: Dongli Zhang Reviewed-by: Zhao Liu --- Changed since v2: - Add my Signed-off-by. Changed since v3: - Pick new reviewed version from: https://lore.kernel.org/all/20250401130205.2198253-8-xiaoyao...@intel.com/ I have fixed

[PATCH v4 10/11] target/i386/kvm: support perfmon-v2 for reset

2025-04-16 Thread Dongli Zhang
tus. - MSR_CORE_PERF_GLOBAL_CTRL and MSR_AMD64_PERF_CNTR_GLOBAL_CTL both use env->msr_global_ctrl. - MSR_CORE_PERF_GLOBAL_OVF_CTRL and MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR both use env->msr_global_ovf_ctrl. No changes are needed for vmstate_msr_architectural_pmu or pmu_enable_needed(). Signed-off-by: Dongli Zhang Re

[PATCH v4 01/11] [DO NOT MERGE] i386/cpu: Consolidate the helper to get Host's vendor

2025-04-16 Thread Dongli Zhang
From: Zhao Liu Extend host_cpu_vendor_fms() to help more cases to get Host's vendor information. Cc: Dongli Zhang Signed-off-by: Zhao Liu --- This patch is already queued by Paolo. https://lore.kernel.org/all/20250410075619.145792-1-zhao1@intel.com/ I don't need to add my Sig

[PATCH v4 03/11] target/i386: disable PERFCORE when "-pmu" is configured

2025-04-16 Thread Dongli Zhang
g on env->features[] in future patches. Suggested-by: Zhao Liu Signed-off-by: Dongli Zhang Reviewed-by: Zhao Liu --- Changed since v2: - No need to check "kvm_enabled() && IS_AMD_CPU(env)". target/i386/cpu.c | 4 1 file changed, 4 insertions(+) diff --git a/target/i386/cp

Re: [PATCH 1/1] vhost-scsi: support VIRTIO_SCSI_F_HOTPLUG

2025-04-16 Thread Dongli Zhang
Ping? Any chance to accept this property? It is acked by Stefano Garzarella. It helped me test vhost-scsi event queue and live migration recently. https://lore.kernel.org/all/20250403063028.16045-9-dongli.zh...@oracle.com/ Thank you very much! Dongli Zhang On 2/11/25 8:26 AM, Stefano

Re: [PATCH] acpi: Set maximum size to 64k for "etc/acpi/rsdp" blob

2025-05-06 Thread Dongli Zhang
Would you mind suggesting any next steps on this issue? 1. Increase maximum size for "etc/acpi/rsdp", or 2. Remove host page size based alignment, and then fix any further live migration issue? Thank you very much! Dongli Zhang On 1/31/23 1:17 AM, Feng Sun wrote: > Michael S. Tsi

Re: [PATCH v4 01/11] [DO NOT MERGE] i386/cpu: Consolidate the helper to get Host's vendor

2025-04-25 Thread Dongli Zhang
Hi Zhao, On 4/25/25 1:28 AM, Zhao Liu wrote: > On Wed, Apr 16, 2025 at 02:52:26PM -0700, Dongli Zhang wrote: >> Date: Wed, 16 Apr 2025 14:52:26 -0700 >> From: Dongli Zhang >> Subject: [PATCH v4 01/11] [DO NOT MERGE] i386/cpu: Consolidate the helper >> to get Host

[PATCH v5 00/10] target/i386/kvm/pmu: PMU Enhancement, Bugfix and Cleanup

2025-04-25 Thread Dongli Zhang
comment. - Bring back global static variable 'kvm_pmu_disabled' read from /sys/module/kvm/parameters/enable_pmu. Changed since v4: - Re-base on top of most recent mainline QEMU. - Add more Reviewed-by. - All patches are reviewed. Xiaoyao Li (1): kvm: Introduce kvm_arch

[PATCH v5 09/10] target/i386/kvm: support perfmon-v2 for reset

2025-04-25 Thread Dongli Zhang
tus. - MSR_CORE_PERF_GLOBAL_CTRL and MSR_AMD64_PERF_CNTR_GLOBAL_CTL both use env->msr_global_ctrl. - MSR_CORE_PERF_GLOBAL_OVF_CTRL and MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR both use env->msr_global_ovf_ctrl. No changes are needed for vmstate_msr_architectural_pmu or pmu_enable_needed(). Signed-off-by: Dongli Zhang Re

[PATCH v5 08/10] target/i386/kvm: reset AMD PMU registers during VM reset

2025-04-25 Thread Dongli Zhang
sues, we propose resetting AMD PMU registers during the VM reset process. Signed-off-by: Dongli Zhang Reviewed-by: Zhao Liu Reviewed-by: Sandipan Das --- Changed since v1: - Modify "MSR_K7_EVNTSEL0 + 3" and "MSR_K7_PERFCTR0 + 3" by using AMD64_NUM_COUNTERS

[PATCH v5 07/10] target/i386/kvm: query kvm.enable_pmu parameter

2025-04-25 Thread Dongli Zhang
kvm.enable_pmu value from the module sysfs to give a chance to provide more information about vPMU enablement. Signed-off-by: Dongli Zhang Reviewed-by: Zhao Liu --- Changed since v2: - Rework the code flow following Zhao's suggestion. - Return error when: (*kvm_enable_pmu == 'N'

[PATCH v5 05/10] target/i386/kvm: extract unrelated code out of kvm_x86_build_cpuid()

2025-04-25 Thread Dongli Zhang
try() instead of cpu_x86_cpuid(), because CPUID has already been filled at this stage. Signed-off-by: Dongli Zhang Reviewed-by: Zhao Liu --- Changed since v1: - Still extract the code, but call them for all CPUs. Changed since v2: - Use cpuid_find_entry() instead of cpu_x86_cpuid(). - Didn't

[PATCH v5 02/10] target/i386: disable PERFCORE when "-pmu" is configured

2025-04-25 Thread Dongli Zhang
g on env->features[] in future patches. Suggested-by: Zhao Liu Signed-off-by: Dongli Zhang Reviewed-by: Zhao Liu Reviewed-by: Sandipan Das --- Changed since v2: - No need to check "kvm_enabled() && IS_AMD_CPU(env)". Changed since v4: - Add Reviewed-by from Sandipan. target

[PATCH v5 04/10] target/i386/kvm: set KVM_PMU_CAP_DISABLE if "-pmu" is configured

2025-04-25 Thread Dongli Zhang
any CPUID bit to indicate PMU availability. To address this, KVM_CAP_PMU_CAPABILITY is used to set KVM_PMU_CAP_DISABLE when "-pmu" is configured. Signed-off-by: Dongli Zhang Reviewed-by: Xiaoyao Li Reviewed-by: Zhao Liu --- Changed since v1: - Switch back to the initial implementation

[PATCH v5 06/10] target/i386/kvm: rename architectural PMU variables

2025-04-25 Thread Dongli Zhang
, the meaning of pmu_version remains unchanged. For AMD processors: pmu_version == 1 corresponds to versions before AMD PerfMonV2. pmu_version == 2 corresponds to AMD PerfMonV2. Signed-off-by: Dongli Zhang Reviewed-by: Dapeng Mi Reviewed-by: Zhao Liu --- Changed since v2: - Change

[PATCH v5 01/10] target/i386: disable PerfMonV2 when PERFCORE unavailable

2025-04-25 Thread Dongli Zhang
idge perf ctrs = 0x0 (0) number of available UMC PMCs = 0x0 (0) active UMCs bitmask = 0x0 Disable PerfMonV2 in CPUID when PERFCORE is disabled. Suggested-by: Zhao Liu Fixes: 209b0ac12074 ("target/i386: Add PerfMonV2 feature bit") Signed-off-by: D

[PATCH v5 03/10] kvm: Introduce kvm_arch_pre_create_vcpu()

2025-04-25 Thread Dongli Zhang
Acked-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrangé Signed-off-by: Dongli Zhang Reviewed-by: Zhao Liu --- Changed since v2: - Add my Signed-off-by. Changed since v3: - Pick new reviewed version from: https://lore.kernel.org/all/20250401130205.2198253-8-xiaoyao...@intel.com/ I have fixed

[PATCH v5 10/10] target/i386/kvm: don't stop Intel PMU counters

2025-04-25 Thread Dongli Zhang
ting PMC. This approach is true since Linux kernel commit 68fb4757e867 ("KVM: x86/pmu: Defer reprogram_counter() to kvm_pmu_handle_event"), that is, v6.2. No Fixed tag is going to be added for the commit 0d89436786b0 ("kvm: migrate vPMU state"), because this isn't a bug

Re: [PATCH v3 10/10] target/i386/kvm: don't stop Intel PMU counters

2025-04-10 Thread Dongli Zhang
Hi Zhao, On 4/10/25 2:45 AM, Zhao Liu wrote: > On Sun, Mar 30, 2025 at 06:32:29PM -0700, Dongli Zhang wrote: >> Date: Sun, 30 Mar 2025 18:32:29 -0700 >> From: Dongli Zhang >> Subject: [PATCH v3 10/10] target/i386/kvm: don't stop Intel PMU counters >> X-Mailer:

Re: Trying cpr

2025-04-21 Thread Dongli Zhang
inux.git/commit/?id=c52ffadc65e28ab461fd055e9991e8d8106a0056 David Woodhouse has a patchset related to kvmclock and live migration. [RFC PATCH v3 00/21] Cleaning up the KVM clock mess https://lore.kernel.org/all/20240522001817.619072-1-dw...@infradead.org/ Maciej also fixed a similar clock unsta

[PATCH v2 08/10] target/i386/kvm: reset AMD PMU registers during VM reset

2025-03-02 Thread Dongli Zhang
sues, we propose resetting AMD PMU registers during the VM reset process. Signed-off-by: Dongli Zhang --- Changed since v1: - Modify "MSR_K7_EVNTSEL0 + 3" and "MSR_K7_PERFCTR0 + 3" by using AMD64_NUM_COUNTERS (suggested by Sandipan Das). - Use "AMD64_NUM_COUNTE

[PATCH v2 09/10] target/i386/kvm: support perfmon-v2 for reset

2025-03-02 Thread Dongli Zhang
tus. - MSR_CORE_PERF_GLOBAL_CTRL and MSR_AMD64_PERF_CNTR_GLOBAL_CTL both use env->msr_global_ctrl. - MSR_CORE_PERF_GLOBAL_OVF_CTRL and MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR both use env->msr_global_ovf_ctrl. No changes are needed for vmstate_msr_architectural_pmu or pmu_enable_needed(). Signed-off-by: Dongli Zhang --

[PATCH v2 00/10] target/i386/kvm/pmu: PMU Enhancement, Bugfix and Cleanup

2025-03-02 Thread Dongli Zhang
uot;-pmu" but not a global "pmu-cap-disabled" for KVM_PMU_CAP_DISABLE. - Also use sysfs kvm.enable_pmu=N to determine if PMU is supported. - Some changes to PMU register limit calculation. Xiaoyao Li (1): kvm: Introduce kvm_arch_pre_create_vcpu() Dongli Zhang (9): target/i386:

[PATCH v2 05/10] target/i386/kvm: extract unrelated code out of kvm_x86_build_cpuid()

2025-03-02 Thread Dongli Zhang
The initialization of 'has_architectural_pmu_version', 'num_architectural_pmu_gp_counters', and 'num_architectural_pmu_fixed_counters' is unrelated to the process of building the CPUID. Extract them out of kvm_x86_build_cpuid(). No functional change. Signed-off

[PATCH v2 02/10] target/i386: disable PERFCORE when "-pmu" is configured

2025-03-02 Thread Dongli Zhang
g on env->features[] in future patches. Suggested-by: Zhao Liu Signed-off-by: Dongli Zhang --- target/i386/cpu.c | 4 1 file changed, 4 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index b6d6167910..61a671028a 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c

[PATCH v2 06/10] target/i386/kvm: rename architectural PMU variables

2025-03-02 Thread Dongli Zhang
, the meaning of has_pmu_version remains unchanged. For AMD processors: has_pmu_version == 1 corresponds to versions before AMD PerfMonV2. has_pmu_version == 2 corresponds to AMD PerfMonV2. Signed-off-by: Dongli Zhang --- target/i386/kvm/kvm.c | 49 --- 1

<    1   2   3   >