* mips64 LOAD_KPTE2 fix
@ 2003-06-02 11:14 Atsushi Nemoto
2003-06-02 11:23 ` Atsushi Nemoto
0 siblings, 1 reply; 8+ messages in thread
From: Atsushi Nemoto @ 2003-06-02 11:14 UTC (permalink / raw)
To: linux-mips, ralf
If a TLB exception occured on very high address (such as
0xffffffffffffffff), invalid_vmalloc_address should be called but
currently not.
I think it is because LOAD_KPTE2 in arch/mips64/mm/tlbex-r4k.S does
not check overflow of (kptbl + offset). Here is a patch (both 2.4 and
2.5).
diff -u linux-mips-cvs/arch/mips64/mm/tlbex-r4k.S linux.new/arch/mips64/mm/tlbex-r4k.S
--- linux-mips-cvs/arch/mips64/mm/tlbex-r4k.S Mon Apr 28 09:44:54 2003
+++ linux.new/arch/mips64/mm/tlbex-r4k.S Mon Jun 2 19:44:57 2003
@@ -72,6 +72,8 @@
/*
* Determine that fault address is within vmalloc range.
*/
+ bgez \ptr, \not_vmalloc # check overflow
+ nop
dla \tmp, ekptbl
sltu \tmp, \ptr, \tmp
beqz \tmp, \not_vmalloc # not vmalloc
---
Atsushi Nemoto
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: mips64 LOAD_KPTE2 fix
2003-06-02 11:14 mips64 LOAD_KPTE2 fix Atsushi Nemoto
@ 2003-06-02 11:23 ` Atsushi Nemoto
2003-06-03 12:58 ` Maciej W. Rozycki
0 siblings, 1 reply; 8+ messages in thread
From: Atsushi Nemoto @ 2003-06-02 11:23 UTC (permalink / raw)
To: anemo; +Cc: linux-mips, ralf
>>>>> On Mon, 02 Jun 2003 20:14:53 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> said:
anemo> If a TLB exception occured on very high address (such as
anemo> 0xffffffffffffffff), invalid_vmalloc_address should be called
anemo> but currently not.
anemo> I think it is because LOAD_KPTE2 in arch/mips64/mm/tlbex-r4k.S
anemo> does not check overflow of (kptbl + offset). Here is a patch
anemo> (both 2.4 and 2.5).
Please ignore it. I missed an another fix. The beqz lacks delay
slot. Here is a new patch.
diff -u linux-mips-cvs/arch/mips64/mm/tlbex-r4k.S linux.new/arch/mips64/mm/tlbex-r4k.S
--- linux-mips-cvs/arch/mips64/mm/tlbex-r4k.S Mon Apr 28 09:44:54 2003
+++ linux.new/arch/mips64/mm/tlbex-r4k.S Mon Jun 2 20:16:41 2003
@@ -72,9 +72,12 @@
/*
* Determine that fault address is within vmalloc range.
*/
+ bgez \ptr, \not_vmalloc # check overflow
+ nop
dla \tmp, ekptbl
sltu \tmp, \ptr, \tmp
beqz \tmp, \not_vmalloc # not vmalloc
+ nop
.endm
---
Atsushi Nemoto
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: mips64 LOAD_KPTE2 fix
2003-06-02 11:23 ` Atsushi Nemoto
@ 2003-06-03 12:58 ` Maciej W. Rozycki
2003-06-04 1:02 ` Atsushi Nemoto
0 siblings, 1 reply; 8+ messages in thread
From: Maciej W. Rozycki @ 2003-06-03 12:58 UTC (permalink / raw)
To: Atsushi Nemoto; +Cc: anemo, linux-mips, ralf
On Mon, 2 Jun 2003, Atsushi Nemoto wrote:
> Please ignore it. I missed an another fix. The beqz lacks delay
> slot. Here is a new patch.
>
> diff -u linux-mips-cvs/arch/mips64/mm/tlbex-r4k.S linux.new/arch/mips64/mm/tlbex-r4k.S
> --- linux-mips-cvs/arch/mips64/mm/tlbex-r4k.S Mon Apr 28 09:44:54 2003
> +++ linux.new/arch/mips64/mm/tlbex-r4k.S Mon Jun 2 20:16:41 2003
> @@ -72,9 +72,12 @@
> /*
> * Determine that fault address is within vmalloc range.
> */
> + bgez \ptr, \not_vmalloc # check overflow
> + nop
> dla \tmp, ekptbl
> sltu \tmp, \ptr, \tmp
> beqz \tmp, \not_vmalloc # not vmalloc
> + nop
> .endm
The missing delay slot filler might be called a feature, but LOAD_KPTE2
is so far always used near such code it cannot be avoided. So the "nop"
is correct. Please pay attention to proper indentation of instructions in
branch delay slots -- this helps avoiding such errors.
I don't think a separate overflow check is needed, even I see how the
code can fail for large offsets into XKSEG. How about this patch? Does
it work for you? It would not incur unnecessary overhead.
Maciej
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
patch-mips-2.4.21-pre4-20030505-load_kpte2-0
diff -up --recursive --new-file linux-mips-2.4.21-pre4-20030505.macro/arch/mips64/mm/tlbex-r4k.S linux-mips-2.4.21-pre4-20030505/arch/mips64/mm/tlbex-r4k.S
--- linux-mips-2.4.21-pre4-20030505.macro/arch/mips64/mm/tlbex-r4k.S 2003-04-27 02:56:39.000000000 +0000
+++ linux-mips-2.4.21-pre4-20030505/arch/mips64/mm/tlbex-r4k.S 2003-06-03 12:54:41.000000000 +0000
@@ -73,8 +73,9 @@
* Determine that fault address is within vmalloc range.
*/
dla \tmp, ekptbl
- sltu \tmp, \ptr, \tmp
+ slt \tmp, \ptr, \tmp
beqz \tmp, \not_vmalloc # not vmalloc
+ nop
.endm
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: mips64 LOAD_KPTE2 fix
2003-06-03 12:58 ` Maciej W. Rozycki
@ 2003-06-04 1:02 ` Atsushi Nemoto
2003-06-04 14:09 ` Maciej W. Rozycki
0 siblings, 1 reply; 8+ messages in thread
From: Atsushi Nemoto @ 2003-06-04 1:02 UTC (permalink / raw)
To: macro; +Cc: linux-mips, ralf
>>>>> On Tue, 3 Jun 2003 14:58:44 +0200 (MET DST), "Maciej W. Rozycki" <macro@ds2.pg.gda.pl> said:
macro> I don't think a separate overflow check is needed, even I see
macro> how the code can fail for large offsets into XKSEG. How about
macro> this patch? Does it work for you? It would not incur
macro> unnecessary overhead.
macro> diff -up --recursive --new-file linux-mips-2.4.21-pre4-20030505.macro/arch/mips64/mm/tlbex-r4k.S linux-mips-2.4.21-pre4-20030505/arch/mips64/mm/tlbex-r4k.S
macro> --- linux-mips-2.4.21-pre4-20030505.macro/arch/mips64/mm/tlbex-r4k.S 2003-04-27 02:56:39.000000000 +0000
macro> +++ linux-mips-2.4.21-pre4-20030505/arch/mips64/mm/tlbex-r4k.S 2003-06-03 12:54:41.000000000 +0000
macro> @@ -73,8 +73,9 @@
macro> * Determine that fault address is within vmalloc range.
macro> */
macro> dla \tmp, ekptbl
macro> - sltu \tmp, \ptr, \tmp
macro> + slt \tmp, \ptr, \tmp
macro> beqz \tmp, \not_vmalloc # not vmalloc
macro> + nop
macro> .endm
Thank you for pointing out this. I did not think very much. But you
mean "slt \tmp, \tmp, \ptr", don't you?
diff -u linux-mips-cvs/arch/mips64/mm/tlbex-r4k.S linux.new/arch/mips64/mm/tlbex-r4k.S
--- linux-mips-cvs/arch/mips64/mm/tlbex-r4k.S Mon Apr 28 09:44:54 2003
+++ linux.new/arch/mips64/mm/tlbex-r4k.S Wed Jun 4 09:45:48 2003
@@ -73,8 +73,9 @@
* Determine that fault address is within vmalloc range.
*/
dla \tmp, ekptbl
- sltu \tmp, \ptr, \tmp
+ slt \tmp, \tmp, \ptr
beqz \tmp, \not_vmalloc # not vmalloc
+ nop
.endm
---
Atsushi Nemoto
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: mips64 LOAD_KPTE2 fix
2003-06-04 1:02 ` Atsushi Nemoto
@ 2003-06-04 14:09 ` Maciej W. Rozycki
2003-06-05 0:58 ` Atsushi Nemoto
0 siblings, 1 reply; 8+ messages in thread
From: Maciej W. Rozycki @ 2003-06-04 14:09 UTC (permalink / raw)
To: Atsushi Nemoto; +Cc: linux-mips, ralf
On Wed, 4 Jun 2003, Atsushi Nemoto wrote:
> macro> diff -up --recursive --new-file linux-mips-2.4.21-pre4-20030505.macro/arch/mips64/mm/tlbex-r4k.S linux-mips-2.4.21-pre4-20030505/arch/mips64/mm/tlbex-r4k.S
> macro> --- linux-mips-2.4.21-pre4-20030505.macro/arch/mips64/mm/tlbex-r4k.S 2003-04-27 02:56:39.000000000 +0000
> macro> +++ linux-mips-2.4.21-pre4-20030505/arch/mips64/mm/tlbex-r4k.S 2003-06-03 12:54:41.000000000 +0000
> macro> @@ -73,8 +73,9 @@
> macro> * Determine that fault address is within vmalloc range.
> macro> */
> macro> dla \tmp, ekptbl
> macro> - sltu \tmp, \ptr, \tmp
> macro> + slt \tmp, \ptr, \tmp
> macro> beqz \tmp, \not_vmalloc # not vmalloc
> macro> + nop
> macro> .endm
>
>
> Thank you for pointing out this. I did not think very much. But you
> mean "slt \tmp, \tmp, \ptr", don't you?
Not at all. Why would I want to reverse the comparison?
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: mips64 LOAD_KPTE2 fix
2003-06-04 14:09 ` Maciej W. Rozycki
@ 2003-06-05 0:58 ` Atsushi Nemoto
2003-06-05 12:15 ` Maciej W. Rozycki
0 siblings, 1 reply; 8+ messages in thread
From: Atsushi Nemoto @ 2003-06-05 0:58 UTC (permalink / raw)
To: macro; +Cc: anemo, linux-mips, ralf
>>>>> On Wed, 4 Jun 2003 16:09:10 +0200 (MET DST), "Maciej W. Rozycki" <macro@ds2.pg.gda.pl> said:
>> Thank you for pointing out this. I did not think very much. But
>> you mean "slt \tmp, \tmp, \ptr", don't you?
macro> Not at all. Why would I want to reverse the comparison?
Sorry, I garbled. Please ignore my last patch. Your patch works
fine. Thank you again.
---
Atsushi Nemoto
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: mips64 LOAD_KPTE2 fix
2003-06-05 0:58 ` Atsushi Nemoto
@ 2003-06-05 12:15 ` Maciej W. Rozycki
2003-06-05 12:19 ` Ralf Baechle
0 siblings, 1 reply; 8+ messages in thread
From: Maciej W. Rozycki @ 2003-06-05 12:15 UTC (permalink / raw)
To: Atsushi Nemoto, Ralf Baechle; +Cc: linux-mips
On Thu, 5 Jun 2003, Atsushi Nemoto wrote:
> >>>>> On Wed, 4 Jun 2003 16:09:10 +0200 (MET DST), "Maciej W. Rozycki" <macro@ds2.pg.gda.pl> said:
> >> Thank you for pointing out this. I did not think very much. But
> >> you mean "slt \tmp, \tmp, \ptr", don't you?
>
> macro> Not at all. Why would I want to reverse the comparison?
>
> Sorry, I garbled. Please ignore my last patch. Your patch works
> fine. Thank you again.
Ralf, OK to apply then?
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
patch-mips-2.4.21-pre4-20030505-load_kpte2-0
diff -up --recursive --new-file linux-mips-2.4.21-pre4-20030505.macro/arch/mips64/mm/tlbex-r4k.S linux-mips-2.4.21-pre4-20030505/arch/mips64/mm/tlbex-r4k.S
--- linux-mips-2.4.21-pre4-20030505.macro/arch/mips64/mm/tlbex-r4k.S 2003-04-27 02:56:39.000000000 +0000
+++ linux-mips-2.4.21-pre4-20030505/arch/mips64/mm/tlbex-r4k.S 2003-06-03 12:54:41.000000000 +0000
@@ -73,8 +73,9 @@
* Determine that fault address is within vmalloc range.
*/
dla \tmp, ekptbl
- sltu \tmp, \ptr, \tmp
+ slt \tmp, \ptr, \tmp
beqz \tmp, \not_vmalloc # not vmalloc
+ nop
.endm
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: mips64 LOAD_KPTE2 fix
2003-06-05 12:15 ` Maciej W. Rozycki
@ 2003-06-05 12:19 ` Ralf Baechle
0 siblings, 0 replies; 8+ messages in thread
From: Ralf Baechle @ 2003-06-05 12:19 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: Atsushi Nemoto, linux-mips
On Thu, Jun 05, 2003 at 02:15:52PM +0200, Maciej W. Rozycki wrote:
> > Sorry, I garbled. Please ignore my last patch. Your patch works
> > fine. Thank you again.
>
> Ralf, OK to apply then?
Yes, please.
Ralf
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2003-06-05 12:20 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-02 11:14 mips64 LOAD_KPTE2 fix Atsushi Nemoto
2003-06-02 11:23 ` Atsushi Nemoto
2003-06-03 12:58 ` Maciej W. Rozycki
2003-06-04 1:02 ` Atsushi Nemoto
2003-06-04 14:09 ` Maciej W. Rozycki
2003-06-05 0:58 ` Atsushi Nemoto
2003-06-05 12:15 ` Maciej W. Rozycki
2003-06-05 12:19 ` Ralf Baechle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox