Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2142092ybh; Fri, 13 Mar 2020 13:36:37 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuyUA+3xdAAj23gorgos2I1TYRoZllemkfbfvNubxScN2IyCUwRRFAyd6tdq+XdmtNEfAgS X-Received: by 2002:a05:6808:3a1:: with SMTP id n1mr8179950oie.89.1584131796838; Fri, 13 Mar 2020 13:36:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584131796; cv=none; d=google.com; s=arc-20160816; b=EdDzQxk6A62saNlTIeraWReGBax92JTAK+/Dx5XyMedjsJckOoXkpllD6FeD3FNm2e 4DdKA18U9Uj2d4dOnznU0l15j79WRhUwv+jv3DqAnjF0gSPua2RTr9c404g9OlW3ImeK 1kW/KXw0D0kfd+V+sDOoE+s0MWd7M7U7tteyQxUbV3MWees3s6hYICKEpZ+obNmev1E4 orcvOsrueYd+v35uWWabvVDvvCXetKMO7FPOiHAdPM6GRDcwu6Hn9whWipw+mdMlVETq Qw1EU/mUqnXdjAgebGlpTlXMmOMXhvveHB3F6qmHSg8F+MsmICvsY+tWwqraROXfJTVZ 4Ybw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=snoGRJ5yPvHlsyfEDAjKZEi9iB3cRSoy26WcLIuse2U=; b=GNzhLJHH+L1/dKS6o+hkf7B1HqQ8rV1U2mpJDFeuWXXHHa0kbyDdRAp7xY3vlvbz93 etm2HeUsJZhSvS+pSrUAFJHUX0quMVY2iY8TgHk8lh7c5/xzwAjhhEg89Do97NkMGapX g+v+JdG5c2spwgUTaapwA+ZH4erSkZk87U4QUwB4q/fitY6a3CZdOl0xZp+ZodsSH0Q1 Ni/ieHk8QqeEpEdka2G+BPf1aODNos/crgqAW/bkwryZ8WI4wJnVoC2zL67n5jSv2ZRo enoct2VGeIRSzfgwE0lT+HJYBhtYka1D15mQ5Un9trLt9n+f4+3I56UfbQaqGAVOFWMB eqUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=y4AuYnGV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id s207si4985584oih.255.2020.03.13.13.36.24; Fri, 13 Mar 2020 13:36:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=y4AuYnGV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727477AbgCMUdX (ORCPT + 99 others); Fri, 13 Mar 2020 16:33:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:49420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727433AbgCMUdW (ORCPT ); Fri, 13 Mar 2020 16:33:22 -0400 Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C08D52073E; Fri, 13 Mar 2020 20:33:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584131601; bh=Z5/ANwaJRsxTperPsOjqXDHSTFsjsliL0uw9pV+2bT8=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=y4AuYnGVGvKRDjAaHcCc8XFtWkUoE/v5dSJEAHS2HnBZ/tBJxvsdm8np2CZv9+DLB kdG8YrUwsM8ADfSTj4erJMmm9NsDDr26zY8wMsY/GNDN/lohaBoud6qLBnGWHZXKtC IzcK6TVHZgciRdEV21NZO+3SbDQv40SQ3W9RtreA= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 943A53522891; Fri, 13 Mar 2020 13:33:21 -0700 (PDT) Date: Fri, 13 Mar 2020 13:33:21 -0700 From: "Paul E. McKenney" To: Linus Torvalds Cc: Jens Axboe , Tejun Heo , io-uring , "linux-kernel@vger.kernel.org" Subject: Re: [GIT PULL] io_uring fixes for 5.6-rc Message-ID: <20200313203321.GD3199@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <00e5ab7d-f0ad-bc94-204a-d2b7fb88f594@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 13, 2020 at 01:18:30PM -0700, Linus Torvalds wrote: > On Fri, Mar 13, 2020 at 10:50 AM Jens Axboe wrote: > > > > Just a single fix here, improving the RCU callback ordering from last > > week. After a bit more perusing by Paul, he poked a hole in the > > original. > > Ouch. > > If I read this patch correctly, you're now adding a rcu_barrier() onto > the system workqueue for each io_uring context freeing op. > > This makes me worry: > > - I think system_wq is unordered, so does it even guarantee that the > rcu_barrier happens after whatever work you're expecting it to be > after? > > Or is it using a workqueue not because it wants to serialize with any > other work, but because it needs to use rcu_barrier in a context where > it can't sleep? > > But the commit message does seem to imply that ordering is important.. > > - doesn't this have the potential to flood the system_wq be full of > flushing things that all could take a while.. > > I've pulled it, and it may all be correct, just chalk this message up > to "Linus got nervous looking at it". > > Added Paul and Tejun to the participants explicitly. The idea is that rcu_barrier() waits for callbacks from all earlier call_rcu()s to be invoked. So as long as you know that the call_rcu() happened earlier than the rcu_barrier(), the rcu_barrier() is guaranteed to wait for that call_rcu()'s callback. In this case (and Jens will correct me in the sadly likely event that I get the story confused), we have a call_rcu() followed by scheduling work on that same task. The work has to start executing after it was scheduled, so if that work does an rcu_barrier(), then that rcu_barrier() will wait on the call_rcu()'s callback to be invoked. Jens could invoke the rcu_barrier() just before scheduling the work, but the synchronous delay from the rcu_barrier() is a problem. Jens, what did I mess up in the above story? ;-) I defer to Jens and Tejun on the possibility of ending up with all workqueue kthreads waiting on rcu_barrier(). If that is a problem, there are some ways of dealing with it, though none that I can think of that come for free. Thanx, Paul