CVS: cvs.openbsd.org: src

2020-02-13 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2020/02/13 08:39:02

Modified files:
sys/dev/pv : xen.c 

Log message:
Resolve a few issues with interrupt handling

Upon a failed task_add, the adjusted reference counter needs
to be decremented.

xen_intr_schedule should follow the same logic as xen_intr.

Tested by Niklas Hallqvist.  Ok mpi@



CVS: cvs.openbsd.org: src

2019-12-13 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2019/12/13 03:29:05

Modified files:
sys/dev/pv : Tag: OPENBSD_6_6 xen.c 

Log message:
Revert: Always release interrupt source when unmasking the interrupt



CVS: cvs.openbsd.org: src

2019-12-12 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2019/12/12 19:16:53

Modified files:
sys/dev/pv : xen.c 

Log message:
Always release interrupt source when unmasking the interrupt

xen_intr_unmask_release was not decrementing the reference counter
on the interrupt source structure when bailing out early which led
to the refcnt overflow.

>From niklas, ok mlarkin



CVS: cvs.openbsd.org: src

2019-12-12 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2019/12/12 19:14:55

Modified files:
sys/dev/pv : Tag: OPENBSD_6_6 xen.c 

Log message:
Always release interrupt source when unmasking the interrupt

xen_intr_unmask_release was not decrementing the reference counter
on the interrupt source structure when bailing out early which led
to the refcnt overflow.

>From niklas, ok mlarkin



CVS: cvs.openbsd.org: src

2019-10-07 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2019/10/07 09:36:02

Modified files:
sys/dev/pv : hyperv.c 

Log message:
Attach Hyper-V guest services to VMBus 4.0

Tested by Andre Stoebe and Remi Locherer.

ok deraadt, tb



CVS: cvs.openbsd.org: src

2018-06-18 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2018/06/18 13:05:24

Modified files:
sys/dev/usb: uplcom.c 

Log message:
Add an HP LD220 pole display

Diff from Paul de Weerd (weerd@), tested by Jan-Piet Mens, thanks!



CVS: cvs.openbsd.org: src

2018-06-18 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2018/06/18 13:03:57

Modified files:
sys/dev/usb: usbdevs.h usbdevs_data.h 

Log message:
regen



CVS: cvs.openbsd.org: src

2018-06-18 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2018/06/18 13:03:33

Modified files:
sys/dev/usb: usbdevs 

Log message:
Add an HP LD220 pole display

Diff from Paul de Weerd (weerd@), tested by Jan-Piet Mens, thanks!



CVS: cvs.openbsd.org: src

2018-06-14 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2018/06/14 12:44:43

Modified files:
sys/arch/amd64/amd64: aesni.c 

Log message:
Grab the FPU lock before calling aesni_enc

ok guenther



CVS: cvs.openbsd.org: src

2018-05-17 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2018/05/17 06:32:33

Modified files:
sys/dev/pv : if_hvn.c 

Log message:
Let hvn_iff handle promisc mode activation

Tested by Daniel Wade, , thanks!



CVS: cvs.openbsd.org: src

2018-05-17 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2018/05/17 02:09:26

Modified files:
sys/arch/amd64/amd64: vmm.c 

Log message:
Make VMM_DEBUG kernels compile again;  ok mlarkin



CVS: cvs.openbsd.org: src

2018-05-15 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2018/05/15 03:21:52

Modified files:
sys/net: ppp_tty.c 

Log message:
Take NET_LOCK for pppioctl when called via the tty ioctl handler

ok mpi



CVS: cvs.openbsd.org: src

2018-04-13 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2018/04/13 08:09:42

Modified files:
sys/net: hfsc.c pf_ioctl.c 

Log message:
Remove compatibility with pfctl from 6.1 and plug a few leaks

No objections from henning, OK visa



CVS: cvs.openbsd.org: src

2018-04-08 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2018/04/08 12:26:29

Modified files:
sys/arch/amd64/amd64: tsc.c 

Log message:
Remove debugging printf

ok deraadt, guenther



CVS: cvs.openbsd.org: src

2018-04-08 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2018/04/08 10:45:12

Modified files:
sys/kern   : kern_event.c 

Log message:
Test for preexisting conditions when re-enabling events

When an event that was disabled by EV_DISABLE or EV_DISPATCH is registered
again, an associated filter must be ran to mark it active if a preexisting
condition is present.

The issue was reported and fix tested by Lukas Larsson ,
thanks!

ok mpi



