Re: patch axen(4) (WIP)

2019-02-25 Thread Martin Pieuchot
On 25/02/19(Mon) 14:52, Nils Frohberg wrote: > Hi, > > as mentioned previously, I'm looking into axen(4). While searching > for the cause of a panic (fixed since, thanks mpi@) I started to > rewrite parts of the driver. References were mainly the FreeBSD and > Linux drivers. Please try to isolate

bridge/bif tweak

2019-02-22 Thread Martin Pieuchot
There's no need to get the `bif' pointer again, we already got it from the list :) ok? diff --git sys/net/if_bridge.c sys/net/if_bridge.c index 22f67c39dca..838f6d32886 100644 --- sys/net/if_bridge.c +++ sys/net/if_bridge.c @@ -770,7 +770,6 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, stru

Let bridge_rtlookup() insert that tag

2019-02-22 Thread Martin Pieuchot
Some plumbing to move the tag mechanism outside of net/if_bridge.c . bridge_rtlookup() now returns an interface pointer and "bridge_rtnode" are modified with the mutex held. This will make locking in bridge_output() simpler. Ok? Index: net/bridgectl.c ===

Re: bypass interface input queues for vlan(4)

2019-02-22 Thread Martin Pieuchot
On 22/02/19(Fri) 15:01, David Gwynne wrote: > On Thu, Feb 21, 2019 at 04:29:27PM -0300, Martin Pieuchot wrote: > > On 21/02/19(Thu) 14:19, David Gwynne wrote: > > > right now we add vlan_input as a possible input handler on the parent > > > interface, and if the packet i

Re: bypass interface input queues for vlan(4)

2019-02-21 Thread Martin Pieuchot
On 21/02/19(Thu) 14:19, David Gwynne wrote: > right now we add vlan_input as a possible input handler on the parent > interface, and if the packet is for a vlan we take it and pretend we > received it on the vlan interface by calling if_input against that mbuf. > > as mpi notes, the if input queue

Re: ioctls for MPLS pseudowire interface config

2019-02-21 Thread Martin Pieuchot
On 21/02/19(Thu) 07:35, David Gwynne wrote: > > On 20 Feb 2019, at 11:21 pm, Martin Pieuchot wrote: > > > > On 20/02/19(Wed) 14:44, David Gwynne wrote: > >> Index: sys/net/if.c > >> === &g

sched_choosecpu_fork()

2019-02-20 Thread Martin Pieuchot
When choosing the initial CPU for a new thread to run on, the scheduler do not consider that CPU0 is handling interrupts. Threads that are created early, like the network taskq, always end up scheduled on CPU0. If the machine isn't running many programs, like simple firewalls, there won't be cont

Re: ioctls for MPLS pseudowire interface config

2019-02-20 Thread Martin Pieuchot
On 20/02/19(Wed) 14:44, David Gwynne wrote: > Index: sys/net/if.c > === > RCS file: /cvs/src/sys/net/if.c,v > retrieving revision 1.571 > diff -u -p -r1.571 if.c > --- sys/net/if.c 9 Jan 2019 01:14:21 - 1.571 > +++ sys/n

Re: video(1) and modesetting driver

2019-02-14 Thread Martin Pieuchot
On 14/02/19(Thu) 11:24, Raphael Graf wrote: > On Wed, Feb 13, 2019 at 04:09:10PM -0200, Martin Pieuchot wrote: > > On 07/02/19(Thu) 13:52, Raphael Graf wrote: > > > [...] > > > The new diff below solves this yuy2/yuyv problem by defining them both > >

Re: video(1) and modesetting driver

2019-02-13 Thread Martin Pieuchot
On 07/02/19(Thu) 13:52, Raphael Graf wrote: > [...] > The new diff below solves this yuy2/yuyv problem by defining them both under > the same name 'yuy2'. That's great. I would just change the comment to explain that it's due to an incoherency between the names reported by XvListImageFormats(3)

timeout_barrier() in bridge_stop()

