On 2/9/23 8:24 AM, Jonathan Cameron wrote:
On Mon, 06 Feb 2023 13:51:19 -0700
Dave Jiang <dave.jiang@xxxxxxxxx> wrote:
CXL Memory Device SW Guide rev1.0 2.11.2 provides instruction on how to
caluclate latency and bandwidth for CXL memory device. Calculate minimum
Spell check your descriptions (I often forget to do this as well!
)
bandwidth and total latency for the path from the CXL device to the root
port. The calculates values are stored in the cached DSMAS entries attached
to the cxl_port of the CXL device.
For example for a device that is directly attached to a host bus:
Total Latency = Device Latency (from CDAT) + Dev to Host Bus (HB) Link
Latency
Min Bandwidth = Link Bandwidth between Host Bus and CXL device
For a device that has a switch in between host bus and CXL device:
Total Latency = Device (CDAT) Latency + Dev to Switch Link Latency +
Switch (CDAT) Latency + Switch to HB Link Latency
For QTG purposes, are we also supposed to take into account HB to
system interconnect type latency (or maybe nearest CPU?).
That is likely to be non trivial.
Dan brought this ECN [1] to my attention. We can add this if we can find
a BIOS that implements the ECN. Or should we code a place holder for it
until this is available?
https://lore.kernel.org/linux-cxl/e1a52da9aec90766da5de51b1b839fd95d63a5af.camel@xxxxxxxxx/
Min Bandwidth = min(dev to switch bandwidth, switch to HB bandwidth)
Signed-off-by: Dave Jiang <dave.jiang@xxxxxxxxx>
Stray sign off.
The internal latency for a switch can be retrieved from the CDAT of the
switch PCI device. However, since there's no easy way to retrieve that
right now on Linux, a guesstimated constant is used per switch to simplify
the driver code.
I'd like to see that gap closed asap. I think it is fairly obvious how to do
it, so shouldn't be too hard, just needs a dance to get the DOE for a switch
port using Lukas' updated handling of DOE mailboxes.
Talked to Lukas and this may not be difficult with his latest changes. I
can take a look. Do we support switch CDAT in QEMU yet?
Signed-off-by: Dave Jiang <dave.jiang@xxxxxxxxx>
---
drivers/cxl/core/port.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++
drivers/cxl/cxl.h | 9 +++++++
drivers/cxl/port.c | 42 +++++++++++++++++++++++++++++++++
3 files changed, 111 insertions(+)
diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
index 2b27319cfd42..aa260361ba7d 100644
--- a/drivers/cxl/core/port.c
+++ b/drivers/cxl/core/port.c
@@ -1899,6 +1899,66 @@ bool schedule_cxl_memdev_detach(struct cxl_memdev *cxlmd)
}
EXPORT_SYMBOL_NS_GPL(schedule_cxl_memdev_detach, CXL);
+int cxl_port_get_downstream_qos(struct cxl_port *port, long *bw, long *lat)
+{
+ long total_lat = 0, latency;
Similar to before, not good for readability to hide asignments in a list all on one line.