Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9525375rwl; Wed, 11 Jan 2023 06:50:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXthMfnyZfFY3fnrxY/arUyo06Ig+d0bZexzimBtSSFhn8LeaQzrwUowGRD9qPV5NBHBSrCx X-Received: by 2002:a17:90b:1987:b0:226:9361:6e92 with SMTP id mv7-20020a17090b198700b0022693616e92mr31742718pjb.3.1673448639754; Wed, 11 Jan 2023 06:50:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673448639; cv=none; d=google.com; s=arc-20160816; b=XznUj4olOcdcHMQxTpwCk+4LC9iCdVSXRrvY8yJFSTzx3m82s1M0+9YLPjECSvlfK5 psxfO5tsWQsJAmOc2yV+j/OYBgqjO7tsrQS/TkecIMGT/neVnvIefhFs2cuukB4ZYNXA ANACwOxN32tCjQx9iyrPoxulx1fhArkaKX9S9C6KndpTllg9XktBNAxKifF0fWtiCWAV zJHabUC6tTSq4p/6FslwYCbxpmw0rn8x8ydVA5fZSuxaIDB+VZTMQwtMbviWXeK89RpO x05UJUPyOCETMHZ9GDaEyQUQT8xjaQGoyWyUxIOS9CKRsyTmKExag00TTIJpIfk/m5SS be3w== 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:feedback-id :dkim-signature:dkim-signature; bh=d7o3kj/Z/vK6V725jjEnUNSDO4G71V9PXMP9Obm3o9M=; b=WUC987I07fmQFxKONJ4qkDdJ0dI72P6qdNWQy5uWFXy8yORxaSdvCjM90DgolhG30d 94nKAPrfR4M5kuhnHjj7BH0SuS1DKcz7PRHthabjS0gSi7ZbCwZkdDU36hiM/B+7JrMg Up0TaIEFXMlU5XrM/6nerRrw/lRVRs8FTGFrwp2cEaFXHuLAYs33+g50syvJ2lQkTdf3 DVXL/Z8q0QOKtQDGv50D5CHtJQ6z7JvzXTEKZCh963oKpesiz8U2s079Hvg1JMFnnW+I nk1W+OXdlO9eqDO95bwllBXVM6UqIYpQcSIbfb6aK5YFQraKOCzCkPGUFhnWTb3ZIrp8 IYdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov.name header.s=fm1 header.b=BIBP0klk; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=WEISMpVy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oc3-20020a17090b1c0300b002271d025b69si7422615pjb.172.2023.01.11.06.50.33; Wed, 11 Jan 2023 06:50:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@shutemov.name header.s=fm1 header.b=BIBP0klk; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=WEISMpVy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238781AbjAKOPT (ORCPT + 53 others); Wed, 11 Jan 2023 09:15:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238467AbjAKOPH (ORCPT ); Wed, 11 Jan 2023 09:15:07 -0500 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE34918690 for ; Wed, 11 Jan 2023 06:15:05 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 85C315C01BD; Wed, 11 Jan 2023 09:15:04 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 11 Jan 2023 09:15:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1673446504; x=1673532904; bh=d7 o3kj/Z/vK6V725jjEnUNSDO4G71V9PXMP9Obm3o9M=; b=BIBP0klkoRyawjatsO AHvzRWMjsOBzYHjzWRyVjft3peKFivD3em4OKL4nJEoaxnXIIesdzTdkklwCRqxz T2zX6osIT8LYDsp01viXrHe87sgNjGzIDB5HdZrkebdAbUX3rLjG7a5q8GTL+Hj1 AT30h0moP6fGfucn/1cLOTQhaMxQiA2NdGk/sJKUpqR34Ccb1cAfQ90BBq0/9uMl ai96qkrUYfXEuZa2vy0pqD2FM2yoMJ+zmx1rCQ9pIZHmWrZl/lumbDVaVfE0Kxi7 eowGxF9xS4yKTEAGFXTxWJmshrG5xt8rznCjQhD46sbXq5Y7L+i8hUZ3uDlXZ/HA 3v1A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1673446504; x=1673532904; bh=d7o3kj/Z/vK6V725jjEnUNSDO4G7 1V9PXMP9Obm3o9M=; b=WEISMpVytYlaMYfejIvTKo2aTBvvJmU+AG/y83yE7Vaa o74pBAens5T71FO91s9aqU3laRruA/dEFjBt8+RTMbY5pT6YzfPEW9jEmihGvkxQ xH2U7fLSoZd7AHf6UCIO+frsOZiuixWz6n2jtp5/vEE968vmHB3tNLqZBOEV50i6 VDYlPepDCAKPjOjDuoGy5qNCltb2NW0O5G0oK9byTllLzjtBbPEROiZ8Lp+s1v30 Wji/YCxQRDsEFCdZivBi6WHyg2y6k7jAmJRwrgwJbajrVAooDOJxxkJatvVGkT1a iw+/HL/9F7rvnOc8ztbhYLBxuj+TqU42dNnzmFqtjw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrleeggdeivdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehttddttddttddvnecuhfhrohhmpedfmfhirhhi lhhlucetrdcuufhhuhhtvghmohhvfdcuoehkihhrihhllhesshhhuhhtvghmohhvrdhnrg hmvgeqnecuggftrfgrthhtvghrnhephfeigefhtdefhedtfedthefghedutddvueehtedt tdehjeeukeejgeeuiedvkedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepkhhirhhilhhlsehshhhuthgvmhhovhdrnhgrmhgv X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 11 Jan 2023 09:15:03 -0500 (EST) Received: by box.shutemov.name (Postfix, from userid 1000) id A4689104377; Wed, 11 Jan 2023 17:14:59 +0300 (+03) Date: Wed, 11 Jan 2023 17:14:59 +0300 From: "Kirill A. Shutemov" To: Linus Torvalds Cc: "Kirill A. Shutemov" , Dave Hansen , Andy Lutomirski , Peter Zijlstra , the arch/x86 maintainers , Kostya Serebryany , Andrey Ryabinin , Andrey Konovalov , Alexander Potapenko , Taras Madan , Dmitry Vyukov , "H . J . Lu" , Andi Kleen , Rick Edgecombe , Bharata B Rao , Jacob Pan , Ashok Raj , Linux-MM , Linux Kernel Mailing List Subject: Re: [PATCHv14 04/17] x86/mm: Handle LAM on context switch Message-ID: <20230111141459.ah7ijfbm733c4g7m@box.shutemov.name> References: <20230111123736.20025-1-kirill.shutemov@linux.intel.com> <20230111123736.20025-5-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 11, 2023 at 07:49:30AM -0600, Linus Torvalds wrote: > Sorry, I'm traveling, and right now only on mobile. So I'm reading patches > on my phone, and answering on it too, so html garbage.. > > On Wed, Jan 11, 2023, 07:24 Kirill A. Shutemov < > kirill.shutemov@linux.intel.com> wrote: > > > > > +static inline unsigned long mm_lam_cr3_mask(struct mm_struct *mm) > > +{ > > + return READ_ONCE(mm->context.lam_cr3_mask); > > +} > > > > I mentioned this before - in the original version this needed (but didn't > have, iirc) that READ_ONCE, but in the new non-thread situation I don't > think that's true. There should be no concurrent changes that can interfere > with the read, no? It should be safe, yes. It is reachable from iommu_sva_bind_device(), but it only called with mm == current->mm. I will drop the READ_ONCE(). -- Kiryl Shutsemau / Kirill A. Shutemov