All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] syscall sysinfo error
@ 2004-02-15 16:35 Martin Theiß
  2004-02-16 20:20 ` Jeff Dike
  2004-02-18 15:44 ` BlaisorBlade
  0 siblings, 2 replies; 3+ messages in thread
From: Martin Theiß @ 2004-02-15 16:35 UTC (permalink / raw)
  To: user-mode-linux-devel

[-- Attachment #1: Type: text/plain, Size: 4759 bytes --]

recently i tried to run debian-installer on a 2.6.2 uml kernel. it didn't
work. i determined the problem has to be the syscall sysinfo. it return
zeroed values for totalram and totalswap. i proved the problem by creating
an initrd containing this as linuxrc executable:

#include <stdio.h>

struct sysinfo {
	long uptime;                    /* Seconds since boot */
	unsigned long loads[3];         /* 1, 5, and 15 minute load averages */
	unsigned long totalram;         /* Total usable main memory size */
	unsigned long freeram;          /* Available memory size */
	unsigned long sharedram;        /* Amount of shared memory */
	unsigned long bufferram;        /* Memory used by buffers */
	unsigned long totalswap;        /* Total swap space size */
	unsigned long freeswap;         /* swap space still available */
	unsigned short procs;           /* Number of current processes */
	unsigned short pad;             /* Padding needed for m68k */
	unsigned long totalhigh;        /* Total high memory size */
	unsigned long freehigh;         /* Available high memory size */
	unsigned int mem_unit;          /* Memory unit size in bytes */
	char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
};

extern int sysinfo (struct sysinfo* info);

int main(void) {
	struct sysinfo info;
	sysinfo(&info);
	printf("info.mem_unit  = %d\n", info.mem_unit);
	printf("info.totalram  = %d\n", info.totalram);
	printf("info.totalswap = %d\n", info.totalswap);
	return 0;
}

The output of the kernel is following:


Checking for the skas3 patch in the host...found
Checking for /proc/mm...found
Linux version 2.6.2-guml-ipt+initrd-1um (mtheiss@scara) (gcc version 3.3.2 (Debian)) #8 Sun Feb 15 16:06:36 CET 2004
On node 0 totalpages: 32768
  DMA zone: 32768 pages, LIFO batch:8
  Normal zone: 0 pages, LIFO batch:1
  HighMem zone: 0 pages, LIFO batch:1
Building zonelist for node : 0
Kernel command line: ubd0=rootfs mem=128MB ramdisk_size=16384 initrd=root.bin root=98:0
PID hash table entries: 16 (order 4: 128 bytes)
Memory: 119200k available
Calibrating delay loop... 1340.21 BogoMIPS
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
checking if image is initramfs...it isn't (no cpio magic); looks like an initrd
Freeing initrd memory: 6900k freed
Checking for host processor cmov support...Yes
Checking for host processor xmm support...No
Checking that ptrace can change system call numbers...OK
Checking that host ptys support output SIGIO...Yes
Checking that host ptys support SIGIO on close...No, enabling workaround
Checking for /dev/anon on the host...Not available (open failed with errno 2)
POSIX conformance testing by UNIFIX
NET: Registered protocol family 16
mconsole (version 2) initialized on /home/mtheiss/.uml/mkRSl9/mconsole
ikconfig 0.7 with /proc/config*
Could not kern_mount tmpfs
Initializing Cryptographic API
pty: 256 Unix98 ptys configured
RAMDISK driver initialized: 16 RAM disks of 16384K size 1024 blocksize
loop: loaded (max 8 devices)
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 8192 bind 16384)
ip_conntrack version 2.1 (932 buckets, 7456 max) - 296 bytes per conntrack
ip_tables: (C) 2000-2002 Netfilter core team
ipt_recent v0.3.1: Stephen Frost <sfrost@snowman.net>.  http://snowman.net/projects/ipt_recent/
NET: Registered protocol family 1
NET: Registered protocol family 17
Initializing software serial port version 1
Using anticipatory io scheduler
 ubda: unknown partition table
