Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp583556imu; Wed, 16 Jan 2019 04:15:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN74YwPShWPdPGeCHVo/lh90tEwtgqSVp5iwmKTun1I2bDPJY6rQI1uzJ+fvSqY1Uwdtt/b3 X-Received: by 2002:a17:902:280b:: with SMTP id e11mr9511589plb.269.1547640947255; Wed, 16 Jan 2019 04:15:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547640947; cv=none; d=google.com; s=arc-20160816; b=ky/8vD8lp5xswz9EJGMkSbFKDBNPx8K0uT1wVN9+hFprbdpusXfnhc/uSyWZbt2eWn 3D0l3nkndAfRWgYYIDnc+BNBrls4YcuLiYyolgrTlT0Z3NPJU0TNgwkOqZs6jzR2lmAn dj4UNIpaqIzKdIa8CZC/8G/QDXXGavjuK26fUMaKc99cdHD5nVEffbcMXE/6+qr6i/9c 6P2JkoNmHXsrV4L7hRuCmvSYMa2dEiafquzMZxVwWHOX0uPup1UjaR7VCi/B/31jJ91K EPK51G9eaXi2xyyyEuHzjbfwe/B9dvJFqnedC1dYZrXMFJfwY12Kogj7nPe93XbQPYZM cVNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=yv1+hIL82nvnUFwN9RCvH8mloQtt+2wdmUQ6kD/E96I=; b=ndY5QvX8nMrRulGzPWKWUU3S4iAa8XRzRcFuphldXc/dbkaTuUFO61RKZRal9JurPY JHyhnuUefFhkreP9u3EdRS7xLYUz/adKBDuOyif0CEFbdRdO4Gl4J8ujyiM7mhTbROlH BXwiMqRJAq+WqpF0vW6Gg72byOFrIkSuV7J6DzIEIDWogtf4eChj6TJ/lRDFSidipOjl M5xNC/Ggq/OrGqFqTC8bi2DG2BjvNiseEIpAi4yD4pt+bTcq3zmK+w9Ss7/lP0RZSzUG SVgbcqCsXKEYGvYnwWph+Zs6LJj0zhiHLSZM1qXmos782UzcOEv+ZOjxNiD5yGDZImWc ZKNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m78si1460097pfj.48.2019.01.16.04.15.28; Wed, 16 Jan 2019 04:15:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390089AbfAOU67 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 15 Jan 2019 15:58:59 -0500 Received: from 212-186-180-163.static.upcbusiness.at ([212.186.180.163]:39050 "EHLO cgate.sperl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730050AbfAOU67 (ORCPT ); Tue, 15 Jan 2019 15:58:59 -0500 Received: from [10.10.10.192] (account martin@sperl.org [10.10.10.192] verified) by sperl.org (CommuniGate Pro SMTP 6.2.1 _community_) with ESMTPSA id 7754801; Tue, 15 Jan 2019 20:58:55 +0000 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: Regression: spi: core: avoid waking pump thread from spi_sync instead run teardown delayed From: Martin Sperl X-Mailer: iPad Mail (16C50) In-Reply-To: <20190115192619.GG5522@sirena.org.uk> Date: Tue, 15 Jan 2019 21:58:55 +0100 Cc: Jon Hunter , linux-tegra , Linux Kernel Mailing List , linux-spi@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: <5D3256B1-5DAE-4E3F-9099-5425F4BCA304@martin.sperl.org> References: <7C4A5EFC-8235-40C8-96E1-E6020529DF72@martin.sperl.org> <20190115192619.GG5522@sirena.org.uk> To: Mark Brown Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On 15.01.2019, at 20:26, Mark Brown wrote: > >> On Tue, Jan 15, 2019 at 06:39:27PM +0100, kernel@martin.sperl.org wrote: >> >> Is it possible that the specific flash is not using the “normal” >> spi_pump_message, but spi_controller_mem_ops operations? > > Right, that's my best guess at the minute as well. > >> Maybe we are missing the teardown in that driver or something is >> changing flags there. > >> grepping a bit: > >> I see spi_mem_access_start calling spi_flush_queue, which is calling >> pump_message, which - if there is no transfer - will trigger a delayed >> tear-down, while it maybe should not be doing that. > > If nothing else it's inefficient. > >> Maybe spi_mem_access_end needs a call to spi_flush_queue as well? > > Hrm, or needs to schedule the queue at any rate (though this will only > have an impact in the fairly unusual case where there's something > sharing the bus with a flash). > >> Unfortunately this is theoretical work and quite a lot of guesswork >> without an actual device available for testing... > > Indeed. Maybe a bigger change to the reduce the complexity of the state machine would solve that problem and also reduce code complexity... I may find some time over the weekend if no solution has been found until then. The way I would envision it it would have a “state” as a level (0=shutdown, 1=hw enabled, 2=in pump, 3=in transfer, 4=in hw-mode,...) and a complete to allow waking the shutdown thread (and by this avoiding the busy wait loop we have now). This would replace those idling, busy, and running flags. Drawback: it is invasive, but let us see what it really looks like... Martin