fam15h_power.rst 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. Kernel driver fam15h_power
  2. ==========================
  3. Supported chips:
  4. * AMD Family 15h Processors
  5. * AMD Family 16h Processors
  6. Prefix: 'fam15h_power'
  7. Addresses scanned: PCI space
  8. Datasheets:
  9. - BIOS and Kernel Developer's Guide (BKDG) For AMD Family 15h Processors
  10. - BIOS and Kernel Developer's Guide (BKDG) For AMD Family 16h Processors
  11. - AMD64 Architecture Programmer's Manual Volume 2: System Programming
  12. Author: Andreas Herrmann <herrmann.der.user@googlemail.com>
  13. Description
  14. -----------
  15. 1) Processor TDP (Thermal design power)
  16. Given a fixed frequency and voltage, the power consumption of a
  17. processor varies based on the workload being executed. Derated power
  18. is the power consumed when running a specific application. Thermal
  19. design power (TDP) is an example of derated power.
  20. This driver permits reading of registers providing power information
  21. of AMD Family 15h and 16h processors via TDP algorithm.
  22. For AMD Family 15h and 16h processors the following power values can
  23. be calculated using different processor northbridge function
  24. registers:
  25. * BasePwrWatts:
  26. Specifies in watts the maximum amount of power
  27. consumed by the processor for NB and logic external to the core.
  28. * ProcessorPwrWatts:
  29. Specifies in watts the maximum amount of power
  30. the processor can support.
  31. * CurrPwrWatts:
  32. Specifies in watts the current amount of power being
  33. consumed by the processor.
  34. This driver provides ProcessorPwrWatts and CurrPwrWatts:
  35. * power1_crit (ProcessorPwrWatts)
  36. * power1_input (CurrPwrWatts)
  37. On multi-node processors the calculated value is for the entire
  38. package and not for a single node. Thus the driver creates sysfs
  39. attributes only for internal node0 of a multi-node processor.
  40. 2) Accumulated Power Mechanism
  41. This driver also introduces an algorithm that should be used to
  42. calculate the average power consumed by a processor during a
  43. measurement interval Tm. The feature of accumulated power mechanism is
  44. indicated by CPUID Fn8000_0007_EDX[12].
  45. * Tsample:
  46. compute unit power accumulator sample period
  47. * Tref:
  48. the PTSC counter period
  49. * PTSC:
  50. performance timestamp counter
  51. * N:
  52. the ratio of compute unit power accumulator sample period to the
  53. PTSC period
  54. * Jmax:
  55. max compute unit accumulated power which is indicated by
  56. MaxCpuSwPwrAcc MSR C001007b
  57. * Jx/Jy:
  58. compute unit accumulated power which is indicated by
  59. CpuSwPwrAcc MSR C001007a
  60. * Tx/Ty:
  61. the value of performance timestamp counter which is indicated
  62. by CU_PTSC MSR C0010280
  63. * PwrCPUave:
  64. CPU average power
  65. i. Determine the ratio of Tsample to Tref by executing CPUID Fn8000_0007.
  66. N = value of CPUID Fn8000_0007_ECX[CpuPwrSampleTimeRatio[15:0]].
  67. ii. Read the full range of the cumulative energy value from the new
  68. MSR MaxCpuSwPwrAcc.
  69. Jmax = value returned.
  70. iii. At time x, SW reads CpuSwPwrAcc MSR and samples the PTSC.
  71. Jx = value read from CpuSwPwrAcc and Tx = value read from PTSC.
  72. iv. At time y, SW reads CpuSwPwrAcc MSR and samples the PTSC.
  73. Jy = value read from CpuSwPwrAcc and Ty = value read from PTSC.
  74. v. Calculate the average power consumption for a compute unit over
  75. time period (y-x). Unit of result is uWatt::
  76. if (Jy < Jx) // Rollover has occurred
  77. Jdelta = (Jy + Jmax) - Jx
  78. else
  79. Jdelta = Jy - Jx
  80. PwrCPUave = N * Jdelta * 1000 / (Ty - Tx)
  81. This driver provides PwrCPUave and interval(default is 10 millisecond
  82. and maximum is 1 second):
  83. * power1_average (PwrCPUave)
  84. * power1_average_interval (Interval)
  85. The power1_average_interval can be updated at /etc/sensors3.conf file
  86. as below:
  87. chip `fam15h_power-*`
  88. set power1_average_interval 0.01
  89. Then save it with "sensors -s".