Re: Severe clock problems with OpenBSD VM on OpenBSD Host

2018-11-09 Thread Jonathan Towne
On Wed, Nov 07, 2018 at 06:40:20PM +, Gareth Ansell scribbled:
# Hi, I can confirm that this is also happening on my VM, also hosted at
# openbsd.amsterdam.
# Gareth

Same here, and none of the tricks I was finding worked.  I was also
unsatisfied with the idea of running rdate or restarting ntpd often
enough to keep things in sync.  Making use of the vmmci(4) timedelta
sensor, I found and modified a piece of existing code by Ted U. to
work around this problem until someone far smarter than I figures out
a proper solution.

Attached, but linked as well in case the attachment doesn't make it.

  https://slite.zenbsd.net/~jontow/vmtimed.c

Neither perfect nor desirable, but workable!  It makes a lot of
adjustments and has been doing an ok job so far.  Doesn't seem to
perfectly keep the clock in a synced state according to "ntpctl -sa".
Here's what it looks like running, and these are the sorts of deltas
it regularly sees and applies.

Nov  6 00:54:43 frea vmtimed: fixing time! -1.152683
Nov  6 00:56:11 frea vmtimed: fixing time! -1.045395
Nov  6 00:58:08 frea vmtimed: fixing time! -1.236222

Here's "ntpctl -sa" as of right now:

4/4 peers valid, 1/1 sensors valid, constraint offset -198s (16 errors), clock 
synced, stratum 1

peer
   wt tl st  next  poll  offset   delay  jitter
80.127.152.30 from pool pool.ntp.org
1 10  2  332s 3126s   705.111ms 5.394ms 0.974ms
195.242.98.57 from pool pool.ntp.org
1 10  2  245s 3183s   657.527ms 2.126ms 0.410ms
93.94.224.67 from pool pool.ntp.org
1 10  2   53s 3147s   687.997ms 1.931ms 0.532ms
95.211.212.5 from pool pool.ntp.org
1 10  2 2657s 3118s73.136ms 2.432ms 0.829ms

sensor
   wt gd st  next  poll  offset  correction
vmmci0  
 *  1  1  08s   15s   689.722ms 0.000ms

-- Jonathan Towne
/*
 * Original code by Ted Unangst 
 * https://https.www.google.com.tedunangst.com/flak/post/vmtimed
 *
 * Lightly modified by Jonathan Towne 
 * For use in vmd(8) hosted VMs using vmmci(4) timedelta sensor.
 * Still probably works with VMware vmt(4), but untested.
 * Works best in concert with ntpd(8) running normally.
 */

/* If time drifts more than +/- SENSITIVITY seconds, hard adjust */
#define SENSITIVITY 1
/* Check timedelta sensor value every SLEEPFOR seconds */ 
#define SLEEPFOR 15

#undef DEBUG

#include 
#include 
#include 
#include 

#include 
#include 
#include 
#include 
#include 
#include 

void
error(const char *msg)
{
syslog(LOG_DAEMON | LOG_ERR, "%s", msg);
exit(1);
}

int
findvmt0(void)
{
struct sensordev sdev;
size_t slen;
int mib[5];
int i;

mib[0] = CTL_HW;
mib[1] = HW_SENSORS;
for (i = 0; i < 20; i++) {
mib[2] = i;
slen = sizeof(sdev);
if (sysctl(mib, 3, , , NULL, 0) == -1)
break;
if (strcmp(sdev.xname, "vmmci0") == 0)
return i;
if (strcmp(sdev.xname, "vmt0") == 0)
return i;
}
return -1;
}

