]> git.itanic.dy.fi Git - linux-stable/commit
cxl/region: Move cache invalidation before region teardown, and before setup
authorDan Williams <dan.j.williams@intel.com>
Sat, 17 Jun 2023 01:24:28 +0000 (18:24 -0700)
committerDan Williams <dan.j.williams@intel.com>
Sun, 25 Jun 2023 20:45:40 +0000 (13:45 -0700)
commitd1257d098a5a38753a0736a50db0a26a62377ad7
tree06246d4de796183e8c45f0c60ec8ac970a3d4c35
parent858fd168a95c5b9669aac8db6c14a9aeab446375
cxl/region: Move cache invalidation before region teardown, and before setup

Vikram raised a concern with the theoretical case of a CPU sending
MemClnEvict to a device that is not prepared to receive. MemClnEvict is
a message that is sent after a CPU has taken ownership of a cacheline
from accelerator memory (HDM-DB). In the case of hotplug or HDM decoder
reconfiguration it is possible that the CPU is holding old contents for
a new device that has taken over the physical address range being cached
by the CPU.

To avoid this scenario, invalidate caches prior to tearing down an HDM
decoder configuration.

Now, this poses another problem that it is possible for something to
speculate into that space while the decode configuration is still up, so
to close that gap also invalidate prior to establish new contents behind
a given physical address range.

With this change the cache invalidation is now explicit and need not be
checked in cxl_region_probe(), and that obviates the need for
CXL_REGION_F_INCOHERENT.

Cc: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Fixes: d18bc74aced6 ("cxl/region: Manage CPU caches relative to DPA invalidation events")
Reported-by: Vikram Sethi <vsethi@nvidia.com>
Closes: http://lore.kernel.org/r/BYAPR12MB33364B5EB908BF7239BB996BBD53A@BYAPR12MB3336.namprd12.prod.outlook.com
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/168696506886.3590522.4597053660991916591.stgit@dwillia2-xfh.jf.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/core/region.c
drivers/cxl/cxl.h