Re: [PATCH v4 9/9] target/i386/kvm: Replace ARRAY_SIZE(msr_handlers) with KVM_MSR_FILTER_MAX_RANGES

2024-07-18 Thread Chen, Zide
On 7/16/2024 9:10 AM, Zhao Liu wrote: > kvm_install_msr_filters() uses KVM_MSR_FILTER_MAX_RANGES as the bound > when traversing msr_handlers[], while other places still compute the > size by ARRAY_SIZE(msr_handlers). > > In fact, msr_handlers[] is an array with the fixed size > KVM_MSR_FILTER_M

Re: [PATCH v4 8/9] target/i386/kvm: Clean up error handling in kvm_arch_init()

2024-07-18 Thread Chen, Zide
On 7/16/2024 9:10 AM, Zhao Liu wrote: > Currently, there're following incorrect error handling cases in > kvm_arch_init(): > * Missed to handle failure of kvm_get_supported_feature_msrs(). > * Missed to return when KVM_CAP_X86_DISABLE_EXITS enabling fails. > * MSR filter related cases called exi

Re: [PATCH v4 7/9] target/i386/kvm: Clean up return values of MSR filter related functions

2024-07-18 Thread Chen, Zide
On 7/16/2024 9:10 AM, Zhao Liu wrote: > At present, the error code of MSR filter enablement attempts to print in > error_report(). > > Unfortunately, this behavior doesn't work because the MSR filter-related > functions return the boolean and current error_report() use the wrong > return value.

Re: [PATCH v4 4/9] target/i386/kvm: Save/load MSRs of kvmclock2 (KVM_FEATURE_CLOCKSOURCE2)

2024-07-18 Thread Chen, Zide
On 7/16/2024 9:10 AM, Zhao Liu wrote: > MSR_KVM_SYSTEM_TIME_NEW and MSR_KVM_WALL_CLOCK_NEW are bound to > kvmclock2 (KVM_FEATURE_CLOCKSOURCE2). > > Add the save/load support for these 2 MSRs just like kvmclock MSRs. > > Signed-off-by: Zhao Liu Reviewed-by: Zide Chen > --- > target/i386/cp

Re: [PATCH v4 5/9] target/i386/kvm: Drop workaround for KVM_X86_DISABLE_EXITS_HTL typo

2024-07-18 Thread Chen, Zide
On 7/16/2024 9:10 AM, Zhao Liu wrote: > The KVM_X86_DISABLE_EXITS_HTL typo has been fixed in commit > 77d361b13c19 ("linux-headers: Update to kernel mainline commit > b357bf602"). > > Drop the related workaround. > > Signed-off-by: Zhao Liu Reviewed-by: Zide Chen > --- > target/i386/kvm/k

Re: [PATCH v4 3/9] target/i386/kvm: Only save/load kvmclock MSRs when kvmclock enabled

2024-07-18 Thread Chen, Zide
On 7/16/2024 9:10 AM, Zhao Liu wrote: > MSR_KVM_SYSTEM_TIME and MSR_KVM_WALL_CLOCK are attached with the (old) > kvmclock feature (KVM_FEATURE_CLOCKSOURCE). > > So, just save/load them only when kvmclock (KVM_FEATURE_CLOCKSOURCE) is > enabled. > > Signed-off-by: Zhao Liu Reviewed-by: Zide C

Re: [PATCH v4 1/9] target/i386/kvm: Add feature bit definitions for KVM CPUID

2024-07-18 Thread Chen, Zide
On 7/16/2024 9:10 AM, Zhao Liu wrote: > Add feature definitions for KVM_CPUID_FEATURES in CPUID ( > CPUID[4000_0001].EAX and CPUID[4000_0001].EDX), to get rid of lots of > offset calculations. > > Signed-off-by: Zhao Liu Reviewed-by: zide.c...@intel.com > --- > v3: Resolved a rebasing confl

