At two out of three call sites to vfp_restore_state_common(), the caller must use critical_{enter,exit} to prevent preemption between its call to vfp_restore_state_common() and other actions, notably its call to sve_enable(). So, it is arguably better to make vfp_restore_state_common()'s caller responsible for performing critical_{enter,exit} and simply perform CRITICAL_ASSERT() inside vfp_restore_state_common().
Diff Detail
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
| sys/arm64/arm64/vfp.c | ||
|---|---|---|
| 737–738 | Is it better to dereference curthread outside of the section (for some value of 'better')? | |
| sys/arm64/arm64/vfp.c | ||
|---|---|---|
| 737–738 | One load instruction moves out of the critical section, and moving it doesn't create any more register pressure. That instruction is going to be a cache hit (when inside the critical section) because critical_enter() itself fetches curthread. Unfortunately, wherever you place td = curthread;, the compiler has to generate two load instructions for curthread. It can't eliminate one because volatile blocks common subexpression expression. I'm pretty much indifferent to where td = curthread; goes, so I'm happy to move it. | |