lkml.org 
[lkml]   [2009]   [Mar]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [git-pull -tip] x86: msr architecture debug code
On Thu, Mar 05, 2009 at 07:42:26PM +0530, Jaswinder Singh Rajput wrote:
> On Thu, 2009-03-05 at 14:54 +0100, Andreas Herrmann wrote:
>
> > All nice suggestions but why in-kernel?
> >
>
> In Kernel Space:
>
> We can read/write MSRs and can change the bits and see it effect without
> writing any code.

Sorry, I can't (or maybe I don't like to) follow.

(BTW, you don't even need to write C-code. You can use a one-liner in perl
or python to seek and read any MSR using /dev/cpu/*/msr.)

> And we can also dump these value if something goes wrong in thats
> sections for kernel that's why I am also using printk.

Just some example how to do this today. (I've recently used this for
debugging.) Using a kernel with msr module loaded or built-in plus using
x86info/lsmsr and hpa's msr-tools.

# lsmsr MTRRfix -c 0
MTRRfix64K_00000 = 0x0606060606060606
MTRRfix16K_80000 = 0x0606060606060606
MTRRfix16K_A0000 = 0x0000000000000000
MTRRfix4K_C0000 = 0x0505050505050505
MTRRfix4K_C8000 = 0x0505050505050505
MTRRfix4K_D0000 = 0x0000000000000000
MTRRfix4K_D8000 = 0x0000000000000000
MTRRfix4K_E0000 = 0x0505050500000000
MTRRfix4K_E8000 = 0x0505050505050505
MTRRfix4K_F0000 = 0x0505050505050505
MTRRfix4K_F8000 = 0x0505050505050505
# lsmsr SYS_CFG
SYS_CFG = 0x0000000000160600
# lsmsr SYS_CFG -l -V3
SYS_CFG : 0xc0010010
8-8:SetDirtyEnE
9-9:SetDirtyEnS
10-10:SetDirtyEnO
16-16:ChxToDirtyDis
17-17:SysUcLockEn
18-18:MtrrFixDramEn
19-19:MtrrFixDramModEn
20-20:MtrrVarDramEn
21-21:MtrrTom2En
22-22:Tom2ForceMemTypeWB
# wrmsr -p 0 0xc0010010 0x00000000001e0600
# lsmsr SYS_CFG
SYS_CFG = 0x00000000001e0600
# lsmsr MTRRfix -c 0
MTRRfix64K_00000 = 0x1e1e1e1e1e1e1e1e
MTRRfix16K_80000 = 0x1e1e1e1e1e1e1e1e
MTRRfix16K_A0000 = 0x0000000000000000
MTRRfix4K_C0000 = 0x1515151515151515
MTRRfix4K_C8000 = 0x1515151515151515
MTRRfix4K_D0000 = 0x0000000000000000
MTRRfix4K_D8000 = 0x0000000000000000
MTRRfix4K_E0000 = 0x1515151500000000
MTRRfix4K_E8000 = 0x1515151515151515
MTRRfix4K_F0000 = 0x1515151515151515
MTRRfix4K_F8000 = 0x1515151515151515


IMHO, there is no need to do this in-kernel.


Regards,

Andreas

--
Operating | Advanced Micro Devices GmbH
System | Karl-Hammerschmidt-Str. 34, 85609 Dornach b. München, Germany
Research | Geschäftsführer: Jochen Polster, Thomas M. McCoy, Giuliano Meroni
Center | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
(OSRC) | Registergericht München, HRB Nr. 43632


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-03-05 15:41    [W:0.085 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site