Re: nfsd: don't clear SB_NOINTR flag

2023-10-22 Thread Vitaliy Makkoveev
On Fri, Oct 20, 2023 at 10:51:46PM +0200, Alexander Bluhm wrote: > On Mon, Oct 16, 2023 at 10:17:50PM +0300, Vitaliy Makkoveev wrote: > > This socket comes from userland, so this flag is never set. This makes > > SB_NOINTR flag immutable, because we only set this bit on NFS cl

Re: nfsd: don't clear SB_NOINTR flag

2023-10-17 Thread Vitaliy Makkoveev
On Mon, Oct 16, 2023 at 10:17:50PM +0300, Vitaliy Makkoveev wrote: > This socket comes from userland, so this flag is never set. This makes > SB_NOINTR flag immutable, because we only set this bit on NFS client > socket buffers for all it's lifetime. > > I want to do this be

Re: Please test: make ipsec(4) timeouts mpsafe

2023-10-16 Thread Vitaliy Makkoveev
> On 13 Oct 2023, at 18:40, Hrvoje Popovski wrote: > > On 12.10.2023. 20:10, Vitaliy Makkoveev wrote: >> Hi, MP safe process timeouts were landed to the tree, so time to test >> them with network stack :) Diff below makes tdb and ids garbage >> collector timeout hand

nfsd: don't clear SB_NOINTR flag

2023-10-16 Thread Vitaliy Makkoveev
This socket comes from userland, so this flag is never set. This makes SB_NOINTR flag immutable, because we only set this bit on NFS client socket buffers for all it's lifetime. I want to do this because this flag modifies sblock() behaviour and it's not clean which lock should protect it for

Please test: make ipsec(4) timeouts mpsafe

2023-10-12 Thread Vitaliy Makkoveev
Hi, MP safe process timeouts were landed to the tree, so time to test them with network stack :) Diff below makes tdb and ids garbage collector timeout handlers running without kernel lock. Not for commit, just share this for tests if someone interesting. Index: sys/netinet/ip_ipsp.c

Re: tcp syn cache unlock

2023-10-12 Thread Vitaliy Makkoveev
On Wed, Oct 11, 2023 at 09:08:33PM -0500, Scott Cheloha wrote: > On Tue, Oct 10, 2023 at 05:26:14PM +0300, Vitaliy Makkoveev wrote: > > On Tue, Oct 10, 2023 at 09:06:23AM -0500, Scott Cheloha wrote: > > > On Fri, Oct 06, 2023 at 03:41:39PM +0200, Alexander Bluhm wrote: > >

Re: tcp syn cache unlock

2023-10-10 Thread Vitaliy Makkoveev
On Tue, Oct 10, 2023 at 09:06:23AM -0500, Scott Cheloha wrote: > On Fri, Oct 06, 2023 at 03:41:39PM +0200, Alexander Bluhm wrote: > > On Fri, Oct 06, 2023 at 03:47:31PM +0300, Vitaliy Makkoveev wrote: > > > On Fri, Oct 06, 2023 at 02:14:52PM +0200, Alexander Bluhm wrote: &g

Please test: make drm*_filtops mpsafe

2023-10-07 Thread Vitaliy Makkoveev
`drmread_filtops' conversion is easy, because `event_lock' mutex(9) is already to protect events list, so use to protect `drmread_filtops' too. `drm_filtops' is little bit difficult. It only requires to protect knote(9) data, but it's not clean to me which existing lock to use. I introduces new

Re: tcp syn cache unlock

2023-10-06 Thread Vitaliy Makkoveev
On Fri, Oct 06, 2023 at 02:14:52PM +0200, Alexander Bluhm wrote: > On Fri, Oct 06, 2023 at 02:12:31PM +0300, Vitaliy Makkoveev wrote: > > I reworked your diff for a little. At firts I use separate > > softclock_thread_mpsafe() for mpsafe timers. I don't think we need to >

Re: ifq_start_task(): purge queue before exit when IFF_RUNNING flag is not set

2023-10-06 Thread Vitaliy Makkoveev
On Fri, Oct 06, 2023 at 02:50:21PM +0200, Alexander Bluhm wrote: > On Fri, Oct 06, 2023 at 12:45:54PM +0300, Vitaliy Makkoveev wrote: > > On Thu, Oct 05, 2023 at 10:42:25PM +1000, David Gwynne wrote: > > > > On 5 Oct 2023, at 21:50, Vitaliy Makkoveev wrote: > >

Re: tcp syn cache unlock

2023-10-06 Thread Vitaliy Makkoveev
On Fri, Oct 06, 2023 at 02:14:52PM +0200, Alexander Bluhm wrote: > > @@ -718,11 +743,13 @@ softclock(void *arg) > > softclock_process_tick_timeout(to, new); > > } > > tostat.tos_softclocks++; > > - needsproc = !CIRCQ_EMPTY(_proc); > > - mtx_leave(_mutex); > > - > >

Re: tcp syn cache unlock

2023-10-06 Thread Vitaliy Makkoveev
On Thu, Oct 05, 2023 at 10:07:24PM +0300, Vitaliy Makkoveev wrote: > On Thu, Oct 05, 2023 at 11:09:52AM -0500, Scott Cheloha wrote: > > On Thu, Oct 05, 2023 at 12:57:24AM +0200, Alexander Bluhm wrote: > > > > > > This is a first step to unlock TCP syn

Re: ifq_start_task(): purge queue before exit when IFF_RUNNING flag is not set

2023-10-06 Thread Vitaliy Makkoveev
n 5 Oct 2023, at 21:50, Vitaliy Makkoveev wrote: > > > > Otherwise `if_snd' could still contain packets. If any of them has > > associated data with bumped reference counter, the corresponding > > refcnt_finalize() will sleep forever. I don't think we need to > > tr

