@@ -50,12 +50,28 @@ Shared HiFi registers mode
50
50
51
51
This mode is used when the application has two or more threads that use HiFi
52
52
registers. When enabled, the kernel automatically allows all threads to use the
53
- HiFi registers. During each thread context switch, the kernel saves the outgoing
54
- thread's HiFi registers and loads the incoming thread's HiFi registers,
55
- regardless of whether the thread utilizes them or not.
53
+ HiFi registers. Conceptually, it can be sub-divided into two sub-modes--eager
54
+ mode and lazy mode. They will both save and restore the HiFi registers, but
55
+ they differ in when the registers are saved and restored, as well as to where
56
+ they are saved and from where they are restored.
56
57
58
+ In the eager sharing model, the HiFi registers are saved and restored during
59
+ every thread context switch, regardless of whether the thread used them or not.
57
60
Additional stack space may be required for each thread to account for the extra
58
- registers that must be saved.
61
+ registers that must be saved. This is default of the two models.
62
+
63
+ In the lazy sharing model, the kernel tracks the thread that 'owns' the
64
+ coprocessor. If the 'owning' thread is switched out, the HiFi registers will
65
+ not be saved until a new thread attempts to use the HiFi, after which that
66
+ new thread becomes the new owner and its HiFi registers are loaded.
67
+
68
+ .. note ::
69
+ If an SMP system detects that the owner-to-be is still an owner on another
70
+ CPU, an IPI will be sent to that CPU to initiate the saving of its HiFi
71
+ registers to memory. The current processor will then spin until the HiFi
72
+ registers are saved. This spinning may result in sporadically longer
73
+ delays. For the best performance, it is recommended that a thread
74
+ using HiFi be pinned to a single CPU.
59
75
60
76
Configuration Options
61
77
=====================
@@ -71,3 +87,10 @@ configuration options :kconfig:option:`CONFIG_XTENSA_HIFI3` and/or
71
87
:kconfig:option: `CONFIG_XTENSA_HIFI4 `. Threads must have sufficient
72
88
stack space for saving the HiFi register values during context switches
73
89
as described above.
90
+
91
+ Both eager and lazy HiFi sharing modes require the configuration option
92
+ :kconfig:option: `CONFIG_XTENSA_HIFI_SHARING ` to be enabled. Although eager
93
+ HiFi sharing is the default, it can be explicitly selected by enabling the
94
+ configuration option :kconfig:option: `CONFIG_XTENSA_EAGER_HIFI_SHARING `. To
95
+ select lazy HiFi sharing instead, enable the configuration option
96
+ :kconfig:option: `CONFIG_XTENSA_LAZY_HIFI_SHARING `.
0 commit comments