[PATCH 3/5] target-i386: kvm: Simplify MSR array construction

2015-12-16 Thread Eduardo Habkost
Add a helper function that appends new entries to the MSR buffer and checks for the buffer size limit. Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- target-i386/kvm.c | 262 ++ 1 file changed, 125 insertions(+), 137 del

[PATCH 4/5] target-i386: kvm: Simplify MSR setting functions

2015-12-16 Thread Eduardo Habkost
Simplify kvm_put_tscdeadline_msr() and kvm_put_msr_feature_control() using kvm_msr_buf and the kvm_msr_entry_add() helper. Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- target-i386/kvm.c | 28 ++-- 1 file changed, 6 insertions(+), 22 deletions(-) diff

[PATCH 5/5] target-i386: kvm: Eliminate kvm_msr_entry_set()

2015-12-16 Thread Eduardo Habkost
Inline the function inside kvm_msr_entry_add(). Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- target-i386/kvm.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 3550866..b328392 100644 --- a/target-i386

[PATCH 2/5] target-i386: kvm: Increase MSR_BUF_SIZE

2015-12-16 Thread Eduardo Habkost
kvm_msr_entry structs. Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- target-i386/kvm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 660b2d9..1e82400 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -52,8

[PATCH 0/5] target-i386: kvm: Increase MSR entry array limits, check for array overrun

2015-12-16 Thread Eduardo Habkost
efinitions, and adding a helper macro to keep track of the kvm_msr_entry_set() calls. The code can be seen at: https://gist.github.com/ehabkost/08d4177a33b8648a71ef Eduardo Habkost (5): target-i386: kvm: Allocate kvm_msrs struct once per VCPU target-i386: kvm: Increase MSR_BUF_SIZE target

[PATCH 1/5] target-i386: kvm: Allocate kvm_msrs struct once per VCPU

2015-12-16 Thread Eduardo Habkost
Instead of using 2400 bytes in the stack for 150 MSR entries in kvm_get_msrs() and kvm_put_msrs(), allocate a buffer once for each VCPU. Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- target-i386/cpu-qom.h | 4 target-i386/kvm.c | 37 +++---

Re: [Qemu-devel] [Patch V2 1/2] x86, mce: Basic support to add LMCE support to QEMU

2015-12-15 Thread Eduardo Habkost
On Mon, Dec 14, 2015 at 07:17:27PM -0500, Raj, Ashok wrote: > On Mon, Dec 14, 2015 at 11:37:16PM +0100, Borislav Petkov wrote: > > On Mon, Dec 14, 2015 at 02:11:46PM -0500, Raj, Ashok wrote: > > > This is mostly harmless.. since the MCG_CAP space is shared and has no > > > conflict between

Re: [Qemu-devel] [Patch V2 1/2] x86, mce: Basic support to add LMCE support to QEMU

2015-12-14 Thread Eduardo Habkost
Hi, Comments below: On Thu, Dec 10, 2015 at 02:41:21PM -0500, Ashok Raj wrote: > This patch adds basic enumeration, control msr's required to support > Local Machine Check Exception Support (LMCE). > > - Added Local Machine Check definitions, changed MCG_CAP > - Added support for

Re: [Qemu-devel] [Patch V2 1/2] x86, mce: Basic support to add LMCE support to QEMU

2015-12-14 Thread Eduardo Habkost
On Mon, Dec 14, 2015 at 02:11:46PM -0500, Raj, Ashok wrote: > On Mon, Dec 14, 2015 at 05:37:38PM +0100, Borislav Petkov wrote: > > > > ... and obviously LMCE is vendor-specific so it cannot be enabled on > > !Intel guests with a define like that. mce_init() in qemu should check > > vendor too. >

[PATCH v3 2/3] target-i386: Use xsave structs for ext_save_area

2015-12-04 Thread Eduardo Habkost
-by: Eduardo Habkost <ehabk...@redhat.com> --- Changes series v1 -> v2 * (none) Changes series v2 -> v3: * Added PKRU state --- target-i386/cpu.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index a3de18d..c4

[PATCH v3 0/3] target-i386: Use C struct for xsave area layout, offsets & sizes

2015-12-04 Thread Eduardo Habkost
eep the QEMU_BUILD_BUG_ON lines Changes v2 -> v3: * XMM_Q helper is now ZMM_Q * Added PKRU state Eduardo Habkost (3): target-i386: Define structs for layout of xsave area target-i386: Use xsave structs for ext_save_area target-i386: kvm: Use X86XSaveArea struct for xsave save/load target-i386/cpu.c

[PATCH v3 1/3] target-i386: Define structs for layout of xsave area

2015-12-04 Thread Eduardo Habkost
Add structs that define the layout of the xsave areas used by Intel processors. Add some QEMU_BUILD_BUG_ON lines to ensure the structs match the XSAVE_* macros in target-i386/kvm.c and the offsets and sizes at target-i386/cpu.c:ext_save_areas. Signed-off-by: Eduardo Habkost <ehabk...@redhat.

[PATCH v3 3/3] target-i386: kvm: Use X86XSaveArea struct for xsave save/load

2015-12-04 Thread Eduardo Habkost
Instead of using offset macros and bit operations in a uint32_t array, use the X86XSaveArea struct to perform the loading/saving operations in kvm_put_xsave() and kvm_get_xsave(). Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- Changes v1 -> v2: * Use uint8_t pointers when loadi

Re: [Qemu-devel] [PATCH v3 0/3] target-i386: add memory protection-key support

2015-12-04 Thread Eduardo Habkost
blic/us/en/documents/manuals/64-ia-32-architectures-software-developer-manual-325462.pdf. Reviewed-by: Eduardo Habkost <ehabk...@redhat.com> The patches were squashed together and queued in x86-next branch for 2.6. > > Huaitong Han (3): > target-i386: add pkeys support for