void
timeloop(int vmt0)
{
struct sensor sensor;
size_t slen;
int mib[5];
struct timeval tv;
double delta;

mib[0] = CTL_HW;
mib[1] = HW_SENSORS;
mib[2] = vmt0;
mib[3] = SENSOR_TIMEDELTA;
mib[4] = 0;
while (1) {
slen = sizeof(sensor);
if (sysctl(mib, 5, , , NULL, 0) == -1)
err(1, "sysctl");
delta = sensor.value / 10.0;
#ifdef DEBUG
printf("%f: timeloop()\n", delta);
#endif
if (delta < (-1 * SENSITIVITY) || delta > SENSITIVITY) {
syslog(LOG_DAEMON | LOG_NOTICE,
"fixing time! %f\n", delta);
if (gettimeofday(, NULL) == -1)
error("gettimeofday");
tv.tv_sec -= delta;
if (settimeofday(, NULL) == -1)
error("settimeofday");
}
sleep(SLEEPFOR);
}
}

int
main(int argc, char **argv)
{
int vmt0;

vmt0 = findvmt0();
if (vmt0 == -1)
error("can't find vmt0");

timeloop(vmt0);
}


Re: CF Card on Sparc 64

2010-03-30 Thread Jonathan Towne
Duncan,

http://wtf.hijacked.us/wiki/index.php/Sun_Netra_t1_compact_flash_root

I've done this before; I don't have it running anymore, but it worked
really well.  Don't know if this helps, but I thought I'd offer it to
the archives for those interested.

