[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.9999.1909200841300.10826@viisi.sifive.com>
Date: Fri, 20 Sep 2019 08:41:41 -0700 (PDT)
From: Paul Walmsley <paul.walmsley@...ive.com>
To: Vincent Chen <vincent.chen@...ive.com>
cc: linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] riscv: Avoid interrupts being erroneously enabled in
handle_exception()
On Mon, 16 Sep 2019, Vincent Chen wrote:
> When the handle_exception function addresses an exception, the interrupts
> will be unconditionally enabled after finishing the context save. However,
> It may erroneously enable the interrupts if the interrupts are disabled
> before entering the handle_exception.
>
> For example, one of the WARN_ON() condition is satisfied in the scheduling
> where the interrupt is disabled and rq.lock is locked. The WARN_ON will
> trigger a break exception and the handle_exception function will enable the
> interrupts before entering do_trap_break function. During the procedure, if
> a timer interrupt is pending, it will be taken when interrupts are enabled.
> In this case, it may cause a deadlock problem if the rq.lock is locked
> again in the timer ISR.
>
> Hence, the handle_exception() can only enable interrupts when the state of
> sstatus.SPIE is 1.
>
> This patch is tested on HiFive Unleashed board.
>
> Signed-off-by: Vincent Chen <vincent.chen@...ive.com>
> Reviewed-by: Palmer Dabbelt <palmer@...ive.com>
Thanks very much. Queued for v5.4-rc.
- Paul
Powered by blists - more mailing lists