x86/mm: Remove preempt_disable/enable() from __native_flush_tlb()
[linux/fpc-iii.git] / tools / testing / selftests / intel_pstate / msr.c
blob88fdd2a4b0a072242b0b3936b6ddda27cf80e818
1 // SPDX-License-Identifier: GPL-2.0
2 #include <math.h>
3 #include <unistd.h>
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <sys/types.h>
7 #include <sys/stat.h>
8 #include <fcntl.h>
9 #include <sys/timeb.h>
10 #include <sched.h>
11 #include <errno.h>
14 int main(int argc, char **argv) {
15 int cpu, fd;
16 long long msr;
17 char msr_file_name[64];
19 if (argc != 2)
20 return 1;
22 errno = 0;
23 cpu = strtol(argv[1], (char **) NULL, 10);
25 if (errno)
26 return 1;
28 sprintf(msr_file_name, "/dev/cpu/%d/msr", cpu);
29 fd = open(msr_file_name, O_RDONLY);
31 if (fd == -1) {
32 perror("Failed to open");
33 return 1;
36 pread(fd, &msr, sizeof(msr), 0x199);
38 printf("msr 0x199: 0x%llx\n", msr);
39 return 0;