The meat of it is finding the right alias for openboot.  I replaced my
cdrom (that didn't exist in my netra t1/105 when I bought it) with the
CF card/adapter: 

boot /p...@1f,0/p...@1/p...@1/i...@e/d...@2:a -c

I also had to set a flag on the IDE controller, at this point thinking
that it disables DMA?  That one is left to the reader to find out.
I just remember that it wouldn't boot reliably without this:

UKC change wd*
change? y
channel: [-1] (hit enter)
flags: [whatever]: 0xff0
UKC quit

-- Jonathan Towne

On Tue, Mar 30, 2010 at 03:23:57AM -0600, Duncan Patton a Campbell scribbled:
# I've got a cf card running as a secondary drive on a Sparc Ultra 5 (Sparc64),
# but have not been able to get it to boot.  The cf/ide plug I am using has no
# master/slave/cs sets and a microprocessor on it as well, which leaves me 
suspicious
# of it because the CF interface is sposed to be a shrunken IDE.  
# 
# The sparc boot diags (probe-ide) show no device other than an ide hdd if it 
is attached.
# 
# Also, I have experience that IDE disks are addressable after boot if the 
CS/MS/SL is 
# set wrong (that is they can have mountable file systems) but will still not 
be bootable
# themselves, which further leads me to believe the CF card 2 IDE plug I have 
is useless
# for this.  
# 
# But I mebbe barking up the wrong tree altogether here and it is just not 
doable...  
# 
# Comments/ideas anyone?
# 
# Thanks,
# 
# Dhu
# 
# 
# p.s. 
# 
# # dmesg 
# console is keyboard/display
# Copyright (c) 1982, 1986, 1989, 1991, 1993
# The Regents of the University of California.  All rights reserved.
# Copyright (c) 1995-2009 OpenBSD. All rights reserved.  http://www.OpenBSD.org
# 
# OpenBSD 4.5 (GENERIC) #1898: Sat Feb 28 17:42:44 MST 2009
# dera...@sparc64.openbsd.org:/usr/src/sys/arch/sparc64/compile/GENERIC
# real mem = 536870912 (512MB)
# avail mem = 507625472 (484MB)
# mainbus0 at root: Sun Ultra 5/10 UPA/PCI (UltraSPARC-IIi 270MHz)
# cpu0 at mainbus0: SUNW,UltraSPARC-IIi (rev 1.3) @ 270 MHz
# cpu0: physical 16K instruction (32 b/l), 16K data (32 b/l), 256K external (64 
b/l)
# psycho0 at mainbus0 addr 0xfffc4000: SUNW,sabre, impl 0, version 0, ign 7c0
# psycho0: bus range 0-3, PCI bus 0
# psycho0: dvma map c000-dfff
# pci0 at psycho0
# ppb0 at pci0 dev 1 function 1 Sun Simba PCI-PCI rev 0x13
# pci1 at ppb0 bus 1
# ebus0 at pci1 dev 1 function 0 Sun PCIO EBus2 rev 0x01
# auxio0 at ebus0 addr 726000-726003, 728000-728003, 72a000-72a003, 
72c000-72c003, 72f000-72f003
# power0 at ebus0 addr 724000-724003 ivec 0x25
# SUNW,pll at ebus0 addr 504000-504002 not configured
# sab0 at ebus0 addr 40-40007f ivec 0x2b: rev 3.2
# sabtty0 at sab0 port 0
# sabtty1 at sab0 port 1
# comkbd0 at ebus0 addr 3083f8-3083ff ivec 0x29: layout 34
# wskbd0 at comkbd0: console keyboard
# com0 at ebus0 addr 3062f8-3062ff ivec 0x2a: mouse: ns16550a, 16 byte fifo
# lpt0 at ebus0 addr 3043bc-3043cb, 30015c-30015d, 70-7f ivec 0x22: 
polled
# clock1 at ebus0 addr 0-1fff: mk48t59
# flashprom at ebus0 addr 0-f not configured
# audioce0 at ebus0 addr 20-2000ff, 702000-70200f, 704000-70400f, 
722000-722003 ivec 0x23 ivec 0x24: nvaddrs 0
# audio0 at audioce0
# hme0 at pci1 dev 1 function 1 Sun HME rev 0x01: ivec 0x7e1, address 
08:00:20:a2:f6:94
# nsphy0 at hme0 phy 1: DP83840 10/100 PHY, rev. 1
# vgafb0 at pci1 dev 2 function 0 ATI Mach64 rev 0x5c
# wsdisplay0 at vgafb0 mux 1: console (std, sun emulation), using wskbd0
# pciide0 at pci1 dev 3 function 0 CMD Technology PCI0646 rev 0x03: DMA, 
channel 0 configured to native-PCI, channel 1 configured to native-PCI
# pciide0: using ivec 0x7e0 for native-PCI interrupt
# wd0 at pciide0 channel 0 drive 0: WDC AC28400R
# wd0: 16-sector PIO, LBA, 8063MB, 16514064 sectors
# wd0(pciide0:0:0): using PIO mode 4
# wd1 at pciide0 channel 1 drive 1: ELITE PRO CF CARD 16GB
# wd1: 1-sector PIO, LBA, 15280MB, 31293440 sectors
# wd1(pciide0:1:1): using PIO mode 4
# ppb1 at pci0 dev 1 function 0 Sun Simba PCI-PCI rev 0x13
# pci2 at ppb1 bus 2
# ppb2 at pci2 dev 1 function 0 DEC 21152 PCI-PCI rev 0x02
# pci3 at ppb2 bus 3
# Sun PCIO EBus2 rev 0x01 at pci3 dev 0 function 0 not configured
# hme1 at pci3 dev 0 function 1 Sun HME rev 0x01: ivec 0x7d1, address 
08:00:20:a3:e8:52
# nsphy1 at hme1 phy 1: DP83840 10/100 PHY, rev. 1
# isp0 at pci3 dev 4 function 0 QLogic ISP1020 rev 0x05: ivec 0x7d0
# isp0: invalid NVRAM header
# scsibus0 at isp0: 16 targets, initiator 7
# softraid0 at root
# bootpath: /p...@1f,0/p...@1,1/i...@3,0/d...@0,0
# root on wd0a swap on wd0b dump on wd0b
# 
# # mount
# /dev/wd0a on / type ffs (local)
# /dev/wd1a on /mnt type ffs (local)
# /dev/wd1d on /mnt2 type ffs (local)
# # df
# Filesystem  512-blocks  Used Avail

Re: Logging bandwidth usage with PF