CVS: cvs.openbsd.org: src

2018-03-11 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2018/03/11 08:31:34

Modified files:
sys/dev/pv : if_hvn.c 

Log message:
Workaround an Azure UDP transmit checksum offloading bug

According to https://reviews.freebsd.org/D12429, UDP transmit checksum
offloading doesn't work in Azure when sizeof(IP hdr + UDP hdr + payload)
is greater than 1420 and don't fragment bit isn't set in the IP header.

Instead of peeking into the packet and attempting to fix the fallout, we
restrict UDP checksum offloading to NDIS versions newer than the one used
in Azure (6.30) in an attempt to keep the feature enabled. Unfortunately,
there's no way to tell Azure apart from a standalone Hyper-V to make this
check more precise.



CVS: cvs.openbsd.org: src

2018-02-21 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2018/02/21 14:09:57

Modified files:
sys/arch/amd64/amd64: via.c 
sys/arch/i386/i386: via.c 

Log message:
Mark VIA padlock as capable of dealing with ESN

There are no actual changes to the driver since the software crypto
driver is called to handle authentication operations.

This enabled padlock to be used when tunnels are setup with iked(8).

Tested by and OK fcambus



CVS: cvs.openbsd.org: src

2018-02-20 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2018/02/20 08:02:13

Modified files:
sys/arch/amd64/amd64: via.c 
sys/arch/i386/i386: via.c 

Log message:
Convert key length from bits to bytes

Reported by Renaud Allard, fix tested by Renaud (i386) and fcambus@ (amd64).
OK visa, fcambus



CVS: cvs.openbsd.org: src

2018-01-21 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2018/01/21 11:54:46

Modified files:
sys/dev/pv : xen.c 

Log message:
Release interrupt source if the interrupt task is already scheduled

Tested by Imre Oolberg, thanks!



CVS: cvs.openbsd.org: src

2018-01-21 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2018/01/21 11:51:19

Modified files:
sys/dev/pv : xen.c 

Log message:
Improve panic message



CVS: cvs.openbsd.org: src

2018-01-18 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2018/01/18 04:43:20

Modified files:
sys/dev/pv : pvbus.c 

Log message:
Fix an off-by-one uncovered by the recent free(9) change

>From canacar@, thanks!



CVS: cvs.openbsd.org: src

2018-01-05 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2018/01/05 12:05:09

Modified files:
sys/crypto : siphash.c 

Log message:
Sync with the code in libc

OK millert; original commit message by tedu@:

memcpy from the right place. at this point, the used variable is not
relevant. from Mark Karpilovskij.
ok millert



CVS: cvs.openbsd.org: src

2017-12-09 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/12/09 07:00:21

Modified files:
sys/dev/pv : if_xnf.c 

Log message:
No need for the txb_used flag anymore



CVS: cvs.openbsd.org: src

2017-12-07 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/12/07 09:52:21

Modified files:
sys/netinet: tcp_subr.c 

Log message:
Initialize tcp_secret in tcp_init

The initialization of a secret SHA256 context for generating TCP
initial sequence numbers is moved out of tcp_set_iss_tsm used to
set up ISN for new connections and into tcp_init, sparing the
need for a global flag.

OK deraadt, visa, mpi



CVS: cvs.openbsd.org: src

2017-11-26 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/11/26 10:06:46

Modified files:
sys/dev: rnd.c 

Log message:
Don't mention XOR as a mix-in function since addition is done since 1.180



CVS: cvs.openbsd.org: src

2017-11-26 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/11/26 09:11:45

Modified files:
sys/dev/pv : xen.c 

Log message:
Xen interrupt task barrier is just a taskq_barrier so call it
instead of rolling its own now that it's been made available.

OK dlg



CVS: cvs.openbsd.org: src

2017-11-19 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/11/19 06:43:06

Modified files:
sys/dev: rnd.c 

Log message:
Remove interlocks between producers and consumers of randomness data

A lot of randomness event producers are executed in the interrupt
context increasing the time spent in the interrupt handler resulting
in extra costs when adding randomness data to the pool.  However, in
practice randomness event producers require interlocking between each
other, but not with with consumers due to the opportunistic nature of
event consumers.

To be able to take advantage of this idea, the ring buffer indexing
is now done with two free running producer and consumer counters modulo
power of 2 size of the ring buffer.

With input from and OK visa, tb, jasper



CVS: cvs.openbsd.org: src

2017-11-07 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/11/07 17:37:18