Re: [Qemu-devel] [for-2.6 PATCH 1/3] target-i386: Define structs for layout of xsave area

2015-12-01 Thread Eduardo Habkost
On Tue, Dec 01, 2015 at 09:09:47AM -0800, Richard Henderson wrote: > On 11/30/2015 03:18 AM, Paolo Bonzini wrote: > >Because this is always little endian, I would write it as uint8_t[16][16]. > > Maybe. That isn't altogether handy for TCG, since we'll be wanting to bswap > these buffers

Re: [Qemu-devel] [for-2.6 PATCH 1/3] target-i386: Define structs for layout of xsave area

2015-12-01 Thread Eduardo Habkost
On Tue, Dec 01, 2015 at 06:27:17PM +0100, Paolo Bonzini wrote: > On 01/12/2015 18:20, Richard Henderson wrote: > >> > >> X86XSaveArea will be used only when loading/saving state using > >> xsave, not for executing regular instructions. > > > > ... like the regular instruction xsave? > > > >

Re: [PATCH v2 0/3] target-i386: Use C struct for xsave area layout, offsets & sizes

2015-12-01 Thread Eduardo Habkost
On Tue, Dec 01, 2015 at 11:22:31AM +0100, Paolo Bonzini wrote: > On 30/11/2015 18:34, Eduardo Habkost wrote: > > target-i386/cpu.c:ext_save_area uses magic numbers for the xsave > > area offets and sizes, and target-i386/kvm.c:kvm_{put,get}_xsave() > > uses offset macros

Re: [PATCH v2 0/3] target-i386: Use C struct for xsave area layout, offsets & sizes

2015-12-01 Thread Eduardo Habkost
On Tue, Dec 01, 2015 at 04:09:44PM +0100, Paolo Bonzini wrote: > > > On 30/11/2015 18:34, Eduardo Habkost wrote: > > target-i386/cpu.c:ext_save_area uses magic numbers for the xsave > > area offets and sizes, and target-i386/kvm.c:kvm_{put,get}_xsave() > > uses offset

[PATCH v2 0/3] target-i386: Use C struct for xsave area layout, offsets & sizes

2015-11-30 Thread Eduardo Habkost
+8); +env->xmm_regs[i].XMM_Q(4) = ldq_p(zmmh); + env->xmm_regs[i].XMM_Q(5) = ldq_p(zmmh+8); +env->xmm_regs[i].XMM_Q(6) = ldq_p(zmmh+16); +env->xmm_regs[i].XMM_Q(7) = ldq_p(zmmh+24); } #ifdef TARGET_X86_64 Eduardo Habkost (3): target-i386:

[PATCH v2 3/3] target-i386: kvm: Use X86XSaveArea struct for xsave save/load

2015-11-30 Thread Eduardo Habkost
Instead of using offset macros and bit operations in a uint32_t array, use the X86XSaveArea struct to perform the loading/saving operations in kvm_put_xsave() and kvm_get_xsave(). Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- Changes v1 -> v2: * Use uint8_t pointers when loadi

[PATCH v2 1/3] target-i386: Define structs for layout of xsave area

2015-11-30 Thread Eduardo Habkost
Add structs that define the layout of the xsave areas used by Intel processors. Add some QEMU_BUILD_BUG_ON lines to ensure the structs match the XSAVE_* macros in target-i386/kvm.c and the offsets and sizes at target-i386/cpu.c:ext_save_areas. Signed-off-by: Eduardo Habkost <ehabk...@redhat.

[PATCH v2 2/3] target-i386: Use xsave structs for ext_save_area

2015-11-30 Thread Eduardo Habkost
-by: Eduardo Habkost <ehabk...@redhat.com> --- target-i386/cpu.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 11e5e39..bc95437 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -458,17 +458,23 @@ typedef

Re: [for-2.6 PATCH 0/3] target-i386: Use C struct for xsave area layout, offsets & sizes

2015-11-30 Thread Eduardo Habkost
On Mon, Nov 30, 2015 at 12:21:23PM +0100, Paolo Bonzini wrote: > > > On 28/11/2015 20:56, Eduardo Habkost wrote: > > I still need to figure out a way to write unit tests for the new > > code. Maybe I will just copy and paste the new and old functions, > > and

Re: [for-2.6 PATCH 1/3] target-i386: Define structs for layout of xsave area

2015-11-30 Thread Eduardo Habkost
On Mon, Nov 30, 2015 at 12:18:33PM +0100, Paolo Bonzini wrote: > On 28/11/2015 20:56, Eduardo Habkost wrote: > > +/* Ext. save area 2: AVX State */ > > +typedef struct XSaveAVX { > > +uint64_t ymmh[16][2]; > > +} XSaveAVX; > > + > > Because this

Re: [Qemu-devel] [PATCH v6 3/3] target-i386: add support to migrate vcpu's TSC rate

2015-11-28 Thread Eduardo Habkost
On Fri, Nov 27, 2015 at 08:16:42AM +0800, Haozhong Zhang wrote: > On 11/26/15 12:19, Eduardo Habkost wrote: > > On Tue, Nov 24, 2015 at 11:33:57AM +0800, Haozhong Zhang wrote: > > > This patch enables migrating vcpu's TSC rate. If KVM on the destination > > > machine

[for-2.6 PATCH 3/3] target-i386: kvm: Use X86XSaveArea struct for xsave save/load

2015-11-28 Thread Eduardo Habkost
Instead of using offset macros and bit operations in a uint32_t array, use the X86XSaveArea struct to perform the loading/saving operations in kvm_put_xsave() and kvm_get_xsave(). Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- target-i386/kvm.c

[for-2.6 PATCH 1/3] target-i386: Define structs for layout of xsave area

