Message ID | 1386684373-24753-1-git-send-email-chiau.ee.chew@intel.com (mailing list archive) |
---|---|
State | Rejected |
Headers | show |
On Tue, Dec 10, 2013 at 10:06:13PM +0800, Chew Chiau Ee wrote: > From: Chew, Chiau Ee <chiau.ee.chew@intel.com> > > This is to disable/enable DW_DMAC hw during suspend/resume. > > Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com> > Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > drivers/dma/dw/pci.c | 33 +++++++++++++++++++++++++++++++++ > 1 files changed, 33 insertions(+), 0 deletions(-) > > diff --git a/drivers/dma/dw/pci.c b/drivers/dma/dw/pci.c > index e89fc24..97bc3a2 100644 > --- a/drivers/dma/dw/pci.c > +++ b/drivers/dma/dw/pci.c > @@ -75,6 +75,36 @@ static void dw_pci_remove(struct pci_dev *pdev) > dev_warn(&pdev->dev, "can't remove device properly: %d\n", ret); > } > > +#ifdef CONFIG_PM_SLEEP > + > +static int dw_pci_suspend_noirq(struct device *dev) > +{ > + struct pci_dev *pci = to_pci_dev(dev); > + struct dw_dma_chip *chip = pci_get_drvdata(pci); > + > + return dw_dma_suspend(chip); > +}; > + > +static int dw_pci_resume_noirq(struct device *dev) > +{ > + struct pci_dev *pci = to_pci_dev(dev); > + struct dw_dma_chip *chip = pci_get_drvdata(pci); > + > + return dw_dma_resume(chip); > +}; > + > +#else /* !CONFIG_PM_SLEEP */ > + > +#define dw_pci_suspend_noirq NULL > +#define dw_pci_resume_noirq NULL > + > +#endif /* !CONFIG_PM_SLEEP */ How about SET_SYSTEM_SLEEP_PM_OPS instead? -- ~Vinod > + > +static const struct dev_pm_ops dw_pci_dev_pm_ops = { > + .suspend_noirq = dw_pci_suspend_noirq, > + .resume_noirq = dw_pci_resume_noirq, > +}; > + > static DEFINE_PCI_DEVICE_TABLE(dw_pci_id_table) = { > /* Medfield */ > { PCI_VDEVICE(INTEL, 0x0827), (kernel_ulong_t)&dw_pci_pdata }, > @@ -92,6 +122,9 @@ static struct pci_driver dw_pci_driver = { > .id_table = dw_pci_id_table, > .probe = dw_pci_probe, > .remove = dw_pci_remove, > + .driver = { > + .pm = &dw_pci_dev_pm_ops, > + }, > }; > > module_pci_driver(dw_pci_driver); > -- > 1.7.4.4 >
T24gVHVlLCAyMDEzLTEyLTEwIGF0IDE1OjQwICswNTMwLCBWaW5vZCBLb3VsIHdyb3RlOg0KPiBP biBUdWUsIERlYyAxMCwgMjAxMyBhdCAxMDowNjoxM1BNICswODAwLCBDaGV3IENoaWF1IEVlIHdy b3RlOg0KPiA+IEZyb206IENoZXcsIENoaWF1IEVlIDxjaGlhdS5lZS5jaGV3QGludGVsLmNvbT4N Cj4gPiANCj4gPiBUaGlzIGlzIHRvIGRpc2FibGUvZW5hYmxlIERXX0RNQUMgaHcgZHVyaW5nIHN1 c3BlbmQvcmVzdW1lLg0KPiA+IA0KPiA+IFNpZ25lZC1vZmYtYnk6IENoZXcsIENoaWF1IEVlIDxj aGlhdS5lZS5jaGV3QGludGVsLmNvbT4NCj4gPiBBY2tlZC1ieTogQW5keSBTaGV2Y2hlbmtvIDxh bmRyaXkuc2hldmNoZW5rb0BsaW51eC5pbnRlbC5jb20+DQo+ID4gLS0tDQo+ID4gIGRyaXZlcnMv ZG1hL2R3L3BjaS5jIHwgICAzMyArKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysNCj4g PiAgMSBmaWxlcyBjaGFuZ2VkLCAzMyBpbnNlcnRpb25zKCspLCAwIGRlbGV0aW9ucygtKQ0KPiA+ IA0KPiA+IGRpZmYgLS1naXQgYS9kcml2ZXJzL2RtYS9kdy9wY2kuYyBiL2RyaXZlcnMvZG1hL2R3 L3BjaS5jDQo+ID4gaW5kZXggZTg5ZmMyNC4uOTdiYzNhMiAxMDA2NDQNCj4gPiAtLS0gYS9kcml2 ZXJzL2RtYS9kdy9wY2kuYw0KPiA+ICsrKyBiL2RyaXZlcnMvZG1hL2R3L3BjaS5jDQo+ID4gQEAg LTc1LDYgKzc1LDM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pdmVyKGR3X3BjaV9k cml2ZXIpOw0KPiA+IC0tIA0KPiA+IDEuNy40LjQNCj4gPiANCj4gDQoNCi0tIA0KQW5keSBTaGV2 Y2hlbmtvIDxhbmRyaXkuc2hldmNoZW5rb0BpbnRlbC5jb20+DQpJbnRlbCBGaW5sYW5kIE95DQot LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0KSW50ZWwgRmlubGFuZCBPeQpSZWdpc3RlcmVkIEFkZHJlc3M6IFBMIDI4MSwg MDAxODEgSGVsc2lua2kgCkJ1c2luZXNzIElkZW50aXR5IENvZGU6IDAzNTc2MDYgLSA0IApEb21p Y2lsZWQgaW4gSGVsc2lua2kgCgpUaGlzIGUtbWFpbCBhbmQgYW55IGF0dGFjaG1lbnRzIG1heSBj b250YWluIGNvbmZpZGVudGlhbCBtYXRlcmlhbCBmb3IKdGhlIHNvbGUgdXNlIG9mIHRoZSBpbnRl bmRlZCByZWNpcGllbnQocykuIEFueSByZXZpZXcgb3IgZGlzdHJpYnV0aW9uCmJ5IG90aGVycyBp cyBzdHJpY3RseSBwcm9oaWJpdGVkLiBJZiB5b3UgYXJlIG5vdCB0aGUgaW50ZW5kZWQKcmVjaXBp ZW50LCBwbGVhc2UgY29udGFjdCB0aGUgc2VuZGVyIGFuZCBkZWxldGUgYWxsIGNvcGllcy4K -- To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Vmlub2QsDQoNCkFzIG1lbnRpb25lZCBieSBBbmR5LCB3ZSBhcmUgdXNpbmcgKl9ub2lycSAgdmVy aW9uIG9mIHN1c3BlbmQvcmVzdW1lIFBNIGNhbGxiYWNrIHdoZXJlYnkgdGhlIGNhbGxiYWNrcyB3 b3VsZCBiZSBleGVjdXRlZCBhZnRlciBJUlEgaGFuZGxlcnMgaGF2ZSBi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25zdCBzdHJ1Y3QgZGV2X3BtX29wcyBkd19wY2lfZGV2X3BtX29wcyA9 IHsNCj4gPiArCS5zdXNwZW5kX25vaXJxID0gZHdfcGNpX3N1c3BlbmRfbm9pcnEsDQo+ID4gKwku cmVzdW1lX25vaXJxID0gZHdfcGNpX3Jlc3VtZV9ub2lycSwgfTsNCj4gPiArDQo+ID4gIHN0YXRp YyBERUZJTkVfUENJX0RFVklDRV9UQUJMRShkd19wY2lfaWRfdGFibGUpID0gew0KPiA+ICAJLyog TWVkZmllbGQgKi8NCj4gPiAgCXsgUENJX1ZERVZJQ0UoSU5URUwsIDB4MDgyNyksIChrZXJuZWxf dWxvbmdfdCkmZHdfcGNpX3BkYXRhIH0sIEBAIA0KPiA+IC05Miw2ICsxMjIsOSBAQCBzdGF0aWMg c3RydWN0IHBjaV9kcml2ZXIgZHdfcGNpX2RyaXZlciA9IHsNCj4gPiAgCS5pZF90YWJsZQk9IGR3 X3BjaV9pZF90YWJsZSwNCj4gPiAgCS5wcm9iZQkJPSBkd19wY2lfcHJvYmUsDQo+ID4gIAkucmVt b3ZlCQk9IGR3X3BjaV9yZW1vdmUsDQo+ID4gKwkuZHJpdmVyCT0gew0KPiA+ICsJCS5wbQk9ICZk d19wY2lfZGV2X3BtX29wcywNCj4gPiArCX0sDQo+ID4gIH07DQo+ID4gIA0KPiA+ICBtb2R1bGVf cGNpX2RyaXZlcihkd19wY2lfZHJpdmVyKTsNCj4gPiAtLQ0KPiA+IDEuNy40LjQNCj4gPiANCj4g DQoNCi0tDQpBbmR5IFNoZXZjaGVua28gPGFuZHJpeS5zaGV2Y2hlbmtvQGludGVsLmNvbT4gSW50 ZWwgRmlubGFuZCBPeQ0K -- To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Dec 16, 2013 at 01:51:47PM +0530, Chew, Chiau Ee wrote: > Vinod, Please do *NOT* top post Please fix your MUA to wrap lines with 80chars. I have fix below to make it readble... > As mentioned by Andy, we are using *_noirq verion of suspend/resume PM > callback whereby the callbacks would be executed after IRQ handlers have been > disabled. If using SET_SYSTEM_SLEEP_PM_OPS, it would be the normal > suspend/resume PM callback. Looking at the Desginware DMAC platform code > (drivers/dma/dw/platform.c), it is using the *_noirq suspend/resume PM > callback. Is it advisable to use the normal suspend/resume PM callback instead > of *_noirq suspend/PM callback? i dont see a reason why we need the noirq versions -- ~Vinod > > Thanks, > Chiau Ee > > -----Original Message----- > From: Shevchenko, Andriy > Sent: Tuesday, December 10, 2013 7:57 PM > To: Koul, Vinod > Cc: Chew, Chiau Ee; Viresh Kumar; Andy Shevchenko; Williams, Dan J; dmaengine@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH] dma: dw: Add suspend and resume handling for PCI mode DW_DMAC. > > On Tue, 2013-12-10 at 15:40 +0530, Vinod Koul wrote: > > On Tue, Dec 10, 2013 at 10:06:13PM +0800, Chew Chiau Ee wrote: > > > From: Chew, Chiau Ee <chiau.ee.chew@intel.com> > > > > > > This is to disable/enable DW_DMAC hw during suspend/resume. > > > > > > Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com> > > > Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > > --- > > > drivers/dma/dw/pci.c | 33 +++++++++++++++++++++++++++++++++ > > > 1 files changed, 33 insertions(+), 0 deletions(-) > > > > > > diff --git a/drivers/dma/dw/pci.c b/drivers/dma/dw/pci.c index > > > e89fc24..97bc3a2 100644 > > > --- a/drivers/dma/dw/pci.c > > > +++ b/drivers/dma/dw/pci.c > > > @@ -75,6 +75,36 @@ static void dw_pci_remove(struct pci_dev *pdev) > > > dev_warn(&pdev->dev, "can't remove device properly: %d\n", ret); > > > } > > > > > > +#ifdef CONFIG_PM_SLEEP > > > + > > > +static int dw_pci_suspend_noirq(struct device *dev) { > > > + struct pci_dev *pci = to_pci_dev(dev); > > > + struct dw_dma_chip *chip = pci_get_drvdata(pci); > > > + > > > + return dw_dma_suspend(chip); > > > +}; > > > + > > > +static int dw_pci_resume_noirq(struct device *dev) { > > > + struct pci_dev *pci = to_pci_dev(dev); > > > + struct dw_dma_chip *chip = pci_get_drvdata(pci); > > > + > > > + return dw_dma_resume(chip); > > > +}; > > > + > > > +#else /* !CONFIG_PM_SLEEP */ > > > + > > > +#define dw_pci_suspend_noirq NULL > > > +#define dw_pci_resume_noirq NULL > > > + > > > +#endif /* !CONFIG_PM_SLEEP */ > > How about SET_SYSTEM_SLEEP_PM_OPS instead? > > So, we are using *_noirq versions of the functions here. What happened when we switch to normal ones? Any side effects? > > > > > -- > > ~Vinod > > > + > > > +static const struct dev_pm_ops dw_pci_dev_pm_ops = { > > > + .suspend_noirq = dw_pci_suspend_noirq, > > > + .resume_noirq = dw_pci_resume_noirq, }; > > > + > > > static DEFINE_PCI_DEVICE_TABLE(dw_pci_id_table) = { > > > /* Medfield */ > > > { PCI_VDEVICE(INTEL, 0x0827), (kernel_ulong_t)&dw_pci_pdata }, @@ > > > -92,6 +122,9 @@ static struct pci_driver dw_pci_driver = { > > > .id_table = dw_pci_id_table, > > > .probe = dw_pci_probe, > > > .remove = dw_pci_remove, > > > + .driver = { > > > + .pm = &dw_pci_dev_pm_ops, > > > + }, > > > }; > > > > > > module_pci_driver(dw_pci_driver); > > > -- > > > 1.7.4.4 > > > > > > > -- > Andy Shevchenko <andriy.shevchenko@intel.com> Intel Finland Oy
On Wed, 2013-12-18 at 21:19 +0530, Vinod Koul wrote: > On Mon, Dec 16, 2013 at 01:51:47PM +0530, Chew, Chiau Ee wrote: > > As mentioned by Andy, we are using *_noirq verion of suspend/resume PM > > callback whereby the callbacks would be executed after IRQ handlers have been > > disabled. If using SET_SYSTEM_SLEEP_PM_OPS, it would be the normal > > suspend/resume PM callback. Looking at the Desginware DMAC platform code > > (drivers/dma/dw/platform.c), it is using the *_noirq suspend/resume PM > > callback. Is it advisable to use the normal suspend/resume PM callback instead > > of *_noirq suspend/PM callback? > > i dont see a reason why we need the noirq versions Okay. I imagine the following use case. For example we have compiled in DMA driver (dw_dmac) along with, for example, SPI driver. System was scheduled to go sleep. An order of calling IIUC might be DMA first, then SPI (since they are not in parent / child relations). What was happened when SPI would like to do a DMA transfer and DMA is going to sleep? I'm trying to understand if this is a case. > > > How about SET_SYSTEM_SLEEP_PM_OPS instead? > > > > So, we are using *_noirq versions of the functions here. What happened when we switch to normal ones? Any side effects?
On Thu, Dec 19, 2013 at 12:51:29PM +0200, Andy Shevchenko wrote: > On Wed, 2013-12-18 at 21:19 +0530, Vinod Koul wrote: > > On Mon, Dec 16, 2013 at 01:51:47PM +0530, Chew, Chiau Ee wrote: > > > > As mentioned by Andy, we are using *_noirq verion of suspend/resume PM > > > callback whereby the callbacks would be executed after IRQ handlers have been > > > disabled. If using SET_SYSTEM_SLEEP_PM_OPS, it would be the normal > > > suspend/resume PM callback. Looking at the Desginware DMAC platform code > > > (drivers/dma/dw/platform.c), it is using the *_noirq suspend/resume PM > > > callback. Is it advisable to use the normal suspend/resume PM callback instead > > > of *_noirq suspend/PM callback? > > > > i dont see a reason why we need the noirq versions > > Okay. I imagine the following use case. > > For example we have compiled in DMA driver (dw_dmac) along with, for > example, SPI driver. > > System was scheduled to go sleep. > > An order of calling IIUC might be DMA first, then SPI (since they are > not in parent / child relations). > > What was happened when SPI would like to do a DMA transfer and DMA is > going to sleep? I'm trying to understand if this is a case. In that case how does no irq version help us? For these cases, I have been using suspend_late. Since the dmaengine driver is providing service to other clients (SPI), it needs to esnure that it suspends after SPI using suspend_late and resume using resume_early. That way dma is availble whenever the client is active -- ~Vinod > > > > > How about SET_SYSTEM_SLEEP_PM_OPS instead? > > > > > > So, we are using *_noirq versions of the functions here. What happened when we switch to normal ones? Any side effects? > > > > -- > Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Intel Finland Oy >
On Mon, Jan 20, 2014 at 06:17:56PM +0530, Shevchenko, Andriy wrote: > On Mon, 2014-01-20 at 14:55 +0530, Vinod Koul wrote: > > On Thu, Dec 19, 2013 at 12:51:29PM +0200, Andy Shevchenko wrote: > > > On Wed, 2013-12-18 at 21:19 +0530, Vinod Koul wrote: > > > > On Mon, Dec 16, 2013 at 01:51:47PM +0530, Chew, Chiau Ee wrote: > > > > > > > > As mentioned by Andy, we are using *_noirq verion of suspend/resume PM > > > > > callback whereby the callbacks would be executed after IRQ handlers have been > > > > > disabled. If using SET_SYSTEM_SLEEP_PM_OPS, it would be the normal > > > > > suspend/resume PM callback. Looking at the Desginware DMAC platform code > > > > > (drivers/dma/dw/platform.c), it is using the *_noirq suspend/resume PM > > > > > callback. Is it advisable to use the normal suspend/resume PM callback instead > > > > > of *_noirq suspend/PM callback? > > > > > > > > i dont see a reason why we need the noirq versions > > > > > > Okay. I imagine the following use case. > > > > > > For example we have compiled in DMA driver (dw_dmac) along with, for > > > example, SPI driver. > > > > > > System was scheduled to go sleep. > > > > > > An order of calling IIUC might be DMA first, then SPI (since they are > > > not in parent / child relations). > > > > > > What was happened when SPI would like to do a DMA transfer and DMA is > > > going to sleep? I'm trying to understand if this is a case. > > In that case how does no irq version help us? > > It guarantees that we have no user of DMA anymore, since there is no > interrupt going on. well how is that. It will gaurantee that there wont be interrupt. User can still submit a transaction or another transaction will be in progress... > > For these cases, I have been using suspend_late. Since the dmaengine driver is > > providing service to other clients (SPI), it needs to esnure that it suspends > > after SPI using suspend_late and resume using resume_early. That way dma is > > availble whenever the client is active > > suspend_late is working in context that interrupt handler may be > invoked. Thus, to have DMA driver be properly shut down we have to > wait / terminate possible ongoing transfer. Well client is already suspended via .suspend. So where is the transaction :) > > It seems for me all DMA drivers that are using > system .suspend()/.resume() are potentially buggy. Yup!
On Mon, 2014-01-20 at 14:55 +0530, Vinod Koul wrote: > On Thu, Dec 19, 2013 at 12:51:29PM +0200, Andy Shevchenko wrote: > > On Wed, 2013-12-18 at 21:19 +0530, Vinod Koul wrote: > > > On Mon, Dec 16, 2013 at 01:51:47PM +0530, Chew, Chiau Ee wrote: > > > > > > As mentioned by Andy, we are using *_noirq verion of suspend/resume PM > > > > callback whereby the callbacks would be executed after IRQ handlers have been > > > > disabled. If using SET_SYSTEM_SLEEP_PM_OPS, it would be the normal > > > > suspend/resume PM callback. Looking at the Desginware DMAC platform code > > > > (drivers/dma/dw/platform.c), it is using the *_noirq suspend/resume PM > > > > callback. Is it advisable to use the normal suspend/resume PM callback instead > > > > of *_noirq suspend/PM callback? > > > > > > i dont see a reason why we need the noirq versions > > > > Okay. I imagine the following use case. > > > > For example we have compiled in DMA driver (dw_dmac) along with, for > > example, SPI driver. > > > > System was scheduled to go sleep. > > > > An order of calling IIUC might be DMA first, then SPI (since they are > > not in parent / child relations). > > > > What was happened when SPI would like to do a DMA transfer and DMA is > > going to sleep? I'm trying to understand if this is a case. > In that case how does no irq version help us? It guarantees that we have no user of DMA anymore, since there is no interrupt going on. > For these cases, I have been using suspend_late. Since the dmaengine driver is > providing service to other clients (SPI), it needs to esnure that it suspends > after SPI using suspend_late and resume using resume_early. That way dma is > availble whenever the client is active suspend_late is working in context that interrupt handler may be invoked. Thus, to have DMA driver be properly shut down we have to wait / terminate possible ongoing transfer. It seems for me all DMA drivers that are using system .suspend()/.resume() are potentially buggy. > > -- > ~Vinod > > > > > > > > How about SET_SYSTEM_SLEEP_PM_OPS instead? > > > > > > > > So, we are using *_noirq versions of the functions here. What happened when we switch to normal ones? Any side effects? > > > > > > > > -- > > Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > Intel Finland Oy > > > -- Andy Shevchenko <andriy.shevchenko@intel.com> Intel Finland Oy --------------------------------------------------------------------- Intel Finland Oy Registered Address: PL 281, 00181 Helsinki Business Identity Code: 0357606 - 4 Domiciled in Helsinki This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
On Mon, 2014-01-20 at 17:37 +0530, Vinod Koul wrote: > On Mon, Jan 20, 2014 at 06:17:56PM +0530, Shevchenko, Andriy wrote: > > On Mon, 2014-01-20 at 14:55 +0530, Vinod Koul wrote: > > > On Thu, Dec 19, 2013 at 12:51:29PM +0200, Andy Shevchenko wrote: > > > > On Wed, 2013-12-18 at 21:19 +0530, Vinod Koul wrote: > > > > > On Mon, Dec 16, 2013 at 01:51:47PM +0530, Chew, Chiau Ee wrote: > > > > > > > > > > As mentioned by Andy, we are using *_noirq verion of suspend/resume PM > > > > > > callback whereby the callbacks would be executed after IRQ handlers have been > > > > > > disabled. If using SET_SYSTEM_SLEEP_PM_OPS, it would be the normal > > > > > > suspend/resume PM callback. Looking at the Desginware DMAC platform code > > > > > > (drivers/dma/dw/platform.c), it is using the *_noirq suspend/resume PM > > > > > > callback. Is it advisable to use the normal suspend/resume PM callback instead > > > > > > of *_noirq suspend/PM callback? > > > > > > > > > > i dont see a reason why we need the noirq versions > > > > > > > > Okay. I imagine the following use case. > > > > > > > > For example we have compiled in DMA driver (dw_dmac) along with, for > > > > example, SPI driver. > > > > > > > > System was scheduled to go sleep. > > > > > > > > An order of calling IIUC might be DMA first, then SPI (since they are > > > > not in parent / child relations). > > > > > > > > What was happened when SPI would like to do a DMA transfer and DMA is > > > > going to sleep? I'm trying to understand if this is a case. > > > In that case how does no irq version help us? > > > > It guarantees that we have no user of DMA anymore, since there is no > > interrupt going on. > well how is that. It will gaurantee that there wont be interrupt. User can still > submit a transaction or another transaction will be in progress... This is how system suspend callback tree is called. First it calls .suspend() for all devices, then .suspend_late(), then .suspend_noirq(). There is set of assumptions per each callback round. After .suspend() the device must be quiescent. But... > > > For these cases, I have been using suspend_late. Since the dmaengine driver is > > > providing service to other clients (SPI), it needs to esnure that it suspends > > > after SPI using suspend_late and resume using resume_early. That way dma is > > > availble whenever the client is active > > > > suspend_late is working in context that interrupt handler may be > > invoked. Thus, to have DMA driver be properly shut down we have to > > wait / terminate possible ongoing transfer. > Well client is already suspended via .suspend. So where is the transaction :) ...as I already wrote before we have no parent-child relationship between DMA and, for example, SPI. That means we may possible have the case when SPI's .suspend() will be called later than DMA's one. > > It seems for me all DMA drivers that are using > > system .suspend()/.resume() are potentially buggy. > Yup! So, we have to decide what to do with them. .suspend_late() still seems for me not the best approach. *Or* we have to check for ongoing transaction and do something with it. *Or* just shut down the device and rely on DMA transaction initiator that it handles the terminated transaction properly. What is you opinion? -- Andy Shevchenko <andriy.shevchenko@intel.com> Intel Finland Oy --------------------------------------------------------------------- Intel Finland Oy Registered Address: PL 281, 00181 Helsinki Business Identity Code: 0357606 - 4 Domiciled in Helsinki This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
On Mon, Jan 20, 2014 at 07:38:32PM +0530, Shevchenko, Andriy wrote: > > > > > > > As mentioned by Andy, we are using *_noirq verion of suspend/resume PM > > > > > > > callback whereby the callbacks would be executed after IRQ handlers have been > > > > > > > disabled. If using SET_SYSTEM_SLEEP_PM_OPS, it would be the normal > > > > > > > suspend/resume PM callback. Looking at the Desginware DMAC platform code > > > > > > > (drivers/dma/dw/platform.c), it is using the *_noirq suspend/resume PM > > > > > > > callback. Is it advisable to use the normal suspend/resume PM callback instead > > > > > > > of *_noirq suspend/PM callback? > > > > > > > > > > > > i dont see a reason why we need the noirq versions > > > > > > > > > > Okay. I imagine the following use case. > > > > > > > > > > For example we have compiled in DMA driver (dw_dmac) along with, for > > > > > example, SPI driver. > > > > > > > > > > System was scheduled to go sleep. > > > > > > > > > > An order of calling IIUC might be DMA first, then SPI (since they are > > > > > not in parent / child relations). > > > > > > > > > > What was happened when SPI would like to do a DMA transfer and DMA is > > > > > going to sleep? I'm trying to understand if this is a case. > > > > In that case how does no irq version help us? > > > > > > It guarantees that we have no user of DMA anymore, since there is no > > > interrupt going on. > > well how is that. It will gaurantee that there wont be interrupt. User can still > > submit a transaction or another transaction will be in progress... > > This is how system suspend callback tree is called. > > First it calls .suspend() for all devices, then .suspend_late(), > then .suspend_noirq(). > > There is set of assumptions per each callback round. After .suspend() > the device must be quiescent. > > But... > > > > > For these cases, I have been using suspend_late. Since the dmaengine driver is > > > > providing service to other clients (SPI), it needs to esnure that it suspends > > > > after SPI using suspend_late and resume using resume_early. That way dma is > > > > availble whenever the client is active > > > > > > suspend_late is working in context that interrupt handler may be > > > invoked. Thus, to have DMA driver be properly shut down we have to > > > wait / terminate possible ongoing transfer. > > Well client is already suspended via .suspend. So where is the transaction :) > > ...as I already wrote before we have no parent-child relationship > between DMA and, for example, SPI. That means we may possible have the > case when SPI's .suspend() will be called later than DMA's one. > > > > It seems for me all DMA drivers that are using > > > system .suspend()/.resume() are potentially buggy. > > Yup! > > So, we have to decide what to do with them. .suspend_late() still seems > for me not the best approach. *Or* we have to check for ongoing > transaction and do something with it. *Or* just shut down the device and > rely on DMA transaction initiator that it handles the terminated > transaction properly. As you clearly said, we dont have a parent-child relatation though we have big dependency. I think this is true for DMA clients, i ran into similar situation with i2c few days back! So only think which can give us a good system behaviour would be clients getting suspended first and then then service providing subsystems. (same reason why we do dma driver loading and init much before others drivers) So yes in the .suspend callback of the client, it needs to 1) abort any transactions it has 2) make the client quiscent then the .late_suspend kicks in and suspend the core drivers like dma. This is how it has worked reliably for me in production systems. I am all ears if we have a better and cleaner apprach to this problem :)
On Sun, 2014-01-26 at 16:47 +0530, Vinod Koul wrote: > > > > > For these cases, I have been using suspend_late. Since the dmaengine driver is > > > > > providing service to other clients (SPI), it needs to esnure that it suspends > > > > > after SPI using suspend_late and resume using resume_early. That way dma is > > > > > availble whenever the client is active > > > > > > > > suspend_late is working in context that interrupt handler may be > > > > invoked. Thus, to have DMA driver be properly shut down we have to > > > > wait / terminate possible ongoing transfer. > > > Well client is already suspended via .suspend. So where is the transaction :) > > > > ...as I already wrote before we have no parent-child relationship > > between DMA and, for example, SPI. That means we may possible have the > > case when SPI's .suspend() will be called later than DMA's one. > > > > > > It seems for me all DMA drivers that are using > > > > system .suspend()/.resume() are potentially buggy. > > > Yup! > > > > So, we have to decide what to do with them. .suspend_late() still seems > > for me not the best approach. *Or* we have to check for ongoing > > transaction and do something with it. *Or* just shut down the device and > > rely on DMA transaction initiator that it handles the terminated > > transaction properly. > > As you clearly said, we dont have a parent-child relatation though we have big > dependency. I think this is true for DMA clients, i ran into similar situation > with i2c few days back! > > So only think which can give us a good system behaviour would be clients getting > suspended first and then then service providing subsystems. Agree. > (same reason why we > do dma driver loading and init much before others drivers) Yes, it would be done via deferred probe. > So yes in the .suspend callback of the client, it needs to > 1) abort any transactions it has > 2) make the client quiscent > > then the .late_suspend kicks in and suspend the core drivers like dma. > > This is how it has worked reliably for me in production systems. I am all ears > if we have a better and cleaner apprach to this problem :) Yes, summarize everything we discussed we have to: - provide suspend_late, resume_early callbacks in the DMA driver instead of *_noirq versions - ensure that all clients on our platforms follow the described scenario Chiau Ee, I think you may to change your patch accordingly.
> -----Original Message----- > From: Andy Shevchenko [mailto:andriy.shevchenko@linux.intel.com] > Sent: Monday, January 27, 2014 6:17 PM > To: Koul, Vinod > Cc: Andy Shevchenko; Chew, Chiau Ee; Viresh Kumar; Williams, Dan J; > dmaengine@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH] dma: dw: Add suspend and resume handling for PCI mode > DW_DMAC. > > On Sun, 2014-01-26 at 16:47 +0530, Vinod Koul wrote: > > > > > > > For these cases, I have been using suspend_late. Since the > > > > > > dmaengine driver is providing service to other clients (SPI), > > > > > > it needs to esnure that it suspends after SPI using > > > > > > suspend_late and resume using resume_early. That way dma is > > > > > > availble whenever the client is active > > > > > > > > > > suspend_late is working in context that interrupt handler may be > > > > > invoked. Thus, to have DMA driver be properly shut down we have > > > > > to wait / terminate possible ongoing transfer. > > > > Well client is already suspended via .suspend. So where is the > > > > transaction :) > > > > > > ...as I already wrote before we have no parent-child relationship > > > between DMA and, for example, SPI. That means we may possible have > > > the case when SPI's .suspend() will be called later than DMA's one. > > > > > > > > It seems for me all DMA drivers that are using system > > > > > .suspend()/.resume() are potentially buggy. > > > > Yup! > > > > > > So, we have to decide what to do with them. .suspend_late() still > > > seems for me not the best approach. *Or* we have to check for > > > ongoing transaction and do something with it. *Or* just shut down > > > the device and rely on DMA transaction initiator that it handles the > > > terminated transaction properly. > > > > As you clearly said, we dont have a parent-child relatation though we > > have big dependency. I think this is true for DMA clients, i ran into > > similar situation with i2c few days back! > > > > So only think which can give us a good system behaviour would be > > clients getting suspended first and then then service providing subsystems. > > Agree. > > > (same reason why we > > do dma driver loading and init much before others drivers) > > Yes, it would be done via deferred probe. > > > So yes in the .suspend callback of the client, it needs to > > 1) abort any transactions it has > > 2) make the client quiscent > > > > then the .late_suspend kicks in and suspend the core drivers like dma. > > > > This is how it has worked reliably for me in production systems. I am > > all ears if we have a better and cleaner apprach to this problem :) > > Yes, summarize everything we discussed we have to: > - provide suspend_late, resume_early callbacks in the DMA driver instead of > *_noirq versions > - ensure that all clients on our platforms follow the described scenario > > Chiau Ee, I think you may to change your patch accordingly. Ok. Noted > > > -- > Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Intel Finland Oy
diff --git a/drivers/dma/dw/pci.c b/drivers/dma/dw/pci.c index e89fc24..97bc3a2 100644 --- a/drivers/dma/dw/pci.c +++ b/drivers/dma/dw/pci.c @@ -75,6 +75,36 @@ static void dw_pci_remove(struct pci_dev *pdev) dev_warn(&pdev->dev, "can't remove device properly: %d\n", ret); } +#ifdef CONFIG_PM_SLEEP + +static int dw_pci_suspend_noirq(struct device *dev) +{ + struct pci_dev *pci = to_pci_dev(dev); + struct dw_dma_chip *chip = pci_get_drvdata(pci); + + return dw_dma_suspend(chip); +}; + +static int dw_pci_resume_noirq(struct device *dev) +{ + struct pci_dev *pci = to_pci_dev(dev); + struct dw_dma_chip *chip = pci_get_drvdata(pci); + + return dw_dma_resume(chip); +}; + +#else /* !CONFIG_PM_SLEEP */ + +#define dw_pci_suspend_noirq NULL +#define dw_pci_resume_noirq NULL + +#endif /* !CONFIG_PM_SLEEP */ + +static const struct dev_pm_ops dw_pci_dev_pm_ops = { + .suspend_noirq = dw_pci_suspend_noirq, + .resume_noirq = dw_pci_resume_noirq, +}; + static DEFINE_PCI_DEVICE_TABLE(dw_pci_id_table) = { /* Medfield */ { PCI_VDEVICE(INTEL, 0x0827), (kernel_ulong_t)&dw_pci_pdata }, @@ -92,6 +122,9 @@ static struct pci_driver dw_pci_driver = { .id_table = dw_pci_id_table, .probe = dw_pci_probe, .remove = dw_pci_remove, + .driver = { + .pm = &dw_pci_dev_pm_ops, + }, }; module_pci_driver(dw_pci_driver);