On Wed, May 09, 2018 at 06:21:54PM +0200, Hans-Joerg Hoexer wrote:
> Hi,
>
> I think this fallout from using interrupt gates now. I did not properly
> enable interrupts for dna, fpu and f00f_redirect: Thux npxintr() tries to
> get the kernel lock with interrupts disabled. Meanwhile the IPI for tlb
> shootdown is pending for delivery. When the sender of the IPI is holding
> the kernel lock it will spin in pmap_tlb_shootwait() and we dead lock.
>
> Diff below fixes dna, fpu and f00f_redirect by enabling interrupts.
>
> (dna and fpu leave the kernel directly, thus they have to disable
> interrupts again; f00f_redirect goes through calltrap which will enable
> interrupts)
>
> Take care,
> HJ.
>
This makes sense, ok mlarkin.
-ml
> Index: sys/arch/i386//i386/locore.s
> ===================================================================
> RCS file: /cvs/src/sys/arch/i386/i386/locore.s,v
> retrieving revision 1.185
> diff -u -p -u -p -r1.185 locore.s
> --- sys/arch/i386//i386/locore.s 11 Apr 2018 15:44:08 -0000 1.185
> +++ sys/arch/i386//i386/locore.s 9 May 2018 15:47:51 -0000
> @@ -988,6 +988,7 @@ IDTVEC(dna)
> pushl $0 # dummy error code
> pushl $T_DNA
> INTRENTRY(dna)
> + sti
> pushl CPUVAR(SELF)
> call *_C_LABEL(npxdna_func)
> addl $4,%esp
> @@ -996,6 +997,7 @@ IDTVEC(dna)
> #ifdef DIAGNOSTIC
> movl $0xfd,%esi
> #endif
> + cli
> INTRFASTEXIT
> #else
> ZTRAP(T_DNA)
> @@ -1015,6 +1017,7 @@ IDTVEC(prot)
> IDTVEC(f00f_redirect)
> pushl $T_PAGEFLT
> INTRENTRY(f00f_redirect)
> + sti
> testb $PGEX_U,TF_ERR(%esp)
> jnz calltrap
> movl %cr2,%eax
> @@ -1050,6 +1053,7 @@ IDTVEC(fpu)
> */
> subl $8,%esp /* space for tf_{err,trapno} */
> INTRENTRY(fpu)
> + sti
> pushl CPL # if_ppl in intrframe
> pushl %esp # push address of intrframe
> incl _C_LABEL(uvmexp)+V_TRAP
> @@ -1058,6 +1062,7 @@ IDTVEC(fpu)
> #ifdef DIAGNOSTIC
> movl $0xfc,%esi
> #endif
> + cli
> INTRFASTEXIT
> #else
> ZTRAP(T_ARITHTRAP)
>