Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp5494851pxv; Wed, 7 Jul 2021 05:14:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKc2QM8zm/xxMIuHZqZOHrpG6QZxcVC8a0i/a9EESGfx3CO/sr6CHvu1H3aeK/RhMp6YD5 X-Received: by 2002:a17:906:c241:: with SMTP id bl1mr23493167ejb.536.1625660077246; Wed, 07 Jul 2021 05:14:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625660077; cv=none; d=google.com; s=arc-20160816; b=iDzujHIEXIC5aXFFMX0MBQv/SLFp7HM/85ciCaLHxxBsDIXa5+tvxqFq1TICfZyPMF +WOxCxEGV9FsLk8e/UGxKw+ntuOIuxBuaeftYKFRjUY1Jby2P9IP2ZRZ3rpVxsE1oKn2 ehY2kK0KXWIlVx2RMmDWDY1E8A08dPzQNjm37l3fEIf2Movw/8Ulj1ZzndZtN7q1XnGp cUOf+rrrdzEitLTkrqAH+cGpIWFJV1FYO97I7NMms2J2m6/yQbZCWzeHj6pJOJuuvczH zowuhRfZ3+ZyLGV1RlkGI9qyifgVpNsktAzoI5eOzBN3WVhFscDhqvyNCJrwjPf3j89i ry5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=oooIMXln0sD5ZtObC14n9fGoSqY5mgLfYWdMjCLtleU=; b=K8XX9yM5S8uGjFhx8wu8q2uqBo+WXN7Pa6tSRx9atZjvVU8vTBC/LRxBL56tbhQEdc KKXcJoDhxoGaUnfn+/MykkRgLRfwEIggeFJ7UXckLhMRO5wPFFB0BOc5ElnTQES6Rqsi u9VxfiDhwU7rav9Kq6oZwDVC5tkFX9UZsWgqJ6a7oEjmoxCcvTSbOcaN5wpNCO5SOllA EcnlrHvVqfvPxt7AdyTey33JinTBR4ONRjQBfBXoQ19KIc8AQbz23GUMWf3bKXyr0Od+ tTw3RYbEai/CDXBYDgxRLctEFe1zaXN1rGnfPvGL2aJjuTCW4b6HEZheRuQT8g6rXM9Z 53pw== 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 c6si17550529ejc.71.2021.07.07.05.14.13; Wed, 07 Jul 2021 05:14:37 -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; 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 S231421AbhGGMOp (ORCPT + 99 others); Wed, 7 Jul 2021 08:14:45 -0400 Received: from foss.arm.com ([217.140.110.172]:35708 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231358AbhGGMOp (ORCPT ); Wed, 7 Jul 2021 08:14:45 -0400 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 384F2D6E; Wed, 7 Jul 2021 05:12:05 -0700 (PDT) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 35B5C3F73B; Wed, 7 Jul 2021 05:12:04 -0700 (PDT) From: Valentin Schneider To: Frederic Weisbecker 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 In-Reply-To: <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> <20210707120305.GB115752@lothringen> Date: Wed, 07 Jul 2021 13:11:59 +0100 Message-ID: <87czru727k.mognet@arm.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/07/21 14:03, Frederic Weisbecker wrote: > On Wed, Jul 07, 2021 at 12:55:20AM +0100, Valentin Schneider wrote: >> 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. Indeed, this becomes quite obvious when tracing the preemption count changes. This also means that s390 relied on the idle_thread_get() from the hotplug machinery to properly setup the preempt count, rather than init_idle_preempt_count() - which is quite yuck. I'll write a patch for that and likely one for powerpc.