From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2308C433E2 for ; Fri, 22 May 2020 14:36:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CC94C2225E for ; Fri, 22 May 2020 14:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730089AbgEVOgn (ORCPT ); Fri, 22 May 2020 10:36:43 -0400 Received: from mga09.intel.com ([134.134.136.24]:53007 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729879AbgEVOgn (ORCPT ); Fri, 22 May 2020 10:36:43 -0400 IronPort-SDR: PNRESnoLTTWrUFmjh2S7uVf/ViOltpUimj0ATAkaB7hqF/++B36fLXIDeAYymtKg+JMhbl7Ypa PV+iqeF43h9Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 May 2020 07:36:42 -0700 IronPort-SDR: WNZo8BoCRV9wtlQZiq9woxf7m5ny2JVyE4bhx4igzwWJwFIpt7LGzYskJ0taZyG5btHO00rmXe QQTY2nqFiPPA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,422,1583222400"; d="scan'208";a="283413455" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga002.jf.intel.com with ESMTP; 22 May 2020 07:36:37 -0700 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1jc8mt-008FKt-Bm; Fri, 22 May 2020 17:36:39 +0300 Date: Fri, 22 May 2020 17:36:39 +0300 From: Andy Shevchenko To: Serge Semin Cc: Mark Brown , Linus Walleij , Vinod Koul , Feng Tang , Grant Likely , Alan Cox , Georgy Vlasov , Ramil Zaripov , Alexey Malahov , Thomas Bogendoerfer , Paul Burton , Ralf Baechle , Arnd Bergmann , Rob Herring , linux-mips@vger.kernel.org, devicetree@vger.kernel.org, Wan Ahmad Zainie , Thomas Gleixner , Jarkko Nikula , "wuxu.wu" , Clement Leger , Linus Walleij , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 01/16] spi: dw: Add Tx/Rx finish wait methods to the MID DMA Message-ID: <20200522143639.GG1634618@smile.fi.intel.com> References: <20200522000806.7381-2-Sergey.Semin@baikalelectronics.ru> <20200522111340.GX1634618@smile.fi.intel.com> <20200522115235.rt3ay7lveimrgooa@mobilestation> <20200522121221.GA1634618@smile.fi.intel.com> <20200522121820.GG5801@sirena.org.uk> <20200522123427.GD1634618@smile.fi.intel.com> <20200522124406.co7gmteojfsooerc@mobilestation> <20200522131013.GH5801@sirena.org.uk> <20200522132742.taf2ixfjpyd5u3dt@mobilestation> <20200522140025.bmd6bhpjjk5msvsm@mobilestation> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200522140025.bmd6bhpjjk5msvsm@mobilestation> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Fri, May 22, 2020 at 05:00:25PM +0300, Serge Semin wrote: > On Fri, May 22, 2020 at 04:27:43PM +0300, Serge Semin wrote: > > On Fri, May 22, 2020 at 02:10:13PM +0100, Mark Brown wrote: > > > On Fri, May 22, 2020 at 03:44:06PM +0300, Serge Semin wrote: > > > > On Fri, May 22, 2020 at 03:34:27PM +0300, Andy Shevchenko wrote: ... > > > > > > Realistically it seems unlikely that the clock will be even as slow as > > > > > > double digit kHz though, and if we do I'd not be surprised to see other > > > > > > problems kicking in. It's definitely good to handle such things if we > > > > > > can but so long as everything is OK for realistic use cases I'm not sure > > > > > > it should be a blocker. > > > > > > > As I see it the only way to fix the problem for any use-case is to move the > > > > busy-wait loop out from the tasklet's callback, add a completion variable to the > > > > DW SPI data and wait for all the DMA transfers completion in the > > > > dw_spi_dma_transfer() method. Then execute both busy-wait loops (there we can > > > > use spi_delay_exec() since it's a work-thread) and call > > > > spi_finalize_current_transfer() after it. What do you think? > > > > > > I'm concerned that this will add latency for the common case to handle a > > > potential issue for unrealistically slow buses but yeah, if it's an > > > issue kicking up to task context is how you'd handle it. > > > > I am not that worried about the latency (most likely it'll be the same as > > before), but I am mostly concerned regarding a most likely need to re-implement > > a local version spi_transfer_wait(). We can't afford wait for the completion > > indefinitely here, so the wait_for_completion_timeout() should be used, for which > > I would have to calculate a decent timeout based on the transfer capabilities, > > etc. So basically it would mean to partly copy the spi_transfer_wait() to this > > module.( > > I'd also wait for Andy's suggestion regarding this, since he's been worried > about the delay length in the first place. So he may come up with a better > solution in this regard. The completion approach sounds quite heavy to me. Since we haven't got any report for such an issue, I prefer as simplest as possible approach. If we add might_sleep() wouldn't it be basically reimplementation of the spi_delay_exec() again? And second question, do you experience this warning on your system? My point is: let's warn and see if anybody comes with a bug report. We will solve an issue when it appears. -- With Best Regards, Andy Shevchenko