From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0085.outbound.protection.outlook.com [104.47.33.85]) by dpdk.org (Postfix) with ESMTP id 631B32A58 for ; Wed, 21 Sep 2016 19:15:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=harmonic.onmicrosoft.com; s=selector1-harmonicinc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=dhOYZwY3jpXDFO/ugQ3Fm8xlvQAdwGJDbfNNjAq7PtE=; b=C1K5rVy1Iae9ph1bQfxmmQMCDdvmekqbLHWWD/Hmf/lph1OWGvJhB1DQwbI4i0N+5sqRwX7fzEkaZaV8SwfU4eQmyBj/PzK1h8QVb2ELrqoPyXTpBLe5TWG115x7hirRBDdZblQcrWfe2CF4TBKCOTvFisFN3IL7qt75m91pU0A= Received: from MWHPR11MB1360.namprd11.prod.outlook.com (10.169.235.22) by MWHPR11MB1358.namprd11.prod.outlook.com (10.169.232.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.629.8; Wed, 21 Sep 2016 17:15:19 +0000 Received: from MWHPR11MB1360.namprd11.prod.outlook.com ([10.169.235.22]) by MWHPR11MB1360.namprd11.prod.outlook.com ([10.169.235.22]) with mapi id 15.01.0629.006; Wed, 21 Sep 2016 17:15:19 +0000 From: Vladyslav Buslov To: Ferruh Yigit , Stephen Hemminger CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] kni: add support for core_id param in single threaded mode Thread-Index: AQHSE23mmjhr3dPq70+BF5hO1nXy2aCEKW4AgAACTgA= Date: Wed, 21 Sep 2016 17:15:19 +0000 Message-ID: References: <20160910135016.6468-2-vladyslav.buslov@harmonicinc.com> <20160920181637.26778-1-vladyslav.buslov@harmonicinc.com> <20160920113636.38b2ed2a@xeon-e3> <366f0b2a-abb6-9fdc-cd12-d79185d32c5e@intel.com> In-Reply-To: <366f0b2a-abb6-9fdc-cd12-d79185d32c5e@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Vladyslav.Buslov@harmonicinc.com; x-originating-ip: [95.67.66.62] x-ms-office365-filtering-correlation-id: 46b374d9-ee74-4eb5-53f7-08d3e242dd67 x-microsoft-exchange-diagnostics: 1; MWHPR11MB1358; 20:DDJ7OQfyKAbiBl1Hpwsw5gId+uUpPxdcGBcQhFwqsy1nRKHt8ojPjPBzP52fUHDPLrStQTzTiejHss3AMHyfCNSauaAw1MWGjZpd0Tch33uTYqno+EFLTPVNzjKrogX5sIQ+E8Evhu34oJv2FBM6qsS6DgUvfeWfVIAvxn7Bqxg= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:MWHPR11MB1358; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:MWHPR11MB1358; BCL:0; PCL:0; RULEID:; SRVR:MWHPR11MB1358; x-forefront-prvs: 007271867D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(24454002)(189002)(377454003)(199003)(68736007)(6116002)(19580395003)(9686002)(19580405001)(2906002)(586003)(92566002)(4326007)(102836003)(105586002)(99286002)(3846002)(11100500001)(87936001)(5002640100001)(2900100001)(2950100001)(77096005)(93886004)(106116001)(76576001)(106356001)(189998001)(76176999)(74316002)(5001770100001)(10400500002)(101416001)(5660300001)(86362001)(7696004)(305945005)(33656002)(8936002)(3660700001)(54356999)(66066001)(50986999)(7846002)(3280700002)(8676002)(7736002)(81156014)(122556002)(97736004)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR11MB1358; H:MWHPR11MB1360.namprd11.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: harmonicinc.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: harmonicinc.com X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Sep 2016 17:15:19.7885 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 19294cf8-3352-4dde-be9e-7f47b9b6b73d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1358 Subject: Re: [dpdk-dev] [PATCH] kni: add support for core_id param in single threaded mode X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2016 17:15:22 -0000 > On 9/20/2016 7:36 PM, Stephen Hemminger wrote: > > On Tue, 20 Sep 2016 21:16:37 +0300 > > Vladyslav Buslov wrote: > > > >> @@ -123,6 +125,9 @@ static int __net_init kni_init_net(struct net *net= ) > >> /* Clear the bit of device in use */ > >> clear_bit(KNI_DEV_IN_USE_BIT_NUM, &knet->device_in_use); > >> > >> + mutex_init(&knet->kni_kthread_lock); > >> + knet->kni_kthread =3D NULL; > >> + > > > > Why not just use kzalloc() here? You would still need to init the > > mutex etc, but it would be safer. > > >=20 > Hi Vladyslav, >=20 > This is good suggestion, if you send a new version for this update, pleas= e > keep my Ack. >=20 > Thanks, > ferruh Hi Ferruh, Stephen, Could you please elaborate on using kzalloc for this code. Currently kni_thread_lock is value member of kni_net structure and never ex= plicitly allocated or deallocated. Kni_kthread is pointer member of kni_net and is implicitly created and dest= royed by kthread_run, kthread_stop functions. Which one of those do you suggest to allocate with kzalloc() and how would = it improve safety? Sorry for not being able to follow your code review but my Kernel programmi= ng experience is somewhat limited. Thanks, Vladyslav