From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBE26C7115C for ; Wed, 25 Jun 2025 09:13:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 61DFD6B00A2; Wed, 25 Jun 2025 05:13:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F5856B00A3; Wed, 25 Jun 2025 05:13:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 532056B00A8; Wed, 25 Jun 2025 05:13:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 43D2F6B00A2 for ; Wed, 25 Jun 2025 05:13:38 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id F1400106837 for ; Wed, 25 Jun 2025 09:13:37 +0000 (UTC) X-FDA: 83593360074.25.7DDED81 Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) by imf13.hostedemail.com (Postfix) with ESMTP id C614320007 for ; Wed, 25 Jun 2025 09:13:35 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=zytor.com header.s=2025062101 header.b=W+B0I6fa; spf=pass (imf13.hostedemail.com: domain of hpa@zytor.com designates 198.137.202.136 as permitted sender) smtp.mailfrom=hpa@zytor.com; dmarc=pass (policy=none) header.from=zytor.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1750842816; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Q0/RM2kQyckW7LSQ3VeyfPEi1mattHTjXA79SYKL5MQ=; b=Ux7j8i6jS40eIhz4fyvYaIroZGhhN6m7i/pJp5D2rEqhJ0I0RnMp9C63+M27U9B6BRd51h D/pAEI4df39obb8SdqOxRWbqIS0Cl795AYFys4ekYKrWusyAJGPBaNjSzsaF4HZwpVOCu1 +OYZQmwJPr/drLZQaf0w5L8QPA6LXlA= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=zytor.com header.s=2025062101 header.b=W+B0I6fa; spf=pass (imf13.hostedemail.com: domain of hpa@zytor.com designates 198.137.202.136 as permitted sender) smtp.mailfrom=hpa@zytor.com; dmarc=pass (policy=none) header.from=zytor.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1750842816; a=rsa-sha256; cv=none; b=YjuBByh3eAD/Gl9ToBsOkVLziREjQORu+Lb9cnibrOSOXXoQWM32iwTnC7QgT+5HdByOu6 QTnDlXt6fSMgKVoNaha7PZgBZV2A96dImgf0nGbjkK1ovPlUcMAn/AKIc2D5EqTrA+4sz1 Cswd/3CgtSZ1ThI/R/NoOOx541NbzI4= Received: from [127.0.0.1] (c-76-133-66-138.hsd1.ca.comcast.net [76.133.66.138]) (authenticated bits=0) by mail.zytor.com (8.18.1/8.17.1) with ESMTPSA id 55P9CeH61706513 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Wed, 25 Jun 2025 02:12:40 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 55P9CeH61706513 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2025062101; t=1750842761; bh=Q0/RM2kQyckW7LSQ3VeyfPEi1mattHTjXA79SYKL5MQ=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=W+B0I6fat7CBMT8xxv1mOc55VFltc/zjXsP3OwTMiTTZtyf3Fsi+bvE02lJgVO1F2 IuAz3EgL52KsFKV+kBlMfDlHRSSqrMPwCg18mlwvplgdehXFaGUTw6a++Ax4KL2kKw FIQeeDSEq/A0BTqA1La3+DGCze68qT1gBK+gs79Vc2z5CkyhDqmHK7WUQlL7UsHmOp d4ytIvUBcHN0QkrMS5NBIkyc85ZqDXjDMGXTKEDF86V1yqYddYtivujm+OYCDZjVGc u0Wjl5yVuoFGi7OgzLoMZ20RQT2WTKH3AXcxbMIqftnevMQ06REiTtc4pqGPTXnfDk hVKVhJdC3xoFg== Date: Wed, 25 Jun 2025 02:12:39 -0700 From: "H. Peter Anvin" To: Peter Zijlstra , Jonathan Cameron CC: Catalin Marinas , james.morse@arm.com, linux-cxl@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, gregkh@linuxfoundation.org, Will Deacon , Dan Williams , Davidlohr Bueso , Yicong Yang , linuxarm@huawei.com, Yushan Wang , Lorenzo Pieralisi , Mark Rutland , Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, Andy Lutomirski Subject: Re: [PATCH v2 0/8] Cache coherency management subsystem User-Agent: K-9 Mail for Android In-Reply-To: <20250625085204.GC1613200@noisy.programming.kicks-ass.net> References: <20250624154805.66985-1-Jonathan.Cameron@huawei.com> <20250625085204.GC1613200@noisy.programming.kicks-ass.net> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam11 X-Rspam-User: X-Rspamd-Queue-Id: C614320007 X-Stat-Signature: 6s751f4mqk5fdswpramb5b9an5wr4t9d X-HE-Tag: 1750842815-740329 X-HE-Meta: U2FsdGVkX1+qa0DFiaXT+clk9LDjrMpCLXLJQzSabxPUeOeGfrjZv3M2hB9kU8Nabr09GDkLT1+RDeWzeTb4GdvAsOsz8fjq2XivEs2ESFczlYgToCUxc3s53MPaIhRQt/WKhjEK07056PxcE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9FliNSVTme+oohrlsKRmtCS9eLxmIuM+/xnpju1Rcu343WGACv7P5hK4461ovVhogiAqTQSBCHhCT9EWrGQnJ1C2/bF1NUSZPulL3L0V1vDi66u6uoUazC1L4qISfJ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On June 25, 2025 1:52:04 AM PDT, Peter Zijlstra wr= ote: >On Tue, Jun 24, 2025 at 04:47:56PM +0100, Jonathan Cameron wrote: > >> On x86 there is the much loved WBINVD instruction that causes a write b= ack >> and invalidate of all caches in the system=2E It is expensive but it is > >Expensive is not the only problem=2E It actively interferes with things >like Cache-Allocation-Technology (RDT-CAT for the intel folks)=2E Doing >WBINVD utterly destroys the cache subsystem for everybody on the >machine=2E > >> necessary in a few corner cases=2E=20 > >Don't we have things like CLFLUSH/CLFLUSHOPT/CLWB exactly so that we can >avoid doing dumb things like WBINVD ?!? > >> These are cases where the contents of >> Physical Memory may change without any writes from the host=2E Whilst t= here >> are a few reasons this might happen, the one I care about here is when >> we are adding or removing mappings on CXL=2E So typically going from >> there being actual memory at a host Physical Address to nothing there >> (reads as zero, writes dropped) or visa-versa=2E=20 > >> The >> thing that makes it very hard to handle with CPU flushes is that the >> instructions are normally VA based and not guaranteed to reach beyond >> the Point of Coherence or similar=2E You might be able to (ab)use >> various flush operations intended to ensure persistence memory but >> in general they don't work either=2E > >Urgh so this=2E Dan, Dave, are we getting new instructions to deal with >this? I'm really not keen on having WBINVD in active use=2E > WBINVD is the nuclear weapon to use when you have lost all notion of where= the problematic data can be, and amounts to a full reset of the cache syst= em=2E=20 WBINVD can block interrupts for many *milliseconds*, system wide, and so i= s really only useful for once-per-boot type events, like MTRR initializatio= n=2E