From patchwork Thu Aug 4 09:15:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Brugger X-Patchwork-Id: 9263099 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 10BA26048F for ; Thu, 4 Aug 2016 09:19:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0162628333 for ; Thu, 4 Aug 2016 09:19:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA4CE28384; Thu, 4 Aug 2016 09:19:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 67A3F28333 for ; Thu, 4 Aug 2016 09:19:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bVEmw-0001q7-R3; Thu, 04 Aug 2016 09:18:02 +0000 Received: from smtp.nue.novell.com ([195.135.221.5]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bVElJ-0000Ot-O7 for linux-arm-kernel@lists.infradead.org; Thu, 04 Aug 2016 09:16:56 +0000 Received: from nwb-ext-pat.microfocus.com ([10.120.13.103]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Thu, 04 Aug 2016 11:15:57 +0200 Received: from linux-gy6r.site (nwb-a10-snat.microfocus.com [10.120.13.201]) by nwb-ext-pat.microfocus.com with ESMTP (TLS encrypted); Thu, 04 Aug 2016 10:15:33 +0100 From: Matthias Brugger To: pbonzini@redhat.com, rkrcmar@redhat.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com Subject: [PATCH 1/4] arm64: insn: Do not disable irqs during patching Date: Thu, 4 Aug 2016 11:15:14 +0200 Message-Id: <1470302117-32296-2-git-send-email-mbrugger@suse.com> X-Mailer: git-send-email 2.6.6 In-Reply-To: <1470302117-32296-1-git-send-email-mbrugger@suse.com> References: <1470302117-32296-1-git-send-email-mbrugger@suse.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160804_021622_768630_49B68F85 X-CRM114-Status: UNSURE ( 9.49 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, mbrugger@suse.com, kvm@vger.kernel.org, david.daney@cavium.com, ard.biesheuvel@linaro.org, zlim.lnx@gmail.com, suzuki.poulose@arm.com, agraf@suse.de, linux-kernel@vger.kernel.org, rrichter@cavium.com, lorenzo.pieralisi@arm.com, james.morse@arm.com, dave.long@linaro.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Robert Richter __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 Signed-off-by: Matthias Brugger --- 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; }