public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Herrmann <andreas.herrmann3@amd.com>
To: Jaswinder Singh Rajput <jaswinder@kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
	x86 maintainers <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [git-pull -tip] x86: msr architecture debug code
Date: Thu, 5 Mar 2009 15:37:26 +0100	[thread overview]
Message-ID: <20090305143726.GC7347@alberich.amd.com> (raw)
In-Reply-To: <1236262346.2527.3.camel@ht.satnam>

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



  reply	other threads:[~2009-03-05 14:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-02 15:42 [git-pull -tip] x86: msr architecture debug code Jaswinder Singh Rajput
2009-03-02 17:25 ` Jaswinder Singh Rajput
2009-03-02 20:54 ` Ingo Molnar
2009-03-04 19:16   ` Jaswinder Singh Rajput
2009-03-04 20:49     ` [git-pull -tip V2] " Jaswinder Singh Rajput
2009-03-05 12:21       ` Andreas Herrmann
2009-03-05 13:10         ` Jaswinder Singh Rajput
2009-03-05 13:32         ` Ingo Molnar
2009-03-05 13:48           ` Jaswinder Singh Rajput
2009-03-05 14:11             ` Ingo Molnar
2009-03-05 14:31               ` Jaswinder Singh Rajput
2009-03-05 13:54   ` [git-pull -tip] " Andreas Herrmann
2009-03-05 14:08     ` Ingo Molnar
2009-03-05 17:01       ` Andreas Herrmann
2009-03-05 14:12     ` Jaswinder Singh Rajput
2009-03-05 14:37       ` Andreas Herrmann [this message]
2009-03-05 15:16         ` Jaswinder Singh Rajput
2009-03-05 15:47         ` Jaswinder Singh Rajput
2009-03-05 18:23           ` Andreas Herrmann
2009-03-05 18:40             ` Jaswinder Singh Rajput
2009-03-06 10:07               ` Andreas Herrmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090305143726.GC7347@alberich.amd.com \
    --to=andreas.herrmann3@amd.com \
    --cc=hpa@zytor.com \
    --cc=jaswinder@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox