mbox series

[GIT,PULL] ata changes for 5.18-rc1

Message ID 20220322065608.167815-1-damien.lemoal@opensource.wdc.com
State New
Headers show
Series [GIT,PULL] ata changes for 5.18-rc1 | expand

Pull-request

ssh://git@gitolite.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata tags/ata-5.18-rc1

Message

Damien Le Moal March 22, 2022, 6:56 a.m. UTC
Linus,

The following changes since commit 26291c54e111ff6ba87a164d85d4a4e134b7315c:

  Linux 5.17-rc2 (2022-01-30 15:37:07 +0200)

are available in the Git repository at:

  ssh://git@gitolite.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata tags/ata-5.18-rc1

for you to fetch changes up to d268afa1ff6f582dede1819fbed7ded7442a406c:

  ata: pata_pxa: Use platform_get_irq() to get the interrupt (2022-03-10 11:17:59 +0900)

----------------------------------------------------------------
ata changes for 5.18-rc1

For this cycle, no big change but many small fixes and code cleanup to
libata, the ahci driver and various pata drivers. In more details:

* Code simplification in pata_platform using platform_get_mem_or_io(),
  from Lad.

* Fix read-only arrays declarations as const in pata_atiixp and
  pata_pdc202xx_old, from Colin.

* Various cleanups and code simplification in libata-scsi, from me.

* Remove dead code in libata-acpi, from Sergey.

* Skip device scan deboune delay for Marvell 88SE9235 adapters (ahci) to
  speedup boot, from Paul.

* Simplify functions declaration and use for functions always returning
  0 in libata-core, from Sergey.

* Non-fatal error fixes and in the pata_hpt366 and pata_hpt3x2n drivers,
  from Sergey.

* Various code cleanup in the pata_artop, pata_hpt37x, pata_hpt366,
  pata_hpt3x2n, pata_samsung_cf and sata_rcar drivers, from Sergey.

* Some libata-sff and libata-scsi code cleanup (e.g. change functions
  to return "bool"), from Sergey.

* Renae ahci_board_mobile to board_ahci_low_power to be more descriptive
  of the feature as that is also used on PC and server AHCI adapters,
  from Mario.

* Cleanup of OF match tables, from Geert.

* Simplify the pata_pxa driver initialization using platform_get_irq(),
  from Minghao.

----------------------------------------------------------------
Colin Ian King (2):
      ata: pata_atiixp: make static read-only arrays const
      ata: pata_pdc202xx_old: make static read-only array pio_timing const

Damien Le Moal (4):
      ata: libata-scsi: Cleanup ata_get_xlat_func()
      ata: libata-scsi: Simplify ata_scsi_mode_select_xlat()
      ata: libata-scsi: Simplify scsi_XX_lba_len()
      ata: Kconfig: fix sata gemini compile test condition

Geert Uytterhoeven (1):
      ata: Drop commas after OF match table sentinels

Julia Lawall (1):
      ata: pata_mpc52xx: use GFP_KERNEL

Lad Prabhakar (1):
      ata: pata_platform: Make use of platform_get_mem_or_io()

Mario Limonciello (3):
      ata: ahci: Rename board_ahci_mobile
      ata: ahci: Rename `AHCI_HFLAG_IS_MOBILE`
      ata: ahci: Rename CONFIG_SATA_LPM_MOBILE_POLICY configuration item

Minghao Chi (1):
      ata: pata_pxa: Use platform_get_irq() to get the interrupt

Paul Menzel (1):
      ata: ahci: Skip 200 ms debounce delay for Marvell 88SE9235