2019-02-13 Thread Martin Pieuchot
If timeout_del(9) didn't remove the timeout we need to ensure we're not leaving a reference to the `sc' in the wild. We do not want to execute the timeout when the interface isn't running, so add the proper check and correct the flag set/unset ordering. ok? diff --git sys/net/bridgectl.c sys/net

mpw(4) hacks for bridge(4)

2019-02-13 Thread Martin Pieuchot
Now that mpw(4) is an Ethernet interface, can I get rid of the following hacks? Index: net/if_bridge.c === RCS file: /cvs/src/sys/net/if_bridge.c,v retrieving revision 1.319 diff -u -p -r1.319 if_bridge.c --- net/if_bridge.c 29 Ja

Protect bridge(4) hash table

2019-02-13 Thread Martin Pieuchot
Diff below uses a mutex to serialize accesses to the hash table. It doesn't guarantee that pointers returned by a lookup on this table are still valid. This will be addressed in a later diff. I also annotated Immutable fields ([I]) in the bridge_softc structure. Ok? Index: net/bridgectl.c

Re: futex(2) based pthread_rwlock*

2019-02-13 Thread Martin Pieuchot
On 12/02/19(Tue) 23:25, Paul Irofti wrote: > On Wed, Jan 30, 2019 at 12:29:20PM -0200, Martin Pieuchot wrote: > > On 28/01/19(Mon) 14:57, Martin Pieuchot wrote: > > > Summer is really warm here. No need to make my machines hotter by > > > spinning a lot. So here's

Re: fork rt_ifa_{add,del} for mpls local input routes

2019-02-01 Thread Martin Pieuchot
On 31/01/19(Thu) 13:31, David Gwynne wrote: > On Wed, Jan 30, 2019 at 11:54:45AM -0200, Martin Pieuchot wrote: > > On 30/01/19(Wed) 11:48, David Gwynne wrote: > > > mpls uses AF_MPLS routes with RTF_LOCAL set on them to know which tags > > > are used as input for

Re: futex(2) based pthread_rwlock*

2019-01-30 Thread Martin Pieuchot
On 28/01/19(Mon) 14:57, Martin Pieuchot wrote: > Summer is really warm here. No need to make my machines hotter by > spinning a lot. So here's a futex(2) based pthread_rwlock* > implementation. I should look familiar to those of you that reviewed > the mutex & semaphore

Re: fork rt_ifa_{add,del} for mpls local input routes

2019-01-30 Thread Martin Pieuchot
On 30/01/19(Wed) 11:48, David Gwynne wrote: > mpls uses AF_MPLS routes with RTF_LOCAL set on them to know which tags > are used as input for the mpe and mpw interfaces. setting this up > currently goes through rt_ifa_add, but that has a couple of features > that are undesirable for mpls. > > First

futex(2) based pthread_rwlock*

2019-01-28 Thread Martin Pieuchot
k.c 23 Jan 2019 20:30:22 - @@ -1,8 +1,7 @@ /* $OpenBSD: rthread_rwlock.c,v 1.11 2018/04/24 16:28:42 pirofti Exp $ */ /* - * Copyright (c) 2004,2005 Ted Unangst + * Copyright (c) 2018 Martin Pieuchot * Copyright (c) 2012 Philip Guenther - * All Rights Reserved. * * Permission to use,

pthread_cond_signal(3) tweak

2019-01-28 Thread Martin Pieuchot
Amend the manual, per POSIX [0], the function "shall unblock at least one of the threads". This can happen in our implementation when the function is called w/o holding the corresponding mutex. If a thread is blocking on the futex lock, the sequence number will change and futex(2) will return EAG

bridge_output() plumbing

2019-01-28 Thread Martin Pieuchot
Some plumbing to makes upcoming locking changes easier to review: - Move the `m_len' check first, this does require any locking and will save us a lock/unlock dance. - Use the `!ETHER_IS_MULTICAST()' idiom to be coherent with the rest of the driver. It is also clear that if the bridge(4) is

Re: MPLSv6 1/2: kernel diff

2019-01-28 Thread Martin Pieuchot
On 28/01/19(Mon) 13:36, David Gwynne wrote: > > > > On 27 Dec 2018, at 5:42 pm, Claudio Jeker wrote: > > > > On Wed, Dec 26, 2018 at 09:27:59PM +0100, Denis Fondras wrote: > >> Resend because of nasty typo :/ > >> > >> On Mon, Dec 24, 2018 at

Re: Unobfuscate thread stealing algorithm

2019-01-27 Thread Martin Pieuchot
On 27/01/19(Sun) 01:02, Mark Kettenis wrote: > > Date: Sat, 26 Jan 2019 14:46:41 -0200 > > From: Martin Pieuchot > > > > On MP machines, when a CPU executes mi_switch() and doesn't have any > > thread on its runqueue it will try to steal one from another CPU&#x

Silent error in pfkeyv2_send()

2019-01-26 Thread Martin Pieuchot
If pfkeyv2_send() tries to send a message without a required extension or with a non-allowed extension it will silently fail. I spent many hours debugging the code exporting counters because of this. I'd like to return an error code instead. Ok? Index: /sys/net/pfkeyv2.c ===

Export per-TDB counters

2019-01-26 Thread Martin Pieuchot
Last time I enabled this code, I forgot to whitelist the extension for SADB_GET. Thanks to the help from Mark Patruck, who originally reported the regression with iked(8) via bugs@, I came up with the diff below. ok to enable it again? Index: net/pfkeyv2.c ===

Unobfuscate thread stealing algorithm

2019-01-26 Thread Martin Pieuchot
On MP machines, when a CPU executes mi_switch() and doesn't have any thread on its runqueue it will try to steal one from another CPU's runqueue. If it fails to steal a thread from another runqueue it will pick its own Idle thread. To decide which thread should be picked, the scheduler evaluate t

