Received: by 2002:ab2:78c:0:b0:1ec:b906:25e5 with SMTP id h12csp257492lqe; Fri, 23 Feb 2024 03:41:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUa8zPsUfswRR5J1u79lmP0U2d0hTMv+YXqpRMLwLumISx/LTTZ8SexmNNviQ7DxuALW9bIYYVQezGlZer1xBbRt4sLGpnrO2KwtJun9Q== X-Google-Smtp-Source: AGHT+IEMqriIa75T69ml0jYmlLvcmpp8+jJKguh4L6I59Yl0oGasikByBHuA5apbT81YphZkfZiU X-Received: by 2002:a05:620a:22c6:b0:787:a978:20e4 with SMTP id o6-20020a05620a22c600b00787a97820e4mr1375642qki.26.1708688492982; Fri, 23 Feb 2024 03:41:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708688492; cv=pass; d=google.com; s=arc-20160816; b=TRnOJkJ60uRosVLutr3e9cZjNQAtAM21eo48YEtjptsnZqIvrqIRyfVv3ynRtLDCkE f5u5Gr6kLowq5R5Ub0wlrWOY6QWW9jcZtXbQG5T1R7n7L/ZSVbkliNx+xsLSeFZqz9PD VBbh4Xq5B3WlYqf+kxyGRyoH+lxB10d3Bs1IFbrEcJSeoswJkce3seEpBy37BlK3dhoM FH6UXbi1GWbcHIKLf+1IDoqgOl0zrzNqp/1SQXY8N7qJQa6wyzmrqEdmao++I1Ao/0qZ HfGqJTZhu4FQCo+eqIKfhLgzlUQQldtDWfKoLWd3OXwkVJtdOEA/xAmiU3rf5wT9lWCk ULmw== 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=WleLyyDSILND3IuvqQZZ23XmaNw8vhubsQCPpP7GU3s=; fh=DYXP1Ch9nIvB3k83kzJ63A+miFPdoc+WlOkYv4iPLUI=; b=vXIKB5eMOvSVP4JbTsIMRAWqcDf1Kbn5UzT7BStVHWNJYnqnBUBIKKnNsy2CUskH5N gePBfS2AcFPhPDMRa81N3Vc9Jd4nIJRT28LNIhjvB9EziIvU2QXMk+O+ahzgEKNudxQD I660C5Scuy0ipwDel2SajmihNfdEbKgmcbLwfrC1i+pUHO6vjV2EUO6OYcdnF78Lxybg wRDwiw3UJScWJyVgE07dd51pDFxfmk34F8Y8w/BimqKrd7RfhW0asIsEgdiTddcqdG05 s4t5/JMU2IiOEzKt1k3QNXAUehEsboAPvttZAcSgIMD+RKqJP4zdPpjKBvmJ6tRhXp+P CJnA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sQrH7EoJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78244-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78244-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 w6-20020a05620a094600b00787aae4d19esi1870529qkw.781.2024.02.23.03.41.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 03:41:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78244-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=sQrH7EoJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78244-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78244-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 983701C21D82 for ; Fri, 23 Feb 2024 11:41:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 03BD77C6D4; Fri, 23 Feb 2024 11:39:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sQrH7EoJ" 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 24343664D7; Fri, 23 Feb 2024 11:39:47 +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=1708688388; cv=none; b=XwPzNV+Fjv4M9xt8W70e5T/Xh9TR6Y8EcpGG4Z9PlUTdBe2sYeZDOjHzNDEJL6k1p5aQS2KKtLFdlYGCfM8wld71jCs2HuYTROY8TC5SgzwAHtooamYv2osA13JNqfRmVPDrB5N7W5Pbs5a/6vP+xbq6+7bNvSJhyS5l8R+5+24= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708688388; c=relaxed/simple; bh=HYUQjAE4WdJ6K+bIyLr2HE5+D/keOdzS3+RV5vP2ak4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=r1lYD++F4sfxFooEGInNXSxrBbpMatdACJUcAs9GRgdPeZKfh+Nht02IZsRru7U379zHOUBRAPxoJk+GFFTIaXp01L33ssRoefhJnMrkMyWM6gfQah2W6uHLbpYv+rD5ncyr6T7nAkhUU8urH/Qx6ZgcpHUrGLTGCRRcrbP3P3g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sQrH7EoJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18C90C433C7; Fri, 23 Feb 2024 11:39:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708688387; bh=HYUQjAE4WdJ6K+bIyLr2HE5+D/keOdzS3+RV5vP2ak4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sQrH7EoJhU78lDusZtSycgOB5TobF+XgA/Kc798Udpd52zFQ9BSZfvV7jUh+7WoW1 vP9IGJiQWhgtajmsAKoYSEdiD4plLU7Km3hX4SkLFQOpavqVCArhgigdIbLbcRntli cdk+FTPZJqBLRv/t7KILVN73mhAUXjwIaKHUIhz2TqAUHyEqygu1d0twfsw7LIp/ha FEPFnpjignENeU8KLOkayxjgd74Vm/4qux1ZWQsuZR6IK6G4hdn7uGxSdRTihx+IqI bxBedPb5NXr5vIFYDTM/PVmdqqLrDuDEXfM5sRuAQHE5PVLXkFW2sCKqo3NkXkm87S HOHhnMJSQPR8g== Date: Fri, 23 Feb 2024 12:39:44 +0100 From: Frederic Weisbecker To: "Paul E. McKenney" 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 , Andrew Morton , Kent Overstreet , Oleg Nesterov , Heiko Carstens , Christian Brauner , Suren Baghdasaryan , "Michael S. Tsirkin" , Mike Christie , Mateusz Guzik , Nicholas Piggin , Peng Zhang Subject: Re: [PATCH v2 3/6] rcu-tasks: Initialize data to eliminate RCU-tasks/do_exit() deadlocks Message-ID: References: <20240217012745.3446231-1-boqun.feng@gmail.com> <20240217012745.3446231-4-boqun.feng@gmail.com> <1e265c80-2008-4419-8a21-d05c39e1e53e@paulmck-laptop> 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: <1e265c80-2008-4419-8a21-d05c39e1e53e@paulmck-laptop> On Thu, Feb 22, 2024 at 12:41:55PM -0800, Paul E. McKenney wrote: > On Thu, Feb 22, 2024 at 05:21:03PM +0100, Frederic Weisbecker wrote: > > Le Fri, Feb 16, 2024 at 05:27:38PM -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 initializes 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 Looks good, thanks! Reviewed-by: Frederic Weisbecker