linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yishai Hadas <yishaih-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: Jason Gunthorpe
	<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>,
	dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	raindel-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
	jackm-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org
Subject: Re: [PATCH for-next V7 6/6] IB/ucma: HW Device hot-removal support
Date: Wed, 05 Aug 2015 18:09:45 +0300	[thread overview]
Message-ID: <55C22739.5060808@dev.mellanox.co.il> (raw)
In-Reply-To: <20150804220903.GE10934-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

On 8/5/2015 1:09 AM, Jason Gunthorpe wrote:
> On Tue, Aug 04, 2015 at 05:03:28PM +0300, Yishai Hadas wrote:
>> Currently, IB/cma remove_one flow blocks until all user descriptor managed by
>> IB/ucma are released. This prevents hot-removal of IB devices. This patch
>> allows IB/cma to remove devices regardless of user space activity. Upon getting
>> the RDMA_CM_EVENT_DEVICE_REMOVAL event we close all the underlying HW resources
>> for the given ucontext. The ucontext itself is still alive till its explicit
>> destroying by its creator.
>>
>> Running applications at that time will have some zombie device, further
>> operations may fail.
>
> I've never made it far enough to look at this patch before... It is
> Sean's stuff so he is best qualified to comment on it. The rest of the
> series is OK now Sean.
>
>> +static void ucma_close_id(struct work_struct *work)
>> +{
>> +	struct ucma_context *ctx =  container_of(work, struct ucma_context, close_work);
>> +
>> +	/* Fence to ensure that ctx->closing was seen by all
>> +	 * ucma_get_ctx running
>> +	 */
>> +	mutex_lock(&mut);
>> +	mutex_unlock(&mut);
>
> Uh, no. That isn't how to use mutex's.

That locking scheme is used in some other places in the kernel when a 
barrier/fence is needed, see below some examples of that usage and my 
comment around the usage.

One of (see below in cma.c) was added by Sean Hefty as part of commit ID 
a396d43a in rdma_destroy_id, it's part of same kernel subsystem and uses 
same concept as of above code.

I believe that we can go ahead and merge this patch as part of the series.

If you still don't agree we can go ahead and merge the first 5 patches 
that doesn't depend on that last patch and handle/discuss this patch later.

The first 4 you already review and acked the fifth is in mlx4_ib and has 
no comments to fix so far - some months in the list.


Some examples of that usage:
------------------------------
http://lxr.free-electrons.com/source/kernel/audit.c#L532
         /* wait for parent to finish and send an ACK */
532         mutex_lock(&audit_cmd_mutex);
533         mutex_unlock(&audit_cmd_mutex);

http://lxr.free-electrons.com/source/fs/configfs/dir.c#L1386
1386                         /* Wait until the racing operation 
terminates */
1387                         mutex_lock(wait_mutex);
1388                         mutex_unlock(wait_mutex);

http://lxr.free-electrons.com/source/drivers/infiniband/core/cma.c#L1053
1050          /* Wait for any active callback to finish.  New callbacks 
will find
1051          * the id_priv state set to destroying and abort.
1052          */
1053         mutex_lock(&id_priv->handler_mutex);
1054         mutex_unlock(&id_priv->handler_mutex);

http://lxr.free-electrons.com/source/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c#L96
  96         /* barrier */
  97         mutex_lock(&sec_gc_mutex);
  98         mutex_unlock(&sec_gc_mutex);


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-08-05 15:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04 14:03 [PATCH for-next V7 0/6] HW Device hot-removal support Yishai Hadas
     [not found] ` <1438697008-26209-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-08-04 14:03   ` [PATCH for-next V7 1/6] IB/uverbs: Fix reference counting usage of event files Yishai Hadas
2015-08-04 14:03   ` [PATCH for-next V7 2/6] IB/uverbs: Fix race between ib_uverbs_open and remove_one Yishai Hadas
     [not found]     ` <1438697008-26209-3-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-08-04 21:36       ` Jason Gunthorpe
2015-08-04 14:03   ` [PATCH for-next V7 3/6] IB/uverbs: Explicitly pass ib_dev to uverbs commands Yishai Hadas
2015-08-04 14:03   ` [PATCH for-next V7 4/6] IB/uverbs: Enable device removal when there are active user space applications Yishai Hadas
     [not found]     ` <1438697008-26209-5-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-08-04 21:48       ` Jason Gunthorpe
2015-08-04 14:03   ` [PATCH for-next V7 5/6] IB/mlx4_ib: Disassociate support Yishai Hadas
2015-08-04 14:03   ` [PATCH for-next V7 6/6] IB/ucma: HW Device hot-removal support Yishai Hadas
     [not found]     ` <1438697008-26209-7-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-08-04 22:09       ` Jason Gunthorpe
     [not found]         ` <20150804220903.GE10934-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-08-05 15:09           ` Yishai Hadas [this message]
     [not found]             ` <55C22739.5060808-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-08-05 18:21               ` Jason Gunthorpe
     [not found]                 ` <20150805182117.GA15583-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-08-06 15:36                   ` Liran Liss
     [not found]                     ` <HE1PR05MB1418EA195D579C09EB1FB746B1740-eBadYZ65MZ87O8BmmlM1zNqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2015-08-11  5:48                       ` Jason Gunthorpe
     [not found]                         ` <20150811054852.GC13314-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-08-11 12:47                           ` Liran Liss
     [not found]                             ` <HE1PR05MB1418DE9D40F9B2B20FD1AC3BB17F0-eBadYZ65MZ87O8BmmlM1zNqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2015-08-11 16:35                               ` Jason Gunthorpe
2015-08-05  0:23       ` Jason Gunthorpe
     [not found]         ` <20150805002338.GB22959-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-08-05 15:51           ` Yishai Hadas

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=55C22739.5060808@dev.mellanox.co.il \
    --to=yishaih-ldsdmyg8hgv8yrgs2mwiifqbs+8scbdb@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=jackm-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=raindel-VPRAkNaXOzVWk0Htik3J/w@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 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).