Re: fuse(4): make `fuse_rd_filtops' mpsafe

2023-10-05 Thread Vitaliy Makkoveev
ping > On 27 Sep 2023, at 16:07, Vitaliy Makkoveev wrote: > > Introduce `fd_mtx' mutex(9) and use it for `fd_fbufs_in' fuse buffers > queue and `fd_rklist' knotes list protection. > > Index: sys/miscfs/

Re: video(4): make `video_filtops' mpsafe

2023-10-05 Thread Vitaliy Makkoveev
ping > On 27 Sep 2023, at 23:19, Vitaliy Makkoveev wrote: > > Introduce `sc_mtx` mutex(9) and use it for `sc_frames_ready' and > `sc_rklist' knotes list protection. > > Index: sys/dev/video.c > === > RC

Re: vscsi(4): make `vscsi_filtops' mpsafe

2023-10-05 Thread Vitaliy Makkoveev
ping > On 28 Sep 2023, at 14:28, Vitaliy Makkoveev wrote: > > On Thu, Sep 28, 2023 at 01:16:17PM +0200, Claudio Jeker wrote: >> On Thu, Sep 28, 2023 at 01:58:45PM +0300, Vitaliy Makkoveev wrote: >>> filt_vscsiread() checks `sc_ccb_i2t' protected by `sc_state_m

Re: tcp syn cache unlock

2023-10-05 Thread Vitaliy Makkoveev
On Thu, Oct 05, 2023 at 11:09:52AM -0500, Scott Cheloha wrote: > On Thu, Oct 05, 2023 at 12:57:24AM +0200, Alexander Bluhm wrote: > > > > This is a first step to unlock TCP syn cache. The timer function > > is independent of the socket code. That makes it easy to start > > there. > > > > [...]

ifq_start_task(): purge queue before exit when IFF_RUNNING flag is not set

2023-10-05 Thread Vitaliy Makkoveev
Otherwise `if_snd' could still contain packets. If any of them has associated data with bumped reference counter, the corresponding refcnt_finalize() will sleep forever. I don't think we need to transmit these packets when interface became running again. I don't like this unlocked if_flags check

Re: wg destroy hangs

2023-10-04 Thread Vitaliy Makkoveev
On Thu, Oct 05, 2023 at 12:08:55AM +0200, Kirill Miazine wrote: > • Vitaliy Makkoveev [2023-10-05 00:02]: > > > On 5 Oct 2023, at 00:56, Kirill Miazine wrote: > > > > > > new diff doesn't prevent hang in test scenario either. > > > > > > >

Re: wg destroy hangs

2023-10-04 Thread Vitaliy Makkoveev
> On 5 Oct 2023, at 00:56, Kirill Miazine wrote: > > new diff doesn't prevent hang in test scenario either. > Which one?

Re: wg destroy hangs

2023-10-04 Thread Vitaliy Makkoveev
> On 5 Oct 2023, at 00:31, Alexander Bluhm wrote: > > On Wed, Oct 04, 2023 at 11:03:27PM +0300, Vitaliy Makkoveev wrote: >> On Wed, Oct 04, 2023 at 09:13:59PM +0200, Alexander Bluhm wrote: >>> On Wed, Oct 04, 2023 at 08:42:48PM +0200, Kirill Miazine wrote: >>>

Re: wg destroy hangs

2023-10-04 Thread Vitaliy Makkoveev
On Wed, Oct 04, 2023 at 11:07:24PM +0200, Kirill Miazine wrote: > > > • Vitaliy Makkoveev [2023-10-04 22:03]: > > On Wed, Oct 04, 2023 at 09:13:59PM +0200, Alexander Bluhm wrote: > > > On Wed, Oct 04, 2023 at 08:42:48PM +0200, Kirill Miazine wrote: > > > >

Re: wg destroy hangs

2023-10-04 Thread Vitaliy Makkoveev
On Wed, Oct 04, 2023 at 09:13:59PM +0200, Alexander Bluhm wrote: > On Wed, Oct 04, 2023 at 08:42:48PM +0200, Kirill Miazine wrote: > > > If it happns again, could you send an 'ps axlww | grep ifconifg' > > > output? Then we see the wait channel where it hangs in the kernel. > > > > > > $ ps

Re: vscsi(4): make `vscsi_filtops' mpsafe

2023-09-28 Thread Vitaliy Makkoveev
On Thu, Sep 28, 2023 at 01:16:17PM +0200, Claudio Jeker wrote: > On Thu, Sep 28, 2023 at 01:58:45PM +0300, Vitaliy Makkoveev wrote: > > filt_vscsiread() checks `sc_ccb_i2t' protected by `sc_state_mtx' > > mutex(9), so use it to protect `sc_klist' knotes list too. > > >