Sergey Shtylyov (24):
      ata: libata-acpi: kill ata_acpi_on_suspend()
      ata: libata: ata_{sff|std}_prereset() always return 0
      ata: libata: make ata_host_suspend() *void*
      pata_hpt3x2n: check channel enable bits
      pata_hpt3x2n: fix writing to wrong register in hpt3x2n_bmdma_stop()
      ata: pata_artop: use *switch* in artop_init_one()
      ata: pata_artop: use *switch* in atp8xx_fixup()
      ata: pata_hpt3x2n: drop unused HPT_PCI_FAST
      ata: pata_hpt3x2n: drop unused 'struct hpt_chip'
      ata: libata-sff: make ata_devchk() return 'bool'
      ata: pata_samsung_cf: make pata_s3c_devchk() return 'bool'
      ata: sata_rcar: make sata_rcar_ata_devchk() return 'bool'
      ata: pata_hpt366: check channel enable bits
      ata: sata_rcar: drop unused #define's
      ata: pata_hpt366: disable fast interrupts in prereset() method
      ata: pata_hpt37x: disable fast interrupts in prereset() method
      ata: pata_hpt3x2n: disable fast interrupts in prereset() method
      ata: libata-sff: make ata_resources_present() return 'bool'
      ata: libata-sff: refactor ata_sff_set_devctl()
      ata: libata-sff: refactor ata_sff_altstatus()
      ata: libata-scsi: use *switch* statements to check SCSI command codes
      ata: add/use ata_taskfile::{error|status} fields
      ata: libata-sff: use *switch* statement in ata_sff_dev_classify()
      ata: pata_hpt37x: merge transfer mode setting methods

 drivers/ata/Kconfig             |   8 +--
 drivers/ata/acard-ahci.c        |   2 +-
 drivers/ata/ahci.c              | 113 +++++++++++++++++----------------
 drivers/ata/ahci.h              |   4 +-
 drivers/ata/ahci_brcm.c         |   2 +-
 drivers/ata/ahci_ceva.c         |   2 +-
 drivers/ata/ahci_da850.c        |   2 +-
 drivers/ata/ahci_dm816.c        |   2 +-
 drivers/ata/ahci_imx.c          |   2 +-
 drivers/ata/ahci_mtk.c          |   2 +-
 drivers/ata/ahci_mvebu.c        |   2 +-
 drivers/ata/ahci_octeon.c       |   2 +-
 drivers/ata/ahci_platform.c     |   2 +-
 drivers/ata/ahci_qoriq.c        |   4 +-
 drivers/ata/ahci_st.c           |   2 +-
 drivers/ata/ahci_sunxi.c        |   2 +-
 drivers/ata/ahci_xgene.c        |   4 +-
 drivers/ata/ata_piix.c          |   5 +-
 drivers/ata/libahci.c           |   4 +-
 drivers/ata/libahci_platform.c  |   3 +-
 drivers/ata/libata-acpi.c       |  29 ++-------
 drivers/ata/libata-core.c       |  22 +++----
 drivers/ata/libata-eh.c         |  49 +++++++--------
 drivers/ata/libata-sata.c       |  10 +--
 drivers/ata/libata-scsi.c       |  95 ++++++++++++----------------
 drivers/ata/libata-sff.c        | 136 ++++++++++++++++++++++------------------
 drivers/ata/libata.h            |   2 -
 drivers/ata/pata_arasan_cf.c    |   3 +-
 drivers/ata/pata_artop.c        |  31 +++++----
 drivers/ata/pata_atiixp.c       |   4 +-
 drivers/ata/pata_cs5520.c       |   5 +-
 drivers/ata/pata_ep93xx.c       |   4 +-
 drivers/ata/pata_ftide010.c     |   6 +-
 drivers/ata/pata_hpt366.c       |  49 +++++++++++++--
 drivers/ata/pata_hpt37x.c       | 115 +++++++++------------------------
 drivers/ata/pata_hpt3x2n.c      |  38 ++++++-----
 drivers/ata/pata_imx.c          |  15 ++---
 drivers/ata/pata_ixp4xx_cf.c    |   2 +-
 drivers/ata/pata_macio.c        |  24 ++-----
 drivers/ata/pata_mpc52xx.c      |   7 ++-
 drivers/ata/pata_ns87415.c      |   4 +-
 drivers/ata/pata_octeon_cf.c    |  10 ++-
 drivers/ata/pata_of_platform.c  |   2 +-
 drivers/ata/pata_pdc202xx_old.c |   2 +-
 drivers/ata/pata_platform.c     |  18 ++----
 drivers/ata/pata_pxa.c          |  10 +--
 drivers/ata/pata_samsung_cf.c   |  12 ++--
 drivers/ata/pata_triflex.c      |   5 +-
 drivers/ata/sata_fsl.c          |  14 ++---
 drivers/ata/sata_gemini.c       |   6 +-
 drivers/ata/sata_highbank.c     |   7 ++-
 drivers/ata/sata_inic162x.c     |  10 +--
 drivers/ata/sata_mv.c           |   8 +--
 drivers/ata/sata_rcar.c         |  35 +++++------
 drivers/ata/sata_svw.c          |  10 +--
 drivers/ata/sata_vsc.c          |  10 +--
 include/linux/libata.h          |  12 +++-
 57 files changed, 456 insertions(+), 534 deletions(-)

