Re: [PATCH v2] ata: use generic power management
On 7/27/20 11:17 PM, Vaibhav Gupta wrote: > On Mon, Jul 27, 2020 at 02:30:03PM -0600, Jens Axboe wrote: >> On 7/27/20 12:11 PM, Vaibhav Gupta wrote: >>> On Mon, Jul 27, 2020 at 11:59:05AM -0600, Jens Axboe wrote: On 7/27/20 11:51 AM, Vaibhav Gupta wrote: > On Mon, Jul 27, 2020 at 11:42:51AM -0600, Jens Axboe wrote: >> On 7/27/20 11:40 AM, Vaibhav Gupta wrote: >>> Yes, I agree. Actually with previous drivers, I was able to get help >>> from maintainers and/or supporters for the hardware testing. Is that >>> possible for this patch? >> >> It might be, you'll have to ask people to help you, very rarely do people >> just test patches unsolicited unless they have some sort of interest in the >> feature. >> >> This is all part of what it takes to get code upstream. Writing the code >> is just a small part of it, the bigger part is usually getting it tested >> and providing some assurance that you are willing to fix issues when/if >> they come up. >> >> You might want to consider splitting up the patchset a bit - you could >> have one patch for the generic bits, then one for each chipset. That >> would allow you to at least get some of the work upstream, once tested. >> > I think I can break this patch into one commit per driver. The reason that > all updates got into one single patch is that I made > ata_pci_device_suspend/resume() static and exported just the > ata_pci_device_pm_ops variable. Thus, all the driver using .suspend/.resume() > had to be updated in a single patch. > > First I will make changes in drivers/ata/libata-core.c, but won't make any > function static. Thus, each driver can be updated in independent commits > without breaking anything. And then in the last commit, I can hide the > unnecessary .suspend()/.resume() callbacks. This will create patch-series of > 55 > or 56 patches. > > Will this approach work? That should work, but more importantly, ensure you get some folks signed up for testing this functionality. -- Jens Axboe
Re: [PATCH v2] ata: use generic power management
On Mon, Jul 27, 2020 at 02:30:03PM -0600, Jens Axboe wrote: > On 7/27/20 12:11 PM, Vaibhav Gupta wrote: > > On Mon, Jul 27, 2020 at 11:59:05AM -0600, Jens Axboe wrote: > >> On 7/27/20 11:51 AM, Vaibhav Gupta wrote: > >>> On Mon, Jul 27, 2020 at 11:42:51AM -0600, Jens Axboe wrote: > On 7/27/20 11:40 AM, Vaibhav Gupta wrote: > > Yes, I agree. Actually with previous drivers, I was able to get help > > from maintainers and/or supporters for the hardware testing. Is that > > possible for this patch? > > It might be, you'll have to ask people to help you, very rarely do people > just test patches unsolicited unless they have some sort of interest in the > feature. > > This is all part of what it takes to get code upstream. Writing the code > is just a small part of it, the bigger part is usually getting it tested > and providing some assurance that you are willing to fix issues when/if > they come up. > > You might want to consider splitting up the patchset a bit - you could > have one patch for the generic bits, then one for each chipset. That > would allow you to at least get some of the work upstream, once tested. > I think I can break this patch into one commit per driver. The reason that all updates got into one single patch is that I made ata_pci_device_suspend/resume() static and exported just the ata_pci_device_pm_ops variable. Thus, all the driver using .suspend/.resume() had to be updated in a single patch. First I will make changes in drivers/ata/libata-core.c, but won't make any function static. Thus, each driver can be updated in independent commits without breaking anything. And then in the last commit, I can hide the unnecessary .suspend()/.resume() callbacks. This will create patch-series of 55 or 56 patches. Will this approach work? Thanks Vaibhav Gupta > -- > Jens Axboe >
Re: [PATCH v2] ata: use generic power management
On 7/27/20 12:11 PM, Vaibhav Gupta wrote: > On Mon, Jul 27, 2020 at 11:59:05AM -0600, Jens Axboe wrote: >> On 7/27/20 11:51 AM, Vaibhav Gupta wrote: >>> On Mon, Jul 27, 2020 at 11:42:51AM -0600, Jens Axboe wrote: On 7/27/20 11:40 AM, Vaibhav Gupta wrote: > The patch is compile-tested only. Please test and verify actual functionality, if you're serious about potentially getting this into the kernel. >>> Hello Jens, >>> >>> Sadly I don't have the hardware. This upgrade is part of my Linux >>> Kernel Mentorship Program project. Like other PCI drivers which I >>> have updated, I could do compile-testing only. Though this patch >>> covers 54 drivers but the actual change is done only in >>> drivers/ata/libata-core. Since rest of the drivers make use of the >>> same ata_pci_device_suspend/resume(), it was a chain reaction. I >>> only had to change variable binding in "struct pci_driver" variable >>> of dependent drivers. >> >> That's understandable, but you should find at least some hardware >> (maybe remotely accessible) to test this on. I'm not going to apply >> this without some confidence that it actually works, and compile only >> testing is a far cry from that. Lots of code compiles, but fails >> miserably at runtime. >> >> While it's touching 54 drivers, at least basic coverage of the most >> popular choices will give everybody some confidence that it works in >> general. >> > Yes, I agree. Actually with previous drivers, I was able to get help > from maintainers and/or supporters for the hardware testing. Is that > possible for this patch? It might be, you'll have to ask people to help you, very rarely do people just test patches unsolicited unless they have some sort of interest in the feature. This is all part of what it takes to get code upstream. Writing the code is just a small part of it, the bigger part is usually getting it tested and providing some assurance that you are willing to fix issues when/if they come up. You might want to consider splitting up the patchset a bit - you could have one patch for the generic bits, then one for each chipset. That would allow you to at least get some of the work upstream, once tested. -- Jens Axboe
Re: [PATCH v2] ata: use generic power management
On Mon, Jul 27, 2020 at 11:59:05AM -0600, Jens Axboe wrote: > On 7/27/20 11:51 AM, Vaibhav Gupta wrote: > > On Mon, Jul 27, 2020 at 11:42:51AM -0600, Jens Axboe wrote: > >> On 7/27/20 11:40 AM, Vaibhav Gupta wrote: > >>> The patch is compile-tested only. > >> > >> Please test and verify actual functionality, if you're serious about > >> potentially getting this into the kernel. > >> > > Hello Jens, > > > > Sadly I don't have the hardware. This upgrade is part of my Linux Kernel > > Mentorship Program project. Like other PCI drivers which I have updated, I > > could > > do compile-testing only. Though this patch covers 54 drivers but the actual > > change is done only in drivers/ata/libata-core. Since rest of the drivers > > make use of the same ata_pci_device_suspend/resume(), it was a chain > > reaction. I > > only had to change variable binding in "struct pci_driver" variable of > > dependent > > drivers. > > That's understandable, but you should find at least some hardware (maybe > remotely > accessible) to test this on. I'm not going to apply this without some > confidence > that it actually works, and compile only testing is a far cry from that. Lots > of > code compiles, but fails miserably at runtime. > > While it's touching 54 drivers, at least basic coverage of the most popular > choices will give everybody some confidence that it works in general. > Yes, I agree. Actually with previous drivers, I was able to get help from maintainers and/or supporters for the hardware testing. Is that possible for this patch? Thanks Vaibhav Gupta > -- > Jens Axboe >
Re: [PATCH v2] ata: use generic power management
On 7/27/20 11:51 AM, Vaibhav Gupta wrote: > On Mon, Jul 27, 2020 at 11:42:51AM -0600, Jens Axboe wrote: >> On 7/27/20 11:40 AM, Vaibhav Gupta wrote: >>> The patch is compile-tested only. >> >> Please test and verify actual functionality, if you're serious about >> potentially getting this into the kernel. >> > Hello Jens, > > Sadly I don't have the hardware. This upgrade is part of my Linux Kernel > Mentorship Program project. Like other PCI drivers which I have updated, I > could > do compile-testing only. Though this patch covers 54 drivers but the actual > change is done only in drivers/ata/libata-core. Since rest of the drivers > make use of the same ata_pci_device_suspend/resume(), it was a chain > reaction. I > only had to change variable binding in "struct pci_driver" variable of > dependent > drivers. That's understandable, but you should find at least some hardware (maybe remotely accessible) to test this on. I'm not going to apply this without some confidence that it actually works, and compile only testing is a far cry from that. Lots of code compiles, but fails miserably at runtime. While it's touching 54 drivers, at least basic coverage of the most popular choices will give everybody some confidence that it works in general. -- Jens Axboe
Re: [PATCH v2] ata: use generic power management
On Mon, Jul 27, 2020 at 11:42:51AM -0600, Jens Axboe wrote: > On 7/27/20 11:40 AM, Vaibhav Gupta wrote: > > The patch is compile-tested only. > > Please test and verify actual functionality, if you're serious about > potentially getting this into the kernel. > Hello Jens, Sadly I don't have the hardware. This upgrade is part of my Linux Kernel Mentorship Program project. Like other PCI drivers which I have updated, I could do compile-testing only. Though this patch covers 54 drivers but the actual change is done only in drivers/ata/libata-core. Since rest of the drivers make use of the same ata_pci_device_suspend/resume(), it was a chain reaction. I only had to change variable binding in "struct pci_driver" variable of dependent drivers. Thanks Vaibhav Gupta > -- > Jens Axboe >
Re: [PATCH v2] ata: use generic power management
On 7/27/20 11:40 AM, Vaibhav Gupta wrote: > The patch is compile-tested only. Please test and verify actual functionality, if you're serious about potentially getting this into the kernel. -- Jens Axboe
Re: [PATCH v2] ata: use generic power management
The patch is compile-tested only. Thanks Vaibhav Gupta
[PATCH v2] ata: use generic power management
use generic power management Drivers using legacy power management .suspen()/.resume() callbacks have to manage PCI states and device's PM states themselves. They also need to take care of standard configuration registers. Switch to generic power management framework using a single "struct dev_pm_ops" variable to take the unnecessary load from the driver. This also avoids the need for the driver to directly call most of the PCI helper functions and device power state control functions, as through the generic framework PCI Core takes care of the necessary operations, and drivers are required to do only device-specific jobs. The ata_pci_device_suspend() and ata_pci_device_resume(), declared in include/linux/libata.h and defined in drivers/ata/libata-core.c, were external and were exported. Those were then used by other source files. Now, as they have to bind with dev_pm_ops object, there is no need to export them and they can be made static. Declare an extern const dev_pm_ops object in include/linux/ata.h and define it in drivers/ata/libata-core.c with SIMPLE_DEV_PM_OPS macro, binding suspend, and resume callbacks with it. This object can now be used by other source files. Now ata_pci_device_suspend() invokes ata_host_suspend(...,pm_message_t). Earlier, PCI core used to send "PMSG_SUSPEND" argument to pm_message_t variable of .suspend() which was then passed to .host_suspend(). Since, the structure of .suspend() has changed, PCI core no more, pass this argument. Hence, modfy each instance of call to .host_susped(), in respective PCI drivers, and pass the value "PMSG_SUSPEND" to it. Signed-off-by: Vaibhav Gupta --- drivers/ata/acard-ahci.c| 36 +--- drivers/ata/ata_generic.c | 5 +-- drivers/ata/ata_piix.c | 48 +-- drivers/ata/libata-core.c | 59 ++--- drivers/ata/pata_acpi.c | 5 +-- drivers/ata/pata_ali.c | 26 +++ drivers/ata/pata_amd.c | 24 +++--- drivers/ata/pata_artop.c| 25 +++--- drivers/ata/pata_atiixp.c | 5 +-- drivers/ata/pata_atp867x.c | 23 ++--- drivers/ata/pata_cmd640.c | 26 +++ drivers/ata/pata_cmd64x.c | 25 +++--- drivers/ata/pata_cs5520.c | 35 +++ drivers/ata/pata_cs5530.c | 23 ++--- drivers/ata/pata_cs5535.c | 5 +-- drivers/ata/pata_cs5536.c | 5 +-- drivers/ata/pata_cypress.c | 5 +-- drivers/ata/pata_efar.c | 5 +-- drivers/ata/pata_hpt366.c | 26 +++ drivers/ata/pata_hpt3x3.c | 25 +++--- drivers/ata/pata_it8213.c | 5 +-- drivers/ata/pata_it821x.c | 27 --- drivers/ata/pata_jmicron.c | 5 +-- drivers/ata/pata_marvell.c | 5 +-- drivers/ata/pata_mpiix.c| 5 +-- drivers/ata/pata_netcell.c | 5 +-- drivers/ata/pata_ninja32.c | 24 +++--- drivers/ata/pata_ns87410.c | 5 +-- drivers/ata/pata_ns87415.c | 25 +++--- drivers/ata/pata_oldpiix.c | 5 +-- drivers/ata/pata_opti.c | 5 +-- drivers/ata/pata_optidma.c | 5 +-- drivers/ata/pata_pdc2027x.c | 29 drivers/ata/pata_pdc202xx_old.c | 5 +-- drivers/ata/pata_piccolo.c | 5 +-- drivers/ata/pata_radisys.c | 5 +-- drivers/ata/pata_rdc.c | 5 +-- drivers/ata/pata_rz1000.c | 25 +++--- drivers/ata/pata_sc1200.c | 5 +-- drivers/ata/pata_sch.c | 5 +-- drivers/ata/pata_serverworks.c | 25 +++--- drivers/ata/pata_sil680.c | 27 +++ drivers/ata/pata_sis.c | 25 +++--- drivers/ata/pata_sl82c105.c | 25 +++--- drivers/ata/pata_triflex.c | 33 +- drivers/ata/pata_via.c | 33 +- drivers/ata/sata_inic162x.c | 23 +++-- drivers/ata/sata_mv.c | 29 drivers/ata/sata_nv.c | 29 drivers/ata/sata_sil.c | 28 drivers/ata/sata_sil24.c| 29 drivers/ata/sata_sis.c | 5 +-- drivers/ata/sata_via.c | 32 +- include/linux/libata.h | 9 ++--- 54 files changed, 407 insertions(+), 586 deletions(-) diff --git a/drivers/ata/acard-ahci.c b/drivers/ata/acard-ahci.c index 2a04e8abd397..4883ab38c076 100644 --- a/drivers/ata/acard-ahci.c +++ b/drivers/ata/acard-ahci.c @@ -61,10 +61,8 @@ static bool acard_ahci_qc_fill_rtf(struct ata_queued_cmd *qc); static int acard_ahci_port_start(struct ata_port *ap); static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); -#ifdef CONFIG_PM_SLEEP -static int acard_ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); -static int acard_ahci_pci_device_resume(struct pci_dev *pdev); -#endif +static int __maybe_unused