> 
> [Severity: Medium]
> Should bo.sg_table(pdev) only be called when map_wc is true?
> 
> When map_wc is false (for example with DRM_PANTHOR_BO_WB_MMAP), calling
> bo.sg_table(pdev) here eagerly pins all backing pages and runs
> dma_map_sgtable() at BO creation time even though CPU accesses use cached
> mappings.  Because shmem::Object::sg_table() caches the result in a SetOnce,

Yeah, I’d rather favor uniformity. In any case, this cost would be paid for as
soon as you bind the BO. So moving this cost to creation time doesn’t really
change much.

> consuming that one-shot dma_map_sgtable() call before userspace writes to
> the write-back mapping also means the later sg_table() call in
> GpuVmData::sm_step_map() during VM_BIND returns the cached table without
> flushing dirty CPU cache lines.

The whole point is that the initial flush happens during creation instead.
Any other flushes need to be done by userspace, either through the platform's
ISA (i.e.: DC CIVAC) or through the BO_SYNC ioctl, which ultimately boils down
to platform-specific code too.

— Daniel

Reply via email to