Building tree without making obj symlinks

2016-06-23 Thread Masao Uebayashi
/b/obj/bin/ls (if object directories are already generated by "make obj"). I'm not 100% sure about the change in bsd.obj.mk (i.e. interaction with bsd.subdir.mk). >From d81931ee7fea3e1f30c7d05ef95bbc01a489f73f Mon Sep 17 00:00:00 2001 From: Masao Uebayashi <uebay...@tombiinc.com>

Re: Building installer as cross

2016-06-19 Thread Masao Uebayashi
Slightly improved by killing stupid .ifdef added under src/distrib by honoring .OBJDIR. diff --git a/Makefile.cross b/Makefile.cross index 8e2afa1..2a686eb 100644 --- a/Makefile.cross +++ b/Makefile.cross @@ -1,7 +1,7 @@ # $OpenBSD: Makefile.cross,v 1.85 2016/05/11 21:52:48 deraadt Exp $

Building installer as cross

2016-06-16 Thread Masao Uebayashi
This is a proof-of-concept of cross-building installers under src/distrib. Theoretically it is possible to cross-build installers, because those programs in the installer are all small, base programs, that are covered by decent BSD makefiles. It actually turned out to be easy by only a few

Better alignment of `netstat -nr' for IPv6 addresses

2016-06-14 Thread Masao Uebayashi
`netstat -r' uses 34 columns for "Destination" and 30 for "Gateway". As these two columns have the same notation, these columns could also have the same length. 30 is too short for SLAAC addresses with longer interface names: % echo -n 'fe80:::::%vether99' | wc 0 1

Re: make vlan(4) remember its parent by index, not by reference

2016-03-22 Thread Masao Uebayashi
On Tue, Mar 22, 2016 at 09:36:18PM +1000, David Gwynne wrote: > this basically makes the code use if_get instead of carrying a > pointer around. this is as mechanical as i can make it. > > ok? > > Index: if_vlan_var.h > === > RCS

Re: CPUID in amd64/i386 boot code

