[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH 03/23] plat: Hardware context - Use interrupt stack when handling interrupts


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Mon, 8 Jul 2019 11:33:32 +0300
  • Cc: felipe.huici@xxxxxxxxx, simon.kuenzer@xxxxxxxxx
  • Delivery-date: Mon, 08 Jul 2019 08:50:15 +0000
  • Ironport-phdr: 9a23:+vWI9x26Gga/mGfIsmDT+DRfVm0co7zxezQtwd8ZseMWKfad9pjvdHbS+e9qxAeQG9mCsbQY06GO7+jJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6JvjvGo7Vks+7y/2+94fcbglVmjaxe7x/IAm5oQnNucQdnJdvJLs2xhbVuHVDZv5YxXlvJVKdnhb84tm/8Zt++ClOuPwv6tBNX7zic6s3UbJXAjImM3so5MLwrhnMURGP5noHXWoIlBdDHhXI4wv7Xpf1tSv6q/Z91SyHNsD4Ubw4RTKv5LptRRT1iikIKiQ5/XnXhMJukaxVrhGvqRt9zI7ae4yZKOZyc7nBcd4AWWZNQsBcXDFBDIOmaIsPCvIMMPhfr4nmu1sOrB2+DhSqCuPy0j9Im2L90Kom3OQmCgHGwA0gH9QUvHTQsdX1LLoSXPupw6nT1znDd+5W1izn5IjSdRAsuPeBVq9+f8rWzEkgDQLFjlOIpIHkMD6ZzP8NvHOd4uF9Vuyvk3Yqpxx+rzSy3MshiYnEipgLxlza9yh12og4KcWlREN0fNKoCphduiGAO4doTM4vTXtktDs1x7EYv5OwYTIEx449xxHFbvyKa42I4hX+W+mPOTp4n3dleK6nhxa17Eig1vXwVsmq31ZOqSpIisfMtnUX2BzS7siLUOdy/ly71TaXygDc8ftIIVozlabDKp4hxKA/loYLvEjeESL6hV/6gayWe0k+5OSk9ebqbq/oq5OEMo97kAD+MqAgmsylBuQ4NxADUHSc+eSnyL3j/Ev5TK9Ojv0riqnZrYvXKtgApqKjGw9Vz50s5wylDzehyNgYh2UILEpZeBKbiIjkI1TOIPH+Dfe+hFSsiy5nyO3YMb3/HJrNKmPOkLPgfbZm905c0xA/zN9B6JJSEL0BJ+jzWkDpvtzCEhA5KxC0w/rgCNhl2IMRR2aPAq6BMKzMq1OI5v8vI+iQa48Uozv9LeYq6OLqjXAjglARZ7em3YYPYnCiAvtmO1mZYWbrgtoZCmcKvw8+TOvsiFGYUj5Temi9X6Q95z4lEoKrFoHDSZ6xj7yFxii0BYdaaX5bCgPELXC9coSCWvAXLS6fPMJlujgFTqS6DZ8s01eprgCp5aBgK7///TYEtJSr8MVt+qWHnhYp6T1yScCAy3ylRHoyhn4CASUxivMs6Xdhw0uOhPAry8dTEsZesqtE
  • Ironport-sdr: 5wQgM4vjJBaooLFdu0rRlqABn/mypqXT83yyVAFxo4aRtMZUoWvr0lF/EE4vELR2JLTKosARvW Esp/yfZcRJ0g==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

Now that we use a special "stack" for saving the thread registers when entering
interrupt context, we have to get back to using the interrupt stack for the
rest of job.

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 plat/kvm/x86/cpu_vectors_x86_64.S | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/plat/kvm/x86/cpu_vectors_x86_64.S 
b/plat/kvm/x86/cpu_vectors_x86_64.S
index 1af2fd00..41bd6f88 100644
--- a/plat/kvm/x86/cpu_vectors_x86_64.S
+++ b/plat/kvm/x86/cpu_vectors_x86_64.S
@@ -24,6 +24,8 @@
  */
 /* Taken from solo5 */
 
+#include <uk/config.h>
+#include <uk/arch/limits.h>
 #include <x86/traps.h>
 #include <x86/regs.h>
 
@@ -92,11 +94,28 @@ ENTRY(cpu_irq_\irqno)
 
        pushq $0                            /* no error code */
        PUSH_CALLER_SAVE
+#if CONFIG_HAVE_SCHED_PREEMPT
+       pushq $1f                           /* save continuation */
+       /* Set kernel stack */
+       movq intr_stack_start(%rip), %rsp
+#else
        subq $REGS_PAD_SIZE, %rsp           /* we have some padding */
 
+#endif /* CONFIG_HAVE_SCHED_PREEMPT */
+
        movq $\irqno, %rdi
        call _ukplat_irq_handle
 
+#if CONFIG_HAVE_SCHED_PREEMPT
+1:
+       /* Load current thread */
+       and $STACK_MASK_TOP, %rsp
+       mov (%rsp), %rsp
+       /* Load thread exception stack */
+       mov OFFSETOF_UKTHREAD_REGS(%rsp), %rsp
+       mov (%rsp), %rsp
+#endif
+
        addq $REGS_PAD_SIZE, %rsp           /* we have some padding */
        POP_CALLER_SAVE
        addq $8, %rsp
@@ -104,6 +123,11 @@ ENTRY(cpu_irq_\irqno)
        iretq
 .endm
 
+#if CONFIG_HAVE_SCHED_PREEMPT
+intr_stack_start:
+       .quad cpu_intr_stack + __STACK_SIZE - 8
+#endif
+
 TRAP_ENTRY divide_error,     0
 TRAP_ENTRY debug,            0
 TRAP_ENTRY nmi,              0
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.