From patchwork Sat Dec 9 01:15:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongjiu Geng X-Patchwork-Id: 10103477 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 34A5D60325 for ; Sat, 9 Dec 2017 01:16:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2779528FFE for ; Sat, 9 Dec 2017 01:16:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B14E2900D; Sat, 9 Dec 2017 01:16:30 +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,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 A395828FFE for ; Sat, 9 Dec 2017 01:16:29 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=CtafZ06Db9Ij3979X0bOrJ6gE+HuFdHFGHNOn9Ir/oQ=; b=SYCTT45FVxFjKw mheq3T3BZsbSdTH/gYebp8TJe5c3PlQMUbvwuiPvNg4DZh+aLq2OW8CAZLTM8Hke7/f2ru0OBOV6D AORu/rDmlmANxsKQwh479MMhLU24qnWehD2f5Oc51Z+65Mj+5iYcIhcLuKyEvIxuempAZ1qE4CHMx C1CdtxgbJMJw2b04DgP1vm1NS/NJLfDbWC2IkkQg8K0HKAeP/jSrj7u+AHxk9x7K1PsRxRKTbMqt9 2sGEEq6B608Jq70LOYxZlLly0MmRscQuE37l68VDzj8lcLwJaGFL0Vhe3DQ6UXZRq9mWpsN+HXTLz Wt6qFlnsBevLW88MpnIA==; 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 1eNTkh-0004jw-8Z; Sat, 09 Dec 2017 01:16:27 +0000 Received: from szxga05-in.huawei.com ([45.249.212.191] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eNTkc-0004i3-NE for linux-arm-kernel@lists.infradead.org; Sat, 09 Dec 2017 01:16:25 +0000 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id A4DB42CA2B999; Sat, 9 Dec 2017 09:15:43 +0800 (CST) Received: from SHA150392835-N.china.huawei.com (10.45.61.20) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.361.1; Sat, 9 Dec 2017 09:15:38 +0800 From: Dongjiu Geng To: , , , , , Subject: [PATCH V2] arm64: fault: avoid send SIGBUS two times Date: Sat, 9 Dec 2017 09:15:32 +0800 Message-ID: <20171209011532.7300-1-gengdongjiu@huawei.com> X-Mailer: git-send-email 2.11.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.45.61.20] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171208_171623_076047_0FCD2838 X-CRM114-Status: UNSURE ( 8.29 ) 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: , Cc: wuquanming@huawei.com, huangshaoyu@huawei.com, gengdongjiu@huawei.com 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 do_sea() calls arm64_notify_die() which will always signal user-space. It also returns whether APEI claimed the external abort as a RAS notification. If it returns failure do_mem_abort() will signal user-space too. do_mem_abort() wants to know if we handled the error, we always call arm64_notify_die() so can always return success. The si_code BUS_MCEERR_AR can tell user-space there is a hardware error that needs to be dealt with immediately Signed-off-by: Dongjiu Geng --- arch/arm64/mm/fault.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index b64958b..38b9f3e 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -610,7 +610,6 @@ static int do_sea(unsigned long addr, unsigned int esr, struct pt_regs *regs) { struct siginfo info; const struct fault_info *inf; - int ret = 0; inf = esr_to_fault_info(esr); pr_err("Synchronous External Abort: %s (0x%08x) at 0x%016lx\n", @@ -625,7 +624,7 @@ static int do_sea(unsigned long addr, unsigned int esr, struct pt_regs *regs) if (interrupts_enabled(regs)) nmi_enter(); - ret = ghes_notify_sea(); + ghes_notify_sea(); if (interrupts_enabled(regs)) nmi_exit(); @@ -633,14 +632,14 @@ static int do_sea(unsigned long addr, unsigned int esr, struct pt_regs *regs) info.si_signo = SIGBUS; info.si_errno = 0; - info.si_code = 0; + info.si_code = BUS_MCEERR_AR; if (esr & ESR_ELx_FnV) info.si_addr = NULL; else info.si_addr = (void __user *)addr; arm64_notify_die("", regs, &info, esr); - return ret; + return 0; } static const struct fault_info fault_info[] = {