vscsi(4): make `vscsi_filtops' mpsafe

2023-09-28 Thread Vitaliy Makkoveev
filt_vscsiread() checks `sc_ccb_i2t' protected by `sc_state_mtx' mutex(9), so use it to protect `sc_klist' knotes list too. Tested with iscsid(8). Index: sys/dev/vscsi.c === RCS file: /cvs/src/sys/dev/vscsi.c,v retrieving revision

video(4): make `video_filtops' mpsafe

2023-09-27 Thread Vitaliy Makkoveev
Introduce `sc_mtx` mutex(9) and use it for `sc_frames_ready' and `sc_rklist' knotes list protection. Index: sys/dev/video.c === RCS file: /cvs/src/sys/dev/video.c,v retrieving revision 1.57 diff -u -p -r1.57 video.c ---

fuse(4): make `fuse_rd_filtops' mpsafe

2023-09-27 Thread Vitaliy Makkoveev
Introduce `fd_mtx' mutex(9) and use it for `fd_fbufs_in' fuse buffers queue and `fd_rklist' knotes list protection. Index: sys/miscfs/fuse/fuse_device.c === RCS file: /cvs/src/sys/miscfs/fuse/fuse_device.c,v retrieving revision 1.39

Re: Please test; midi(4): make midi{read,write}_filtops mp safe

2023-09-26 Thread Vitaliy Makkoveev
On Tue, Sep 26, 2023 at 10:37:29AM +0200, Alexandre Ratchov wrote: > On Sun, Sep 24, 2023 at 11:03:54PM +0300, Vitaliy Makkoveev wrote: > > Please test this diff, I have no midi(4) devices. > > > > midi(4) already uses `audio_lock' mutex(9) for filterops, but they are &g

Re: Please test; midi(4): make midi{read,write}_filtops mp safe

2023-09-25 Thread Vitaliy Makkoveev
On Mon, Sep 25, 2023 at 05:39:34AM +, Visa Hankala wrote: > On Sun, Sep 24, 2023 at 11:03:54PM +0300, Vitaliy Makkoveev wrote: > > Please test this diff, I have no midi(4) devices. > > > > midi(4) already uses `audio_lock' mutex(9) for filterops, but they are > > st

Please test; midi(4): make midi{read,write}_filtops mp safe

2023-09-24 Thread Vitaliy Makkoveev
Please test this diff, I have no midi(4) devices. midi(4) already uses `audio_lock' mutex(9) for filterops, but they are still kernel locked. Wipe out old selwakeup API and make them MP safe. knote_locked(9) will not grab kernel lock, so call it directly from interrupt handlers instead of

vmt(4): use shared netlock to protect ifnet data within vmt_tclo_broadcastip()

2023-09-23 Thread Vitaliy Makkoveev
This makes ifnet protection consistent. Execute vmt_tclo_tick() timeout handler in process context to allow context switch within vmt_tclo_broadcastip(). Index: sys/dev/pv/vmt.c === RCS file: /cvs/src/sys/dev/pv/vmt.c,v retrieving

hotplug(4): simplify buffer cleanup on device close

2023-09-23 Thread Vitaliy Makkoveev
`evqueue' is simple circular buffer. Its pretty enough to set head equal to tail to make it empty. Index: sys/dev/hotplug.c === RCS file: /cvs/src/sys/dev/hotplug.c,v retrieving revision 1.24 diff -u -p -r1.24 hotplug.c ---

Re: fix a wireguard mbuf leak

2023-09-22 Thread Vitaliy Makkoveev
On Fri, Sep 22, 2023 at 12:21:42PM +0900, YASUOKA Masahiko wrote: > A leak may happens when wgpeer is deleted. > > ok? > ok mvs@ > The state queue should be freeed when wg_peer is destroyed. > diff from IIJ. > > Index: sys/net/if_wg.c >

Re: hotplug(4): introduce `hotplug_mtx' mutex(9) and make `hotplugread_filterops' mp safe

2023-09-18 Thread Vitaliy Makkoveev
On Mon, Sep 18, 2023 at 02:03:08PM +0300, Vitaliy Makkoveev wrote: > Also use this mutex to protect `evqueue_head', `evqueue_tail' and > `evqueue_count'. > Sorry, the right diff: Index: sys/dev/hotplug.c === RCS file: /cv

hotplug(4): introduce `hotplug_mtx' mutex(9) and make `hotplugread_filterops' mp safe

2023-09-18 Thread Vitaliy Makkoveev
Also use this mutex to protect `evqueue_head', `evqueue_tail' and `evqueue_count'. Index: sys/dev/hotplug.c === RCS file: /cvs/src/sys/dev/hotplug.c,v retrieving revision 1.23 diff -u -p -r1.23 hotplug.c --- sys/dev/hotplug.c 8 Sep

hyperv(4): use shared netlock to protect if_list and ifa_list walkthrough and data

2023-09-18 Thread Vitaliy Makkoveev
Context switch looks fine here. Index: sys/dev/pv/hypervic.c === RCS file: /cvs/src/sys/dev/pv/hypervic.c,v retrieving revision 1.19 diff -u -p -r1.19 hypervic.c --- sys/dev/pv/hypervic.c 11 Apr 2023 00:45:08 - 1.19

Re: Use counters_read(9) from ddb(4)

