All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
To: Oded Gabbay <oded.gabbay-5C7GfCeVMHo@public.gmane.org>
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] iommu/amd: fix accounting of device_state
Date: Wed, 12 Nov 2014 15:02:47 +0100	[thread overview]
Message-ID: <20141112140247.GU10744@8bytes.org> (raw)
In-Reply-To: <1415614899-12602-1-git-send-email-oded.gabbay-5C7GfCeVMHo@public.gmane.org>

On Mon, Nov 10, 2014 at 12:21:39PM +0200, Oded Gabbay wrote:
> This patch fixes a bug in the accounting of the device_state.
> In the current code, the device_state was put (decremented) too many times,
> which sometimes lead to the driver getting stuck permanently in
> put_device_state_wait(). That happen because the device_state->count would go
> below zero, which is never supposed to happen.
> 
> The root cause is that the device_state was decremented in put_pasid_state()
> and put_pasid_state_wait() but also in all the functions that call those
> functions. Therefore, the device_state was decremented twice in each of these
> code paths.
> 
> The fix is to decouple the device_state accounting from the pasid_state
> accounting - remove the call to put_device_state() from the
> put_pasid_state() and the put_pasid_state_wait())

Right, there was a double drop of the reference to device state. An
alternative would have been to remove the put_device_state call at the
end of the amd_iommu_unbind_pasid() function. But this patch works as
well and is slightly better, so: Applied, thanks.


	Joerg

WARNING: multiple messages have this Message-ID (diff)
From: Joerg Roedel <joro@8bytes.org>
To: Oded Gabbay <oded.gabbay@amd.com>
Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu/amd: fix accounting of device_state
Date: Wed, 12 Nov 2014 15:02:47 +0100	[thread overview]
Message-ID: <20141112140247.GU10744@8bytes.org> (raw)
In-Reply-To: <1415614899-12602-1-git-send-email-oded.gabbay@amd.com>

On Mon, Nov 10, 2014 at 12:21:39PM +0200, Oded Gabbay wrote:
> This patch fixes a bug in the accounting of the device_state.
> In the current code, the device_state was put (decremented) too many times,
> which sometimes lead to the driver getting stuck permanently in
> put_device_state_wait(). That happen because the device_state->count would go
> below zero, which is never supposed to happen.
> 
> The root cause is that the device_state was decremented in put_pasid_state()
> and put_pasid_state_wait() but also in all the functions that call those
> functions. Therefore, the device_state was decremented twice in each of these
> code paths.
> 
> The fix is to decouple the device_state accounting from the pasid_state
> accounting - remove the call to put_device_state() from the
> put_pasid_state() and the put_pasid_state_wait())

Right, there was a double drop of the reference to device state. An
alternative would have been to remove the put_device_state call at the
end of the amd_iommu_unbind_pasid() function. But this patch works as
well and is slightly better, so: Applied, thanks.


	Joerg


  parent reply	other threads:[~2014-11-12 14:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-10 10:21 [PATCH] iommu/amd: fix accounting of device_state Oded Gabbay
2014-11-10 10:21 ` Oded Gabbay
     [not found] ` <1415614899-12602-1-git-send-email-oded.gabbay-5C7GfCeVMHo@public.gmane.org>
2014-11-12 14:02   ` Joerg Roedel [this message]
2014-11-12 14:02     ` Joerg Roedel

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=20141112140247.GU10744@8bytes.org \
    --to=joro-zlv9swrftaidnm+yrofe0a@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=oded.gabbay-5C7GfCeVMHo@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.