Re: [PATCH V3 0/4] KVM vPMU support for AMD CPUs

2015-04-22 Thread Radim Krčmář
2015-04-18 02:23-0400, Wei Huang:
 Currently KVM only supports vPMU for Intel CPUs. This patchset enables
 KVM vPMU support for AMD platform by creating a common PMU interface for
 x86. By refractoring, PMU related MSR accesses from guest VMs are dispatched
 to corresponding functions defined in arch specific files.
 
 V3:
   * Rebase the code to the latest of KVM tree (queue branch);
   * Branch out the Intel specific code from pmu.c to pmu_intel.c, in order
 to reflect the change history more accurately;
   * Name the parameters/variables more consistently (use msr, idx, 
 pmc_idx) across files;
   * Fix issues (whitespaces, macro names, ...) based on Radim's V2 comments;
   * Fix the MSR_K7_PERFCTRn and MSR_K7_EVNTSELn access code (in patch 4);

I still wasn't happy about the API, especially naming, but didnt't find
any bugs in functionality, also

Tested-by: Radim Krčmář rkrc...@redhat.com

I didn't give reviewed-by to all patches, but if we want it fast,
there's no problem in fixing some stuff later.  (Though it usually
doesn't happen and we end up with bad code.)
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V3 0/4] KVM vPMU support for AMD CPUs

2015-04-21 Thread Radim Krčmář
2015-04-18 02:23-0400, Wei Huang:
 Currently KVM only supports vPMU for Intel CPUs. This patchset enables
 KVM vPMU support for AMD platform by creating a common PMU interface for
 x86. By refractoring, PMU related MSR accesses from guest VMs are dispatched
 to corresponding functions defined in arch specific files.
 
 V3:
   * Rebase the code to the latest of KVM tree (queue branch);
   * Branch out the Intel specific code from pmu.c to pmu_intel.c, in order
 to reflect the change history more accurately;
   * Name the parameters/variables more consistently (use msr, idx, 
 pmc_idx) across files;
   * Fix issues (whitespaces, macro names, ...) based on Radim's V2 comments;
   * Fix the MSR_K7_PERFCTRn and MSR_K7_EVNTSELn access code (in patch 4);

Looks ok, thanks.  I only have petty comments about naming and stuff and
ideas leading to less code duplication ... I'll just smoke test it and
give the proper tag tomorrow.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V3 0/4] KVM vPMU support for AMD CPUs

2015-04-18 Thread Wei Huang
Currently KVM only supports vPMU for Intel CPUs. This patchset enables
KVM vPMU support for AMD platform by creating a common PMU interface for
x86. By refractoring, PMU related MSR accesses from guest VMs are dispatched
to corresponding functions defined in arch specific files.

V3:
  * Rebase the code to the latest of KVM tree (queue branch);
  * Branch out the Intel specific code from pmu.c to pmu_intel.c, in order
to reflect the change history more accurately;
  * Name the parameters/variables more consistently (use msr, idx, 
pmc_idx) across files;
  * Fix issues (whitespaces, macro names, ...) based on Radim's V2 comments;
  * Fix the MSR_K7_PERFCTRn and MSR_K7_EVNTSELn access code (in patch 4);

V2:
  * Create a generic pmu.c file which is shared by Intel and AMD CPUs;
  * pmu.c code becomes part of kvm.ko module. Similarly pmu_intel.c and
pmu_amd.c are linked to kvm-intel.ko and kvm-amd.ko respectively;
  * Re-define kvm_pmu_ops function pointers. Per Radim Krcmar's comments,
a large portion of Intel vPMU code are now consolidated and moved to
pmu.c;
  * Polish pmu_amd.c code to comply with new definition of kvm_pmu_ops;

V1:
  * Adopt the file layout suggested by Radim Krcmar
  * Link arch module with its specific PMU file

RFC:
  * Initial version for RFC

Wei Huang (4):
  KVM: x86/vPMU: Define kvm_pmu_ops to support vPMU function dispatch
  KVM: x86/vPMU: Create vPMU interface for VMX and SVM
  KVM: x86/vPMU: Implement AMD vPMU code for KVM
  KVM: x86/vPMU: Enable PMU handling for AMD PERFCTRn and EVNTSELn MSRs

 arch/x86/include/asm/kvm_host.h |  37 ++-
 arch/x86/kvm/Makefile   |   4 +-
 arch/x86/kvm/cpuid.c|   3 +-
 arch/x86/kvm/pmu.c  | 557 +++-
 arch/x86/kvm/pmu.h  |  98 +++
 arch/x86/kvm/pmu_amd.c  | 207 +++
 arch/x86/kvm/pmu_intel.c| 359 ++
 arch/x86/kvm/svm.c  |   8 +
 arch/x86/kvm/vmx.c  |   8 +
 arch/x86/kvm/x86.c  |  47 ++--
 10 files changed, 891 insertions(+), 437 deletions(-)
 create mode 100644 arch/x86/kvm/pmu.h
 create mode 100644 arch/x86/kvm/pmu_amd.c
 create mode 100644 arch/x86/kvm/pmu_intel.c

-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html