[Bug 412375] [NEW] Fails to read registers on 32 bit
jasmineaura
jasmine.aura at yahoo.com
Wed Aug 12 07:08:52 UTC 2009
Public bug reported:
Binary package hint: msr-tools
This is the same exact bug reported in debian:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=495445
On a 32-bit ubuntu system, trying to rdmsr 0xc0010041 or 0xc0010042 gives the following error:
rdmsr:pread: Invalid argument
or sometimes gives a plain old "0"...
Example:
--------------------------------------
root at evrx:/root/drivers/phc# rdmsr 0xc0010042
rdmsr:pread: Invalid argument
root at evrx:/root/drivers/phc# rdmsr 0xc0010041
rdmsr:pread: Invalid argument
root at evrx:/root/drivers/phc# rdmsr c0010042
0
root at evrx:/root/drivers/phc# rdmsr c0010041
0
---------------------------------------
My very basic python script, however, reads the offsets just fine:
---------------------------------------
#!/usr/bin/env python
import os
MSR_FIDVID_CTL=int(0xc0010041)
MSR_FIDVID_STATUS=int(0xc0010042)
msrfile = os.open("/dev/cpu/0/msr", os.O_RDONLY);
os.lseek(msrfile, MSR_FIDVID_STATUS, 0); ##jump to where current values lie
value = os.read(msrfile, 8) ##read 8 bytes
print "--- MSR_FIDVID_STATUS ---"
for v in value:
print ord(v)
os.lseek(msrfile, MSR_FIDVID_CTL, 0); ##jump to where target values lie
value = os.read(msrfile, 8) ##read 8 bytes
print "--- MSR_FIDVID_CTL ---"
for v in value:
print ord(v)
os.close(msrfile)
---------------------------------------
Example Output from my python script:
---------------------------------------
root at evrx:/root/drivers/phc# ./test.py
--- MSR_FIDVID_STATUS ---
0
0
8
17
30
30
17
51
--- MSR_FIDVID_CTL ---
0
30
0
0
1
0
0
0
---------------------------------------
msr-tools from the 1.1.2-1 pkg works fine on 64 bit, just not on 32-bit...
However, they work fine (on 32-bit) if compiled from non-debian/non-
ubuntu sources.
Quote, from the previously mentioned debian bug report on same package:
---------------------------------------
The defines are not being set correctly. Building the debian package it
is compiled like this:
gcc -Wall -g -O2 -g -Wall -O2 -o wrmsr wrmsr.c
gcc -Wall -g -O2 -g -Wall -O2 -o rdmsr rdmsr.c
Building without debian patches it is like this:
gcc -Wall -g -O2 -fomit-frame-pointer -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o wrmsr wrmsr.c
gcc -Wall -g -O2 -fomit-frame-pointer -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o rdmsr rdmsr.c
I see the debian patch adds #define __USE_UNIX98 to the source, but that
doesn't appear to be sufficient.
---------------------------------------
Hope this helps..
** Affects: msr-tools (Ubuntu)
Importance: Undecided
Status: New
** Description changed:
Binary package hint: msr-tools
This is the same exact bug reported in debian:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=495445
- On a 32-bit ubuntu system, trying to rdmsr 0xC0010015 or 0xC0011023 gives the following error:
+ On a 32-bit ubuntu system, trying to rdmsr 0xc0010041 or 0xc0010042 gives the following error:
rdmsr:pread: Invalid argument
or sometimes gives a plain old "0"...
Example:
--------------------------------------
root at evrx:/root/drivers/phc# rdmsr 0xc0010042
rdmsr:pread: Invalid argument
root at evrx:/root/drivers/phc# rdmsr 0xc0010041
rdmsr:pread: Invalid argument
root at evrx:/root/drivers/phc# rdmsr c0010042
0
root at evrx:/root/drivers/phc# rdmsr c0010041
0
---------------------------------------
My very basic python script, however, reads the offsets just fine:
---------------------------------------
#!/usr/bin/env python
import os
MSR_FIDVID_CTL=int(0xc0010041)
MSR_FIDVID_STATUS=int(0xc0010042)
msrfile = os.open("/dev/cpu/0/msr", os.O_RDONLY);
os.lseek(msrfile, MSR_FIDVID_STATUS, 0); ##jump to where current values lie
value = os.read(msrfile, 8) ##read 8 bytes
print "--- MSR_FIDVID_STATUS ---"
for v in value:
print ord(v)
os.lseek(msrfile, MSR_FIDVID_CTL, 0); ##jump to where target values lie
value = os.read(msrfile, 8) ##read 8 bytes
print "--- MSR_FIDVID_CTL ---"
for v in value:
print ord(v)
os.close(msrfile)
---------------------------------------
Example Output from my python script:
---------------------------------------
root at evrx:/root/drivers/phc# ./test.py
--- MSR_FIDVID_STATUS ---
0
0
8
17
30
30
17
51
--- MSR_FIDVID_CTL ---
0
30
0
0
1
0
0
0
---------------------------------------
- msr-tools from the 1.1.2-1 deb pkg works fine on 64 bit, just not on 32-bit...
+ msr-tools from the 1.1.2-1 pkg works fine on 64 bit, just not on 32-bit...
However, they work fine (on 32-bit) if compiled from non-debian/non-
ubuntu sources.
Quote, from the previously mentioned debian bug report on same package:
---------------------------------------
The defines are not being set correctly. Building the debian package it
is compiled like this:
gcc -Wall -g -O2 -g -Wall -O2 -o wrmsr wrmsr.c
gcc -Wall -g -O2 -g -Wall -O2 -o rdmsr rdmsr.c
Building without debian patches it is like this:
gcc -Wall -g -O2 -fomit-frame-pointer -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o wrmsr wrmsr.c
gcc -Wall -g -O2 -fomit-frame-pointer -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o rdmsr rdmsr.c
I see the debian patch adds #define __USE_UNIX98 to the source, but that
doesn't appear to be sufficient.
---------------------------------------
Hope this helps..
--
Fails to read registers on 32 bit
https://bugs.launchpad.net/bugs/412375
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
More information about the universe-bugs
mailing list