Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp543101pxj; Fri, 11 Jun 2021 05:44:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWZVyBcHH9nzzbz+2cwVfjLHtg73SDDbewrHEHQEiM8/OAhhBaHadEGC8Qca5Amo4lnyuD X-Received: by 2002:aa7:cb8b:: with SMTP id r11mr3461254edt.233.1623415465478; Fri, 11 Jun 2021 05:44:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623415465; cv=none; d=google.com; s=arc-20160816; b=iu62iFhtYIbMvF+pNLn/9pKtK3Sa9oOKfoU9qvo4qj4dXk9IQZq44W/DnMGYcgGJAz XmZATX+E5d8tE/5SDzHSh03cLaKKDfIjhcy3vG9GZqJwEhzmCy6m+Rz/gWKPvKW6e5Dm WXO4W2wcmiSbnBv6Y8oNlXxk/uDzsXXcvkDWmQISJ2Oe+PxbUm406u4Tzv+ZVQQN6oDi xO2d7wwXOwOnLrXyZWKTK6xp1ESlTZmuKske7SFR3s9Z+HPHyS+JodWDbnngAfhdSuzN PtsuP+/Mriqr3KpmMPRnNEY1iYC9DoOb7c0fBhc6cGUnwI0BFf1v0AGGNv/cyww0JDp0 cx/g== 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=xwp0PIcd0dYBm8zXMw93JB0aGnbAcZLbyNIkkVKIwqo=; b=1CqC8pbZwoIDNj4oNQwTCkHgIX9RXv0SW3cN5X148hAVlz7OI858vvL7PlUGfY0qtL AefCR3H6uTKTilwxGB8ULrmPPOVWS4mZUWIjJQh2b3+89ia9m6ZDG8pqcczovdmxfBNQ RU9GC+t+dB74eFMSx0Un6MwcEtGYwa8fRqC4gtBT/XflUU1F58QIJBBMC1EAmOHQMnLu dTmWYe3H2jrk0hGWNmVybacUwuiCVdVxiQXgrceAKZG0UTtpuLzaPKXPZBqUBZoMQJYB O52uo6fDZqgS1lNOV0iRlt50tlZs7V7OnRKTxweWco7bmXmcRXpej1qkMCauUWHntzSc K8+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WAi7+dvf; 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 m12si4890212ejn.548.2021.06.11.05.44.02; Fri, 11 Jun 2021 05:44:25 -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=WAi7+dvf; 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 S231553AbhFKMoS (ORCPT + 99 others); Fri, 11 Jun 2021 08:44:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:51510 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231314AbhFKMoM (ORCPT ); Fri, 11 Jun 2021 08:44:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 93D9F613EA; Fri, 11 Jun 2021 12:42:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623415335; bh=GTGqCNvv+zgEh7y/tQSHhbtsrEkz7+mSU0+uhfVNAcc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WAi7+dvfGCaFhklZ7xvXMZscHDQSnVXu58LgwTsv/WSe3LXDvmhoD8HguGptZl5CP Y+37XdC5Z+ByKDMKl/nKPdgkE2Gqna/eJkcv5x/Y33P9ESsx1o55RSdsTc2o3cMO0Z LkHeI48EbaOkiiuapB9Wzw/VqbSuaHyYzIK/ukHbJv3B1xkSVNnC6xFanQ10t3Xg4W DAonK8Q1e7rhvlhK/M+7G3bucULySsNiMtBRG9uFftI2lnyGffZfgANjSuFM1ZxoTL hcIl9YltYG3gU//d3Ftyl7NsAQlibMBFeV0zOCjOLydkoPCE36xrZ22UjizOahdmV1 VaX/P2HaeuViQ== Date: Fri, 11 Jun 2021 14:42:12 +0200 From: Frederic Weisbecker To: "Paul E. McKenney" Cc: Valentin Schneider , linux-kernel@vger.kernel.org Subject: Re: Question about a8ea6fc9b089 ("sched: Stop PF_NO_SETAFFINITY from being inherited by various init system threads") Message-ID: <20210611124212.GB143945@lothringen> References: <20210610170435.GA2187550@paulmck-ThinkPad-P17-Gen-1> <8735tpd15i.mognet@arm.com> <20210610201713.GU4397@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210610201713.GU4397@paulmck-ThinkPad-P17-Gen-1> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 10, 2021 at 01:17:13PM -0700, Paul E. McKenney wrote: > On Thu, Jun 10, 2021 at 07:28:57PM +0100, Valentin Schneider wrote: > > On 10/06/21 10:04, Paul E. McKenney wrote: > > > > Hi, > > > Hello, Frederic, > > > > > > This commit works well, but has the unfortunate side-effect of making > > > smp_processor_id() complain when used in a preemptible region even > > > though the kthread has been pinned onto a single CPU by a call to > > > set_cpus_allowed_ptr(). (Which did return success.) > > > > > > > On which tree are you encountering this? > > I bisected to this commit in -next tag next-20210609, and this commit > could of course be an innocent bystander caught in the crossfire. > > > Looking at check_preemption_disabled() and CPU affinity, v5.13-rc5 has: > > > > /* > > * Kernel threads bound to a single CPU can safely use > > * smp_processor_id(): > > */ > > if (current->nr_cpus_allowed == 1) > > goto out; > > > > tip/sched/core additionally hinges that on PF_NO_SETAFFINITY: > > > > 570a752b7a9b ("lib/smp_processor_id: Use is_percpu_thread() instead of nr_cpus_allowed") > > > > The former shouldn't be affected by Frederic's patch, and the latter should > > only cause warnings if the pinned task isn't a "proper" kthread (thus > > doesn't have PF_NO_SETAFFINITY)... Exceptions that come to mind are things > > like UMH which doesn't use kthread_create(). > > And reverting 570a752b7a9b ("lib/smp_processor_id: Use is_percpu_thread() > instead of nr_cpus_allowed") causes the kernel to once again be OK with > smp_processor_id(), so thank you! And apologies to Frederic for the > false alarm. > > Added Yejune on CC. Thoughts? There is also that: 15faafc6b449777a85c0cf82dd8286c293fed4eb ("sched,init: Fix DEBUG_PREEMPT vs early boot") Not sure if that will help but just in case.