Re: How to destroy a condvar(9) with waiters?

2015-12-30 Thread Taylor R Campbell
Date: Tue, 29 Dec 2015 07:29:44 +0100 From: Stephan Thanks for your explanation. There are 2 condvars for the object - as far as I understand should one refcount be enough to make sure there are no waiters left on both, correct? Yes, that should be fine. You don't even need to us

Re: x86 CPU RNG support, take 2

2016-01-02 Thread Taylor R Campbell
Date: Fri, 1 Jan 2016 14:37:53 -0500 From: Thor Lancelot Simon On Sun, Dec 27, 2015 at 02:26:36AM +, Taylor R Campbell wrote: [...] > What does MSR_VIA_RNG_2NOISE actually do? Can you add a documentation > citation? As the comment just above noted:

Re: x86 CPU RNG support, take 2

2016-01-04 Thread Taylor R Campbell
Date: Mon, 4 Jan 2016 13:46:40 -0500 From: Gabriel Rosenkoetter On 02 Jan, 2016, at 12:01 EST, Taylor R Campbell wrote: > In that case, why not make cpu_rng_init tell the caller whether or not > there is a CPU RNG? It seems to me the CPU feature bits should > dete

Re: miscfs/specfs/spec_vnops.c panic (triggered by filemon(4))

2016-01-04 Thread Taylor R Campbell
Date: Tue, 5 Jan 2016 09:13:01 +0800 (PHT) From: Paul Goyette Note: from the kernel map, 0x805e3120 is the address of vmspace0, as would be expected from the above initialization code. The map doesn't have anything that corresponds to 0x805dea80 - the closest

Re: miscfs/specfs/spec_vnops.c panic (triggered by filemon(4))

2016-01-04 Thread Taylor R Campbell
Date: Tue, 5 Jan 2016 09:39:15 +0800 (PHT) From: Paul Goyette On Tue, 5 Jan 2016, Taylor R Campbell wrote: > So I think DIAGNOSTIC condition is wrong. I think the right condition > is probably uio->uio_vmspace == vmspace_kernel(). Yes, this make a lot of sense. I

Re: RFC: gif(4) MP-ify

2016-01-05 Thread Taylor R Campbell
Date: Tue, 5 Jan 2016 17:30:35 +0900 From: Kengo NAKAHARA I use rw_init() for gif_softc_list_lock instead of rw_obj_alloc(). However, I still use rw_obj_alloc() for struct gif_softc.gif_lock. If I use rw_init() for struct gif_softc.gif_lock, it would be the following code [..

workqueue semantics [was Re: How to identify specific wait-state for a "DE" process?]

2016-01-05 Thread Taylor R Campbell
Date: Tue, 5 Jan 2016 21:48:42 -0500 From: Thor Lancelot Simon You can probably use workqueues for this. Looking at the manual page again for the first time in years, I think it's a little misleading -- what I believe is meant by "A work must not be enqueued again until the cal

cacheline-aligned locks [was Re: RFC: gif(4) MP-ify]

2016-01-06 Thread Taylor R Campbell
Date: Wed, 6 Jan 2016 14:19:01 +0900 From: Kengo NAKAHARA I have a question for confirmation. If the struct has two locks for different purposes, is the COHERENCY_UNIT padding required between the locks isn't it? E.g. in my old patch(gif-mp-ify.patch), is the COHERENCY_UNIT padd

Re: How to identify specific wait-state for a "DE" process?

2016-01-06 Thread Taylor R Campbell
Date: Wed, 6 Jan 2016 09:22:44 -0800 From: Brian Buhrow hello. Is there a particular reason file descriptors are closed in ascending order? Traditionally, file descriptors 2, 1 and 0 are always in use and it seems like it might be a good idea to have those be the last to

Re: In-kernel process exit hooks?

2016-01-06 Thread Taylor R Campbell
Another possibility would be to change filemon(4) to do fd_getfile each it needs to use the file descriptor. This makes it a little more brittle (fails if you close the descriptor), but would sidestep the problem. Another possibility would be to use fd_getfile2/closef, which holds a reference onl

Re: In-kernel process exit hooks?

2016-01-08 Thread Taylor R Campbell
Date: Fri, 8 Jan 2016 09:00:03 +0800 (PHT) From: Paul Goyette On Fri, 8 Jan 2016, Paul Goyette wrote: > The saga continues! :) > > > > Next, I'm going to have a look at fd_getfile2()/fclose() and see if that > is a viable approach. Hmmm. The comments in kern/ke

Re: In-kernel process exit hooks?

2016-01-08 Thread Taylor R Campbell
Date: Fri, 8 Jan 2016 17:13:54 +0800 (PHT) From: Paul Goyette On Fri, 8 Jan 2016, bch wrote: > Out of curiousity, I'm trying to use this interface, but getting: > > /usr/include/sys/ktrace.h:83:20: error: field '_ts' has incomplete type >struct timespec _ts; > > Do

Re: In-kernel process exit hooks?

