From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754816AbbIIDRu (ORCPT ); Tue, 8 Sep 2015 23:17:50 -0400 Received: from mail-by2on0110.outbound.protection.outlook.com ([207.46.100.110]:17952 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754605AbbIIDRm convert rfc822-to-8bit (ORCPT ); Tue, 8 Sep 2015 23:17:42 -0400 From: Li Leo To: Yao Yuan , Vinod Koul CC: Nigel Cunningham , "stefan@agner.ch" , Arnd Bergmann , Dan Williams , "dmaengine@vger.kernel.org" , lkml , "linux-arm-kernel@lists.infradead.org" , "linux-pm@vger.kernel.org" Subject: RE: [PATCH v2] dmaengine: fsl-edma: add PM suspend/resume support Thread-Topic: [PATCH v2] dmaengine: fsl-edma: add PM suspend/resume support Thread-Index: AQHQw5QETahgv8214E+kkRhxNaGB9p4KjlKAgABu6+CAAVL+AIADWdZggABAUYCAAANXAIAEhi0QgByGRYCAAtFMAA== Date: Wed, 9 Sep 2015 03:02:26 +0000 Message-ID: References: <1437469005-3162-1-git-send-email-yao.yuan@freescale.com> <55D183D1.9020401@nigelcunningham.com.au> <20150820040801.GS13546@localhost> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=LeoLi@freescale.com; x-originating-ip: [192.88.168.50] x-microsoft-exchange-diagnostics: 1;BLUPR03MB136;5:7AG4Q/rRNE+Jb6CK2c5kq2ytMhqE7lpz27kcFWpLHTaEWfitD4KkKSgHhRj2kzg9Ak1nh9t4ZXCkptv+ZXQXWHJ31/LX5dX+Zw62+rNtZ7zSRO8RM++dT46NCW+o24gwnW7cMIXFIIcUPITsGkNvMw==;24:3mngQUjgLBJzSMps1PKBFelN14H0T6x8finD8C8UnsaimB8ONdaspgqySR8O51quImW5axDoGvD6LdHcz4OPOfh7liNL/8K8xaYuEftDDxo=;20:fbs44JHFsCrrkTPYjOignZ51nmifJIuOXw/4U4pb58u+RudBBj1mZWKaksmVQtR28gqhOgLfJ5fjnD6bnfBTLg== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB136; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(5005006)(8121501046)(3002001);SRVR:BLUPR03MB136;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB136; x-forefront-prvs: 0694C54398 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(189002)(199003)(24454002)(86362001)(76176999)(122556002)(2950100001)(5001960100002)(40100003)(5007970100001)(5002640100001)(97736004)(64706001)(189998001)(33656002)(10400500002)(105586002)(80792005)(11100500001)(66066001)(87936001)(5001830100001)(99286002)(101416001)(106356001)(76576001)(106116001)(93886004)(50986999)(2900100001)(5004730100002)(81156007)(74316001)(62966003)(102836002)(77156002)(5003600100002)(54356999)(4001540100001)(5001860100001)(46102003)(5001770100001)(92566002)(77096005)(68736005);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR03MB136;H:DM2PR0301MB0734.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Sep 2015 03:02:26.9473 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB136 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Thu, Aug 20, 2015 at 12:08:00PM +0800, Vinod Koul wrote: > > On Mon, Aug 17, 2015 at 02:10:46PM -0500, Li Yang wrote: > > > >> Think of it from the end user perspective. Would you like your > > > >> laptop (or > > > >> whatever) to refuse to suspend because of this condition? The > > > >> user may well expect that closing the lid on their laptop will > > > >> reliably lead to it suspending to ram. Returning a failure here > > > >> could result in a loss of data if the condition is not detected > > > >> and the machine > > subsequently runs out of power. > > > >> > > > > > > > > Yes, the user may well expect that closing the lid on their laptop > > > > will reliably > > lead to it suspending to ram. > > > > So the client(the user of the DMA) must to PAUSE or terminate the > > > > DMA > > transmission. > > > > > > > > We need to rely on client doing the right thing here. > > > > The DMA should not make a decision instead of client. > > > > If the DMA is not idle in DMA suspend, it should be the client's issue. > > > > We don't know what the client really want to do, so just return > > > > the non- > > success value. > > > > > > The problem here is that neither the client nor the DMA controller > > > driver should easily decide to stop the suspend entrance and rollback. > > > I don't think the non-idle situation is serious enough to cause a > > > rollback. You should do whatever can be done with the DMA > > > controller(such as stop the controller and leave whatever to be done > > > to the wake up) and continue with the suspend. > > > > Ideally yes client should suspend first and dmaengine driver then > > being idle when suspend is invoked. But we know we are in idle world! > > So, driver should ensure it suspends the active channels and then goes > > to suspend and restores that on resume > > > > Hi Vinod, > Hi Leo, > > Is there any other discussions? > > I think we can have the following solutions for DMA driver: > 1, Force terminate the active channels in its suspend and then return. > 2, DMA have to wait until the active channels idle. > 3, Don't care about the active channels and direct return. > 4, Return BUS BUSY error and stop PM progress. > > > I prefer the last one, because I think client should make sure the channel is idle. > > But also the first one should be works. I agree that client should be responsible for cleaning up the pending requests. My concern is that we shouldn't be triggering rewind by returning error if any client failed to do so. I would suggest to complain about it with a message and continue to do whatever we can do at the DMA driver level and continue with the suspend. So I would prefer the solution one. Regards, Leo