Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add async save/load file ability. #253

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

cyber-pc
Copy link
Collaborator

@cyber-pc cyber-pc commented Dec 26, 2024

Purpose

The save/load file functionality does not work on the Application Processor (AP - non-main thread), even with resource locking. It can only operate on the Boot Strap Processor (BS - main thread).
This PR introduces the capability to save/load files on non-main threads by offloading the actual operations to the main thread.

Detail: https://github.com/orgs/qubic/projects/1?pane=issue&itemId=85821090

Design Features

  • AsyncLoadFile (AsyncLoadLargeFile): Can be called from any thread to load a file. This is a blocking call until the load is complete.
  • AsyncSaveFile (AsyncSaveLargeFile): Can be called from any thread to save a file. This can be either a blocking or non-blocking call.
  • flushAsyncFileIOBuffer: this function performs the save/load operations and also releases the blocking calls of the above two functions.

How to use

  • Initialize the file system with the additional EFI_MP_SERVICES_PROTOCOL* using initFilesystem(pServiceProtocol).
  • Call AsyncLoadFile, AsyncLoadLargeFile, AsyncSaveFile, or AsyncSaveLargeFile with or without blocking flags, depending on the purpose.
  • On main thread must frequently call flushAsyncFileIOBuffer.
  • After done, need to call deInitFileSystem

Test. [UPDATED]

  • Unit-test implementation
  • An standalone UEFI testing for all functions is implemented in https://github.com/cyber-pc/qubic-core/tree/cyber-pc/uefi-file
  • testnet run successfully with this PR
  • testnet run successfully with this PR + enable async save file (keep the same logic with current master, and use async file io to repicate the behavior) and all files matched

Next Step

  • For file IO on multiple-process, encourage to use the new asyncFileIO.
  • For file IO on main process, can use the normal version.

- All save/load operation will happen in main thread
- Support blocking save/load and non-blocking save
- Add test for async save load
@philippwerner philippwerner linked an issue Jan 8, 2025 that may be closed by this pull request
@cyber-pc
Copy link
Collaborator Author

@philippwerner @Franziska-Mueller This PR is ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

researching a method to write to disk in parallel
1 participant