2023-09-15 Thread Vitaliy Makkoveev
On Fri, Sep 15, 2023 at 04:18:13PM +0200, Martin Pieuchot wrote: > On 11/09/23(Mon) 21:05, Martin Pieuchot wrote: > > On 06/09/23(Wed) 23:13, Alexander Bluhm wrote: > > > On Wed, Sep 06, 2023 at 12:23:33PM -0500, Scott Cheloha wrote: > > > > On Wed, Sep 06, 2023 at 01:04:19PM +0100, Martin

Make `logread_filtops' mpsafe

2023-09-14 Thread Vitaliy Makkoveev
`log_mtx' mutex(9) already used for message buffer protection, so use it to protect `logread_filtops' too. ok? Index: sys/kern/subr_log.c === RCS file: /cvs/src/sys/kern/subr_log.c,v retrieving revision 1.77 diff -u -p -r1.77

fuse(4) device: replace selinfo with klist

2023-09-10 Thread Vitaliy Makkoveev
Replace selinfo remnants with knote(9) API. Mechanical conversion because `fuse_rd_filtops' left non MP safe. knote_locked(9) used because the path covered by kernel lock. We have some places where selinfo is still used. All of them could be mechanically converted in this way and obsolete

Re: Replace selinfo by klist in vnode structure

2023-09-08 Thread Vitaliy Makkoveev
On Fri, Sep 08, 2023 at 07:39:10PM +0200, Alexander Bluhm wrote: > On Thu, Sep 07, 2023 at 10:32:58PM +0300, Vitaliy Makkoveev wrote: > > Remove the remnants of the leftover selinfo from vnode(9) layer. Just > > mechanical replacement because knote(9) API is already used. I don'

Replace selinfo by klist in vnode structure

2023-09-07 Thread Vitaliy Makkoveev
Remove the remnants of the leftover selinfo from vnode(9) layer. Just mechanical replacement because knote(9) API is already used. I don't want make klist MP safe with this diff. headers added where is was required. Disabled tmpsfs was also tested. ok? Index: sys/dev/hotplug.c

Re: tcp sync cache signed use counter

2023-09-04 Thread Vitaliy Makkoveev
> On 4 Sep 2023, at 23:43, Christian Weisgerber wrote: > > Alexander Bluhm: > >> Variable scs_use is basically counting packet insertions to syn >> cache, so I would prefer type long to exclude overflow on fast >> machines. With the current limits int should be enough, but long >> does not

Re: tcp sync cache signed use counter

2023-09-04 Thread Vitaliy Makkoveev
> On 4 Sep 2023, at 19:52, Alexander Bluhm wrote: > > On Mon, Sep 04, 2023 at 07:22:03PM +0300, Vitaliy Makkoveev wrote: >>> On 4 Sep 2023, at 16:19, Alexander Bluhm wrote: >>> >>> Hi, >>> >>> Variable scs_use is basically counting pack

Re: tcp sync cache signed use counter

2023-09-04 Thread Vitaliy Makkoveev
> On 4 Sep 2023, at 16:19, Alexander Bluhm wrote: > > Hi, > > Variable scs_use is basically counting packet insertions to syn > cache, so I would prefer type long to exclude overflow on fast > machines. With the current limits int should be enough, but long > does not hurt. > > It can be

Re: tcp sync cache refcount improvement

2023-09-03 Thread Vitaliy Makkoveev
> On 3 Sep 2023, at 21:08, Alexander Bluhm wrote: > > Hi, > > Avoid a useless increment and decrement of of the tcp syn cache > refcount by unexpanding the SYN_CACHE_TIMER_ARM() macro in the timer > callback. > > ok? > ok mvs > bluhm > > Index: netinet/tcp_input.c >

Re: sosetopt(): merge SO_SND* with corresponding SO_RCV* cases

2023-08-08 Thread Vitaliy Makkoveev
On Tue, Aug 08, 2023 at 10:40:46PM +0200, Alexander Bluhm wrote: > On Fri, Aug 04, 2023 at 12:38:23AM +0300, Vitaliy Makkoveev wrote: > > @@ -1856,6 +1856,9 @@ sosetopt(struct socket *so, int level, i > > case SO_SNDLOWAT: > >

sosetopt(): merge SO_SND* with corresponding SO_RCV* cases

2023-08-03 Thread Vitaliy Makkoveev
The only difference is the socket buffer. As bonus, in the future solock() will be easily replaced by sblock() instead pushing it down to each SO_SND* and SO_RCV* case. Index: sys/kern/uipc_socket.c === RCS file:

Re: uvm_meter remove wakeup of swapper

2023-08-01 Thread Vitaliy Makkoveev
On Tue, Aug 01, 2023 at 11:24:01AM +0200, Claudio Jeker wrote: > Now that the issue in inteldrm was resolved we can finally remove this > old wakeup of the swapper. > > OK? ok mvs > -- > :wq Claudio > > Index: uvm_meter.c > === >

Re: uvm_meter: remove wakeup of proc0

2023-07-31 Thread Vitaliy Makkoveev
On Mon, Jul 31, 2023 at 10:04:44PM +0200, Claudio Jeker wrote: > On Mon, Jul 31, 2023 at 09:49:30PM +0200, Claudio Jeker wrote: > > On Mon, Jul 31, 2023 at 08:03:41PM +0300, Vitaliy Makkoveev wrote: > > > This is the culprit: > > > > > > schedule_

Re: uvm_meter: remove wakeup of proc0

2023-07-31 Thread Vitaliy Makkoveev
On Mon, Jul 31, 2023 at 09:49:30PM +0200, Claudio Jeker wrote: > On Mon, Jul 31, 2023 at 08:03:41PM +0300, Vitaliy Makkoveev wrote: > > This is the culprit: > > > > schedule_timeout_uninterruptible(long timeout) > > { > > tsleep(curproc, PWAIT, "s

Re: uvm_meter: remove wakeup of proc0

2023-07-31 Thread Vitaliy Makkoveev
This is the culprit: schedule_timeout_uninterruptible(long timeout) { tsleep(curproc, PWAIT, "schtou", timeout); return 0; }

Re: uvm_meter: remove wakeup of proc0

2023-07-29 Thread Vitaliy Makkoveev
On Sat, Jul 29, 2023 at 11:16:14AM +0200, Claudio Jeker wrote: > proc0 aka the swapper does not do anything. So there is no need to wake it > up. Now the problem is that last time this was tried some inteldrm systems > did hang during bootup because the drm code unexpectedly depended on this >

Re: Move solock() down to sosetopt()

2023-07-22 Thread Vitaliy Makkoveev
On Fri, Jul 21, 2023 at 07:38:17PM +0200, Alexander Bluhm wrote: > On Thu, Jul 13, 2023 at 02:22:17AM +0300, Vitaliy Makkoveev wrote: > > This is a part of my standalone sblock() work. I need this movement > > because buffers related SO_SND* and SO_RCV* socket options modifica

Re: inetd echo localhost

2023-07-21 Thread Vitaliy Makkoveev
On Thu, Jul 20, 2023 at 09:57:00PM +0200, Alexander Bluhm wrote: > Hi, > > I wonder why UDP echo does not work with inetd on 127.0.0.1. > > Note that it is default off. One of my regress machines has it > enabled for other tests. There perl dist/Net-Ping/t/510_ping_udp.t > expects that UDP

sobuf_print(): add `sb_state' output