Comments

Linus Torvalds March 23, 2022, 10:10 p.m. UTC | #1
On Mon, Mar 21, 2022 at 11:57 PM Damien Le Moal
<damien.lemoal@opensource.wdc.com> wrote:
>
> * Rename ahci_board_mobile to board_ahci_low_power to be more descriptive
>   of the feature as that is also used on PC and server AHCI adapters,
>   from Mario.
>
> Mario Limonciello (3):
>       ata: ahci: Rename board_ahci_mobile
>       ata: ahci: Rename `AHCI_HFLAG_IS_MOBILE`
>       ata: ahci: Rename CONFIG_SATA_LPM_MOBILE_POLICY configuration item

So I've pulled this, but it's worth noting that particularly renaming
that CONFIG option was probably not a good idea.

Why?

Because it means that people silently lose their old values. And it has that

        range 0 4
        default 0

with 4 being explicitly marked as very dangerous - but at least Fedora
seems to actually have a default of 3 in their kernels:

  /boot/config-5.16.13-200.fc35.x86_64:
        CONFIG_SATA_MOBILE_LPM_POLICY=3

so that "default 0" may actually not be the right one.

Now, we're at the point where few enough people likely care about ATA,
but the corollary to that is also that these kinds of changes can
cause user pain that then developers have *no* idea about.
Particularly when the pain ends up being caused by some subtle default
config option silently changing that nobody even thought about.

Now, that "default 0" is probably the only safe default - and I don't
dispute that part. But I also suspect that Fedora chose that value '3'
because it probably makes a noticeable power use difference on at
least some platforms.

I don't know. But I doubt really *anybody* knows, so renaming them and
silently likely changing config options for some less-than-critical
reason is just not a great idea.

                Linus
Mario Limonciello March 23, 2022, 11:04 p.m. UTC | #2
[Public]

> On Mon, Mar 21, 2022 at 11:57 PM Damien Le Moal
> <damien.lemoal@opensource.wdc.com> wrote:
> >
> > * Rename ahci_board_mobile to board_ahci_low_power to be more
> descriptive
> >   of the feature as that is also used on PC and server AHCI adapters,
> >   from Mario.
> >
> > Mario Limonciello (3):
> >       ata: ahci: Rename board_ahci_mobile
> >       ata: ahci: Rename `AHCI_HFLAG_IS_MOBILE`
> >       ata: ahci: Rename CONFIG_SATA_LPM_MOBILE_POLICY configuration item
> 
> So I've pulled this, but it's worth noting that particularly renaming
> that CONFIG option was probably not a good idea.
> 
> Why?
> 
> Because it means that people silently lose their old values. And it has that
> 
>         range 0 4
>         default 0
> 
> with 4 being explicitly marked as very dangerous - but at least Fedora
> seems to actually have a default of 3 in their kernels:
> 
>   /boot/config-5.16.13-200.fc35.x86_64:
>         CONFIG_SATA_MOBILE_LPM_POLICY=3
> 
> so that "default 0" may actually not be the right one.
> 
> Now, we're at the point where few enough people likely care about ATA,
> but the corollary to that is also that these kinds of changes can
> cause user pain that then developers have *no* idea about.
> Particularly when the pain ends up being caused by some subtle default
> config option silently changing that nobody even thought about.
> 
> Now, that "default 0" is probably the only safe default - and I don't
> dispute that part. But I also suspect that Fedora chose that value '3'
> because it probably makes a noticeable power use difference on at
> least some platforms.
> 
> I don't know. But I doubt really *anybody* knows, so renaming them and
> silently likely changing config options for some less-than-critical
> reason is just not a great idea.
> 
>                 Linus

Thanks for pointing out the subtlety of renaming a configuration option hides
problems because people don't see the new config option and pick the default.
I wouldn't call this configuration option rename critical, so if you chose to revert
it I would understand.

