From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sessmg22.ericsson.net (sessmg22.ericsson.net [193.180.251.58]) by dpdk.org (Postfix) with ESMTP id E925E2BAF for ; Tue, 6 Dec 2016 12:43:12 +0100 (CET) X-AuditID: c1b4fb3a-d644398000007918-6d-5846a450451e Received: from ESESSHC002.ericsson.se (Unknown_Domain [153.88.183.24]) by (Symantec Mail Security) with SMTP id 34.05.31000.054A6485; Tue, 6 Dec 2016 12:43:12 +0100 (CET) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.24) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 6 Dec 2016 12:42:40 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.onmicrosoft.com; s=selector1-ericsson-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=9SdoU8TTPaIzpK7HVzOZdRFBYEFYQaDtnBM6d0gh8rQ=; b=Oz8I0FCNi/Bqd3Z/gz14nlXR/vqA6lMGsziihRrZsL9NouI7cA7Fz97idlaH7408YnKcrOW8jloaVw8oVzMhAuM6/+faud3WTnsq+Eiwcas0ncf34FTJWe43bkpbEp8X4zP8+qskcE0I9+9WGAMXiycS+XrUHon/Gnp0SoQ2/5w= Received: from AM4PR0701MB2146.eurprd07.prod.outlook.com (10.167.132.143) by VI1PR07MB1007.eurprd07.prod.outlook.com (10.161.111.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.771.4; Tue, 6 Dec 2016 11:42:38 +0000 Received: from AM4PR0701MB2146.eurprd07.prod.outlook.com ([10.167.132.143]) by AM4PR0701MB2146.eurprd07.prod.outlook.com ([10.167.132.143]) with mapi id 15.01.0771.006; Tue, 6 Dec 2016 11:42:37 +0000 From: Jan Wickbom To: Yuanhan Liu CC: "huawei.xie@intel.com" , "dev@dpdk.org" , Patrik Andersson R Thread-Topic: [PATCH] vhost: allow for many vhost user ports Thread-Index: AQHSS+dsrC7gZAg5S0ivPPolwDmqTqD6g/OAgABL7VA= Date: Tue, 6 Dec 2016 11:42:36 +0000 Message-ID: References: <1480606010-6132-1-git-send-email-jan.wickbom@ericsson.com> <20161206065633.GQ24403@yliu-dev.sh.intel.com> In-Reply-To: <20161206065633.GQ24403@yliu-dev.sh.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=jan.wickbom@ericsson.com; x-originating-ip: [192.176.1.95] x-microsoft-exchange-diagnostics: 1; VI1PR07MB1007; 7:WZyRjwQSWFtWEmEnkdx2Nt6c+06zpESbQoaD1n0ThgowzxaB/V8rWIi3Bj7rm0qZKIiFSRBFKEXtF5H3KPrN0r4Al/gf5dqxw2/T/epyp28v2Xih22oerlOhiyO739hoCEGQQzvBDVTGjh3R9Mhw/llhjrKKVuWr9RvJElpwWxJcmXscrTyAZ8/qnI4ew6irLgdhG/3ddT4wXVcv5CsVsTXh8I0JdA6SzC6L085yb2+8hGtJeREMS4FXPCb3gj9HTPtN/gU96miLL6S4yv/W1nasOQYctuZJyR6OrhgT+uvQVd15SzdYxKlGrl5AXcmeN7Pf0bINP03thclF4ZTO/8941uIW7+n1KINETOO7JwqLGUrg6UT5u/m+9H7LaIA9o0Jy4VK6hLfDuSXYlm8+eZ8MVhxardcsdnyEtY3kkTb6+e70W68/18thEbiDBBnVrZsZX8dYwC3Hsx60dnQvCg== x-forefront-antispam-report: SFV:SKI; SCL:-1SFV:NSPM; SFS:(10009020)(6009001)(7916002)(13464003)(24454002)(189002)(199003)(8936002)(81156014)(81166006)(106116001)(77096006)(74316002)(9686002)(39450400002)(6116002)(3660700001)(229853002)(105586002)(4001430100002)(39840400001)(189998001)(76576001)(305945005)(39850400001)(6506006)(92566002)(39860400001)(3280700002)(107886002)(106356001)(39410400001)(5660300001)(7736002)(2900100001)(7846002)(38730400001)(97736004)(33656002)(110136003)(15395725005)(7696004)(4326007)(122556002)(3846002)(54356999)(50986999)(2906002)(101416001)(76176999)(6916009)(8676002)(66066001)(86362001)(2950100002)(102836003)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR07MB1007; H:AM4PR0701MB2146.eurprd07.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; x-ms-office365-filtering-correlation-id: 2c6ff604-72c5-419a-8a94-08d41dccfa0a x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:VI1PR07MB1007; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(37575265505322)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123558021)(20161123560025)(20161123564025)(20161123555025)(20161123562025)(6072148); SRVR:VI1PR07MB1007; BCL:0; PCL:0; RULEID:; SRVR:VI1PR07MB1007; x-forefront-prvs: 01480965DA received-spf: None (protection.outlook.com: ericsson.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-MS-Exchange-CrossTenant-originalarrivaltime: 06 Dec 2016 11:42:36.9789 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB1007 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA02Se0iTYRTGeb/L/JRGn/N2MCMZ/hHeMrFYaqGWF4jIgmh005FfKs4L+0w0 imak6crSSKbLy8KVqKWQwqzEG2XeaiXijURBnYlWa2qGpuX2KvTf75znOYfnPbwMKSqgXZnE lHROkSKTiwV2VKlUDz7RugipX++Yh+S7WU9I7pR+ICTDhZ/oEDJqVfuUjqpqmSOiKnpORZPn 7ILjOHliBqfYdyTWLqGlyyZtDTJN9Q2UEt11UCFbBtgA+FjeZqNCdoyIrUdgepRP4+I9As3j WmtBsQUk1M7PEFhRE9Bv1pG46EMwMFJBWZYJWG+o+5ZHW9iR9YGZsnrrOMnmISjU51oFBzYI Wr8sUdgUDLm3TQTmQBgoriQtTLEe0N/2ytoXsrGwPoo9IjYT1IsT1lnbzT1dao3Awoh1hpXe 51YPybrA2HQlgV/Hgq7FQGJ2grmpDRr7z0NN6zSF++6Q376w5b9HQWelvSU0sGoBdDcO0lg4 ARumPmqbi95N2WBOgiVzy9bwcSi+X44wawjQmXerELPJblCscsb5Oah+kYPwHVxhfDAfFSJP zX+xMXuD9o1ZgNkLnj2ZJzXWU9hDT+k0pUVULXLiOZ5Pjvf39+UUiZd5PjXFN4VLf4k2P0lH 01pgM+qYDe1ELIPEO4QmZbhURMsy+KzkTgQMKXYUZldFSEXCOFnWNU6RGqO4Kuf4TrSLocQu woM1E2dFbLwsnUviuDROsa0SjK2rEgm8AkdWf4eV5BjGF9rPzAfNLx/IlRuPvQ1ZH7s+rD2k 93kd/WMyUnQjXPMzfkg1pCwyOuxxMxLdU03N69pLAZKTy36tF5bbc26uZX9tmK2LmSw7bPoT E3DFUL0o05XcWvm716j+/CAylDQEH3UfpcOGyJCVxot9O/1Tfw0/PB1dI6b4BNl+T1LBy/4B iA6wGyADAAA= Subject: Re: [dpdk-dev] [PATCH] vhost: allow for many vhost user ports 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, 06 Dec 2016 11:43:13 -0000 > -----Original Message----- > From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com] > Sent: den 6 december 2016 07:57 > To: Jan Wickbom > Cc: huawei.xie@intel.com; dev@dpdk.org; Patrik Andersson R > > Subject: Re: [PATCH] vhost: allow for many vhost user ports >=20 > On Thu, Dec 01, 2016 at 04:26:50PM +0100, Jan Wickbom wrote: > > Currently select() is used to monitor file descriptors for vhostuser > > ports. This limits the number of ports possible to create since the > > fd number is used as index in the fd_set and we have seen fds > 1023. >=20 > Yeah, it's a known issue for a while. Thanks for making a patch to fix > that! Thanks for your comments! Please see below for some questions/opinions. >=20 > > This patch changes select() to poll(). This way we can keep an > > packed (pollfd) array for the fds, e.g. as many fds as the size of > > the array. > > > > Also see: > > http://dpdk.org/ml/archives/dev/2016-April/037024.html > > > ... > > +/** > > + * Adjusts the highest index populated in the array of fds >=20 > This function only shrinks (but not extends) the fdset array, so why > not naming it to something like "fdset_shrink". >=20 > > + * @return > > + * Index of highest position populated + 1. >=20 > I think it's clearer to say "The new size of fdset". >=20 >=20 > > @@ -189,7 +206,7 @@ > > pfdset->fd[i].fd =3D -1; > > pfdset->fd[i].rcb =3D pfdset- > >fd[i].wcb =3D NULL; > > pfdset->fd[i].dat =3D NULL; > > - pfdset->num--; > > + (void) fdset_adjust_num(pfdset); >=20 > Unncessary cast. I'd like to keep the cast. The function returns int and it's nice to show w= e deliberately don't care. No strong opinion though, but we should do the same everywhere.= Please see below. >=20 > > i =3D -1; > > } > > pthread_mutex_unlock(&pfdset->fd_mutex); > > @@ -211,12 +228,12 @@ > > > > pfdset->fd[index].fd =3D -1; > > pfdset->fd[index].rcb =3D pfdset->fd[index].wcb =3D NULL; > > - pfdset->fd[index].dat =3D NULL; > > - pfdset->num--; > > + (void) fdset_adjust_num(pfdset); If we remove the cast above, we should remove this one as well. > > > > pthread_mutex_unlock(&pfdset->fd_mutex); > > } > > > > + > > /** > > * This functions runs in infinite blocking loop until there is no fd = in > > * pfdset. It calls corresponding r/w handler if there is event on the= fd. > > @@ -229,44 +246,48 @@ > > void > > fdset_event_dispatch(struct fdset *pfdset) > > { > > - fd_set rfds, wfds; > > - int i, maxfds; > > + int i; > > struct fdentry *pfdentry; > > - int num =3D MAX_FDS; > > + int numfds; > > fd_cb rcb, wcb; > > void *dat; > > int fd; > > int remove1, remove2; > > int ret; > > + int handled; > > > > if (pfdset =3D=3D NULL) > > return; > > > > + struct pollfd * const rwfds =3D > > + rte_malloc("struct pollfd", MAX_FDS * > sizeof(*rwfds), 0); >=20 > There is neither a NULL check, nor a free after the usage. Since it's > a fixed size at compile time (MAX_FDS), you might want to define a > static array for that. >=20 > --yliu