From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Ananyev, Konstantin" Subject: Re: [PATCH V20 2/4] eal: add failure handler mechanism for hot plug Date: Fri, 20 Apr 2018 16:16:23 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258AE918E93@IRSMSX102.ger.corp.intel.com> References: <1498711073-42917-1-git-send-email-jia.guo@intel.com> <1524058689-4954-1-git-send-email-jia.guo@intel.com> <1524058689-4954-3-git-send-email-jia.guo@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "jblunck@infradead.org" , "shreyansh.jain@nxp.com" , "dev@dpdk.org" , "Zhang, Helin" To: "Guo, Jia" , "stephen@networkplumber.org" , "Richardson, Bruce" , "Yigit, Ferruh" , "gaetan.rivet@6wind.com" , "Wu, Jingjing" , "thomas@monjalon.net" , "motih@mellanox.com" , "matan@mellanox.com" , "Van Haaren, Harry" , "Tan, Jianfeng" Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 7BCFF7CC5 for ; Fri, 20 Apr 2018 18:16:27 +0200 (CEST) Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > > + > > +static void sigbus_handler(int signum __rte_unused, siginfo_t *info, > > + void *ctx __rte_unused) > > +{ > > + int ret; > > + > > + RTE_LOG(ERR, EAL, "SIGBUS error, fault address:%p\n", info->si_addr); > > + ret =3D dev_uev_failure_process(NULL, info->si_addr); >=20 > As now you can try to mmap/munmap same address from two or more different= threads > you probably need some synchronization here. > Something simple as spinlock seems to be enough here. > We might have one per device or might be even a global one would be ok he= re. >=20 > > + if (!ret) > > + RTE_LOG(DEBUG, EAL, > > + "SIGBUS error is because of hot unplug!\n"); Also if sigbus handler wasn't able to fix things - failure addr doesn't bel= ong to=20 any devices, or remaping fails - we probably should invoke previously insta= lled handler or just apply default action. Konstantin > > +} > > +