-
Notifications
You must be signed in to change notification settings - Fork 25
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
Feature: Reintroduce tapasco-debug
with new interface in Rust
#290
Feature: Reintroduce tapasco-debug
with new interface in Rust
#290
Conversation
Thanks for starting this. For reference: You can use the new API introduced in #279 to access platform memory: tapasco/runtime/libtapasco/src/device.rs Line 618 in 50ed109
This is needed for e.g. DMA and Interrupt status registers. |
Thanks, I will have a look into this. |
// Allocate the first device with ID 0 (because most devices will only have one FPGA) | ||
let mut tlkm_device = tlkm.device_alloc(0, &HashMap::new()).context(TLKMInit {})?; | ||
// Change device access to excluse to be able to acquire PEs | ||
tlkm_device.change_access(tapasco::tlkm::tlkm_access::TlkmAccessExclusive).context(DeviceInit {})?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be an issue as you cannot run any other tapasco software requiring exclusive access while running tapasco-debug this way.
You might want to change your "acquire_pe_without_job" to return a read-only version of the PE which does not require exclusive access.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I wanted to discuss this anyway, so I've split it into a separate commit. Thank you for bringing it up directly.
I'm not sure how to resolve this in the end but I think in order to set register values (which is not implemented at the moment) there should be exclusive access. If someone wants to observe another Tapasco application there could be a read-only mode of tapasco-debug
where you cannot set the values but run with other software side-by-side.
What do you think about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to have ´tapasco-debug´ ignore all of the scheduler etc and go entirely with debug functionality. This could look like the functions I've prepared for this purpose for the platform part at
tapasco/runtime/libtapasco/src/device.rs
Line 618 in 50ed109
pub fn get_available_platform_components(&self) -> Vec<String> { |
For the Arch part we'd only need two functions, e.g.:
pub fn get_available_pes(&self) -> Vec<(Id, PEId)> {}
pub fn get_pe(&self, read_only: bool) -> PE {}
For those we can have a read-only version which does not require exclusive access, and a full access version. Tapasco-debug can then have e.g. three modes
- Default: Monitor mode -> read only
- Full Access -> requires exclusive
- Forced Full Access -> Works with monitor mode but provides full access, all safety is off
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me. I'm going to talk about it with @cahz later and see what his opinion is on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are now three modes: Monitor, Debug and Unsafe. But they don't work correctly yet. See:
#296
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have now disabled the debug mode again and added a comment for #296.
1a55414
to
1dbf30e
Compare
13b7fa5
to
b5b3e02
Compare
b5b3e02
to
9e706fe
Compare
9e706fe
to
873ae73
Compare
This is the first commit for a work-in-progress effort on Issue esa-tu-darmstadt#264. Since `tapasco-debug` was removed in the v2020.10 release because the ncurses-based UI was "quite flaky" you had to use two different Tapasco workspaces to have the debugger still around while using the recent Tapasco version. This reimplementation of `tapasco-debug` is written in Rust and uses the `libtui-rs` and `crossterm` crates for the terminal user interface along with the new Tapasco runtime. For the moment it provides a list of PEs which can be selected to see the first 16 argument registers along with some generic bitstream and platform information. Writing to argument registers, starting PEs, dumping Local Memory is not possible yet. To integrate it into the build process of this repository it uses the same mechanism to build using Cargo from CMake as PR esa-tu-darmstadt#285.
This is a necessary change for `tapasco-debug` to be able to acquire a PE in order to call its methods instead of directly starting a job on that PE as it is usually the case.
In order to implement a Monitor Mode where values can only be observed in `tapasco-debug` the function in `libtapasco` which is used to acquire PEs is modified to return non-mutable PE structs which do not need exclusive access to the device.
As discussed in the respective PR esa-tu-darmstadt#290 (esa-tu-darmstadt#290) there are now three differenct access modes: Monitor, Debug, Unsafe. This commit introduces command-line subcommands to choose the mode in which to operate. In `Monitor` mode nothing can be modified only another runtime can be monitored. In `Debug` Mode the argument registers can also be set interactively. In `Unsafe` Mode the only difference to `Debug` Mode is that the driver is released, so another host application can run in parallel.
- Adds unsafe method to directly access platform component memory - Simplifies usage of platform components with interrupts if they follow the TaPaSCo PE conventions - NOTE: Does not return a Job as most operations such as memory copy does not make sense for most platform components
from the cherry-picked commit from PR esa-tu-darmstadt#279: 03d717e This requires the App state to hold the device for the reference which makes unsafe mode effectively debug mode. But this is not a problem because debug mode is in reality unsafe mode as long as the exclusive access is not working correctly.
when parsing the timestamp of the bitstream generation.
to make it unsafe again.
by removing unnecessary folders.
Also leave some instructions on how to enable it again. Debug mode is currently the same as unsafe mode due to libtapasco not handling this case of access mode. Additionally, the DMA Buffers, Interrupts, etc. are also allocated in Monitor Mode which leads to the problem that you have to start your other runtime twice. For this case I've added a comment in the help section of `tapasco-debug`.
Write the 1 to start the PE directly to the appropriate address in the mapped memory. Using `libtapasco`'s API function to start a PE is not possible because ownership of the `PE` struct has already been taken and cannot be stolen back in the starting function.
that are necessary for `tapasco-debug` but break up the usually wanted encapsulation of `libtapasco`, so they are guarded behind conditional compilation if the non-default feature is activated.
TryInto is now in the prelude of the 2021 edition.
Replace unnecessary `StatefulList`s with `ListStates`. Make the number of registers and the size of local memory endless.
873ae73
to
7c59523
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! This will make many users happy :-)
I do hope so! :) |
Closes #264