Hi Kevin,
We conducted a test in our legacy KEXT environment, and the results indicate a behavioral difference between the KEXT and DriverKit frameworks in handling I/O requests.
Test Scenario (KEXT Environment):
We executed a 10MB raw I/O write command to an rdisk node:
sudo dd if=/dev/zero of=/dev/rdisk7 bs=10m count=1
Observations:
This command is a single 10MB write request. Our KEXT logs show that the driver did not receive one 10MB request, but instead received 20 sequential WRITE(10) commands.
Upon analysis, we confirmed that the size of each request was 512KB.
Evidence 1: DataLength
The DataLength for each request in the log is 0x00080000, which is 524,288 bytes (512KB).
Evidence 2: CDB Content
In the CDB of the first request, the transfer length is 0x0400 blocks (1024 blocks). 1024 blocks * 512 bytes/block = 512KB.
The LBAs of subsequent requests were sequential (LBA 0, LBA 1024, LBA 2048, ...).
Partial log for reference:
[AME_DAS_SCSI_Prepare] --- [KEXT FINAL DUMP] AME_SCSI_REQUEST_DAS packet for BufferID 46 ---
[AME_DAS_SCSI_Prepare] Opcode (from CDB[0]): 0x2a (WRITE (10))
[AME_DAS_SCSI_Prepare] CDB (hex): 2a 00 00 00 00 00 00 04 00 00
[AME_DAS_SCSI_Prepare] DataLength: 0x00080000
...
[AME_DAS_SCSI_Prepare] --- [KEXT FINAL DUMP] AME_SCSI_REQUEST_DAS packet for BufferID 47 ---
[AME_DAS_SCSI_Prepare] Opcode (from CDB[0]): 0x2a (WRITE (10))
[AME_DAS_SCSI_Prepare] CDB (hex): 2a 00 00 00 04 00 00 04 00 00
[AME_DAS_SCSI_Prepare] DataLength: 0x00080000
Our Conclusion:
This test shows that in the KEXT environment, the I/O Kit storage stack splits a large raw I/O request that exceeds an internal limit into multiple smaller chunks (512KB in this case) before sending them to the driver.
This is different from the behavior we observed in our DEXT. In the DEXT, after we declared a maxTransferSize of 64KB via UserGetDMASpecification, any rdisk request larger than this limit is rejected by the framework, not split.
Our Updated Questions:
Is this behavior in DriverKit an intentional design change?
Is the request-splitting functionality of I/O Kit no longer a part of the DriverKit framework, with the expectation that DEXT developers should now implement the logic for splitting large raw I/O requests?
Thank you for your clarification.
Best,
Charles
Topic:
App & System Services
SubTopic:
Drivers
Tags: