Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp169819rbb; Fri, 23 Feb 2024 16:28:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVTpI3EOaUISBb4SUKGXj13Nf/2tNS2946mT9div5sIH2oosagaxCU3E/A4L97Cyzsi7csXGLhtJUFuT0WtUDZge5R6e5Z2RyDvcjdATw== X-Google-Smtp-Source: AGHT+IFbl3pfUPwbSqKeKDY424VPzLu2e07waSr/Cu76UdQ6fAu6cwTyqMCOL6aZtl7nTF1hkdsa X-Received: by 2002:a05:622a:48e:b0:42e:6d96:daee with SMTP id p14-20020a05622a048e00b0042e6d96daeemr699226qtx.10.1708734509346; Fri, 23 Feb 2024 16:28:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708734509; cv=pass; d=google.com; s=arc-20160816; b=0z0Hk1oa2b4dezPkfexyRsHXCfhXtuA3n9woXYQMFOcjbSXLbv3HTSHXU/4ZJxdJE0 Em4i5WJBqMF5/TgB6mNxH74UClw7XuOHA9k+2JT992Su1CY5ooAfD3ZjhaJM17wXGTZq 0ayyy+TWmVoCv8XuNU3Md8lRmupcgP0J5uCJd3qQh1hd0z0LWbXSNp9HEBHoQHv1YQOi WcZvQoYq8TM488DA43CltLJxFhGC8SN+j5qudBIznKUoejG4EkX6MbwRXDvHT5P0znOb baJ9Eb3otDhKJxiHi2he3y7xfexSN0WGt73Qgf6tCF8Bt1CxDRPKXl/TxvNsgPj92pQV gsxQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=SAnJUfSTNkSdYUdMC1HQv0ddWTMZloCbXt+GoWE/Dhg=; fh=rtXF96jnKzNnAwlaM4KK37v/SF/DqVA9nNj4G4dqZog=; b=EVYheil5Rw+UR2jX8sduQ+Z/1wg2KZ5cqXTeqJn9XtxdYyxxVfa11+h8kJepb+/+21 VQ2NUuSrqdeV8aUGfOy9+oYKG1eZu4q08p07IPhfGQQtSGTg0TqmZt2FYbPBl/94z2ID gHVWrs817WSrj9ZleEgiG7KR2hG0ceFnQPF/lOt3/zhb5TrRm6/WJF1SB4oa94i4kofz 1rTlQlYnKWUlsk129hy2Y4RsBvzq6rf8zVmiPmPN5zBppQ0lb7AKawBf5WUnKjPY1hpg eBOw8/lwVxyyPgQhcDVdlh1hGLMxOhcwUZWOG/6dzoD8lMd2S7bIiuQPd2LI4fpPBCdl Q1RA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VRFq04Cv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79363-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79363-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h10-20020a05622a170a00b0042e6a1bec87si105928qtk.553.2024.02.23.16.28.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 16:28:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79363-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VRFq04Cv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79363-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79363-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A28EC1C22E01 for ; Sat, 24 Feb 2024 00:28:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 40103A55; Sat, 24 Feb 2024 00:28:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VRFq04Cv" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41D7310F2; Sat, 24 Feb 2024 00:28:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708734505; cv=none; b=jjxLI0/nLGIsqNzCQyxvKlBOUlaQZ6XWrp4pUjQWN9o00LCT0a9QMx8f8ciRC+C6mfpQEvi8Mouyomq97cRRHMlkZGbJQCRW3xWCqs+N3jP5tlvsMt4KC+q1A9FO896SOyB1JwRLdnumTmhZWwvxUj8xqdBzOL+5DXjQZkgDylk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708734505; c=relaxed/simple; bh=NfXtG/1GMXbQ2yBn2k0Gm8LXQ6d0gmiTwMDv0HaP6Y8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iMDyYpY+gq6jzARRClsDkZDsJz2dM1sAOj6sV9wY2PK1+cGQil+Q0Ydp6D67yPTT+ZtcFC4HpDQdoGC/mkCAm24fJnNZ41Q2rjBt0rV6GD7v0xEauGRuH4UUasEycfY3nuMaSzyitLuj2tc8aq/fFyRBnrJfAUNsxsLBP3z9q2Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VRFq04Cv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F5DDC433C7; Sat, 24 Feb 2024 00:28:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708734504; bh=NfXtG/1GMXbQ2yBn2k0Gm8LXQ6d0gmiTwMDv0HaP6Y8=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=VRFq04CvhZ3G0DEDfladC2Pth55Hp8itifcNJuADVOl65dYXrWqJgGghGyU5g/8wW wglNojhhmItEA2QXQDxJLNeuA7qPa0WAjTxytJRXd05+8VCE3hiBazML8nBhPo5Iri EAxSKfBcN4KoxXdOXooKVUSxpcb+kZb/psYzrl58GxusG+wTmvt176AwnL7CIwg0A7 CgbSciL1mV2MBIw2RufWmoNG6NUrhyRZEwOl+tc5tcGyuje026XKMpil2NODz4bF8/ AskIkeT1Ea0cTViK/hJ+2A061DM9JvpCJ5EOWBNOeV6OvNNgfw/h89c90z7xUhpR9E ezyYZ0SpPKr/Q== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 290F5CE1113; Fri, 23 Feb 2024 16:28:19 -0800 (PST) Date: Fri, 23 Feb 2024 16:28:19 -0800 From: "Paul E. McKenney" To: Frederic Weisbecker Cc: Boqun Feng , linux-kernel@vger.kernel.org, rcu@vger.kernel.org, Neeraj Upadhyay , Chen Zhongjin , Yang Jihong , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang Subject: Re: [PATCH v2 4/6] rcu-tasks: Maintain lists to eliminate RCU-tasks/do_exit() deadlocks Message-ID: Reply-To: paulmck@kernel.org References: <20240217012745.3446231-1-boqun.feng@gmail.com> <20240217012745.3446231-5-boqun.feng@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Feb 23, 2024 at 01:19:42PM +0100, Frederic Weisbecker wrote: > On Fri, Feb 16, 2024 at 05:27:39PM -0800, Boqun Feng wrote: > > -void exit_tasks_rcu_start(void) __acquires(&tasks_rcu_exit_srcu) > > +void exit_tasks_rcu_start(void) > > { > > - current->rcu_tasks_idx = __srcu_read_lock(&tasks_rcu_exit_srcu); > > + unsigned long flags; > > + struct rcu_tasks_percpu *rtpcp; > > + struct task_struct *t = current; > > + > > + WARN_ON_ONCE(!list_empty(&t->rcu_tasks_exit_list)); > > + preempt_disable(); > > + rtpcp = this_cpu_ptr(rcu_tasks.rtpcpu); > > + t->rcu_tasks_exit_cpu = smp_processor_id(); > > + raw_spin_lock_irqsave_rcu_node(rtpcp, flags); > > + if (!rtpcp->rtp_exit_list.next) > > And then you might want to turn that into a WARN_ONCE. Excellent point, thank you! I am queueing a separate patch for this with your Reported-by. (This change can lag behind, just in case this series needs to go in quickly.) Thanx, Paul > Thanks. > > > + INIT_LIST_HEAD(&rtpcp->rtp_exit_list); > > + list_add(&t->rcu_tasks_exit_list, &rtpcp->rtp_exit_list); > > + raw_spin_unlock_irqrestore_rcu_node(rtpcp, flags); > > + preempt_enable(); > > }