DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pavel Boldin <pboldin@mirantis.com>
To: "Xie, Huawei" <huawei.xie@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v5 4/5] vhost: eventfd_link: replace copy-pasted sys_close
Date: Sat, 11 Jul 2015 18:08:23 +0300	[thread overview]
Message-ID: <CACf4_B_rbJutj+F6xqsGOx2EFs8GYYhQxrWSoWqF9077Up=Wxg@mail.gmail.com> (raw)
In-Reply-To: <C37D651A908B024F974696C65296B57B0F56C759@SHSMSX101.ccr.corp.intel.com>

Xie, All,

Please find my comments intermixed below.

On Fri, Jul 10, 2015 at 6:42 PM, Xie, Huawei <huawei.xie@intel.com> wrote:

> Don't know why previous mail get messed.
>
> On 7/10/2015 10:50 PM, Pavel Boldin wrote:
> Xie,
>
> Regarding the patches:
> 1. The replaced code in fourth patch is checked to be a copy-paste of the
> `sys_close` syscall.
>
> sys_close does extra cleanup than the replaced coe. My concern is, for
> example, sys_close will mark the fd as next-to-be-allocated fd. Will there
> be issue when we allocate a new fd, because it will be allocated starting
> from the value of next-to-be-allocted-fd? I think kernel willn't blindly
> use that value, but not sure.
>

That is what applications do when call `close' libc function -- the freed
FD is ready to be allocated again and it is OK for applications to reuse
FDs.


>
> 2. It is not uncommon for the applications to close FD making it allocated
> 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.
>
> Yes, that is exactly what the old code does.
> 3. There is an implementation of the exact same thing in the SCM_RIGHTS
> [1] that can be used as the reference code.
>
> I did a rough check. Maybe i miss something. I see it calls fd_install on
> a newly allocated fd. That is exactly what i want to replace the current
> code with.
> 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 user
> space at all, what we should do is allocate a new fd in kernel, and install
> the file onto it.
>
> new_fd = get_unused_fd_flags(...)
> fd_install(new_fd, get_file(fp[i])
>

Well, this requires changes from the user-space side so I prefer not to do
it by myself at the moment, because I'm no expert in DPDK. I can provide
with the updated patches though but I will require a lab to check that it
works indeed.

No comments below this line.

Pavel


>
> /huawei
>
> [1] https://github.com/torvalds/linux/blob/master/net/core/scm.c#L248
>
> Pavel
>
> On Fri, Jul 10, 2015 at 5:27 PM, Xie, Huawei <huawei.xie@intel.com<mailto:
> huawei.xie@intel.com>> wrote:
> On 6/17/2015 11:24 PM, Thomas Monjalon wrote:
> > 2015-05-07 06:54, Xie, Huawei:
> >> On 4/16/2015 7:48 PM, Pavel Boldin wrote:
> >>> +   /* Closing the source_fd */
> >>> +   ret = sys_close(eventfd_copy.source_fd);
> >> Pavel:
> >> Here we close the fd and re-install a new file on this fd later.
> >> sys_close does all cleanup.
> >> But, for instance, if we allocate new fd later, normally it will reuse
> >> the just freed fds by sys_close, is there issue here?
> > Pavel, Huawei,
> > Could we come to a conclusion on this patch series please?
> For the previous 3 patches, i am OK except that i don't think inline is
> needed explicitly for non-performance critical function.
> For this patch, didn't check the fs code.
>
> >
> >
>
>
>
>

  parent reply	other threads:[~2015-07-11 15:08 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16 16:40 [dpdk-dev] [PATCH] Fix `eventfd_link' module leakages and races Pavel Boldin
