Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1456248

[PATCH 1/4] arm64: insn: Do not disable irqs during patching

From Matthias Brugger <mbrugger@suse.com>
Newsgroups linux.kernel
Subject [PATCH 1/4] arm64: insn: Do not disable irqs during patching
Date 2016-08-04 11:20 +0200
Message-ID <s2mYO-6W6-51@gated-at.bofh.it> (permalink)
References <s2mYN-6W6-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Robert Richter <rrichter@cavium.com>

__aarch64_insn_write() is always called with interrupts enabled. Thus,
there is no need to use an irqsave variant for the spin lock.

This change should also address the fix of:

commit abffa6f3b157 ("arm64: convert patch_lock to raw lock")

We need to enable interrupts to allow cpu sync for code patching
using smp_call_function*().

Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
---
 arch/arm64/kernel/insn.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c
index 63f9432..138bd8a 100644
--- a/arch/arm64/kernel/insn.c
+++ b/arch/arm64/kernel/insn.c
@@ -86,7 +86,7 @@ bool aarch64_insn_is_branch_imm(u32 insn)
 		aarch64_insn_is_bcond(insn));
 }
 
-static DEFINE_RAW_SPINLOCK(patch_lock);
+static DEFINE_SPINLOCK(patch_lock);
 
 static void __kprobes *patch_map(void *addr, int fixmap)
 {
@@ -129,16 +129,15 @@ int __kprobes aarch64_insn_read(void *addr, u32 *insnp)
 static int __kprobes __aarch64_insn_write(void *addr, u32 insn)
 {
 	void *waddr = addr;
-	unsigned long flags = 0;
 	int ret;
 
-	raw_spin_lock_irqsave(&patch_lock, flags);
+	spin_lock(&patch_lock);
 	waddr = patch_map(addr, FIX_TEXT_POKE0);
 
 	ret = probe_kernel_write(waddr, &insn, AARCH64_INSN_SIZE);
 
 	patch_unmap(FIX_TEXT_POKE0);
-	raw_spin_unlock_irqrestore(&patch_lock, flags);
+	spin_unlock(&patch_lock);
 
 	return ret;
 }
-- 
2.6.6

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

arm64: Implement IPI based TLB invalidation Matthias Brugger <mbrugger@suse.com> - 2016-08-04 11:20 +0200
  [PATCH 2/4] arm64: Implement IPI based TLB invalidation Matthias Brugger <mbrugger@suse.com> - 2016-08-04 11:20 +0200
  [PATCH 1/4] arm64: insn: Do not disable irqs during patching Matthias Brugger <mbrugger@suse.com> - 2016-08-04 11:20 +0200
  Re: [PATCH] arm64: Add workaround for Cavium erratum 26026 David Daney <ddaney.cavm@gmail.com> - 2016-08-04 23:50 +0200

csiph-web