vmubc for Tru64 5.0 ?

From: Paul Szabo <psz_at_maths.usyd.edu.au>
Date: Wed, 23 Feb 2000 10:33:26 +1100 (EST)

On 3 Nov 1999 Toni Harbaugh-Blackford wrote:

> Does anyone have patches that will allow vmubc to compile on Tru64 v5.0 ?

It compiles just fine, but dies with message

  kmem - cannot read machine_slot

Vmubc (in file system.c) uses nlist() to look up addresses in kmem for:

  machine_slot
  ubc_dirtypages
  ubc_maxpages
  ubc_minpages
  ubc_pages

but these are not available at V5. Which is rather odd: line 108 of file
/usr/include/mach/machine.h has "extern machine_slot_t *machine_slot;" but
still no /sys/BINARY/*.mod files have this (as an external symbol: used to
be defined in std_kern.mod, and 'strings -a' still shows it, but not 'nm').
The ubc variables are not declared external in /usr/include/sys/table.h or
/usr/sys/include/vm/vm_numa.h (this last file was not present at V4): it is
not surprising that they are not available.

The reason vmubc dies is that it has no error checks on the nlist() return
values: an address of zero is used in the kmem read, which fails. The best
I could do is to put in error checks for lookup failures. Then it cannot
show UBC things, nor usage for each CPU in a multi-CPU machine (that part
seems to work fine on a single-CPU machine as machine_slot is not used).

Paul Szabo - System Manager // School of Mathematics and Statistics
psz_at_maths.usyd.edu.au // University of Sydney, NSW 2006, Australia

---
Vmubc is available on the Freeware CD, as well as:
ftp://gatekeeper.dec.com/pub/DEC/vmubc.tar.Z
http://ftp.digital.com/pub/digital/vmubc.tar.Z
http://www.unix.digital.com/demos/freesrc/Original_Base_Src/vmubc-1.4.tar.gz
Looking in http://www.unix.digital.com/unix/faq/software.html I find:
"vmubc ... was written by George Chaltas at Compaq". In 1994? Rewriting
history, following in the footsteps of the great dictators?
---
*** system.c.old	Wed Feb 14 06:37:54 1996
--- system.c	Wed Feb 23 09:16:13 2000
***************
*** 300,305 ****
--- 300,306 ----
  {
  	int states[5];
  	
+ 	if (nl[N_UBC_PAGES].n_value) {
  	if (lseek(kmem, (long) nl[N_UBC_PAGES].n_value, SEEK_SET) !=
  	    (long) nl[N_UBC_PAGES].n_value) {
  		perror("ubc_pages; lseek");
***************
*** 308,314 ****
--- 309,318 ----
  		    sizeof(ubc_pages)) {
  			perror("ubc_pages; read");
  		}
+ 	}
+ 	else { ubc_pages = 0; }
  	
+ 	if (nl[N_UBC_MINPAGES].n_value) {
  	if (lseek(kmem, (long) nl[N_UBC_MINPAGES].n_value, SEEK_SET) !=
  	    (long) nl[N_UBC_MINPAGES].n_value) {
  		perror("ubc_minpages; lseek");
***************
*** 317,323 ****
--- 321,330 ----
  		    sizeof(ubc_minpages)) {
  			perror("ubc_minpages; read");
  		}
+ 	}
+ 	else { ubc_minpages = 0; }
  
+ 	if (nl[N_UBC_MAXPAGES].n_value) {
  	if (lseek(kmem, (long) nl[N_UBC_MAXPAGES].n_value, SEEK_SET) !=
  	    (long) nl[N_UBC_MAXPAGES].n_value) {
  		perror("ubc_maxpages; lseek");
***************
*** 326,331 ****
--- 333,340 ----
  		    sizeof(ubc_maxpages)) {
  			perror("ubc_maxpages; read");
  		}
+ 	}
+ 	else { ubc_maxpages = 0; }
  
  	if (lseek(kmem, (long) nl[N_VM_MANAGED_PAGES].n_value, SEEK_SET) !=
  	    (long) nl[N_VM_MANAGED_PAGES].n_value) {
***************
*** 349,354 ****
--- 358,364 ----
  {
  	int states[5];
  
+ 	if (nl[N_UBC_DIRTYPAGES].n_value) {
  	if (lseek(kmem, (long) nl[N_UBC_DIRTYPAGES].n_value, SEEK_SET) !=
  	    (long) nl[N_UBC_DIRTYPAGES].n_value) {
  		perror("ubc_dirtypages; lseek");
***************
*** 357,362 ****
--- 367,374 ----
  		    sizeof(ubc_dirtypages)) {
  			perror("ubc_dirtypages; read");
  		}
+ 	}
+ 	else { ubc_dirtypages = 0; }
  
  	states[0] = ubc_pages-ubc_dirtypages;
  	states[1] = ubc_dirtypages;
***************
*** 494,499 ****
--- 506,512 ----
      fprintf(stderr, "nlist failed to read _machine_slot:\n");
      exit(1);
    }
+   if (! nlis[0].n_value) { fprintf (stderr, "Cannot find machine_slot (will not show multi-CPU usage)\n"); }
    mslot = (struct machine_slot *)nlis[0].n_value;
  
  #ifdef GSI_CPUS_IN_BOX
***************
*** 563,569 ****
--- 576,584 ----
    float total;
    struct tick_struct temp_info;
  
+ if (mslot) {
    getkmem(mslot,machine_slot,sizeof(machine_slot),"machine_slot");
+ }
  
    for (i = 0; i < ncpus; i++) {
      if( getcpudata( i, &cpu_info[i] ) ) {
***************
*** 683,688 ****
--- 698,708 ----
  		perror(kname);
  		exit(1);
  	}
+ 
+ 	if (! nl[N_UBC_PAGES].n_value)      { fprintf (stderr, "Cannot find ubc_pages (will show zero)\n"); }
+ 	if (! nl[N_UBC_MINPAGES].n_value)   { fprintf (stderr, "Cannot find ubc_minpages (will show zero)\n"); }
+ 	if (! nl[N_UBC_MAXPAGES].n_value)   { fprintf (stderr, "Cannot find ubc_maxpages (will show zero)\n"); }
+ 	if (! nl[N_UBC_DIRTYPAGES].n_value) { fprintf (stderr, "Cannot find ubc_dirtypages (will show zero)\n"); }
  
  	if ((kmem = open(_PATH_KMEM, O_RDONLY)) < 0) {
  		perror(_PATH_KMEM);
Received on Tue Feb 22 2000 - 23:34:34 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:40 NZDT