2015-03-16 17:55 ` Neil Horman
2015-03-17  1:29 ` Ouyang, Changchun
2015-03-20 15:57   ` Pavel Boldin
2015-03-18 13:16 ` [dpdk-dev] [PATCH v2] " Pavel Boldin
2015-03-23 11:15   ` Thomas Monjalon
2015-03-23 11:36     ` Pavel Boldin
2015-03-23 11:44       ` Thomas Monjalon
2015-03-23 15:15   ` [dpdk-dev] [PATCH v3] vhost: Refactor module `eventfd_link' Pavel Boldin
2015-04-02 17:01     ` [dpdk-dev] [PATCH v4 0/5] " Pavel Boldin
2015-04-02 17:01       ` [dpdk-dev] [PATCH v4 1/5] vhost: eventfd_link: moving ioctl to a function Pavel Boldin
2015-05-07  7:57         ` Xie, Huawei
     [not found]           ` <CACf4_B8MDfkaEk5jMjMbEw9F8LsBVLA9TUWwOBU=SCAxzFmSFw@mail.gmail.com>
2015-05-18  6:06             ` Xie, Huawei
2015-05-18  9:16               ` Pavel Boldin
2015-06-18  3:08             ` Xie, Huawei
2015-04-02 17:01       ` [dpdk-dev] [PATCH v4 2/5] vhost: eventfd_link: add function fget_from_files Pavel Boldin
2015-04-02 17:01       ` [dpdk-dev] [PATCH v4 3/5] vhost: eventfd_link: fix ioctl return values Pavel Boldin
2015-04-02 17:01       ` [dpdk-dev] [PATCH v4 4/5] vhost: eventfd_link: replace copy-pasted sys_close Pavel Boldin
2015-04-02 17:01       ` [dpdk-dev] [PATCH v4 5/5] vhost: eventfd_link: removing extra #includes Pavel Boldin
2015-04-16 11:48       ` [dpdk-dev] [PATCH v5 0/5] Refactor module `eventfd_link' Pavel Boldin
2015-04-16 11:48         ` [dpdk-dev] [PATCH v5 1/5] vhost: eventfd_link: moving ioctl to a function Pavel Boldin
2015-08-28 18:51           ` [dpdk-dev] [PATCH v5 1/4] vhost: eventfd_link: refactoring EVENTFD_COPY handler Pavel Boldin
2015-09-23 20:25             ` Pavel Boldin
2015-09-29 19:42               ` Thomas Monjalon
2015-09-29 23:29                 ` Pavel Boldin
2015-10-20  9:06             ` Xie, Huawei
2015-10-28 18:33             ` [dpdk-dev] [PATCH v6 0/3] vhost: eventfd_link refactoring Pavel Boldin
2015-10-29 18:33               ` Xie, Huawei
2015-10-30 19:10                 ` Thomas Monjalon
2015-10-28 18:33             ` [dpdk-dev] [PATCH v6 1/3] vhost: eventfd_link: refactoring EVENTFD_COPY handler Pavel Boldin
2015-10-28 18:33             ` [dpdk-dev] [PATCH v6 2/3] vhost: add EVENTFD_COPY2 ioctl Pavel Boldin
2015-10-28 18:33             ` [dpdk-dev] [PATCH v6 3/3] vhost: using EVENTFD_COPY2 Pavel Boldin
2015-08-28 18:51           ` [dpdk-dev] [PATCH v5 2/4] vhost: add EVENTFD_COPY2 ioctl Pavel Boldin
2015-10-20  9:43             ` Xie, Huawei
2015-08-28 18:51           ` [dpdk-dev] [PATCH v5 3/4] vhost: using EVENTFD_COPY2 Pavel Boldin
2015-10-20  9:52             ` Xie, Huawei
2015-10-21 12:16               ` Pavel Boldin
2015-10-26  1:45                 ` Xie, Huawei
2015-10-28 18:35                   ` Pavel Boldin
2015-08-28 18:51           ` [dpdk-dev] [PATCH v5 4/4] DO NOT MERGE: Tests for new eventfd_link module Pavel Boldin
2015-04-16 11:48         ` [dpdk-dev] [PATCH v5 2/5] vhost: eventfd_link: add function fget_from_files Pavel Boldin
2015-04-16 11:48         ` [dpdk-dev] [PATCH v5 3/5] vhost: eventfd_link: fix ioctl return values Pavel Boldin
2015-04-16 11:48         ` [dpdk-dev] [PATCH v5 4/5] vhost: eventfd_link: replace copy-pasted sys_close Pavel Boldin
2015-05-07  6:54           ` Xie, Huawei
2015-06-17 15:24             ` Thomas Monjalon
2015-07-09  0:59               ` Thomas Monjalon
2015-07-10 14:27               ` Xie, Huawei
2015-07-10 14:50                 ` Pavel Boldin
2015-07-10 15:32                   ` Xie, Huawei
2015-07-10 15:42                   ` Xie, Huawei
2015-07-10 15:49                     ` Thomas Monjalon
2015-07-10 16:06                       ` Xie, Huawei
2015-07-11 15:08                     ` Pavel Boldin [this message]
2015-07-13  1:59                       ` Xie, Huawei
2015-07-19 12:39                         ` Pavel Boldin
2015-04-16 11:48         ` [dpdk-dev] [PATCH v5 5/5] vhost: eventfd_link: removing extra #includes Pavel Boldin
2015-04-28 14:35         ` [dpdk-dev] [PATCH v5 0/5] Refactor module `eventfd_link' Thomas Monjalon
2015-05-04  5:29           ` Xie, Huawei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACf4_B_rbJutj+F6xqsGOx2EFs8GYYhQxrWSoWqF9077Up=Wxg@mail.gmail.com' \
    --to=pboldin@mirantis.com \
    --cc=dev@dpdk.org \
    --cc=huawei.xie@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).