Skip to content

Conversation

ShadowCurse
Copy link
Contributor

@ShadowCurse ShadowCurse commented Sep 13, 2024

Changes

Enabled ftrace feature in guest kernels. This will help us to debug problems in the future.
Additionally we need to disable CONFIG_ARM64_ERRATUM_3194386 in aarch64 guest configs as this option hides ssbs feature from the guest user space and this breaks our integration test that verifies these features. The option itself was added in recent kernel versions and is intended for Cortex-X4 and Neoverse-V3 cpus, and we are not using those. Link: https://lore.kernel.org/stable/[email protected]/

Reason

Improve future debug-ability.

Examples:

root@ubuntu-fc-uvm:~# trace-cmd record -p function_graph -l 'hrtimer_*' -l 'lapic_*' -l 'wrmsr*'
...
root@ubuntu-fc-uvm:~# trace-cmd report
cpus=2
          <idle>-0     [001]   185.577231: funcgraph_entry:        1.040 us   |  hrtimer_get_next_event();
          <idle>-0     [001]   185.577234: funcgraph_entry:                   |  hrtimer_start_range_ns() {
          <idle>-0     [001]   185.577234: funcgraph_entry:                   |    hrtimer_force_reprogram() {
          <idle>-0     [001]   185.577235: funcgraph_entry:        3.120 us   |      lapic_next_deadline();
          <idle>-0     [001]   185.577238: funcgraph_exit:         3.910 us   |    }
          <idle>-0     [001]   185.577238: funcgraph_exit:         4.880 us   |  }
       trace-cmd-934   [000]   185.577401: funcgraph_entry:                   |  hrtimer_nanosleep() {
       trace-cmd-934   [000]   185.577401: funcgraph_entry:        0.300 us   |    hrtimer_init_sleeper();
       trace-cmd-934   [000]   185.577402: funcgraph_entry:        0.900 us   |    hrtimer_start_range_ns();
          <idle>-0     [000]   185.577850: funcgraph_entry:                   |  hrtimer_interrupt() {
          <idle>-0     [000]   185.577851: funcgraph_entry:        0.230 us   |    hrtimer_run_queues();
          <idle>-0     [000]   185.577852: funcgraph_entry:        0.210 us   |    hrtimer_forward();
          <idle>-0     [000]   185.577853: funcgraph_entry:        1.960 us   |    lapic_next_deadline();
          <idle>-0     [000]   185.577855: funcgraph_exit:         5.550 us   |  }
          <idle>-0     [001]   185.577870: funcgraph_entry:                   |  hrtimer_cancel() {
          <idle>-0     [001]   185.577870: funcgraph_entry:        0.250 us   |    hrtimer_active();
          <idle>-0     [001]   185.577871: funcgraph_entry:        0.370 us   |    hrtimer_try_to_cancel.part.0();
          <idle>-0     [001]   185.577871: funcgraph_exit:         1.880 us   |  }
          <idle>-0     [001]   185.577871: funcgraph_entry:        0.200 us   |  hrtimer_forward();
          <idle>-0     [001]   185.577872: funcgraph_entry:                   |  hrtimer_start_range_ns() {
          <idle>-0     [001]   185.577872: funcgraph_entry:                   |    hrtimer_reprogram() {
          <idle>-0     [001]   185.577872: funcgraph_entry:        2.030 us   |      lapic_next_deadline();
          <idle>-0     [001]   185.577875: funcgraph_exit:         2.560 us   |    }
          <idle>-0     [001]   185.577875: funcgraph_exit:         3.100 us   |  }

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.

PR Checklist

  • If a specific issue led to this PR, this PR closes the issue.
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this
    PR.
  • API changes follow the Runbook for Firecracker API changes.
  • User-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.
  • New TODOs link to an issue.
  • Commits meet
    contribution quality standards.

  • This functionality cannot be added in rust-vmm.

@ShadowCurse ShadowCurse changed the title Enabled ftrace in guest kernels Enable ftrace in guest kernels Sep 13, 2024
@ShadowCurse ShadowCurse marked this pull request as ready for review September 13, 2024 12:48
@ShadowCurse ShadowCurse added Status: Awaiting review Indicates that a pull request is ready to be reviewed Type: Enhancement Indicates new feature requests labels Sep 13, 2024
@ShadowCurse ShadowCurse requested review from kalyazin, pb8o and roypat and removed request for roypat September 13, 2024 12:56
Copy link

codecov bot commented Sep 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.32%. Comparing base (9104425) to head (2e878b7).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4801   +/-   ##
=======================================
  Coverage   84.32%   84.32%           
=======================================
  Files         249      249           
  Lines       27521    27521           
=======================================
  Hits        23206    23206           
  Misses       4315     4315           
Flag Coverage Δ
5.10-c5n.metal 84.54% <ø> (ø)
5.10-m5n.metal 84.53% <ø> (ø)
5.10-m6a.metal 83.81% <ø> (-0.01%) ⬇️
5.10-m6g.metal 80.89% <ø> (ø)
5.10-m6i.metal 84.52% <ø> (ø)
5.10-m7g.metal 80.89% <ø> (ø)
6.1-c5n.metal 84.54% <ø> (ø)
6.1-m5n.metal 84.52% <ø> (-0.01%) ⬇️
6.1-m6a.metal 83.81% <ø> (-0.01%) ⬇️
6.1-m6g.metal 80.89% <ø> (ø)
6.1-m6i.metal 84.51% <ø> (-0.01%) ⬇️
6.1-m7g.metal 80.89% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ShadowCurse ShadowCurse force-pushed the ftrace branch 2 times, most recently from bf54f10 to d08d4d1 Compare September 13, 2024 13:20
@roypat
Copy link
Contributor

roypat commented Sep 13, 2024

Do we also add trace-cmd to our rootfs? We could just fiddle with the sysfs, but trace-cmd is nicer

@ShadowCurse
Copy link
Contributor Author

Do we also add trace-cmd to our rootfs? We could just fiddle with the sysfs, but trace-cmd is nicer

I can used trace-cmd with our rootfs, so it is already there.

@roypat
Copy link
Contributor

roypat commented Sep 13, 2024

Do we also add trace-cmd to our rootfs? We could just fiddle with the sysfs, but trace-cmd is nicer

I can used trace-cmd with our rootfs, so it is already there.

oh, neat!

This will allows us to debug issues with a guest kernel
more easily.

Signed-off-by: Egor Lazarchuk <[email protected]>
Disable CONFIG_ARM64_ERRATUM_3194386 option in the guest
kernels for aarch64. It is enabled by default
and makes `ssbs` feature to not be user space visible. This breaks
out integration tests.
This option is only indented for `Cortex-X4` and
`Neoverse-V3` cpus which we are not using, so disabling it
is safe.

Signed-off-by: Egor Lazarchuk <[email protected]>
We need to add net interface so the `vm.start()`
will wait for a vm to boot. Otherwise the `time.sleep(0.3)`
is not enough for a vm to boot and connect to the vhost-user-backend.

Signed-off-by: Egor Lazarchuk <[email protected]>
@ShadowCurse ShadowCurse force-pushed the ftrace branch 2 times, most recently from 83c7317 to 728080b Compare September 16, 2024 08:15
roypat
roypat previously approved these changes Sep 16, 2024
pb8o
pb8o previously approved these changes Sep 16, 2024
Because now we have ftrace enabled in guest kernels,
the boot time increases slightly and no longer satisfies
150000 us time.

Signed-off-by: Egor Lazarchuk <[email protected]>
@ShadowCurse ShadowCurse merged commit ec7e13a into firecracker-microvm:main Sep 16, 2024
7 checks passed
@ShadowCurse ShadowCurse deleted the ftrace branch September 16, 2024 11:24
@roypat roypat mentioned this pull request Sep 16, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Awaiting review Indicates that a pull request is ready to be reviewed Type: Enhancement Indicates new feature requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants