Changeset View
Standalone View
sys/amd64/amd64/cpu_switch.S
| Show All 29 Lines | |||||
| * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
| * SUCH DAMAGE. | * SUCH DAMAGE. | ||||
| */ | */ | ||||
| #include <machine/asmacros.h> | #include <machine/asmacros.h> | ||||
| #include <machine/specialreg.h> | #include <machine/specialreg.h> | ||||
| #include "assym.inc" | #include "assym.inc" | ||||
| #include "opt_sched.h" | |||||
| /*****************************************************************************/ | /*****************************************************************************/ | ||||
| /* Scheduling */ | /* Scheduling */ | ||||
| /*****************************************************************************/ | /*****************************************************************************/ | ||||
| .text | .text | ||||
| /* | /* | ||||
| ▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | ctx_switch_fpusave_done: | ||||
| movq %rsi,%r12 | movq %rsi,%r12 | ||||
| movq %rdi,%r13 | movq %rdi,%r13 | ||||
| movq %rdx,%r15 | movq %rdx,%r15 | ||||
| movq %rsi,%rdi | movq %rsi,%rdi | ||||
| callq pmap_activate_sw | callq pmap_activate_sw | ||||
| movq %r15,TD_LOCK(%r13) /* Release the old thread */ | movq %r15,TD_LOCK(%r13) /* Release the old thread */ | ||||
| sw1: | sw1: | ||||
| leaq TD_MD_PCB(%r12),%r8 | leaq TD_MD_PCB(%r12),%r8 | ||||
| #if defined(SCHED_ULE) | |||||
| movq $blocked_lock, %rdx | movq $blocked_lock, %rdx | ||||
| movq TD_LOCK(%r12),%rcx | movq TD_LOCK(%r12),%rcx | ||||
| cmpq %rcx, %rdx | cmpq %rcx, %rdx | ||||
| je sw1wait | je sw1wait | ||||
| sw1cont: | sw1cont: | ||||
| #endif | |||||
| /* | /* | ||||
| * At this point, we've switched address spaces and are ready | * At this point, we've switched address spaces and are ready | ||||
| * to load up the rest of the next context. | * to load up the rest of the next context. | ||||
| */ | */ | ||||
| /* Skip loading LDT and user fsbase/gsbase for kthreads */ | /* Skip loading LDT and user fsbase/gsbase for kthreads */ | ||||
| testl $TDP_KTHREAD,TD_PFLAGS(%r12) | testl $TDP_KTHREAD,TD_PFLAGS(%r12) | ||||
| jnz do_kthread | jnz do_kthread | ||||
| ▲ Show 20 Lines • Show All 333 Lines • ▼ Show 20 Lines | #undef SDT_SYSBSY | ||||
| movq PCB_RIP(%rdi),%rax | movq PCB_RIP(%rdi),%rax | ||||
| movq %rax,(%rsp) | movq %rax,(%rsp) | ||||
| xorl %eax,%eax | xorl %eax,%eax | ||||
| ret | ret | ||||
| END(resumectx) | END(resumectx) | ||||
| /* Wait for the new thread to become unblocked */ | /* Wait for the new thread to become unblocked */ | ||||
| #if defined(SCHED_ULE) | |||||
minsoochoo0122_proton.me: This should be done for other arch's `swtch.S` as well. | |||||
Done Inline ActionsDid you read what I wrote in the first comment? kib: Did you read what I wrote in the first comment? | |||||
Done Inline ActionsYes. What I'm trying to say is
minsoochoo0122_proton.me: Yes. What I'm trying to say is
1. I would prefer doing this for all arch at once instead of… | |||||
Done Inline ActionsThis is a diff against the branch, which contains around 20 commits. I do not see a reason to spend time on machines I cannot even test, until the idea of this change is circulated in public and get accepted enough for the MD work to make sense. For armv7, the arch maintainers or people who want the platform to stay alive, need to finally implement ifuncs for the kernel. It is not much work, much less than for userspace (where it is not too hard as well). kib: This is a diff against the branch, which contains around 20 commits.
I do not see a reason to… | |||||
Done Inline ActionsMake sense. We can ask other arch developers for testing and once they report success (hopefully with additional investigation in the MD code) it can be merged. There are many voices in the mailing list who want to keep support for armv7, but I'm not sure how many of them will actually test this and do the ifunc implementation. Since the idea of scheduler as kernel module takes time for more investigation, I'm fine with this approach. Once merged, I'll ask 4BSD users on the mailing list to benchmark 4BSD vs ULE. minsoochoo0122_proton.me: Make sense. We can ask other arch developers for testing and once they report success… | |||||
Done Inline Actions
Please coordinate at least with me before sending anything. We have to be careful in the choice of words, since the really important thing is that users do these tests after my ULE fixes. If people want to test 4BSD vs. ULE in the meantime, that's of course fine, but we don't want to press them to do that. olce: > Since the idea of scheduler as kernel module takes time for more investigation, I'm fine with… | |||||
Done Inline ActionsGot that. minsoochoo0122_proton.me: Got that. | |||||
| sw1wait: | sw1wait: | ||||
| 1: | 1: | ||||
| pause | pause | ||||
| movq TD_LOCK(%r12),%rcx | movq TD_LOCK(%r12),%rcx | ||||
| cmpq %rcx, %rdx | cmpq %rcx, %rdx | ||||
| je 1b | je 1b | ||||
| jmp sw1cont | jmp sw1cont | ||||
| #endif | |||||
This should be done for other arch's swtch.S as well.