From: Julien Thierry <julien.thierry@arm.com>
To: Wei Li <liwei391@huawei.com>, linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, marc.zyngier@arm.com,
daniel.thompson@linaro.org, catalin.marinas@arm.com,
will.deacon@arm.com, dave.martin@arm.com, mark.rutland@arm.com,
jason@lakedaemon.net, huawei.libin@huawei.com,
guohanjun@huawei.com, thunder.leizhen@huawei.com
Subject: Re: [PATCH] arm64: fix potential deadlock in arm64-provide-pseudo-NMI-with-GICv3
Date: Tue, 29 Jan 2019 13:42:16 +0000 [thread overview]
Message-ID: <37962c23-75a9-a0a1-7810-3abfb702be72@arm.com> (raw)
In-Reply-To: <20190129131223.32505-1-liwei391@huawei.com>
Hi Wei,
Thanks testing the series.
On 29/01/2019 13:12, Wei Li wrote:
> In some exception handlers, the interrupt is not reenabled by daifclr at first.
> The later process may call local_irq_enable() to enable the interrupt, like
> gic_handle_irq(). As we known, function local_irq_enable() just change the pmr now.
This is not yet in, so it might be useful to point to the series that
adds this:
https://lkml.org/lkml/2019/1/21/1060
> The following codes what i found may cause a deadlock or some issues else:
>
> do_sp_pc_abort <- el0_sp_pc
> do_el0_ia_bp_hardening <- el0_ia
> kgdb_roundup_cpus <- el1_dbg
>
> Signed-off-by: Wei Li <liwei391@huawei.com>
> ---
> arch/arm64/kernel/kgdb.c | 4 ++++
> arch/arm64/mm/fault.c | 6 ++++++
> 2 files changed, 10 insertions(+)
>
> diff --git a/arch/arm64/kernel/kgdb.c b/arch/arm64/kernel/kgdb.c
> index a20de58061a8..119fbf2c0788 100644
> --- a/arch/arm64/kernel/kgdb.c
> +++ b/arch/arm64/kernel/kgdb.c
> @@ -25,6 +25,7 @@
> #include <linux/kgdb.h>
> #include <linux/kprobes.h>
> #include <linux/sched/task_stack.h>
> +#include <linux/irqchip/arm-gic-v3.h>
>
> #include <asm/debug-monitors.h>
> #include <asm/insn.h>
> @@ -291,6 +292,9 @@ static void kgdb_call_nmi_hook(void *ignored)
>
> void kgdb_roundup_cpus(unsigned long flags)
Hmm, I don't see this function defined in arch/arm64/kernel/kgdb.c in
v5.0-rc*. Was it removed? or is that something in your local tree.
> {
> + if (gic_prio_masking_enabled())
> + gic_arch_enable_irqs();
> +
> local_irq_enable();
Seeing we introduce the daifflags functions, with the relation described
at the top of arch/arm64/include/asm/daifflags.h. I think just calling
local_irq_enable() might not comply with this, as PSR.I would be clear
while PSR.D is set.
Maybe it should be using:
local_daif_restore(DAIF_PROCCTX);
> smp_call_function(kgdb_call_nmi_hook, NULL, 0);
> local_irq_disable();
and here
local_daif_mask();
Although I'd like to understand what you are applying the pseudo-NMI
series on first.
> diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
> index 97ba2ba78aee..f7c39a0b28bc 100644
> --- a/arch/arm64/mm/fault.c
> +++ b/arch/arm64/mm/fault.c
> @@ -32,6 +32,7 @@
> #include <linux/perf_event.h>
> #include <linux/preempt.h>
> #include <linux/hugetlb.h>
> +#include <linux/irqchip/arm-gic-v3.h>
>
> #include <asm/bug.h>
> #include <asm/cmpxchg.h>
> @@ -780,6 +781,8 @@ asmlinkage void __exception do_el0_ia_bp_hardening(unsigned long addr,
> if (addr > TASK_SIZE)
> arm64_apply_bp_hardening();
>
> + if (gic_prio_masking_enabled())
> + gic_arch_enable_irqs();
> local_irq_enable();
This is not in mainline, in v5.0-rc1 there is:
local_daif_restore(DAIF_PROCCTX);
Which my series updates to modify both DAIF and PMR if needed.
So you wouldn't need to have the gic_arch_enable_irqs().
> do_mem_abort(addr, esr, regs);
> }
> @@ -794,6 +797,9 @@ asmlinkage void __exception do_sp_pc_abort(unsigned long addr,
> if (user_mode(regs)) {
> if (instruction_pointer(regs) > TASK_SIZE)
> arm64_apply_bp_hardening();
> +
> + if (gic_prio_masking_enabled())
> + gic_arch_enable_irqs();
> local_irq_enable();
Same here.
Thanks,
--
Julien Thierry
prev parent reply other threads:[~2019-01-29 13:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-29 13:12 Wei Li
2019-01-29 13:42 ` Julien Thierry [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=37962c23-75a9-a0a1-7810-3abfb702be72@arm.com \
--to=julien.thierry@arm.com \
--cc=catalin.marinas@arm.com \
--cc=daniel.thompson@linaro.org \
--cc=dave.martin@arm.com \
--cc=guohanjun@huawei.com \
--cc=huawei.libin@huawei.com \
--cc=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liwei391@huawei.com \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=thunder.leizhen@huawei.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®