From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EECDC433F5 for ; Fri, 28 Jan 2022 16:12:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349957AbiA1QMJ (ORCPT ); Fri, 28 Jan 2022 11:12:09 -0500 Received: from foss.arm.com ([217.140.110.172]:51886 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349958AbiA1QMJ (ORCPT ); Fri, 28 Jan 2022 11:12:09 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CB099113E; Fri, 28 Jan 2022 08:12:08 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.13.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 60D523F793; Fri, 28 Jan 2022 08:12:06 -0800 (PST) Date: Fri, 28 Jan 2022 16:11:57 +0000 From: Mark Rutland To: Sven Schnelle Cc: Steven Rostedt , LKML , Ingo Molnar , Andrew Morton , Yinan Liu , Ard Biesheuvel , Kees Cook , Sachin Sant , linuxppc-dev@lists.ozlabs.org, Russell King , linux-arm-kernel@lists.infradead.org, hca@linux.ibm.com, linux-s390@vger.kernel.org, "Paul E. McKenney" Subject: Re: ftrace hangs waiting for rcu Message-ID: References: <20220127114249.03b1b52b@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-s390@vger.kernel.org On Fri, Jan 28, 2022 at 05:08:48PM +0100, Sven Schnelle wrote: > Hi Mark, > > Mark Rutland writes: > > > On arm64 I bisected this down to: > > > > 7a30871b6a27de1a ("rcu-tasks: Introduce ->percpu_enqueue_shift for dynamic queue selection") > > > > Which was going wrong because ilog2() rounds down, and so the shift was wrong > > for any nr_cpus that was not a power-of-two. Paul had already fixed that in > > rcu-next, and just sent a pull request to Linus: > > > > https://lore.kernel.org/lkml/20220128143251.GA2398275@paulmck-ThinkPad-P17-Gen-1/ > > > > With that applied, I no longer see these hangs. > > > > Does your s390 test machine have a non-power-of-two nr_cpus, and does that fix > > the issue for you? > > We noticed the PR from Paul and are currently testing the fix. So far > it's looking good. The configuration where we have seen the hang is a > bit unusual: > > - 16 physical CPUs on the kvm host > - 248 logical CPUs inside kvm Aha! 248 is notably *NOT* a power of two, and in this case the shift would be wrong (ilog2() would give 7, when we need a shift of 8). So I suspect you're hitting the same issue as I was. Thanks, Mark. > - debug kernel both on the host and kvm guest > > So things are likely a bit slow in the kvm guest. Interesting is that > the number of CPUs is even. But maybe RCU sees an odd number of CPUs > and gets confused before all cpus are brought up. Have to read code/test > to see whether that could be possible. > > Thanks for investigating! > Sven