From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 88624C39C for ; Fri, 10 Jul 2015 18:06:45 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 10 Jul 2015 09:06:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,447,1432623600"; d="scan'208";a="522088214" Received: from pgsmsx105.gar.corp.intel.com ([10.221.44.96]) by FMSMGA003.fm.intel.com with ESMTP; 10 Jul 2015 09:06:42 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by PGSMSX105.gar.corp.intel.com (10.221.44.96) with Microsoft SMTP Server (TLS) id 14.3.224.2; Sat, 11 Jul 2015 00:06:40 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.246]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.46]) with mapi id 14.03.0224.002; Sat, 11 Jul 2015 00:06:39 +0800 From: "Xie, Huawei" To: Thomas Monjalon Thread-Topic: [dpdk-dev] [PATCH v5 4/5] vhost: eventfd_link: replace copy-pasted sys_close Thread-Index: AdC7JwkTV8dlCf+ynE6WaHWpLcGybQ== Date: Fri, 10 Jul 2015 16:06:38 +0000 Message-ID: References: <1427994080-10163-1-git-send-email-pboldin@mirantis.com> <7112583.u7L3bAyaN6@xps13> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" , Pavel Boldin Subject: Re: [dpdk-dev] [PATCH v5 4/5] vhost: eventfd_link: replace copy-pasted sys_close 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: Fri, 10 Jul 2015 16:06:46 -0000 On 7/10/2015 11:50 PM, Thomas Monjalon wrote:=0A= > 2015-07-10 15:42, Xie, Huawei:=0A= >> Don't know why previous mail get messed.=0A= > Same problem with this one.=0A= > It's maybe because you send HTML mail which is wrongly translated in plai= n text.=0A= Have something to to with Pavel? :). I remember the format usually get=0A= messed when i reply to his mail.=0A= Anyway, I changed delivery format in Thunderbird from "Auto detect" to=0A= "Plain text only".=0A= > =0A= >> On 7/10/2015 10:50 PM, Pavel Boldin wrote:=0A= >> Xie,=0A= >>=0A= >> Regarding the patches:=0A= >> 1. The replaced code in fourth patch is checked to be a copy-paste of th= e `sys_close` syscall.=0A= >>=0A= >> sys_close does extra cleanup than the replaced coe. My concern is, for e= xample, sys_close will mark the fd as next-to-be-allocated fd. Will there b= e issue when we allocate a new fd, because it will be allocated starting fr= om the value of next-to-be-allocted-fd? I think kernel willn't blindly use = that value, but not sure.=0A= >>=0A= >> 2. It is not uncommon for the applications to close FD making it allocat= ed for a different file. In our particular case the file is closed in the *= source* process and *added* to a target process, so matching fds should not= be the problem.=0A= >>=0A= >> Yes, that is exactly what the old code does.=0A= >> 3. There is an implementation of the exact same thing in the SCM_RIGHTS = [1] that can be used as the reference code.=0A= >>=0A= >> I did a rough check. Maybe i miss something. I see it calls fd_install o= n a newly allocated fd. That is exactly what i want to replace the current = code with.=0A= >> Currently we allcoate eventfd in user space and install a new file onto = it through fd_install. Actually we don't need to allocate the eventfd in us= er space at all, what we should do is allocate a new fd in kernel, and inst= all the file onto it.=0A= >>=0A= >> new_fd =3D get_unused_fd_flags(...)=0A= >> fd_install(new_fd, get_file(fp[i])=0A= >>=0A= >> /huawei=0A= >>=0A= >> [1] https://github.com/torvalds/linux/blob/master/net/core/scm.c#L248=0A= >>=0A= >> Pavel=0A= >>=0A= >> On Fri, Jul 10, 2015 at 5:27 PM, Xie, Huawei > wrote:=0A= >> On 6/17/2015 11:24 PM, Thomas Monjalon wrote:=0A= >>> 2015-05-07 06:54, Xie, Huawei:=0A= >>>> On 4/16/2015 7:48 PM, Pavel Boldin wrote:=0A= >>>>> + /* Closing the source_fd */=0A= >>>>> + ret =3D sys_close(eventfd_copy.source_fd);=0A= >>>> Pavel:=0A= >>>> Here we close the fd and re-install a new file on this fd later.=0A= >>>> sys_close does all cleanup.=0A= >>>> But, for instance, if we allocate new fd later, normally it will reuse= =0A= >>>> the just freed fds by sys_close, is there issue here?=0A= >>> Pavel, Huawei,=0A= >>> Could we come to a conclusion on this patch series please?=0A= >> For the previous 3 patches, i am OK except that i don't think inline is= =0A= >> needed explicitly for non-performance critical function.=0A= >> For this patch, didn't check the fs code.=0A= >>=0A= >>>=0A= >>=0A= >>=0A= >=0A= >=0A= >=0A= =0A=