From owner-freebsd-hackers@freebsd.org Wed Aug 22 07:01:09 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6766108F081 for ; Wed, 22 Aug 2018 07:01:08 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3704B85CAD; Wed, 22 Aug 2018 07:01:08 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: from [78.46.172.2] (helo=sslproxy05.your-server.de) by dedi548.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from ) id 1fsN8c-0005k6-8i; Wed, 22 Aug 2018 09:01:06 +0200 Received: from [82.135.62.35] (helo=mail.embedded-brains.de) by sslproxy05.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1fsN8c-000DC3-0Q; Wed, 22 Aug 2018 09:01:06 +0200 Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id A5F732A165C; Wed, 22 Aug 2018 09:01:07 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id LQ1PIPsURJE7; Wed, 22 Aug 2018 09:01:05 +0200 (CEST) Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 5608C2A167E; Wed, 22 Aug 2018 09:01:05 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 3G8LUxfj_9uF; Wed, 22 Aug 2018 09:01:05 +0200 (CEST) Received: from [192.168.96.149] (unknown [192.168.96.149]) by mail.embedded-brains.de (Postfix) with ESMTPSA id 214682A165C; Wed, 22 Aug 2018 09:01:05 +0200 (CEST) Subject: Re: epoch(9) background information? To: Matthew Macy Cc: freebsd-hackers@freebsd.org References: <15e3f080-2f82-a243-80e9-f0a916445828@embedded-brains.de> From: Sebastian Huber Message-ID: <26445c95-17c5-1a05-d290-0741d91b7721@embedded-brains.de> Date: Wed, 22 Aug 2018 09:01:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: quoted-printable X-Authenticated-Sender: smtp-embedded@poldinet.de X-Virus-Scanned: Clear (ClamAV 0.100.1/24863/Tue Aug 21 18:48:32 2018) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Aug 2018 07:01:09 -0000 On 22/08/18 08:49, Matthew Macy wrote: > > > On Tue, Aug 21, 2018 at 11:42 PM Sebastian Huber=20 > > wrote: > > On 22/08/18 08:34, Sebastian Huber wrote: > > On 21/08/18 15:38, Jacques Fourie wrote: > >> > >> > >> On Tue, Aug 21, 2018 at 8:33 AM, Sebastian Huber > >> > >> >> wrote: > >> > >> =C2=A0=C2=A0=C2=A0 Hello, > >> > >> =C2=A0=C2=A0=C2=A0 I update currently a port of the FreeBSD netw= ork stack, etc. to > >> =C2=A0=C2=A0=C2=A0 the real-time operating system RTEMS from the= head version at > >> =C2=A0=C2=A0=C2=A0 2017-04-04 to the head version of today. I no= ticed that some > >> =C2=A0=C2=A0=C2=A0 read-write locks are replaced by a relatively= new stuff called > >> =C2=A0=C2=A0=C2=A0 EPOCH(9). Is there some background informatio= n available > for this? > >> =C2=A0=C2=A0=C2=A0 The man page is a bit vague and searching for= something named > >> =C2=A0=C2=A0=C2=A0 epoch on the internet is not really great. Fo= r example, what is > >> =C2=A0=C2=A0=C2=A0 the motivation for this change? How is this r= elated to > >> =C2=A0=C2=A0=C2=A0 read-copy-update (RCU)? > >> > >> =C2=A0=C2=A0=C2=A0 -- =C2=A0=C2=A0=C2=A0 Sebastian Huber, embedd= ed brains GmbH > >> > >> =C2=A0=C2=A0=C2=A0 Address : Dornierstr. 4, D-82178 Puchheim, Ge= rmany > >> > > >> =C2=A0=C2=A0=C2=A0 Phone=C2=A0 =C2=A0: +49 89 189 47 41-16 > >> =C2=A0=C2=A0=C2=A0 Fax=C2=A0 =C2=A0 =C2=A0: +49 89 189 47 41-09 > >> =C2=A0=C2=A0=C2=A0 E-Mail=C2=A0 : sebastian.huber@embedded-brain= s.de > > >> =C2=A0=C2=A0=C2=A0 > > >> =C2=A0=C2=A0=C2=A0 PGP=C2=A0 =C2=A0 =C2=A0: Public key available= on request. > >> > >> =C2=A0=C2=A0=C2=A0 Diese Nachricht ist keine gesch=C3=A4ftliche = Mitteilung im Sinne > des > >> EHUG. > >> > >> =C2=A0=C2=A0=C2=A0 _____________________________________________= __ > >> freebsd-hackers@freebsd.org > > > > >> =C2=A0=C2=A0=C2=A0 mailing list > >> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > >> > >> =C2=A0=C2=A0=C2=A0 To unsubscribe, send any mail to > >> =C2=A0=C2=A0=C2=A0 "freebsd-hackers-unsubscribe@freebsd.org > > >> =C2=A0=C2=A0=C2=A0 >" > >> > >> > >> Additional information is available here : > >> http://concurrencykit.org/presentations/ebr.pdf > >> . The way I > >> understand it is that it is mostly used in place of read locks t= o > >> provide liveness guarantees without using atomics. Additional > detail > >> is available in the commit messages. As an example see r333813 f= or > >> some performance data. > >> > > > > Thanks, for the reference. The "epoch reclamation" are good > keywords > > to find more information. > > > > What is the right mailing list to ask questions about the epoch > > implementation of the FreeBSD kernel? > > > > To support this machinery in RTEMS is a bit difficult (in > particular > > EPOCH_LOCKED). Since RTEMS is supposed to be a real-time operatin= g > > system it supports only fixed-priority and job-level fixed priori= ty > > (EDF) schedulers. To allow some scaling to larger SMP systems it > > supports clustered scheduling together with the mutual exclusion > > locking protocols MrsP > > (http://www-users.cs.york.ac.uk/~burns/MRSPpaper.pdf > ) and OMIP > > (http://www.mpi-sws.org/~bbb/papers/pdf/ecrts13b.pdf > ). This > makes the > > thread pinning hard to implement (which is very easy to support i= n > > FreeBSD). The locking protocols may temporarily move a thread whi= ch > > owns a mutex to a foreign scheduler instance, e.g. a thread which > > wants to obtain the mutex helps the owner to make progress if it > was > > pre-empted in its home scheduler instance. Due to a timeout of th= e > > helper the owner may loose the right to execute in the foreign > > scheduler instance. This would make it impossible to fulfil the > > processor pinning constraint (e.g. the thread priority in the > foreign > > scheduler instance is undefined). > > > > It would save me a lot of trouble if I could assume that > EPOCH_LOCKED > > is an exotic feature which is unlikely to get used in FreeBSD. > > > > Another question, is it a common use case to call > epoch_enter_preempt() > and epoch_exit_preempt() while owning a mutex? > > > Yes. Very. It is generally not permitted to hold a mutex across=20 > epoch_wait() that's why there's the special flag EPOCH_LOCKED. If you=20 > have a very limited number of threads, you might want to have each=20 > thread have its own record registered with the epoch. Then you=20 > wouldn't need the CPU pinning. The pinning is just away of providing a=20 > limited number of records to an unbounded number of threads. Thanks for the prompt answer. Do I need a record per thread and per epoch? Could I use only one (maybe=20 dependent on the nest level?) record per thread? --=20 Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.huber@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine gesch=C3=A4ftliche Mitteilung im Sinne des EHUG= .