Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Aug 2015 19:46:03 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Luigi Rizzo <rizzo@iet.unipi.it>
Cc:        freebsd-current <freebsd-current@freebsd.org>, Stefano Garzarella <stefanogarzarella@gmail.com>, Giuseppe Lettieri <g.lettieri@iet.unipi.it>
Subject:   Re: proper way to terminate a kthread when the parent process dies ?
Message-ID:  <20150804164603.GQ2072@kib.kiev.ua>
In-Reply-To: <CA%2BhQ2%2BikWxJ-rdj7F74xPfsP2Sdf56zq41fBEMA2aCKGd8O6XQ@mail.gmail.com>
References:  <CA%2BhQ2%2Bg8zSSHrLFiuD3-oZ1D0F9BsnJKVwc0hSDowr4gaX6eYw@mail.gmail.com> <20150804145311.GN2072@kib.kiev.ua> <CA%2BhQ2%2BiUpK9Z_bV9TYpWQEd0mi=PKtcwNThqg_WYVrka1reBHg@mail.gmail.com> <20150804160211.GO2072@kib.kiev.ua> <CA%2BhQ2%2BikWxJ-rdj7F74xPfsP2Sdf56zq41fBEMA2aCKGd8O6XQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Aug 04, 2015 at 06:27:46PM +0200, Luigi Rizzo wrote:
> Specifically, our two threads implement the host part of a virtualized network
> interface and operate in a way that is very similar to an interrupt handler,
> or vhost-net in KVM. In principle, the user process that issues
> the system call could be unaware of the existence and number of
> those threads; that is why we went for a "kernel thread" created
> within the kernel.

You might try to construct this using the recently added
initialize_thread argument to the thread_create(). Specifically,
you could call cpu_set_fork_handler() there, instead of
cpu_set_upcall(_kse)(), to leave the thread in the kernel and force it
to execute your function.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150804164603.GQ2072>