Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp783593pxb; Wed, 22 Sep 2021 12:49:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBIqlZq8rww4/2e5WAnKte2apxbWSa17MmUMRS4QTRS1180LUI61hBt/owTYTHMqCR0klt X-Received: by 2002:a05:6e02:2185:: with SMTP id j5mr600450ila.189.1632340166983; Wed, 22 Sep 2021 12:49:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632340166; cv=none; d=google.com; s=arc-20160816; b=KRVfPyW2ztaceYbg43J6qb1Kbo1Mric24A1id9MkpdI/rPimxqBaG9ejek+UPaRPPX QWnomwksXUluIGx8/sFHsA+NftYK9kNM4R8dF6DH7w/jbGkKzva0kHeupGLCr0sJj7BN BpJCWAnWf9s/ozw1UUcEJLvvteF4Dvb/oYtJeKISASUer7ZyUNuD06SnB+ettk2E2Usa uVUScqpzC4z8rd/XLYC/U5Q5TFWyvDlQm1sq4eAUx1RcferTDMvzgN0Q8BNEzOzZay6q 3cvYiNcGnz3SiRXV62NeUvtf62QuCBzOSno5bxlI0hY2Bd98yI/qDmAVHRsEIaGJqLQb zBhQ== 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:message-id:subject:cc:to:from:date:dkim-signature; bh=1YATyr10hFKsEJyvlpPeeKxTucU8KD0HwbL0+C+7uQk=; b=u/3+wCoE42K/XU1BL0B1PnVbGXlBNH83sJN/c40UqCqWYZORC1NrvBsYsQjh/iMpBa HSWqWBG7U6LCxpyuehAmn6XeMfdi3jhdDHw5S/3iorGkND/osQPMn/r9UuskSqKMGIFV JuBvsG4QQ3dj7SsnIcZR+tZM0kaR586l2xCyIv8GCIqwA24TRolMP5PjoPa3BxZc8xpm gcEyu9tqeGT7Igzmn120PNb3ywGLJGQLU84YvRMnb+zpfby+o1xL6thfyEwID2qZmQr1 1dzlSdxdTC+Yg9xhDawboewBBN3MzZutcO7VL6n/fLCk/9xbtSDcXRmkwM7s8i5i0UkW iz2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=jeWIYoP2; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v11si3792805jas.4.2021.09.22.12.49.15; Wed, 22 Sep 2021 12:49:26 -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=@infradead.org header.s=desiato.20200630 header.b=jeWIYoP2; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237256AbhIVTt4 (ORCPT + 99 others); Wed, 22 Sep 2021 15:49:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230456AbhIVTtu (ORCPT ); Wed, 22 Sep 2021 15:49:50 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 042C4C061574; Wed, 22 Sep 2021 12:48:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=1YATyr10hFKsEJyvlpPeeKxTucU8KD0HwbL0+C+7uQk=; b=jeWIYoP2uKYq5WeKPu8DnDeYnr rwd7Pn7gCthcDCndOfxADAFLUP9es9gLdBpu+klkOhiwbuMTZqQwnEA5Pmrl70WyYiX9lC2sa+SvA pcu1tFRRT40TNN8PCjrC1zx5E9igQyyC6+QaDSGIgXsWFVAtjKhdCzVY8FK7f3ssE3tVgvflRDCFT efnDqHETPgT412VUR5q5qt/IpFikXIj0B0usRmHzPYtnMf7vqg3mXfBWuaFFeDBvgXpV/6VbqVnd2 gHSAyZR66ypzIYcRw37h8EEetF0rpqgq6lKuQAw8Fn1G2grGTW8jRKzECqWB1CdJRdYkzcabydK+Y rRRWkMoA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mT8Do-005484-Px; Wed, 22 Sep 2021 19:48:01 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id E449B3001CD; Wed, 22 Sep 2021 21:47:59 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C86E62D7CF342; Wed, 22 Sep 2021 21:47:59 +0200 (CEST) Date: Wed, 22 Sep 2021 21:47:59 +0200 From: Peter Zijlstra To: "Paul E. McKenney" 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: 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: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.