Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1596750pxb; Fri, 20 Nov 2020 13:40:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJyezxV8HpSXOcPjN7+sGw/Rsk5hed0w8RHIoUTjFyZr5cV3otP8rHVd0+ZYXi3+usgM82VM X-Received: by 2002:a17:906:ccd3:: with SMTP id ot19mr35646347ejb.44.1605908455882; Fri, 20 Nov 2020 13:40:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605908455; cv=none; d=google.com; s=arc-20160816; b=CcoGXBOiCtx9wSjG5+0/ygXZf75ogAARDEC+ayVolDdZH9VfIhC2OPvM9oDGAWV7oe cgFgPcM8kCBvv9QIUsI+SxQlOSU4JqeqzaFHoaOUkt1YYOAdjJn+R7oMReCFquVIyAR9 cwYZ1EqkuKyKYCgMisxmrXtsQrT7pO2Lq/Dea7whbvo1P8kWM/4idBfjYfaQJ8ywSsgU LYOJIK2jBNsjIXy1eFZOQuVKxVt5D0EIAqlHOqKlp1ek3gXGmKCIBX6tbhlEwR3K7QOA PDx5F2fij29nvzL7QAChXaMhWQakdqnAcqN4mCpAdNGBP9yxB+y4X0UnFMJ/iLCwN+Il MJ2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:subject:references:in-reply-to:cc:to:from:date :dkim-signature; bh=DUJNd4tRGYCD9L2FHbnO1xCZ53g6cGk0WCqn3IXEHeU=; b=M872kQmyegIEDuXP+wxMSAXl8G/penHfi0/N7EyPxqjSws+0/YNYGPAcqyQ6vaJyVe jQu0oQ+YU0s+HVnhNqpKUguyH8zK3kuYQvjP0XaFejt7GSdkxno6+v6yCf/uwGwy+XDe lJBhnMSoRjJcpT8/laYdKI4nT5vVcBvQ7kDd7gEawZ2ihjhnmoX1HBBEl28+vgnSwFFF i1NHsXqXhhcA3c8EGyDcmMzbbXwZNlZg/92xLO62etEG2wnuD2J0Ymj6lOCstV3IVN6s fiTqOU1Y6CPLh7Hoa6yGhsos8AKR08l5+ZdZPZBdNaGQhJi9HYm+2IH1XuEgmikOTePz TGJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CIZEaTqe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gv1si2283163ejb.249.2020.11.20.13.40.33; Fri, 20 Nov 2020 13:40:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CIZEaTqe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728353AbgKTVgV (ORCPT + 99 others); Fri, 20 Nov 2020 16:36:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:50994 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727248AbgKTVgV (ORCPT ); Fri, 20 Nov 2020 16:36:21 -0500 Received: from localhost (cpc102334-sgyl38-2-0-cust884.18-2.cable.virginm.net [92.233.91.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0720F2237B; Fri, 20 Nov 2020 21:36:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605908180; bh=1rzRLgdpZdI/PWxav/ixRoMIL2da2T/gEM+OQBevwqY=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=CIZEaTqeAUy4sehhHduWQSnyEpi4pM2TWmjPaIyZDGAmEJNv1GMd/FPufJreF2xoS O2nwVi2iS1WmWUMCGDnKMfCIto23AU3zT+U9/br1RPw3sgrKPZjbAlr3CTabqjkKP1 X6vIOhd8p5Ed0hDEgEieOy6SvSti5HQAAv82NA+c= Date: Fri, 20 Nov 2020 21:35:59 +0000 From: Mark Brown To: Serge Semin Cc: Ramil Zaripov , Serge Semin , Pavel Parkhomenko , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, Alexey Malahov In-Reply-To: <20201117094517.5654-1-Sergey.Semin@baikalelectronics.ru> References: <20201117094517.5654-1-Sergey.Semin@baikalelectronics.ru> Subject: Re: [RFC PATCH] spi: Take the SPI IO-mutex in the spi_setup() method Message-Id: <160590815903.48662.5764722048038617376.b4-ty@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 17 Nov 2020 12:45:17 +0300, Serge Semin wrote: > I've discovered that due to the recent commit 49d7d695ca4b ("spi: dw: > Explicitly de-assert CS on SPI transfer completion") a concurrent usage of > the spidev devices with different chip-selects causes the "SPI transfer > timed out" error. The root cause of the problem has turned to be in a race > condition of the SPI-transfer execution procedure and the spi_setup() > method being called at the same time. In particular in calling the > spi_set_cs(false) while there is an SPI-transfer being executed. In my > case due to the commit cited above all CSs get to be switched off by > calling the spi_setup() for /dev/spidev0.1 while there is an concurrent > SPI-transfer execution performed on /dev/spidev0.0. Of course a situation > of the spi_setup() being called while there is an SPI-transfer being > executed for two different SPI peripheral devices of the same controller > may happen not only for the spidev driver, but for instance for MMC SPI + > some another device, or spi_setup() being called from an SPI-peripheral > probe method while some other device has already been probed and is being > used by a corresponding driver... > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next Thanks! [1/1] spi: Take the SPI IO-mutex in the spi_setup() method commit: 4fae3a58ab59d8a286864d61fe1846283a0316f2 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark