From: James Hogan <james.hogan@imgtec.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: <linux-mips@linux-mips.org>
Subject: Re: [PATCH 5/9] MIPS: dump_tlb: Take global bit into account
Date: Mon, 18 May 2015 14:37:08 +0100 [thread overview]
Message-ID: <5559EB04.2000007@imgtec.com> (raw)
In-Reply-To: <20150515153800.GD2322@linux-mips.org>
[-- Attachment #1: Type: text/plain, Size: 2415 bytes --]
On 15/05/15 16:38, Ralf Baechle wrote:
> On Wed, May 13, 2015 at 11:50:51AM +0100, James Hogan wrote:
>
>> The TLB only matches the ASID when the global bit isn't set, so
>> dump_tlb() shouldn't really be skipping global entries just because the
>> ASID doesn't match. Fix the condition to read the TLB entry's global bit
>> from EntryLo0. Note that after a TLB read the global bits in both
>> EntryLo registers reflect the same global bit in the TLB entry.
>>
>> Signed-off-by: James Hogan <james.hogan@imgtec.com>
>> Cc: Ralf Baechle <ralf@linux-mips.org>
>> Cc: linux-mips@linux-mips.org
>> ---
>> arch/mips/lib/dump_tlb.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/mips/lib/dump_tlb.c b/arch/mips/lib/dump_tlb.c
>> index 17d05caa776d..70e0a6bdb322 100644
>> --- a/arch/mips/lib/dump_tlb.c
>> +++ b/arch/mips/lib/dump_tlb.c
>> @@ -73,7 +73,8 @@ static void dump_tlb(int first, int last)
>> */
>> if ((entryhi & ~0x1ffffUL) == CKSEG0)
>> continue;
>> - if ((entryhi & 0xff) != asid)
>> + /* ASID takes effect in absense of global bit */
>> + if (!(entrylo0 & 1) && (entryhi & 0xff) != asid)
>> continue;
>
> Note the architecture mandates that there only is one global bit per
> TLB entry and its written as the logic and of the two global bits in
> the entrylo0 and entrylo1 registers. On TLB read the G bits of both
> entrylo registers will return the same value.
>
> In reality some implementations differ in hardware, for example the
> SB1 core where the TLB entries both have their separate G bit. Both
> will be written with the logic and of the G bits of the entrylo registers
> so the existence of multiple G bits per TLB entry should never become
> visible.
>
> Except when writing a duplicate TLB entry where certain revisions will
> write the entrylo0 half of the TLB entry, then take the machine check
> exception leaving the entrylo1 half of the TLB entry unchanged. At
> this point one may end up with architecturally undefined TLB entries
> with one G bit set and one clear.
>
> There may be other CPUs where such invalid TLB entries are possible
> therfore think we should check for entries with mismatching global
> bits and print those anyway.
Okay, makes sense. If either global bit is set I'll make it skip the
ASID check.
Thanks for the information.
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: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Subject: Re: [PATCH 5/9] MIPS: dump_tlb: Take global bit into account
Date: Mon, 18 May 2015 14:37:08 +0100 [thread overview]
Message-ID: <5559EB04.2000007@imgtec.com> (raw)
Message-ID: <20150518133708._jST12Tl6wCE0DPjsMg835SE8nfcvUGke5_1ECY-N58@z> (raw)
In-Reply-To: <20150515153800.GD2322@linux-mips.org>
[-- Attachment #1: Type: text/plain, Size: 2415 bytes --]
On 15/05/15 16:38, Ralf Baechle wrote:
> On Wed, May 13, 2015 at 11:50:51AM +0100, James Hogan wrote:
>
>> The TLB only matches the ASID when the global bit isn't set, so
>> dump_tlb() shouldn't really be skipping global entries just because the
>> ASID doesn't match. Fix the condition to read the TLB entry's global bit
>> from EntryLo0. Note that after a TLB read the global bits in both
>> EntryLo registers reflect the same global bit in the TLB entry.
>>
>> Signed-off-by: James Hogan <james.hogan@imgtec.com>
>> Cc: Ralf Baechle <ralf@linux-mips.org>
>> Cc: linux-mips@linux-mips.org
>> ---
>> arch/mips/lib/dump_tlb.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/mips/lib/dump_tlb.c b/arch/mips/lib/dump_tlb.c
>> index 17d05caa776d..70e0a6bdb322 100644
>> --- a/arch/mips/lib/dump_tlb.c
>> +++ b/arch/mips/lib/dump_tlb.c
>> @@ -73,7 +73,8 @@ static void dump_tlb(int first, int last)
>> */
>> if ((entryhi & ~0x1ffffUL) == CKSEG0)
>> continue;
>> - if ((entryhi & 0xff) != asid)
>> + /* ASID takes effect in absense of global bit */
>> + if (!(entrylo0 & 1) && (entryhi & 0xff) != asid)
>> continue;
>
> Note the architecture mandates that there only is one global bit per
> TLB entry and its written as the logic and of the two global bits in
> the entrylo0 and entrylo1 registers. On TLB read the G bits of both
> entrylo registers will return the same value.
>
> In reality some implementations differ in hardware, for example the
> SB1 core where the TLB entries both have their separate G bit. Both
> will be written with the logic and of the G bits of the entrylo registers
> so the existence of multiple G bits per TLB entry should never become
> visible.
>
> Except when writing a duplicate TLB entry where certain revisions will
> write the entrylo0 half of the TLB entry, then take the machine check
> exception leaving the entrylo1 half of the TLB entry unchanged. At
> this point one may end up with architecturally undefined TLB entries
> with one G bit set and one clear.
>
> There may be other CPUs where such invalid TLB entries are possible
> therfore think we should check for entries with mismatching global
> bits and print those anyway.
Okay, makes sense. If either global bit is set I'll make it skip the
ASID check.
Thanks for the information.
Cheers
James
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-05-18 13:37 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 10:50 [PATCH 0/9] MIPS: dump_tlb improvements James Hogan
2015-05-13 10:50 ` James Hogan
2015-05-13 10:50 ` [PATCH RFC 1/9] MIPS: Add SysRq operation to dump TLBs on all CPUs James Hogan
2015-05-13 10:50 ` James Hogan
2015-05-13 10:50 ` [PATCH 2/9] MIPS: hazards: Add hazard macros for tlb read James Hogan
2015-05-13 10:50 ` James Hogan
2015-05-15 15:08 ` Ralf Baechle
2015-05-18 13:30 ` James Hogan
2015-05-18 13:30 ` James Hogan
2015-05-13 10:50 ` [PATCH 3/9] MIPS: dump_tlb: Use tlbr hazard macros James Hogan
2015-05-13 10:50 ` James Hogan
2015-05-15 15:17 ` Ralf Baechle
2015-05-16 0:32 ` Maciej W. Rozycki
2015-05-13 10:50 ` [PATCH 4/9] MIPS: dump_tlb: Refactor TLB matching James Hogan
2015-05-13 10:50 ` James Hogan
2015-05-13 10:50 ` [PATCH 5/9] MIPS: dump_tlb: Take global bit into account James Hogan
2015-05-13 10:50 ` James Hogan
2015-05-15 15:38 ` Ralf Baechle
2015-05-18 13:37 ` James Hogan [this message]
2015-05-18 13:37 ` James Hogan
2015-05-16 0:44 ` Maciej W. Rozycki
2015-05-16 1:02 ` Maciej W. Rozycki
2015-05-18 13:50 ` James Hogan
2015-05-18 13:50 ` James Hogan
2015-05-18 14:19 ` Maciej W. Rozycki
2015-05-13 10:50 ` [PATCH 6/9] MIPS: dump_tlb: Take EHINV " James Hogan
2015-05-13 10:50 ` James Hogan
2015-05-13 10:50 ` [PATCH 7/9] MIPS: dump_tlb: Take RI/XI bits " James Hogan
2015-05-13 10:50 ` James Hogan
2015-05-13 10:50 ` [PATCH 8/9] MIPS: dump_tlb: Take XPA " James Hogan
2015-05-13 10:50 ` James Hogan
2015-05-13 10:50 ` [PATCH 9/9] MIPS: tlb-r4k: Fix PG_ELPA comment James Hogan
2015-05-13 10: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=5559EB04.2000007@imgtec.com \
--to=james.hogan@imgtec.com \
--cc=linux-mips@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