However I think you raise a good point that if distros are picking different "default"
values and keeping them there a long time that the value in the upstream kernel
is probably not right anymore.  A while back that default made sense because all the
power saving stuff was risky at the time.  It's pretty well baked now.

So maybe a logical thing is to keep this change and send a follow up that also changes
the default to 3?  If you're supportive of that I'll send something to Damien to do that.
Linus Torvalds March 23, 2022, 11:13 p.m. UTC | #3
On Wed, Mar 23, 2022 at 4:04 PM Limonciello, Mario
<Mario.Limonciello@amd.com> wrote:
>
> So maybe a logical thing is to keep this change and send a follow up that also changes
> the default to 3?  If you're supportive of that I'll send something to Damien to do that.

It would probably be good to have some way to see what other distros do.

I only have F35 here, so a very limited selection of distro defaults..

            Linus
pr-tracker-bot@kernel.org March 23, 2022, 11:36 p.m. UTC | #4
The pull request you sent on Tue, 22 Mar 2022 15:56:08 +0900:

> ssh://git@gitolite.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata tags/ata-5.18-rc1

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/c7d4b15372bde442059c7d6415afeba073a09474

Thank you!
Damien Le Moal March 23, 2022, 11:40 p.m. UTC | #5
On 3/24/22 07:10, Linus Torvalds wrote:
> On Mon, Mar 21, 2022 at 11:57 PM Damien Le Moal
> <damien.lemoal@opensource.wdc.com> wrote:
>>
>> * Rename ahci_board_mobile to board_ahci_low_power to be more descriptive
>>   of the feature as that is also used on PC and server AHCI adapters,
>>   from Mario.
>>
>> Mario Limonciello (3):
>>       ata: ahci: Rename board_ahci_mobile
>>       ata: ahci: Rename `AHCI_HFLAG_IS_MOBILE`
>>       ata: ahci: Rename CONFIG_SATA_LPM_MOBILE_POLICY configuration item
> 
> So I've pulled this, but it's worth noting that particularly renaming
> that CONFIG option was probably not a good idea.
> 
> Why?
> 
> Because it means that people silently lose their old values. And it has that
> 
>         range 0 4
>         default 0
> 
> with 4 being explicitly marked as very dangerous - but at least Fedora
> seems to actually have a default of 3 in their kernels:
> 
>   /boot/config-5.16.13-200.fc35.x86_64:
>         CONFIG_SATA_MOBILE_LPM_POLICY=3
> 
> so that "default 0" may actually not be the right one.

Yes. Mario has follow up patches to change the default. But as changing it
may break things, we are going to try it early this cycle so that it can
get lots of linux-next testing. Since Fedora has had the default of 3 for
a long time now, changing the kernel default from 0 to 3 should be OK. The
goal here is of course to have a default kernel config that is more
eco-friendly.

> Now, we're at the point where few enough people likely care about ATA,
> but the corollary to that is also that these kinds of changes can
> cause user pain that then developers have *no* idea about.
> Particularly when the pain ends up being caused by some subtle default
> config option silently changing that nobody even thought about.
> 
> Now, that "default 0" is probably the only safe default - and I don't
> dispute that part. But I also suspect that Fedora chose that value '3'
> because it probably makes a noticeable power use difference on at
> least some platforms.

Most laptops benefit from it. And yes, most laptop today have switched to
NVMe, but there are still a fair amount out there using SATA SSDs and 2.5"
HDDs, even new ones (low end models).

> I don't know. But I doubt really *anybody* knows, so renaming them and
> silently likely changing config options for some less-than-critical
> reason is just not a great idea.

Understood. I will monitor this and see if a revert of the rename is
needed. For now, I do prefer the new name as it reflects the fact that
link power management policies are not for mobile chipsets anymore and
also apply to regular server chipsets where power consumption really
matters too.
Damien Le Moal March 23, 2022, 11:41 p.m. UTC | #6
On 3/24/22 08:13, Linus Torvalds wrote:
> On Wed, Mar 23, 2022 at 4:04 PM Limonciello, Mario
> <Mario.Limonciello@amd.com> wrote:
>>
>> So maybe a logical thing is to keep this change and send a follow up that also changes
>> the default to 3?  If you're supportive of that I'll send something to Damien to do that.
> 
> It would probably be good to have some way to see what other distros do.
> 
> I only have F35 here, so a very limited selection of distro defaults..

