Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966848AbbBDQfD (ORCPT ); Wed, 4 Feb 2015 11:35:03 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:55934 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966683AbbBDQe5 (ORCPT ); Wed, 4 Feb 2015 11:34:57 -0500 Date: Wed, 4 Feb 2015 17:34:50 +0100 From: Peter Zijlstra To: Joerg Roedel Cc: iommu@lists.linux-foundation.org, Benjamin LaHaise , Jesse Barnes , linux-aio@kvack.org, linux-kernel@vger.kernel.org, Oded Gabbay , jroedel@suse.de Subject: Re: [PATCH] iommu/amd: Use wait_event in put_pasid_state_wait Message-ID: <20150204163450.GD5029@twins.programming.kicks-ass.net> References: <1423062622-28257-1-git-send-email-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1423062622-28257-1-git-send-email-joro@8bytes.org> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1362 Lines: 38 On Wed, Feb 04, 2015 at 04:10:22PM +0100, Joerg Roedel wrote: > From: Joerg Roedel > > Now that I learned about possible spurious wakeups this > place needs fixing too. Replace the self-coded sleep variant > with the generic wait_event() helper. > > Signed-off-by: Joerg Roedel > --- > drivers/iommu/amd_iommu_v2.c | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c > index b6398d7..5cc1409 100644 > --- a/drivers/iommu/amd_iommu_v2.c > +++ b/drivers/iommu/amd_iommu_v2.c > @@ -266,14 +266,7 @@ static void put_pasid_state(struct pasid_state *pasid_state) > > static void put_pasid_state_wait(struct pasid_state *pasid_state) > { > - DEFINE_WAIT(wait); > - > - prepare_to_wait(&pasid_state->wq, &wait, TASK_UNINTERRUPTIBLE); > - > - if (!atomic_dec_and_test(&pasid_state->count)) > - schedule(); > - > - finish_wait(&pasid_state->wq, &wait); > + wait_event(pasid_state->wq, !atomic_read(&pasid_state->count)); > free_pasid_state(pasid_state); > } You just lost your atomic_dec. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/