From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751656AbdJTGND (ORCPT ); Fri, 20 Oct 2017 02:13:03 -0400 Received: from mga04.intel.com ([192.55.52.120]:51725 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750968AbdJTGNC (ORCPT ); Fri, 20 Oct 2017 02:13:02 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,405,1503385200"; d="scan'208";a="164871216" Date: Fri, 20 Oct 2017 11:47:20 +0530 From: Vinod Koul To: Alexander Kochetkov Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Dan Williams , Marek Szyprowski , Krzysztof Kozlowski Subject: Re: [PATCH v2 1/2] dmaengine: pl330: fix descriptor allocation fail Message-ID: <20171020061720.GN30097@localhost> References: <1507117044-3456-1-git-send-email-al.kochet@gmail.com> <1507117044-3456-2-git-send-email-al.kochet@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1507117044-3456-2-git-send-email-al.kochet@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 04, 2017 at 02:37:23PM +0300, Alexander Kochetkov wrote: > If two concurrent threads call pl330_get_desc() when DMAC descriptor > pool is empty it is possible that allocation for one of threads will fail > with message: > > kernel: dma-pl330 20078000.dma-controller: pl330_get_desc:2469 ALERT! > > Here how that can happen. Thread A calls pl330_get_desc() to get > descriptor. If DMAC descriptor pool is empty pl330_get_desc() allocates > new descriptor on shared pool using add_desc() and then get newly > allocated descriptor using pluck_desc(). At the same time thread B calls > pluck_desc() and take newly allocated descriptor. In that case descriptor > allocation for thread A will fail. > > Using on-stack pool for new descriptor allow avoid the issue described. > The patch modify pl330_get_desc() to use on-stack pool for allocation > new descriptors. Applied, thanks -- ~Vinod