Modified files:
sys/dev/pv : if_xnf.c 

Log message:
Fixup what looks like a merge mistake; no functional change



CVS: cvs.openbsd.org: src

2017-10-28 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/10/28 09:25:20

Modified files:
usr.bin/netstat: mbuf.c 

Log message:
Bring "netstat -m" output up to speed with the kernel

The kernel no longer sets watermarks on cluster pools rendering
"max" values useless. Instead, there's now a global limit on how
much memory all cluster pools combined together can allocate from
the system. The limit is set to kern.maxclusters number of 2Kb
increments which allows us to display current, peak and maximum
total memory used by the network.

OK claudio, millert



CVS: cvs.openbsd.org: src

2017-10-25 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/10/25 16:29:41

Modified files:
sys/arch/amd64/amd64: fpu.c 

Log message:
Initialize processor extended state in fpu_kernel_enter

Tested by a few; OK visa, sthen



CVS: cvs.openbsd.org: src

2017-10-24 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/10/24 08:49:29

Modified files:
sys/netinet: tcp_input.c tcp_var.h 

Log message:
Refactor handling of partial TCP acknowledgements

With input from Klemens Nanni, OK visa, mpi, bluhm



CVS: cvs.openbsd.org: src

2017-10-23 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/10/23 09:41:29

Modified files:
sys/arch/amd64/amd64: machdep.c 
sys/arch/amd64/include: cpu.h 

Log message:
Expose TSC properties via sysctl nodes

>From Adam Steen with suggestions from tedu@
OK deraadt, mlarkin (as part of a larger diff)



CVS: cvs.openbsd.org: src

2017-10-22 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/10/22 08:11:34

Modified files:
sys/conf   : GENERIC 
sys/netinet: tcp_input.c tcp_output.c tcp_subr.c tcp_timer.c 
 tcp_usrreq.c tcp_var.h 

Log message:
Unconditionally enable TCP selective acknowledgements (SACK)

OK deraadt, mpi, visa, job



CVS: cvs.openbsd.org: src

2017-10-19 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/10/19 16:09:49

Modified files:
sys/arch/amd64/amd64: tsc.c 

Log message:
Don't forget to set the timecounter frequency

Found the hard way, fix tested and OK mlarkin



CVS: cvs.openbsd.org: src

2017-10-18 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/10/18 09:26:05

Modified files:
sys/arch/amd64/amd64: tsc.c 

Log message:
Fixup previous; noticed by canacar@



CVS: cvs.openbsd.org: src

2017-10-18 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/10/18 06:52:06

Modified files:
sys/arch/amd64/amd64: identcpu.c tsc.c 

Log message:
Set TSC timecounter frequency to the CPU frequency estimate if unknown

ok mlarkin



CVS: cvs.openbsd.org: src

2017-10-17 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/10/17 07:58:10

Modified files:
sys/arch/amd64/amd64: tsc.c 

Log message:
Correctly handle frequency measurement failures

Issue observed by Joe Gidi and canacar@.
While here, make sure that the success rate is at least 2 out of 3
measurements but with an increased threshold.



CVS: cvs.openbsd.org: src

2017-10-16 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/10/16 09:09:43

Modified files:
lib/libc/gen   : sysctl.3 

Log message:
draft-ietf-tcpm-initcwnd was published as rfc 6928



CVS: cvs.openbsd.org: src

2017-10-13 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/10/13 17:41:34

Modified files:
share/man/man5 : pf.conf.5 

Log message:
Integrate the description of flow queues into the main body of text



Re: CVS: cvs.openbsd.org: src

2017-10-06 Thread Mike Belopuhov
On Fri, Oct 06, 2017 at 13:33 +, Mike Belopuhov wrote:
> CVSROOT:  /cvs
> Module name:  src
> Changes by:   mi...@cvs.openbsd.org   2017/10/06 07:33:53
> 
> Modified files:
>   sys/arch/amd64/amd64: identcpu.c 
>   sys/arch/amd64/conf: files.amd64 
>   sys/arch/amd64/include: cpu.h cpuvar.h 
>   sys/dev/acpi   : acpihpet.c acpitimer.c 
> Added files:
>   sys/arch/amd64/amd64: tsc.c 
> 
> Log message:
> Recalibrate TSC timecounter with HPET and PM timer
> 
> If frequency of an invariant (non-stop) time stamp counter is measured
> using an independent working timecounter that has a known frequency, we
> can assume that the measured TSC frequency is as good as the resolution
> of the timecounter that we use to perform the measurement. This lets us
> switch from this high quality but expensive source to the cheaper TSC
> without sacrificing precision on a wide range of modern CPUs.
> 
> From Adam Steen <a...@adamsteen.com.au> with tweaks from reyk@ and myself.
> 
> Tested by brynet@, sthen@ and others, OK mlarkin, sthen
> 

