From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0046.outbound.protection.outlook.com [104.47.0.46]) by dpdk.org (Postfix) with ESMTP id B8E2E1B2BA for ; Wed, 14 Feb 2018 14:59:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=pXdrBeP+oPpEcEO/24+15ZCBTRlB6xealJJV14Ma7wE=; b=ZzPrTiKlEzxThBAQiU9HLrpHHeg2y3XtKjMBsqMlW1ccm9oTgeQODnldgWhfDxsvuKGE1Rjq8hoi8R1EJOZgZB2cUmUGohVLJNDhVzPwj/I3gEWhYxJ2LLFsdoAS2B1RBNo8xE8qib0JpY4bBwZD8jNVRXdqK29v3/4pX/HoLMk= Received: from AM4PR0501MB2657.eurprd05.prod.outlook.com (10.172.215.19) by AM4PR0501MB1923.eurprd05.prod.outlook.com (10.167.91.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.10; Wed, 14 Feb 2018 13:59:56 +0000 Received: from AM4PR0501MB2657.eurprd05.prod.outlook.com ([fe80::80c6:df5:b1b0:ff05]) by AM4PR0501MB2657.eurprd05.prod.outlook.com ([fe80::80c6:df5:b1b0:ff05%17]) with mapi id 15.20.0506.016; Wed, 14 Feb 2018 13:59:56 +0000 From: Matan Azrad To: =?iso-8859-1?Q?Ga=EBtan_Rivet?= CC: "dev@dpdk.org" Thread-Topic: [PATCH] net/failsafe: fix Rx interrupt reinstallation Thread-Index: AQHTpZsW5gV3+oToOk6tfe7RNDqgwqOj7N9A Date: Wed, 14 Feb 2018 13:59:56 +0000 Message-ID: References: <1518562772-29823-1-git-send-email-matan@mellanox.com> <20180214135227.o7lddtw5jmnnec7u@bidouze.vm.6wind.com> In-Reply-To: <20180214135227.o7lddtw5jmnnec7u@bidouze.vm.6wind.com> Accept-Language: en-US, he-IL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR0501MB1923; 7:OQJ3cGiq5V6ZQHf2EITCEvNSCKjkMTkzLreqh9AZL3DRuR9HeAgAK0FdKYvCghlEQgXgmrSJ5WXzJ/PTMUOCoDt3RekVaK+9b1DSub/qTRXSVS+qE+GZgo43baOw0QGNQJ6ujd9LYRixe4bZjTinVgCFO1fopZ6bzEwn3/I+1+Yac69pqMAa/osGPHe6+W7nYmDXcUoeEVTTK4PzlRTWX1S+By7eRCljziXUKZz6b5gjxipykMrvmNXyruPCabB3 x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 591f3330-2037-4ddd-93e1-08d573b33a96 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020); SRVR:AM4PR0501MB1923; x-ms-traffictypediagnostic: AM4PR0501MB1923: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3231101)(2400082)(944501161)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041288)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:AM4PR0501MB1923; BCL:0; PCL:0; RULEID:; SRVR:AM4PR0501MB1923; x-forefront-prvs: 0583A86C08 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(396003)(346002)(39860400002)(39380400002)(199004)(189003)(13464003)(8676002)(14454004)(5660300001)(66066001)(102836004)(6506007)(99286004)(316002)(55016002)(53546011)(97736004)(229853002)(3280700002)(33656002)(9686003)(3660700001)(59450400001)(106356001)(76176011)(478600001)(8936002)(68736007)(6246003)(4326008)(7736002)(2900100001)(7696005)(2950100002)(6436002)(26005)(6916009)(2906002)(3846002)(186003)(5250100002)(74316002)(105586002)(53936002)(25786009)(81166006)(81156014)(6116002)(305945005)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR0501MB1923; H:AM4PR0501MB2657.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: QHu7L5v6ooVUXMw88J2MI+1Yan+4BSf+7aivEKxCfBhoukK4+jg1i3ki2nMgw/cP1zJK1B/UT2zl4ySO/Warsg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 591f3330-2037-4ddd-93e1-08d573b33a96 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Feb 2018 13:59:56.0986 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0501MB1923 Subject: Re: [dpdk-dev] [PATCH] net/failsafe: fix Rx interrupt reinstallation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Feb 2018 13:59:58 -0000 Hi Gaetan Agree, will send V2. > -----Original Message----- > From: Ga=EBtan Rivet [mailto:gaetan.rivet@6wind.com] > Sent: Wednesday, February 14, 2018 3:52 PM > To: Matan Azrad > Cc: dev@dpdk.org > Subject: Re: [PATCH] net/failsafe: fix Rx interrupt reinstallation >=20 > Hi Matan, >=20 > On Tue, Feb 13, 2018 at 10:59:32PM +0000, Matan Azrad wrote: > > Fail-safe dev_start() operation can be called by both the application > > and the hot-plug alarm mechanism. > > > > The installation of Rx interrupt are triggered from dev_start() in any > > time it is called while actually the Rx interrupt should be installed > > only by the application calls. > > > > So, each plug-in event causes reinstallation which causes memory leak. > > > > Trigger the Rx interrupt installation only for application calls. > > > > Fixes: 9e0360aebf23 ("net/failsafe: register as Rx interrupt mode") > > > > Signed-off-by: Matan Azrad > > --- > > drivers/net/failsafe/failsafe_ops.c | 10 ++++++---- > > 1 file changed, 6 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/net/failsafe/failsafe_ops.c > > b/drivers/net/failsafe/failsafe_ops.c > > index 057e435..bbbd335 100644 > > --- a/drivers/net/failsafe/failsafe_ops.c > > +++ b/drivers/net/failsafe/failsafe_ops.c > > @@ -181,10 +181,12 @@ > > int ret; > > > > fs_lock(dev, 0); > > - ret =3D failsafe_rx_intr_install(dev); > > - if (ret) { > > - fs_unlock(dev, 0); > > - return ret; > > + if (PRIV(dev)->alarm_lock =3D=3D 0) { >=20 > I dislike having to rely on unrelated context of execution to decide a co= de- > path. >=20 > I'd prefer to make interrupt installation dependent on the interrupt stat= e > instead. >=20 > I think it should be possible to forbid reinstallation within > failsafe_rx_intr_install directly, e.g. >=20 > diff --git a/drivers/net/failsafe/failsafe_intr.c > b/drivers/net/failsafe/failsafe_intr.c > index f6ff04dc8..46c3aa5f2 100644 > --- a/drivers/net/failsafe/failsafe_intr.c > +++ b/drivers/net/failsafe/failsafe_intr.c > @@ -523,7 +523,8 @@ failsafe_rx_intr_install(struct rte_eth_dev *dev) > const struct rte_intr_conf *const intr_conf =3D > &priv->dev->data->dev_conf.intr_conf; >=20 > - if (intr_conf->rxq =3D=3D 0) > + if (intr_conf->rxq =3D=3D 0 || > + dev->intr_handle !=3D NULL) > return 0; > if (fs_rx_intr_vec_install(priv) < 0) > return -rte_errno; >=20 > This way the logic is self-dependent and the check limited to this compon= ent. >=20 > There might be better way to do this, it's only an example to explain my > point. >=20 > > + ret =3D failsafe_rx_intr_install(dev); > > + if (ret) { > > + fs_unlock(dev, 0); > > + return ret; > > + } > > } > > FOREACH_SUBDEV(sdev, i, dev) { > > if (sdev->state !=3D DEV_ACTIVE) > > -- > > 1.9.5 > > >=20 > -- > Ga=EBtan Rivet > 6WIND