Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp476797rdb; Thu, 22 Feb 2024 09:18:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUr3WitPipu9zDFa1K2xHRFzhdlgC1al6fV0gjO6XZKyNM4qe4VQGyl7hymV/A3k76OqJ6BzWag3PBNlScC1kg3exA9U/ajiQL6+rPm2A== X-Google-Smtp-Source: AGHT+IGYfPnWJFo1yi+QNJGoDwV77F7Tci7GyXTqvIBHDJ/cv6pXBguUdTrTYOeCKf9flNVg71Ul X-Received: by 2002:a05:6e02:2148:b0:363:d9eb:c2de with SMTP id d8-20020a056e02214800b00363d9ebc2demr27067678ilv.6.1708622302895; Thu, 22 Feb 2024 09:18:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708622302; cv=pass; d=google.com; s=arc-20160816; b=YY3tq2LJwBN9WDMGM1apmrL9Jxo295PQT/pHrgKbubk/HP4S6Dk6sGMrsA4eFiB59x im66dV27u6DzqzEVMzTPDoIwRbo0caZl8+5aKW+prssxVcSE/nBn7thLQzQF2cyl5Z+T VYpXM7F+mXs8hbidi2GiQ/i04FuvEfcWAtq/HmGBJ1KmfjCuCMxu0AuTp0rC+W65wrFQ JE0uZDn6AggJ6BAF4nyw6bJbcEYK3B64o5vWPMpAnxVOhoU5ISMcFQlCRx0IyANsNhMI 1YBh58LDqdvt0j1hE8D1bbBzUrQX6mVea9xyyPGVxm9aruf5EwdrcpXYfr0Jv04KFkW6 1poQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=aL8hqT371DAcJDWdYv2b16feAWrDdnAJ+yxA2RuA4P0=; fh=FDrgFAB1ivcbMGuDUI9zeoUK09NKtqS6ighbV3FtWz8=; b=SjgaDeAXgV/tHiYJZ58r7SETzcyRDHPw6/NL9HPjv2AykofE5YhBzvB4xYume0+g86 ww63BvSRs7f0vk/27hHnNhMxiZ/YM25vcRXWdQpI9Ry6YlX1pY+EofV+r76VclkEA3KO AeTCxj8E+4uhe8R7z6bUNlc+dFrlYY43EWnW5pWOBWhM3mpxcZe0spN4EoUKcc8dDNwL YZHMd3lk1DVQtMdJk09CgZ7m+C5q2Agb2TspugsoCAkhIUDHMsovIE4ujeUA5rhIr+lG 33R0l9KsmLo6DuhV+uI+YJ8o5alUEDtns+n1/Aqwq7U80Zpsh6dB+OAndsRvNILnCQ0g hmXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YgleK6KZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76910-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76910-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id o30-20020a63731e000000b005dc88260f76si10799683pgc.330.2024.02.22.09.18.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 09:18:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76910-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YgleK6KZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76910-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76910-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C308AB22B3E for ; Thu, 22 Feb 2024 16:55:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8DF671552EC; Thu, 22 Feb 2024 16:54:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YgleK6KZ" 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 1CB9A15530D; Thu, 22 Feb 2024 16:54:51 +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=1708620892; cv=none; b=cuj+UuTFPqg0ARWGm158Cut60wWlX2bOfOIs80QVE+zpyUa7a4QTfYqK3l2FVH3zF5eDZWe+svqtBk6O29iwMLGO1yvoLzf3NXpiC79c5p9Vr3utTHW6Ef0ApNxQKU5tneCScpCfAs1+wZT7zRRJz8r9IKRvcb6N0Zx6cXUx6xQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708620892; c=relaxed/simple; bh=9cY5jx/umKBQXhkjaty2wtDlATbIFuzu8zNWrAbZnEo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Nh2VNtPTVpw+lJ/5+fEV3fI3qO6Kq+zM2TKTjJ4lT/8dqOrIBoy9Yic9WQUdKAoh42gZcx0wrfLVEbhad9XYbKPPjPMOxKHYFDQouw3sq3OID2pjyILeXRf6KTj0AVWpPAt1sZ3d4DlBtwrb8XNF17qwWfnr+nfjtkUQ7Kf69YE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YgleK6KZ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9044FC433C7; Thu, 22 Feb 2024 16:54:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708620890; bh=9cY5jx/umKBQXhkjaty2wtDlATbIFuzu8zNWrAbZnEo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YgleK6KZc8npigGMXlaBEMD75geC7x7eBAmIhAFjdvdugRQKuCluvoxnQmNwi8t1z Dv42AsE4ry3sP4/fRFhVi9H5WgVqs/scDlfcPHw81idn/6czlaqBpGOy20tZRudo4A bOBqnVAiEAtvsi6R0auWZ0/fyQo2uSkg/3QOnJXOMfFv7zaYNb41rlhFGLRwa8sTRV qtFzXCCC5MhBkAIdbLO44qS4qrxe0a5LP7WqeFHaJKur/tFehJX4rYZ8mg7Muga01Q YwZldrqQ4gXpNy0dqkt3YMn+a/zHe+imZ8PWlRX9pvCj+Q44SaiaeZPgKGjATaxJ7c QpgfwpujrIP6w== Date: Thu, 22 Feb 2024 17:54:48 +0100 From: Frederic Weisbecker To: Boqun Feng Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, Neeraj Upadhyay , "Paul E. McKenney" , Chen Zhongjin , Yang Jihong , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , Zqiang Subject: Re: [PATCH v2 2/6] rcu-tasks: Add data to eliminate RCU-tasks/do_exit() deadlocks Message-ID: References: <20240217012745.3446231-1-boqun.feng@gmail.com> <20240217012745.3446231-3-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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240217012745.3446231-3-boqun.feng@gmail.com> Le Fri, Feb 16, 2024 at 05:27:37PM -0800, Boqun Feng a ?crit : > From: "Paul E. McKenney" > > Holding a mutex across synchronize_rcu_tasks() and acquiring > that same mutex in code called from do_exit() after its call to > exit_tasks_rcu_start() but before its call to exit_tasks_rcu_stop() > results in deadlock. This is by design, because tasks that are far > enough into do_exit() are no longer present on the tasks list, making > it a bit difficult for RCU Tasks to find them, let alone wait on them > to do a voluntary context switch. However, such deadlocks are becoming > more frequent. In addition, lockdep currently does not detect such > deadlocks and they can be difficult to reproduce. > > In addition, if a task voluntarily context switches during that time > (for example, if it blocks acquiring a mutex), then this task is in an > RCU Tasks quiescent state. And with some adjustments, RCU Tasks could > just as well take advantage of that fact. > > This commit therefore adds the data structures that will be needed > to rely on these quiescent states and to eliminate these deadlocks. > > Link: https://lore.kernel.org/all/20240118021842.290665-1-chenzhongjin@huawei.com/ > > Reported-by: Chen Zhongjin > Reported-by: Yang Jihong > Signed-off-by: Paul E. McKenney > Tested-by: Yang Jihong > Tested-by: Chen Zhongjin > Signed-off-by: Boqun Feng Reviewed-by: Frederic Weisbecker