I use Fedora too. I will check the other major distributions default.
Damien Le Moal March 23, 2022, 11:45 p.m. UTC | #7
On 3/24/22 08:04, Limonciello, Mario wrote:
> [Public]
> 
>> On Mon, Mar 21, 2022 at 11:57 PM Damien Le Moal
>> <damien.lemoal@opensource.wdc.com> wrote:
>>>
>>> * Rename ahci_board_mobile to board_ahci_low_power to be more
>> descriptive
>>>   of the feature as that is also used on PC and server AHCI adapters,
>>>   from Mario.
>>>
>>> Mario Limonciello (3):
>>>       ata: ahci: Rename board_ahci_mobile
>>>       ata: ahci: Rename `AHCI_HFLAG_IS_MOBILE`
>>>       ata: ahci: Rename CONFIG_SATA_LPM_MOBILE_POLICY configuration item
>>
>> So I've pulled this, but it's worth noting that particularly renaming
>> that CONFIG option was probably not a good idea.
>>
>> Why?
>>
>> Because it means that people silently lose their old values. And it has that
>>
>>         range 0 4
>>         default 0
>>
>> with 4 being explicitly marked as very dangerous - but at least Fedora
>> seems to actually have a default of 3 in their kernels:
>>
>>   /boot/config-5.16.13-200.fc35.x86_64:
>>         CONFIG_SATA_MOBILE_LPM_POLICY=3
>>
>> so that "default 0" may actually not be the right one.
>>
>> Now, we're at the point where few enough people likely care about ATA,
>> but the corollary to that is also that these kinds of changes can
>> cause user pain that then developers have *no* idea about.
>> Particularly when the pain ends up being caused by some subtle default
>> config option silently changing that nobody even thought about.
>>
>> Now, that "default 0" is probably the only safe default - and I don't
>> dispute that part. But I also suspect that Fedora chose that value '3'
>> because it probably makes a noticeable power use difference on at
>> least some platforms.
>>
>> I don't know. But I doubt really *anybody* knows, so renaming them and
>> silently likely changing config options for some less-than-critical
>> reason is just not a great idea.
>>
>>                 Linus
> 
> Thanks for pointing out the subtlety of renaming a configuration option hides
> problems because people don't see the new config option and pick the default.
> I wouldn't call this configuration option rename critical, so if you chose to revert
> it I would understand.
> 
> However I think you raise a good point that if distros are picking different "default"
> values and keeping them there a long time that the value in the upstream kernel
> is probably not right anymore.  A while back that default made sense because all the
> power saving stuff was risky at the time.  It's pretty well baked now.
> 
> So maybe a logical thing is to keep this change and send a follow up that also changes
> the default to 3?  If you're supportive of that I'll send something to Damien to do that.

Mario, let's check what other distros do first before deciding. Fedora for
sure has a default of 3 and I have never seen any issue with it (and I
have been using Fedora for a long time with many different drives).

Not sure what distro you are using, but if it is not Fedora, please check.
We should check at least Debian, Ubuntu, SUSE, RHEL and CentOS. I can
check some other minor ones too as I know users.
Mario Limonciello March 24, 2022, 12:25 a.m. UTC | #8
[Public]