ACHTUNG!

Please make sure to do a "make config" when building the kernel to update
offset tables because of the cpu_info structure changes.



CVS: cvs.openbsd.org: src

2017-10-06 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/10/06 07:33:53

Modified files:
sys/arch/amd64/amd64: identcpu.c 
sys/arch/amd64/conf: files.amd64 
sys/arch/amd64/include: cpu.h cpuvar.h 
sys/dev/acpi   : acpihpet.c acpitimer.c 
Added files:
sys/arch/amd64/amd64: tsc.c 

Log message:
Recalibrate TSC timecounter with HPET and PM timer

If frequency of an invariant (non-stop) time stamp counter is measured
using an independent working timecounter that has a known frequency, we
can assume that the measured TSC frequency is as good as the resolution
of the timecounter that we use to perform the measurement. This lets us
switch from this high quality but expensive source to the cheaper TSC
without sacrificing precision on a wide range of modern CPUs.

>From Adam Steen  with tweaks from reyk@ and myself.

Tested by brynet@, sthen@ and others, OK mlarkin, sthen



CVS: cvs.openbsd.org: www

2017-10-01 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:www
Changes by: mi...@cvs.openbsd.org   2017/10/01 12:51:04

Modified files:
.  : 62.html 

Log message:
Mention Xen improvements and FQ-CoDel support



CVS: cvs.openbsd.org: src

2017-09-26 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/09/26 16:12:04

Modified files:
sys/dev/ic : wdc.c 

Log message:
Prevent null pointer dereference when probing channels

Account for the case when wdc is attached to the ISA bus and performs
channel probing using a dummy structure that lacks the back pointer to
the controller's softc.

Bug reported and fix tested by Andrew Daugherity, thanks!
OK phessler, jsg, krw, deraadt



CVS: cvs.openbsd.org: src

2017-09-18 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/09/18 13:45:52

Modified files:
share/man/man4 : hyperv.4 

Log message:
Mention that Generation 2 Virtual Machines are currently not supported



CVS: cvs.openbsd.org: src

2017-08-23 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/08/23 04:10:56

Modified files:
sys/dev/pci: if_txp.c 

Log message:
Prevent trashing of the producer index and descriptor counter

The last change has removed a clause that required caching producer
index and descriptor counter but introduced an early break that can
cause uninitialized values to be stored in the ring header.

Coverity CID 1453170, 1452971

OK visa



CVS: cvs.openbsd.org: src

2017-08-17 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/08/17 12:22:43

Modified files:
sys/net: hfsc.c 

Log message:
Remove a class from parent's active list when queue is empty

When hfsc_deq_begin can't obtain an mbuf from the queue which can
happen with fq_codel, the hfsc_deq_commit isn't called and HFSC
doesn't get to update the active queue list of the parent class.
To successfully purge and destroy such class, we need to make
sure to run the service curve update routine even if we haven't
dequeued anything so that the parent class doesn't accumulate
stale child classes on its active list.

Reported by Atanas Vladimirov, OK visa



CVS: cvs.openbsd.org: src

2017-08-17 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/08/17 12:14:39

Modified files:
sys/net: hfsc.c 

Log message:
Resolve races with the hfsc_deferred timeout

Since NET_LOCK no longer protects the ioctl path from timeouts
running while ifq configuration is happening, the hfsc_deferred
timeout needs to make sure that the underlying HFSC object is
locked before attempting to reference it. This prevents the race
happening after we release the ifq mutex in ifq_attach but before
hfsc_free disables the timeout.

The second race is possible after hfsc_alloc but before the ifq
mutex gets locked in ifq_attach and a new set of ifq operations
is installed. If hfsc_deferred fires in between, it wouldn't be
able to reschedule itself and will no longer be executed. To
prevent this, the timeout can be established when packets are
enqueued instead of the moment the queue is created.

With input and OK visa



CVS: cvs.openbsd.org: src

2017-08-17 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/08/17 04:14:08

Modified files:
sys/net: if_bridge.c 

Log message:
Skip SPD lookups for short packets on IPsec-enabled bridge