2007-11-13 Thread Jonathan Towne
On Mon, Nov 12, 2007 at 11:52:08PM -0500, Jason Dixon scribbled:
# On Nov 12, 2007, at 10:31 AM, Joel Gudknecht wrote:
# 
# Misc list:
# 
# I'm trying to figure out a way to log and analyze bandwidth usage
# passing through my PF gateway. It's doing NAT for ~60 users.
# 

How about argus?

http://qosient.com/argus/

It reads netflow data; but also has its own powerful 
processing/storage engine.

It does bidirectional flow analysis, where netflow only does it
unidirectional.  You may or may not want that, but I encourage
you to look anyway.  It's quite a bit easier to script.


-- Jonathan Towne



Keyboard interrupt problem ('lag')

2007-05-09 Thread Jonathan Towne
Hello all;

I asked a while back about a 'lag' in keyboard response on my laptop
(Gateway MT3705) that runs -current.  Someone responded off-list and 
noted that it was an interrupt issue.

I was wondering if there is any known workaround / fix for it; the
machine can be very hard to use for day to day operation with this
happening.

Looking through the dmesg, it doesn't look like an irq sharing problem
necessarily?

I'm currently working on building a new -current and a new xenocara
to test with since this one is a little dated.


dmesg is as follows:


OpenBSD 4.1-current (EXTRO.acpi-mp) #1: Tue Apr 17 09:34:02 EDT 2007
[EMAIL PROTECTED]:/usr/src/sys/arch/i386/compile/EXTRO.acpi-mp
cpu0: Genuine Intel(R) CPU T2060 @ 1.60GHz (GenuineIntel 686-class) 1.60 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,EST,TM2,xTPR
real mem  = 1004621824 (981076K)
avail mem = 910696448 (889352K)
using 4278 buffers containing 50356224 bytes (49176K) of memory
mainbus0 (root)
bios0 at mainbus0: AT/286+ BIOS, date 12/07/06, BIOS32 rev. 0 @ 0xfd5fd, SMBIOS 
rev. 2.4 @ 0xdc010 (41 entries)
bios0: Gateway MT3705
pcibios0 at bios0: rev 2.1 @ 0xfd580/0xa80
pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xfde90/336 (19 entries)
pcibios0: no compatible PCI ICU found: ICU vendor 0x1002 product 0x4372
pcibios0: Warning, unable to fix up PCI interrupt routing
pcibios0: PCI bus #8 is the last bus
bios0: ROM list: 0xc/0xd000 0xdc000/0x4000!
acpi0 at mainbus0: rev 0
acpi0: tables DSDT FACP SLIC APIC MCFG SSDT 
acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpi device at acpi0 from table DSDT not configured
acpi device at acpi0 from table FACP not configured
acpi device at acpi0 from table SLIC not configured
acpimadt0 at acpi0 table APIC addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: apic clock running at 133 MHz
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Genuine Intel(R) CPU T2060 @ 1.60GHz (GenuineIntel 686-class) 1.60 GHz
cpu1: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,EST,TM2,xTPR
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 21, 24 pins
acpi device at acpi0 from table MCFG not configured
acpi device at acpi0 from table SSDT not configured
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 0 (PB2_)
acpiprt2 at acpi0: bus 0 (PB3_)
acpiprt3 at acpi0: bus 2 (PB4_)
acpiprt4 at acpi0: bus 5 (PB5_)
acpiprt5 at acpi0: bus 0 (PB6_)
acpiprt6 at acpi0: bus 0 (PB7_)
acpiprt7 at acpi0: bus 8 (P2P_)
acpiprt8 at acpi0: bus 1 (AGP_)
acpiec0 at acpi0: EC__
acpicpu0 at acpi0: CPU0: acpicpu0: C3 not supported
acpicpu1 at acpi0: CPU1: acpicpu1: C3 not supported
acpitz0 at acpi0, critical temperature: 100 degC
acpiac0 at acpi0: AC unit offline
acpibat0 at acpi0: BAT0: model: 6MSB serial:  type: Li   oem: SMP-P
acpibtn0 at acpi0: PWRB
acpibtn1 at acpi0: LID0
acpibtn2 at acpi0: SLPB
vesabios0 at mainbus0: version 2.0, ATI Technologies Inc. MS4
pci0 at mainbus0 bus 0: configuration mode 1 (no bios)
pchb0 at pci0 dev 0 function 0 vendor ATI, unknown product 0x5a31 rev 0x01
ppb0 at pci0 dev 1 function 0 ATI RS480 PCIE rev 0x00
pci1 at ppb0 bus 1
vga1 at pci1 dev 5 function 0 ATI Radeon XPRESS 200M rev 0x00, vesafb
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
ppb1 at pci0 dev 4 function 0 ATI RS480 PCIE rev 0x00
pci2 at ppb1 bus 2
mskc0 at pci2 dev 0 function 0 Marvell Yukon 88E8038 rev 0x14, Yukon-2 FE 
(0x1): apic 2 int 16 (irq 10)
msk0 at mskc0 port A, address 00:03:25:3f:d0:32
eephy0 at msk0 phy 0: Marvell 88E3082 10/100 PHY, rev. 3
ukphy0 at msk0 phy 3: Generic IEEE 802.3u media interface, rev. 0: OUI 
0x121012, model 0x0004
ukphy0: no media present
ukphy1 at msk0 phy 6: Generic IEEE 802.3u media interface, rev. 0: OUI 
0x004c00, model 0x0013
ukphy1: no media present
ppb2 at pci0 dev 5 function 0 ATI RS480 PCIE rev 0x00
pci3 at ppb2 bus 5
ohci0 at pci0 dev 19 function 0 ATI IXP400 USB rev 0x80: apic 2 int 19 (irq 
11), version 1.0, legacy support
ohci1 at pci0 dev 19 function 1 ATI IXP400 USB rev 0x80: apic 2 int 19 (irq 
11), version 1.0, legacy support
ehci0 at pci0 dev 19 function 2 ATI IXP400 USB2 rev 0x80: apic 2 int 19 (irq 
11)
usb0 at ehci0: USB revision 2.0
uhub0 at usb0
uhub0: ATI EHCI root hub, rev 2.00/1.00, addr 1
uhub0: 8 ports with 8 removable, self powered
ATI IXP400 SMBus rev 0x83 at pci0 dev 20 function 0 not configured
pciide0 at pci0 dev 20 function 1 ATI IXP400 IDE rev 0x80: DMA, channel 0 
configured to compatibility, channel 1 configured to compatibility
wd0 at pciide0 channel 0 drive 0: HTS421210H9AT00
wd0: 16-sector PIO, LBA48, 95396MB, 195371568 sectors
atapiscsi0 at pciide0 channel 0 drive 1
scsibus0 at atapiscsi0: 2 targets
cd0 at scsibus0 targ 0 lun 0: HL-DT-ST, DVDRAM GSA-T10N, PG02 SCSI0 5/cdrom 
removable
wd0(pciide0:0:0): using PIO mode 4, 

