From: Zhou Chengming <zhouchengming1@huawei.com>
To: <mhiramat@kernel.org>, <bp@suse.de>, <peterz@infradead.org>,
<ananth@linux.vnet.ibm.com>, <anil.s.keshavamurthy@intel.com>,
<davem@davemloft.net>, <tglx@linutronix.de>, <jkosina@suse.cz>,
<rostedt@goodmis.org>, <mjurczyk@google.com>
Cc: <x86@kernel.org>, <linux-kernel@vger.kernel.org>,
<zhouchengming1@huawei.com>
Subject: [PATCH 2/4] x86/alternatives: Don't need text_mutex when text_poke() on UP
Date: Sat, 28 Oct 2017 20:50:55 +0800 [thread overview]
Message-ID: <1509195057-117316-2-git-send-email-zhouchengming1@huawei.com> (raw)
In-Reply-To: <1509195057-117316-1-git-send-email-zhouchengming1@huawei.com>
The alternatives_smp_lock/unlock only be used on UP, so we don't
need to hold the text_mutex when text_poke(). Then in the next patch,
we can remove the outside smp_alt mutex too.
Signed-off-by: Zhou Chengming <zhouchengming1@huawei.com>
---
arch/x86/kernel/alternative.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 8549269..5c3f593 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -442,7 +442,6 @@ static void alternatives_smp_lock(const s32 *start, const s32 *end,
{
const s32 *poff;
- mutex_lock(&text_mutex);
for (poff = start; poff < end; poff++) {
u8 *ptr = (u8 *)poff + *poff;
@@ -452,7 +451,6 @@ static void alternatives_smp_lock(const s32 *start, const s32 *end,
if (*ptr == 0x3e)
text_poke(ptr, ((unsigned char []){0xf0}), 1);
}
- mutex_unlock(&text_mutex);
}
static void alternatives_smp_unlock(const s32 *start, const s32 *end,
@@ -460,7 +458,6 @@ static void alternatives_smp_unlock(const s32 *start, const s32 *end,
{
const s32 *poff;
- mutex_lock(&text_mutex);
for (poff = start; poff < end; poff++) {
u8 *ptr = (u8 *)poff + *poff;
@@ -470,7 +467,6 @@ static void alternatives_smp_unlock(const s32 *start, const s32 *end,
if (*ptr == 0xf0)
text_poke(ptr, ((unsigned char []){0x3E}), 1);
}
- mutex_unlock(&text_mutex);
}
struct smp_alt_module {
--
1.8.3.1
next prev parent reply other threads:[~2017-10-28 12:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-28 12:50 [PATCH 1/4] x86/alternatives: free smp_alt_modules when enable smp Zhou Chengming
2017-10-28 12:50 ` Zhou Chengming [this message]
2017-10-29 1:20 ` [PATCH 2/4] x86/alternatives: Don't need text_mutex when text_poke() on UP zhouchengming
2017-10-28 12:50 ` [PATCH 3/4] x86/alternatives: get rid of the smp_alt mutex Zhou Chengming
2017-10-28 12:50 ` [PATCH 4/4] kprobes, x86/alternatives: preempt_disable() when check smp_alt_modules Zhou Chengming
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=1509195057-117316-2-git-send-email-zhouchengming1@huawei.com \
--to=zhouchengming1@huawei.com \
--cc=ananth@linux.vnet.ibm.com \
--cc=anil.s.keshavamurthy@intel.com \
--cc=bp@suse.de \
--cc=davem@davemloft.net \
--cc=jkosina@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mjurczyk@google.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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®