From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-185.mta0.migadu.com (out-185.mta0.migadu.com [91.218.175.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E191731355D for ; Thu, 18 Jun 2026 16:40:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.185 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781800857; cv=none; b=GVHr+ektxJQjExCtuu40/Go1Y3CcfCJ1jBIguA1rL4Xd7oF+eRGu5bM0QAUURz7se0ZZEsxIuOBVfqwcfZmNUGVYuiZOSicWmxEQLztTXcYq+esxgC2AU9fP1+WQ5gSX7F0tM5jJldjcv1uV7I6Q47zWBe+Lc/DI584YrZI9oEE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781800857; c=relaxed/simple; bh=fdzv9PGawQ0A6K5vAV416Mg2fBoCe17ESqoc+127I5A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WYci+DI6/tafRY2zxxuSDzRr0gUBzEz5Fpvqz1nSdTiHInjta/D3vN19GSf2OZcHerH3Ah1h+TiQadG4ac0g93fZU0KDPNIo61sOP9DFP6HJ2Dmo0/HRpdPArIsknPcG4nenpwydnArrkf31hemrmVRBuxNS6uZCtQzVjraWZbY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=YRN/MCBg; arc=none smtp.client-ip=91.218.175.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="YRN/MCBg" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1781800852; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xeiijMLpLKaaOkBdp35eM6zjfD+uzItWtXaFrZwEr/A=; b=YRN/MCBgQjjjy+x0E2HVms6+4UopRfdKkRjbBBd6raI83Ir4b0lNXN6gwHsucVI50zBlsY ui/ezbdRaiIBRz5V6y5LEvG4vT8e2PVUVtQtOUToeND8UuUp6XHPPBr3J1Zvy0p3QgLzJM w4Ep695ahAYnUkrvERLu5oC9iUgO3Gc= From: Usama Arif To: Rik van Riel Cc: Usama Arif , linux-kernel@vger.kernel.org, x86@kernel.org, linux-mm@kvack.org, "Thomas Gleixner" , "Ingo Molnar" , "Dmitry Ilvokhin" , "Borislav Petkov" , "Dave Hansen" , "Andrew Morton" , "David Hildenbrand" , "Lorenzo Stoakes" , "Liam R. Howlett" , "Vlastimil Babka" , "Suren Baghdasaryan" Subject: Re: [PATCH 1/3] x86/mm: use READ_ONCE/WRITE_ONCE for mm->context.untag_mask Date: Thu, 18 Jun 2026 09:40:42 -0700 Message-ID: <20260618164043.784764-1-usama.arif@linux.dev> In-Reply-To: <20260616190300.1509639-2-riel@surriel.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On Tue, 16 Jun 2026 15:02:58 -0400 Rik van Riel wrote: > mm->context.untag_mask is written once, when LAM is enabled > (mm_enable_lam(), under mmap_write_lock and while the process is still > single-threaded), and is otherwise stable and never reverted. > untagged_addr_remote() reads it for a remote mm, and the new > untagged_addr_remote_unlocked() (used by the per-VMA-lock > access_remote_vm() fast path) reads it without the mmap lock. > > The field is a single aligned word and cannot tear, but annotate the > reads and writes with READ_ONCE()/WRITE_ONCE() to make the lockless > access explicit and keep the compiler from reloading or tearing it. > > No functional change. > > Assisted-by: Claude:claude-opus-4-8 > Signed-off-by: Rik van Riel > --- > arch/x86/include/asm/mmu_context.h | 6 +++--- > arch/x86/include/asm/uaccess_64.h | 2 +- > arch/x86/kernel/process_64.c | 2 +- > 3 files changed, 5 insertions(+), 5 deletions(-) > Acked-by: Usama Arif