2016-01-08 Thread Taylor R Campbell
Date: Fri, 8 Jan 2016 16:52:28 +0800 (PHT) From: Paul Goyette Robert Elz wrote: > That is, instead of a fd_getfile() without an (almost immediate) > fd_putfile() so keeping ff_refcount incremented, in filemon, just do > >fp = fd_getfile(...); >fp->f_count+

Re: RFC: gif(4) MP-ify

2016-01-10 Thread Taylor R Campbell
Date: Wed, 6 Jan 2016 14:19:01 +0900 From: Kengo NAKAHARA On 2016/01/06 3:40, Taylor R Campbell wrote: > There are a couple other things I'm concerned about in the patch -- I > notice you're doing softint_establish with a lock held. Maybe that's > OK,

Re: Patch: CPU RNG framework with stub x86 implementation

2016-01-10 Thread Taylor R Campbell
Date: Sun, 10 Jan 2016 21:08:45 -0500 From: Thor Lancelot Simon As requested - here's just "cpu_rng" itself for review. I believe this version addresses all comments received so far except that I _like_ the construct "size_t cnt = ; type_t foo[x]" so I've retained that. At the

Re: a parallel operation problem about softint(9)

2016-01-12 Thread Taylor R Campbell
Date: Fri, 18 Dec 2015 11:09:17 +0900 From: Kengo NAKAHARA I think softint_disestablish should wait not only SOFTINT_ACTIVE but also SOFTINT_PENDING flag, that is, the following patch is required I think that this may not be the correct fix, and that you may be masking a legitimat

Re: RFC: gif(4) MP-ify

2016-01-12 Thread Taylor R Campbell
Date: Tue, 12 Jan 2016 18:54:44 +0900 From: Kengo NAKAHARA Yes, I removed atomic operations from gif(4) packet-processing path, as note above. I think the fix for PR/50522 fixes the race between gif_output and softint_disestablish. Ah, OK, I missed that -- joerg@'s Git mirror, whi

Re: RFC: softint-based if_input

2016-01-15 Thread Taylor R Campbell
Date: Fri, 15 Jan 2016 18:35:32 +0900 From: Ryota Ozaki BTW, I forgot noting that ipi_sysinit in main() needed a tweak to use pktq_create in driver attach routines. The tweak is like this finally: http://www.netbsd.org/~ozaki-r/fix-ipi_sysinit.diff I'm a little concerned about

Re: Very slow transfers to/from micro SD card on a RPi B+

2016-01-19 Thread Taylor R Campbell
Date: Tue, 19 Jan 2016 15:52:33 +0100 From: Stephan A way to circumvent these hangs is to remount the filesystem with noatime. Maybe we should make noatime the default... I have mounted all my file systems with noatime for many years, and never regretted it.

Re: fix gif(4)'s softint(9) contract violation [was Re: RFC: gif(4) MP-ify]

2016-01-22 Thread Taylor R Campbell
Date: Fri, 22 Jan 2016 13:37:23 +0900 From: Kengo NAKAHARA I implement this processing. Here is the patch. http://netbsd.org/~knakahara/fix-gif-softint/fix-gif-softint.patch The patch includes reverting cvs kern_softint.c:r1.42. Furthermore, the patch fixes the race betwee

Re: fix gif(4)'s softint(9) contract violation [was Re: RFC: gif(4) MP-ify]

2016-01-22 Thread Taylor R Campbell
Date: Fri, 22 Jan 2016 16:29:40 + From: Taylor R Campbell Part (2) makes ip_encap scale well to many cores, but it stops ip_encap from scaling well to many tunnels, because it removes the radix tree. Maybe that's OK -- maybe today, scaling to many cores is more impo

Re: dtrace by default

2016-01-22 Thread Taylor R Campbell
Date: Fri, 22 Jan 2016 14:23:09 -0800 From: Jeff Rizzo On 08/20/15 10:52 AM, Taylor R Campbell wrote: > I'd like to enable dtrace by default on i386, amd64, and arm -- that > is, setting MKDTRACE=yes in make for the userland tools, and enabling > options KDTRAC

passive references

2016-01-24 Thread Taylor R Campbell
To make the network stack scale well to multiple cores, the packet- processing path needs to share resources such as routes, tunnels, pcbs, &c., between cores without incurring much interprocessor synchronization. It would be nice to use pserialize(9) for this, but many of these resources are held

Re: RFC: softint-based if_input

2016-01-24 Thread Taylor R Campbell
Date: Mon, 25 Jan 2016 11:25:16 +0900 From: Ryota Ozaki On Tue, Jan 19, 2016 at 2:22 PM, Ryota Ozaki wrote: (snip) >> (a) a per-CPU pktq that never distributes packets to another CPU, or >> (b) a single-CPU pktq, to be used only from the CPU to which the >> device's (queue's

Re: RFC: softint-based if_input

