From owner-svn-src-head@freebsd.org Wed Nov 29 16:14:02 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E19DE57F84; Wed, 29 Nov 2017 16:14:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 EA2ED7A775; Wed, 29 Nov 2017 16:14:01 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id vATGDueb022766 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 29 Nov 2017 18:13:56 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua vATGDueb022766 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id vATGDus9022765; Wed, 29 Nov 2017 18:13:56 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 29 Nov 2017 18:13:56 +0200 From: Konstantin Belousov To: Hans Petter Selasky Cc: John Baldwin , Nathan Whitehorn , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Konstantin Belousov , "O. Hartmann" , KrishnamRaju ErapaRaju Subject: Re: svn commit: r326218 - head/sys/kern Message-ID: <20171129161356.GA2272@kib.kiev.ua> References: <201711252341.vAPNf5Qx001464@repo.freebsd.org> <14322447.103fKFTi3y@ralph.baldwin.cx> <3fc45d5f-22b9-0562-278b-c515e36f48e7@freebsd.org> <14058479.lc6xlYgyBM@ralph.baldwin.cx> <2e752d6a-d34a-dde0-acea-fdbf8bebea51@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2e752d6a-d34a-dde0-acea-fdbf8bebea51@selasky.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Nov 2017 16:14:02 -0000 On Wed, Nov 29, 2017 at 04:33:50PM +0100, Hans Petter Selasky wrote: > Hi Nathan, > > The chunk below causes sched_pin() to stop working and should be removed > from your commit ??!! > > It probably explains the hangs seen recently reported by various brave > people running 12-current :-) > > Specifically I see threads migrating between CPUs when td->td_pinned > 0 > using the LinuxKPI RCU API, which in turn leads to a hang when trying to > synchronize RCU. > > --HPS > > diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c > index 5c8bae5afa1..bd4b505f6c3 100644 > --- a/sys/kern/sched_ule.c > +++ b/sys/kern/sched_ule.c > @@ -2453,7 +2453,7 @@ sched_add(struct thread *td, int flags) > * Pick the destination cpu and if it isn't ours transfer to the > * target cpu. > */ > - td_get_sched(td)->ts_cpu = curcpu; /* Pick something valid to > start */ > +// td_get_sched(td)->ts_cpu = curcpu; /* Pick something valid to > start */ > cpu = sched_pickcpu(td, flags); > tdq = sched_setcpu(td, cpu, flags); > tdq_add(tdq, td, flags); To clarify. It seems that this change breaks sched_bind(). It might be that LinuxKPI does use sched_pin() in somewhat questionable way. Namely, the code puts the thread off the CPU (e.g. by taking a lock). Then, is it guaranteed that the pinned thread returns to the same cpu after sched_add() ? I think that the second behaviour is not guaranteed, but it might happens by the way the things are arranged. If guaranteed, then the sched_pin() breakage is same as for sched_bind().