> On 3/24/22 08:04, Limonciello, Mario wrote:
> > [Public]
> >
> >> On Mon, Mar 21, 2022 at 11:57 PM Damien Le Moal
> >> <damien.lemoal@opensource.wdc.com> wrote:
> >>>
> >>> * Rename ahci_board_mobile to board_ahci_low_power to be more
> >> descriptive
> >>>   of the feature as that is also used on PC and server AHCI adapters,
> >>>   from Mario.
> >>>
> >>> Mario Limonciello (3):
> >>>       ata: ahci: Rename board_ahci_mobile
> >>>       ata: ahci: Rename `AHCI_HFLAG_IS_MOBILE`
> >>>       ata: ahci: Rename CONFIG_SATA_LPM_MOBILE_POLICY configuration
> item
> >>
> >> So I've pulled this, but it's worth noting that particularly renaming
> >> that CONFIG option was probably not a good idea.
> >>
> >> Why?
> >>
> >> Because it means that people silently lose their old values. And it has that
> >>
> >>         range 0 4
> >>         default 0
> >>
> >> with 4 being explicitly marked as very dangerous - but at least Fedora
> >> seems to actually have a default of 3 in their kernels:
> >>
> >>   /boot/config-5.16.13-200.fc35.x86_64:
> >>         CONFIG_SATA_MOBILE_LPM_POLICY=3
> >>
> >> so that "default 0" may actually not be the right one.
> >>
> >> Now, we're at the point where few enough people likely care about ATA,
> >> but the corollary to that is also that these kinds of changes can
> >> cause user pain that then developers have *no* idea about.
> >> Particularly when the pain ends up being caused by some subtle default
> >> config option silently changing that nobody even thought about.
> >>
> >> Now, that "default 0" is probably the only safe default - and I don't
> >> dispute that part. But I also suspect that Fedora chose that value '3'
> >> because it probably makes a noticeable power use difference on at
> >> least some platforms.
> >>
> >> I don't know. But I doubt really *anybody* knows, so renaming them and
> >> silently likely changing config options for some less-than-critical
> >> reason is just not a great idea.
> >>
> >>                 Linus
> >
> > Thanks for pointing out the subtlety of renaming a configuration option hides
> > problems because people don't see the new config option and pick the default.
> > I wouldn't call this configuration option rename critical, so if you chose to
> revert
> > it I would understand.
> >
> > However I think you raise a good point that if distros are picking different
> "default"
> > values and keeping them there a long time that the value in the upstream
> kernel
> > is probably not right anymore.  A while back that default made sense because
> all the
> > power saving stuff was risky at the time.  It's pretty well baked now.
> >
> > So maybe a logical thing is to keep this change and send a follow up that also
> changes
> > the default to 3?  If you're supportive of that I'll send something to Damien to
> do that.
> 
> Mario, let's check what other distros do first before deciding. Fedora for
> sure has a default of 3 and I have never seen any issue with it (and I
> have been using Fedora for a long time with many different drives).
> 
> Not sure what distro you are using, but if it is not Fedora, please check.
> We should check at least Debian, Ubuntu, SUSE, RHEL and CentOS. I can
> check some other minor ones too as I know users.
> 

I use Ubuntu mostly, and have a variety of distro kernels installed:

config-5.13.0-25-generic:CONFIG_SATA_MOBILE_LPM_POLICY=3
config-5.14.0-1029-oem:CONFIG_SATA_MOBILE_LPM_POLICY=3
config-5.4.0-60-generic:CONFIG_SATA_MOBILE_LPM_POLICY=3

From a box with a random RHEL8 kernel I see:

config-4.18.0-372.2.1.el8.x86_64:CONFIG_SATA_MOBILE_LPM_POLICY=0

However I believe that is because RH uses tuned to set policies like this. 
They have use cases from embedded up through datacenter.
For example you can see their "desktop" profile overrides it to
to medium_power:

https://github.com/redhat-performance/tuned/commit/adffbb0ca1537277d5344661e05a705af2520c89

Downloaded a random Debian 5.10 kernel package and extracted it:
$ grep LPM config-5.10.0-10-amd64
CONFIG_SATA_MOBILE_LPM_POLICY=3

Checked arch from their source tree and they also set 3:
https://github.com/archlinux/svntogit-packages/blob/packages/linux/trunk/config#L2798