2015-11-28 Thread Eduardo Habkost
Add structs that define the layout of the xsave areas used by Intel processors. Add some QEMU_BUILD_BUG_ON lines to ensure the structs match the XSAVE_* macros in target-i386/kvm.c and the offsets and sizes at target-i386/cpu.c:ext_save_areas. Signed-off-by: Eduardo Habkost <ehabk...@redhat.

[for-2.6 PATCH 0/3] target-i386: Use C struct for xsave area layout, offsets & sizes

2015-11-28 Thread Eduardo Habkost
to write unit tests for the new code. Maybe I will just copy and paste the new and old functions, and test them locally (checking if they give the same results when translating blobs of random bytes). Eduardo Habkost (3): target-i386: Define structs for layout of xsave area target-i386: Use

[for-2.6 PATCH 2/3] target-i386: Use xsave structs for ext_save_area

2015-11-28 Thread Eduardo Habkost
-by: Eduardo Habkost <ehabk...@redhat.com> --- target-i386/cpu.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 11e5e39..bc95437 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -458,17 +458,23 @@ typedef

Re: [PATCH v6 1/3] target-i386: fallback vcpu's TSC rate to value returned by KVM

2015-11-26 Thread Eduardo Habkost
tches to enable migrating vcpu's TSC rate. > > Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> Reviewed-by: Eduardo Habkost <ehabk...@redhat.com> > --- > target-i386/kvm.c | 14 ++ > 1 file changed, 14 insertions(+) > > diff --git a/targe

Re: [PATCH v6 2/3] target-i386: reorganize TSC rate setting code

2015-11-26 Thread Eduardo Habkost
lack of TSC scaling never failed kvm_arch_init_vcpu(), >* the failure of KVM_SET_TSC_KHZ failed kvm_arch_init_vcpu() > unconditionally, even though the TSC rate to be set is identical > to the value currently used by KVM. > > Signed-off-by: Haozhong Zhang <haoz

Re: [PATCH v6 3/3] target-i386: add support to migrate vcpu's TSC rate

2015-11-26 Thread Eduardo Habkost
), because the patch will be included after QEMU 2.5.0: Reviewed-by: Eduardo Habkost <ehabk...@redhat.com> One comment below: > --- [...] > diff --git a/target-i386/kvm.c b/target-i386/kvm.c > index 1e811ee..2a0fd54 100644 > --- a/target-i386/kvm.c > +++ b/target-i386/kvm.c &

Re: [PATCH 3/3] target-i386: kvm: Print warning when clearing mcg_cap bits

2015-11-25 Thread Eduardo Habkost
On Wed, Nov 25, 2015 at 05:45:20PM +0100, Paolo Bonzini wrote: > On 25/11/2015 16:49, Eduardo Habkost wrote: > > Instead of silently clearing mcg_cap bits when the host doesn't > > support them, print a warning when doing that. > > > > Signed-off-by: Eduardo H

[PATCH 3/3] target-i386: kvm: Print warning when clearing mcg_cap bits

2015-11-25 Thread Eduardo Habkost
Instead of silently clearing mcg_cap bits when the host doesn't support them, print a warning when doing that. Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- target-i386/kvm.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/target-i386/kvm.c b/targe

[PATCH 2/3] target-i386: kvm: Use env->mcg_cap when setting up MCE

2015-11-25 Thread Eduardo Habkost
e_init() in the future, to implement different defaults depending on CPU model, machine-type or command-line parameters. Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- target-i386/cpu.h | 2 ++ target-i386/kvm.c | 11 --- 2 files changed, 6 insertions(+), 7 deletions(-) diff --

[PATCH 1/3] target-i386: kvm: Abort if MCE bank count is not supported by host

2015-11-25 Thread Eduardo Habkost
KVM_CAP_MCE was introduced, so no behavior is being changed and the error can't be triggered by any Linux version. The point of the new check is to ensure we won't silently change the bank count if we change MCE_BANKS_DEF or make the bank count configurable in the future. Signed-off-by: Eduardo Habkost

[PATCH 0/3] target-i386: kvm: Use env->mcg_cap when setting up MCE

2015-11-25 Thread Eduardo Habkost
faults depending on CPU model, machine-type or command-line parameters. Eduardo Habkost (3): target-i386: kvm: Abort if MCE bank count is not supported by host target-i386: kvm: Use env->mcg_cap when setting up MCE target-i386: kvm: Print warning when clearing mcg_cap bits target-i386/

Re: [PATCH 1/3] target-i386: kvm: Abort if MCE bank count is not supported by host

2015-11-25 Thread Eduardo Habkost
On Wed, Nov 25, 2015 at 05:46:38PM +0100, Paolo Bonzini wrote: > > > On 25/11/2015 16:49, Eduardo Habkost wrote: > > Instead of silently changing the number of banks in mcg_cap based > > on kvm_get_mce_cap_supported(), abort initialization if the host > > doesn't

Re: [PATCH v6 1/3] target-i386: fallback vcpu's TSC rate to value returned by KVM

2015-11-25 Thread Eduardo Habkost
tches to enable migrating vcpu's TSC rate. > > Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> Reviewed-by: Eduardo Habkost <ehabk...@redhat.com> > --- > target-i386/kvm.c | 14 ++ > 1 file changed, 14 insertions(+) > > diff --git a/targe

Re: MCG_CAP ABI breakage (was Re: [Qemu-devel] [PATCH] target-i386: Do not set MCG_SER_P by default)

2015-11-24 Thread Eduardo Habkost
On Mon, Nov 23, 2015 at 05:43:14PM +0100, Borislav Petkov wrote: > On Mon, Nov 23, 2015 at 01:11:27PM -0200, Eduardo Habkost wrote: > > On Mon, Nov 23, 2015 at 11:22:37AM -0200, Eduardo Habkost wrote: > > [...] > > > In the case of this code, it looks like it's alre

