From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 8232F1B00F for ; Tue, 9 Jan 2018 03:55:48 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2018 18:55:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,333,1511856000"; d="scan'208";a="193428108" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga006.fm.intel.com with ESMTP; 08 Jan 2018 18:55:46 -0800 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 8 Jan 2018 18:55:46 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 8 Jan 2018 18:55:45 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.159]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Tue, 9 Jan 2018 10:55:44 +0800 From: "Wang, Xiao W" To: 'Yuanhan Liu' CC: "Bie, Tiwei" , "'dev@dpdk.org'" , "'stephen@networkplumber.org'" Thread-Topic: [PATCH v6 2/3] net/virtio: add packet injection method Thread-Index: AQHTh2fH1krhAZUhnkW98xT0UcktDaNpbUEAgACebSCAAM1YsA== Date: Tue, 9 Jan 2018 02:55:44 +0000 Message-ID: References: <20180107120513.142196-1-xiao.w.wang@intel.com> <20180107120513.142196-3-xiao.w.wang@intel.com> <20180108130334.GN8818@yliu-mob> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTZjMWVkMGEtMjYzOC00MzVjLWEwNDItNTgzNTFlZmZlYjI5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJ2TkNlQmM0VHBFWk8xWTVHanBQY0tKQXkwWTRWc1RVdDRXOTdMcG5tU2N1MlJIakFRbWF1TzlqR1phbTZVbFcrIn0= dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v6 2/3] net/virtio: add packet injection method 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: Tue, 09 Jan 2018 02:55:49 -0000 > -----Original Message----- > From: Wang, Xiao W > Sent: Monday, January 8, 2018 11:12 PM > To: Yuanhan Liu > Cc: Bie, Tiwei ; dev@dpdk.org; > stephen@networkplumber.org > Subject: RE: [PATCH v6 2/3] net/virtio: add packet injection method >=20 >=20 >=20 > > -----Original Message----- > > From: Yuanhan Liu [mailto:yliu@fridaylinux.org] > > Sent: Monday, January 8, 2018 9:04 PM > > To: Wang, Xiao W > > Cc: Bie, Tiwei ; dev@dpdk.org; > > stephen@networkplumber.org > > Subject: Re: [PATCH v6 2/3] net/virtio: add packet injection method > > > > On Sun, Jan 07, 2018 at 04:05:12AM -0800, Xiao Wang wrote: > > > + /* > > > + * App management thread and virtio interrupt handler thread > > > + * both can change the 'started' flag, this lock is meant to > > > + * avoid such a contention. > > > + */ > > > + rte_spinlock_t state_lock; > > > > Why not turning the "started" to atomic type, so that you don't need > > the lock? > > > During the interrupt handler routine, there are a series of instructions > between lock acquire and release. An atomic value is not suitable for thi= s > scenario. >=20 The current comment may doesn't explain the state_lock correctly, this lock= needs to be acquired in dev_pause and released in dev_resume, so it's not = just used to protect the "started" value. I would improve the comment as " App management thread and virtio interrupt= handler thread both can change device state, ..." Thanks for comments, Xiao