When short packets are sent to the bridge with IPsec enabled,
an incorrect error path can be taken which leads to a lookup
of an SPD entry using an uninitialized SPI. Most of the time
this will fail, however there's a chance that an existing SPD
entry corresponds to the provided SPI which leads to use of
another uninitialized variable used to offset the IP or IPv6
header in order to get to the security protocol header.

ESP performs packet length checks and will fail when such
packets will reach it, but AH and IPComp don't have similar
checks and are affected the most.

CID 1452946, 1452957; Severity: Major

OK millert, visa, bluhm



CVS: cvs.openbsd.org: src

2017-08-16 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/08/16 11:52:17

Modified files:
sys/kern   : kern_bufq.c 

Log message:
Correct the check when selecting an elevator

Coverity CID 1453358; Severity: unlikely, not user-visible

ok millert, visa



CVS: cvs.openbsd.org: src

2017-08-16 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/08/16 08:19:57

Modified files:
sys/net: pf_table.c 

Log message:
Validate pfra_type after copyin before using it to index an array

Don't trust the value of pfra_type blindly since it's coming from
userland and sanitize it in pfr_validate_addr that is called after
every copyin and also perform the check in pfr_create_kentry before
we attempt to use the value not after.

Coverity CID 1452909, 1453097, 1453384; Severity: Minor
It can be triggered only by root by default or anyone with write
access to /dev/pf if such access is provided.

ok visa, bcook, sashan, jsg



CVS: cvs.openbsd.org: src

2017-08-10 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/08/10 14:13:57

Modified files:
sys/dev/pv : xen.c 

Log message:
Don't forget to call va_end in xen_hypercall

Coverity CID 1453343



CVS: cvs.openbsd.org: src

2017-08-10 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/08/10 12:14:56

Modified files:
sys/dev/pv : xenstore.c 

Log message:
Prevent an unlikely resource leak

Coverity CID 1453069; Severity: unlikely, not user-visible.



CVS: cvs.openbsd.org: src

2017-08-10 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/08/10 11:22:48

Modified files:
sys/dev/pv : hvs.c 

Log message:
Correct the upper bound for the command size before the passthrough

Coverity CID 1453317; Severity: unlikely, not user-visible.



CVS: cvs.openbsd.org: src

2017-08-10 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/08/10 11:11:49

Modified files:
sys/dev/pv : hvs.c 

Log message:
Buffer size for the SCSI vendor string should be 8 char long

A vendor and part of the product string got copied into a larger
on-stack buffer as a result of an out-of-bounds access, however
only 4 characters are meaningful in this context.

Coverity CID 1453206; Severity: insignificant.



CVS: cvs.openbsd.org: src

2017-08-10 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/08/10 10:48:47

Modified files:
sys/dev/pv : if_hvn.c 

Log message:
Fixup upper bound for the completion descriptor identifier

Coverity CID 1452864; Severity: unlikely, not user-visible.



CVS: cvs.openbsd.org: src

2017-08-10 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/08/10 09:25:57

Modified files:
sys/dev/pv : hypervic.c 

Log message:
Fail if unknown type of an address family was specified

Coverity CID 1452981; Severity: unlikely, not user-visible.



CVS: cvs.openbsd.org: src

2017-08-10 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/08/10 09:01:42

Modified files:
sys/dev/pci: mpii.c 

Log message:
Remove a leftover bit that was dereferencing an uninitialized pointer

Coverity CID 1453398; ok deraadt.



CVS: cvs.openbsd.org: src

2017-07-24 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/24 09:20:46

Modified files:
sys/net: hfsc.c 

Log message:
Don't attempt to deactivate a class that doesn't have any packets in it

Classes are considered "active" when they have packets assigned to them.
Active classes are tracked on various lists and during the purge operation
must be dissociated from them.  During factoring out of the HFSC internal
FIFO operations, the check for whether the class is empty got lost.

Issue reported and fix tested by abieber@ and myself.



CVS: cvs.openbsd.org: src

2017-07-23 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/23 19:23:46

Modified files:
sys/net: fq_codel.c 

Log message:
Fixup free list handling in fqcodel_deq_begin

We're growing an mbuf free list while iterating over flow queues
and need to adjust our internal statistics on every iteration by
using a portion of the free list corresponding to the current
iteration.



CVS: cvs.openbsd.org: src

2017-07-21 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/21 14:58:07

Modified files:
usr.sbin/hostctl: hostctl.8 