Re: MCG_CAP ABI breakage (was Re: [Qemu-devel] [PATCH] target-i386: Do not set MCG_SER_P by default)

2015-11-23 Thread Eduardo Habkost
On Mon, Nov 23, 2015 at 05:43:14PM +0100, Borislav Petkov wrote: > On Mon, Nov 23, 2015 at 01:11:27PM -0200, Eduardo Habkost wrote: > > On Mon, Nov 23, 2015 at 11:22:37AM -0200, Eduardo Habkost wrote: > > [...] > > > In the case of this code, it looks like it's alre

Re: [PATCH] target-i386: Do not set MCG_SER_P by default

2015-11-23 Thread Eduardo Habkost
On Sat, Nov 21, 2015 at 02:09:25AM +0100, Borislav Petkov wrote: > On Sat, Nov 21, 2015 at 12:11:35AM +0100, Andreas Färber wrote: > > Hi, > > > > CC'ing qemu-devel. > > Ah, thanks. > > > Am 21.11.2015 um 00:01 schrieb Borislav Petkov: > > > From: Borislav Petkov > > > > > >

MCG_CAP ABI breakage (was Re: [Qemu-devel] [PATCH] target-i386: Do not set MCG_SER_P by default)

2015-11-23 Thread Eduardo Habkost
On Mon, Nov 23, 2015 at 11:22:37AM -0200, Eduardo Habkost wrote: [...] > In the case of this code, it looks like it's already broken > because the resulting mcg_cap depends on host kernel capabilities > (the ones reported by kvm_get_mce_cap_supported()), and the data > initialized by

Re: [Qemu-devel] [PATCH v3 1/3] target-i386: add pkeys support for cpuid handling

2015-11-19 Thread Eduardo Habkost
On Thu, Nov 19, 2015 at 12:10:49PM +0100, Paolo Bonzini wrote: > > > On 19/11/2015 07:36, Han, Huaitong wrote: > > I understand it has always been that QEMU considers the feature of > > cpuid_7_0_ecx_feature_name as migratable. If the feature is > > unmigratable, it will been added to

Re: [Qemu-devel] [PATCH v3 1/3] target-i386: add pkeys support for cpuid handling

