Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161177AbbKEMaT (ORCPT ); Thu, 5 Nov 2015 07:30:19 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:48605 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031373AbbKEMaQ (ORCPT ); Thu, 5 Nov 2015 07:30:16 -0500 Subject: Re: [PATCH v2 1/5] spi: introduce mmap read support for spi flash devices To: Mark Brown References: <1446545174-14193-1-git-send-email-vigneshr@ti.com> <1446545174-14193-2-git-send-email-vigneshr@ti.com> <20151104143915.GI1717@sirena.org.uk> CC: Tony Lindgren , Michal Suchanek , Russell King , , , , , , From: Vignesh R Message-ID: <563B4BB0.9020206@ti.com> Date: Thu, 5 Nov 2015 17:59:36 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151104143915.GI1717@sirena.org.uk> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1532 Lines: 38 On 11/04/2015 08:09 PM, Mark Brown wrote: > On Tue, Nov 03, 2015 at 03:36:10PM +0530, Vignesh R wrote: > >> + } >> + mutex_lock(&master->mmap_lock_mutex); >> + ret = master->spi_mtd_mmap_read(spi, from, len, retlen, buf, >> + read_opcode, addr_width, >> + dummy_bytes); >> + mutex_unlock(&master->mmap_lock_mutex); >> + if (master->auto_runtime_pm) >> + pm_runtime_put(master->dev.parent); > > It's a bit worrying that this doesn't sync with the message queue except > via the mutex: this means that we might be out of order with respect to > any asynchronous transfers that are happening on the device. I'm not > sure that this is a practical problem, though there is some risk of > unfair scheduling that would have to be under extreme load and it might > make sense to prioritise reads anyway. > Since mmap interface is used only by mtd flash drivers and since almost all mtd flash devices use synchronous transfers (spi_sync()), IMO, there wont be out of order problem wrt mtd flashes. But mmap read might delay transfers queued for non mtd flash devices. It is difficult to wait for all transfers already queued to be pumped out by __spi_pump_messages() and then do the mmap transfer. Do you have any thoughts on how to sync with message queue? -- Regards Vignesh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/