From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sessmg23.ericsson.net (sessmg23.ericsson.net [193.180.251.45]) by dpdk.org (Postfix) with ESMTP id 548CA2BA4 for ; Mon, 12 Dec 2016 17:55:22 +0100 (CET) X-AuditID: c1b4fb2d-26a859800000561e-01-584ed679befc Received: from ESESSHC009.ericsson.se (Unknown_Domain [153.88.183.45]) by (Symantec Mail Security) with SMTP id 63.95.22046.976DE485; Mon, 12 Dec 2016 17:55:21 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.45) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 12 Dec 2016 17:55:31 +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=AJ1fPeeKZQfOlQGTWZvJgzPBy4g4yjeS0NJb8n2ukdg=; b=JVY7c6sW8DivgB1D5uKRmd2Y0q5zO94CYOXGDxUJ9H5Ys2ET77rNEbvxcZJPwGvYV6yFqx9gPR81rIV6Gd18ConjKu0pe9ns8l28nvF1cET2ewNQRS8CsqZ+SGQNmrOX22/nrGZsCRvvXTyk8DAoOb+kkUqGpANKR4B5xB18Wks= Received: from AM4PR0701MB2146.eurprd07.prod.outlook.com (10.167.132.143) by HE1PR07MB1003.eurprd07.prod.outlook.com (10.162.27.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.771.4; Mon, 12 Dec 2016 16:55:13 +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.014; Mon, 12 Dec 2016 16:55:11 +0000 From: Jan Wickbom To: Yuanhan Liu CC: "dev@dpdk.org" , Patrik Andersson R Thread-Topic: [PATCH] vhost: allow for many vhost user ports Thread-Index: AQHSS+dsrC7gZAg5S0ivPPolwDmqTqD8TSeAgAAuW+CAARqzgIAHAqFg Date: Mon, 12 Dec 2016 16:55:10 +0000 Message-ID: References: <1480606010-6132-1-git-send-email-jan.wickbom@ericsson.com> <20161207101257.GK31182@yliu-dev.sh.intel.com> <20161208055041.GO31182@yliu-dev.sh.intel.com> In-Reply-To: <20161208055041.GO31182@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; HE1PR07MB1003; 7:yR/MxX7LX4KUa3tUUMMO/VXXZyisLYvEuIh/r9JR55V60XmESBYXTNKYnxoovLnHsp+sscBnysaSgHypUnTZpmmKsqe/bXZkCL3+38BGSoxixh0z+a/Lzhn6ER15BGIIvcwUwEdPck1c17VeyoqdFl1kdOShmRw3XaiNmjd0ZqtpqQ/iGE8HpWqhzU3Vh0cn7d0FaJsT2d9+U5PKq/2KFpNzlo5QjKkUY18lXiieIIDU4ckd9kD/L+krLQ+vT/f7jwJ+ogbLgGogkqgbJTLok7jx6h6dsbivrWjEvVYtWoY5AUmaHY9HZiBb4GPSguXIeG7pUE6YSQlMzXZrvPkWai71qFFiOY2IhDAt8+4LJtRhieI6U75/jGjElXMy6XV/Fy8uneIwh1AT3uy+xbB4pk9WH+UWULOJDIdidMgbGvsBNdg1gEFFGZHap0N+JvefxlAgMJIXEXYi4uYN1UOjMw== x-forefront-antispam-report: SFV:SKI; SCL:-1SFV:NSPM; SFS:(10009020)(6009001)(7916002)(39850400002)(39840400002)(39860400002)(39450400003)(39410400002)(24454002)(13464003)(189002)(199003)(2900100001)(81166006)(9686002)(122556002)(4326007)(97736004)(50986999)(229853002)(74316002)(3660700001)(189998001)(33656002)(76176999)(106356001)(5660300001)(66066001)(54356999)(6916009)(76576001)(93886004)(38730400001)(2950100002)(4001430100002)(68736007)(2906002)(7696004)(101416001)(3280700002)(6436002)(305945005)(6506006)(110136003)(92566002)(8936002)(105586002)(77096006)(7736002)(102836003)(8676002)(6116002)(3846002)(86362001)(106116001)(107886002)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR07MB1003; H:AM4PR0701MB2146.eurprd07.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; x-ms-office365-filtering-correlation-id: dccc634a-8fd7-4169-3aa5-08d422afa2c5 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:HE1PR07MB1003; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(37575265505322)(228905959029699)(17755550239193); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123564025)(20161123555025)(20161123560025)(20161123562025)(6072148); SRVR:HE1PR07MB1003; BCL:0; PCL:0; RULEID:; SRVR:HE1PR07MB1003; x-forefront-prvs: 0154C61618 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: 12 Dec 2016 16:55:11.0117 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR07MB1003 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphleLIzCtJLcpLzFFi42KZGbFdV7fyml+EwYcHphbvPm1nsrg+4QKr A5PHrwVLWT3mnQwMYIrisklJzcksSy3St0vgypiw7TRzwR6Bis6LU1gaGG/ydDFyckgImEis +DiLCcQWEljHKPH8hXQXIxeQfYJRYum9mawgDotAL7PEw4MXmSAy05kkzvedYodwzjBKbPx+ DKyfTUBHYvXbDlYQW0RAV+LpnHVgNrNApMSOA8fZQGxhAWuJfXe+sEDU2Ei0tXxggrDdJL79 bwKrZxFQlXi0YhlYPa9AgkTT58dsEMsamCTef7sAluAEGnT4ylEwm1FATOL7qTVMEMvEJW49 mc8E8ZyAxJI955khbFGJl4//sULUR0us3PeEBSKuINF54A3YaxICPSwS78+9Y4RwprBJ/P/7 F6rKV+L47q+sMPbu1nVA/3MA2dkSu28mQ4SjJXaun8wIYXcxSTQdzIGwZSR2b3wJDeFUieVr WxkhISElcfdKJ+MERq1ZSO6GsHUkFuz+xAZha0ssW/iaeRY4MAQlTs58wrKAkWUVo2hxanFx brqRsV5qUWZycXF+nl5easkmRmDaOLjlt+4OxtWvHQ8xCnAwKvHwFuz2ixBiTSwrrsw9xCjB wawkwit3BSjEm5JYWZValB9fVJqTWnyIUZqDRUmc12zl/XAhgfTEktTs1NSC1CKYLBMHp1QD I082TzfD2bkxB1657/sQ73brrlvlfvW+p++S5cxFP+9/+NiMsXJDzoqmh+HnbP98mswwOYQj ZH9X8P2Fj+WfmT3hcZUS2fP370FTvqWf7pyWX3asfeovDflOgWmtv2RsriTMk/0hm26yZnJe zDIuIY4Th76t6M/lZFEU/C9RYCW0X1J0b5HzWSWW4oxEQy3mouJEAAZrUvgXAwAA 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: Mon, 12 Dec 2016 16:55:22 -0000 > -----Original Message----- > From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com] > Sent: den 8 december 2016 06:51 > To: Jan Wickbom > Cc: dev@dpdk.org; Patrik Andersson R > Subject: Re: [PATCH] vhost: allow for many vhost user ports >=20 > On Wed, Dec 07, 2016 at 01:23:48PM +0000, Jan Wickbom wrote: > > > On Thu, Dec 01, 2016 at 04:26:50PM +0100, Jan Wickbom wrote: > > > > static int > > > > -fdset_fill(fd_set *rfset, fd_set *wfset, struct fdset *pfdset) > > > > +fdset_fill(struct pollfd *rwfds, struct fdset *pfdset) > ... > > > > + rwfds[i].fd =3D pfdentry->fd; > > > > + rwfds[i].events =3D pfdentry->rcb ? POLLIN : 0; > > > > + rwfds[i].events |=3D pfdentry->wcb ? POLLOUT : > > > 0; > > > > > > Another thing is we don't have to re-init this rwfds array again > > > and again. Instead, we could > > > > > > - set it up correctly when fdset_add is invoked: set the fd and > > > events. > > > > > > - reset revents when it's been handled at fdset_event_dispatch(). > > > > > > - swap with the last one and shrink the array on fd delete > > > > > > Could you make a follow up patch for that? > > > > I don't see how that could easily be done. The loop index, i, is a dire= ct > reference between > > an entry in the rwfds array and an entry in the pfdset array. It should= stay > like that while we are > > hanging in the poll(). If an entry in the pfdset array is removed whil= e we > are hanging in the poll() > > and we then immediately replaces it with the last entry in the array we= will > end up in trouble if the > > revent gets set for the "replaced" index. The direct reference is gone. > > Or am I missing something? >=20 > Yes, we should not shrink the rwfds during the poll, but we could later, = at > the end of the while() loop. Did something in v3, please have a look. >=20 > Talking about that, you should not invoke fdset_shrink() inside fdset_del= (), > since it could be in the poll stage. Thanks! Forgot this! Will send a v4 >=20 > --yliu