Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751172AbdFBTEg (ORCPT ); Fri, 2 Jun 2017 15:04:36 -0400 Received: from us01smtprelay-2.synopsys.com ([198.182.60.111]:49656 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750966AbdFBTEf (ORCPT ); Fri, 2 Jun 2017 15:04:35 -0400 Subject: Re: [PATCH v2 11/11] ARC: [plat-eznps] Handle memory error as an exception To: Noam Camus , CC: , Elad Kanfi Newsgroups: gmane.linux.kernel.arc,gmane.linux.kernel References: <1495954328-28736-1-git-send-email-noamca@mellanox.com> <1495954328-28736-12-git-send-email-noamca@mellanox.com> From: Vineet Gupta Message-ID: <529402c7-e75e-8640-fbc1-37d8efd92dd9@synopsys.com> Date: Fri, 2 Jun 2017 12:04:25 -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: <1495954328-28736-12-git-send-email-noamca@mellanox.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.10.161.108] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2600 Lines: 67 On 05/27/2017 11:52 PM, Noam Camus wrote: > From: Noam Camus > > This commit adds the configuration CONFIG_EZNPS_MEM_ERROR. > If set, it will cause the kernel to handle user memory error > as a machine check exception. > It is required in order to align the NPS simulator memory > error handling to the one of the NPS400 real chip behavior. > We override weak symbole of mem_service to achieve that. > > Signed-off-by: Elad Kanfi > Signed-off-by: Noam Camus > --- > arch/arc/plat-eznps/Kconfig | 11 +++++++++++ > arch/arc/plat-eznps/entry.S | 14 ++++++++++++++ > 2 files changed, 25 insertions(+), 0 deletions(-) > > diff --git a/arch/arc/plat-eznps/Kconfig b/arch/arc/plat-eznps/Kconfig > index feaa471..c5f946c 100644 > --- a/arch/arc/plat-eznps/Kconfig > +++ b/arch/arc/plat-eznps/Kconfig > @@ -32,3 +32,14 @@ config EZNPS_MTM_EXT > any of them seem like CPU from Linux point of view. > All threads within same core share the execution unit of the > core and HW scheduler round robin between them. > + > +config EZNPS_MEM_ERROR > + bool "ARC-EZchip Memory error as an exception" > + depends on ARC_PLAT_EZNPS > + default n > + help > + On the real chip of the NPS, user memory errors are handled > + as a machine check exception, whereas on simulator platform > + for NPS, it handled as an interrupt level 2 (like legacy arc > + real chip architecture).This configuration will cause the kernel > + to handle memory error as a machine check exception. Do you really need a Kconfig option here. AFAIKR you guys had some magic in platform code to determine whether running on sim or hw - can that be not used ? > diff --git a/arch/arc/plat-eznps/entry.S b/arch/arc/plat-eznps/entry.S > index 328261c..03e2892 100644 > --- a/arch/arc/plat-eznps/entry.S > +++ b/arch/arc/plat-eznps/entry.S > @@ -68,3 +68,17 @@ ENTRY(res_service) > > j stext > END(res_service) > + > +#if defined(CONFIG_EZNPS_MEM_ERROR) > +ENTRY(mem_service) > + ; SW workaround to cover up on a difference between > + ; NPS real chip and simulator behaviors. > + ; NPS real chip will activate a machine check exception > + ; in case of memory error, while the simulator will > + ; trigger a level 2 interrupt. Therefor this code section > + ; should be reached only in simulation mode. > + ; DEAD END: display Regs and HALT > + > + j EV_MachineCheck > +END(mem_service) > +#endif Just squash the weak symbol patch in here - not worth a separate patch ! -Vineet