keyboard sequences missed / lag

2007-04-24 Thread Jonathan Towne
Hello all,


This has been driving me nuts for weeks (ever since upgrading to -current):

I type at a fairly fast rate with very high accuracy and on this laptop it
all goes downhill in a handbasket; makes it very hard to use regularly.

It seems to be aggravated by typing over an SSH connection, but is still
very apparent at a local console or in an xterm/aterm/etc.

Many characters are missed, sometimes end up in the wrong order with an
obvious lag/delay, etc.  I've tried playing with wsconsctl tunables like
keyboard.repeat.del{n,1} without any real results.

If anyone has any idea, I'd be very interested to hear it!

Great work on the 4.1 branch and xenocara!

(Finally get 1280x800 resolution in X.org, but still have a few issues)

In fact, now -current lacks only a native working RTL8185 and azalia driver
and this laptop is perfect; thanks everyone.


-- Jonathan Towne



Re: Recommend Technical Networking Book?

2007-04-17 Thread Jonathan Towne
On Mon, Apr 16, 2007 at 01:45:36AM -0700, Clint Pachl scribbled:

[snip]

# The Tao of Network Security Monitoring: Beyond Intrusion Detection, 
# 
http://www.amazon.com/gp/product/0321246772/ref=wl_it_dp/103-5124063-8263036?ie=UTF8coliid=IHNHJ98G36HX1colid=1B2FORVUWNNME
 