2016-01-24 Thread Taylor R Campbell
Date: Wed, 20 Jan 2016 17:03:09 +0900 From: Ryota Ozaki I measured several cases of softint-based if_input implementation and other implementations including vanilla and polling-based packet processing (POC). Here are the results of the measurements (TL;TR): https://gist.git

Re: fix gif(4)'s softint(9) contract violation [was Re: RFC: gif(4) MP-ify]

2016-01-25 Thread Taylor R Campbell
Date: Mon, 25 Jan 2016 13:41:20 +0900 From: Kengo NAKAHARA On 2016/01/23 1:29, Taylor R Campbell wrote: > 1. fix the softint disestablish issue by adding a pause operation, and > 2. make ip_encap MP-scalable by using a pserialized list instead of a > giant-locked r

Re: RFC: softint-based if_input

2016-01-27 Thread Taylor R Campbell
Date: Wed, 27 Jan 2016 16:51:22 +0900 From: Ryota Ozaki Here it is: http://www.netbsd.org/~ozaki-r/softint-if_input-ifqueue.diff Results of performance measurements of it are also added to https://gist.github.com/ozaki-r/975b06216a54a084debc The results are good but bothers me

Re: RFC: softint-based if_input

2016-01-27 Thread Taylor R Campbell
Date: Thu, 28 Jan 2016 11:58:05 +0900 From: Ryota Ozaki On Thu, Jan 28, 2016 at 12:17 AM, Taylor R Campbell wrote: > So vanilla might make less efficient use of the CPU cache, > and vanilla might leave the rxq full for longer so that the device > canno

Re: RFC: softint-based if_input

2016-01-29 Thread Taylor R Campbell
Date: Fri, 29 Jan 2016 12:44:07 +0900 From: Ryota Ozaki So here is a complete patch: http://www.netbsd.org/~ozaki-r/softint-if_input-full.diff With the patch if_input and above should not run in HW interrupt anymore. Instead of adding fields to the already overpopulated struct

Re: passive references

2016-01-29 Thread Taylor R Campbell
Date: Fri, 29 Jan 2016 17:39:13 +0900 From: Ryota Ozaki I'm thinking applying psref to bridge member list that is now using its own version of similar mechanism (psz + refcount). Nice! That sounds like a good application to test, since most of the work has been done already and i

Re: RFC: softint-based if_input

2016-02-01 Thread Taylor R Campbell
Date: Mon, 1 Feb 2016 14:41:03 +0900 From: Ryota Ozaki While I agree on providing a separate API and letting all drivers use it finally, I don't agree on applying it to all drivers that need it at this point. There are so many driver that we have to let use softint-based if_inpu

Re: passive references

2016-02-01 Thread Taylor R Campbell
Date: Mon, 1 Feb 2016 14:58:05 +0900 From: Ryota Ozaki On Sat, Jan 30, 2016 at 12:43 AM, Taylor R Campbell wrote: >Date: Fri, 29 Jan 2016 17:39:13 +0900 >From: Ryota Ozaki > >I'm thinking applying psref to bridge member list >that

Re: RFC: softint-based if_input

2016-02-01 Thread Taylor R Campbell
Date: Mon, 1 Feb 2016 19:18:44 +0900 From: Ryota Ozaki On Mon, Feb 1, 2016 at 2:41 PM, Ryota Ozaki wrote: > On Fri, Jan 29, 2016 at 11:58 PM, Taylor R Campbell > wrote: > So I think it's better to adopt two approaches: > - Add if_percpuq to ifnet and let

Re: RFC: softint-based if_input

2016-02-03 Thread Taylor R Campbell
Date: Wed, 3 Feb 2016 14:55:31 +0900 From: Ryota Ozaki Here is a new patch: http://www.netbsd.org/~ozaki-r/softint-if_input-percpuq2.diff The diff from v1 is here: http://www.netbsd.org/~ozaki-r/softint-if_input-percpuq2-diff.diff Some comments: - if_percpuq_softint blocks

Re: RFC: softint-based if_input

2016-02-03 Thread Taylor R Campbell
Date: Thu, 4 Feb 2016 14:35:46 +0900 From: Ryota Ozaki On Thu, Feb 4, 2016 at 11:35 AM, Thor Lancelot Simon wrote: > On Wed, Feb 03, 2016 at 01:44:58PM +0900, Ryota Ozaki wrote: >> >> It's probably simple but time-consuming because there are more than >> one and a half hundr

Re: RFC: softint-based if_input

2016-02-04 Thread Taylor R Campbell
Date: Thu, 4 Feb 2016 17:58:02 +0900 From: Ryota Ozaki So here is latest patches that apply the above fixes: http://www.netbsd.org/~ozaki-r/softint-if_input-percpuq3-diff.diff http://www.netbsd.org/~ozaki-r/softint-if_input-percpuq3.diff Some little notes: --- a/sys/dev/pc

Re: RFC: softint-based if_input