2023-07-21 Thread Vitaliy Makkoveev
It contains SS_CANTSENDMORE, SS_ISSENDING, SS_CANTRCVMORE and SS_RCVATMARK bits. Also do `sb_flags' output as hex, it contains flags too. Index: sys/kern/uipc_socket.c === RCS file: /cvs/src/sys/kern/uipc_socket.c,v retrieving

Move solock() down to sosetopt()

2023-07-12 Thread Vitaliy Makkoveev
This is a part of my standalone sblock() work. I need this movement because buffers related SO_SND* and SO_RCV* socket options modification should be protected with sblock(). However, standalone sblock() has different lock orders with solock() for receive and send buffers. At least sblock() for

Replace selwakeup() with knote(9) in wscons(4) and make filterops mpsafe

2023-07-11 Thread Vitaliy Makkoveev
Use per 'wseventvar' structure `mtx' mutex(9) to protect `put' and `get' circular buffer indexes together with klist data. Not a big deal, but Xorg will not kernel lock while polling keyboard and mouse events. Also removed obsolete selinfo. Feedback, objections, oks? Not related to this diff,

Re: route leak nd6 detach

2023-07-09 Thread Vitaliy Makkoveev
> On 9 Jul 2023, at 15:15, Alexander Bluhm wrote: > > Hi, > > While testing my ART reference couting fix, I discovered a rtentry > leak that is triggered by regress/sbin/route and detected with > btrace(8) refcnt. > > The reference returned by rtalloc() must be freed with rtfree() in > all

Re: Use u_long for struct mstat

2023-07-07 Thread Vitaliy Makkoveev
On Fri, Jul 07, 2023 at 12:31:02PM +0300, YASUOKA Masahiko wrote: > Hi, > > I'd like to expand the counters in struct mbstat from u_short to u_long. > > When I was debugging a mbuf leak, I saw the result of "netstat -m" > --- > 28647 mbufs in use: > 28551 mbufs allocated to data >

Re: tso lo keep mss

2023-07-07 Thread Vitaliy Makkoveev
On Fri, Jul 07, 2023 at 11:48:13AM +0300, Alexander Bluhm wrote: > Hi, > > When we preserve M_TCP_TSO we also must keep ph_mss. In lo(4) > LRO/TSO this logic was missing. As this may be relevant only for > weird pf configs that forward from loopback and ifconfig tcplro is > disabled by default,

Re: sec(4): route based ipsec vpns

2023-07-04 Thread Vitaliy Makkoveev
On Tue, Jul 04, 2023 at 03:26:30PM +1000, David Gwynne wrote: > tl;dr: this adds sec(4) p2p ip interfaces. Traffic in and out of these > interfaces is protected by IPsec security associations (SAs), but > there's no flows (security policy database (SPD) entries) associated > with these SAs. The

Re: Introduce M_IFGROUP type of memory allocation

2023-06-27 Thread Vitaliy Makkoveev
On Tue, Jun 27, 2023 at 11:09:32AM +, Klemens Nanni wrote: > On Tue, Jun 27, 2023 at 01:32:37PM +0300, Vitaliy Makkoveev wrote: > > M_TEMP seems unreasonable for interface groups data allocations. > > After claudio pointed out the wrong type, I thought of the same name, >

Introduce M_IFGROUP type of memory allocation

2023-06-27 Thread Vitaliy Makkoveev
M_TEMP seems unreasonable for interface groups data allocations. Don't forget to recompile systat(1) and vmstat(8) with new sys/malloc.h. Index: sys/net/if.c === RCS file: /cvs/src/sys/net/if.c,v retrieving revision 1.700 diff -u -p

Re: inpcb sip hash mutex contention

2023-06-24 Thread Vitaliy Makkoveev
> On 22 Jun 2023, at 22:50, Alexander Bluhm wrote: > > Hi, > > I am working on a diff to run UDP input in parallel. Btrace kstack > analysis shows that SIP hash for PCB lookup is quite expensive. > When running in parallel we get lock contention on the PCB table > mutex. > > So it results in

Re: ifconfig rename tcplro

2023-06-07 Thread Vitaliy Makkoveev
On Wed, Jun 07, 2023 at 01:29:09PM +0200, Alexander Bluhm wrote: > On Wed, Jun 07, 2023 at 12:59:11PM +0300, Vitaliy Makkoveev wrote: > > On Wed, Jun 07, 2023 at 10:19:32AM +1000, David Gwynne wrote: > > > > > > > > > > On 7 Jun 2023, at 06:33, Vitaliy M

Kill if_detached_ioctl()

2023-06-07 Thread Vitaliy Makkoveev
In this point the interface is already removed from the list of all interfaces and from the interface index map and all possible concurrent ioctl() threads finished. Remove this dead code. Index: sys/net/if.c === RCS file:

if_detach(): move nd6_ifdetach() out of netlock

2023-06-07 Thread Vitaliy Makkoveev
In this point, the interface is disconnected from everywhere. No need to hold netlock for dummy 'nd_ifinfo' release. Netlock is also not needed for TAILQ_EMPTY(>if_*hooks) assertions. Index: sys/net/if.c === RCS file:

Re: ifconfig rename tcplro

2023-06-07 Thread Vitaliy Makkoveev
On Wed, Jun 07, 2023 at 10:19:32AM +1000, David Gwynne wrote: > > > > On 7 Jun 2023, at 06:33, Vitaliy Makkoveev wrote: > > > >> On 6 Jun 2023, at 20:29, Alexander Bluhm wrote: > >> > >> On Tue, Jun 06, 2023 at 05:54:31PM +0300, Vitaliy Makkove

Re: ifconfig rename tcplro

2023-06-06 Thread Vitaliy Makkoveev
> On 6 Jun 2023, at 20:29, Alexander Bluhm wrote: > > On Tue, Jun 06, 2023 at 05:54:31PM +0300, Vitaliy Makkoveev wrote: >> On Tue, Jun 06, 2023 at 02:31:52PM +0200, Alexander Bluhm wrote: >>> Hi, >>> >>> I would suggest to rename ifconfig tcprecvofflo

Re: ifconfig rename tcplro

2023-06-06 Thread Vitaliy Makkoveev
> On 6 Jun 2023, at 19:37, Chris Cappuccio wrote: > > Jan Klemkow [j.klem...@wemelug.de] wrote: >> On Tue, Jun 06, 2023 at 05:54:31PM +0300, Vitaliy Makkoveev wrote: >>> On Tue, Jun 06, 2023 at 02:31:52PM +0200, Alexander Bluhm wrote: >>>> I would sugge

Re: ifconfig rename tcplro

2023-06-06 Thread Vitaliy Makkoveev
On Tue, Jun 06, 2023 at 02:31:52PM +0200, Alexander Bluhm wrote: > Hi, > > I would suggest to rename ifconfig tcprecvoffload to tcplro. Maybe > it's just because I had to type that long name too often. > > With that we have consistent naming: > # ifconfig ix0 tcplro > # sysctl

Re: Relax netlock to shared netlock and push it down to mrt_sysctl_mfc()

2023-05-26 Thread Vitaliy Makkoveev
On Fri, May 26, 2023 at 05:08:06PM +0200, Alexander Bluhm wrote: > On Fri, May 26, 2023 at 05:29:58PM +0300, Vitaliy Makkoveev wrote: > > On Wed, May 17, 2023 at 01:02:58PM +0300, Vitaliy Makkoveev wrote: > > > mrt_rtwalk_mfcsysctl() performs read-only access to

Re: Relax netlock to shared netlock and push it down to mrt_sysctl_vif()

2023-05-26 Thread Vitaliy Makkoveev
On Wed, May 17, 2023 at 01:08:52PM +0300, Vitaliy Makkoveev wrote: > Also read-only access to netlock protected data. > Regardless on sysctl(2) unlocking backout, the netlock around mrt_sysctl_vif() could be relaxed to shared netlock. > Index: sys/netinet/i

Re: Relax netlock to shared netlock and push it down to mrt_sysctl_mfc()

2023-05-26 Thread Vitaliy Makkoveev
On Wed, May 17, 2023 at 01:02:58PM +0300, Vitaliy Makkoveev wrote: > mrt_rtwalk_mfcsysctl() performs read-only access to protected data, so > rtable_walk() could be called with shared netlock. > Regardless on sysctl(2) unlocking backout, the netlock around mrt_sysctl_mfc() could b

Re: pfioctl: drop net lock from DIOCGETIFACES, DIOC{SET,CLR}IFFLAG

2023-05-26 Thread Vitaliy Makkoveev
On Fri, May 26, 2023 at 01:03:13PM +, Klemens Nanni wrote: > snmpd(8) and 'pfctl -s Interfaces' dump pf's internal list of interfaces. > > pf.conf's 'set skip on ifN' and 'pfctl -F all|Reset' set and clear flags, > PFI_IFLAG_SKIP being the only flag. > > (There's no other usage of these

Re: Unlock ip6_sysctl()

2023-05-17 Thread Vitaliy Makkoveev
> On 18 May 2023, at 01:14, Alexander Bluhm wrote: > > On Wed, May 17, 2023 at 12:46:02PM +0300, Vitaliy Makkoveev wrote: >> Introduce `ip6_soiikey_lock' rwlock(9) to protect `ip6_soiikey'. It >> accessed only by ip6_sysctl_soiikey() and ip6_sysctl() is the only >> ip6