2016-03-19 Thread Masao Uebayashi
ailable. + * Appears to be necessary on (at least) the Intel Mac + * Mini. +*/ + do { + __asm volatile(DOINT(0x16) "; setnz %b0" : "=a" (rv) : + "0" (0x100) : &quo

Re: Implement delay() using TSC

2016-03-19 Thread Masao Uebayashi
On Wed, Mar 16, 2016 at 11:49:32PM -0700, Mike Larkin wrote: > On Thu, Mar 17, 2016 at 03:38:20PM +0900, Masao Uebayashi wrote: > > On Wed, Mar 16, 2016 at 11:25:11PM -0700, Mike Larkin wrote: > > > On Thu, Mar 17, 2016 at 09:44:22AM +0900, Masao Uebayashi wrote: > > >

Implement delay() using TSC

2016-03-19 Thread Masao Uebayashi
eak; case CPU_ROLE_AP: diff --git a/sys/arch/amd64/amd64/tsc.c b/sys/arch/amd64/amd64/tsc.c new file mode 100644 index 000..15242ca --- /dev/null +++ b/sys/arch/amd64/amd64/tsc.c @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016 Masao Uebayashi <uebay...@tombiinc.com> + * + * Permission to use, cop

IB700 watchdog

2016-03-19 Thread Masao Uebayashi
mode 100644 index 000..cdad79f --- /dev/null +++ b/sys/dev/isa/ib700wdt.c @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2016 Masao Uebayashi <uebay...@tombiinc.com> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, pr

CPUID in amd64/i386 boot code

2016-03-19 Thread Masao Uebayashi
Factor out CPUID code in mdrandom(), invoke it once, then save the result. I'll use it to switch behavior depending on HV or not. efiboot is not tested. Comments? >From 104cb04bbbd0f7e40758938cc3103b2370a2285c Mon Sep 17 00:00:00 2001 From: Masao Uebayashi <uebay...@tombiinc.com> Date

Re: dwctwo(4) matching on Octeon

2016-03-19 Thread Masao Uebayashi
OK uebayasi@ On Sat, Mar 19, 2016 at 02:51:56PM +, Visa Hankala wrote: > dwctwo(4) should be attached only on those Octeon models that have the > DWC2 controller. The list below is not complete but it covers every > model that has any chance of working with cnmac(4). > > OK? > > Index:

Re: Octeon II usb

2016-03-19 Thread Masao Uebayashi
A bit surprised that code does more than I imagined by reading your description :) but it looks very good to me! A few comments: - `struct octuctl_softc' is not using `sc_ehci' and `sc_ohci'? - Some magic numbers in `octuctl_clock_setup' could be #define'ed I've just bought EdgeRouter Pro.

Re: CPUID in amd64/i386 boot code

2016-03-19 Thread Masao Uebayashi
On Wed, Mar 16, 2016 at 11:26:39PM -0700, Mike Larkin wrote: > On Thu, Mar 17, 2016 at 03:15:07PM +0900, Masao Uebayashi wrote: > > This is the intended use, avoid busy-polling of BIOS PC console if > > running on HV. Avoid 100% CPU usage at boot prompt on hypervisors. > > &

Re: Implement delay() using TSC

2016-03-18 Thread Masao Uebayashi
On Wed, Mar 16, 2016 at 11:25:11PM -0700, Mike Larkin wrote: > On Thu, Mar 17, 2016 at 09:44:22AM +0900, Masao Uebayashi wrote: > > Implement delay() using TSC > > > > - Calculate delay using 64-bit RDTSC instruction > > - Enable tsc_delay() as delay(9) backend > >

Re: Update `ticks' in the right place

2016-03-15 Thread Masao Uebayashi
This doesn't use atomic operation, because: - hardclock() is the only writer - Clock interrupt doesn't run simultaneously - Reading int should be atomic on all architectures On Wed, Mar 16, 2016 at 02:13:13PM +0900, Masao Uebayashi wrote: > This clarifies that the single, global `ti

Update `ticks' in the right place

2016-03-15 Thread Masao Uebayashi
This clarifies that the single, global `ticks' is owned by kern_clock.c. timeout(9) is only one of users of `ticks', even though its handler, timeout_hardclock_update(), is called from hardclock() after update of `ticks' every time. Theoretically timecounter(9)'s tick, tc_ticktock(), is

Fix cross tool build

2016-03-08 Thread Masao Uebayashi
When building 5.9 cross tools ("cross-tools" target in Makefile.cross) on 5.8, cross tools are installed to e.g. ${CROSSDIR}/usr/*-openbsd5.9, not .../*-openbsd5.8. Don't use ${OSREV} which is derived from hardcoded ${OSMINOR} in building host's /usr/share/mk/sys.mk (still 5.8), but use

ipmi(4) - Implement ipmitool-compatible IOCTL

2016-02-01 Thread Masao Uebayashi
a/sys/dev/ipmi.c +++ b/sys/dev/ipmi.c @@ -1,6 +1,7 @@ /* $OpenBSD: ipmi.c,v 1.91 2016/01/25 06:36:47 uebayasi Exp $ */ /* + * Copyright (c) 2015 Masao Uebayashi * Copyright (c) 2005 Jordan Hargrave * All rights reserved. * @@ -31,21 +32,21 @@ #include #include #include +#includ

Re: ipmi(4) - Stop watchdog internal timer properly

2016-01-09 Thread Masao Uebayashi
On Thu, Jan 07, 2016 at 01:48:53PM +0900, Masao Uebayashi wrote: > Reflected kettenis@'s comments: > - Initialize sc_wdog_period before use. > - Define less stupid register names. > > * > > When stopping wdog, not only disabling reboot, but also stop timer. Forgot

Re: ipmi(4) - Stop watchdog internal timer properly

2016-01-06 Thread Masao Uebayashi
Reflected kettenis@'s comments: - Initialize sc_wdog_period before use. - Define less stupid register names. * When stopping wdog, not only disabling reboot, but also stop timer. diff --git a/sys/dev/ipmi.c b/sys/dev/ipmi.c index c837234..d579987 100644 --- a/sys/dev/ipmi.c +++ b/sys/dev/ipmi.c

Re: ipmi(4) - Don't check threshold erroneously

2016-01-06 Thread Masao Uebayashi
Update: - Better log message - Exclude "read disabled sensor" part * Correct sensor threashold handling by properly checking response of Get Sensor Reading Command. diff --git a/sys/dev/ipmi.c b/sys/dev/ipmi.c index d579987..5895347 100644 --- a/sys/dev/ipmi.c +++ b/sys/dev/ipmi.c @@ -175,7

Re: ipmi(4) - Don't check threshold erroneously

2015-12-24 Thread Masao Uebayashi
On Fri, Dec 25, 2015 at 11:47:19AM +0900, Masao Uebayashi wrote: (snip) > Without learning much about sensor part of IPMI, I think that both reading > bits and "Get Sensor Thresholds Command" work. ... I meant: both ... *should* work.

Re: ipmi(4) - Don't check threshold erroneously

2015-12-24 Thread Masao Uebayashi
On Fri, Dec 25, 2015 at 11:47:19AM +0900, Masao Uebayashi wrote: > On Tue, Dec 22, 2015 at 09:03:56PM +1000, Jonathan Matthew wrote: > > On Tue, Dec 22, 2015 at 06:42:23PM +0900, Masao Uebayashi wrote: > > > On Mon, Dec 21, 2015 at 03:53:09PM +0100, Mark Kettenis wrote: > >

Re: ipmi(4) - Don't check threshold erroneously

2015-12-24 Thread Masao Uebayashi
On Tue, Dec 22, 2015 at 09:03:56PM +1000, Jonathan Matthew wrote: > On Tue, Dec 22, 2015 at 06:42:23PM +0900, Masao Uebayashi wrote: > > On Mon, Dec 21, 2015 at 03:53:09PM +0100, Mark Kettenis wrote: > > > > Date: Mon, 21 Dec 2015 22:47:19 +0900 > > > > From: Masao

Re: ipmi(4) - Remove unused code

2015-12-22 Thread Masao Uebayashi
On Mon, Dec 21, 2015 at 03:41:23PM +0100, Mark Kettenis wrote: > > Date: Mon, 21 Dec 2015 22:31:22 +0900 > > From: Masao Uebayashi <uebay...@tombiinc.com> > > > > This is the first part of the big ipmi(4) patch I sent in another thread. > > > > Th

Re: ipmi(4) - Stop watchdog internal timer properly

2015-12-22 Thread Masao Uebayashi
On Mon, Dec 21, 2015 at 03:49:09PM +0100, Mark Kettenis wrote: > > Date: Mon, 21 Dec 2015 22:43:46 +0900 > > From: Masao Uebayashi <uebay...@tombiinc.com> > > > > When stopiing ipmi(4) watchdog, not only set action to disabled but also > > stop >

Re: ipmi(4) - Don't check threshold erroneously

2015-12-22 Thread Masao Uebayashi
On Mon, Dec 21, 2015 at 03:53:09PM +0100, Mark Kettenis wrote: > > Date: Mon, 21 Dec 2015 22:47:19 +0900 > > From: Masao Uebayashi <uebay...@tombiinc.com> > > > > ipmi(4) has checked thresholds of some sensing values and reported false > > alar

Re: ipmi(4) - Remove unused code

2015-12-22 Thread Masao Uebayashi
FWIW, I'm not going to propose enabling ipmi(4). Sent from my iPhone On Dec 22, 2015, at 1:26 AM, Theo de Raadt wrote: >>> diff --git a/sys/dev/ipmi.c b/sys/dev/ipmi.c >>> index a1156d8..91aa147 100644 >>> --- a/sys/dev/ipmi.c >>> +++ b/sys/dev/ipmi.c >>> @@ -1082,11

ipmi(4) - Remove unused code

2015-12-21 Thread Masao Uebayashi
This is the first part of the big ipmi(4) patch I sent in another thread. This removes complicate polling timeout code. Serial communication with BMC is slow but considered as reliable. Communication failure is a fatal problem. Returning error doesn't make sense. This also removes unfinished

ipmi(4) - Don't check threshold erroneously

2015-12-21 Thread Masao Uebayashi
ipmi(4) has checked thresholds of some sensing values and reported false alarms. This patch reverts those checks. This also changes ipmi(4) to handle disabled sensors while allowing them to supply readings if they want. >From Jonathan Matthew. OK? diff --git a/sys/dev/ipmi.c b/sys/dev/ipmi.c

ipmi(4) - Stop watchdog internal timer properly

2015-12-21 Thread Masao Uebayashi
When stopiing ipmi(4) watchdog, not only set action to disabled but also stop internal timer (clear don't stop flag). Without this our NEC servers fail to stop IPMI watchdog and reset during shutdown process. OK? diff --git a/sys/dev/ipmi.c b/sys/dev/ipmi.c index 91aa147..d88b7c1 100644 ---

Re: ipmi(4) - Support ipmitool IOCTL etc.

2015-12-20 Thread Masao Uebayashi
Update: merged 3 changes from Jonathan Matthew. Other things remain. See [1] for details. - Don't check threashold in this driver; fix false positive warnings. - Handle disabled sensors, but allow them to supply readings if they want. - Make command taskq MP-safe. Masao [1]

Re: fix snmpd reporting of IP-MIB::ipForwarding.0

2015-10-07 Thread Masao Uebayashi
Thanks for spotting this. Looks correct, but if I were to fix this: (v == 0) ? 2 : 1 Either case, OK uebayasi@ On Wed, Oct 07, 2015 at 10:39:17PM +0100, Stuart Henderson wrote: > IP-MIB::ipForwarding.0 should return one of these values: > > ipForwarding OBJECT-TYPE > SYNTAX

Re: ipmi(4) - Support ipmitool IOCTL etc.

2015-09-21 Thread Masao Uebayashi
I've added a patch to sysutils/ipmitool; apply it and rebuild. https://github.com/uebayasi/openbsd-ipmi/blob/ipmi19/ipmitool.patch On Fri, Sep 18, 2015 at 05:48:52PM +0900, Masao Uebayashi wrote: > I've prepared a set of patches to make OpenBSD's ipmi(4) work with ipmitool > vi

ipmi(4) - Support ipmitool IOCTL etc.

2015-09-18 Thread Masao Uebayashi
I've prepared a set of patches to make OpenBSD's ipmi(4) work with ipmitool via /dev/ipmi*, following what FreeBSD did. I'd like to hear feedback from developers and users. https://github.com/uebayasi/openbsd-ipmi I'm also looking for someone whose machine supports BT (block transfer)

kqueue-process regress test race

2015-08-01 Thread Masao Uebayashi
regress/sys/kern/kqueue/kqueue-process (kqueue-test -P) is a test to receive process-related events (fork/exec/exit). This test forks a child, then forks a child-child from child. But parent checks only child's exit. This has worked because scheduler happens to run child-child much later.

Re: buffer overrun in fnmatch.c

2015-07-31 Thread Masao Uebayashi
On Fri, Jul 31, 2015 at 11:18:15AM -0700, enh wrote: automated fuzzing caught this: #include fnmatch.h #include string.h int main() { char *str = strdup(*[\\$:*[:lower:]); fnmatch(str, str, 0x27); } This is the output of Valgrind as of today: ==7819== Memcheck, a memory error

ls(1): Missing fts_close(3)

2015-06-23 Thread Masao Uebayashi
ls(1) omits fts_close(3) after fts_open(3), resulting in an FD leak. Found by Valgrind. Index: bin/ls/ls.c === RCS file: /cvs/src/bin/ls/ls.c,v retrieving revision 1.40 diff -u -p -r1.40 ls.c --- bin/ls/ls.c 18 Apr 2015 18:28:36

Re: vfs_shutdown would like to do polled I/O at least on panic

2015-05-07 Thread Masao Uebayashi
By doing complex VFS shutdown operation, the system's memory image will be modified a lot since a panic was triggered. I'd totally skip vfs_shutdown() after a panic [1], then do the best to dump a kernel core for analysis. [1] OpenBSD's panic(9) sets RB_NOSYNC only when panicstr is already set

Re: Possible bug in cpu_chooseproc?

2014-07-13 Thread Masao Uebayashi
Index: kern_sched.c === RCS file: /cvs/src/sys/kern/kern_sched.c,v retrieving revision 1.32 diff -u -p -r1.32 kern_sched.c --- kern_sched.c4 May 2014 05:03:26 - 1.32 +++ kern_sched.c13 Jul 2014 20:18:38

vmxnet3

2013-05-31 Thread Masao Uebayashi
This is a newly written driver for VMware VMXNET3 ethernet controller. - vic(4) was not used as a base because VMXNET3 is very different from previous VMXNET versions. - Simple test shows that performance is comparable to VMXNET3 driver from open-vm-tools. - Man page is missing (ongoing).