From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <michael.qiu@intel.com>
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id 27D358D28
 for <dev@dpdk.org>; Tue,  2 Feb 2016 03:57:31 +0100 (CET)
Received: from orsmga001.jf.intel.com ([10.7.209.18])
 by fmsmga104.fm.intel.com with ESMTP; 01 Feb 2016 18:57:30 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.22,383,1449561600"; d="scan'208";a="874648138"
Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203])
 by orsmga001.jf.intel.com with ESMTP; 01 Feb 2016 18:57:31 -0800
Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by
 FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS)
 id 14.3.248.2; Mon, 1 Feb 2016 18:57:29 -0800
Received: from shsmsx104.ccr.corp.intel.com (10.239.110.15) by
 fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS)
 id 14.3.248.2; Mon, 1 Feb 2016 18:57:29 -0800
Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.215]) by
 SHSMSX104.ccr.corp.intel.com ([169.254.5.117]) with mapi id 14.03.0248.002;
 Tue, 2 Feb 2016 10:57:27 +0800
From: "Qiu, Michael" <michael.qiu@intel.com>
To: "Zhang, Helin" <helin.zhang@intel.com>, "Lu, Wenzhuo"
 <wenzhuo.lu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [PATCH v2] ixgbe: Fix disable interrupt twice
Thread-Index: AQHRWlokuxzst+DuYUqlXTIjOup9yQ==
Date: Tue, 2 Feb 2016 02:57:26 +0000
Message-ID: <533710CFB86FA344BFBF2D6802E6028622F28B7B@SHSMSX101.ccr.corp.intel.com>
References: <1454046700-20843-1-git-send-email-michael.qiu@intel.com>
 <1454047090-21274-1-git-send-email-michael.qiu@intel.com>
 <6A0DE07E22DDAD4C9103DF62FEBC0909034256DA@shsmsx102.ccr.corp.intel.com>
 <533710CFB86FA344BFBF2D6802E6028622F28091@SHSMSX101.ccr.corp.intel.com>
 <6A0DE07E22DDAD4C9103DF62FEBC0909034266D1@shsmsx102.ccr.corp.intel.com>
 <533710CFB86FA344BFBF2D6802E6028622F28A4D@SHSMSX101.ccr.corp.intel.com>
 <F35DEAC7BCE34641BA9FAC6BCA4A12E70A991744@SHSMSX104.ccr.corp.intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [10.239.127.40]
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH v2] ixgbe: Fix disable interrupt twice
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://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: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 02 Feb 2016 02:57:31 -0000