Re: video(1) and modesetting driver

2019-01-25 Thread Martin Pieuchot
On 25/01/19(Fri) 11:16, Raphael Graf wrote: > On Wed, Jan 23, 2019 at 12:54:51PM -0200, Martin Pieuchot wrote: > > > Index: video.c > > > === > > > RCS file: /cvs/xenocara/app/video/video.c,v > > &

Re: new USB audio class v2.0 driver

2019-01-23 Thread Martin Pieuchot
On 31/12/18(Mon) 16:58, Alexandre Ratchov wrote: > Hi, > > Here's a new driver for both USB audio class (UAC) v1.0 and v2.0 > devices, it would replace the current one. It focuses on reliability > and proper synchronization, including in low-latency configurations. Some comments about the code.

Re: video(1) and modesetting driver

2019-01-23 Thread Martin Pieuchot
Hello Raphael, On 16/01/19(Wed) 12:41, Raphael Graf wrote: > Here is an attempt to make video(1) work with the modesetting driver. > See https://marc.info/?l=openbsd-bugs&m=152231686416039&w=2 > > The general idea: > If there is no common encoding for input (device) and output (Xv), the > encodin

bridge_ourether() tweak

2019-01-22 Thread Martin Pieuchot
Directly pass a pointer, which implies we have a valid reference for the given interface. This will matters when we'll start using ifp indexes. ok? Index: net/if_bridge.c === RCS file: /cvs/src/sys/net/if_bridge.c,v retrieving revis

Down bridge(4) & span ports

2019-01-22 Thread Martin Pieuchot
If a bridge(4) is down packets don't flow through it, so be coherent and do not copy them for span ports. ok? Index: net/if_bridge.c === RCS file: /cvs/src/sys/net/if_bridge.c,v retrieving revision 1.316 diff -u -p -r1.316 if_bridge.

Re: trunk shouldnt care if it's stacked

2019-01-10 Thread Martin Pieuchot
On 09/01/19(Wed) 19:12, Theo de Raadt wrote: > Philip Guenther wrote: > > > On Wed, Jan 9, 2019 at 1:11 AM Klemens Nanni wrote: > > > > > On Wed, Jan 09, 2019 at 01:12:31PM +1000, David Gwynne wrote: > > > > -#define TRUNK_MAX_STACKING 4 /* maximum number of stacked > > > trunks */ > >

off by one in pfkeyv2_sysctl_policydumper()

2019-01-09 Thread Martin Pieuchot
The last extension type isn't set in pfkeyv2_sysctl_policydumper(). So fix the bug instead of working around it in export_counter(). ok? Index: net/pfkeyv2.c === RCS file: /cvs/src/sys/net/pfkeyv2.c,v retrieving revision 1.193 diff

Re: Convert bridge span & int. list to SLIST()

2019-01-09 Thread Martin Pieuchot
On 09/01/19(Wed) 10:11, Martin Pieuchot wrote: > On 23/12/18(Sun) 14:41, Martin Pieuchot wrote: > > Using SLIST() instead of TAILQ() is a step towards using lock-less > > lists. > > > > As found in my previous attempts the interface list cannot be protected > >

Re: Convert bridge span & int. list to SLIST()

2019-01-09 Thread Martin Pieuchot
On 23/12/18(Sun) 14:41, Martin Pieuchot wrote: > Using SLIST() instead of TAILQ() is a step towards using lock-less > lists. > > As found in my previous attempts the interface list cannot be protected > by a mutex as long a if_enqueue() might grab the KERNEL_LOCK(). So I'

Re: MPLSv6 1/2: kernel diff

2018-12-27 Thread Martin Pieuchot
On 26/12/18(Wed) 17:13, Denis Fondras wrote: > On Mon, Dec 24, 2018 at 08:43:10PM -0200, Martin Pieuchot wrote: > > I'm not happy with adding the IFF_MULTICAST flag and SIOC{ADD,DEL}MULTI > > ioctls. It seems to be a common pattern between in existing pseudo-driver, > &g

Re: iSerialNumber -> serial

2018-12-27 Thread Martin Pieuchot
On 25/12/18(Tue) 20:32, Martin Pieuchot wrote: > Simple change to have verbose USB device fit into 80 chars in usbdevs(8): New version using 'iSerial'. This is coherent w/ what lsusb(8) displays and isn't ambiguous with regard to the device descriptor name as pointed out by

uhub(4) w/o usbd_device2interface_handle()

