All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: "Hefty,
	Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Jason Gunthorpe
	<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Cc: Liran Liss <liranl-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Alex Rosenbaum
	<rosenbaumalex-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [RFC] libibverbs IB device hotplug support
Date: Wed, 1 Mar 2017 16:56:50 -0500	[thread overview]
Message-ID: <cad3d2c6-0c98-9f58-a3bb-81823103bd76@redhat.com> (raw)
In-Reply-To: <1828884A29C6694DAF28B7E6B8A82373AB0ECDC6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 2844 bytes --]

On 3/1/2017 1:00 PM, Hefty, Sean wrote:
>>>> I don't think that we should introduce an asych context into
>> libibverbs.
>>> 
>>> Why not?
>> 
>> Generally, I dislike the idea of running threads from libraries, 
>> particularly libraries like ibverbs. So many apps get no benefit
>> from the thread, but it sits there connected to udev..
> 
> I thought Doug was referring to reporting the device add/remove event
> through some event reporting interface, like what the librdmacm
> already does.  So no threads for that are needed.  IMO, this makes
> sense.

It can be done without a thread, that's not to say I would necessarily
do so myself.

> I didn't follow his idea for how the device list would be updated and
> kept in sync between the app and the library.

There is no requirement that the device list be kept in sync between the
library and the app, period.

There are three usages for what I suggested:

1)  The app gets a device list initially just like it does now.  If the
app never updates that list again, so be it.  This is 100% backward
compatible.

2)  The simplified version of hotplug/unplug that has been discussed:
the app calls ibv_get_device_list.  As proposed by Alex, the library
would rescan the sysfs directory on this call.  If the device is there,
great.  If it isn't, great too.  Under my proposed implementation, the
exact same thing is true.  If the device is there, great.  If there
isn't a new device in the list already, then great too.  Because the
initial implementation proposal left if up to the app to determine
how/when to check for a new device, there was never any guarantee that
whatever triggered the app to look for the new device meant that it was
ready to be used in sysfs and would be found by the re-reading of the
sysfs directory.  So whatever race might be present in my proposed
implementation would also be present in the original implementation.

3)  My proposed implementation where an entry point is added for async
events.  In this case, the library would not pass the event on up until
the device was ready to be used, so there is no race here.  And there is
minimal delay from detection to notification and ready for use.

> If you had device add/remove events, the get_event call could
> intercept that event and update the device list there.  But I don't
> know that you try to sync a shared list between the library and the
> app.

No, I wouldn't try that at all.  The inherently racy thing in all of
this is having the library be responsible for scanning a device, but not
responsible for detecting that there is a new device to be scanned.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    GPG Key ID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

  parent reply	other threads:[~2017-03-01 21:56 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-27 16:08 [RFC] libibverbs IB device hotplug support Alex Rosenbaum
     [not found] ` <CAFgAxU9eQYwBad2+SJw1x+cQMMqzgkz0fpeumG7Rx=o_eQqo2g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-27 18:59   ` Jason Gunthorpe
     [not found]     ` <20170227185912.GM5891-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-02-27 22:11       ` Alex Rosenbaum
     [not found]         ` <CAFgAxU9XJTXkaeL_VE7zHASPBM+j=TZd2L+McKBcJRThJtUN5w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-27 22:36           ` Jason Gunthorpe
     [not found]             ` <20170227223600.GA1526-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-02-28  7:56               ` Alex Rosenbaum
     [not found]                 ` <CAFgAxU8KkrOS6aib4ykf8vj1sQFGK_oMW=fX3vZ2X2_r3ryDVA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-28 21:26                   ` Jason Gunthorpe
2017-02-28 15:48   ` Doug Ledford
     [not found]     ` <1488296882.86943.214.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-02-28 16:32       ` Liran Liss
     [not found]         ` <HE1PR0501MB28123E8F342607E2C2CA4DD9B1560-692Kmc8YnlIVrnpjwTCbp8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-02-28 21:47           ` Doug Ledford
     [not found]             ` <3389d831-c135-b326-4b96-5f2a746de5ac-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-03-01  0:44               ` Jason Gunthorpe
     [not found]                 ` <20170301004449.GA13114-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-03-01 18:00                   ` Hefty, Sean
     [not found]                     ` <1828884A29C6694DAF28B7E6B8A82373AB0ECDC6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-03-01 18:07                       ` Jason Gunthorpe
2017-03-01 21:47                       ` Alex Rosenbaum
     [not found]                         ` <CAFgAxU9vObaW4O+byEJ5pV1Ofou4cd05HHWWPC7iTJshyk+LdA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-01 22:07                           ` Doug Ledford
     [not found]                             ` <d92df6b7-207f-f3a3-8bf5-b12cffe20684-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-03-01 22:32                               ` Alex Rosenbaum
     [not found]                                 ` <CAFgAxU_-jbAoOR2XMYfSgbDMn7FnrthudZJLgeNNTzb9GEUXrg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-02 12:48                                   ` Doug Ledford
     [not found]                                     ` <467c0560-8de7-42e5-14b9-178c367874d2-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-03-02 16:53                                       ` Jason Gunthorpe
2017-03-01 23:18                           ` Hefty, Sean
2017-03-01 21:56                       ` Doug Ledford [this message]
     [not found]                         ` <cad3d2c6-0c98-9f58-a3bb-81823103bd76-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-03-01 22:23                           ` Jason Gunthorpe
2017-03-01 22:34                           ` Alex Rosenbaum
2017-03-01  0:10   ` ira.weiny
     [not found]     ` <20170301001023.GA3001-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2017-03-01 21:21       ` Alex Rosenbaum
     [not found]         ` <CAFgAxU-Vf6RLEo8N=oya0X+WbneRHE1xa_-5GY+TEqo1wyzpow-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-01 22:17           ` Weiny, Ira
     [not found]             ` <2807E5FD2F6FDA4886F6618EAC48510E67C5CA80-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-03-01 22:38               ` Alex Rosenbaum
2017-03-01 21:57       ` Alex Rosenbaum
     [not found]         ` <CAFgAxU_i+5FtBkdf=t5vdQAvBqDt9aKsFJbAKGN5YWQQ9w-c2A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-01 22:15           ` Weiny, Ira
     [not found]             ` <2807E5FD2F6FDA4886F6618EAC48510E67C5CA68-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-03-01 22:42               ` Alex Rosenbaum
2017-03-01 23:07               ` Jason Gunthorpe
     [not found]                 ` <20170301230743.GC2820-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-03-02 13:22                   ` Leon Romanovsky
2017-03-02 16:08   ` Hefty, Sean
     [not found]     ` <1828884A29C6694DAF28B7E6B8A82373AB0ED3C6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-03-03 12:31       ` Alex Rosenbaum

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=cad3d2c6-0c98-9f58-a3bb-81823103bd76@redhat.com \
    --to=dledford-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
    --cc=leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=liranl-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=rosenbaumalex-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.