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

Feature: Reintroduce tapasco-debug with new interface in Rust #290

Merged

Conversation

zyno42
Copy link
Contributor

@zyno42 zyno42 commented Jul 5, 2021

Closes #264

@jahofmann
Copy link
Contributor

Thanks for starting this.

For reference: You can use the new API introduced in #279 to access platform memory:

pub fn get_available_platform_components(&self) -> Vec<String> {

This is needed for e.g. DMA and Interrupt status registers.

@zyno42
Copy link
Contributor Author

zyno42 commented Jul 5, 2021

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 {})?;
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

@jahofmann jahofmann Jul 5, 2021

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

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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.

@zyno42 zyno42 force-pushed the feature/reintroduce-tapasco-debug branch from 1a55414 to 1dbf30e Compare July 5, 2021 13:38
@zyno42 zyno42 marked this pull request as ready for review September 6, 2021 15:33
@zyno42 zyno42 force-pushed the feature/reintroduce-tapasco-debug branch from 13b7fa5 to b5b3e02 Compare March 14, 2022 20:41
@zyno42 zyno42 force-pushed the feature/reintroduce-tapasco-debug branch from b5b3e02 to 9e706fe Compare March 14, 2022 20:54
@zyno42 zyno42 force-pushed the feature/reintroduce-tapasco-debug branch from 9e706fe to 873ae73 Compare March 18, 2022 11:06
zyno42 and others added 17 commits March 18, 2022 12:07
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.
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.
@zyno42 zyno42 force-pushed the feature/reintroduce-tapasco-debug branch from 873ae73 to 7c59523 Compare March 18, 2022 11:08
Copy link
Member

@cahz cahz left a 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 :-)

@cahz cahz merged commit ffc11ee into esa-tu-darmstadt:develop Mar 18, 2022
@zyno42
Copy link
Contributor Author

zyno42 commented Mar 18, 2022

I do hope so! :)

@zyno42 zyno42 deleted the feature/reintroduce-tapasco-debug branch March 18, 2022 11:46
@cahz cahz added this to the 2022.1 milestone May 3, 2022
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.

None yet

3 participants