# by Richard Bejtlich 
# 
http://www.amazon.com/gp/product/0321246772/ref=wl_it_dp/103-5124063-8263036?ie=UTF8coliid=IHNHJ98G36HX1colid=1B2FORVUWNNME


This is the only one I can comment, having read it cover to cover sometime 
last year.  First off, it is excellent.

This title is effectively 'first in a series', in a sense; it forms the
groundwork for an understanding that can only come with lots of practice.

It covers a few of the topics you noted, including architecture, best practices,
and a lot on monitoring (obviously!).  It's all well thought through and
having spoken to Richard on a number of occasions, you won't find a better
person to describe such a topic.

I bought it in a store a number of hours south of here on an impulse.  
I can say it was the best impulse buy I've *ever* made.

I'll leave it at that.



-- Jonathan Towne



Re: Routerboards (was: Re: Routerboard 532 Bounty)

2007-04-14 Thread Jonathan Towne
On Thu, Apr 12, 2007 at 10:44:10AM -0400, Bret Lambert scribbled:
# So, a question to the list: besides soekris and WRAP boards (and the
# specific board that began the thread), what tiny, non-PC machines are
# out there and useful?

I've been in contact for some time with the folks at AR Infotek in
Taiwan.  They're exceedingly nice people and offer some very cool
products.  I'm trying to get ahold of a small pile of their 3258-245
model to use as OpenBSD+carp firewalls and routers.

The main issue with them is that they aren't a distributor of their
product; they mainly sell to system integrators and the like.  They do
sell in small quantities for evaluation purposes, and OpenBSD has
been ported to run on them.

I was (just today) sent a press release from a while back about
OpenBSD on their 3xxx series machines:

http://www.arinfotek.com/news/news_d.asp?sty=2pid=29


-- Jonathan Towne



Re: Are Atheros AR5005G Wifi Network Adapter and Marvell Yukon 88E8038 PCI-E Fast Ethernet Controller supported?

2007-03-27 Thread Jonathan Towne
On Tue, Mar 27, 2007 at 12:28:36AM +0800, Tito Mari Francis Esca?o scribbled:
# Greetings!
# I need to know if Atheros AR5005G Wifi Network Adapter and Marvell
# Yukon 88E8038 PCI-E Fast Ethernet Controller are already supported in
# OBSD 4.0 or will be in the next release. I bought me a laptop built-in
# with these and I'd love to have OpenBSD on it rather than any other
# OS.
# Thanks!


I can't speak for ther Atheros chip, but the Marvell Yukon 88E8038 works
beautifully on my new laptop (Gateway MT3705).

It attaches as msk0 like so:


mskc0 at pci2 dev 0 function 0 Marvell Yukon 88E8038 rev 0x14, Yukon-2 FE 
(0x1): irq 10
msk0 at mskc0 port A, address 00:03:25:3f:d0:32
eephy0 at msk0 phy 0: Marvell 88E3082 10/100 PHY, rev. 3
ukphy0 at msk0 phy 3: Generic IEEE 802.3u media interface, rev. 0: OUI 
0x121012, model 0x0004
ukphy0: no media present
ukphy1 at msk0 phy 6: Generic IEEE 802.3u media interface, rev. 0: OUI 
0x004c00, model 0x0013
ukphy1: no media present


I'm using it right now, in fact!



-- Jonathan Towne