Relax netlock to shared netlock and push it down to mrt_sysctl_vif()

2023-05-17 Thread Vitaliy Makkoveev
Also read-only access to netlock protected data. Index: sys/netinet/ip_input.c === RCS file: /cvs/src/sys/netinet/ip_input.c,v retrieving revision 1.384 diff -u -p -r1.384 ip_input.c --- sys/netinet/ip_input.c 16 May 2023

Relax netlock to shared netlock and push it down to mrt_sysctl_mfc()

2023-05-17 Thread Vitaliy Makkoveev
mrt_rtwalk_mfcsysctl() performs read-only access to protected data, so rtable_walk() could be called with shared netlock. Index: sys/netinet/ip_input.c === RCS file: /cvs/src/sys/netinet/ip_input.c,v retrieving revision 1.384 diff -u

Unlock ip6_sysctl()

2023-05-17 Thread Vitaliy Makkoveev
Introduce `ip6_soiikey_lock' rwlock(9) to protect `ip6_soiikey'. It accessed only by ip6_sysctl_soiikey() and ip6_sysctl() is the only ip6_sysctl_soiikey() caller so context switch is allowed here. Also remove unused `oldkey' from ip6_sysctl_soiikey(). For IPV6CTL_MRTSTATS, IPV6CTL_MRTMIF and