2018-12-25 Thread Martin Pieuchot
Now that almost all USB drivers match a properly configured device, we can simplify them. Instead of calling usbd_device2interface_handle() simply use the `iface' argument passed to the *attach() function. This works well in uhub(4) because the interface 0 of the first configuration is always use

sys/crypto & free(9) sizes

2018-12-25 Thread Martin Pieuchot
ok? Index: crypto/cryptosoft.c === RCS file: /cvs/src/sys/crypto/cryptosoft.c,v retrieving revision 1.84 diff -u -p -r1.84 cryptosoft.c --- crypto/cryptosoft.c 31 May 2018 19:40:58 - 1.84 +++ crypto/cryptosoft.c 29 Nov 2018 1

Kill usb_fill_di_task()

2018-12-25 Thread Martin Pieuchot
usbd_fill_deviceinfo() does not generate any I/O so there's no need to call it from a USB thread. So the diff below kills usb_fill_di_task(). While here do not skip USB devices without attached drivers. If you disable ugen(4) in your kernel they are properly handled. usbdevs(8) will simply not

iSerialNumber -> serial

2018-12-25 Thread Martin Pieuchot
Simple change to have verbose USB device fit into 80 chars in usbdevs(8): Before == $ usbdevs -v addr 04: 0b95:1790 ASIX Elec. Corp., AX88179 high speed, power 248 mA, config 1, rev 1.00, iSerialNumber 133B8B1B30 driver: axen0 After

Re: MPLS: mpls_do_error() cleanup

2018-12-25 Thread Martin Pieuchot
On 25/12/18(Tue) 21:16, Denis Fondras wrote: > On Mon, Dec 24, 2018 at 08:43:10PM -0200, Martin Pieuchot wrote: > > It would be great if you could think the IPv4 version as well to take > > a 'struct sockaddr' argument instead of a `struct in_ifaddr'. > > &g

Re: MPLSv6 1/2: kernel diff