2016-02-04 Thread Taylor R Campbell
Date: Thu, 4 Feb 2016 17:58:02 +0900 From: Ryota Ozaki So here is latest patches that apply the above fixes: http://www.netbsd.org/~ozaki-r/softint-if_input-percpuq3-diff.diff http://www.netbsd.org/~ozaki-r/softint-if_input-percpuq3.diff Another note: --- a/sys/arch/mips/c

Re: RFC: softint-based if_input

2016-02-07 Thread Taylor R Campbell
Date: Mon, 8 Feb 2016 13:04:41 +0900 From: Ryota Ozaki nitpick: #include moved from if.h to if.c: http://www.netbsd.org/~ozaki-r/softint-if_input-percpuq5.diff Any other suggestions or comments? Looks fine to me!

Re: RFC: softint-based if_input

2016-02-08 Thread Taylor R Campbell
Date: Mon, 8 Feb 2016 15:01:18 +0900 From: Ryota Ozaki After that, two more issues have been found by him, and I've fixed them: http://www.netbsd.org/~ozaki-r/softint-if_input-percpuq6.diff http://www.netbsd.org/~ozaki-r/softint-if_input-percpuq6-diff.diff (For the record, the

Re: RFC: softint-based if_input

2016-02-08 Thread Taylor R Campbell
Date: Tue, 9 Feb 2016 10:30:57 +0900 From: Ryota Ozaki On Tue, Feb 9, 2016 at 1:34 AM, Taylor R Campbell wrote: > (For the record, the issues were spurious reinitialization of > ifp->if_percpuq in if_iwm and if_rtwn causing a memory leak, and a > needless white

Re: RFC: softint-based if_input

2016-02-08 Thread Taylor R Campbell
Date: Tue, 9 Feb 2016 11:41:00 +0900 From: Ryota Ozaki ...so it's time to commit? :) Looks good to me, provided you've tested at least some driver other than wm(4). Maybe ideally an ieee80211 driver too.

Re: RFC: softint-based if_input

2016-02-08 Thread Taylor R Campbell
Date: Tue, 9 Feb 2016 12:53:55 +0900 From: Ryota Ozaki On Tue, Feb 9, 2016 at 12:01 PM, Taylor R Campbell wrote: > Looks good to me, provided you've tested at least some driver other > than wm(4). Maybe ideally an ieee80211 driver too. I tested only wm(4), v

Re: passive references

2016-02-08 Thread Taylor R Campbell
Date: Tue, 9 Feb 2016 13:00:28 +0900 From: Ryota Ozaki One fix: psref_class_create needs to return class before fail1. Oops! One question: can we destroy objects like this?: LIST_FOREACH_SAFE(frotz, &frobbotzim.head, frotz_entry, tmp) { frotz_destroy(frotz); } I

Re: Synchronizing if_xennet_xenbus detach with event-handling

2016-02-09 Thread Taylor R Campbell
Date: Tue, 9 Feb 2016 08:51:43 +0100 From: Manuel Bouyer On Mon, Feb 08, 2016 at 04:34:20PM -0800, Rohan Desai wrote: > BTW, > in my crash detach is waiting on a cv in softint_disestablish() If softint_disestablish() can sleep that may be more problematic. In this case event

Re: passive references

2016-02-09 Thread Taylor R Campbell
Date: Tue, 9 Feb 2016 20:33:51 +0900 From: Kengo NAKAHARA Is "target->prt_draining = false;" required at the end of psref_target_drain()? Or, shouldn't psref_target_drain() be called twice? My kernel paniced with the following message. kernel diagnostic

Re: passive references

2016-02-09 Thread Taylor R Campbell
Date: Tue, 9 Feb 2016 16:07:32 + From: Taylor R Campbell You shouldn't call psref_target_drain twice, unless you have already called psref_target_destroy and psref_target_init again. You should: 1. Guarantee that no new references can be made. For example, remove

Re: Simplify bridge(4)

2016-02-10 Thread Taylor R Campbell
Date: Wed, 10 Feb 2016 18:56:46 +0900 From: Ryota Ozaki Thanks to introducing softint-based if_input, we can simplify bridge(4). Awesome! I love patches that have loads more -'s than +'s, and simplify locking schemes, and remove sketchy cpu_intr_p conditionals, and things like that.

Re: passive references

2016-02-10 Thread Taylor R Campbell
Date: Wed, 10 Feb 2016 17:20:15 +0900 From: Kengo NAKAHARA I tried to use passive reference for a encaptab list itself instead of pserialize_read_enter(). # As you know, packet processing path encap4_lookup() can sleep at # ep->func. I try to reuse psref for the encaptab lis

Re: passive references

2016-02-12 Thread Taylor R Campbell
) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Taylor R. Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following

vether vs tap [was Re: Simplify bridge(4)]

2016-02-13 Thread Taylor R Campbell
Date: Fri, 12 Feb 2016 21:21:29 -0500 From: Thor Lancelot Simon On Fri, Feb 12, 2016 at 10:17:31AM -0800, John Nemeth wrote: > tap(4) is a direct interface between userland and the network. Only if you actually hook something up to the userland side. Otherwise, hooked to

