From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <konstantin.ananyev@intel.com>
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
 by dpdk.org (Postfix) with ESMTP id 7BCFF7CC5
 for <dev@dpdk.org>; Fri, 20 Apr 2018 18:16:27 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga006.fm.intel.com ([10.253.24.20])
 by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 20 Apr 2018 09:16:26 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="222064764"
Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159])
 by fmsmga006.fm.intel.com with ESMTP; 20 Apr 2018 09:16:24 -0700
Received: from irsmsx102.ger.corp.intel.com ([169.254.2.164]) by
 IRSMSX104.ger.corp.intel.com ([169.254.5.171]) with mapi id 14.03.0319.002;
 Fri, 20 Apr 2018 17:16:23 +0100
From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: "Guo, Jia" <jia.guo@intel.com>, "stephen@networkplumber.org"
 <stephen@networkplumber.org>, "Richardson, Bruce"
 <bruce.richardson@intel.com>, "Yigit, Ferruh" <ferruh.yigit@intel.com>,
 "gaetan.rivet@6wind.com" <gaetan.rivet@6wind.com>, "Wu, Jingjing"
 <jingjing.wu@intel.com>, "thomas@monjalon.net" <thomas@monjalon.net>,
 "motih@mellanox.com" <motih@mellanox.com>, "matan@mellanox.com"
 <matan@mellanox.com>, "Van Haaren, Harry" <harry.van.haaren@intel.com>,
 "Tan, Jianfeng" <jianfeng.tan@intel.com>
CC: "jblunck@infradead.org" <jblunck@infradead.org>, "shreyansh.jain@nxp.com"
 <shreyansh.jain@nxp.com>, "dev@dpdk.org" <dev@dpdk.org>, "Zhang, Helin"
 <helin.zhang@intel.com>
Thread-Topic: [PATCH V20 2/4] eal: add failure handler mechanism for hot plug
Thread-Index: AQHT1xqzqPjYdX34MkmMybpR9E4Z+KQJeEawgABeo3A=
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> 
Accept-Language: en-IE, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzkwMTA3YTQtOTBjMy00YjdhLTgzMTYtYzI5NjllNzQ4NjNlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IjhtWGttejJqbG51QStuRXhzWHNXMTkzUEhtQ0RubjBUdzVzXC9nd1wvWGhHVT0ifQ==
x-ctpclassification: CTP_NT
dlp-product: dlpe-windows
dlp-version: 11.0.200.100
dlp-reaction: no-action
x-originating-ip: [163.33.239.181]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH V20 2/4] eal: add failure handler mechanism
	for hot plug
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Apr 2018 16:16:27 -0000


> > +
> > +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

> > +}
> > +