Date: Tue, 28 Mar 2000 18:14:30 +0300 From: Ruslan Ermilov <ru@ucb.crimea.ua> To: Mikhail Teterin <mi@kot.ne.mediaone.net> Cc: stable@freebsd.org, Bruce Evans <bde@freebsd.org> Subject: Re: top, systat )-: (all rebuilt!) Message-ID: <20000328181430.A41307@relay.ucb.crimea.ua> In-Reply-To: <200003281453.JAA01102@rtfm.newton>; from Mikhail Teterin on Tue, Mar 28, 2000 at 09:53:20AM -0500 References: <20000328100840.B7725@relay.ucb.crimea.ua> <200003281453.JAA01102@rtfm.newton>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Tue, Mar 28, 2000 at 09:53:20AM -0500, Mikhail Teterin wrote:
> Ruslan Ermilov once stated:
>
> =Do you use loader(8), or directly boot your kernel from boot blocks?
>
> Directly... Is that what it is?!?
>
Yes, starting from the following files/revisions:
peter 1999/12/26 23:14:59 PST
Modified files:
lib/libkvm kvm.c kvm_alpha.c kvm_file.c
kvm_getloadavg.c kvm_getswapinfo.c
kvm_i386.c kvm_nlist.3 kvm_private.h
kvm_proc.c kvm_sparc.c
Log:
Use kldsym(2) to lookup symbol values. This avoids the kvm_mkdb juggling
and is module aware. Yes, this means that kvm_nlist(3) will find symbols
in loaded modules. The emulation of the nlist struct is pretty crude but
seems to work well enough for all the users in the tree that I found.
Revision Changes Path
1.12 +22 -113 src/lib/libkvm/kvm.c
1.4 +1 -2 src/lib/libkvm/kvm_alpha.c
1.9 +5 -0 src/lib/libkvm/kvm_file.c
1.3 +5 -1 src/lib/libkvm/kvm_getloadavg.c
1.10 +1 -2 src/lib/libkvm/kvm_getswapinfo.c
1.11 +5 -1 src/lib/libkvm/kvm_i386.c
1.5 +7 -9 src/lib/libkvm/kvm_nlist.3
1.5 +1 -1 src/lib/libkvm/kvm_private.h
1.25 +7 -2 src/lib/libkvm/kvm_proc.c
1.3 +5 -1 src/lib/libkvm/kvm_sparc.c
Could you please try the following two patches (kindly provided by
Bruce Evans), and tell us whether they help you.
There is a kern/17422 on this issue, please follow-up to it.
Cheers,
--
Ruslan Ermilov Sysadmin and DBA of the
ru@ucb.crimea.ua United Commercial Bank,
ru@FreeBSD.org FreeBSD committer,
+380.652.247.647 Simferopol, Ukraine
http://www.FreeBSD.org The Power To Serve
http://www.oracle.com Enabling The Information Age
[-- Attachment #2 --]
Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16])
by relay.ucb.crimea.ua (8.9.3/8.9.3/UCB) with ESMTP id EAA76938
for <ru@ucb.crimea.ua>; Tue, 14 Mar 2000 04:52:39 +0200 (EET)
(envelope-from bde@zeta.org.au)
Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102])
by mailman.zeta.org.au (8.8.7/8.8.7) with ESMTP id NAA05065;
Tue, 14 Mar 2000 13:58:35 +1100
Date: Tue, 14 Mar 2000 13:51:49 +1100 (EST)
From: Bruce Evans <bde@zeta.org.au>
X-Sender: bde@alphplex.bde.org
To: Ruslan Ermilov <ru@ucb.crimea.ua>
cc: Jordan Hubbard <jkh@FreeBSD.org>, committers@FreeBSD.org
Subject: Re: [4.0-ERRATA candidate?] loader(8)/kvm(3) interoperability issue
In-Reply-To: <20000313194345.A52651@relay.ucb.crimea.ua>
Message-ID: <Pine.BSF.4.21.0003141325520.2522-100000@alphplex.bde.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
On Mon, 13 Mar 2000, Ruslan Ermilov wrote:
> One thing that should IMHO be pointed out in the upcoming 4.0-RELEASE's
> ERRATA (or some more appropriate place), is the fact that the loader(8)
> is now a prerequisite for certain programs using kvm(3) interface.
> Obvious examples are top(1) and swapinfo(8).
>
> If you boot your kernel without loader(8), directly through bootblocks,
> these programs will not work.
I don't user loader(8), and finally got around to fixing this. The
problem is that the kernel linker wants module data for the kernel.
It defaults to using incomplete data if none is present. The following
supplies slightly less incomplete data:
diff -c2 machdep.c~ machdep.c
*** machdep.c~ Tue Feb 29 19:18:29 2000
--- machdep.c Mon Mar 6 10:05:52 2000
***************
*** 1809,1812 ****
--- 1799,1816 ----
preload_metadata = (caddr_t)bootinfo.bi_modulep + KERNBASE;
preload_bootstrap_relocate(KERNBASE);
+ } else {
+ static u_int32_t oldmoduledata[] = {
+ 1, sizeof("kernel"), 0, 0,
+ 2, sizeof("elf kernel"), 0, 0, 0,
+ 0x8004, 4, 0,
+ 0x8003, 4, 0,
+ 0, 0,
+ };
+
+ preload_metadata = (caddr_t)&oldmoduledata[0];
+ strcpy((char *)&oldmoduledata[2], "kernel");
+ strcpy((char *)&oldmoduledata[6], "elf kernel");
+ oldmoduledata[11] = roundup2(bootinfo.bi_esymtab, 4);
+ oldmoduledata[14] = bootinfo.bi_symtab;
}
if (bootinfo.bi_envp)
Bruce
[-- Attachment #3 --]
Received: from gidora.zeta.org.au (gidora.zeta.org.au [203.26.10.25])
by relay.ucb.crimea.ua (8.9.3/8.9.3/UCB) with SMTP id QAA33103
for <ru@ucb.crimea.ua>; Wed, 22 Mar 2000 16:34:11 +0200 (EET)
(envelope-from bde@zeta.org.au)
Received: (qmail 25547 invoked from network); 22 Mar 2000 14:33:30 -0000
Received: from bde.zeta.org.au (203.2.228.102)
by gidora.zeta.org.au with SMTP; 22 Mar 2000 14:33:30 -0000
Date: Thu, 23 Mar 2000 01:33:15 +1100 (EST)
From: Bruce Evans <bde@zeta.org.au>
X-Sender: bde@alphplex.bde.org
To: Ruslan Ermilov <ru@ucb.crimea.ua>
Subject: Re: [4.0-ERRATA candidate?] loader(8)/kvm(3) interoperability issue
In-Reply-To: <20000321213700.A64137@relay.ucb.crimea.ua>
Message-ID: <Pine.BSF.4.21.0003230126570.275-100000@alphplex.bde.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
> Hmm, the kernel with this patch panics with fatal trap 12 earlier,
> right after it reports the amount of available memory, if I boot
> without loader(8), but works perfectly, if I do use loader(8).
The symbol addresses in struct bootinfo were garbage when the symbol
table was loaded but DDB was not configured.
diff -c2 locore.s~ locore.s
*** locore.s~ Mon Dec 6 11:12:51 1999
--- locore.s Thu Mar 23 01:11:57 2000
***************
*** 45,51 ****
#include "opt_bootp.h"
- #include "opt_ddb.h"
#include "opt_nfsroot.h"
- #include "opt_userconfig.h"
#include <sys/syscall.h>
--- 45,49 ----
***************
*** 751,756 ****
movl $R(_end),%esi
! /* include symbols if loaded and useful */
! #ifdef DDB
movl R(_bootinfo+BI_ESYMTAB),%edi
testl %edi,%edi
--- 749,753 ----
movl $R(_end),%esi
! /* Include symbols, if any. */
movl R(_bootinfo+BI_ESYMTAB),%edi
testl %edi,%edi
***************
*** 761,765 ****
addl %edi,R(_bootinfo+BI_ESYMTAB)
over_symalloc:
- #endif
/* If we are told where the end of the kernel space is, believe it. */
--- 758,761 ----
Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000328181430.A41307>