On 2/2/2016 10:14 AM, Zhang, Helin wrote:=0A=
>=0A=
>> -----Original Message-----=0A=
>> From: Qiu, Michael=0A=
>> Sent: Tuesday, February 2, 2016 10:07 AM=0A=
>> To: Lu, Wenzhuo; dev@dpdk.org=0A=
>> Cc: Zhou, Danny; Liu, Yong; Liang, Cunming; Zhang, Helin=0A=
>> Subject: Re: [PATCH v2] ixgbe: Fix disable interrupt twice=0A=
>>=0A=
>> [+cc helin]=0A=
>>=0A=
>> On 2/2/2016 9:03 AM, Lu, Wenzhuo wrote:=0A=
>>> Hi Michael,=0A=
>>>=0A=
>>>> -----Original Message-----=0A=
>>>> From: Qiu, Michael=0A=
>>>> Sent: Monday, February 1, 2016 4:05 PM=0A=
>>>> To: Lu, Wenzhuo; dev@dpdk.org=0A=
>>>> Cc: Zhou, Danny; Liu, Yong; Liang, Cunming=0A=
>>>> Subject: Re: [PATCH v2] ixgbe: Fix disable interrupt twice=0A=
>>>>=0A=
>>>> On 1/29/2016 4:07 PM, Lu, Wenzhuo wrote:=0A=
>>>>> Hi Michael,=0A=
>>>>>=0A=
>>>>>> -----Original Message-----=0A=
>>>>>> From: Qiu, Michael=0A=
>>>>>> Sent: Friday, January 29, 2016 1:58 PM=0A=
>>>>>> To: dev@dpdk.org=0A=
>>>>>> Cc: Zhou, Danny; Liu, Yong; Liang, Cunming; Lu, Wenzhuo; Qiu,=0A=
>>>>>> Michael=0A=
>>>>>> Subject: [PATCH v2] ixgbe: Fix disable interrupt twice=0A=
>>>>>>=0A=
>>>>>> Currently, ixgbe vf and pf will disable interrupt twice in stop=0A=
>>>>>> stage and uninit stage. It will cause an error:=0A=
>>>>>>=0A=
>>>>>>     testpmd> quit=0A=
>>>>>>=0A=
>>>>>>     Shutting down port 0...=0A=
>>>>>>     Stopping ports...=0A=
>>>>>>     Done=0A=
>>>>>>     Closing ports...=0A=
>>>>>>     EAL: Error disabling MSI-X interrupts for fd 26=0A=
>>>>>>     Done=0A=
>>>>>>=0A=
>>>>>> Becasue the interrupt already been disabled in stop stage.=0A=
>>>>>> Since it is enabled in init stage, better remove from stop stage.=0A=
>>>>> I'm afraid it=92s not a good idea to just remove the intr_disable fro=
m=0A=
>> dev_stop.=0A=
>>>>> I think dev_stop have the chance to be used independently with=0A=
>>>>> dev_unint. In=0A=
>>>> this scenario, we still need intr_disable, right?=0A=
>>>>> Maybe what we need is some check before we disable the intr:)=0A=
>>>> Yes, indeed we need some check in disable intr, but it need=0A=
>>>> additional fields in "struct rte_intr_handle",  and it's much saft to=
=0A=
>>>> do so, but as I check i40e/fm10k code, only ixgbe disable it in dev_st=
op().=0A=
>>> I found fm10k doesn=92t enable intr in dev_start. So, I think it's OK. =
But i40e=0A=
>> enables intr in dev_start.=0A=
>>> To my opinion, it's more like i40e misses the intr_disable in dev_stop.=
=0A=
>> I don't think i40e miss it, because it not the right please to disable i=
nterrupt.=0A=
>> because all interrupts are enabled in init stage.=0A=
>>=0A=
>> Actually, ixgbe enable the interrupt in init stage, but in dev_start, it=
 disable it=0A=
>> first and re-enable, so it just the same with doing nothing about interr=
upt.=0A=
>>=0A=
>> Just think below:=0A=
>>=0A=
>> 1. start the port.(interrupt already enabled in init stage, disable -->=
=0A=
>> re-enable)=0A=
>> 2. stop the port.(disable interrupt)=0A=
>> 3. start port again(Try to disable, but failed, already disabled)=0A=
>>=0A=
>> Would you think the code has issue?=0A=
> [Zhang, Helin] in ixgbe PMD, it can be seen that uninit() calls dev_close=
(),=0A=
> which calls dev_stop(). So I think the disabling can be done only in dev_=
stop().=0A=
> All others can make use of dev_stop to disable the interrupt.=0A=
=0A=
As I said, if it is in dev_stop, it will has issue when dev_start -->=0A=
dev_stop --> dev_start, this also could applied in i40e and fm10k. If=0A=
you want to put it in dev_stop, better to remove enable interrupts in=0A=
init stage, and only put it in dev_start.=0A=
=0A=
Thanks,=0A=
Michael=0A=
> Regards,=0A=
> Helin=0A=
>=0A=
>> Thanks,=0A=
>> Michael=0A=
>>=0A=
>>> Maybe we can follow fm10k's style.=0A=
>>>=0A=
>>>> On other hand, if we remove it in dev_stop, any side effect? In ixgbe=
=0A=
>>>> start, it will always disable it first and then re-enable it, so it's =
safe.=0A=
>>> I think you mean we can disable intr anyway even if it has been disable=
d.=0A=
>> Actually, we couldn't, DPDK call VFIO ioctl to kernel to disable interru=
pts, and=0A=
>> if we try disable twice, it will return and error.=0A=
>> That's why I mean we need a flag to show the interrupts stats. If it alr=
eady=0A=
>> disabled, we do not need call in to kernel. just return and give a warni=
ng=0A=
>> message.=0A=
>>=0A=
>> Thanks,=0A=
>> Michael=0A=
>>=0A=
>>>  Sounds more like why we don't=0A=
>>> need this patch :)=0A=
>>>=0A=
>>>> Thanks,=0A=
>>>> Michael=0A=
>=0A=
=0A=