From patchwork Wed Nov 1 19:14:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongjiu Geng X-Patchwork-Id: 10036247 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 EA6FC6032D for ; Wed, 1 Nov 2017 11:11:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE9252843B for ; Wed, 1 Nov 2017 11:11:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0BA728B6D; Wed, 1 Nov 2017 11:11:17 +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=-2.3 required=2.0 tests=BAYES_00, DATE_IN_FUTURE_06_12, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6F8E22843B for ; Wed, 1 Nov 2017 11:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VJYjgMuabj7qgfN72RsELnHHJNIMpS+5kowWVARW7SE=; b=QGxawu9kwL50pC qDf5RTwxgLH1EKegJGrHNhq3zkoTTnkY73DNqAjZ78jCAFLX20zfyDFxBb2DXoZ5s/+v9pbWlR+wC Yvn9Q3yK/M1QQMorQS2X4C2/FesR63PswcjfsFs82y4lYsA7lANfZ56Pa049sT336V7qMTwMDrJGl MFYJVS3NTvc9XD4Z1tP2IIGfJro6A+8n9o3W5Q3PNsN32Da7eMHlGb1K7pKSWNjduZmbtErYa7eBQ nLWAHIfvPL6of9lpCQ8mq7UoK4xhFZUrZZ7gfrEwtmrX8s05MYmmCWHenVjZN6zSHBsJYs9p4bThn AYcCfhhedaK76BzmlCVQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e9qvM-0000ja-Eh; Wed, 01 Nov 2017 11:11:08 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e9quL-00070q-5Z for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2017 11:10:08 +0000 Received: from 172.30.72.59 (EHLO DGGEMS405-HUB.china.huawei.com) ([172.30.72.59]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DKC78231; Wed, 01 Nov 2017 19:09:16 +0800 (CST) Received: from localhost.localdomain (10.143.28.90) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.361.1; Wed, 1 Nov 2017 19:08:58 +0800 From: Dongjiu Geng To: , , , , , , , , , , , , , , Subject: [PATCH v1 2/3] arm64: add error synchronization barrier in kernel_entry/kernel_exit Date: Thu, 2 Nov 2017 03:14:56 +0800 Message-ID: <1509563697-6359-3-git-send-email-gengdongjiu@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1509563697-6359-1-git-send-email-gengdongjiu@huawei.com> References: <1509563697-6359-1-git-send-email-gengdongjiu@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.143.28.90] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.59F9AB5D.0055, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: cb67cca806e13fca9e4d6715d513195c X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171101_041005_636562_C9C15E12 X-CRM114-Status: UNSURE ( 9.43 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 If taking an exception from or return to user space, insert a Error Synchronization Barrier(ESB) to isolate the error. If a user space process is pending a SError, when enter to kernel, the SError will be immediately synchronized in the handler entry. Otherwise if kernel space is pending a SError, before return to user space, the SError will be synchronized in the handler exit. In order to reduce impact on performance, not check the DISR_EL1 to see whether an SError is consumed by an ESB instruction. This is because DISR_EL1 is RAZ/WI in firmware-first RAS solution, if happen SError, it will immediately trap to EL3 firmware. Signed-off-by: Dongjiu Geng --- arch/arm64/kernel/entry.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index e147c1d..6dde644 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -138,6 +138,7 @@ stp x28, x29, [sp, #16 * 14] .if \el == 0 + error_synchronize mrs x21, sp_el0 ldr_this_cpu tsk, __entry_task, x20 // Ensure MDSCR_EL1.SS is clear, ldr x19, [tsk, #TSK_TI_FLAGS] // since we can unmask debug @@ -281,6 +282,7 @@ alternative_if ARM64_WORKAROUND_845719 1: alternative_else_nop_endif #endif + error_synchronize .endif msr elr_el1, x21 // set up the return data