Log message:
Stress the fact that individual pvbus device nodes correspond to
a single key-value store and if there are other ones available,
different nodes must be used to access them.



CVS: cvs.openbsd.org: src

2017-07-21 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/21 14:00:47

Modified files:
sys/dev/pv : xen.c xenvar.h 

Log message:
Replace MD _bus_dmamap_* function calls with MI ones



CVS: cvs.openbsd.org: src

2017-07-21 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/21 13:15:43

Modified files:
etc/etc.amd64  : MAKEDEV 
etc/etc.i386   : MAKEDEV 

Log message:
sync



CVS: cvs.openbsd.org: src

2017-07-21 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/21 13:15:07

Modified files:
etc: MAKEDEV.common 

Log message:
Multiple virtualization layers may be available at the same time
reachable through different pvbus device nodes.

Suggestion and OK deraadt, OK reyk



CVS: cvs.openbsd.org: src

2017-07-21 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/21 12:27:32

Modified files:
share/man/man4 : xen.4 

Log message:
Document settings for XenServer

Figured out by Dinar Talypov and Maxim Khitrov.  With input from
deraadt@ and schwarze@.  OK schwarze.



CVS: cvs.openbsd.org: src

2017-07-21 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/21 06:28:15

Modified files:
share/man/man4 : ciss.4 

Log message:
Fixup too much indentation



CVS: cvs.openbsd.org: src

2017-07-20 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/20 15:14:39

Modified files:
regress/sbin/pfctl: pf109.ok pf110.in pf110.ok 

Log message:
Fixup pf109.ok and rewrite pf110



CVS: cvs.openbsd.org: src

2017-07-19 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/19 10:48:22

Modified files:
sys/dev/pv : xen.c 

Log message:
Turn this into a panic since there's no way to recover from it



CVS: cvs.openbsd.org: src

2017-07-19 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/19 10:31:56

Modified files:
sys/dev/usb: if_urndis.c 

Log message:
Add a handler for RNDIS status messages

RNDIS status messages may indicate various conditions reported by
the hardware, including link status events. They're not supposed
to be universally treated as errors.

Issue reported by Artturi Alm, ok armani



CVS: cvs.openbsd.org: src

2017-07-19 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/19 07:41:20

Modified files:
sys/net: hfsc.c 

Log message:
Fix the test condition weakened a recent change



CVS: cvs.openbsd.org: src

2017-07-19 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/19 07:02:46

Modified files:
regress/sbin/pfctl: Makefile 
Added files:
regress/sbin/pfctl: pf105.in pf106.in pf107.in pf108.in pf109.in 
pf105.ok pf106.ok pf107.ok pf108.ok pf109.ok 
pf110.in pf111.in pf110.ok pf111.ok 
pfail58.in pfail59.in pfail58.ok pfail59.ok 
pfail60.in pfail61.in pfail62.in pfail60.ok 
pfail61.ok pfail62.ok 

Log message:
Regression tests asserting various HFSC and FQ-CoDel functionality



CVS: cvs.openbsd.org: src

2017-07-19 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/19 06:58:31

Modified files:
sbin/pfctl : parse.y pfctl.c pfctl_parser.c 
usr.bin/systat : pftop.c 

Log message:
Allow HFSC classes to use flow queues

The FQ-CoDel related configuration (flows, quantum) becomes available
for the regular bandwidth queue.  Internally the kernel will pick the
FQ-CoDel for use as a queue manager for the specified class instead of
the FIFO.

Discussed with and OK henning@ at d2k17 as a part of a larger diff.



CVS: cvs.openbsd.org: src

2017-07-19 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/19 06:54:09

Modified files:
sys/net: hfsc.c 

Log message:
Factor out internal FIFO queue manager

HFSC internal queue becomes accessible via pf queueing ops. It will
also select an alternative queue manager based on the queue spec.

Discussed with and OK henning@ at d2k17 as a part of a larger diff.



CVS: cvs.openbsd.org: src

2017-07-19 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/19 06:51:31

Modified files:
sbin/pfctl : parse.y pfctl.c pfctl_queue.c 
sys/net: pf_ioctl.c pfvar.h 

Log message:
Rework HFSC vs FQ-CoDel checks

The selection mechanism introduced in pf_ioctl.c -r1.316 suffers
from being too ambiguous and lacks robustness. Instead of relying
on composition of multiple flags in the queue specification, it's
easier to identify the root class (if it exists) and derive all
further checks from it.



CVS: cvs.openbsd.org: src

