message: vpmu: implement a workaround for AWS
diff: @@ -479,6 +479,20 @@ void PCM::readCoreCounterConfig(const bool complainAboutMSR)
  std::cerr << "PCM Error: Can't determine the number of available counters reliably because reading MSR_TSX_FORCE_ABORT failed.\n";
  }
  }
  +#if defined(__linux__)
  + const auto env = std::getenv("PCM_NO_AWS_WORKAROUND");
  + auto aws_workaround = true;
  + if (env != nullptr && std::string(env) == std::string("1"))
  + {
  + aws_workaround = false;
  + }
  + if (aws_workaround == true && vm == true && linux_arch_perfmon == true && core_gen_counter_num_max > 3)
  + {
  + core_gen_counter_num_max = 3;
  + std::cerr << "INFO: Reducing the number of programmable counters to 3 to workaround the fixed cycle counter virtualization issue on AWS.\n";
  + std::cerr << " You can disable the workaround by setting PCM_NO_AWS_WORKAROUND=1 environment variable\n";
  + }
  +#endif
  }
  }
  