2015-11-18 Thread Eduardo Habkost
On Wed, Nov 18, 2015 at 10:20:15AM +0800, Huaitong Han wrote: [...] > @@ -408,6 +420,13 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] > = { > .cpuid_reg = R_EBX, > .tcg_features = TCG_7_0_EBX_FEATURES, > }, > +[FEAT_7_0_ECX] = { > +.feat_names =

Re: [Qemu-devel] [PATCH v3 0/3] target-i386: add memory protection-key support

2015-11-18 Thread Eduardo Habkost
On Wed, Nov 18, 2015 at 10:20:14AM +0800, Huaitong Han wrote: > Changes in v3: > *Fix cpuid_7_0_ecx_feature_name error. > > Changes in v2: > *Fix memcpy error for xsave state. > *Fix TCG_7_0_ECX_FEATURES to 0. > *Make subjects more readable. > > The protection-key feature provides an additional

Re: [PATCH v8 0/5] implement vNVDIMM

2015-11-18 Thread Eduardo Habkost
On Wed, Nov 18, 2015 at 09:59:34AM +0800, Xiao Guangrong wrote: > > Ping... > > Do you have any comment on this patchset? Could it be applied to somewhere > if it is okay for you? I have no additional comments, as the memory-backend patches I was reviewing are not included in this version. I

Re: [PATCH v5 2/3] target-i386: reorganize TSC rate setting code

2015-11-17 Thread Eduardo Habkost
On Tue, Nov 17, 2015 at 01:20:38PM +0800, Haozhong Zhang wrote: > Following two changes are made to the TSC rate setting code in > kvm_arch_init_vcpu(): > * The code is moved to a new function kvm_arch_set_tsc_khz(). > * If setting user-specified TSC rate fails and the host TSC rate is >

Re: [PATCH v5 1/3] target-i386: fallback vcpu's TSC rate to value returned by KVM

2015-11-17 Thread Eduardo Habkost
On Tue, Nov 17, 2015 at 01:20:37PM +0800, Haozhong Zhang wrote: > If no user-specified TSC rate is present, we will try to set > env->tsc_khz to the value returned by KVM_GET_TSC_KHZ. > > Signed-off-by: Haozhong Zhang > --- > target-i386/kvm.c | 12 > 1

Re: [PATCH v5 3/3] target-i386: add support to migrate vcpu's TSC rate

2015-11-17 Thread Eduardo Habkost
Hi, On Tue, Nov 17, 2015 at 01:20:39PM +0800, Haozhong Zhang wrote: > This patch enables migrating vcpu's TSC rate. If KVM on the destination > machine supports TSC scaling, guest programs will observe a consistent > TSC rate across the migration. > > If TSC scaling is not supported on the

Re: [PATCH v5 2/3] target-i386: reorganize TSC rate setting code

2015-11-17 Thread Eduardo Habkost
On Tue, Nov 17, 2015 at 10:07:53PM +0800, Haozhong Zhang wrote: > On 11/17/15 11:32, Eduardo Habkost wrote: > > On Tue, Nov 17, 2015 at 01:20:38PM +0800, Haozhong Zhang wrote: > > > Following two changes are made to the TSC rate setting code in > > > kvm_arch_ini

Re: [PATCH v4 2/2] target-i386: add support to migrate vcpu's TSC rate

2015-11-16 Thread Eduardo Habkost
On Mon, Nov 16, 2015 at 10:30:08PM +0800, Haozhong Zhang wrote: > On 11/16/15 11:43, Eduardo Habkost wrote: > > On Mon, Nov 16, 2015 at 04:04:08PM +0800, Haozhong Zhang wrote: > > > This patch enables migrating vcpu's TSC rate. If KVM on the destination > > > machine

Re: [PATCH v4 2/2] target-i386: add support to migrate vcpu's TSC rate

2015-11-16 Thread Eduardo Habkost
On Mon, Nov 16, 2015 at 04:04:08PM +0800, Haozhong Zhang wrote: > This patch enables migrating vcpu's TSC rate. If KVM on the destination > machine supports TSC scaling, guest programs will observe a consistent > TSC rate across the migration. > > If TSC scaling is not supported on the

Re: [PATCH v4 1/2] target-i386: fallback vcpu's TSC rate to value returned by KVM

2015-11-16 Thread Eduardo Habkost
On Mon, Nov 16, 2015 at 04:04:07PM +0800, Haozhong Zhang wrote: > If no user-specified TSC rate is present, we will try to set > env->tsc_khz to the value returned by KVM_GET_TSC_KHZ. > > Signed-off-by: Haozhong Zhang > --- > target-i386/kvm.c | 25

Re: [Qemu-devel] [PATCH v3 1/3] target-i386: add a subsection for migrating vcpu's TSC rate

2015-11-13 Thread Eduardo Habkost
On Fri, Nov 13, 2015 at 10:23:54AM +0800, Haozhong Zhang wrote: > On 11/11/15 22:27, Haozhong Zhang wrote: > > On 11/11/15 12:16, Eduardo Habkost wrote: > [...] > > > > diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c > > > > index 2f8f396..858ed69 1

Re: [PATCH v3 2/3] target-i386: calculate vcpu's TSC rate to be migrated

2015-11-11 Thread Eduardo Habkost
On Wed, Nov 11, 2015 at 12:57:44AM +0800, Haozhong Zhang wrote: > On 11/09/15 14:01, Eduardo Habkost wrote: > > On Mon, Nov 09, 2015 at 08:33:55AM +0800, haozhong.zh...@intel.com wrote: > > > On 11/06/15 13:12, Eduardo Habkost wrote: > > > > On Fri, Nov 06, 2015 at

Re: [PATCH v3 2/3] target-i386: calculate vcpu's TSC rate to be migrated

2015-11-11 Thread Eduardo Habkost
On Tue, Nov 10, 2015 at 09:08:58AM +0800, Haozhong Zhang wrote: > On 11/09/15 14:01, Eduardo Habkost wrote: > > On Mon, Nov 09, 2015 at 08:33:55AM +0800, haozhong.zh...@intel.com wrote: > > > On 11/06/15 13:12, Eduardo Habkost wrote: > > > > On Fri, Nov 06, 2015 at

Re: [Qemu-devel] [PATCH v3 1/3] target-i386: add a subsection for migrating vcpu's TSC rate

2015-11-11 Thread Eduardo Habkost
On Mon, Nov 02, 2015 at 05:26:41PM +0800, Haozhong Zhang wrote: > A new subsection 'vmstate_tsc_khz' is added to migrate vcpu's TSC > rate. For the backwards compatibility, this subsection is not migrated > on pc-*-2.4 and older machine types. > > Signed-off-by: Haozhong Zhang

Re: [PATCH v7 07/35] util: introduce qemu_file_get_page_size()

2015-11-09 Thread Eduardo Habkost
On Mon, Nov 09, 2015 at 12:36:36PM +0800, Xiao Guangrong wrote: > On 11/06/2015 11:36 PM, Eduardo Habkost wrote: > >On Mon, Nov 02, 2015 at 05:13:09PM +0800, Xiao Guangrong wrote: > >>There are three places use the some logic to get the page size on > >>the file path

Re: [PATCH v7 12/35] util: let qemu_fd_getlength support block device

2015-11-09 Thread Eduardo Habkost
On Mon, Nov 09, 2015 at 01:58:27PM +0800, Xiao Guangrong wrote: > > > On 11/06/2015 11:54 PM, Eduardo Habkost wrote: > >On Mon, Nov 02, 2015 at 05:13:14PM +0800, Xiao Guangrong wrote: > >>lseek can not work for all block devices as the man page says: > >>| Some

Re: [PATCH 2/3] qemu, pkeys: add pkeys support for qemu xsave state handling

2015-11-09 Thread Eduardo Habkost
On Mon, Nov 09, 2015 at 07:55:33PM +0800, Huaitong Han wrote: > This patch adds pkeys support for qemu xsave state handling. > > Signed-off-by: Huaitong Han [...] > @@ -1145,6 +1146,7 @@ static int kvm_put_xsave(X86CPU *cpu) > #ifdef TARGET_X86_64 >

Re: [PATCH v3 2/3] target-i386: calculate vcpu's TSC rate to be migrated

2015-11-09 Thread Eduardo Habkost
On Mon, Nov 09, 2015 at 08:33:55AM +0800, haozhong.zh...@intel.com wrote: > On 11/06/15 13:12, Eduardo Habkost wrote: > > On Fri, Nov 06, 2015 at 10:32:24AM +0800, haozhong.zh...@intel.com wrote: > > > On 11/05/15 14:05, Eduardo Habkost wrote: > > > > On Thu, No

Re: [PATCH v7 11/35] util: introduce qemu_file_getlength()

2015-11-09 Thread Eduardo Habkost
On Mon, Nov 09, 2015 at 12:44:55PM +0800, Xiao Guangrong wrote: > On 11/06/2015 11:50 PM, Eduardo Habkost wrote: > >As this patch affects raw_getlength(), CCing the raw block driver > >maintainer and the qemu-block mailing list. > > Eduardo, thanks for your reminder. I

Re: [PATCH v3 2/3] target-i386: calculate vcpu's TSC rate to be migrated

2015-11-06 Thread Eduardo Habkost
On Fri, Nov 06, 2015 at 10:32:24AM +0800, haozhong.zh...@intel.com wrote: > On 11/05/15 14:05, Eduardo Habkost wrote: > > On Thu, Nov 05, 2015 at 09:30:51AM +0800, Haozhong Zhang wrote: > > > On 11/04/15 19:42, Eduardo Habkost wrote: [...] > > > > >

Re: [PATCH v3 3/3] target-i386: load the migrated vcpu's TSC rate

2015-11-06 Thread Eduardo Habkost
On Fri, Nov 06, 2015 at 10:32:44AM +0800, Haozhong Zhang wrote: > On 11/05/15 14:10, Eduardo Habkost wrote: > > On Mon, Nov 02, 2015 at 05:26:43PM +0800, Haozhong Zhang wrote: > > > Set vcpu's TSC rate to the migrated value if the user does not specify a > > > TSC r

Re: [PATCH v7 07/35] util: introduce qemu_file_get_page_size()

2015-11-06 Thread Eduardo Habkost
On Mon, Nov 02, 2015 at 05:13:09PM +0800, Xiao Guangrong wrote: > There are three places use the some logic to get the page size on > the file path or file fd > > Windows did not support file hugepage, so it will return normal page > for this case. And this interface has not been used on windows

Re: [PATCH v7 12/35] util: let qemu_fd_getlength support block device

2015-11-06 Thread Eduardo Habkost
On Tue, Nov 03, 2015 at 12:21:30AM +0800, Xiao Guangrong wrote: > On 11/03/2015 12:11 AM, Vladimir Sementsov-Ogievskiy wrote: > >On 02.11.2015 12:13, Xiao Guangrong wrote: > >>lseek can not work for all block devices as the man page says: > >>| Some devices are incapable of seeking and POSIX does

Re: [PATCH v7 12/35] util: let qemu_fd_getlength support block device

2015-11-06 Thread Eduardo Habkost
As this patch affects raw_getlength(), CCing the raw block driver maintainer and the qemu-block mailing list. On Mon, Nov 02, 2015 at 05:13:14PM +0800, Xiao Guangrong wrote: > lseek can not work for all block devices as the man page says: > | Some devices are incapable of seeking and POSIX does

Re: [PATCH v7 11/35] util: introduce qemu_file_getlength()

2015-11-06 Thread Eduardo Habkost
As this patch affects raw_getlength(), CCing the raw block driver maintainer and the qemu-block mailing list. On Mon, Nov 02, 2015 at 05:13:13PM +0800, Xiao Guangrong wrote: > It is used to get the size of the specified file, also qemu_fd_getlength() > is introduced to unify the code with

Re: [PATCH v7 12/35] util: let qemu_fd_getlength support block device

2015-11-06 Thread Eduardo Habkost
On Mon, Nov 02, 2015 at 05:13:14PM +0800, Xiao Guangrong wrote: > lseek can not work for all block devices as the man page says: > | Some devices are incapable of seeking and POSIX does not specify > | which devices must support lseek(). > > This patch tries to add the support on Linux by using

Re: [PATCH 1/2] target-i386: tcg: Accept clwb instruction

2015-11-06 Thread Eduardo Habkost
On Fri, Nov 06, 2015 at 12:04:56PM +0100, Richard Henderson wrote: > On 11/04/2015 10:24 PM, Eduardo Habkost wrote: > >Accept the clwb instruction (66 0F AE /6) if its corresponding feature > >flag is enabled on CPUID[7]. > > > >Signed-off-by: Eduardo H

Re: [PATCH v3 3/3] target-i386: load the migrated vcpu's TSC rate

2015-11-05 Thread Eduardo Habkost
On Mon, Nov 02, 2015 at 05:26:43PM +0800, Haozhong Zhang wrote: > Set vcpu's TSC rate to the migrated value if the user does not specify a > TSC rate by cpu option 'tsc-freq' and a migrated TSC rate does exist. If > KVM supports TSC scaling, guest programs will observe TSC increasing in > the

Re: [PATCH v3 2/3] target-i386: calculate vcpu's TSC rate to be migrated

2015-11-05 Thread Eduardo Habkost
On Thu, Nov 05, 2015 at 09:30:51AM +0800, Haozhong Zhang wrote: > On 11/04/15 19:42, Eduardo Habkost wrote: > > On Mon, Nov 02, 2015 at 05:26:42PM +0800, Haozhong Zhang wrote: > > > The value of the migrated vcpu's TSC rate is determined as below. > > > 1. If a TSC r

Re: [Qemu-devel] [PATCH] target-i386: enable cflushopt/clwb/pcommit instructions

2015-11-05 Thread Eduardo Habkost
On Thu, Nov 05, 2015 at 08:51:24AM +0100, Richard Henderson wrote: > On 11/04/2015 08:35 PM, Eduardo Habkost wrote: > >On Fri, Oct 30, 2015 at 01:54:33PM -0700, Richard Henderson wrote: > >>On 10/29/2015 12:31 AM, Xiao Guangrong wrote: > >>>These instructi

Re: [PATCH v7 20/35] dimm: get mapped memory region from DIMMDeviceClass->get_memory_region

2015-11-05 Thread Eduardo Habkost
On Mon, Nov 02, 2015 at 05:13:22PM +0800, Xiao Guangrong wrote: [...] > static MemoryRegion *pc_dimm_get_memory_region(DIMMDevice *dimm) > { > -return host_memory_backend_get_memory(dimm->hostmem, _abort); > +Error *local_err = NULL; > +MemoryRegion *mr; > + > +mr =

[kvm-unit-test RFC] x86: Memory instructions test case

2015-11-04 Thread Eduardo Habkost
se opcodes. Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- config/config-x86-common.mak | 2 + config/config-x86_64.mak | 2 +- x86/memory.c | 88 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 x8

Re: [PATCH v3 2/3] target-i386: calculate vcpu's TSC rate to be migrated

2015-11-04 Thread Eduardo Habkost
On Mon, Nov 02, 2015 at 05:26:42PM +0800, Haozhong Zhang wrote: > The value of the migrated vcpu's TSC rate is determined as below. > 1. If a TSC rate is specified by the cpu option 'tsc-freq', then this > user-specified value will be used. > 2. If neither a user-specified TSC rate nor a

[PATCH 1/2] target-i386: tcg: Accept clwb instruction

2015-11-04 Thread Eduardo Habkost
Accept the clwb instruction (66 0F AE /6) if its corresponding feature flag is enabled on CPUID[7]. Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- target-i386/translate.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/target-i386/translate.c b/

[PATCH 2/2] target-i386: tcg: Check right CPUID bits for clflushopt/pcommit

2015-11-04 Thread Eduardo Habkost
Detect the clflushopt and pcommit instructions and check their corresponding feature flags, instead of checking CPUID_SSE and CPUID_CLFLUSH. Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- target-i386/translate.c | 28 1 file changed, 20 insertions

[PATCH 0/2] target-i386: tcg: Handle clflushopt/clwb/pcommit instructions

2015-11-04 Thread Eduardo Habkost
end-email-ehabk...@redhat.com> Eduardo Habkost (2): target-i386: tcg: Accept clwb instruction target-i386: tcg: Check right CPUID bits for clflushopt/pcommit target-i386/translate.c | 39 +++ 1 file changed, 31 insertions(+), 8 deletions(-) --

Re: [Qemu-devel] [PATCH] target-i386: enable cflushopt/clwb/pcommit instructions

2015-11-04 Thread Eduardo Habkost
On Fri, Oct 30, 2015 at 01:54:33PM -0700, Richard Henderson wrote: > On 10/29/2015 12:31 AM, Xiao Guangrong wrote: > > These instructions are used by NVDIMM drivers and the specification > > locates at: > > https://software.intel.com/sites/default/files/managed/0d/53/319433-022.pdf > > > > There

Re: [PATCH v7 08/35] exec: allow memory to be allocated from any kind of path

2015-11-04 Thread Eduardo Habkost
On Wed, Nov 04, 2015 at 11:12:41AM +0800, Xiao Guangrong wrote: > On 11/04/2015 07:00 AM, Eduardo Habkost wrote: > >On Mon, Nov 02, 2015 at 05:13:10PM +0800, Xiao Guangrong wrote: > >>Currently file_ram_alloc() is designed for hugetlbfs, however, the memory > >>of nvdi

Re: [PATCH v7 11/35] util: introduce qemu_file_getlength()

2015-11-04 Thread Eduardo Habkost
On Wed, Nov 04, 2015 at 11:17:09AM +0800, Xiao Guangrong wrote: > > > On 11/04/2015 07:21 AM, Eduardo Habkost wrote: > >On Mon, Nov 02, 2015 at 05:13:13PM +0800, Xiao Guangrong wrote: > >[...] > >>+size_t qemu_file_getlength(const char *file, Error **errp

Re: [PATCH v7 08/35] exec: allow memory to be allocated from any kind of path

2015-11-03 Thread Eduardo Habkost
On Mon, Nov 02, 2015 at 05:13:10PM +0800, Xiao Guangrong wrote: > Currently file_ram_alloc() is designed for hugetlbfs, however, the memory > of nvdimm can come from either raw pmem device eg, /dev/pmem, or the file > locates at DAX enabled filesystem > > So this patch let it work on any kind of

Re: [PATCH v7 11/35] util: introduce qemu_file_getlength()

2015-11-03 Thread Eduardo Habkost
On Mon, Nov 02, 2015 at 05:13:13PM +0800, Xiao Guangrong wrote: [...] > +size_t qemu_file_getlength(const char *file, Error **errp) > +{ > +int64_t size; [...] > +return size; Can you guarantee that SIZE_MAX >= INT64_MAX on all platforms supported by QEMU? -- Eduardo -- To unsubscribe

Re: [PATCH v6 07/33] util: introduce qemu_file_get_page_size()

2015-10-31 Thread Eduardo Habkost
On Sat, Oct 31, 2015 at 04:09:56PM +0800, Xiao Guangrong wrote: > On 10/30/2015 11:54 PM, Eduardo Habkost wrote: > >On Fri, Oct 30, 2015 at 01:56:01PM +0800, Xiao Guangrong wrote: > >>There are three places use the some logic to get the page size on > >>the file path or

Re: [Qemu-devel] [PATCH v6 11/33] hostmem-file: use whole file size if possible

2015-10-31 Thread Eduardo Habkost
On Sat, Oct 31, 2015 at 04:46:05PM +0800, Xiao Guangrong wrote: > On 10/31/2015 01:30 AM, Eduardo Habkost wrote: > >On Fri, Oct 30, 2015 at 01:56:05PM +0800, Xiao Guangrong wrote: > >>Use the whole file size if @size is not specified which is useful > >>if we want to di

Re: [Qemu-devel] [PATCH v6 08/33] exec: allow memory to be allocated from any kind of path

2015-10-31 Thread Eduardo Habkost
On Sat, Oct 31, 2015 at 03:44:39PM +0800, Xiao Guangrong wrote: > On 10/30/2015 10:04 PM, Vladimir Sementsov-Ogievskiy wrote: > >On 30.10.2015 08:56, Xiao Guangrong wrote: > >>Currently file_ram_alloc() is designed for hugetlbfs, however, the memory > >>of nvdimm can come from either raw pmem

Re: [PATCH v6 07/33] util: introduce qemu_file_get_page_size()

2015-10-30 Thread Eduardo Habkost
On Fri, Oct 30, 2015 at 01:56:01PM +0800, Xiao Guangrong wrote: > There are three places use the some logic to get the page size on > the file path or file fd > > This patch introduces qemu_file_get_page_size() to unify the code > > Signed-off-by: Xiao Guangrong

Re: [Qemu-devel] [PATCH v6 11/33] hostmem-file: use whole file size if possible

2015-10-30 Thread Eduardo Habkost
On Fri, Oct 30, 2015 at 01:56:05PM +0800, Xiao Guangrong wrote: > Use the whole file size if @size is not specified which is useful > if we want to directly pass a file to guest > > Signed-off-by: Xiao Guangrong > --- > backends/hostmem-file.c | 48

Re: [PATCH v2 0/3] target-i386: save/restore vcpu's TSC rate during migration

2015-10-26 Thread Eduardo Habkost
On Mon, Oct 26, 2015 at 10:09:13AM +0800, haozhong.zh...@intel.com wrote: > On Fri, Oct 23, 2015 at 12:45:13PM -0200, Eduardo Habkost wrote: > > On Fri, Oct 23, 2015 at 10:27:27AM +0800, Haozhong Zhang wrote: > > > On Thu, Oct 22, 2015 at 04:45:21PM -0200, Eduardo Habkost wro

Re: [PATCH v2 0/3] target-i386: save/restore vcpu's TSC rate during migration

2015-10-23 Thread Eduardo Habkost
On Fri, Oct 23, 2015 at 08:35:20AM -0200, Marcelo Tosatti wrote: > On Thu, Oct 22, 2015 at 04:45:21PM -0200, Eduardo Habkost wrote: > > On Tue, Oct 20, 2015 at 03:22:51PM +0800, Haozhong Zhang wrote: > > > This patchset enables QEMU to save/restore vcpu's TSC rate during the >

Re: [PATCH v2 0/3] target-i386: save/restore vcpu's TSC rate during migration

2015-10-23 Thread Eduardo Habkost
On Fri, Oct 23, 2015 at 10:27:27AM +0800, Haozhong Zhang wrote: > On Thu, Oct 22, 2015 at 04:45:21PM -0200, Eduardo Habkost wrote: > > On Tue, Oct 20, 2015 at 03:22:51PM +0800, Haozhong Zhang wrote: > > > This patchset enables QEMU to save/restore vcpu's TSC rate during the >

Re: [PATCH v2 3/3] target-i386: load the migrated vcpu's TSC rate

2015-10-23 Thread Eduardo Habkost
On Fri, Oct 23, 2015 at 11:14:48AM +0800, Haozhong Zhang wrote: > On Thu, Oct 22, 2015 at 04:11:37PM -0200, Eduardo Habkost wrote: > > On Tue, Oct 20, 2015 at 03:22:54PM +0800, Haozhong Zhang wrote: > > > Set vcpu's TSC rate to the migrated value (if any). If KVM supports TSC &g

Re: [PATCH v2 0/3] target-i386: save/restore vcpu's TSC rate during migration

2015-10-22 Thread Eduardo Habkost
On Tue, Oct 20, 2015 at 03:22:51PM +0800, Haozhong Zhang wrote: > This patchset enables QEMU to save/restore vcpu's TSC rate during the > migration. When cooperating with KVM which supports TSC scaling, guest > programs can observe a consistent guest TSC rate even though they are > migrated among

Re: [PATCH v2 3/3] target-i386: load the migrated vcpu's TSC rate

2015-10-22 Thread Eduardo Habkost
On Tue, Oct 20, 2015 at 03:22:54PM +0800, Haozhong Zhang wrote: > Set vcpu's TSC rate to the migrated value (if any). If KVM supports TSC > scaling, guest programs will observe TSC increasing in the migrated rate > other than the host TSC rate. > > The loading is controlled by a new cpu option

Re: [PATCH v3 27/32] nvdimm: support DSM_CMD_IMPLEMENTED function

2015-10-14 Thread Eduardo Habkost
On Wed, Oct 14, 2015 at 10:50:40PM +0800, Xiao Guangrong wrote: > On 10/14/2015 05:40 PM, Stefan Hajnoczi wrote: > >On Sun, Oct 11, 2015 at 11:52:59AM +0800, Xiao Guangrong wrote: > >> static void dsm_write(void *opaque, hwaddr addr, > >>uint64_t val, unsigned size) > >>

Re: [PATCH 3/3] kvm-all: notice KVM of vcpu's TSC rate after migration

2015-09-30 Thread Eduardo Habkost
On Wed, Sep 30, 2015 at 08:32:26AM +0800, Haozhong Zhang wrote: > > [...] > > > > Or maybe we shouldn't treat this as VM state, but as configuration, and > > > > let management configure the TSC frequency explicitly if the user really > > > > needs it to stay the same during migration. > > > > > >

Re: [PATCH 3/3] kvm-all: notice KVM of vcpu's TSC rate after migration

2015-09-29 Thread Eduardo Habkost
On Tue, Sep 29, 2015 at 11:43:34AM +0800, Haozhong Zhang wrote: > On Mon, Sep 28, 2015 at 01:37:34PM -0300, Eduardo Habkost wrote: > > On Mon, Sep 28, 2015 at 01:38:31PM +0800, Haozhong Zhang wrote: [...] > > > static void do_kvm_cpu_synchronize_post_init(void *arg) > >

Re: [PATCH 3/3] kvm-all: notice KVM of vcpu's TSC rate after migration

2015-09-28 Thread Eduardo Habkost
On Mon, Sep 28, 2015 at 01:38:31PM +0800, Haozhong Zhang wrote: > When a vcpu is created in KVM, its TSC rate is initially identical to > the host TSC rate. If its state is migrated to a vcpu on another > machine (target machine) which may uses a different host TSC rate, QEMU > on the target

  1   2   3   4   5   6   7   >