Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp5486436pxv; Wed, 7 Jul 2021 05:04:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzew+MEEmOLstLryxDdAC8hUCUsP58MKkBQaF1YjUl0bIhr6Jwb63MYtfSLlpPsX/bBGX1R X-Received: by 2002:a17:906:f6d6:: with SMTP id jo22mr22915349ejb.26.1625659475520; Wed, 07 Jul 2021 05:04:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625659475; cv=none; d=google.com; s=arc-20160816; b=oDrcwQ4qU26//RzMIiOiL/trxd5zVUsqtTHVelaz/xrxOaQGIRnSdNN9FojaWOkDjZ Tm2Ezecq/0WPPdqgNVPl/vlY4KxvZHa1UcCGc7Au4JWvgKgL6ac+iZaTULUEGs4k5CKv sbRcwW7RKELLHxx2+0HC0Ui56Fod+u2pz9sMJAnr2sKfS75J2xnH8EmfNCjWNKyimy1A Zj0gvk7ItdOfTOIQzE4D0i7bnOIgmvMNRlURvjk+zsGKcwtOzq9aozA1pjdJSVrCIqG6 x2BoIiFYw1Q5/ceeqTiHIhHv0POMuWQhDzjSlg9gKtTbH8cOjvLXxNu2zz3OrWRvf+jp TEkA== 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:dkim-signature; bh=79bdj5npNYj1X2ecAJnRAiNavF75k5RfuHy5ZjyZy6M=; b=pUX1ulMAkn4KuTF7l8LwXXwmmC7hO3vC4SnX3wW7/ZSoGuJfEjGgx+Qh9+QF5xW7w4 DI0xh8/dQlHNSBQ4P2GXXpRoAohMVErDk10wdyRIeCThttfbQZcnuwcCG+fp1LCdeXBC MUr6542fCDc74gtXNZMRNOuv+yt6eWu71mRczAxgTO9BlShAJNo/ueKFRWWEbYjWeBMH pYiELYOLp8D8vRjYDLjyMppay/hQz9IMPfyHI00rvVQsZ073h1e/zKBEKN+ajdxB2xeA grwba8J5kdgZ/JoqN00o3uUjvaXr2yoyXxG32QvRrsPKBIzN1gV2b7lgKnwTmeQpY1YY afjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gOwpVQDN; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r16si4698533eda.37.2021.07.07.05.04.10; Wed, 07 Jul 2021 05:04:35 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gOwpVQDN; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231480AbhGGMFs (ORCPT + 99 others); Wed, 7 Jul 2021 08:05:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:43968 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231437AbhGGMFr (ORCPT ); Wed, 7 Jul 2021 08:05:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0E80F61C98; Wed, 7 Jul 2021 12:03:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625659387; bh=NjF5w9ZP+cQZ5Y4p+VeGTnHtVqiDONjLEpnlo0arWdc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gOwpVQDNeLQbksLIDdOIRGGpaI0sHWc6RcyCDmf2cckd6L1sBi2uwj6qCfuarvjOF 0HIH1qoj9zR/SiANu0/O3GaNDG6jueXTL5OMA69Awzu5Q92y8rGzShMBoWbwHmxhu5 lNaNEBSkDbSAdTgydQO3bKp5wFqIsU678AcxDXTUlxsK1h9wDS2FFpmIBJvSLezzLm dlPKY/mxuLP4pe30EDosRrp/S3tgvduItn7cgaewYm54fPD0fANCuhCqs0x9IKVnf1 GdRNjGTuErRRpDDIR4KHGb+3BOb0tIREWtyPmI8F8KOu6PmUk16xrER+Ys6ZAooCGr EewFfme1yIiKQ== Date: Wed, 7 Jul 2021 14:03:05 +0200 From: Frederic Weisbecker To: Valentin Schneider Cc: Guenter Roeck , linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org, Ingo Molnar , Peter Zijlstra , x86@kernel.org Subject: Re: [tip: sched/core] sched/core: Initialize the idle task with preemption disabled Message-ID: <20210707120305.GB115752@lothringen> References: <20210512094636.2958515-1-valentin.schneider@arm.com> <162081815405.29796.14574924529325899839.tip-bot2@tip-bot2> <20210706194456.GA1823793@roeck-us.net> <87fswr6lqv.mognet@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87fswr6lqv.mognet@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 07, 2021 at 12:55:20AM +0100, Valentin Schneider wrote: > > Hi Guenter, > > On 06/07/21 12:44, Guenter Roeck wrote: > > This patch results in several messages similar to the following > > when booting s390 images in qemu. > > > > [ 1.690807] BUG: sleeping function called from invalid context at include/linux/percpu-rwsem.h:49 > > [ 1.690925] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1, name: swapper/0 > > [ 1.691053] no locks held by swapper/0/1. > > [ 1.691310] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.13.0-11788-g79160a603bdb #1 > > [ 1.691469] Hardware name: QEMU 2964 QEMU (KVM/Linux) > > [ 1.691612] Call Trace: > > [ 1.691718] [<0000000000d98bb0>] show_stack+0x90/0xf8 > > [ 1.692040] [<0000000000da894c>] dump_stack_lvl+0x74/0xa8 > > [ 1.692134] [<0000000000187e52>] ___might_sleep+0x15a/0x170 > > [ 1.692228] [<000000000014f588>] cpus_read_lock+0x38/0xc0 > > [ 1.692320] [<0000000000182e8a>] smpboot_register_percpu_thread+0x2a/0x160 > > [ 1.692412] [<00000000014814b8>] cpuhp_threads_init+0x28/0x60 > > [ 1.692505] [<0000000001487a30>] smp_init+0x28/0x90 > > [ 1.692597] [<00000000014779a6>] kernel_init_freeable+0x1f6/0x270 > > [ 1.692689] [<0000000000db7466>] kernel_init+0x2e/0x160 > > [ 1.692779] [<0000000000103618>] __ret_from_fork+0x40/0x58 > > [ 1.692870] [<0000000000dc6e12>] ret_from_fork+0xa/0x30 > > > > Reverting this patch fixes the problem. > > Bisect log is attached. > > > > Guenter > > > > Thanks for the report. > > So somehow the init task ends up with a non-zero preempt_count()? Per > FORK_PREEMPT_COUNT we should exit __ret_from_fork() with a zero count, are > you hitting the WARN_ONCE() in finish_task_switch()? > > Does CONFIG_DEBUG_PREEMPT=y yield anything interesting? > > I can't make sense of this right now, but it's a bit late :) I'll grab some > toolchain+qemu tomorrow and go poke at it (and while at it I need to do the > same with powerpc). One possible issue is that s390's init_idle_preempt_count() doesn't apply on the target idle task but on the _current_ CPU. And since smp_init() -> idle_threads_init() is actually called remotely, we are overwriting the current CPU preempt_count() instead of the target one.