qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Yuval Shaia <yuval.shaia@oracle.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v5 07/10] hw/rdma: Free all receive buffers when QP is destroyed
Date: Mon, 23 Mar 2020 10:30:40 +0000	[thread overview]
Message-ID: <CAFEAcA86hGnX5MfZjzfR0486qNOXfLmC+YSfc7GOc7d9jakrFQ@mail.gmail.com> (raw)
In-Reply-To: <20190310084610.23077-8-yuval.shaia@oracle.com>

On Sun, 10 Mar 2019 at 09:25, Yuval Shaia <yuval.shaia@oracle.com> wrote:
>
> When QP is destroyed the backend QP is destroyed as well. This ensures
> we clean all received buffer we posted to it.
> However, a contexts of these buffers are still remain in the device.
> Fix it by maintaining a list of buffer's context and free them when QP
> is destroyed.
>
> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>

Hi; Coverity has just raised an issue on this code (CID 1421951):

> diff --git a/hw/rdma/rdma_utils.c b/hw/rdma/rdma_utils.c
> index 0a8abe572d..73f279104c 100644
> --- a/hw/rdma/rdma_utils.c
> +++ b/hw/rdma/rdma_utils.c
> @@ -90,3 +90,32 @@ int64_t rdma_protected_qlist_pop_int64(RdmaProtectedQList *list)
>
>      return qnum_get_uint(qobject_to(QNum, obj));
>  }
> +
> +void rdma_protected_gslist_init(RdmaProtectedGSList *list)
> +{
> +    qemu_mutex_init(&list->lock);
> +}
> +
> +void rdma_protected_gslist_destroy(RdmaProtectedGSList *list)
> +{
> +    if (list->list) {
> +        g_slist_free(list->list);
> +        list->list = NULL;
> +    }

Coverity wonders whether this function should take the list->lock
before freeing the list, because the other places which manipulate
list->list take the lock.

> +}

This is one of those Coverity checks which is quite prone to
false positives because it's just heuristically saying "you
look like you take the lock when you modify this field elsewhere,
maybe this place should take the lock too". Does this function
need to take a lock, or does the code that uses it guarantee
that it's never possible for another thread to be running
with access to the structure once we decide to destroy it?

thanks
-- PMM


  reply	other threads:[~2020-03-23 10:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-10  8:46 [Qemu-devel] [PATCH v5 00/10] Misc fixes to pvrdma device Yuval Shaia
2019-03-10  8:46 ` [Qemu-devel] [PATCH v5 01/10] hw/rdma: Switch to generic error reporting way Yuval Shaia
2019-03-10  8:46 ` [Qemu-devel] [PATCH v5 02/10] hw/rdma: Introduce protected qlist Yuval Shaia
2019-03-10  8:46 ` [Qemu-devel] [PATCH v5 03/10] hw/rdma: Protect against concurrent execution of poll_cq Yuval Shaia
2019-03-10  8:46 ` [Qemu-devel] [PATCH v5 04/10] hw/pvrdma: Collect debugging statistics Yuval Shaia
2019-03-10  8:46 ` [Qemu-devel] [PATCH v5 05/10] {hmp, hw/pvrdma}: Expose device internals via monitor interface Yuval Shaia
2019-03-10  8:46 ` [Qemu-devel] [PATCH v5 06/10] hw/rdma: Free all MAD receive buffers when device is closed Yuval Shaia
2019-03-10  8:46 ` [Qemu-devel] [PATCH v5 07/10] hw/rdma: Free all receive buffers when QP is destroyed Yuval Shaia
2020-03-23 10:30   ` Peter Maydell [this message]
2020-03-24  9:56     ` Yuval Shaia
2020-03-24 10:04       ` Yuval Shaia
2019-03-10  8:46 ` [Qemu-devel] [PATCH v5 08/10] hw/pvrdma: Delete unneeded function argument Yuval Shaia
2019-03-10  8:46 ` [Qemu-devel] [PATCH v5 09/10] hw/pvrdma: Delete pvrdma_exit function Yuval Shaia
2019-03-10  8:46 ` [Qemu-devel] [PATCH v5 10/10] hw/pvrdma: Unregister from shutdown notifier when device goes down Yuval Shaia

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=CAFEAcA86hGnX5MfZjzfR0486qNOXfLmC+YSfc7GOc7d9jakrFQ@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yuval.shaia@oracle.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).