Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp311166pxb; Wed, 18 Nov 2020 05:18:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxIyVIeIL0XOC5k+Al/YLdpgWm4aF6K0XFxAQfy++y56uDsQ79Y58prR3sq7T9CUphFVGq+ X-Received: by 2002:a17:906:b53:: with SMTP id v19mr23165509ejg.136.1605705537453; Wed, 18 Nov 2020 05:18:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605705537; cv=none; d=google.com; s=arc-20160816; b=WOs0F6RgTRxA1GWwmTUdv3SVJihTtLlw4vNOG/NxwNMacFwmYrH7L72cP5uqvTStxE az7hSha0mFO72rH/I1j+9fjsmusTWCYcYZBPw6w7tNR8USROO/TYs4Tzarcg58SUJ+tq mR+3OkANpB3O/D9DlBp/iCFMN6V2uasWAMAOiyRtFTpv816mwl+p8Q3bb1aqSTrn0joL n2dhsLSQ9uH12scYJyA0gUECpugPcsQVMHpNh9xUWE+I3bkhNySseMRTCQkxLDWrR4cV nIpNv9EA3SK2/d2iTfknJjez8nDi5GNRcRkaC4yTL6XhnrfLWqNukxBzTgEkZT6/qV8G NR1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=e23kZynCiNav246zo9Xn4R3kIa8ASFdQUD3HVEtCql8=; b=XJOh+PET/uuUI7+opZ0xdzoTZ9m+8n1n8dnv0AdSB1/yeaMiHI4GRtAEO0rCqW6+fG DridRQa1Cy07gjq/iVKoK7CkUQO2jLBQHqvSXFsx2mpz/psj+sIIYQNuO2/hHK/dNBQh Tz1rVOSsNs5UiNI7Q/M85iCUzvQ/m5ZZfpcrD0EZIqfB+cLMrw4Q6m3q6f3fSLrIZCQK vQD6w2FzdoKPwDEMUA74NemjV3N2amPc6oqsk6YSgAJDhU8FVyMlTgh8qR1lM9UP5E4V Q9vXNdb+1/35DZyNCEiRhyGBZSEWNfc4oOmDIPmtaIpG138UVCt7l8kiWeb6SupJq44j IzeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="j/3fR4bx"; 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 n20si16282299edw.72.2020.11.18.05.18.34; Wed, 18 Nov 2020 05:18:57 -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="j/3fR4bx"; 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 S1726243AbgKRNQ1 (ORCPT + 99 others); Wed, 18 Nov 2020 08:16:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:43872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726015AbgKRNQ0 (ORCPT ); Wed, 18 Nov 2020 08:16:26 -0500 Received: from localhost (fw-tnat.cambridge.arm.com [217.140.96.140]) (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 385BC241A5; Wed, 18 Nov 2020 13:16:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605705385; bh=nTNTsy3xL/gdqy1AFHbIdrzBXhJhxmiLNAzDiJMibX4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=j/3fR4bxrWAtVPLAy/gorf0yvxu74ioU6EQeCPzHG60j8ReAMM5AOCQZmXSyigOVx iX6gPnoCGy3blwvPQL+/pBz6Wv/6LZoDlyWiNRllMcU8OdaCXjk2EgdrEk/ZdmBPoW AV3QX8xQIZOjENq+7wVMW8P30xR0W4T/XV7edH3U= Date: Wed, 18 Nov 2020 13:16:04 +0000 From: Mark Brown To: Serge Semin Cc: Serge Semin , Alexey Malahov , Ramil Zaripov , Pavel Parkhomenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] spi: Take the SPI IO-mutex in the spi_setup() method Message-ID: <20201118131604.GC4827@sirena.org.uk> References: <20201117094517.5654-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Md/poaVZ8hnGTzuv" Content-Disposition: inline In-Reply-To: <20201117094517.5654-1-Sergey.Semin@baikalelectronics.ru> X-Cookie: A nuclear war can ruin your whole day. User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Md/poaVZ8hnGTzuv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Nov 17, 2020 at 12:45:17PM +0300, Serge Semin wrote: > 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... It's documented that a driver's spi_setup() operation is supposed to support being able to be called concurrently with other transfers, see spi-summary.rst. > Of course I could have provided a fix affecting the DW APB SSI driver > only, for instance, by creating a mutual exclusive access to the set_cs > callback and setting/clearing only the bit responsible for the > corresponding chip-select. But after a short research I've discovered that > the problem most likely affects a lot of the other drivers: Yeah, problems with it are very common as the documentation has noted since forever. IIRC there was some problem triggered by trying to force it to be serialised but I can't remember what it was. --Md/poaVZ8hnGTzuv Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl+1HpQACgkQJNaLcl1U h9C10wf/UL7gHcOtEornz8CUpn8gXROVBLHD829V29n5B5EAiRDHuF/B5TrIbNfE Ciaeb81Gonxu2/gXNWHJB09neBhzC338vZGnfQumD8iR2HJmjqtfP/vpdxu+pxt1 XBZhKfhpqrwKgZbERk87QJfv10YV4x3CIsQOqgBK1C5TwmBotCTgX11bsERfLclj vssooAxtI/R8J3EQrt99SczUNfEZZHxIU5ZtrEd4s1to/PLFO0yLQshro5fhlIMj z2jFS4lkgaOVZEEZU2xOaOMGSGYUdRRbO4UlT1n3wGRMWV+nXBh9W+34RFfVMMcN VKWlt2Rv7Soaqecr2x87L0qVETf4ww== =70uB -----END PGP SIGNATURE----- --Md/poaVZ8hnGTzuv--