2017-07-18 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/18 05:42:51

Modified files:
sys/dev/pci: xspd.c 

Log message:
Fixup the printf string, spacing



CVS: cvs.openbsd.org: src

2017-07-17 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/17 10:32:26

Modified files:
sys/dev/pv : xen.c 

Log message:
Forbid overwriting a grant table entry currently in use



CVS: cvs.openbsd.org: src

2017-07-17 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/17 10:04:31

Modified files:
sys/dev/pv : xen.c 

Log message:
Reduce amount of CAS attempts in a busy-wait loop by a factor of 100



CVS: cvs.openbsd.org: src

2017-07-17 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/17 10:01:24

Modified files:
sys/dev/pv : if_xnf.c 

Log message:
Pick the correct TX buffer when unrolling



CVS: cvs.openbsd.org: src

2017-07-17 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/17 09:58:22

Modified files:
sys/dev/pv : if_xnf.c 

Log message:
Reimplement mbuf/map to descriptor mapping

Previously descriptors have referenced DMA maps too loosely which
led to bus_dmamap_unload being called before all fragments have been
completed.  This eliminates the last instance of excessive looping
while waiting for a grant table entry to become available.



CVS: cvs.openbsd.org: src

2017-07-17 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/17 04:30:03

Modified files:
sys/dev/pv : xbf.c 

Log message:
Grant table entries must be disassociated once CCB is complete

Attempting to unload the map before all chunks are done may lead
to unnecessary looping.



CVS: cvs.openbsd.org: src

2017-07-14 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/14 15:53:34

Modified files:
sys/dev/pv : xen.c 

Log message:
Spacing



CVS: cvs.openbsd.org: src

2017-07-14 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/14 14:08:46

Modified files:
sys/dev/pv : xen.c 

Log message:
Reduce the number of CAS loops from ludicrous to ridiculous

Now that the source of the delay with releasing grant table entries has
been identified and fixed the number of attempts to CAS entry flags can
be substantially reduced and while it's decreased by a factor of 10,
it should go down at least a 100 more in the future.



CVS: cvs.openbsd.org: src

2017-07-14 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/14 13:09:52

Modified files:
sys/dev/pv : xen.c xenvar.h 

Log message:
Silence the interrupt source until the interrupt task has done its job

This small change significantly improves performance under load and halves
the number of received interrupts.



CVS: cvs.openbsd.org: src

2017-07-14 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/14 12:24:51

Modified files:
sys/dev/pv : if_xnf.c 

Log message:
Support out-of-order TX completion notifications

Apparently, just like the disk interface, the network backend may
post TX completions out-of-order, i.e. the ring position doesn't
determine which descriptor is being completed and the code must
look at the response id inside the completion message.  It might
seem obvious, but since networking hardware doesn't usually work
this way, it was something that has been overlooked.

Based on instability reports from Kirill Miazine ,
thanks!



CVS: cvs.openbsd.org: src

2017-07-13 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/13 05:23:53

Modified files:
sys/dev/pv : hvs.c 

Log message:
Add a comment explaining why pciide(4) must skip attaching disks

Requested by kettenis@.



CVS: cvs.openbsd.org: src

2017-07-12 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/12 08:36:57

Modified files:
sys/dev/pci: if_txp.c if_txpreg.h 

Log message:
Tweak txp to avoid ifq_deq_begin/commit/rollback

Setup the transmit ring the way FreeBSD driver does giving each
descriptor a 16 fragment chain and revamp the start routine to
use m_defrag for long chains and avoid the dequeue begin/commit/
rollback dance.

OK dlg



CVS: cvs.openbsd.org: src

2017-07-12 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/12 08:25:36

Modified files:
sys/dev/pci: if_vic.c 

Log message:
Reshuffle vic_start and get rid of the dequeue begin/rollback/commit dance

Tested on ESXi 5.5.0, OK reyk



CVS: cvs.openbsd.org: src

2017-07-12 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/12 07:44:54

Modified files:
sys/dev/pv : hvs.c 

Log message:
Prefer paravirtualized interface for IDE disks as well



CVS: cvs.openbsd.org: src

2017-07-12 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/12 07:40:59

Modified files:
sys/dev/ic : wdc.c wdcvar.h 
sys/dev/pci: pciide.c 

Log message:
Introduce two quirks to prevent attaching ATA and ATAPI devices

