Re: kmem_alloc: out of kernel memory

Norman Feske <[email protected]> Mon, 18 Jul 2011 15:57:26 +0200
Newsgroups gmane.comp.micro-kernel.l4.l4ka.general
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------030400070106020900020807
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello,

we hit the same problem today. Apparently, it is triggered by recent
versions of binutils, which seem to interpret the result of the address
calculation for Pistachio's '_memory_descriptors_raw' as
section-relative value. But this symbol address must be absolute. The
attached patch fixes the problem by explicitly using ld's 'ABSOLUTE'
function.

Cheers
Norman

On 06/29/2011 09:52 AM, Jan Stoess wrote:
> There seems to be something terribly broken :-/
>=20
> Can you do me a favor and send me your kernel config (the config dir in=
 your build directory)?
>=20
> Thanks,
> -Jan=20
>=20
> --
> Dr. Jan Stoess, KIT System Architecture Group
> Phone: +49 (721) 6084 4056
>=20
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]
>> karlsruhe.de] On Behalf Of David Silcott
>> Sent: Monday, May 30, 2011 9:28 PM
>> To: [email protected]
>> Subject: kmem_alloc: out of kernel memory
>>
>> Hi,
>>
>> I've synced my local copy of Pistachio against the latest available an=
d now all
>> of my builds are reporting an out of memory error when I try to run an=
y
>> application, even pingpong or memtest. Below is the output I receive w=
hen I
>> attempt to run memtest
>>
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> =3D=3D=3D=3D=3D=3D=3D
>>
>> KickStart 0.13.06
>> Detected multiboot compliant loader
>>  kernel    (0x00824000-0x0090ad41)   =3D> 0x001ef4d0
>>   (0x00824000-0x0083f388) -> 0x00100000-0x0011b388
>>   (0x00840000-0x00840028) -> 0x0011c000-0x0011c028
>>   (0x00841000-0x0084a376) -> 0x0011d000-0x00126376
>>   (0x0084b000-0x008ef0c0) -> 0x00127000-0x001cb0c0
>>   (0x008f0000-0x008f4338) -> 0x001ec000-0x001f0338
>>  sigma0    (0x0090b000-0x0092eb24)   =3D> 0x00020000
>>   (0x0090c000-0x00915524) -> 0x00020000-0x00029524
>>  roottask  (0x0092f000-0x0093d424)   =3D> 0x00400000
>>   (0x00930000-0x00935044) -> 0x00400000-0x00405044 Launching kernel ..=
.
>>
>> L4Ka::Pistachio - built on May 28 2011 21:39:10 by david@andesite usin=
g gcc
>> version 3.3.6
>> --- "KD# kmem_alloc: out of kernel memory" ---
>> --------------------------------- (eip=3Df010909c, esp=3D00000000) ---
>>
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> =3D=3D=3D=3D=3D=3D=3D
>>
>>
>> A query of the memory statistics reveals the following:
>>
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> =3D=3D=3D=3D=3D=3D=3D
>>
>> /stats> kmem
>> Kernel memory statistics:
>>   Chunk size  =3D 1024 bytes
>>   Free chunks =3D 2 (2KB)
>>
>>   Consecutive   Number of
>>   chunks        matches
>>         1            2
>>         2            1
>>         4            0
>>         8            0
>>        16            0
>>        32            0
>>        64            0
>>       128            0
>>       256            0
>>       512            0
>>      1024+           0
>>
>>   Max consecutive chunks: 2
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> =3D=3D=3D=3D=3D=3D=3D
>>
>>
>>  I get the same results even if I explicitly pass  memory values to
>> kickstart:    maxmem=3D1G  kmem=3D128M
>>
>> I have tried several versions of GCC with 3.3.6 being the last but all=
 have
>> reported some form of 'out of memory' error and the error occurs both =
on
>> qemu and on a physical machine.
>>
>> The processor and memory spcecs of my test machine are:
>>
>> CPU: Intel Core 2 duo
>> Memory: 4G
>>
>> Can anyone see what I am doing wrong? I didn't have this problem befor=
e
>> updated pistachio
>>
>> I have attached a copy of my config.out file.
>>
>> Regards
>> David

--=20
Dr.-Ing. Norman Feske
Genode Labs

http://www.genode-labs.com =B7 http://genode.org

Genode Labs GmbH =B7 Amtsgericht Dresden =B7 HRB 28424 =B7 Sitz Dresden
Gesch=E4ftsf=FChrer: Dr.-Ing. Norman Feske, Christian Helmuth

--------------030400070106020900020807
Content-Type: text/plain;
 name="binutils_2.21_fix.export"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="binutils_2.21_fix.export"

# HG changeset patch
# User Norman Feske <[email protected]>
# Date 1310996644 -7200
# Node ID d607d7b9090b5efd1e4aa7347b00ea43bf807d17
# Parent  cc50e20f0544a5886c3bd0d464ef16ed600a2126
- Explicitly declare '_memory_descriptors_raw' absolute as needed to build
  Pistachio with binutils newer than version 2.20

diff -r cc50e20f0544 -r d607d7b9090b kernel/src/api/v4/kip.ldi
--- a/kernel/src/api/v4/kip.ldi	Thu Jun 02 11:33:25 2011 -0700
+++ b/kernel/src/api/v4/kip.ldi	Mon Jul 18 15:44:04 2011 +0200
@@ -43,9 +43,9 @@
 		*(.data.KIP_SECTION.mdesc)
 
 #if defined(CONFIG_IS_32BIT)
-	_memory_descriptors_raw = (_memory_descriptors_offset << 16)
-		+ _memory_descriptors_size;
+	_memory_descriptors_raw = ABSOLUTE((_memory_descriptors_offset << 16)
+		+ _memory_descriptors_size);
 #elif defined(CONFIG_IS_64BIT)
-	_memory_descriptors_raw = (_memory_descriptors_offset << 32)
-		+ _memory_descriptors_size;
+	_memory_descriptors_raw = ABSOLUTE((_memory_descriptors_offset << 32)
+		+ _memory_descriptors_size);
 #endif

--------------030400070106020900020807--