Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp740110pxj; Fri, 11 Jun 2021 10:13:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBkFjQ9gyGfPd7rTIACxKR8PclOFz57PZ3R1F+1xTIKKxROVWWncmkX2O5n1lkZUxYhySS X-Received: by 2002:aa7:c9ce:: with SMTP id i14mr4795348edt.148.1623431580679; Fri, 11 Jun 2021 10:13:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623431580; cv=none; d=google.com; s=arc-20160816; b=XJC18ZArciq1Urkqc3NKD4rf8SpmnBs4GLiRa2SU4ww/j5RhKjutRD/sHM+5GojUfU HYlbHD+9FwmXNRoBR8b+F1kNY+jjS2uUXalAmgRlb54ZwZxVLyvtKk56lau3ae8n+1/y 4rgG7wWsYduipulw9Samlwq0boFDK+8C+Q/idvfT/gZYd3uj8lJanRryPKimIN85N75q gSYvcYzMEUhJXiJxU+du6Jlbs2D/COy2N4Lym/EGIL473f8Ih6YPZ0CCv5A+Slas9WTK APhHDq+gGzQ8+u1xzU+YmQS7NAodxYHH857wZMtVKBdHAIWjEnrF5o6snJabwwsX2/Qy l/ZA== 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:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=/7Tgh02P1CONb5jlARr87Ih06qmSqLpcLohTiWure5Y=; b=zxFjK6iwtq3T+xAnjBwvMHCEqvihmdoVNQxIkKS33C7UFo7CkvLzx8MTkGPJPx8tI9 afG+6btqd08C2ILGnKlJwc+VsWmzgmk6RUnnh+P6RYLDN0bbeNpCerwjhgDsq2eTHmQv qdcxsARJt05DNcBHuHf2vrQMwIoeahPaOBxg1uGOTvgBHkzu2X4kFqJU+eyHHwNVZY5s UOA9zJqu6r9dQslJPCklth9wBYPQqrN3SPE5URIsT1d0M++sC++XhyTlejB9SkZf7vrl JE55gP1brljz9zxRAaQh+Z3wLK3wBsdul21WjaGAmSaU6fvRnnCUb0p1Lh4t66BLAn3p 8jLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="o/fVu5T8"; 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 q4si5459951ejz.593.2021.06.11.10.12.37; Fri, 11 Jun 2021 10:13:00 -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="o/fVu5T8"; 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 S231209AbhFKRNh (ORCPT + 99 others); Fri, 11 Jun 2021 13:13:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:60344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230303AbhFKRNg (ORCPT ); Fri, 11 Jun 2021 13:13:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C72BE61184; Fri, 11 Jun 2021 17:11:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623431498; bh=/BcjzFgtIGfGd3+j0Jqz2SkO9Jfqps+SzPLc0uDWASQ=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=o/fVu5T8rsNjNMwHsa/Y02VbMfFHN0We8KxHrZnov2Oul5+/wB4VvFE1m6rTo0rN0 qP7fOeBed9NpayasYVBeJmMMnIE/ndgj9q1ATGfeY+aXmw/v98JTE2KAYGHOcGdyj5 +VDIVNFMlu/t0wUcVXGEMqk8Z90LWCMiOZPopZCBzoOw9cbZCxMYYoacOQzgVa2r8I 1w0O5+wqdZhoZ8XgaHGiO05Qtaokm4w2BThIkBYUleH7SY//eaEBFE975TFfOVHUcz uROZyZSY+qVbL5lCPoKHlnPNUyH8LbOkfDVHErFhsILhtcTjsUKPVyWl2xEMKIcRbZ ve22WDQfyYnnw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 93AE45C0990; Fri, 11 Jun 2021 10:11:38 -0700 (PDT) Date: Fri, 11 Jun 2021 10:11:38 -0700 From: "Paul E. McKenney" To: Frederic Weisbecker 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: <20210611171138.GF4397@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20210610170435.GA2187550@paulmck-ThinkPad-P17-Gen-1> <8735tpd15i.mognet@arm.com> <20210610201713.GU4397@paulmck-ThinkPad-P17-Gen-1> <20210611124212.GB143945@lothringen> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210611124212.GB143945@lothringen> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 11, 2021 at 02:42:12PM +0200, Frederic Weisbecker wrote: > 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. Thank you for the pointer! These tasks start later well after kthreadd_done, so I believe that I dodged this particular bullet. ;-) Thanx, Paul