From patchwork Mon Jun 12 17:40:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 774784 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wmgCr6nJBz9s06 for ; Tue, 13 Jun 2017 03:40:40 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="X+c86pdZ"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=H6S4dOD/Xu1fIXXgH5v70aiEMT+zmEl1jdvVZGYbxI0=; b=X+c86pdZMv8llYnQlpb6W2QdJ ash6wQGDbkhC/jih7QCmmRZmlGqLT5kukIDJiyeESncwGnk+iFo+O2LFbQEcq1tjKQ0j+GFDYt1X+ 3nGBdGEwuQ06J0J9/tgmpYSyNHoVsDtxlWiFmNOfHJV/ZmfyE4VKtIB8mdIwdd+iVxPUCYsk1C1Hi sUY4CDtK9NkFqf8zVtmLQLnHhqzAXB7UeiBhgOfbib0AuP5y8pfCZWeWI8mkFHjNnntvR8OH/yu8+ QwLvG1V/T3s1iq5Gwz5yzXq5tn97ATz5XMTcL2Ukt4J/zzaZJKZRuejQOQvMxQlYiXq71HESZtg7C CX+nDK6Xg==; 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 1dKTKR-00069i-Gw; Mon, 12 Jun 2017 17:40:39 +0000 Received: from smtprelay4.synopsys.com ([198.182.47.9] helo=smtprelay.synopsys.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dKTKG-0005vT-Sm for linux-snps-arc@lists.infradead.org; Mon, 12 Jun 2017 17:40:30 +0000 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 025EE24E0200; Mon, 12 Jun 2017 10:40:07 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id D57A38A5; Mon, 12 Jun 2017 10:40:06 -0700 (PDT) Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2-vip.internal.synopsys.com [10.12.239.238]) by mailhost.synopsys.com (Postfix) with ESMTP id BFE9D8A0; Mon, 12 Jun 2017 10:40:06 -0700 (PDT) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by US01WEHTC2.internal.synopsys.com (10.12.239.237) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 12 Jun 2017 10:40:06 -0700 Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.104) by IN01WEHTCB.internal.synopsys.com (10.144.199.105) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 12 Jun 2017 23:10:03 +0530 Received: from [10.10.161.108] (10.10.161.108) by IN01WEHTCA.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 12 Jun 2017 23:10:03 +0530 Subject: Re: [PATCH v2 11/11] ARC: [plat-eznps] Handle memory error as an exception To: Noam Camus References: <1495954328-28736-1-git-send-email-noamca@mellanox.com> <1495954328-28736-12-git-send-email-noamca@mellanox.com> <15ef64f3-3b5b-a362-c520-e5316121d3d6@synopsys.com> <67715c5d-30f2-815e-87ab-7fb4e8205a90@synopsys.com> From: Vineet Gupta Message-ID: <01e7716b-291c-08b2-fe93-5c5982ba4a11@synopsys.com> Date: Mon, 12 Jun 2017 10:40:00 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Originating-IP: [10.10.161.108] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170612_104028_959355_C97DE295 X-CRM114-Status: GOOD ( 14.16 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.47.9 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-snps-arc@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Elad Kanfi Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org On 06/08/2017 08:17 PM, Noam Camus wrote: > > *> From:*Vineet Gupta > > *> Sent:* Thursday, June 8, 2017 10:00 PM > > > >> With EZsim we try to simulate NPS400 CTOP core and not ARC core, and as such we > >> strive to have similar echo system for both silicon and its simulator. > > >Right, but if you are using nSIM which generates L2 interrupt for user mode error > >- then it is already different from silicon and needs to handled as such. > Why so, this is something I wish to minimize and not just live with. > So I handle difference by redirecting back to the track I want to. > > >> If we could, we would alter nSIM to behave just like our silicon. > >> So in current situation where we lack doing so we suffice in single pretty small > >> adjustment in OS (platform specific code). > > >You are saying contradicting things here. Above u want EZSim to simulate CTOP > >(i.e. generate machinechk for U errors) but here you claim u use nSIM which will > >generates L2 intr. > > >So I'm still grossly confused. > Sorry, for confusion. > I am using nSIM which creates L2 interrupt and not machine check because I got > no alternative. > At the first chance I get the opportunity, I put execution back to my desired > direction. > Since the direction as our silicon dictate is ending with die() it is a clear > path without a risk. OK I understand now - you want the die semantics not try and continue... but the patch is simply wrong. From L2 interrupt you jump to machine check vector which reads ECR. In this case it would be bogus - with some old stale value. What you really want is an NPS version of do_memory_error - since platforms can have their way of dealing with such errors - but the low level machine handling is just not in their control. I'd propose the patch below and then you can define your own version of do_memory_error() and handle as appropriate ! ----> linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc diff --git a/arch/arc/kernel/traps.c b/arch/arc/kernel/traps.c index ff83e78d0cfb..5a8042784ee9 100644 --- a/arch/arc/kernel/traps.c +++ b/arch/arc/kernel/traps.c @@ -80,11 +80,26 @@ int name(unsigned long address, struct pt_regs *regs) \ DO_ERROR_INFO(SIGILL, "Priv Op/Disabled Extn", do_privilege_fault, ILL_PRVOPC) DO_ERROR_INFO(SIGILL, "Invalid Extn Insn", do_extension_fault, ILL_ILLOPC) DO_ERROR_INFO(SIGILL, "Illegal Insn (or Seq)", insterror_is_error, ILL_ILLOPC) -DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", do_memory_error, BUS_ADRERR) DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_is_brkpt, TRAP_BRKPT) DO_ERROR_INFO(SIGBUS, "Misaligned Access", do_misaligned_error, BUS_ADRALN) /* + * Entry point for bus errors + * opencoded DO_ERROR_INFO() but __weak to allow possible plarform override + */ +int __weak do_memory_error(unsigned long address, struct pt_regs *regs) +{ + siginfo_t info = { + .si_signo = SIGBUS, + .si_errno = 0, + .si_code = BUS_ADRERR, + .si_addr = (void __user *)address, + }; + + return unhandled_exception("Invalid Mem Access", regs, &info); +} + +/* _______________________________________________ linux-snps-arc mailing list