2018-12-25 Thread Martin Pieuchot
On 25/12/18(Tue) 20:05, Denis Fondras wrote: > On Tue, Dec 25, 2018 at 04:50:17PM -0200, Martin Pieuchot wrote: > > On 25/12/18(Tue) 10:25, Denis Fondras wrote: > > > On Mon, Dec 24, 2018 at 08:43:10PM -0200, Martin Pieuchot wrote: > > > > On 24/12/18(M

Re: Please test: HZ bump

2018-12-25 Thread Martin Pieuchot
On 24/12/18(Mon) 20:07, Scott Cheloha wrote: > On Tue, Dec 18, 2018 at 03:39:43PM -0600, Ian Sutton wrote: > > On Mon, Aug 14, 2017 at 3:07 PM Martin Pieuchot wrote: > > > > > > I'd like to improve the fairness of the scheduler, with the goal of > > > m

Re: MPLSv6 1/2: kernel diff

2018-12-25 Thread Martin Pieuchot
On 25/12/18(Tue) 10:25, Denis Fondras wrote: > On Mon, Dec 24, 2018 at 08:43:10PM -0200, Martin Pieuchot wrote: > > On 24/12/18(Mon) 17:31, Denis Fondras wrote: > > > Index: net/if_ethersubr.c > > > === &

Re: MPLSv6 1/2: kernel diff

2018-12-24 Thread Martin Pieuchot
On 24/12/18(Mon) 17:31, Denis Fondras wrote: > Thank you for the comments Martin. Here is an improved diff. I think you should commit the icmp6_do_error() refactoring. It's ok mpi@ with some nits below. It would be great if you could think the IPv4 version as well to take a 'st

Convert bridge span & int. list to SLIST()

2018-12-23 Thread Martin Pieuchot
Using SLIST() instead of TAILQ() is a step towards using lock-less lists. As found in my previous attempts the interface list cannot be protected by a mutex as long a if_enqueue() might grab the KERNEL_LOCK(). So I'm heading towards using SRPL_*(). Ok? Index: net/if_bridge.c ==

Re: MPLSv6 1/2: kernel diff

2018-12-23 Thread Martin Pieuchot
On 18/12/18(Tue) 12:13, Denis Fondras wrote: > Here is a serie of diffs to enable MPLSv6, MPLS transport over IPv6. Nice! > First diff : allow mpe(4) to handle IPv6 trafic. Comments below > Index: net/if_ethersubr.c > === > RCS fi

Re: Another attempt to bypass ifqs on interfaces

2018-12-23 Thread Martin Pieuchot
On 20/12/18(Thu) 11:35, David Gwynne wrote: > My last attempt in "let etherip(4) output directly to the ip stack" > didn't go so well. This one at least doesn't break bridge(4) on > Ethernet. It breaks it on mpw(4). > This diff effectively turns if_enqueue into a per interface function > pointer.

Re: let etherip(4) output directly to the ip stack

2018-12-12 Thread Martin Pieuchot
On 12/12/18(Wed) 12:03, David Gwynne wrote: > with the previous if_ethersubr.c diff, this allows etherip(4) to output > directly to the network stack. What do you mean with "directly"? To my understanding ip{,6}_etherip_output() call ip{,6}_send() to enqueue packets. > direct output relies on t

bridge nits

2018-12-11 Thread Martin Pieuchot
- Unify the two hooks by passing the same argument - Check for nullity before dereferencing `if_bridgeport', this will matter when we go MP - Use the same pattern to find a member in the ioctl path ok? Index: net/if_bridge.c === RC

sysv shm free(9) sizes

2018-12-11 Thread Martin Pieuchot
ok? Index: kern/sysv_shm.c === RCS file: /cvs/src/sys/kern/sysv_shm.c,v retrieving revision 1.69 diff -u -p -r1.69 sysv_shm.c --- kern/sysv_shm.c 15 Sep 2016 02:00:16 - 1.69 +++ kern/sysv_shm.c 11 Dec 2018 16:42:55 -0

SVID semaphores free(9) sizes

2018-12-11 Thread Martin Pieuchot
ok? Index: kern/sysv_sem.c === RCS file: /cvs/src/sys/kern/sysv_sem.c,v retrieving revision 1.53 diff -u -p -r1.53 sysv_sem.c --- kern/sysv_sem.c 14 Mar 2015 03:38:50 - 1.53 +++ kern/sysv_sem.c 11 Dec 2018 16:36:20 -0

bridge cleanup

2018-12-05 Thread Martin Pieuchot
Stop passing `sc' when it is not necessary. Also prefer passing the brigde's ifp rather than `sc' when it's enough. This makes auditing easier. Different structures need different locking. As a bonus is removes an horrible cast in net/if_switch.c. ok? Index: net/if_bridge.c ==

Useless splnet()

2018-12-05 Thread Martin Pieuchot
bstp_create() is called on by bridge/switch_clone_create(). Nothing it touches is reachable, so there's no need for splnet(). ok? Index: net/bridgestp.c === RCS file: /cvs/src/sys/net/bridgestp.c,v retrieving revision 1.66 diff -u -

netcred free(9) sizes

2018-12-05 Thread Martin Pieuchot
Keep track of the allocated size and use it later :) ok? Index: kern/vfs_subr.c === RCS file: /cvs/src/sys/kern/vfs_subr.c,v retrieving revision 1.282 diff -u -p -r1.282 vfs_subr.c --- kern/vfs_subr.c 29 Sep 2018 04:29:48 -

Re: option kcov + GENERIC.MP -> silent crash

2018-12-01 Thread Martin Pieuchot
On 01/12/18(Sat) 16:34, Anton Lindqvist wrote: > On Tue, Nov 27, 2018 at 05:52:15PM -0800, Greg Steuck wrote: > > I booted the patched kernel and it seems to have gone farther and I believe > > reached init before crashing. > > By performing a semi-automated bisect I was able to identify the sourc

Re: athn(4) hostap: mem leak

2018-12-01 Thread Martin Pieuchot
On 30/11/18(Fri) 13:49, Benjamin Baier wrote: > Hi > > There is a leak of *arg in > dev/usb/if_athn_usb.c:athn_usb_newauth() line 1263 > since Rev. 1.49 > Because athn_usb_do_async() memcpy's the argument anyway. > > Found with llvm/scan-build. > > Instead of adding free(arg) I opted to make th

Re: fuse_opt.3 patch

2018-11-30 Thread Martin Pieuchot
On 30/11/18(Fri) 07:07, Edgar Pettijohn wrote: > Here is a diff to remove the dubious example and fix one gramatical issue. Thanks. Don't forget to use "mandoc -Tlint" to spot potentials errors after a change. In this case you forgot to remove an ".Ed". Keep the good work. All fuse manuals ne

Re: free(9) sizes for sysv_msg

2018-11-30 Thread Martin Pieuchot
On 29/11/18(Thu) 22:42, Alexandre Ratchov wrote: > On Thu, Nov 29, 2018 at 04:51:19PM -0200, Martin Pieuchot wrote: > > Trivial one, ok? > > > > Index: kern/sysv_msg.c > > === > > RCS fil

Re: split ether_output up into resolution, encapsulation, and output

2018-11-30 Thread Martin Pieuchot
On 30/11/18(Fri) 12:35, David Gwynne wrote: > On Fri, Nov 30, 2018 at 12:21:11PM +1000, David Gwynne wrote: > > i have a plan to allow virtual interfaces (eg, vlan, etherip, etc) to > > provide their own output functions so they can bypass the ifq machinery > > and push the packet onto the underlyi

Re: fuse_opt.3 patch

2018-11-29 Thread Martin Pieuchot
On 29/11/18(Thu) 10:57, Edgar Pettijohn wrote: > Mostly just typos. Corrected the example some. However, please see below. I > don't > think the example works or I'm just doing something wrong. If we can fix the example, I'd say it's better to remove it. There are other places to find documentat

free(9) sizes for sysv_msg

2018-11-29 Thread Martin Pieuchot
Trivial one, ok? Index: kern/sysv_msg.c === RCS file: /cvs/src/sys/kern/sysv_msg.c,v retrieving revision 1.33 diff -u -p -r1.33 sysv_msg.c --- kern/sysv_msg.c 15 Sep 2016 02:00:16 - 1.33 +++ kern/sysv_msg.c 29 Nov 201

free(9) sizes for autoconf

2018-11-28 Thread Martin Pieuchot
This one is a bit tricky. In the indirect case, config_make_softc() allocates a chunk corresponding to a given `cf->cf_attach->ca_devsize'. ok? Index: kern/subr_autoconf.c === RCS file: /cvs/src/sys/kern/subr_autoconf.c,v retrieving

free(9) sizes for hooks

2018-11-28 Thread Martin Pieuchot
Trivial sizes, ok? Index: net/if.c === RCS file: /cvs/src/sys/net/if.c,v retrieving revision 1.567 diff -u -p -r1.567 if.c --- net/if.c12 Nov 2018 23:41:22 - 1.567 +++ net/if.c28 Nov 2018 20:57:21 - @@ -1088,9 +10

uticom(4): last driver setting config

2018-11-18 Thread Martin Pieuchot
Here's another diff to get rid of a driver attaching to a device in unconfigured state. I'd like to convert them all to enforce that a USB device can only be matched if the stack already managed to set its configuration. I'm looking for tests and oks. Index: uticom.c

ubsa(4): don't set the config in match()

2018-11-18 Thread Martin Pieuchot
Instead of setting the configuration in the *match() routine let the stack do it for us. This operation can fail, so it's better to not attach any driver if something bad happens. This change is similar to what I did with the rest of the drivers some years ago when I fuzzed the stack. I'm lookin

kue(4): don't set the config in match()

2018-11-18 Thread Martin Pieuchot
Instead of setting the configuration in the *match() routine let the stack do it for us. This operation can fail, so it's better to not attach any driver if something bad happens. This change is similar to what I did with the rest of the drivers some years ago when I fuzzed the stack. I'm lookin

free(9) sizes for USB subdevs

2018-11-16 Thread Martin Pieuchot
We need to keep track of the number of slots, so add a new field for that. ok? Index: usb_subr.c === RCS file: /cvs/src/sys/dev/usb/usb_subr.c,v retrieving revision 1.141 diff -u -p -r1.141 usb_subr.c --- usb_subr.c 16 Nov 2018 11:5

bread_cluster(9) & free(9) sizes

2018-11-14 Thread Martin Pieuchot
Diff below uses the, already calculated, number of read-ahead buffers to pass the correct size to free(9). While here I unified the two loops calculating this number of buffers, as we know for sure the first one isn't NULL. ok? Index: kern/vfs_bio.c ==

uhci(4) free(9) sizes

2018-11-14 Thread Martin Pieuchot
Pass the sizes of the interrupt and isochronous arrays to free(9). While here convert a malloc(9) to mallocarray(9). Untested for lack of hardware. ok? Index: uhci.c === RCS file: /cvs/src/sys/dev/usb/uhci.c,v retrieving revision 1

free(9) sizes for USB ifaces

2018-11-14 Thread Martin Pieuchot
We already have the number of available interfaces in the configuration descriptor, so use it to free the array. ok? Index: usb_subr.c === RCS file: /cvs/src/sys/dev/usb/usb_subr.c,v retrieving revision 1.140 diff -u -p -r1.140 usb_s

Re: sdmmc(4) support for suspend/resume with eMMC devices

2018-11-12 Thread Martin Pieuchot
On 12/11/18(Mon) 23:36, Ben Pye wrote: > On Mon, Nov 12, 2018 at 06:46:26PM -0200, Martin Pieuchot wrote: > > On 11/11/18(Sun) 13:10, Ben Pye wrote: > > > Hey all, > > > > > > In my quest for better OpenBSD support on my Chromebook 13 I have found > &

Re: [PATCH] Add elan(4) touchpad driver

2018-11-12 Thread Martin Pieuchot
On 09/11/18(Fri) 16:25, Ben Pye wrote: > On Thu, Nov 08, 2018 at 11:25:37PM -0600, joshua stein wrote: > > On Fri, 09 Nov 2018 at 03:30:07 +, b...@curlybracket.co.uk wrote: > > > Hi all, > > > > > > This patch adds a new touchpad driver, elan(4), which supports older non > > > PTP I2C Elantech

Re: sdmmc(4) support for suspend/resume with eMMC devices

2018-11-12 Thread Martin Pieuchot
On 11/11/18(Sun) 13:10, Ben Pye wrote: > Hey all, > > In my quest for better OpenBSD support on my Chromebook 13 I have found > that sdmmc(4)'s current strategy for suspend/resume only really works > for removable storage. Upon a suspend it marks the device as dying, and > upon resume will detach

batch copyout(9) in bridge(4)

2018-11-08 Thread Martin Pieuchot
I'd like to protect bridge(4) data structures with a mutex. Using a mutex is necessary because bridge_output() is called from interrupt handlers in wireless drivers. This forces us to decouple data gathering from copying to userland when executing some ioctl(2)s. Diff below does that by moving t

free(9) sizes for USB cdesc

2018-11-08 Thread Martin Pieuchot
The length of the configuration descriptor is already used in usbd_parse_idesc(). The diff below reuses the same pattern to add the size argument to free(9), ok? Index: usb_subr.c === RCS file: /cvs/src/sys/dev/usb/usb_subr.c,v retri

free(9) size for wi(4) @ USB

2018-11-08 Thread Martin Pieuchot
The driver already keeps track of the size of the allocated buffer, so use it. Diff is untested as I don't have a wi(4) @ USB. ok? Index: if_wi_usb.c === RCS file: /cvs/src/sys/dev/usb/if_wi_usb.c,v retrieving revision 1.68 diff -u

free(9) sizes for uhub(4)

2018-11-08 Thread Martin Pieuchot
The driver already keeps track of the number of ports, so use this piece of information to free allocated structures. Ok? Index: uhub.c === RCS file: /cvs/src/sys/dev/usb/uhub.c,v retrieving revision 1.90 diff -u -p -r1.90 uhub.c ---

free(9) size for USB endpoints

2018-11-08 Thread Martin Pieuchot
Keep track of the number of allocated endpoints and use it when freeing the array. ok? Index: usb_subr.c === RCS file: /cvs/src/sys/dev/usb/usb_subr.c,v retrieving revision 1.138 diff -u -p -r1.138 usb_subr.c --- usb_subr.c 19 Jul 2

bridge(4) ioctl & MP

2018-10-24 Thread Martin Pieuchot
I'd like to take brigde_input() & bridge_output() outside of the KERNEL_LOCK(). My previous approach relying on the NET_LOCK() didn't work because wireless drivers might call bridge_output() from their interrupt handler. So we'll need another mechanism. The first step would be to use a mutex. O

Re: diff: split ctloutput into getopt/setopt

2018-10-24 Thread Martin Pieuchot
On 18/10/18(Thu) 11:34, David Hill wrote: > Hello - > > This diff splits the ctloutput functions into getopt/setopt, which could > offer more fine-grained locking. It also removes some indentation and > imo is easier to read. > > Thoughts? Splitting the read and write path makes sense, it will

Re: igmp_slowtimo: drop NETLOCK

2018-10-24 Thread Martin Pieuchot
On 19/10/18(Fri) 12:15, Scott Cheloha wrote: > Hi, > > If we introduce a mutex for the igmp module we can drop the NETLOCK > from igmp_slowtimo(). The router_info list, rti_head, and its entries > are only ever accessed within the igmp module. The mutex also needs > to protect igmp_timers_are_ru

More bif

2018-09-26 Thread Martin Pieuchot
Diff below rename the remaining "struct bridge_iflist" variables to `bif', cohérence oblige! Ok? Index: net/bridgectl.c === RCS file: /cvs/src/sys/net/bridgectl.c,v retrieving revision 1.8 diff -u -p -r1.8 bridgectl.c --- net/bridge

carp_ourether() mpsafe

2018-09-21 Thread Martin Pieuchot
This is a requirement to get the bridge input/output path out of the KERNEL_LOCK(). The diff is simple, use the non-locked version of SRP lists, as it is already done in other paths in carp(4). Ok? Index: netinet/ip_carp.c === RCS f

Always call bridge_iflist `bif'

2018-09-17 Thread Martin Pieuchot
I'd like to always use the same name of `bridge_iflist', it helps me deal with the different data structures and their relation with `ifp'. Diff below use `bif' everywhere, ok? No intentional functional change. Index: net/if_bridge.c ==

Re: umidi(4) alloc_all_endpoints_fixed_ep()

2018-09-06 Thread Martin Pieuchot
On 06/09/18(Thu) 23:01, Michael Mikonos wrote: > Hello, > > In the umidi(4) driver the function alloc_all_endpoints_fixed_ep() > returns USBD_NOMEM if mallocarray() fails, but the return value is > always USBD_INVAL when 'goto error' happens. OK? Note that it'd be better to *not* use `usbd_status

Re: fix "_nfiles" references for crash dump

2018-09-05 Thread Martin Pieuchot
On 04/09/18(Tue) 14:59, Naoki Fukaumi wrote: > hi tech@, > > "_nfiles" was renamed to "_numfiles" by this commit, > https://marc.info/?l=openbsd-cvs&m=147199491615345&w=2 > > then fstat/pstat put following errors, > > # fstat -M bsd.0.core -N bsd.0 > fstat: _nfiles: no such symbol > > # pst

Call a tdb `tdb'

2018-08-30 Thread Martin Pieuchot
Stop naming 'struct tdb *' `sa', we always use `tdb' in the rest of the kernel. No functional change, ok? Index: net/pfkeyv2.c === RCS file: /cvs/src/sys/net/pfkeyv2.c,v retrieving revision 1.190 diff -u -p -r1.190 pfkeyv2.c --- net/

Re: lo(4) automatic ::1 setting and multiple loopbacks

2018-08-22 Thread Martin Pieuchot
On 09/08/18(Thu) 22:14, Stuart Henderson wrote: > While looking into something unrelated I found a strange extra ::1 > address on lo1 (I usually hang my loopback addresses for IBGP off lo1). > > lo1: flags=8049 mtu 32768 > index 12 priority 0 llprio 3 > groups: lo > inet xx

Re: Unlock pipe(2) and pipe2(2)

2018-08-06 Thread Martin Pieuchot
On 02/08/18(Thu) 13:06, Martin Pieuchot wrote: > On 01/08/18(Wed) 01:53, Mark Kettenis wrote: > > > Date: Tue, 31 Jul 2018 14:55:45 -0300 > > > From: Martin Pieuchot > > > > > > On 26/06/18(Tue) 12:31, Martin Pieuchot wrote: > > > > These sys

[PATCH] bs(6): removing extra signal()

2018-08-04 Thread Martin Kopta
The original version from Bruce Holloway in 1986-03-06 [0] did only one signal(SIGINT), but the call was probably duplicated after code cleanup by ESR somewhere between 1986 and 1993. Please, confirm there is no hidden reason to call the same signal() twice. I am unsure. [0] https://groups.google

Re: Unlock pipe(2) and pipe2(2)

2018-08-02 Thread Martin Pieuchot
On 01/08/18(Wed) 01:53, Mark Kettenis wrote: > > Date: Tue, 31 Jul 2018 14:55:45 -0300 > > From: Martin Pieuchot > > > > On 26/06/18(Tue) 12:31, Martin Pieuchot wrote: > > > These syscalls do two operations: they allocate FDs and some buffers. > > > Th

Re: Unlock pipe(2) and pipe2(2)

2018-07-31 Thread Martin Pieuchot
On 26/06/18(Tue) 12:31, Martin Pieuchot wrote: > These syscalls do two operations: they allocate FDs and some buffers. > Thanks to the work done for sockets the file-related bits are now > mp-safe, so we can push the KERNEL_LOCK() down. > > Diff below adds some KERNEL_LOCK/UNLOCK(

pr_attach w/o socket lock

2018-07-30 Thread Martin Pieuchot
When a per-protocol attach function is called the given socket is not yet reachable, so there's no need to lock it. So the diff below remove the solock/sounlock dance and shows where the NET_LOCK() is required to protect some specific global data structures. I reordered the different blocks in al

Re: USB device & port number

2018-07-17 Thread Martin Pieuchot
On 12/07/18(Thu) 12:25, Martin Pieuchot wrote: > Diff below extends 'struct usb_device_info' to include the port number > where the USB device is attached to. It doesn't grow the structure and > reuse implicit padding. > > I'd like to export the port number t

Re: Kill SS_NBIO

2018-07-12 Thread Martin Pieuchot
On 12/07/18(Thu) 17:53, Alexander Bluhm wrote: > On Thu, Jul 12, 2018 at 02:38:48PM +0200, Martin Pieuchot wrote: > > @@ -83,12 +91,6 @@ soo_ioctl(struct file *fp, u_long cmd, c > > switch (cmd) { > > > > case FIONBIO: > > - s = solock(so);

Kill SS_NBIO

2018-07-12 Thread Martin Pieuchot
Sockets and files have one flag each to indicate the I/O mode is non-blocking. This is redundant. Keeping both flags in sync is hard since races can happen between the two different layers. So the diff below gets rid of SS_NBIO. It is fairly simple since sosend(9) and soreceive(9) already take

USB device & port number

2018-07-12 Thread Martin Pieuchot
Diff below extends 'struct usb_device_info' to include the port number where the USB device is attached to. It doesn't grow the structure and reuse implicit padding. I'd like to export the port number to userland to satisfy devel/libusb1, see: https://github.com/libusb/libusb/issues/314 Ok? Ind

usbdevs(8): fewer buttons

2018-07-11 Thread Martin Pieuchot
Instead of having a button for printing the driver(s) attached to a USB device, do it when invoked with '-v'. This allows me to recycle '-d'. I'm now using it, like pcidump(8) does, to specify a specific device node. My plan is then to use '-f' to force a device to attach as ugen(4). In that ca

Re: Time to retire RTM_LOSING

2018-07-11 Thread Martin Pieuchot
On 11/07/18(Wed) 09:55, Claudio Jeker wrote: > On busy servers I seen multiple RTM_LOSING message per second being > generated. This is not helpful (especially since nothing is doing > something with it). This diff removes the part where RTM_LOSING is > generated I'm fine with that. However what

<    5   6   7   8   9   10   11   12   13   14   >