Bug 265786 - broadcom storage controller: bus_dmamap_load_ccb() is failing with EINPROGRESS for 1MB IOs
Summary: broadcom storage controller: bus_dmamap_load_ccb() is failing with EINPROGRES...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.1-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-12 08:05 UTC by Chandrakanth Patil
Modified: 2022-10-13 08:41 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chandrakanth Patil 2022-08-12 08:05:38 UTC
We are seeing the issue in bus_dmamap_load_ccb() function in the case of 1MB IOs. 
It seems, that IO mapping to DMA mem is taking more time so bus_dmamap_load_ccb is returning EINPROGRESS (error no: 36) more frequently. the DMA attributes passed are below while creating the tag:
1. maxsize: 1MB
2. nsegments: 256
3. maxsegsz: 1MB

I have seen in some of the FreeBSD BZ that warner losh has suggested the workaround for this by increasing the hw.maxphys in /boot/loader.conf. I have tried the same and it will fix our issue. but the issue was reported on 13.0 and the fix was supposed to be part of 13.1 but I am still seeing it.
Comment 1 Warner Losh freebsd_committer freebsd_triage 2022-08-12 14:56:30 UTC
First, EINPROGRESS means that the transaction has been deferred either because the bounce pages it needs to allocate the memory backing the DMA isn't available (which I don't think is in play, but might be if there's a maximum address constraint for the dmamap) or there's not enough iommu contexts available to do the I/O.

I'm having trouble recalling the exact context for my suggestion or the comment that the fix should be in 13.1. Can you refresh my recollection on that?
Comment 2 Chandrakanth Patil 2022-10-13 08:41:19 UTC
(In reply to Warner Losh from comment #1)

Hi warner,

Below is the Bug ID link where you mentioned that increasing the maxphys will resolve the issue: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240145

Couple of queries I have on your response:

1. when bus_dmamap_load_ccb() returns "EINPROGRESS" does it 
   mean DMA memory allocation is failing due to the unavailability of DMA memory 
   and what course of action the driver should take after this. do we need to 
   return those IOs with specific error codes? so that those IOs could be re- 
   tried.

2. Does it mean FreeBSD doesn't support 1MB IOs? in that do we need to reduce the 
   max transfer size to < 1MB? if yes, then what could be the correct max IO size     


NOTE: hardware supports a max transfer size of 1MB