Skip to contentSkip to conversation

[uml-devel] [[email protected]: Re: ps u failed with signal 8 (FPE)]

uml-devel Gerd Knorr 3 participants 4 messages Jan 22, 2004 – Jan 28, 2004 User-mode Linux (UML)

lore
Share & tools
lore

Gerd Knorr

author
#0 lore raw

Hi,

"ps u" doesn't work in uml due to some values in /proc/meminfo being zero, see below for details,

Gerd

----- Forwarded message from Sebastian Koch <[email protected]> -----

Date: Thu, 22 Jan 2004 11:20:17 +0100 (MET)
From: Sebastian Koch <[email protected]>
Subject: Re: ps u failed with signal 8 (FPE)
To: Albert Cahalan <[email protected]>
cc: Sebastian Koch <[email protected]>,
Gerd Knorr <[email protected]>
Importance: high
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Bogosity: Unsure, tests=bogofilter, spamicity=0.482720, version=0.15.13

I've found it.

The problem is that the proc file system of the UML shows a wrong /proc/meminfo. Especially the MemTotal:

Achen:~ # p /proc/meminfo

MemTotal:            0 kB
MemFree:         33656 kB
Buffers:           752 kB
Cached:          19756 kB
SwapCached:          0 kB
Active:          12236 kB
Inactive:        10600 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:            0 kB
LowFree:         33656 kB
SwapTotal:      262136 kB
SwapFree:       262136 kB
Dirty:              16 kB
Writeback:           0 kB
Mapped:           5360 kB
Slab:             3264 kB
Committed_AS:    27144 kB
PageTables:        172 kB
VmallocTotal:   449516 kB
VmallocUsed:       184 kB
VmallocChunk:   449332 kB

Achen:~ #

This leeds to divide by zero in ps/output.c line 785 because the kb_main_total == 0.

/* pp->vm_rss * 1000 would overflow on 32-bit systems with 64 GB memory */ static int pr_pmem(char *restrict const outbuf, const proc_t *restrict const pp){
unsigned long pmem = 0;
pmem = pp->vm_rss * 1000ULL / kb_main_total;
if (pmem > 999) pmem = 999;
return snprintf(outbuf, COLWID, "%2u.%u", (unsigned)(pmem/10),
(unsigned)(pmem%10));
}

Do you want to setup a consistence check after reading the proc/meminfo ?

I will try to find out the problem in UML.

Best regards
Sebastian

Quoted 11 lines · Albert Cahalan
Quoted 1 line · Sebastian Koch

Probably this is a known bug.

Nope. I've not seen this one.

Quoted 4 lines

If you need additional information regarding the UML-, host-kernel or the root file system please let me know. I can provide a backtrace if someone point me out where to set a breakpoint. To be honest I don't understand the kernel FPE signal handling at this moment.

Quoted 8 lines

This could be caused by integer division by zero.
If you can get the siginfo data, that would be
enough to determine this.

Also, try this: ps --info

--

----- End forwarded message -----

Signature · 12 lines
"... und auch das ganze Wochenende oll" -- Wetterbericht auf RadioEins


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#1 lore raw
Quoted 2 lines · Gerd Knorr

"ps u" doesn't work in uml due to some values in /proc/meminfo being zero, see below for details,

Works fine here:

user@uml ~$ ps u

USER      PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
user     7112  0.0  0.0  2200    4 pts/1    S    Jan03   0:00 /bin/bash
user    12177  0.0  1.5  2192  444 pts/0    S    Jan09   0:00 -bash
user    12182  0.0  1.8  2312  520 pts/0    S    Jan09   0:00 screen -r
user    12219  0.0  4.6  2208 1288 pts/2    S    Jan09   0:00 /bin/bash
user    12224  0.0  2.5  2536  724 pts/2    R    Jan09   0:00 ps u
user@uml ~$ cat /proc/meminfo
        total:    used:    free:  shared: buffers:  cached:
 Mem:  28614656 27774976   839680        0   806912 21946368
Swap: 134209536 11239424 122970112
MemTotal:        27944 kB
MemFree:           820 kB
MemShared:           0 kB
Buffers:           788 kB
Cached:          20028 kB
SwapCached:       1404 kB
Active:           1968 kB
Inactive:        21180 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:        27944 kB
LowFree:           820 kB
SwapTotal:      131064 kB
SwapFree:       120088 kB

user@uml ~$ cat /proc/version
Linux version 2.4.22-4bgstatic-6um ([email protected]) (gcc version 3.3) #1 Mon Dec 1 01:18:56 CET 2003

user@host ~$ cat /proc/version
Linux version 2.4.23-0tr1bg ([email protected]) (gcc version 3.3) #1 Sun Nov 30 17:08:50 CET 2003

So what version of uml are you talking about.

Signature · 15 lines
/"\ Goetz Bock at blacknet dot de  --  secure mobile Linux everNETting
\ /                     (c) 2003 as GNU FDL 1.1
 X   [ 1. Use descriptive subjects - 2. Edit a reply for brevity -  ]
/ \  [ 3. Reply to the list - 4. Read the archive *before* you post ]


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
author
#2 lore raw
Quoted 7 lines · Goetz Bock
Quoted 2 lines · Gerd Knorr

"ps u" doesn't work in uml due to some values in /proc/meminfo being zero, see below for details,

Works fine here:

user@uml ~$ cat /proc/version
Linux version 2.4.22-4bgstatic-6um ([email protected]) (gcc version 3.3) #1 Mon Dec 1 01:18:56 CET 2003

The kernel in question is 2.6.x ...

Gerd

Signature · 12 lines
"... und auch das ganze Wochenende oll" -- Wetterbericht auf RadioEins


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#3 lore raw
In reply to Gerd Knorr
Quoted 2 lines · [email protected] said:

The problem is that the proc file system of the UML shows a wrong / proc/meminfo. Especially the MemTotal:

Nice catch. I was wondering about that SIGFPE crash. Try the patch below.

Jeff

===== arch/um/kernel/mem.c 1.21 vs edited =====

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

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel