From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0049.outbound.protection.outlook.com [104.47.40.49]) by dpdk.org (Postfix) with ESMTP id 12DDE690F for ; Tue, 6 Sep 2016 16:38:12 +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=qSZ5oV1RsiGh0qFaEd1L0ItoSIHnxdTGQbDq6uU/YRY=; b=rDtKsNs6R/u6VsnOZ0A8S/b9KSV3+e3qG1vuftHxnKr1P/3PyclEjSMedu7eiZGkjooDAx8qX1J8Pt8B7YUqx/HndwvGopkrjGXg2xHUOUyVBKxiu0jsQZwfz7ZpkEz7oLhLTz5ZjiktbieC9TLMFYCt2XBymERAkh4Y4wz3sW0= Received: from MWHPR11MB1360.namprd11.prod.outlook.com (10.169.235.22) by MWHPR11MB1360.namprd11.prod.outlook.com (10.169.235.22) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9; Tue, 6 Sep 2016 14:38:10 +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.0609.006; Tue, 6 Sep 2016 14:38:10 +0000 From: Vladyslav Buslov To: Ferruh Yigit CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] kni: add support for core_id param in single threaded mode Thread-Index: AQHSCEl1cbyndnN5nkCM0qPmVxc2+qBshfIAgAABSuA= Date: Tue, 6 Sep 2016 14:38:10 +0000 Message-ID: References: <20160906112513.26090-1-vladyslav.buslov@harmonicinc.com> <20160906112513.26090-2-vladyslav.buslov@harmonicinc.com> <072eecca-8108-a45b-91b7-7245dfbe760b@intel.com> <205fd2b1-4e0c-b5d3-df0c-e2777919e4f6@intel.com> In-Reply-To: <205fd2b1-4e0c-b5d3-df0c-e2777919e4f6@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: 3b337a27-e9ab-4039-865d-08d3d6636cba x-microsoft-exchange-diagnostics: 1; MWHPR11MB1360; 20:o97/gm065rN1J7sd2DCOQWzL/Nv+hm6Dj6jmfSa40KDSS24hYUNNRE3UyskN9+Bwh4kLYpDU+dR6mrqwEY8akPJePBkwi4C0SvcDAeVu/R5HZsCPPTpLrQASYXU1pJopZ81ngpRtoI75BUFVbvFexIZ++GlvgyNN2ujabBPXzfo= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:MWHPR11MB1360; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:MWHPR11MB1360; BCL:0; PCL:0; RULEID:; SRVR:MWHPR11MB1360; x-forefront-prvs: 0057EE387C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(76104003)(13464003)(24454002)(199003)(189002)(377454003)(4326007)(2900100001)(76176999)(93886004)(66066001)(33656002)(2950100001)(10400500002)(87936001)(3660700001)(86362001)(8676002)(77096005)(19580405001)(8936002)(50986999)(54356999)(9686002)(5002640100001)(6116002)(3846002)(122556002)(81156014)(2906002)(5660300001)(81166006)(92566002)(76576001)(106116001)(19580395003)(99286002)(305945005)(189998001)(586003)(110136002)(97736004)(105586002)(74316002)(68736007)(7696003)(11100500001)(7846002)(102836003)(101416001)(7736002)(3280700002)(106356001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR11MB1360; H:MWHPR11MB1360.namprd11.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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: 06 Sep 2016 14:38:10.1619 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 19294cf8-3352-4dde-be9e-7f47b9b6b73d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1360 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: Tue, 06 Sep 2016 14:38:12 -0000 Ferruh, Thanks for suggestions. I'll try to provide new patch this week. Regards, Vladyslav -----Original Message----- From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]=20 Sent: Tuesday, September 06, 2016 5:31 PM To: Vladyslav Buslov Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] kni: add support for core_id param in singl= e threaded mode On 9/6/2016 3:14 PM, Ferruh Yigit wrote: > On 9/6/2016 12:25 PM, Vladyslav Buslov wrote: >> Allow binding KNI thread to specific core in single threaded mode by=20 >> setting core_id and force_bind config parameters. >=20 > Thanks, patch does exactly what we talked, and as I tested it works fine. >=20 > 1) There are a few comments, can you please find them inline. >=20 > 2) Would you mind adding some document related this new feature? > Document path is: doc/guides/prog_guide/kernel_nic_interface.rst >=20 >> >> Signed-off-by: Vladyslav Buslov >> --- >> lib/librte_eal/linuxapp/kni/kni_misc.c | 48=20 >> ++++++++++++++++++++++------------ >> 1 file changed, 32 insertions(+), 16 deletions(-) >> >> diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c=20 >> b/lib/librte_eal/linuxapp/kni/kni_misc.c >> index 59d15ca..5e7cf21 100644 >> --- a/lib/librte_eal/linuxapp/kni/kni_misc.c >> +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c >> @@ -30,6 +30,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -100,6 +101,7 @@ static int kni_net_id; >> =20 >> struct kni_net { >> unsigned long device_in_use; /* device in use flag */ >> + struct mutex kni_kthread_lock; >> struct task_struct *kni_kthread; >> struct rw_semaphore kni_list_lock; >> struct list_head kni_list_head; >> @@ -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); >> =20 >> + mutex_init(&knet->kni_kthread_lock); >> + knet->kni_kthread =3D NULL; >> + >> init_rwsem(&knet->kni_list_lock); >> INIT_LIST_HEAD(&knet->kni_list_head); >> =20 >> @@ -139,9 +144,9 @@ static int __net_init kni_init_net(struct net=20 >> *net) >> =20 >> static void __net_exit kni_exit_net(struct net *net) { -#ifndef=20 >> HAVE_SIMPLIFIED_PERNET_OPERATIONS >> struct kni_net *knet =3D net_generic(net, kni_net_id); >> - >> + mutex_destroy(&knet->kni_kthread_lock); >> +#ifndef HAVE_SIMPLIFIED_PERNET_OPERATIONS >> kfree(knet); >> #endif >> } >> @@ -236,16 +241,9 @@ kni_open(struct inode *inode, struct file *file) >> return -EBUSY; >> =20 >> /* Create kernel thread for single mode */ >> - if (multiple_kthread_on =3D=3D 0) { >> + if (multiple_kthread_on =3D=3D 0) >> KNI_PRINT("Single kernel thread for all KNI devices\n"); >> - /* Create kernel thread for RX */ >> - knet->kni_kthread =3D kthread_run(kni_thread_single, (void *)knet, >> - "kni_single"); >> - if (IS_ERR(knet->kni_kthread)) { >> - KNI_ERR("Unable to create kernel threaed\n"); >> - return PTR_ERR(knet->kni_kthread); >> - } >> - } else >> + else >> KNI_PRINT("Multiple kernel thread mode enabled\n"); >=20 > Can move logs to where threads actually created (kni_ioctl_create) Thinking twice, moving logs to kni_ioctl_create() can be too verbose since = it has been called multiple times, but we need this log only once. Keepin in open() cb isn't good option, what do you think moving into kni_in= it(), after kni_parse_ktread_mode? I think fits here better since this is a= module param...