Re: passive references

2016-02-15 Thread Taylor R Campbell
+ "passive reference transferred from lwp %p to lwp %p", + psref->psref_lwp, curlwp); + KASSERTMSG((psref->psref_cpu == curcpu()), + "passive reference transferred from CPU %u to CPU %u", +

Re: passive references

2016-02-15 Thread Taylor R Campbell
Date: Mon, 15 Feb 2016 22:23:31 + From: Taylor R Campbell In your patch, you try to do a radix tree lookup in a pserialize read section. It would be nice if that worked -- but I am pretty sure that our radix tree code is not going to be pserialize-safe, because it won'

Re: passive references

2016-02-16 Thread Taylor R Campbell
Date: Wed, 17 Feb 2016 13:56:02 +0900 From: Kengo NAKAHARA Hi, On 2016/02/16 7:23, Taylor R Campbell wrote: > Thanks! I'm a little confused, though: that patch series doesn't > apply cleanly when I extract it and pass it to `git am'. Some of the &g

Re: UVM wait states

2016-02-23 Thread Taylor R Campbell
Date: Wed, 24 Feb 2016 00:08:46 + (GMT) From: Robert Swindells Would there be any objection to the following patch, it makes it easier to see in top(1) which thing a process is waiting for. The rule is that wchan messages should be at most 8 characters (see, e.g., condvar(9)). T

Re: UVM wait states

2016-02-24 Thread Taylor R Campbell
Date: Wed, 24 Feb 2016 17:37:13 +0800 (PHT) From: Paul Goyette On Wed, 24 Feb 2016, Christos Zoulas wrote: > In article <20160224031758.7a34b60...@jupiter.mumble.net>, > Taylor R Campbell wrote: >> The rule is that wchan messages should be at most

Re: passive references

2016-02-29 Thread Taylor R Campbell
Date: Wed, 17 Feb 2016 13:56:02 +0900 From: Kengo NAKAHARA I fix above bugs and rebase, here is "git format-patch" patch series. http://www.netbsd.org/~knakahara/fix-gif-softint-using-psref2/fix-gif-softint-using-psref2.tgz # I think this can be applied cleanly this time...

Re: RFC: ALTQ caller refactor

2016-03-04 Thread Taylor R Campbell
Date: Fri, 4 Mar 2016 12:01:52 +0900 From: Kengo NAKAHARA On 2016/02/23 13:52, Kengo NAKAHARA wrote: > I want to uniform IFQ_ENQUEUE arguments whether ALTQ is defined or not. > # And I also want to eliminate ALTQ_DECL and ALTQ_COMMA macros... > So, I make struct altq_pktattr fr

Re: RFC: ALTQ caller refactor

2016-03-07 Thread Taylor R Campbell
Date: Mon, 7 Mar 2016 17:39:15 +0900 From: Kengo NAKAHARA On 2016/03/04 12:23, Taylor R Campbell wrote: > One of the questions from the thread you cited is whether you can put > it in the mbuf packet header instead of using an m_tag. I have no > opinion on that, but

Re: passive references

2016-03-11 Thread Taylor R Campbell
Date: Fri, 11 Mar 2016 11:07:01 +0100 From: Joerg Sonnenberger On Sun, Jan 24, 2016 at 07:10:42PM +, Taylor R Campbell wrote: > The idea is that acquiring a reference puts an entry on a CPU-local > list, which can be done inside a pserialize read section. Is t

Re: IFQ_ENQUEUE argument refactor (was Re: RFC: ALTQ caller refactor)

2016-03-25 Thread Taylor R Campbell
Date: Fri, 25 Mar 2016 17:26:14 +0900 From: Kengo NAKAHARA I rebase and modify a little(use container_of). Here is the patch. http://www.netbsd.org/~knakahara/ifq-enqueue-refactor/ifq-enqueue-refactor.patch Does anyone have Any comments? Any comments are welcome. Minor nit i

Re: Simplify bridge(4)

2016-03-25 Thread Taylor R Campbell
Date: Wed, 23 Mar 2016 20:03:54 +0900 From: Ryota Ozaki ...not so much soon though, I prepared patches: http://www.netbsd.org/~ozaki-r/bridge-psz-list.diff http://www.netbsd.org/~ozaki-r/bridge-default-mpsafe.diff The first one introduces membar to list operations used in b

Re: Simplify bridge(4)

2016-03-28 Thread Taylor R Campbell
Date: Mon, 28 Mar 2016 16:07:19 +0900 From: Ryota Ozaki On Fri, Mar 25, 2016 at 11:40 PM, Taylor R Campbell wrote: > No need for the _PSZ variants here: the bridge list is used only under > an exclusive lock. > > Actually... I don't see any users of

Re: IFQ_ENQUEUE argument refactor (was Re: RFC: ALTQ caller refactor)

2016-03-29 Thread Taylor R Campbell
Date: Tue, 29 Mar 2016 17:45:20 +0900 From: Kengo NAKAHARA On 2016/03/25 23:05, Taylor R Campbell wrote: > Either or altq_get_pattr or IFQ_ENQUEUE should KASSERT(pattr != NULL) > or similar. Hmm, I think the functions which are set to ifq->altq_enqueue by altq_att

asynchronous ugen(4) bulk transfers

2016-04-02 Thread Taylor R Campbell
There appears to be no reliable way to do asynchronous ugen(4) bulk transfers without just deferring each one to a thread. - There is no specific operation to submit a transfer without waiting for it to complete: . You can do read/write, which may wait for it to complete if there's not en

interrupting I/O in a thread

2016-04-02 Thread Taylor R Campbell
Delivering a signal to a process waiting in an I/O system call will interrupt the system call and cause control to return to userland, if the signal is handled and not ignored. In principle, one could do that to a thread, too, with pthread_kill. However, there doesn't seem to be any way to establi

Re: Random lockups on an email server - possibly kern/50168

2016-04-03 Thread Taylor R Campbell
Date: Sun, 3 Apr 2016 09:51:08 -0400 From: "D'Arcy J.M. Cain" This led me to the following PR. http://gnats.netbsd.org/39016 There is a bit of discussion and then it was closed with "This particular problem has been fixed. Other problems that lead to "tstile syndrome" still

Re: missing SDT_PROVIDER_DEFINE(sdt)

2016-04-03 Thread Taylor R Campbell
Date: Fri, 1 Apr 2016 12:29:19 +0900 From: Kengo NAKAHARA There is SDT_PROVIDER_DECLARE(sdt) in sdt.h. http://nxr.netbsd.org/xref/src/sys/sys/sdt.h#416 However, there is no SDT_PROVIDER_DEFINE(sdt). I think this is inconsistent. Currently, "sdt" provider is not used yet,

Re: dtrace(1) error in the kernel built by build.sh kernel=GENERIC

2016-04-03 Thread Taylor R Campbell
Date: Fri, 1 Apr 2016 20:04:01 +0900 From: Kengo NAKAHARA When I use the kernel built by "build.sh kernel=GENERIC" (the source is updated at March 31), I find dtrace(1) error which prints the following message. == NG result == # dtrace -n 'proc::: {}' dtrac

pserialize-safe queue(3) alternative

2016-04-03 Thread Taylor R Campbell
The attached pslist.h implements a pserialize-safe alternative to the LIST_* operations in queue(3), with example use in pslist.c: - The PSLIST_WRITER_* operations are safe to use in an exclusive writer to publish and unpublish elements -- they issue membar_producer after each element is initializ

Re: pserialize-safe queue(3) alternative

2016-04-03 Thread Taylor R Campbell
Date: Sun, 3 Apr 2016 18:20:06 + From: Taylor R Campbell The attached pslist.h implements a pserialize-safe alternative to the LIST_* operations in queue(3), with example use in pslist.c: ...actually attached, this time for real! /* $NetBSD$*/ /*- * Copyright (c

Re: missing SDT_PROVIDER_DEFINE(sdt)

2016-04-03 Thread Taylor R Campbell
Date: Mon, 04 Apr 2016 07:06:37 +1000 from: matthew green Taylor R Campbell writes: > I'm actually a little puzzled by all that. Why doesn't ipf just > define its own provider? ipf appears to be the only use of the sdt > provider. I'd sooner

Re: pserialize-safe queue(3) alternative

2016-04-07 Thread Taylor R Campbell
Date: Thu, 7 Apr 2016 17:50:56 +0900 From: Kengo NAKAHARA I have a question. It seems that pslist_writer_insert_after() does not change old entry->ple_next->ple_prevp. I think pslist_writer_insert_after() may be only used to add last element. If that is correct, I think "pslist_

Re: pserialize-safe queue(3) alternative

2016-04-07 Thread Taylor R Campbell
a note on write ordering to justify the placement of membar_producer. /* $NetBSD$*/ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Taylor R. Campbell. * * Redistribution an

Re: Random lockups on an email server - possibly kern/50168

2016-04-11 Thread Taylor R Campbell
Date: Mon, 11 Apr 2016 10:01:13 -0400 From: "D'Arcy J.M. Cain" Crash didn't help. When I pressed enter it dumped a ps output to the screen, probably the last command I ran when the system was up. Here is a partial output of that as far back as screen would go. [...] I tri

Re: nick-nhusb merge coming soon

2016-04-13 Thread Taylor R Campbell
Date: Wed, 13 Apr 2016 07:59:20 +0100 From: Nick Hudson I think the first phase of nick-nhusb is in a state ready to be merged. I'd like to merge it in the next few days, but in the meantime I've put some kernels for testing here: http://www.netbsd.org/~skrll/nick-nhusb C

Re: bridge(4): BRIDGE_MPSAFE by default and applying psref(9)

2016-04-14 Thread Taylor R Campbell
Date: Thu, 14 Apr 2016 15:55:45 +0900 From: Ryota Ozaki I prepared two patches for bridge(4): http://www.netbsd.org/~ozaki-r/remove-BRIDGE_MPSAFE.diff http://www.netbsd.org/~ozaki-r/psref-bridge.diff The former removes BRIDGE_MPSAFE switch and enables the MP-safe code by

Re: bridge(4): BRIDGE_MPSAFE by default and applying psref(9)

2016-04-18 Thread Taylor R Campbell
Date: Mon, 18 Apr 2016 17:06:51 +0900 From: Ryota Ozaki On Fri, Apr 15, 2016 at 5:37 AM, Taylor R Campbell wrote: > You could make (e.g.) bridge_input always satisfy the contract by > doing > > int bound = curlwp->l_pflag & LP_BOUND; >

Re: struct file reference at VFS level

2016-04-22 Thread Taylor R Campbell
Date: Fri, 22 Apr 2016 09:10:23 + From: Emmanuel Dreyfus On Wed, Apr 20, 2016 at 07:09:12AM -0400, Greg Troxel wrote: > I am not following this. My basic issue is that while I see your point > about open files in FUSE being different, I don't see how that's > different fro

Re: struct file reference at VFS level

2016-04-22 Thread Taylor R Campbell
Date: Fri, 22 Apr 2016 14:33:14 + From: Emmanuel Dreyfus On Fri, Apr 22, 2016 at 02:07:22PM +, Taylor R Campbell wrote: >I talked to the glusterFS developer that hit the problem about the >requirement. This is to iplement mandatory locks, a feature not ava

Re: RFC: new ifnet MP-scalable sending interface

2016-04-26 Thread Taylor R Campbell
Date: Tue, 26 Apr 2016 13:22:40 +0900 From: Kengo NAKAHARA Does anyone have any comments or objections? If there is no objection, I will commit this patch after a few days or a few weeks. http://www.netbsd.org/~knakahara/if-transmit/if-transmit.patch # rebased, no functi

Re: RFC: new ifnet MP-scalable sending interface

2016-04-27 Thread Taylor R Campbell
Date: Wed, 27 Apr 2016 16:27:56 +0900 From: Kengo NAKAHARA On 2016/04/27 0:27, Taylor R Campbell wrote: > - Why not call the struct ifnet member `if_enqueue'? > > It may be confusing to add a new verb `transmit' to a lexicon that > already has

Re: Scripting DDB in Forth?

2016-05-02 Thread Taylor R Campbell
Date: Mon, 2 May 2016 04:59:32 +0300 From: Valery Ushakov I've accidentally wrote a Forth for sh3 (long story). I thought it might be interesting to put it into the kernel so that it can be hooked into DDB. Neat! If there's interest I can push what I have to bitbucket (I use

Re: Scripting DDB in Forth?

2016-05-02 Thread Taylor R Campbell
Date: Mon, 2 May 2016 15:00:15 +0300 From: Valery Ushakov On Mon, May 02, 2016 at 00:59:06 -0400, Michael wrote: > I'm afraid my first thought was OF_interpret() on machines that have > OF-like device trees but no OF. I'm not sure I understand. OF_interpret() by itself is not

Re: WAPBL not locking enough?

2016-05-03 Thread Taylor R Campbell
Date: Tue, 3 May 2016 10:02:44 + From: co...@sdf.org I fear that WAPBL should be locking wl_mtx before running wapbl_transaction_len (in wapbl_flush) I suspect so because it performs a similar lock before looking at wl_bufcount in sys/kern/vfs_wapbl.c:1455-1460. If true,

Re: WAPBL not locking enough?

2016-05-11 Thread Taylor R Campbell
Date: Wed, 11 May 2016 11:30:39 + From: co...@sdf.org @@ -1624,6 +1627,9 @@ wapbl_flush(struct wapbl *wl, int waitfor) } error = wapbl_truncate(wl, flushsize); + + mutex_exit(&wl->wl_mtx); + Can't hold wl->wl_mtx across wapbl_truncate -- wapbl_tr

Re: Improvements in amd64

2016-05-13 Thread Taylor R Campbell
Date: Fri, 13 May 2016 23:09:03 +0200 From: Martin Husemann What I still don't get is why you seem to think that an additional X in the mapping for .rodata is so terrible - as long as there is no W I don't see the additional attack vector you are trying to elliminate. Reduce attac

Re: MP-safe ifnet with psz & psref

2016-05-19 Thread Taylor R Campbell
Date: Thu, 19 May 2016 16:11:56 +0900 From: Ryota Ozaki I'm working on a next task that replaces an ifnet pointer embedded in other objects, say mbuf and rtentry, with an interface index (ifnet#if_index) and when we take an ifnet object from such objects, look it up (with psz or

Re: MP-safe ifnet with psz & psref

2016-05-19 Thread Taylor R Campbell
Date: Fri, 20 May 2016 11:51:24 +0900 From: Ryota Ozaki On Fri, May 20, 2016 at 3:01 AM, Taylor R Campbell wrote: > Can you explain why there are long-term mbufs and rtentries that may > continue to point to ifnets that are gone? Can you instead arrange to > (1) p

Re: gif(4) MP-ify by psref [was Re: passive references]

2016-05-20 Thread Taylor R Campbell
Date: Fri, 20 May 2016 16:28:15 +0900 From: Kengo NAKAHARA I back to gif(4) MP-ify, since I could eliminate bottleneck of MP-scalable bridge(4) to support wm(4) TX multiqueue. I rebase my gif(4) MP-ify patches and reflect latest psref(9) and pslist(9) implementation. Here is th

Re: Vnode life cycle: add vnode state

2016-05-20 Thread Taylor R Campbell
Date: Fri, 20 May 2016 16:38:22 +0200 From: J. Hannken-Illjes 1) Objects vnode and vcache_node always exist together so it makes sense to merge them into one object. This can be done in two ways: - Add the current vcache_node elements (hash list, key and flag) to the vnode.

