From: Xiongfeng Wang <wangxiongfeng2@huawei.com>
To: <wangxiongfeng2@huawei.com>, <huawei.libin@huawei.com>,
<james.morse@arm.com>, <catalin.marinas@arm.com>,
<will.deacon@arm.com>
Cc: <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: [RFC PATCH 3/3] stop_machine: mask sdei before running the callback
Date: Fri, 12 Apr 2019 20:04:59 +0800 [thread overview]
Message-ID: <1555070699-3685-4-git-send-email-wangxiongfeng2@huawei.com> (raw)
In-Reply-To: <1555070699-3685-1-git-send-email-wangxiongfeng2@huawei.com>
Kprobes use 'stop_machine' to modify code which could be run in the
sdei event handler at the same time. This patch mask sdei before running
the stop_machine callback to avoid this race condition.
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
---
kernel/stop_machine.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index 067cb83..7b95632 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -22,6 +22,9 @@
#include <linux/atomic.h>
#include <linux/nmi.h>
#include <linux/sched/wake_q.h>
+#ifdef CONFIG_ARM64
+#include <linux/arm_sdei.h>
+#endif
/*
* Structure to determine completion condition and record errors. May
@@ -208,6 +211,9 @@ static int multi_cpu_stop(void *data)
case MULTI_STOP_DISABLE_IRQ:
local_irq_disable();
hard_irq_disable();
+#ifdef CONFIG_ARM64
+ sdei_mask_local_cpu();
+#endif
break;
case MULTI_STOP_RUN:
if (is_active)
@@ -227,6 +233,9 @@ static int multi_cpu_stop(void *data)
}
} while (curstate != MULTI_STOP_EXIT);
+#ifdef CONFIG_ARM64
+ sdei_unmask_local_cpu();
+#endif
local_irq_restore(flags);
return err;
}
--
1.7.12.4
next prev parent reply other threads:[~2019-04-12 12:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-12 12:04 [RFC PATCH 0/3] Enable kprobe to monitor sdei event handler Xiongfeng Wang
2019-04-12 12:04 ` [RFC PATCH 1/3] Revert "arm64: debug: remove unused local_dbg_{enable, disable} macros" Xiongfeng Wang
2019-04-12 12:04 ` [RFC PATCH 2/3] sdei: enable dbg in '_sdei_handler' Xiongfeng Wang
2019-04-24 16:21 ` James Morse
2019-04-12 12:04 ` Xiongfeng Wang [this message]
2019-04-24 16:20 ` [RFC PATCH 0/3] Enable kprobe to monitor sdei event handler James Morse
2019-04-26 8:19 ` Xiongfeng Wang
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=1555070699-3685-4-git-send-email-wangxiongfeng2@huawei.com \
--to=wangxiongfeng2@huawei.com \
--cc=catalin.marinas@arm.com \
--cc=huawei.libin@huawei.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--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®