Initializing stdio console driver
RAMDISK: ext2 filesystem found at block 0
RAMDISK: Loading 6900 blocks [1 disk] into ram disk... done.
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
VFS: Mounted root (ext2 filesystem).
info.mem_unit  = 1
info.totalram  = 0
info.totalswap = 0
kjournald starting.  Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem) readonly.
Trying to move old root to /initrd ... failed
Unmounting old root
Trying to free ramdisk memory ... okay
Warning: unable to open an initial console.
Kernel panic: No init found.  Try passing init= option to kernel.

Is this a general problem of uml or is it a problem of busybox, which is
using this method to determine the amount of free memory?

Greetings
Martin

-- 
Martin Theiß <mtheiss@neo.wh-stutgart.de>
GPG-Fingerprint: EC80 53A2 F0A2 6E6C 74D2  CB6E 002A F6D3 E78B 7F45

The box said 'Requires Windows 95 or better', so I installed Linux - TKK 5

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [uml-devel] syscall sysinfo error
  2004-02-15 16:35 [uml-devel] syscall sysinfo error Martin Theiß
@ 2004-02-16 20:20 ` Jeff Dike
  2004-02-18 15:44 ` BlaisorBlade
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Dike @ 2004-02-16 20:20 UTC (permalink / raw)
  To: Martin Theiß; +Cc: user-mode-linux-devel

mtheiss@neo.wh-stuttgart.de said:
> recently i tried to run debian-installer on a 2.6.2 uml kernel. it
> didn't work. i determined the problem has to be the syscall sysinfo.
> it return zeroed values for totalram and totalswap.

Nice diagnosis.  This looks fixed to me in the 2.6.3-rc2 UML.  I fixed
a bug with totalram_pages being duplicate (and leaving the generic totalram
at zero).  However, I didn't do anything with totalswap.

Now, /proc/meminfo shows
	SwapTotal:     1049592 kB
	SwapFree:      1049592 kB

and your little demo shows

	info.mem_unit  = 1
	info.totalram  = 128688128
	info.totalswap = 1074782208

				Jeff



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [uml-devel] syscall sysinfo error
  2004-02-15 16:35 [uml-devel] syscall sysinfo error Martin Theiß
  2004-02-16 20:20 ` Jeff Dike
@ 2004-02-18 15:44 ` BlaisorBlade
  1 sibling, 0 replies; 3+ messages in thread
From: BlaisorBlade @ 2004-02-18 15:44 UTC (permalink / raw)
  To: user-mode-linux-devel; +Cc: Martin Theiß

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

Alle 17:35, domenica 15 febbraio 2004, Martin Theiß ha scritto:
> recently i tried to run debian-installer on a 2.6.2 uml kernel.
> it didn't
> work. i determined the problem has to be the syscall sysinfo. it return
> zeroed values for totalram and totalswap.
0 for total swap is correct in your case, since you do not enable a swap; 0 
for total ram is wrong but has been fixed in the official Uml patch 2.6.3-rc2 
(it seems that it applies well onto 2.6.2; there are two rejects which must 
be ignored). Or better: the patch fixes the 0 value for totalRam in 
/proc/meminfo; that should fix also the sysinfo value, but if it does not, 
just complain again.

If you want to use patch 2.6.1, apply the attached patch on top of that to fix 
things.

>
> Is this a general problem of uml or is it a problem of busybox, which is
> using this method to determine the amount of free memory?
A uml 2.6 (now fixed) bug, which creates problem to anything using this 
(correct) method. It also caused ps u to crash for a division by 0.

Bye
-- 
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729

[-- Attachment #2: C-07-Ps_crash_fix.patch --]
[-- Type: text/x-diff, Size: 259 bytes --]

--- 1.21/arch/um/kernel/mem.c   Thu Jan  8 07:43:01 2004
+++ edited/arch/um/kernel/mem.c Mon Jan 26 11:02:13 2004
@@ -30,7 +30,6 @@
 int kmalloc_ok = 0;
 
 static unsigned long brk_end;
-static unsigned long totalram_pages = 0;
 
 void unmap_physmem(void)
 {

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-02-18 18:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-15 16:35 [uml-devel] syscall sysinfo error Martin Theiß
2004-02-16 20:20 ` Jeff Dike
2004-02-18 15:44 ` BlaisorBlade

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.