Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
To: David Daney <ddaney.cavm@gmail.com>
Cc: Markos Chandras <markos.chandras@imgtec.com>,
	<linux-mips@linux-mips.org>
Subject: Re: [PATCH 4/6] MIPS: mm: Use the TLBINVF instruction to flush the VTLB
Date: Mon, 11 Nov 2013 12:55:57 -0800	[thread overview]
Message-ID: <5281445D.9090001@imgtec.com> (raw)
In-Reply-To: <528139B1.9010909@gmail.com>

On 11/11/2013 12:10 PM, David Daney wrote:
> On 11/07/2013 09:08 AM, Markos Chandras wrote:
>> From: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
>>
>> The TLBINVF instruction can be used to flush the entire VTLB.
>> This eliminates the need for the TLBWI loop and improves performance.
>>
>> Reviewed-by: Paul Burton <paul.burton@imgtec.com>
>> Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
>> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
>
>
> This should be split into two patches.  One for each file.
>
> Also...
>
>> ---
>>   arch/mips/include/asm/mipsregs.h | 13 +++++++++++++
>>   arch/mips/mm/tlb-r4k.c           | 18 ++++++++++++------
>>   2 files changed, 25 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/mips/include/asm/mipsregs.h 
>> b/arch/mips/include/asm/mipsregs.h
>> index 412fe99..9cd0e13 100644
>> --- a/arch/mips/include/asm/mipsregs.h
>> +++ b/arch/mips/include/asm/mipsregs.h
>> @@ -685,6 +685,19 @@ static inline int mm_insn_16bit(u16 insn)
>>   }
>>
>>   /*
>> + * TLB Invalidate Flush
>> + */
>> +static inline void tlbinvf(void)
>> +{
>> +    __asm__ __volatile__(
>> +        ".set push\n\t"
>> +        ".set noreorder\n\t"
>
> ... Why do you need noreorder here?

Historically. Just copied a worked stuff right before this function and 
doesn't bother "why it is needed in other functions".

>
>> +        ".word 0x42000004\n\t" /* tlbinvf */
>> +        ".set pop");
>> +}
>> +
>> +
>> +/*
>>    * Functions to access the R10000 performance counters. These are 
>> basically
>>    * mfc0 and mtc0 instructions from and to coprocessor register with 
>> a 5-bit
>>    * performance counter number encoded into bits 1 ... 5 of the 
>> instruction.
>> diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
>> index 363aa03..427dcac 100644
>> --- a/arch/mips/mm/tlb-r4k.c
>> +++ b/arch/mips/mm/tlb-r4k.c
>> @@ -83,13 +83,19 @@ void local_flush_tlb_all(void)
>>       entry = read_c0_wired();
>>
>>       /* Blast 'em all away. */
>> -    while (entry < current_cpu_data.tlbsize) {
>> -        /* Make sure all entries differ. */
>> -        write_c0_entryhi(UNIQUE_ENTRYHI(entry));
>> -        write_c0_index(entry);
>> +    if (cpu_has_tlbinv && current_cpu_data.tlbsize) {
>> +        write_c0_index(0);
>>           mtc0_tlbw_hazard();
>> -        tlb_write_indexed();
>> -        entry++;
>> +        tlbinvf();  /* invalidate VTLB */
>> +    } else {
>> +        while (entry < current_cpu_data.tlbsize) {
>> +            /* Make sure all entries differ. */
>> +            write_c0_entryhi(UNIQUE_ENTRYHI(entry));
>> +            write_c0_index(entry);
>> +            mtc0_tlbw_hazard();
>> +            tlb_write_indexed();
>> +            entry++;
>> +        }
>>       }
>>       tlbw_use_hazard();
>>       write_c0_entryhi(old_ctx);
>>
>

WARNING: multiple messages have this Message-ID (diff)
From: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
To: David Daney <ddaney.cavm@gmail.com>
Cc: Markos Chandras <markos.chandras@imgtec.com>, linux-mips@linux-mips.org
Subject: Re: [PATCH 4/6] MIPS: mm: Use the TLBINVF instruction to flush the VTLB
Date: Mon, 11 Nov 2013 12:55:57 -0800	[thread overview]
Message-ID: <5281445D.9090001@imgtec.com> (raw)
Message-ID: <20131111205557.rGiosuKC8RM0fKQ6TakV8N_0y5hragsoi7Wo82TJiPk@z> (raw)
In-Reply-To: <528139B1.9010909@gmail.com>

On 11/11/2013 12:10 PM, David Daney wrote:
> On 11/07/2013 09:08 AM, Markos Chandras wrote:
>> From: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
>>
>> The TLBINVF instruction can be used to flush the entire VTLB.
>> This eliminates the need for the TLBWI loop and improves performance.
>>
>> Reviewed-by: Paul Burton <paul.burton@imgtec.com>
>> Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
>> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
>
>
> This should be split into two patches.  One for each file.
>
> Also...
>
>> ---
>>   arch/mips/include/asm/mipsregs.h | 13 +++++++++++++
>>   arch/mips/mm/tlb-r4k.c           | 18 ++++++++++++------
>>   2 files changed, 25 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/mips/include/asm/mipsregs.h 
>> b/arch/mips/include/asm/mipsregs.h
>> index 412fe99..9cd0e13 100644
>> --- a/arch/mips/include/asm/mipsregs.h
>> +++ b/arch/mips/include/asm/mipsregs.h
>> @@ -685,6 +685,19 @@ static inline int mm_insn_16bit(u16 insn)
>>   }
>>
>>   /*
>> + * TLB Invalidate Flush
>> + */
>> +static inline void tlbinvf(void)
>> +{
>> +    __asm__ __volatile__(
>> +        ".set push\n\t"
>> +        ".set noreorder\n\t"
>
> ... Why do you need noreorder here?

Historically. Just copied a worked stuff right before this function and 
doesn't bother "why it is needed in other functions".

>
>> +        ".word 0x42000004\n\t" /* tlbinvf */
>> +        ".set pop");
>> +}
>> +
>> +
>> +/*
>>    * Functions to access the R10000 performance counters. These are 
>> basically
>>    * mfc0 and mtc0 instructions from and to coprocessor register with 
>> a 5-bit
>>    * performance counter number encoded into bits 1 ... 5 of the 
>> instruction.
>> diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
>> index 363aa03..427dcac 100644
>> --- a/arch/mips/mm/tlb-r4k.c
>> +++ b/arch/mips/mm/tlb-r4k.c
>> @@ -83,13 +83,19 @@ void local_flush_tlb_all(void)
>>       entry = read_c0_wired();
>>
>>       /* Blast 'em all away. */
>> -    while (entry < current_cpu_data.tlbsize) {
>> -        /* Make sure all entries differ. */
>> -        write_c0_entryhi(UNIQUE_ENTRYHI(entry));
>> -        write_c0_index(entry);
>> +    if (cpu_has_tlbinv && current_cpu_data.tlbsize) {
>> +        write_c0_index(0);
>>           mtc0_tlbw_hazard();
>> -        tlb_write_indexed();
>> -        entry++;
>> +        tlbinvf();  /* invalidate VTLB */
>> +    } else {
>> +        while (entry < current_cpu_data.tlbsize) {
>> +            /* Make sure all entries differ. */
>> +            write_c0_entryhi(UNIQUE_ENTRYHI(entry));
>> +            write_c0_index(entry);
>> +            mtc0_tlbw_hazard();
>> +            tlb_write_indexed();
>> +            entry++;
>> +        }
>>       }
>>       tlbw_use_hazard();
>>       write_c0_entryhi(old_ctx);
>>
>

  reply	other threads:[~2013-11-11 20:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-07 17:08 [PATCH 0/6] Add support for the proAptiv core Markos Chandras
2013-11-07 17:08 ` Markos Chandras
2013-11-07 17:08 ` [PATCH 1/6] MIPS: Add missing bits for Config registers Markos Chandras
2013-11-07 17:08   ` Markos Chandras
2013-11-11 20:00   ` David Daney
2013-11-07 17:08 ` [PATCH 2/6] MIPS: mm: Move UNIQUE_ENTRYHI macro to a header file Markos Chandras
2013-11-07 17:08   ` Markos Chandras
2013-11-07 17:08 ` [PATCH 3/6] MIPS: Add support for the proAptiv cores Markos Chandras
2013-11-07 17:08   ` Markos Chandras
2013-11-11 19:59   ` David Daney
2013-11-12  9:41     ` Markos Chandras
2013-11-12  9:41       ` Markos Chandras
2013-11-07 17:08 ` [PATCH 4/6] MIPS: mm: Use the TLBINVF instruction to flush the VTLB Markos Chandras
2013-11-07 17:08   ` Markos Chandras
2013-11-11 20:10   ` David Daney
2013-11-11 20:55     ` Leonid Yegoshin [this message]
2013-11-11 20:55       ` Leonid Yegoshin
2013-11-12  9:40     ` Markos Chandras
2013-11-12  9:40       ` Markos Chandras
2013-11-07 17:08 ` [PATCH 5/6] MIPS: Add support for FTLBs Markos Chandras
2013-11-07 17:08   ` Markos Chandras
2013-11-07 17:08 ` [PATCH 6/6] MIPS: Add debugfs file to print the segmentation control registers Markos Chandras
2013-11-07 17:08   ` Markos Chandras

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=5281445D.9090001@imgtec.com \
    --to=leonid.yegoshin@imgtec.com \
    --cc=ddaney.cavm@gmail.com \
    --cc=linux-mips@linux-mips.org \
    --cc=markos.chandras@imgtec.com \
    /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