Re: [PATCH v4 2/9] target/i386/kvm: Remove local MSR_KVM_WALL_CLOCK and MSR_KVM_SYSTEM_TIME definitions

2024-07-18 Thread Chen, Zide
On 7/16/2024 9:10 AM, Zhao Liu wrote: > These 2 MSRs have been already defined in kvm_para.h (standard-headers/ > asm-x86/kvm_para.h). > > Remove QEMU local definitions to avoid duplication. > > Reviewed-by: Xiaoyao Li > Signed-off-by: Zhao Liu Reviewed-by: zide.c...@intel.com > --- > ta

Re: [PATCH v3 7/8] target/i386/kvm: Clean up return values of MSR filter related functions

2024-07-15 Thread Chen, Zide
On 7/14/2024 9:49 PM, Zhao Liu wrote: > @@ -5274,13 +5272,13 @@ void kvm_arch_update_guest_debug(CPUState *cpu, > struct kvm_guest_debug *dbg) > } > } > > -static bool kvm_install_msr_filters(KVMState *s) > +static int kvm_install_msr_filters(KVMState *s) > { > uint64_t zero = 0;

Re: [PATCH V3 0/2] improve -overcommit cpu-pm=on|off

2024-06-05 Thread Chen, Zide
On 6/5/2024 6:49 AM, Igor Mammedov wrote: > On Mon, 3 Jun 2024 17:02:20 -0700 > Zide Chen wrote: > >> Currently, if running "-overcommit cpu-pm=on" on hosts that don't >> have MWAIT support, the MWAIT/MONITOR feature is advertised to the >> guest and executing MWAIT/MONITOR on the guest trigg

Re: [PATCH V2 2/3] target/i386: call cpu_exec_realizefn before x86_cpu_filter_features

2024-06-05 Thread Chen, Zide
On 6/5/2024 8:07 AM, Igor Mammedov wrote: > On Mon, 3 Jun 2024 14:29:50 -0700 > "Chen, Zide" wrote: > >> On 6/3/2024 2:30 AM, Igor Mammedov wrote: >>> On Sat, 1 Jun 2024 23:26:55 +0800 >>> Zhao Liu wrote: >>> >>>> On Fri,

Re: [PATCH V2 2/3] target/i386: call cpu_exec_realizefn before x86_cpu_filter_features

2024-06-03 Thread Chen, Zide
On 6/3/2024 2:30 AM, Igor Mammedov wrote: > On Sat, 1 Jun 2024 23:26:55 +0800 > Zhao Liu wrote: > >> On Fri, May 31, 2024 at 10:13:47AM -0700, Chen, Zide wrote: >>> Date: Fri, 31 May 2024 10:13:47 -0700 >>> From: "Chen, Zide" >&g

Re: [PATCH V2 2/3] target/i386: call cpu_exec_realizefn before x86_cpu_filter_features

2024-06-03 Thread Chen, Zide
On 6/1/2024 8:26 AM, Zhao Liu wrote: > On Fri, May 31, 2024 at 10:13:47AM -0700, Chen, Zide wrote: >> Date: Fri, 31 May 2024 10:13:47 -0700 >> From: "Chen, Zide" >> Subject: Re: [PATCH V2 2/3] target/i386: call cpu_exec_realizefn before >> x86_cpu_filter

Re: [PATCH V2 2/3] target/i386: call cpu_exec_realizefn before x86_cpu_filter_features

2024-05-31 Thread Chen, Zide
On 5/30/2024 11:30 PM, Zhao Liu wrote: > Hi Zide, > > On Fri, May 24, 2024 at 01:00:16PM -0700, Zide Chen wrote: >> Date: Fri, 24 May 2024 13:00:16 -0700 >> From: Zide Chen >> Subject: [PATCH V2 2/3] target/i386: call cpu_exec_realizefn before >> x86_cpu_filter_features >> X-Mailer: git-send-

Re: [PATCH V2 3/3] target/i386: Move host_cpu_enable_cpu_pm into kvm_cpu_realizefn()

2024-05-31 Thread Chen, Zide
On 5/30/2024 11:53 PM, Zhao Liu wrote: > On Fri, May 24, 2024 at 01:00:17PM -0700, Zide Chen wrote: >> Date: Fri, 24 May 2024 13:00:17 -0700 >> From: Zide Chen >> Subject: [PATCH V2 3/3] target/i386: Move host_cpu_enable_cpu_pm into >> kvm_cpu_realizefn() >> X-Mailer: git-send-email 2.34.1 >>

Re: [PATCH V2 0/3] improve -overcommit cpu-pm=on|off

2024-05-30 Thread Chen, Zide
On 5/30/2024 6:54 AM, Zhao Liu wrote: > Hi Zide, > > On Wed, May 29, 2024 at 10:31:21AM -0700, Chen, Zide wrote: >> Date: Wed, 29 May 2024 10:31:21 -0700 >> From: "Chen, Zide" >> Subject: Re: [PATCH V2 0/3] improve -overcommit cpu-pm=on|off >> &

Re: [PATCH V2 0/3] improve -overcommit cpu-pm=on|off

2024-05-29 Thread Chen, Zide
On 5/29/2024 5:46 AM, Igor Mammedov wrote: > On Tue, 28 May 2024 11:16:59 -0700 > "Chen, Zide" wrote: > >> On 5/28/2024 2:23 AM, Igor Mammedov wrote: >>> On Fri, 24 May 2024 13:00:14 -0700 >>> Zide Chen wrote: >>> >>>> C

Re: [PATCH V2 0/3] improve -overcommit cpu-pm=on|off

2024-05-28 Thread Chen, Zide
On 5/28/2024 2:23 AM, Igor Mammedov wrote: > On Fri, 24 May 2024 13:00:14 -0700 > Zide Chen wrote: > >> Currently, if running "-overcommit cpu-pm=on" on hosts that don't >> have MWAIT support, the MWAIT/MONITOR feature is advertised to the >> guest and executing MWAIT/MONITOR on the guest trig

Re: [PATCH 1/3] vl: Allow multiple -overcommit commands

2024-05-21 Thread Chen, Zide
On 5/20/2024 10:16 PM, Thomas Huth wrote: > On 21/05/2024 07.08, Thomas Huth wrote: >> On 20/05/2024 19.47, Zide Chen wrote: >>> Both cpu-pm and mem-lock are related to system resource overcommit, but >>> they are separate from each other, in terms of how they are realized, >>> and of course, th

Re: [PATCH 1/3] vl: Allow multiple -overcommit commands

2024-05-20 Thread Chen, Zide
On 5/20/2024 10:16 PM, Thomas Huth wrote: > On 21/05/2024 07.08, Thomas Huth wrote: >> On 20/05/2024 19.47, Zide Chen wrote: >>> Both cpu-pm and mem-lock are related to system resource overcommit, but >>> they are separate from each other, in terms of how they are realized, >>> and of course, th

Re: [PATCH 1/3] vl: Allow multiple -overcommit commands

2024-05-20 Thread Chen, Zide
On 5/20/2024 10:16 PM, Thomas Huth wrote: > On 21/05/2024 07.08, Thomas Huth wrote: >> On 20/05/2024 19.47, Zide Chen wrote: >>> Both cpu-pm and mem-lock are related to system resource overcommit, but >>> they are separate from each other, in terms of how they are realized, >>> and of course, th

Re: [PATCH 1/6] target/i386/kvm: Add feature bit definitions for KVM CPUID

2024-04-26 Thread Chen, Zide
On 4/26/2024 3:07 AM, Zhao Liu wrote: > Add feature definiations for KVM_CPUID_FEATURES in CPUID ( > CPUID[4000_0001].EAX and CPUID[4000_0001].EDX), to get rid of lots of > offset calculations. > > Signed-off-by: Zhao Liu > --- > v2: Changed the prefix from CPUID_FEAT_KVM_* to CPUID_KVM_*. (Xi