DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Dan Gora <dg@adax.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2 02/10] kni: separate releasing netdev from freeing KNI interface
Date: Wed, 10 Oct 2018 23:51:08 +0100	[thread overview]
Message-ID: <d20d7db8-9136-7f13-8973-8ce35b35731b@intel.com> (raw)
In-Reply-To: <CAGyogRbH9Yeg2v=pRvThf8t1CFSFbDbOWuCpsEUn-96eUsPhXA@mail.gmail.com>

On 10/10/2018 7:18 PM, Dan Gora wrote:
> On Wed, Oct 10, 2018 at 2:25 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>
>> On 9/4/2018 1:36 AM, Dan Gora wrote:
>>> Hi Ferruh,
>>>
>>> I remembered now the motivation behind separating rte_kni_release()
>>> and rte_kni_free().
>>>
>>> The problem is that the DPDK thread which calls rte_kni_release()
>>> _cannot_ be the same thread which handles callbacks from the KNI
>>> driver via rte_kni_handle_request().  This is because the thread which
>>> calls rte_kni_release() will be stuck down in
>>> ioctl(RTE_KNI_IOCTL_RELEASE) when the kernel calls the
>>> RTE_KNI_REQ_CFG_NETWORK_IF callback to the DPDK application.  Since
>>> that thread cannot call rte_kni_handle_request(), the callback would
>>> then just timeout unless some other thread calls
>>> rte_kni_handle_request().
>>>
>>> So then you are in a bit of a chicken and egg situation.  You _have_
>>> to have a separate thread calling rte_kni_handle_request periodically,
>>> but that thread also _cannot_ run after rte_kni_release returns
>>> (actually it's worse than that because it's actually after the
>>> ioctl(RTE_KNI_IOCTL_RELEASE) returns and the fifos are freed).
>>
>> I see, so we have problem in both end, -userspace side and kernel side.
>>
>> Agreed that separating release & free may help, but I am not sure about adding a
>> new API for KNI.
>>
>> Very simply, what about prevent kni_net_release() send callback to userspace?
> 
> No, because how is the DPDK application going to know when the user
> does 'ip link set down dev <kniX>'?   It's important for the DPDK
> application to know when the KNI interface is marked down.

I mean kni_net_release() called because of unregister_netdev(),

it is possible to set a flag in kni_dev_remove(), before unregister_netdev(),
and in kni_net_release() don't call kni_net_process_request() if flag is set.

Looks like it can work and only a few lines of code, what do you think?

> 
>> This is already not working and removing it resolves the issues you mentioned.
> 
> Huh?  How is it not working?  Of course it works.

The kni_net_release() called because of unregister_netdev() is not working, as
you explained in userspace the thread handles request already terminated, even
if not in kernel side response not received and timed off because of lock...

> 
>> Sample application calls rte_eth_dev_stop() after release itself, so behavior
>> will be same.
> 
> Huh?

in kni sample app, in kni_free_kni() rte_eth_dev_stop() is called after
rte_kni_release().
So if you prevent kni_net_release() called because of unregister_netdev() to
send callback it won't be problem because of existing rte_eth_dev_stop()

> 
>> But the issues in kernel you mentioned, using `dev` after free_netdev() called
>> should be addressed.
> 
> Yes, that's why I fixed them in the patches that I sent.
> 
> d
> 

  reply	other threads:[~2018-10-10 22:51 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28 22:45 [dpdk-dev] [PATCH 00/10] kni: Interface detach and link status fixes Dan Gora
2018-06-29  1:54 ` Dan Gora
2018-06-29  1:54   ` [dpdk-dev] [PATCH v2 01/10] kni: remove unused variables from struct kni_dev Dan Gora
2018-08-29 10:29     ` Ferruh Yigit
2018-06-29  1:55   ` [dpdk-dev] [PATCH v2 02/10] kni: separate releasing netdev from freeing KNI interface Dan Gora
2018-08-29 10:59     ` Ferruh Yigit
2018-09-04  0:20       ` Dan Gora
2018-09-04  0:36       ` Dan Gora
2018-10-10 17:24         ` Ferruh Yigit
2018-10-10 18:18           ` Dan Gora
2018-10-10 22:51             ` Ferruh Yigit [this message]
2018-10-10 23:38               ` Dan Gora
2018-06-29  1:55   ` [dpdk-dev] [PATCH v2 03/10] kni: don't touch struct kni_dev after freeing Dan Gora
2018-06-29  1:55   ` [dpdk-dev] [PATCH v2 04/10] kni: add rte_kni_free to KNI library Dan Gora
2018-06-29  1:55   ` [dpdk-dev] [PATCH v2 05/10] kni: don't run rte_kni_handle_request after interface release Dan Gora
2018-06-29  1:55   ` [dpdk-dev] [PATCH v2 06/10] kni: increase length of timeout for KNI responses Dan Gora
2018-06-29  1:55   ` [dpdk-dev] [PATCH v2 07/10] kni: update kni test for rte_kni_free Dan Gora
2018-06-29  1:55   ` [dpdk-dev] [PATCH v2 08/10] kni: add rte_kni_free to KNI example app Dan Gora
2018-06-29  1:55   ` [dpdk-dev] [PATCH v2 09/10] kni: add rte_kni_free to KNI vdev driver Dan Gora
2018-06-29  1:55   ` [dpdk-dev] [PATCH v2 10/10] kni: add API to set link status on kernel interface Dan Gora
2018-08-29 11:48     ` Ferruh Yigit
2018-08-29 21:10       ` Dan Gora
2018-08-29 22:01         ` Stephen Hemminger
2018-08-29 15:54     ` Stephen Hemminger
2018-08-29 21:02       ` Dan Gora
2018-08-29 22:00         ` Stephen Hemminger
2018-08-29 22:12           ` Dan Gora
2018-08-29 22:41             ` Dan Gora
2018-08-29 23:10               ` Stephen Hemminger
2018-08-30  9:49                 ` Igor Ryzhov
2018-08-30 10:32                   ` Igor Ryzhov
2018-08-30 21:41                   ` Dan Gora
2018-08-30 22:09                     ` Stephen Hemminger
2018-08-30 22:11                       ` Dan Gora
2018-09-04  0:47                         ` Dan Gora
2018-09-05 12:57                           ` Stephen Hemminger
2018-09-11 21:45                             ` Dan Gora
2018-09-11 21:52                               ` Stephen Hemminger
2018-09-11 22:07                                 ` Dan Gora
2018-09-11 23:14                                   ` Stephen Hemminger
2018-09-12  4:02                                     ` Jason Wang
2018-09-11 23:14     ` [dpdk-dev] [PATCH 0/2] " Dan Gora
2018-09-11 23:14     ` [dpdk-dev] [PATCH 1/2] " Dan Gora
2018-09-11 23:18       ` Dan Gora
2018-07-20 11:36   ` [dpdk-dev] [PATCH 00/10] kni: Interface detach and link status fixes Ferruh Yigit

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=d20d7db8-9136-7f13-8973-8ce35b35731b@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=dg@adax.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).