Not sure where to check SUSE.
Damien Le Moal March 24, 2022, 12:38 a.m. UTC | #9
On 3/24/22 09:25, Limonciello, Mario wrote:
> [Public]
> 
>> On 3/24/22 08:04, Limonciello, Mario wrote:
>>> [Public]
>>>
>>>> On Mon, Mar 21, 2022 at 11:57 PM Damien Le Moal
>>>> <damien.lemoal@opensource.wdc.com> wrote:
>>>>>
>>>>> * Rename ahci_board_mobile to board_ahci_low_power to be more
>>>> descriptive
>>>>>   of the feature as that is also used on PC and server AHCI adapters,
>>>>>   from Mario.
>>>>>
>>>>> Mario Limonciello (3):
>>>>>       ata: ahci: Rename board_ahci_mobile
>>>>>       ata: ahci: Rename `AHCI_HFLAG_IS_MOBILE`
>>>>>       ata: ahci: Rename CONFIG_SATA_LPM_MOBILE_POLICY configuration
>> item
>>>>
>>>> So I've pulled this, but it's worth noting that particularly renaming
>>>> that CONFIG option was probably not a good idea.
>>>>
>>>> Why?
>>>>
>>>> Because it means that people silently lose their old values. And it has that
>>>>
>>>>         range 0 4
>>>>         default 0
>>>>
>>>> with 4 being explicitly marked as very dangerous - but at least Fedora
>>>> seems to actually have a default of 3 in their kernels:
>>>>
>>>>   /boot/config-5.16.13-200.fc35.x86_64:
>>>>         CONFIG_SATA_MOBILE_LPM_POLICY=3
>>>>
>>>> so that "default 0" may actually not be the right one.
>>>>
>>>> Now, we're at the point where few enough people likely care about ATA,
>>>> but the corollary to that is also that these kinds of changes can
>>>> cause user pain that then developers have *no* idea about.
>>>> Particularly when the pain ends up being caused by some subtle default
>>>> config option silently changing that nobody even thought about.
>>>>
>>>> Now, that "default 0" is probably the only safe default - and I don't
>>>> dispute that part. But I also suspect that Fedora chose that value '3'
>>>> because it probably makes a noticeable power use difference on at
>>>> least some platforms.
>>>>
>>>> I don't know. But I doubt really *anybody* knows, so renaming them and
>>>> silently likely changing config options for some less-than-critical
>>>> reason is just not a great idea.
>>>>
>>>>                 Linus
>>>
>>> Thanks for pointing out the subtlety of renaming a configuration option hides
>>> problems because people don't see the new config option and pick the default.
>>> I wouldn't call this configuration option rename critical, so if you chose to
>> revert
>>> it I would understand.
>>>
>>> However I think you raise a good point that if distros are picking different
>> "default"
>>> values and keeping them there a long time that the value in the upstream
>> kernel
>>> is probably not right anymore.  A while back that default made sense because
>> all the
>>> power saving stuff was risky at the time.  It's pretty well baked now.
>>>
>>> So maybe a logical thing is to keep this change and send a follow up that also
>> changes
>>> the default to 3?  If you're supportive of that I'll send something to Damien to
>> do that.
>>
>> Mario, let's check what other distros do first before deciding. Fedora for
>> sure has a default of 3 and I have never seen any issue with it (and I
>> have been using Fedora for a long time with many different drives).
>>
>> Not sure what distro you are using, but if it is not Fedora, please check.
>> We should check at least Debian, Ubuntu, SUSE, RHEL and CentOS. I can
>> check some other minor ones too as I know users.
>>
> 
> I use Ubuntu mostly, and have a variety of distro kernels installed:
> 
> config-5.13.0-25-generic:CONFIG_SATA_MOBILE_LPM_POLICY=3
> config-5.14.0-1029-oem:CONFIG_SATA_MOBILE_LPM_POLICY=3
> config-5.4.0-60-generic:CONFIG_SATA_MOBILE_LPM_POLICY=3

OK. Thanks.

> 
> From a box with a random RHEL8 kernel I see:
> 
> config-4.18.0-372.2.1.el8.x86_64:CONFIG_SATA_MOBILE_LPM_POLICY=0
> 
> However I believe that is because RH uses tuned to set policies like this. 
> They have use cases from embedded up through datacenter.
> For example you can see their "desktop" profile overrides it to
> to medium_power:
> 
> https://github.com/redhat-performance/tuned/commit/adffbb0ca1537277d5344661e05a705af2520c89

OK. I will check CentOS too, but it should be the same as RHEL.

> 
> Downloaded a random Debian 5.10 kernel package and extracted it:
> $ grep LPM config-5.10.0-10-amd64
> CONFIG_SATA_MOBILE_LPM_POLICY=3

Yep, just checked that too. Both Debian stable and testing have 3 as the
default.

> 
> Checked arch from their source tree and they also set 3:
> https://github.com/archlinux/svntogit-packages/blob/packages/linux/trunk/config#L2798
> 
> Not sure where to check SUSE.