Re: Unlock ip_sysctl()

2023-05-16 Thread Vitaliy Makkoveev
On Tue, May 16, 2023 at 08:26:37PM +0300, Vitaliy Makkoveev wrote: > > On 16 May 2023, at 18:35, Alexander Bluhm wrote: > > > > I saw one issue in sysctl_niq(). Another CPU could write mq_maxlen > > and our logic is inconsistent. Below is a fix with read once. Each

Re: Unlock ip_sysctl()

2023-05-16 Thread Vitaliy Makkoveev
> On 16 May 2023, at 18:35, Alexander Bluhm wrote: > > I saw one issue in sysctl_niq(). Another CPU could write mq_maxlen > and our logic is inconsistent. Below is a fix with read once. Each > CPU detects its own change, last write wins. Or should we protect > everything with mq_mtx? Then

Re: fill_file(): use solock_shared() to protect socket data

2023-05-16 Thread Vitaliy Makkoveev
On Thu, Apr 27, 2023 at 02:54:38PM +0200, Claudio Jeker wrote: > On Thu, Apr 27, 2023 at 01:55:33PM +0300, Vitaliy Makkoveev wrote: > > Now only direct netlock used for inet sockets protection. The unlocked > > access to all other sockets is safe, but we could lost consistency f

Unlock ip_sysctl()

2023-05-16 Thread Vitaliy Makkoveev
Let's start to unlock (*pr_sysctl)() handlers. We have many of them, so introduce temporary PR_MPSAFE flag to mark MP safe instead of pushing kernel lock within handlers. Unlock ip_sysctl(). Still take kernel lock within IPCTL_MRTSTATS case. It looks like `mrtstat' protection is inconsistent, so

Re: nd6 remove kernel lock

2023-05-12 Thread Vitaliy Makkoveev
> On 12 May 2023, at 15:07, Alexander Bluhm wrote: > > On Fri, May 12, 2023 at 11:43:42AM +, Klemens Nanni wrote: >>> Access rt_llinfo and check for NULL without checking RTF_LLINFO >>> flag before. They are changed togehter with the arp or nd6 mutex. >> >> It is the same change, but I'd

Re: give softnet threads their own names

2023-05-12 Thread Vitaliy Makkoveev
> On 12 May 2023, at 03:34, David Gwynne wrote: > > so in top you see softnet0, softnet1, etc. > > the real change is putting a struct softnet in place to wrap the name > and taskq up with. > > ok? Makes sense. ok mvs > > Index: if.c >

Re: Push kernel lock deep down to sys_sysctl()

2023-05-03 Thread Vitaliy Makkoveev
Ping. > On 21 Apr 2023, at 17:17, Vitaliy Makkoveev wrote: > > At least network subset of sysctl(8) MIBs relies on netlock or another > locks and doesn't require kernel lock. Also some integers in other > subsets can be read without kernel lock held. > > Diff below actual

