Skip to content

Commit

Permalink
[S390] memory detection misses 128k.
Browse files Browse the repository at this point in the history
Fix a memory leak problem in the memory detection routines.  A memory leak
of 128k occurs when we have a contiguous memory with mixed access-mode
(read or write) ranges.

Signed-off-by: Hongjie Yang <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
  • Loading branch information
Hongjie Yang authored and Martin Schwidefsky committed Jan 9, 2007
1 parent efa0670 commit dd401e2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 11 additions & 1 deletion arch/s390/kernel/head31.S
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,14 @@ startup_continue:
srl %r7,28
clr %r6,%r7 # compare cc with last access code
be .Lsame-.LPG1(%r13)
b .Lchkmem-.LPG1(%r13)
lhi %r8,0 # no program checks
b .Lsavchk-.LPG1(%r13)
.Lsame:
ar %r5,%r1 # add 128KB to end of chunk
bno .Lloop-.LPG1(%r13) # r1 < 0x80000000 -> loop
.Lchkmem: # > 2GB or tprot got a program check
lhi %r8,1 # set program check flag
.Lsavchk:
clr %r4,%r5 # chunk size > 0?
be .Lchkloop-.LPG1(%r13)
st %r4,0(%r3) # store start address of chunk
Expand All @@ -190,8 +193,15 @@ startup_continue:
je .Ldonemem # if not, leave
chi %r10,0 # do we have chunks left?
je .Ldonemem
chi %r8,1 # program check ?
je .Lpgmchk
lr %r4,%r5 # potential new chunk
alr %r5,%r1 # add 128KB to end of chunk
j .Llpcnt
.Lpgmchk:
alr %r5,%r1 # add 128KB to end of chunk
lr %r4,%r5 # potential new chunk
.Llpcnt:
clr %r5,%r9 # should we go on?
jl .Lloop
.Ldonemem:
Expand Down
12 changes: 11 additions & 1 deletion arch/s390/kernel/head64.S
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,15 @@ startup_continue:
srl %r7,28
clr %r6,%r7 # compare cc with last access code
je .Lsame
j .Lchkmem
lghi %r8,0 # no program checks
j .Lsavchk
.Lsame:
algr %r5,%r1 # add 128KB to end of chunk
# no need to check here,
brc 12,.Lloop # this is the same chunk
.Lchkmem: # > 16EB or tprot got a program check
lghi %r8,1 # set program check flag
.Lsavchk:
clgr %r4,%r5 # chunk size > 0?
je .Lchkloop
stg %r4,0(%r3) # store start address of chunk
Expand All @@ -204,8 +207,15 @@ startup_continue:
chi %r10, 0 # do we have chunks left?
je .Ldonemem
.Lhsaskip:
chi %r8,1 # program check ?
je .Lpgmchk
lgr %r4,%r5 # potential new chunk
algr %r5,%r1 # add 128KB to end of chunk
j .Llpcnt
.Lpgmchk:
algr %r5,%r1 # add 128KB to end of chunk
lgr %r4,%r5 # potential new chunk
.Llpcnt:
clgr %r5,%r9 # should we go on?
jl .Lloop
.Ldonemem:
Expand Down

0 comments on commit dd401e2

Please sign in to comment.