Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1011528pxj; Thu, 17 Jun 2021 20:07:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuy4IXgu7wkjdRNvY6hxUhYo8SNAgln2Njlna54ApfPLuVndPvgzi5rIgtYRtvBHQoAAcm X-Received: by 2002:a17:906:6859:: with SMTP id a25mr8668572ejs.469.1623985649887; Thu, 17 Jun 2021 20:07:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623985649; cv=none; d=google.com; s=arc-20160816; b=pkzmqOHSTOVE8C79Harb1/oheKbAyLlllD1jmYiqWwntp4SRcQlcG3jLnE3uc92aHg pxFeTTaM9f7sYMpAWvehX1p8l06hc2Al6FKO0n9biXf3cCqp6BLYHRj0w4NJZWZDaOIB 4e5VtJb25OxMHdctGwsPlPKQzeNxx+x7D1qSOIg50uIRfxVPsDGIzP003MAOZIjIWamF v73t0ji3DgmVzAQtbL/fbLok1yesaHjtojNJMph1Spq82c+skFczahm75c20cNGTOGqf 81huQVGelDCWnuho7ziLPTC2LgDliCzRltueBy4I80wTNADrHLaVVecoX0ZEwYsBjFXl j5OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=P0QF4UAXkWLZHCR1zwGelIiN7heDx/ebKi9C7oHZkcw=; b=aZxvoYIGexBmLYm8sCA4Nl9PhWfh+a96J59WW0oAj4KIs9THiGpR6u+Ft4VBL8b42L HbKvWBspFuWSCkSg8Qn36K3ZOqh/9Gjjmm90cjZJoiwKQ49FKxQU+txhgYjAkBJ9teSR hrjmsEIqGGOEYsfw3/rYni/dwuF1sy0vAjHjJH2UB5HU0qtA8zMY938sAlQHSMrAwUaQ ai3q84mZ/XDnS4qvZMcQ/9C2VdrlJMjoxS3xoIxlDSr+BPZvP1cHlBRm2Tb1vDvkfp7l RhwYYl5QVzTdjmZVQCFDtcw7W3lMeiqAxR9mqNFOtb25FJKTcygqulFx7tMR80wz2Fr7 SZAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OoN2DxDZ; 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 nc38si1059086ejc.708.2021.06.17.20.07.07; Thu, 17 Jun 2021 20:07:29 -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=OoN2DxDZ; 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 S233054AbhFRAIN (ORCPT + 99 others); Thu, 17 Jun 2021 20:08:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:60570 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbhFRAIM (ORCPT ); Thu, 17 Jun 2021 20:08:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 340EE61369; Fri, 18 Jun 2021 00:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623974763; bh=jLmwqbg1nf5vjziJwAdKMPZsBWmEUxARXi45U7jKl2w=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=OoN2DxDZHlw2Vn533AGJ/KJZmC0SXvgBWu++dM+4iIsaFCLkwjVRFRbxLOA/kysw8 MwZba+zARl1RnL/fZ+byxqL4SIV7PIx4OYeUzdk01K+ou7rg3tLD1x1hizXV1rqNcp JrCUC8D/XkDYmlpEcjd1V/PZRJ94VnUuBfnGgfmO3E+G3wa7bIzPWiYtOhS9/taZbs SBuRaHK5mpFAtB2M42WwXi8gIctLq+JegQhd2e7UCFKrcTokR4KennZSW397UTXGQc MXsITysuFarlEYON3Nfqx5eegnkb3d0nZqlHcq/uXkytHXjm+JkG5ViQGYqr5dVEfu liH9e7RSsefWQ== Subject: Re: [PATCH 4/8] membarrier: Make the post-switch-mm barrier explicit To: paulmck@kernel.org Cc: Nicholas Piggin , "Peter Zijlstra (Intel)" , Rik van Riel , Andrew Morton , Dave Hansen , Linux Kernel Mailing List , linux-mm@kvack.org, Mathieu Desnoyers , the arch/x86 maintainers References: <1623816595.myt8wbkcar.astroid@bobo.none> <617cb897-58b1-8266-ecec-ef210832e927@kernel.org> <1623893358.bbty474jyy.astroid@bobo.none> <58b949fb-663e-4675-8592-25933a3e361c@www.fastmail.com> <20210617150214.GX4397@paulmck-ThinkPad-P17-Gen-1> From: Andy Lutomirski Message-ID: Date: Thu, 17 Jun 2021 17:06:02 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210617150214.GX4397@paulmck-ThinkPad-P17-Gen-1> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/17/21 8:02 AM, Paul E. McKenney wrote: > On Wed, Jun 16, 2021 at 10:32:15PM -0700, Andy Lutomirski wrote: >> I would appreciate everyone's thoughts as to whether this scheme is sane. >> >> Paul, I'm adding you for two reasons. First, you seem to enjoy bizarre locking schemes. Secondly, because maybe RCU could actually work here. The basic idea is that we want to keep an mm_struct from being freed at an inopportune time. The problem with naively using RCU is that each CPU can use one single mm_struct while in an idle extended quiescent state (but not a user extended quiescent state). So rcu_read_lock() is right out. If RCU could understand this concept, then maybe it could help us, but this seems a bit out of scope for RCU. > > OK, I should look at your patch, but that will be after morning meetings. > > On RCU and idle, much of the idle code now allows rcu_read_lock() to be > directly, thanks to Peter's recent work. Any sort of interrupt or NMI > from idle can also use rcu_read_lock(), including the IPIs that are now > done directly from idle. RCU_NONIDLE() makes RCU pay attention to the > code supplied as its sole argument. > > Or is your patch really having the CPU expect a mm_struct to stick around > across the full idle sojourn, and without the assistance of mmgrab() > and mmdrop()? I really do expect it to stick around across the full idle sojourn. Unless RCU is more magical than I think it is, this means I can't use RCU. --Andy