Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2737717pxb; Mon, 31 Jan 2022 03:16:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJygBbE30yA/neVAq4BHlkWmMf93F/fa+SrG+OymVKhsX5XtOWaYyUp+KN48Xzu2CapaneuJ X-Received: by 2002:a17:906:c110:: with SMTP id do16mr16245177ejc.175.1643627772091; Mon, 31 Jan 2022 03:16:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643627772; cv=none; d=google.com; s=arc-20160816; b=QObhYgC3GDFDsFoHS63255u2LrHLxUzVBFtbAPtRVJ/Q4Gm414E22ZTI0cJ7m7VnM7 9Tw91T1HWyCwYmaLzz9vJwnuKGiCFvBW9pzcUS8ZNCUr7KUTh+VPEcxaE9BbgsiFOkn2 HJ9LYq5jWi1zXiW15nBY8nJmxKEP/v012e9HNFPQpWZq2bp9gyxYbWHtiI3Ji4LHx+U/ vz+DuYEA0I0ttLq+kwGiLwP2Dc1v0+/10GC+CQHl7V/xeBiaJPojcOEMqzs6h2DwVWCD M7u2ccjofQMIj5mN2hpRco9dZyKujogR9Veda0JUCpfcV44tKVEatU9AOgE9mYWUc5rN QfCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=MDv/jMYHQTxhiSXSoPVyJq/Ef9No2gilk59zBffK6aU=; b=rdNyy1ZF9ttGrrBwQEkQHa+wbmttjeSt+u44YxnAlSZoSVta6ueS+rMiAjmt5X7Q/3 ZO8ZownQuYqgxmvYIaygErhVzvhUy7M6jQtkohMwnjwgfEPwkUBjilaAw4gQj8h5vjcr aM6s24FC3dEbQJoHpnVc3EG8mt29/RT0DmrCgNX2stdjQgRDX7k0OK8NiDfte8Cu49yy 6iSiEd+MXik45plAVZigULOEmgo1+3/R2BUV0bbebBpk5cc751Ifq6SbquacGKKtFJ8r 1uVEA3l3uiWRhTL4lJoMMOplqtTJSciwDPG9wHccV+aJsL+4c2a0PLuiaKMmJruJckC2 mJng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mp41si7875546ejc.153.2022.01.31.03.15.47; Mon, 31 Jan 2022 03:16:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239183AbiA1QMK (ORCPT + 99 others); Fri, 28 Jan 2022 11:12:10 -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-kernel@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