Re: Locking strategy for device deletion (also see PR kern/48536)

2016-06-07 Thread Taylor R Campbell
Date: Tue, 7 Jun 2016 18:28:11 +0800 (PHT) From: Paul Goyette Can anyone suggest a reliable way to ensure that a device-driver module can be _really_ safely detached? General approach: 1. Prevent new references (e.g., devsw_detach). 2. Wait for existing references to drain (or rol

Re: Locking strategy for device deletion (also see PR kern/48536)

2016-06-07 Thread Taylor R Campbell
Date: Wed, 08 Jun 2016 04:42:21 +1000 from: matthew green that one i think is a much larger issue that affects *all* of our drivers and needs a general fix where eg device_lookup_private() returns a reference counted value that must be returned, before the module can be consider

Re: Locking strategy for device deletion (also see PR kern/48536)

2016-06-08 Thread Taylor R Campbell
Date: Wed, 8 Jun 2016 19:47:38 +0800 (PHT) From: Paul Goyette For some reason, the device's open() routine is being called twice, but the close() routine is only called once. So every iteration leaves the refcount with a net increment of one. Correct! But, counterintuitively,

Re: Locking strategy for device deletion (also see PR kern/48536)

2016-06-08 Thread Taylor R Campbell
Date: Wed, 8 Jun 2016 17:34:33 + From: David Holland On Tue, Jun 07, 2016 at 06:28:11PM +0800, Paul Goyette wrote: > Can anyone suggest a reliable way to ensure that a device-driver module can > be _really_ safely detached? There's a pserialize scheme for this; see e.g.

Re: Locking strategy for device deletion (also see PR kern/48536)

2016-06-08 Thread Taylor R Campbell
Date: Thu, 9 Jun 2016 07:12:08 +0800 (PHT) From: Paul Goyette For now, I'm just going to maintain a zero/non-zero "active" flag in the driver, setting it on open() and clearing on close(). Unloading of the module will first call devsw_detach(), and then check the flag. If th

Re: Introduce curlwp_bind and curlwp_unbind for psref(9)

2016-06-13 Thread Taylor R Campbell
Date: Mon, 13 Jun 2016 14:00:16 +0200 From: Joerg Sonnenberger On Mon, Jun 13, 2016 at 07:36:31PM +0900, Ryota Ozaki wrote: > Currently we do it by open-coding in each place, > but we should provide some API to simplify codes. > riastradh@ suggested curlwp_bind and curlwp_unbind

CPU-local reference counts

2016-06-13 Thread Taylor R Campbell
this just for review of the concept. Thoughts? /* $NetBSD$*/ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Taylor R. Campbell. * * Redistribution and use in source an

Re: separate L3 output KERNEL_LOCK

2016-06-14 Thread Taylor R Campbell
Date: Tue, 14 Jun 2016 13:33:08 +0900 From: Kengo NAKAHARA The design to implement this concept is consisted of below two parts. 1. at L3 output processing call L2 output routine - remove KERNEL_LOCK from caller(L3) - wrap callee(L2) ifp->if_output with KERNEL_

Re: dump to cgdNb device

2016-06-15 Thread Taylor R Campbell
Date: Wed, 15 Jun 2016 23:49:55 +0100 From: Alexander Nasonov I setup an encrypted disk cgd1 (aes-cbc 256 on top of wd0g, disklabel verification) with a dump device cgd1b but I can't dump to it (I enter ddb and type sync to dump). It prints "device bad". [...] Is it expecte

Re: dump to cgdNb device

2016-06-15 Thread Taylor R Campbell
Date: Thu, 16 Jun 2016 02:52:59 + From: Taylor R Campbell By a quick skim of cgddump and dk_dump, it looks likely that the missing part is a definition for cgddkdriver.d_dumpblocks. Here's a candidate definition that you might try, attached. (Not tested, not even co

<    1   2   3   4   5   6   7   8   >