public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Flavio Baronti <f.baronti-ngIpsMLAhaq41k5uCYKmRQ@public.gmane.org>
To: "Hefty, Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: "linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: When is it safe to release connection resources?
Date: Wed, 04 Jan 2012 10:42:49 +0100	[thread overview]
Message-ID: <4F041F19.1070608@list-group.com> (raw)
In-Reply-To: <1828884A29C6694DAF28B7E6B8A8237325662B63-P5GAC/sN6hlcIJlls4ac1rfspsVTdybXVpNB7YpNyf8@public.gmane.org>

So in order to safely call ibv_destroy_cq, I should call ibv_ack_cq_events *after* ibv_poll_cq? The example on the man 
page for ibv_get_cq_event calls it before, is it an error?

Flavio

Il 1/2/2012 17:39 PM, Hefty, Sean ha scritto:
>> If I understood correctly, when ibv_get_cq_event returns, it holds some sort
>> of lock over the completion queue, which is
>
> ibv_get_cq_event will increment a reference count on the CQ that it is returning.
>
>> released when I call ibv_req_notify_cq. This lock is checked also in
>
> You decrement the count with ibv_ack_cq_events.  ibv_req_notify_cq is used to arm the cq, so that a completion generates an interrupt and a new event.
>
>> ibv_destroy_cq, so that:
>> 1) When ibv_destroy_cq returns, I am certain that there is no thread running
>> somewhere between ibv_get_cq_event and
>> ibv_req_notify_cq
>
> ibv_destroy_cq will block until all outstanding references on the cq have been released.  The intent is to protect the user from ibv_get_cq_event from returning a reference to a cq that is being destroyed from another thread, which could result in a crash in the user's code.
>
>> 2) When ibv_destroy_cq returns, I am certain that ibv_get_cq_event will not
>> return the destroyed cq any more.
>
> correct
>
> - Sean
>

--
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:[~2012-01-04  9:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-29 16:42 When is it safe to release connection resources? Flavio Baronti
     [not found] ` <4EFC987B.6070901-ngIpsMLAhaq41k5uCYKmRQ@public.gmane.org>
2011-12-31 10:55   ` Bart Van Assche
2012-01-02 16:39   ` Hefty, Sean
     [not found]     ` <1828884A29C6694DAF28B7E6B8A8237325662B63-P5GAC/sN6hlcIJlls4ac1rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2012-01-04  9:42       ` Flavio Baronti [this message]
     [not found]         ` <4F041F19.1070608-ngIpsMLAhaq41k5uCYKmRQ@public.gmane.org>
2012-01-04 16:04           ` Hefty, Sean
2012-01-04 19:53       ` Bart Van Assche
     [not found]         ` <CAO+b5-qHFFg-KKQQkEZ2sS_+TWAFCJ0Ed4XGV15cs==_9zttSw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-04 20:05           ` Hefty, Sean
     [not found]             ` <1828884A29C6694DAF28B7E6B8A823732566B335-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2012-01-05 11:23               ` Bart Van Assche
     [not found]                 ` <CAO+b5-pk8v-1+STkYXmwTv2nKyQJcZd575dJW6Hipfo5_AchwA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-05 17:29                   ` Roland Dreier
     [not found]                     ` <CAL1RGDXtZA=6uvCE73isD7cu2=LU4b3CGPs4g7UMPmW=1xqgww-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-07  9:59                       ` Bart Van Assche

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=4F041F19.1070608@list-group.com \
    --to=f.baronti-ngipsmlahaq41k5ucykmrq@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@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