Hyper-V and Xen have varying support for detaching emulated IDE
devices ranging from none on Hyper-V to only IDE disks but not
CDROM (Xen). The quirk mechanism provides a way of enforcing the
desired behavior.

With suggestions and OK kettenis, tedu, mlarkin



CVS: cvs.openbsd.org: src

2017-07-12 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/07/12 05:13:22

Modified files:
sys/kern   : vfs_bio.c 

Log message:
Invalidate read-ahead buffers when read short

Buffercache performs read-ahead for cluster reads by extending
the length of an original read operation to the MAXPHYS (64k).
Upon I/O completion, the length is trimmed and the buffer is
returned to the filesystem and the remaining data is cached.

However, under certain circumstances, the underlying hardware
may fail to do a complete I/O operation and return with a non-
zero value of the residual length (i.e. data that wasn't read).
The residual length may exceed the size of an original request
and must be re-adjusted to uphold the contract with the caller,
e.g. the filesystem. At the same time, read-ahead buffers that
cover chunks of memory corresponding to the residual length
must be invalidated and not cached.

Discussed at length during d2k17, ok tedu



CVS: cvs.openbsd.org: src

2017-06-28 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/06/28 13:30:25

Modified files:
sys/net: pf_ioctl.c pfvar.h 

Log message:
Introduce a simple mechanism to select the appropriate queue manager

Discussed with and OK henning@ at d2k17 as a part of a larger diff.



CVS: cvs.openbsd.org: src

2017-06-28 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/06/28 13:27:42

Modified files:
sys/net: pf_ioctl.c 

Log message:
Tighten up FQ-CoDel vs HFSC checks

PFQS_FLOWQUEUE is about to become a flag that HFSC classes may specify
as well; thus a better way of telling FQ-CoDel and HFSC apart needs to
be found.  At the moment its derived from the queue specification.

Discussed with and OK henning@ at d2k17 as a part of a larger diff.



CVS: cvs.openbsd.org: src

2017-06-28 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/06/28 13:13:35

Modified files:
sys/net: fq_codel.c 

Log message:
Provide pf queue manager API

Discussed with and OK henning@ at d2k17 as a part of a larger diff.



CVS: cvs.openbsd.org: src

2017-06-28 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/06/28 12:31:03

Modified files:
sys/net: pfvar.h 

Log message:
Extend pf queueing ops to include queue manager hooks

Discussed with and OK henning@ at d2k17 as a part of a larger diff.



CVS: cvs.openbsd.org: src

2017-06-28 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/06/28 12:24:02

Modified files:
sys/conf   : files 
sys/net: hfsc.c 

Log message:
hfsc.c should depend on pf instead of inet

Discussed with and OK henning@ at d2k17 as a part of a larger diff.



CVS: cvs.openbsd.org: src

2017-06-27 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/06/27 07:56:15

Modified files:
sys/dev/pv : hyperv.c 

Log message:
Provide a handler stub for the "channel rescind" message



CVS: cvs.openbsd.org: src

2017-06-26 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/06/26 14:12:14

Modified files:
sys/dev/pv : hvs.c 

Log message:
Minor cleanup; when polling delay before calling the interrupt handler



CVS: cvs.openbsd.org: src

2017-06-26 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/06/26 12:42:23

Modified files:
sys/dev/pv : hyperv.c 

Log message:
Rework the deferred interrupt loop

By performing a task_add an interrupt handler can rely on the
taskq_thread to invoke it again with an additional benefit of
being able to sched_pause when required. In the long run more
than 99.8% of calls do not require an additional iteration.



CVS: cvs.openbsd.org: src

2017-06-23 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/06/23 13:09:21

Modified files:
sys/dev/pv : hyperv.c 

Log message:
Event interrupt handler should call hv_channel_schedule now



CVS: cvs.openbsd.org: src

2017-06-23 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/06/23 13:07:13

Modified files:
sys/dev/pv : hvs.c 

Log message:
Request deferred interrupt processing



CVS: cvs.openbsd.org: src

2017-06-23 Thread Mike Belopuhov
CVSROOT:/cvs
Module name:src
Changes by: mi...@cvs.openbsd.org   2017/06/23 13:05:42

Modified files:
sys/dev/pv : hyperv.c hypervvar.h 

Log message:
Introduce deferred interrupt processing capability

Hyper-V interrupts seem to be sometimes delivered before the message
becomes available on the channel ring.  This is reproducible on hvs(4)
under load.  This change is modelled on the workaround found in the
Linux driver.



  1   2   3   4   5   6   7   8   9   10   >