Checking this one now.
Christoph Hellwig March 24, 2022, 6:28 a.m. UTC | #10
On Thu, Mar 24, 2022 at 08:45:56AM +0900, Damien Le Moal wrote:
> Mario, let's check what other distros do first before deciding. Fedora for
> sure has a default of 3 and I have never seen any issue with it (and I
> have been using Fedora for a long time with many different drives).
> 
> Not sure what distro you are using, but if it is not Fedora, please check.
> We should check at least Debian, Ubuntu, SUSE, RHEL and CentOS. I can
> check some other minor ones too as I know users.

Debian:

hch@brick:~/work/linux$ grep CONFIG_SATA_MOBILE_LPM_POLICY /boot/config-5.10.0-1*
/boot/config-5.10.0-10-amd64:CONFIG_SATA_MOBILE_LPM_POLICY=3
/boot/config-5.10.0-11-amd64:CONFIG_SATA_MOBILE_LPM_POLICY=3
/boot/config-5.10.0-12-amd64:CONFIG_SATA_MOBILE_LPM_POLICY=3
Damien Le Moal March 24, 2022, 6:38 a.m. UTC | #11
On 3/24/22 15:28, Christoph Hellwig wrote:
> On Thu, Mar 24, 2022 at 08:45:56AM +0900, Damien Le Moal wrote:
>> Mario, let's check what other distros do first before deciding. Fedora for
>> sure has a default of 3 and I have never seen any issue with it (and I
>> have been using Fedora for a long time with many different drives).
>>
>> Not sure what distro you are using, but if it is not Fedora, please check.
>> We should check at least Debian, Ubuntu, SUSE, RHEL and CentOS. I can
>> check some other minor ones too as I know users.
> 
> Debian:
> 
> hch@brick:~/work/linux$ grep CONFIG_SATA_MOBILE_LPM_POLICY /boot/config-5.10.0-1*
> /boot/config-5.10.0-10-amd64:CONFIG_SATA_MOBILE_LPM_POLICY=3
> /boot/config-5.10.0-11-amd64:CONFIG_SATA_MOBILE_LPM_POLICY=3
> /boot/config-5.10.0-12-amd64:CONFIG_SATA_MOBILE_LPM_POLICY=3

Thanks. Debian testing also has the default at 3.

Mario reported that Ubuntu and Arch also use 3, and that RHEL has 0 as
default but changes it to 3 after boot.

Gentoo default config is also 3. Checking CentOS and [open]SUSE now.

So far, it is looking like 3 is a sane default.
Justin Forbes March 24, 2022, 12:49 p.m. UTC | #12
On Thu, Mar 24, 2022 at 03:38:00PM +0900, Damien Le Moal wrote:
> On 3/24/22 15:28, Christoph Hellwig wrote:
> > On Thu, Mar 24, 2022 at 08:45:56AM +0900, Damien Le Moal wrote:
> >> Mario, let's check what other distros do first before deciding. Fedora for
> >> sure has a default of 3 and I have never seen any issue with it (and I
> >> have been using Fedora for a long time with many different drives).
> >>
> >> Not sure what distro you are using, but if it is not Fedora, please check.
> >> We should check at least Debian, Ubuntu, SUSE, RHEL and CentOS. I can
> >> check some other minor ones too as I know users.
> > 
> > Debian:
> > 
> > hch@brick:~/work/linux$ grep CONFIG_SATA_MOBILE_LPM_POLICY /boot/config-5.10.0-1*
> > /boot/config-5.10.0-10-amd64:CONFIG_SATA_MOBILE_LPM_POLICY=3
> > /boot/config-5.10.0-11-amd64:CONFIG_SATA_MOBILE_LPM_POLICY=3
> > /boot/config-5.10.0-12-amd64:CONFIG_SATA_MOBILE_LPM_POLICY=3
> 
> Thanks. Debian testing also has the default at 3.
> 
> Mario reported that Ubuntu and Arch also use 3, and that RHEL has 0 as
> default but changes it to 3 after boot.
> 
> Gentoo default config is also 3. Checking CentOS and [open]SUSE now.

CentOS uses the RHEL configs and defaults to 0.  I do agree that
renaming config options can be problematic, but the heads up from Damien
helped. It will not be an issue for Fedora, CentOS, and RHEL.

Justin
 
> So far, it is looking like 3 is a sane default.
> 
> -- 
> Damien Le Moal
> Western Digital Research