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 91747C83F17 for ; Thu, 10 Jul 2025 18:56:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B9986B0095; Thu, 10 Jul 2025 14:56:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 091EB6B0099; Thu, 10 Jul 2025 14:56:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE97A6B009A; Thu, 10 Jul 2025 14:56:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id DB9CD6B0095 for ; Thu, 10 Jul 2025 14:56:22 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 918FA5D2FE for ; Thu, 10 Jul 2025 18:56:22 +0000 (UTC) X-FDA: 83649260604.27.3ABD14A Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) by imf10.hostedemail.com (Postfix) with ESMTP id B23B1C000C for ; Thu, 10 Jul 2025 18:56:20 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=zytor.com header.s=2025062101 header.b=frt+T+Za; dmarc=pass (policy=none) header.from=zytor.com; spf=pass (imf10.hostedemail.com: domain of hpa@zytor.com designates 198.137.202.136 as permitted sender) smtp.mailfrom=hpa@zytor.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752173781; 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=VHHMCaeqa3ItN0IdhB57c8hhMJMuVoReCsE7UCNIal4=; b=e8UuQkff2VDnmUKPhaa2SmrP/yN+ednei8G+EK4yi5hM/4UJtLu0boI+K0m8821FonOY6r An/BVScjuE1Uw3i7EyI+DRvwKY2tgOp6Mu8wtBYEMGXXX5P09O2LG1eDcVtxkffzxnQKaP NB/9gBhQ2xzaze0o2zdq7r/1+mOUfaw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752173781; a=rsa-sha256; cv=none; b=OCFhqNksV3kmnsnuIstWFN9m83Bv+oyaweM5lPYHA6Lm8Lf1RLIaOENrGs6Xoi81ggQBqX BOuwGKV9f5saQhHk5ov+4TUh3kiiuhL8Y2QZk4/+Qjy+YRuVA7Uyo8fF92kDxESSj0ngPG DOVWxMUMr83QQLNbuxtMT5gkyW9H/+U= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=zytor.com header.s=2025062101 header.b=frt+T+Za; dmarc=pass (policy=none) header.from=zytor.com; spf=pass (imf10.hostedemail.com: domain of hpa@zytor.com designates 198.137.202.136 as permitted sender) smtp.mailfrom=hpa@zytor.com 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 56AItXe4768856 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Thu, 10 Jul 2025 11:55:34 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 56AItXe4768856 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2025062101; t=1752173735; bh=VHHMCaeqa3ItN0IdhB57c8hhMJMuVoReCsE7UCNIal4=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=frt+T+ZaeHOU5+grV1JCbpKos7M5bBqjph3654o1y7phYKwQfJ56+GDy8KNryK8B9 XF2XuNuAABlhHhXW6fYJQLupzUof4nSKjKrhEjsEL35qhyfZVmkeQZVTH89pnSOq+U kBtp64m7He32K7XBQnvn/+b2ktp+IKWKSyCA0ity2XZp1oE453fLiVLHeHJcG4u0q4 0G//nuisw6F0H9abazQkXmJZxXo+Sa2Lnk8gPh0vCepk2mHF2Uw2+NhXZh3+A/cCO6 uFIYPUSkQ8VouPb6FPWHZ2tDFL2g//rbNfp9FYNLkTeM5fCaiDsWlNrZNlmTJ0g1D0 XYwyrqszcEIDg== Date: Thu, 10 Jul 2025 11:55:33 -0700 From: "H. Peter Anvin" To: dan.j.williams@intel.com, Peter Zijlstra CC: Jonathan Cameron , 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 , 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: <68700a5428a2f_1d3d1008b@dwillia2-xfh.jf.intel.com.notmuch> References: <20250624154805.66985-1-Jonathan.Cameron@huawei.com> <20250625085204.GC1613200@noisy.programming.kicks-ass.net> <20250625093152.GZ1613376@noisy.programming.kicks-ass.net> <686f4e20c57cd_1d3d100b7@dwillia2-xfh.jf.intel.com.notmuch> <20250710105622.GA542000@noisy.programming.kicks-ass.net> <68700a5428a2f_1d3d1008b@dwillia2-xfh.jf.intel.com.notmuch> Message-ID: <575B5DF2-AE1D-43E9-9A4B-09FB78EFFC43@zytor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Queue-Id: B23B1C000C X-Rspamd-Server: rspam03 X-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.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 July 10, 2025 11:45:40 AM PDT, dan=2Ej=2Ewilliams@intel=2Ecom wrote: >Peter Zijlstra wrote: >> On Wed, Jul 09, 2025 at 10:22:40PM -0700, dan=2Ej=2Ewilliams@intel=2Eco= m wrote: >>=20 >> > "Regular?", no=2E Something is wrong if you are doing this regularly= =2E In >> > current CXL systems the expectation is to suffer a WBINVD event once = per >> > server provisioning event=2E >>=20 >> Ok, so how about we strictly track this once, and when it happens more >> than this once, we error out hard? >>=20 >> > Now, there is a nascent capability called "Dynamic Capacity Devices" >> > (DCD) where the CXL configuration is able to change at runtime with >> > multiple hosts sharing a pool of memory=2E Each time the physical mem= ory >> > capacity changes, cache management is needed=2E >> >=20 >> > For DCD, I think the negative effects of WBINVD are a *useful* stick = to >> > move device vendors to stop relying on software to solve this problem= =2E >> > They can implement an existing CXL protocol where the device tells CP= Us >> > and other CXL=2Ecache agents to invalidate the physical address range= s >> > that the device owns=2E >> >=20 >> > In other words, if WBINVD makes DCD inviable that is a useful outcome >> > because it motivates unburdening Linux long term with this problem=2E >>=20 >> Per the above, I suggest we not support this feature *AT*ALL* until an >> alternative to WBINVD is provided=2E >>=20 >> > In the near term though, current CXL platforms that do not support >> > device-initiated-invalidate still need coarse cache management for th= at >> > original infrequent provisioning events=2E Folks that want to go furt= her >> > and attempt frequent DCD events with WBINVD get to keep all the piece= s=2E >>=20 >> I would strongly prefer those pieces to include WARNs and or worse=2E > >That is fair=2E It is not productive for the CXL subsystem to sit back an= d >hope that people notice the destructive side-effects of wbinvd and hope >that leads to device changes=2E > >This discussion has me reconsidering that yes, it would indeed be better >to clflushopt loop over potentially terabytes on all CPUs=2E That should >only be suffered rarely for the provisioning case, and for the DCD case >the potential add/remove events should be more manageable=2E > >drm already has drm_clflush_pages() for bulk cache management, CXL >should just align on that approach=2E Let's not be flippant; looping over terabytes could take *hours*=2E But th= ose are hours during which the system is alive, and only one CPU needs to b= e looping=2E The other question is: what happens if memory is unplugged and then a cach= e line evicted? I'm guessing that existing memory hotplug solutions simply = drop the writeback, since the OS knows there is no valid memory there, and = so any cached data is inherently worthless=2E