Re: Initialize `rtentry_pool' with IPL_SOFTNET IPL

2023-04-28 Thread Vitaliy Makkoveev
> On 28 Apr 2023, at 15:38, Alexander Bluhm wrote: > > On Fri, Apr 28, 2023 at 02:51:23PM +0300, Vitaliy Makkoveev wrote: >>> On 28 Apr 2023, at 14:03, Alexander Bluhm wrote: >>> >>> That basically means we must never call one of the pool get or put >&

Re: Remove kernel lock from rtfree(9)

2023-04-28 Thread Vitaliy Makkoveev
> On 28 Apr 2023, at 15:57, Vitaliy Makkoveev wrote: > > On Fri, Apr 28, 2023 at 02:13:15PM +0200, Alexander Bluhm wrote: >> After running stress test successfully with this diff, next day >> machine crashed while compiling a new kernel. It is unclear whether >>

Re: Remove kernel lock from rtfree(9)

2023-04-28 Thread Vitaliy Makkoveev
On Fri, Apr 28, 2023 at 02:13:15PM +0200, Alexander Bluhm wrote: > After running stress test successfully with this diff, next day > machine crashed while compiling a new kernel. It is unclear whether > it is related to the diff. The softdep in ps is problably processing > make output via ssh.

Re: Initialize `rtentry_pool' with IPL_SOFTNET IPL

2023-04-28 Thread Vitaliy Makkoveev
n this cpu could happen on any other. IPL_MPFLOOR has very high level and I guess it was chosen mostly for insurance. We do rt allocation and release in the sockets, ioctl and softnet context, so I see no reason to disable interrupts with priority greater than IPL_SOFTNET. > > On Thu, Apr 27, 2

Re: fill_file(): use solock_shared() to protect socket data

2023-04-27 Thread Vitaliy Makkoveev
On Thu, Apr 27, 2023 at 02:54:38PM +0200, Claudio Jeker wrote: > On Thu, Apr 27, 2023 at 01:55:33PM +0300, Vitaliy Makkoveev wrote: > > Now only direct netlock used for inet sockets protection. The unlocked > > access to all other sockets is safe, but we could lost consistency f

Re: Remove kernel lock from rtfree(9)

2023-04-27 Thread Vitaliy Makkoveev
> On 27 Apr 2023, at 15:40, Alexander Bluhm wrote: > > On Thu, Apr 27, 2023 at 03:22:10PM +0300, Vitaliy Makkoveev wrote: >>> On 27 Apr 2023, at 15:16, Alexander Bluhm wrote: >>> >>> On Wed, Apr 26, 2023 at 11:17:37PM +0300, Vitaliy Makkoveev wrote

Re: Remove kernel lock from rtfree(9)

2023-04-27 Thread Vitaliy Makkoveev
> On 27 Apr 2023, at 15:16, Alexander Bluhm wrote: > > On Wed, Apr 26, 2023 at 11:17:37PM +0300, Vitaliy Makkoveev wrote: >> Route timers and route labels protected by corresponding mutexes. `ifa' >> uses references counting for protection. No protection requir

fill_file(): use solock_shared() to protect socket data

2023-04-27 Thread Vitaliy Makkoveev
Now only direct netlock used for inet sockets protection. The unlocked access to all other sockets is safe, but we could lost consistency for a little. Since the solock() used for sockets protection, make locking path common and use it. Make it shared because this is read-only access to sockets

Initialize `rtentry_pool' with IPL_SOFTNET IPL

2023-04-26 Thread Vitaliy Makkoveev
Index: sys/net/route.c === RCS file: /cvs/src/sys/net/route.c,v retrieving revision 1.418 diff -u -p -r1.418 route.c --- sys/net/route.c 26 Apr 2023 16:09:44 - 1.418 +++ sys/net/route.c 26 Apr 2023 23:00:02 - @@

Remove kernel lock from rtfree(9)

2023-04-26 Thread Vitaliy Makkoveev
Route timers and route labels protected by corresponding mutexes. `ifa' uses references counting for protection. No protection required for `rt' passed to rt_mpls_clear() because only current thread owns it. ok? Index: sys/net/route.c

Re: arpresolve reduce kernel lock

2023-04-26 Thread Vitaliy Makkoveev
> On 26 Apr 2023, at 15:30, Hrvoje Popovski wrote: > > On 26.4.2023. 12:15, Alexander Bluhm wrote: >> On Wed, Apr 26, 2023 at 11:17:32AM +0200, Alexander Bluhm wrote: >>> On Tue, Apr 25, 2023 at 11:57:09PM +0300, Vitaliy Makkoveev wrote: >>>> On Tue, Apr 25,

Re: arpresolve reduce kernel lock

2023-04-25 Thread Vitaliy Makkoveev
On Tue, Apr 25, 2023 at 11:44:34AM +0200, Alexander Bluhm wrote: > Hi, > > Mutex arp_mtx protects the llinfo_arp la_... fields. So kernel > lock is only needed for changing the route rt_flags. > > Of course there is a race between checking and setting rt_flags. > But the other checks of the

Introduce `rtlabel_mtx' mutex(9) ...

2023-04-24 Thread Vitaliy Makkoveev
... and use it to protect route labels storage. This time it is not clean, which lock protects it because we holding kernel and net locks in various combinations while accessing it. I see no reason to put kernel lock to all the places. Also netlock could not be used, because rtfree() which calls

Push kernel lock deep down to sys_sysctl()

2023-04-21 Thread Vitaliy Makkoveev
At least network subset of sysctl(8) MIBs relies on netlock or another locks and doesn't require kernel lock. Also some integers in other subsets can be read without kernel lock held. Diff below actually pushes kernel lock down to net_sysctl(). It is required for MPLS and PFLOW cases. The

  1   2   3   4   5   6   7   8   >