-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
kernel: smp: Optimize delivery of IPIs #69770
Conversation
65d5381
to
44dae3d
Compare
The following west manifest projects have been modified in this Pull Request:
Note: This message is automatically posted and updated by the Manifest GitHub Action. |
d2cb09a
Rebased to resolve a merge conflict. |
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.
Refresh +1
@peter-mitsis there is a failure because of another change in the SOF tree, I am working on resolving this now, but the conflict here not sure what is it about. |
submanifests/optional.yaml
Outdated
@@ -34,7 +34,7 @@ manifest: | |||
groups: | |||
- optional | |||
- name: sof | |||
revision: c11a3185afbc8e1b2a79916de3dfefaf326d9ad1 | |||
revision: ac1b774abfe2e8a9f6547f5bc305e499c51f9671 |
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.
point to this 1e4702f3080c68e6046b7b16eb030a3eba0ce231
instead.
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 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.
Done.
ok, that was the esf change... |
Updated submanifest as per @nashif's request -- nothing else changed. |
1. The flagging of IPIs is moved out of k_thread_priority_set() into z_thread_prio_set(). This allows for an IPI to be done for a thread that had its priority bumped due to the handling of priority inheritance from a mutex. 2. k_thread_priority_set()'s check for sched_locked only applies to non-SMP builds that are using the old arch_swap() framework to switch between threads. Incidentally, nearly all calls to flag_ipi() are now performed with sched_spinlock being locked. The only exception is in slice_timeout(). Signed-off-by: Peter Mitsis <[email protected]>
The CONFIG_IPI_OPTIMIZE configuration option allows for the flagging and subsequent signaling of IPIs to be optimized. It does this by making each bit in the kernel's pending_ipi field a flag that indicates whether the corresponding CPU might need an IPI to trigger the scheduling of a new thread on that CPU. When a new thread is made ready, we compare that thread against each of the threads currently executing on the other CPUs. If there is a chance that that thread should preempt the thread on the other CPU then we flag that an IPI is needed for that CPU. That is, a clear bit indicates that the CPU absolutely will not need to reschedule, while a set bit indicates that the target CPU must make that determination for itself. Signed-off-by: Peter Mitsis <[email protected]>
Platforms that support IPIs allow them to be broadcast via the new arch_sched_broadcast_ipi() routine (replacing arch_sched_ipi()). Those that also allow IPIs to be directed to specific CPUs may use arch_sched_directed_ipi() to do so. As the kernel has the capability to track which CPUs may need an IPI (see CONFIG_IPI_OPTIMIZE), this commit updates the signalling of tracked IPIs to use the directed version if supported; otherwise they continue to use the broadcast version. Platforms that allow directed IPIs may see a significant reduction in the number of IPI related ISRs when CONFIG_IPI_OPTIMIZE is enabled and the number of CPUs increases. These platforms can be identified by the Kconfig option CONFIG_ARCH_HAS_DIRECTED_IPIS. Signed-off-by: Peter Mitsis <[email protected]>
Updates the sof revision. This is needed for it to pick up a change to the arch_sched_ipi() which has been renamed to arch_sched_broadcast_ipi(). Signed-off-by: Peter Mitsis <[email protected]>
Adds several tests to verify that IPIs can be appropriately targeted to specific CPUs. Signed-off-by: Peter Mitsis <[email protected]>
05c473a
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.
Again
This set of commits is a step towards optimising the delivery of inter-processor interrupts (IPIs). It does this by attempting to deliver IPIs only to relevant CPUs.
The bulk of these changes revolve around three ideas.