Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp790917pxb; Wed, 22 Sep 2021 13:01:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHirO4ye52nsrFLpiropx3a+jqaGGJWNEX5HBEXWwu/QkL9ay7WP6Vp4LWTFx82b+cGldP X-Received: by 2002:a05:6e02:1ba3:: with SMTP id n3mr651676ili.253.1632340904669; Wed, 22 Sep 2021 13:01:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632340904; cv=none; d=google.com; s=arc-20160816; b=s+tqyStDH5QkgpLm2Is2XuH7jGibP/5RjCRLKwJraiC0oWFg4JBP9lYKDZa6coq4Wd 4Q6X8XwO3dbHworfIodWtu2pi95jBeR/mlHBqJFqGBfUeQREsg1dOOkDjVBmoLyos91T yPQkF6JcHmpzgMS6ACLryGhuRSh+Ld49XKpiEZUQgfwX6hqvQrr2j0wJygccFDv1Sczv tbGFjDHIbeN5DzuBsHaYG4wasvcr7f3D7IynnV/kGaQK/ckUfpa6Wpkv9HgRdGVJ1TrD K9SVtRgacUy1p6Pq0mOIE9H7UDfTKNXKxxPttUiQvhFIKL/QoazKZa8A0nGomge8sc/M FNCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=ugshWUeTizDfFXYxqERYzK7SVt5gQ62h+KhQhdQfZoc=; b=xppDmnmcbWSjRFCltOmTUtBN4JatX8lSKea4A27HVrAA+d/M7MDFZbUEir++7qs4Bi MRtcrLF7KWA+rMgG5birfZj5+PCmWOQNh4+bxaFkg0tqu6cWcxN7gugjUpDwyrRA1hPc lvu0OvTxisreCY2p1iz4X3FP1CP4ib/IiJ1t3iSkye+0Xwq/iJKd6Sc5aAaBwroPGaHV 5/5ewh/VAzXed4mI9KKEBEeTv8JSCdnGYcl2D3a5G3D/glK6vvJkTLxG5tHJpQxFn/Iw URvsv4DT17kIVJW+1ULbun4U2Z01uW0Pwr5mtNRKZepSlx9cj5lrrWydV1x3g0fZTs2O 59NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="vLqAo//7"; 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 d6si1664995jaf.9.2021.09.22.13.01.28; Wed, 22 Sep 2021 13:01:44 -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="vLqAo//7"; 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 S237321AbhIVUBJ (ORCPT + 99 others); Wed, 22 Sep 2021 16:01:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:48736 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237330AbhIVUBJ (ORCPT ); Wed, 22 Sep 2021 16:01:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A2F2C611C4; Wed, 22 Sep 2021 19:59:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632340778; bh=Eh2FuMEpUKm0E5dWN1BAfSCOnndQsAw1GzXJgxqOJXY=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=vLqAo//7RpyDObnSx5dS7v6aR8G7rg8UqkfYdX7J2kzTGwGTtK0fcfCGV/3nmbAUs x7AJ4vdO9GOnwEtU3Qx1ED6hO10QBq/ikWthg2F5XAHpgZs9mIYynWQzFxAIPjcMia mFgQDNTARFupG0JUtEgoY/ytojgtaAtlwaZdYFkfeqtrNBlA7hFcTJf11Sdgo87lM/ KSefMNYtcS6JAZdt2pA60A0KBSyImJnS90QEMA+RE17YACpHmhdx568+JkvHq2nat9 9gatIhHVehXSm/9Zbx7IyEcn5pg+mN06vqTuN5REeEEhTYAI/58c9YUR2JQzwBiECt Iu+OmkZaOMP4Q== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 6BC325C0A54; Wed, 22 Sep 2021 12:59:38 -0700 (PDT) Date: Wed, 22 Sep 2021 12:59:38 -0700 From: "Paul E. McKenney" To: Peter Zijlstra Cc: gor@linux.ibm.com, jpoimboe@redhat.com, jikos@kernel.org, mbenes@suse.cz, pmladek@suse.com, mingo@kernel.org, linux-kernel@vger.kernel.org, joe.lawrence@redhat.com, fweisbec@gmail.com, tglx@linutronix.de, hca@linux.ibm.com, svens@linux.ibm.com, sumanthk@linux.ibm.com, live-patching@vger.kernel.org Subject: Re: [RFC][PATCH 6/7] context_tracking: Provide SMP ordering using RCU Message-ID: <20210922195938.GD880162@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20210922110506.703075504@infradead.org> <20210922110836.244770922@infradead.org> <20210922151721.GZ880162@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 22, 2021 at 09:47:59PM +0200, Peter Zijlstra wrote: > On Wed, Sep 22, 2021 at 09:33:43PM +0200, Peter Zijlstra wrote: > > > Anyway, lemme see if I get your proposal; lets say the counter starts at > > 0 and is in kernel space. > > > > 0x00(0) - kernel > > 0x02(2) - user > > 0x04(0) - kernel > > > > So far so simple, then NMI on top of that goes: > > > > 0x00(0) - kernel > > 0x03(3) - kernel + nmi > > 0x04(0) - kernel > > 0x06(2) - user > > 0x09(1) - user + nmi > > 0x0a(2) - user > > > > Which then gives us: > > > > (0) := kernel > > (1) := nmi-from-user > > (2) := user > > (3) := nmi-from-kernel > > > > Which should work I suppose. But like I said above, I'd be happier if > > this counter would live in context_tracking rather than RCU. > > Furthermore, if we have this counter, the we can also do things like: > > seq = context_tracking_seq_cpu(that_cpu); > if ((seq & 3) != USER) > // nohz_fail, do something > set_tsk_thread_flag(curr_task(that_cpu), TIF_DO_SOME_WORK); > if (seq == context_tracking_seq_cpu(that_cpu)) > // success!! > > To remotely set pending state. Allowing yet more NOHZ_FULL fixes, like, > for example, eliding the text_poke IPIs. Nice! There have been several instances where I thought that the extra state would help RCU, but each time there turned out to be a simpler way to get things done. Or that it eventually turned out that RCU didn't need to care about the difference between idle and nohz_full userspace. Thanx, Paul