[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20140213.184812.213639748986818676.davem@davemloft.net>
Date: Thu, 13 Feb 2014 18:48:12 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: mst@...hat.com
Cc: linux-kernel@...r.kernel.org, qinchuanyu@...wei.com,
kvm@...r.kernel.org, virtio-dev@...ts.oasis-open.org,
virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
jasowang@...hat.com
Subject: Re: [PATCH net v2] vhost: fix ref cnt checking deadlock
From: "Michael S. Tsirkin" <mst@...hat.com>
Date: Thu, 13 Feb 2014 11:42:05 +0200
> vhost checked the counter within the refcnt before decrementing. It
> really wanted to know that it is the one that has the last reference, as
> a way to batch freeing resources a bit more efficiently.
>
> Note: we only let refcount go to 0 on device release.
>
> This works well but we now access the ref counter twice so there's a
> race: all users might see a high count and decide to defer freeing
> resources.
> In the end no one initiates freeing resources until the last reference
> is gone (which is on VM shotdown so might happen after a looooong time).
>
> Let's do what we probably should have done straight away:
> switch from kref to plain atomic, documenting the
> semantics, return the refcount value atomically after decrement,
> then use that to avoid the deadlock.
>
> Reported-by: Qin Chuanyu <qinchuanyu@...wei.com>
> Signed-off-by: Michael S. Tsirkin <mst@...hat.com>
> ---
>
> This patch is needed for 3.14 and -stable.
Applied and queued up for -stable.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists