Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: James Hogan <james.hogan@imgtec.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>,
	Joshua Kinard <kumba@gentoo.org>
Cc: Ralf Baechle <ralf@linux-mips.org>, <linux-mips@linux-mips.org>
Subject: Re: [PATCH RFC v2 01/10] MIPS: Add SysRq operation to dump TLBs on all CPUs
Date: Tue, 14 Jul 2015 10:27:29 +0100	[thread overview]
Message-ID: <55A4D601.8070604@imgtec.com> (raw)
In-Reply-To: <alpine.LFD.2.11.1505261230020.11225@eddie.linux-mips.org>

[-- Attachment #1: Type: text/plain, Size: 2707 bytes --]

On 26/05/15 12:58, Maciej W. Rozycki wrote:
> On Sun, 24 May 2015, Joshua Kinard wrote:
> 
>>> Add a MIPS specific SysRq operation to dump the TLB entries on all CPUs,
>>> using the 'x' trigger key.
>>
>> Thought: Would it make sense to split apart the data such that one SysRq key
>> dumps the CP0 registers of all CPUs, and another dumps the TLB info?
> 
>  That would be a large separate project, probing a CPU for its implemented 
> CP0 registers is a complex matter.
> 
>  I did it for GDB and a bare-iron debug stub a few years ago and back then 
> there were IIRC 53 register subsets already defined for MIPS architecture 
> processors, wired to various, sometimes overlapping feature bits of CP0 
> Config registers, and now there are more.  Plus legacy processors require 
> fixed register maps according to CP0.PRId.
> 
>  James, I think what you proposed is good enough for TLB diagnostics (I'm 
> not sure if dumping EntryLo0 and EntryLo1 registers has any use, but it 
> surely does not hurt either).
> 
>>> +	pr_info("CPU%d:\n", smp_processor_id());
>>> +	pr_info("Index	: %0x\n", read_c0_index());
>>> +	pr_info("Pagemask: %0x\n", read_c0_pagemask());
>>> +	pr_info("EntryHi : %0*lx\n", field, read_c0_entryhi());
>>> +	pr_info("EntryLo0: %0*lx\n", field, read_c0_entrylo0());
>>> +	pr_info("EntryLo1: %0*lx\n", field, read_c0_entrylo1());
>>> +	pr_info("Wired   : %0x\n", read_c0_wired());
>>> +	pr_info("Pagegrain: %0x\n", read_c0_pagegrain());
> 
>  Please capitalise these consistently: PageMask and PageGrain.
> 
>> The older CPUs, like the R10000 don't have a PageGrain register I believe (at
>> least R10K doesn't),  Does that need to be stuffed behind a conditional?  Also,
>> R10K (and newer?) CPUs have a FrameMask CP0 register ($21).  Linux currently
>> scribbles a 0 to the writable bits, though, so I'm not sure if it matters.
> 
>  First of all I suggest that this part is split off into separate small 
> helper functions within dump_tlb.c and r3k_dump_tlb.c.  This code is not 
> performance-critical, so the overhead of an extra function call isn't of 
> a concern.
> 
>  Then R3k processors have Index, EntryHi and EntryLo (rather than 
> EntryLo0) registers only; some Toshiba processors have Wired too (cf. 
> `r3k_have_wired_reg').
> 
>  And for the R4k-style TLB the PageGrain register does need to be probed 
> for.  I think including FrameMask would be good too, that shouldn't be 
> difficult (switch on `current_cpu_type'?).

Thanks for all the feedback Joshua and Maciej, and sorry for the delay
getting back to this. I think I've addressed it all now, so I'll submit
a second patchset soon.

Cheers
James


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: James Hogan <james.hogan@imgtec.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>,
	Joshua Kinard <kumba@gentoo.org>
Cc: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Subject: Re: [PATCH RFC v2 01/10] MIPS: Add SysRq operation to dump TLBs on all CPUs
Date: Tue, 14 Jul 2015 10:27:29 +0100	[thread overview]
Message-ID: <55A4D601.8070604@imgtec.com> (raw)
Message-ID: <20150714092729.5TzzanSamxgmhOyk0I7-deZVGr-RZzmS5c4Rcb-MGgU@z> (raw)
In-Reply-To: <alpine.LFD.2.11.1505261230020.11225@eddie.linux-mips.org>

[-- Attachment #1: Type: text/plain, Size: 2707 bytes --]

On 26/05/15 12:58, Maciej W. Rozycki wrote:
> On Sun, 24 May 2015, Joshua Kinard wrote:
> 
>>> Add a MIPS specific SysRq operation to dump the TLB entries on all CPUs,
>>> using the 'x' trigger key.
>>
>> Thought: Would it make sense to split apart the data such that one SysRq key
>> dumps the CP0 registers of all CPUs, and another dumps the TLB info?
> 
>  That would be a large separate project, probing a CPU for its implemented 
> CP0 registers is a complex matter.
> 
>  I did it for GDB and a bare-iron debug stub a few years ago and back then 
> there were IIRC 53 register subsets already defined for MIPS architecture 
> processors, wired to various, sometimes overlapping feature bits of CP0 
> Config registers, and now there are more.  Plus legacy processors require 
> fixed register maps according to CP0.PRId.
> 
>  James, I think what you proposed is good enough for TLB diagnostics (I'm 
> not sure if dumping EntryLo0 and EntryLo1 registers has any use, but it 
> surely does not hurt either).
> 
>>> +	pr_info("CPU%d:\n", smp_processor_id());
>>> +	pr_info("Index	: %0x\n", read_c0_index());
>>> +	pr_info("Pagemask: %0x\n", read_c0_pagemask());
>>> +	pr_info("EntryHi : %0*lx\n", field, read_c0_entryhi());
>>> +	pr_info("EntryLo0: %0*lx\n", field, read_c0_entrylo0());
>>> +	pr_info("EntryLo1: %0*lx\n", field, read_c0_entrylo1());
>>> +	pr_info("Wired   : %0x\n", read_c0_wired());
>>> +	pr_info("Pagegrain: %0x\n", read_c0_pagegrain());
> 
>  Please capitalise these consistently: PageMask and PageGrain.
> 
>> The older CPUs, like the R10000 don't have a PageGrain register I believe (at
>> least R10K doesn't),  Does that need to be stuffed behind a conditional?  Also,
>> R10K (and newer?) CPUs have a FrameMask CP0 register ($21).  Linux currently
>> scribbles a 0 to the writable bits, though, so I'm not sure if it matters.
> 
>  First of all I suggest that this part is split off into separate small 
> helper functions within dump_tlb.c and r3k_dump_tlb.c.  This code is not 
> performance-critical, so the overhead of an extra function call isn't of 
> a concern.
> 
>  Then R3k processors have Index, EntryHi and EntryLo (rather than 
> EntryLo0) registers only; some Toshiba processors have Wired too (cf. 
> `r3k_have_wired_reg').
> 
>  And for the R4k-style TLB the PageGrain register does need to be probed 
> for.  I think including FrameMask would be good too, that shouldn't be 
> difficult (switch on `current_cpu_type'?).

Thanks for all the feedback Joshua and Maciej, and sorry for the delay
getting back to this. I think I've addressed it all now, so I'll submit
a second patchset soon.

Cheers
James


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2015-07-14  9:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-19  8:50 [PATCH v2 00/10] MIPS: dump_tlb improvements James Hogan
2015-05-19  8:50 ` James Hogan
2015-05-19  8:50 ` [PATCH RFC v2 01/10] MIPS: Add SysRq operation to dump TLBs on all CPUs James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-24 21:21   ` Joshua Kinard
2015-05-26 11:58     ` Maciej W. Rozycki
2015-05-27 13:09       ` Maciej W. Rozycki
2015-07-14  9:27       ` James Hogan [this message]
2015-07-14  9:27         ` James Hogan
2015-05-19  8:50 ` [PATCH v2 02/10] MIPS: hazards: Add hazard macros for tlb read James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-26 12:36   ` Maciej W. Rozycki
2015-05-26 12:53     ` Ralf Baechle
2015-05-26 13:25       ` Maciej W. Rozycki
2015-05-26 13:32         ` Ralf Baechle
2015-05-19  8:50 ` [PATCH v2 03/10] MIPS: mipsregs.h: Add EntryLo bit definitions James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-28 23:47   ` Maciej W. Rozycki
2015-05-19  8:50 ` [PATCH v2 04/10] MIPS: dump_tlb: Use tlbr hazard macros James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-19  8:50 ` [PATCH v2 05/10] MIPS: dump_tlb: Refactor TLB matching James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-19  8:50 ` [PATCH v2 06/10] MIPS: dump_tlb: Make use of EntryLo bit definitions James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-19  8:50 ` [PATCH v2 07/10] MIPS: dump_tlb: Take global bit into account James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-19  8:50 ` [PATCH v2 08/10] MIPS: dump_tlb: Take EHINV " James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-19  8:50 ` [PATCH v2 09/10] MIPS: dump_tlb: Take RI/XI bits " James Hogan
2015-05-19  8:50   ` James Hogan
2015-05-19  8:50 ` [PATCH v2 10/10] MIPS: dump_tlb: Take XPA " James Hogan
2015-05-19  8:50   ` James Hogan

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=55A4D601.8070604@imgtec.com \
    --to=james.hogan@imgtec.com \
    --cc=kumba@gentoo.org \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@linux-mips.org \
    --cc=ralf@linux-mips.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