From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Yang, Zhiyong" Subject: Re: [PATCH 1/4] vhost: move fdset functions from fd_man.c to fd_man.h Date: Wed, 21 Mar 2018 06:51:27 +0000 Message-ID: References: <20180214145330.4679-1-zhiyong.yang@intel.com> <9059097.ABoCBN0gVk@xps> <4377329.31r3eYUQgx@xps> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "Tan, Jianfeng" , Maxime Coquelin , "dev@dpdk.org" , "yliu@fridaylinux.org" , "Bie, Tiwei" , "Wang, Zhihong" , "Wang, Dong1" To: "Yang, Zhiyong" , Thomas Monjalon Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 9D806AAC3 for ; Wed, 21 Mar 2018 07:51:32 +0100 (CET) In-Reply-To: Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Thomas, Maxime, Jianfeng, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yang, Zhiyong > Sent: Friday, March 16, 2018 4:44 PM > To: Thomas Monjalon > Cc: Tan, Jianfeng ; Maxime Coquelin > ; dev@dpdk.org; yliu@fridaylinux.org; Bie, > Tiwei ; Wang, Zhihong ; > Wang, Dong1 > Subject: Re: [dpdk-dev] [PATCH 1/4] vhost: move fdset functions from > fd_man.c to fd_man.h >=20 >=20 >=20 > > -----Original Message----- > > From: Thomas Monjalon [mailto:thomas@monjalon.net] > > Sent: Thursday, March 15, 2018 5:33 PM > > To: Yang, Zhiyong > > Cc: Tan, Jianfeng ; Maxime Coquelin > > ; dev@dpdk.org; yliu@fridaylinux.org; Bie, > > Tiwei ; Wang, Zhihong ; > > Wang, Dong1 > > Subject: Re: [PATCH 1/4] vhost: move fdset functions from fd_man.c to > > fd_man.h > > > > 13/03/2018 10:50, Yang, Zhiyong: > > > From: Thomas Monjalon [mailto:thomas@monjalon.net] > > > > 13/03/2018 09:46, Yang, Zhiyong: > > > > > From: Thomas Monjalon [mailto:thomas@monjalon.net] > > > > > > 05/03/2018 08:43, Yang, Zhiyong: > > > > > > > From: Thomas Monjalon [mailto:thomas@monjalon.net] > > > > > > > > I don't see why it should be exported outside of DPDK, > > > > > > > > except for > > > > PMDs. > > > > > > > > I would tend to keep it internal but I understand that it > > > > > > > > would mean duplicating some code, which is not ideal. > > > > > > > > Please could you show what would be the content of the .h i= n > EAL? > > > > > > > > > > > > > > > > > > > > > > If needed to expose them in eal.h, I think that they should > > > > > > > be the whole fdset mechanism as followings. > > > > > > > > > > > > > > typedef void (*fd_cb)(int fd, void *dat, int *remove); > > > > > > > > > > > > > > struct fdentry { > > > > > > > int fd; /* -1 indicates this entry is empty */ > > > > > > > fd_cb rcb; /* callback when this fd is readable. */ > > > > > > > fd_cb wcb; /* callback when this fd is writeable.*/ > > > > > > > void *dat; /* fd context */ > > > > > > > int busy; /* whether this entry is being used in cb. */ > > > > > > > }; > > > > > > > > > > > > > > struct fdset { > > > > > > > struct pollfd rwfds[MAX_FDS]; > > > > > > > struct fdentry fd[MAX_FDS]; > > > > > > > pthread_mutex_t fd_mutex; > > > > > > > int num; /* current fd number of this fdset */ > > > > > > > }; > > > > > > > > > > > > > > void fdset_init(struct fdset *pfdset); (not used in the pa= tchset) > > > > > > > > > > > > > > int fdset_add(struct fdset *pfdset, int fd, > > > > > > > fd_cb rcb, fd_cb wcb, void *dat); (used in this patchset= ) > > > > > > > > > > > > > > void *fdset_del(struct fdset *pfdset, int fd); (not used in > > > > > > > the > > > > > > > patchset) > > > > > > > > > > > > > > void *fdset_event_dispatch(void *arg); (used in this patchs= et) > > > > > > > > > > > > > > seems that we have 4 options. > > > > > > > 1) expose them in librte_vhost > > > > > > > 2) expose them in other existing or new libs. for example, e= al. > > > > > > > 3) duplicate the code lines at PMD layer. > > > > > > > 4) do it as the patch does that. > > > > > > > > > > > > It looks to be very close of the interrupt thread. > > > > > > Can we have all merged in an unique event dispatcher thread? > > > > > > > > > > If I understand right, do you mean that we can merge them in lib = eal ? > > right? > > > > > > > > Yes merge with interrupt thread in EAL. > > > > I didn't look at the details, but it seems the right place for such= thing. > > > > > > > Ok, we have to expose them as new APIs. Expect that somebody as > > > DPDK users can use and like them as well. :) > > > > I think you missed my initial question: > > Is it possible to merge the vhost events needs in the EAL interrupt thr= ead? > > >=20 > Sorry to miss this question. > Compared to vhost event mechanism(poll), Eal interrupt uses epoll, From m= y > basic understanding, linux and freeBSD both support poll, Epoll is suppo= rted > by Linux only. >=20 > Hi Maxime, > I want to know your opinion about Thomas's question. >=20 > This patchset aim to support for virtio-user server mode and just need to= call > event functions, So, Let me try librte_eal epoll mechanism if support for > server mode. >=20 I have implemented the same functionality calling librte_eal epoll mechani= sm instead of Vhost event and V3 has been sent out. Please help review and welcome any c= omments. Thanks Zhiyong