Re: [PATCH 01/12] PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags
On Tue, Oct 17, 2017 at 05:26:20PM +0200, Rafael J. Wysocki wrote: > On Tuesday, October 17, 2017 9:15:43 AM CEST Greg Kroah-Hartman wrote: > > On Tue, Oct 17, 2017 at 12:05:11AM +0200, Rafael J. Wysocki wrote: > > > On Monday, October 16, 2017 8:28:52 AM CEST Greg Kroah-Hartman wrote: > > > > On Mon, Oct 16, 2017 at 03:29:02AM +0200, Rafael J. Wysocki wrote: > > > > > struct dev_pm_info { > > > > > pm_message_tpower_state; > > > > > unsigned intcan_wakeup:1; > > > > > @@ -561,6 +580,7 @@ struct dev_pm_info { > > > > > boolis_late_suspended:1; > > > > > boolearly_init:1; /* Owned by the PM core > > > > > */ > > > > > booldirect_complete:1; /* Owned by the > > > > > PM core */ > > > > > + unsigned intdriver_flags; > > > > > > > > Minor nit, u32 or u64? > > > > > > u32 I think, will update. > > > > > > BTW, there's a mess in this struct overall and I'd like all of the bit > > > fileds > > > to be the same type (and that shouldn't be bool IMO :-)). > > > > > > Do you prefer u32 or unsinged int? > > > > I always prefer an explicit size for variables, unless it's a "generic > > loop" type thing. So I'll always say "u32" for this. > > > > And cleaning up the structure would be great, it's grown over time in > > odd ways as you point out. > > OK, but that will be separate from this work. Of course :) -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/12] PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags
On Tuesday, October 17, 2017 9:15:43 AM CEST Greg Kroah-Hartman wrote: > On Tue, Oct 17, 2017 at 12:05:11AM +0200, Rafael J. Wysocki wrote: > > On Monday, October 16, 2017 8:28:52 AM CEST Greg Kroah-Hartman wrote: > > > On Mon, Oct 16, 2017 at 03:29:02AM +0200, Rafael J. Wysocki wrote: > > > > struct dev_pm_info { > > > > pm_message_tpower_state; > > > > unsigned intcan_wakeup:1; > > > > @@ -561,6 +580,7 @@ struct dev_pm_info { > > > > boolis_late_suspended:1; > > > > boolearly_init:1; /* Owned by the PM core > > > > */ > > > > booldirect_complete:1; /* Owned by the > > > > PM core */ > > > > + unsigned intdriver_flags; > > > > > > Minor nit, u32 or u64? > > > > u32 I think, will update. > > > > BTW, there's a mess in this struct overall and I'd like all of the bit > > fileds > > to be the same type (and that shouldn't be bool IMO :-)). > > > > Do you prefer u32 or unsinged int? > > I always prefer an explicit size for variables, unless it's a "generic > loop" type thing. So I'll always say "u32" for this. > > And cleaning up the structure would be great, it's grown over time in > odd ways as you point out. OK, but that will be separate from this work. Thanks, Rafael -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/12] PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags
On Tue, Oct 17, 2017 at 12:07:37AM +0200, Rafael J. Wysocki wrote: > On Monday, October 16, 2017 8:31:22 AM CEST Greg Kroah-Hartman wrote: > > On Mon, Oct 16, 2017 at 03:29:02AM +0200, Rafael J. Wysocki wrote: > > > +static inline void dev_pm_set_driver_flags(struct device *dev, unsigned > > > int flags) > > > +{ > > > + dev->power.driver_flags = flags; > > > +} > > > > Should this function just set the specific bit? Or is it going to be ok > > to set the whole value, meaning you aren't going to care about turning > > on and off specific flags over the lifetime of the driver/device, you > > are just going to set them once and then just test them as needed? > > The idea is to set them once and they should not be touched again until > the driver (or device) goes away, so that would be the whole value at once > (and one of the i2c-designware-platdrv patches actually sets multiple flags > in one go). Ok, thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/12] PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags
On Tue, Oct 17, 2017 at 12:05:11AM +0200, Rafael J. Wysocki wrote: > On Monday, October 16, 2017 8:28:52 AM CEST Greg Kroah-Hartman wrote: > > On Mon, Oct 16, 2017 at 03:29:02AM +0200, Rafael J. Wysocki wrote: > > > struct dev_pm_info { > > > pm_message_tpower_state; > > > unsigned intcan_wakeup:1; > > > @@ -561,6 +580,7 @@ struct dev_pm_info { > > > boolis_late_suspended:1; > > > boolearly_init:1; /* Owned by the PM core */ > > > booldirect_complete:1; /* Owned by the PM core > > > */ > > > + unsigned intdriver_flags; > > > > Minor nit, u32 or u64? > > u32 I think, will update. > > BTW, there's a mess in this struct overall and I'd like all of the bit fileds > to be the same type (and that shouldn't be bool IMO :-)). > > Do you prefer u32 or unsinged int? I always prefer an explicit size for variables, unless it's a "generic loop" type thing. So I'll always say "u32" for this. And cleaning up the structure would be great, it's grown over time in odd ways as you point out. thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/12] PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags
On Monday, October 16, 2017 10:16:15 PM CEST Alan Stern wrote: > On Mon, 16 Oct 2017, Rafael J. Wysocki wrote: > > > From: Rafael J. Wysocki > > > > The motivation for this change is to provide a way to work around > > a problem with the direct-complete mechanism used for avoiding > > system suspend/resume handling for devices in runtime suspend. > > > > The problem is that some middle layer code (the PCI bus type and > > the ACPI PM domain in particular) returns positive values from its > > system suspend ->prepare callbacks regardless of whether the driver's > > ->prepare returns a positive value or 0, which effectively prevents > > drivers from being able to control the direct-complete feature. > > Some drivers need that control, however, and the PCI bus type has > > grown its own flag to deal with this issue, but since it is not > > limited to PCI, it is better to address it by adding driver flags at > > the core level. > > I'm curious: Why does the PCI bus type (and others) do this? Why > doesn't it do what the driver says to do? Well, the idea was that it might work for the existing drivers without the need to modify them (and they would have had to be modified had the driver's ->prepare return value been required to be taken into account). It actually does work for them in general, although with some notable exceptions. Thanks, Rafael -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/12] PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags
On Monday, October 16, 2017 8:31:22 AM CEST Greg Kroah-Hartman wrote: > On Mon, Oct 16, 2017 at 03:29:02AM +0200, Rafael J. Wysocki wrote: > > +static inline void dev_pm_set_driver_flags(struct device *dev, unsigned > > int flags) > > +{ > > + dev->power.driver_flags = flags; > > +} > > Should this function just set the specific bit? Or is it going to be ok > to set the whole value, meaning you aren't going to care about turning > on and off specific flags over the lifetime of the driver/device, you > are just going to set them once and then just test them as needed? The idea is to set them once and they should not be touched again until the driver (or device) goes away, so that would be the whole value at once (and one of the i2c-designware-platdrv patches actually sets multiple flags in one go). Thanks, Rafael -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/12] PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags
On Monday, October 16, 2017 8:28:52 AM CEST Greg Kroah-Hartman wrote: > On Mon, Oct 16, 2017 at 03:29:02AM +0200, Rafael J. Wysocki wrote: > > struct dev_pm_info { > > pm_message_tpower_state; > > unsigned intcan_wakeup:1; > > @@ -561,6 +580,7 @@ struct dev_pm_info { > > boolis_late_suspended:1; > > boolearly_init:1; /* Owned by the PM core */ > > booldirect_complete:1; /* Owned by the PM core > > */ > > + unsigned intdriver_flags; > > Minor nit, u32 or u64? u32 I think, will update. BTW, there's a mess in this struct overall and I'd like all of the bit fileds to be the same type (and that shouldn't be bool IMO :-)). Do you prefer u32 or unsinged int? Thanks, Rafael -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/12] PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags
On Monday, October 16, 2017 7:34:52 AM CEST Lukas Wunner wrote: > On Mon, Oct 16, 2017 at 03:29:02AM +0200, Rafael J. Wysocki wrote: > > + :c:func:`dev_pm_set_driver_flags` helper function.] If the first of > > + tese flags is set, the PM core will not apply the direct-complete > ^ > these > > > + proceudre described above to the given device and, consequenty, to any > ^ > procedure > Thanks! -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/12] PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags
On Mon, 16 Oct 2017, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > The motivation for this change is to provide a way to work around > a problem with the direct-complete mechanism used for avoiding > system suspend/resume handling for devices in runtime suspend. > > The problem is that some middle layer code (the PCI bus type and > the ACPI PM domain in particular) returns positive values from its > system suspend ->prepare callbacks regardless of whether the driver's > ->prepare returns a positive value or 0, which effectively prevents > drivers from being able to control the direct-complete feature. > Some drivers need that control, however, and the PCI bus type has > grown its own flag to deal with this issue, but since it is not > limited to PCI, it is better to address it by adding driver flags at > the core level. I'm curious: Why does the PCI bus type (and others) do this? Why doesn't it do what the driver says to do? Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/12] PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags
On Mon, Oct 16, 2017 at 03:29:02AM +0200, Rafael J. Wysocki wrote: > +static inline void dev_pm_set_driver_flags(struct device *dev, unsigned int > flags) > +{ > + dev->power.driver_flags = flags; > +} Should this function just set the specific bit? Or is it going to be ok to set the whole value, meaning you aren't going to care about turning on and off specific flags over the lifetime of the driver/device, you are just going to set them once and then just test them as needed? thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/12] PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags
On Mon, Oct 16, 2017 at 03:29:02AM +0200, Rafael J. Wysocki wrote: > struct dev_pm_info { > pm_message_tpower_state; > unsigned intcan_wakeup:1; > @@ -561,6 +580,7 @@ struct dev_pm_info { > boolis_late_suspended:1; > boolearly_init:1; /* Owned by the PM core */ > booldirect_complete:1; /* Owned by the PM core > */ > + unsigned intdriver_flags; Minor nit, u32 or u64? thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/12] PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags
On Mon, Oct 16, 2017 at 03:29:02AM +0200, Rafael J. Wysocki wrote: > + :c:func:`dev_pm_set_driver_flags` helper function.] If the first of > + tese flags is set, the PM core will not apply the direct-complete ^ these > + proceudre described above to the given device and, consequenty, to any ^ procedure Lukas -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html