platform/kernel/linux-starfive.git
2 years agoata: ahci_mtk: add compile test support
Damien Le Moal [Tue, 4 Jan 2022 05:59:00 +0000 (14:59 +0900)]
ata: ahci_mtk: add compile test support

Add Kconfig dependendy on COMPILE_TEST to allow compile tests with
configs that do not enable ARCH_MEDIATEK.

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
2 years agoata: ahci_dm816: add compile test support
Damien Le Moal [Tue, 4 Jan 2022 05:53:49 +0000 (14:53 +0900)]
ata: ahci_dm816: add compile test support

Add Kconfig dependendy on COMPILE_TEST to allow compile tests with
configs that do not enable ARCH_OMAP2PLUS.

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
2 years agoata: ahci_da850: add compile test support
Damien Le Moal [Tue, 4 Jan 2022 05:51:43 +0000 (14:51 +0900)]
ata: ahci_da850: add compile test support

Add Kconfig dependendy on COMPILE_TEST to allow compile tests with
configs that do not enable ARCH_DAVINCI_DA850.

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
2 years agoata: ahci_brcm: add compile test support
Damien Le Moal [Tue, 4 Jan 2022 05:48:17 +0000 (14:48 +0900)]
ata: ahci_brcm: add compile test support

Add Kconfig dependendy on COMPILE_TEST to allow compile tests with
configs that do not enable ARCH_BRCMSTB, BMIPS_GENERIC or ARCH_BCM_XXX.

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
2 years agoata: sata_fsl: add compile test support
Damien Le Moal [Tue, 4 Jan 2022 04:46:18 +0000 (13:46 +0900)]
ata: sata_fsl: add compile test support

Add dependendy on COMPILE_TEST to allow compile tests with configs that
do not enable FSL_SOC.

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
2 years agoata: sata_dwc_460ex: Remove debug compile options
Hannes Reinecke [Tue, 21 Dec 2021 07:21:31 +0000 (08:21 +0100)]
ata: sata_dwc_460ex: Remove debug compile options

Driver has been converted to dynamic debugging, so the compile-time
options don't have any functionality left.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_dwc_460ex: remove 'check_status' argument
Hannes Reinecke [Tue, 21 Dec 2021 07:21:30 +0000 (08:21 +0100)]
ata: sata_dwc_460ex: remove 'check_status' argument

Remove the 'check_status' argument from sata_dwc_qc_complete() and
sata_dwc_dma_xfer_complete() as it has no functionality.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_dwc_460ex: drop DEBUG_NCQ
Hannes Reinecke [Tue, 21 Dec 2021 07:21:29 +0000 (08:21 +0100)]
ata: sata_dwc_460ex: drop DEBUG_NCQ

Obsolete, and has been converted to tracepoints.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata-scsi: rework ata_dump_status to avoid using pr_cont()
Hannes Reinecke [Tue, 21 Dec 2021 07:21:28 +0000 (08:21 +0100)]
ata: libata-scsi: rework ata_dump_status to avoid using pr_cont()

pr_cont() has the problem that individual calls will be disrupted
under high load, causing each call to end up on a single line and
thereby mangling the output.
So rework ata_dump_status() to have just one call to ata_port_warn()
and avoid this problem.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_hpt366: convert pr_warn() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:21:27 +0000 (08:21 +0100)]
ata: pata_hpt366: convert pr_warn() calls

Convert pr_warn() calls to ata_dev_warn()

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_gemini: convert pr_err() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:21:26 +0000 (08:21 +0100)]
ata: sata_gemini: convert pr_err() calls

Convert pr_err() calls to dev_err()

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_hpt3x2n: convert pr_XXX() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:21:25 +0000 (08:21 +0100)]
ata: pata_hpt3x2n: convert pr_XXX() calls

Convert pr_XXX() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_octeon_cf: Replace pr_XXX() calls with structured logging
Hannes Reinecke [Tue, 21 Dec 2021 07:21:24 +0000 (08:21 +0100)]
ata: pata_octeon_cf: Replace pr_XXX() calls with structured logging

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_hpt37x: convert pr_XXX() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:21:23 +0000 (08:21 +0100)]
ata: pata_hpt37x: convert pr_XXX() calls

Convert pr_XXX() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_mv: convert remaining printk() to structured logging
Hannes Reinecke [Tue, 21 Dec 2021 07:21:22 +0000 (08:21 +0100)]
ata: sata_mv: convert remaining printk() to structured logging

Refactor the .reset_hc() callback and convert the remaining printk()
calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_sx4: convert printk() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:21:21 +0000 (08:21 +0100)]
ata: sata_sx4: convert printk() calls

Convert printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_sil680: convert printk() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:21:20 +0000 (08:21 +0100)]
ata: pata_sil680: convert printk() calls

Convert printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_serverworks: convert printk() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:21:19 +0000 (08:21 +0100)]
ata: pata_serverworks: convert printk() calls

Convert printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_rz1000: convert printk() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:21:18 +0000 (08:21 +0100)]
ata: pata_rz1000: convert printk() calls

Convert printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_marvell: convert printk() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:21:17 +0000 (08:21 +0100)]
ata: pata_marvell: convert printk() calls

Convert the printk() call to structured logging and
drop the pointless PCI bar debug messages.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_it821x: convert printk() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:21:16 +0000 (08:21 +0100)]
ata: pata_it821x: convert printk() calls

Convert printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_cypress: convert printk() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:21:15 +0000 (08:21 +0100)]
ata: pata_cypress: convert printk() calls

Convert printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_cs5536: convert printk() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:21:14 +0000 (08:21 +0100)]
ata: pata_cs5536: convert printk() calls

Convert printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_cs5520: convert printk() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:21:13 +0000 (08:21 +0100)]
ata: pata_cs5520: convert printk() calls

Convert printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_cmd64x: convert printk() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:21:12 +0000 (08:21 +0100)]
ata: pata_cmd64x: convert printk() calls

Convert printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_cmd640: convert printk() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:21:11 +0000 (08:21 +0100)]
ata: pata_cmd640: convert printk() calls

Convert printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_atp867x: convert printk() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:21:10 +0000 (08:21 +0100)]
ata: pata_atp867x: convert printk() calls

Convert printk() calls to structured logging.

[Damien]
Fix ata_port_dbg() format in atp867x_check_ports() to avoid compile
warnings with 32-bits arch.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: remove debug compilation switches
Hannes Reinecke [Tue, 21 Dec 2021 07:21:09 +0000 (08:21 +0100)]
ata: libata: remove debug compilation switches

Unused now, so remove and drop any references to them.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: remove 'new' ata message handling
Hannes Reinecke [Tue, 21 Dec 2021 07:21:08 +0000 (08:21 +0100)]
ata: libata: remove 'new' ata message handling

Remove the remaining bits for the 'new' ata message handling.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: drop ata_msg_drv()
Hannes Reinecke [Tue, 21 Dec 2021 07:21:07 +0000 (08:21 +0100)]
ata: libata: drop ata_msg_drv()

Callers are already protected by ata_dev_print_info(), so no need
to have an additional configuration parameter here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: drop ata_msg_info()
Hannes Reinecke [Tue, 21 Dec 2021 07:21:06 +0000 (08:21 +0100)]
ata: libata: drop ata_msg_info()

Convert the sole caller to ata_dev_dbg() and remove the definition.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: drop ata_msg_probe()
Hannes Reinecke [Tue, 21 Dec 2021 07:21:05 +0000 (08:21 +0100)]
ata: libata: drop ata_msg_probe()

All callsites have been converted to dynamic debugging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: drop ata_msg_warn()
Hannes Reinecke [Tue, 21 Dec 2021 07:21:04 +0000 (08:21 +0100)]
ata: libata: drop ata_msg_warn()

The WARN level was always enabled, so drop ata_msg_warn().

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: drop ata_msg_malloc()
Hannes Reinecke [Tue, 21 Dec 2021 07:21:03 +0000 (08:21 +0100)]
ata: libata: drop ata_msg_malloc()

Unused.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: drop ata_msg_ctl()
Hannes Reinecke [Tue, 21 Dec 2021 07:21:02 +0000 (08:21 +0100)]
ata: libata: drop ata_msg_ctl()

The one caller have been converted to dynamic debugging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: drop ata_msg_error() and ata_msg_intr()
Hannes Reinecke [Tue, 21 Dec 2021 07:21:01 +0000 (08:21 +0100)]
ata: libata: drop ata_msg_error() and ata_msg_intr()

Unused.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_sx4: add module parameter 'dimm_test'
Hannes Reinecke [Tue, 21 Dec 2021 07:21:00 +0000 (08:21 +0100)]
ata: sata_sx4: add module parameter 'dimm_test'

Add module parameter 'dimm_test' to enable DIMM testing during startup.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_sx4: Drop pointless VPRINTK() calls and convert the remaining ones
Hannes Reinecke [Tue, 21 Dec 2021 07:20:59 +0000 (08:20 +0100)]
ata: sata_sx4: Drop pointless VPRINTK() calls and convert the remaining ones

Drop pointless VPRINTK() calls for setting up SG tables
and convert the remaining calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_sil: Drop pointless VPRINTK() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:20:58 +0000 (08:20 +0100)]
ata: sata_sil: Drop pointless VPRINTK() calls

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_fsl: convert VPRINTK() calls to ata_port_dbg()
Hannes Reinecke [Tue, 21 Dec 2021 07:20:57 +0000 (08:20 +0100)]
ata: sata_fsl: convert VPRINTK() calls to ata_port_dbg()

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_nv: drop pointless VPRINTK() calls and convert remaining ones
Hannes Reinecke [Tue, 21 Dec 2021 07:20:56 +0000 (08:20 +0100)]
ata: sata_nv: drop pointless VPRINTK() calls and convert remaining ones

Quite some information from the VPRINTK() is already covered by
tracepoints, so remove the pointless calls and convert the remaining
ones to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_mv: Drop pointless VPRINTK() call and convert the remaining one
Hannes Reinecke [Tue, 21 Dec 2021 07:20:55 +0000 (08:20 +0100)]
ata: sata_mv: Drop pointless VPRINTK() call and convert the remaining one

Drop pointless VPRINTK() call and convert the remaining one to dev_dbg().

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_inic162x: Drop pointless VPRINTK() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:20:54 +0000 (08:20 +0100)]
ata: sata_inic162x: Drop pointless VPRINTK() calls

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_rcar: Drop pointless VPRINTK() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:20:53 +0000 (08:20 +0100)]
ata: sata_rcar: Drop pointless VPRINTK() calls

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_qstor: Drop pointless VPRINTK() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:20:52 +0000 (08:20 +0100)]
ata: sata_qstor: Drop pointless VPRINTK() calls

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_promise: Drop pointless VPRINTK() calls and convert the remaining ones
Hannes Reinecke [Tue, 21 Dec 2021 07:20:51 +0000 (08:20 +0100)]
ata: sata_promise: Drop pointless VPRINTK() calls and convert the remaining ones

Drop pointless VPRINTK() calls for entering and existing interrupt
routines and convert the remaining calls to ata_port_dbg().

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_via: Drop pointless VPRINTK() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:20:50 +0000 (08:20 +0100)]
ata: pata_via: Drop pointless VPRINTK() calls

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_octeon_cf: Drop pointless VPRINTK() calls and convert the remaining one
Hannes Reinecke [Tue, 21 Dec 2021 07:20:49 +0000 (08:20 +0100)]
ata: pata_octeon_cf: Drop pointless VPRINTK() calls and convert the remaining one

Drop pointless VPRINTK() calls and convert the remaining calls to
the existing bmdma tracepoint.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pdc_adma: Drop pointless VPRINTK() calls and remove disabled NCQ debugging
Hannes Reinecke [Tue, 21 Dec 2021 07:20:48 +0000 (08:20 +0100)]
ata: pdc_adma: Drop pointless VPRINTK() calls and remove disabled NCQ debugging

Drop pointless VPRINTK() calls for entering routines and setting up sg
tables. And while we're at it, remove the disabled debugging messages.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: ahci: Drop pointless VPRINTK() calls and convert the remaining ones
Hannes Reinecke [Tue, 21 Dec 2021 07:20:47 +0000 (08:20 +0100)]
ata: ahci: Drop pointless VPRINTK() calls and convert the remaining ones

Drop pointless VPRINTK() calls for entering and existing interrupt
routines and convert the remaining calls to dev_dbg().

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: remove pointless VPRINTK() calls
Hannes Reinecke [Tue, 21 Dec 2021 07:20:46 +0000 (08:20 +0100)]
ata: libata: remove pointless VPRINTK() calls

Most of the information is already covered by tracepoints
(if not downright pointless), so remove the VPRINTK() calls.
And while we're at it, remove ata_scsi_dump_cdb(), too,
as this information can be retrieved from scsi tracing.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_pdc2027x: Replace PDPRINTK() with standard ata logging
Hannes Reinecke [Tue, 21 Dec 2021 07:20:45 +0000 (08:20 +0100)]
ata: pata_pdc2027x: Replace PDPRINTK() with standard ata logging

Use standard ata logging macros instead of the hand-crafted
PDPRINTK and remove duplicate logging messages.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_qstor: replace DPRINTK() with dev_dbg()
Hannes Reinecke [Tue, 21 Dec 2021 07:20:44 +0000 (08:20 +0100)]
ata: sata_qstor: replace DPRINTK() with dev_dbg()

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_rcar: replace DPRINTK() with ata_port_dbg()
Hannes Reinecke [Tue, 21 Dec 2021 07:20:43 +0000 (08:20 +0100)]
ata: sata_rcar: replace DPRINTK() with ata_port_dbg()

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_fsl: move DPRINTK to ata debugging
Hannes Reinecke [Tue, 21 Dec 2021 07:20:42 +0000 (08:20 +0100)]
ata: sata_fsl: move DPRINTK to ata debugging

Replace all DPRINTK calls with the ata_XXX_dbg functions.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pdc_adma: Remove DPRINTK call
Hannes Reinecke [Tue, 21 Dec 2021 07:20:41 +0000 (08:20 +0100)]
ata: pdc_adma: Remove DPRINTK call

The DPRINTK call doesn't print information which isn't already covered
by tracepoints later on.
Remove it.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_octeon_cf: remove DPRINTK() macro in interrupt context
Hannes Reinecke [Tue, 21 Dec 2021 07:20:40 +0000 (08:20 +0100)]
ata: pata_octeon_cf: remove DPRINTK() macro in interrupt context

There is only so much information to be glanced when the interrupt
routine is called and exited, so remove these DPRINTK() calls.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_mv: replace DPRINTK with dynamic debugging
Hannes Reinecke [Tue, 21 Dec 2021 07:20:39 +0000 (08:20 +0100)]
ata: sata_mv: replace DPRINTK with dynamic debugging

Move the DPRINTK calls over to dynamic debugging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_mv: kill 'port' argument in mv_dump_all_regs()
Hannes Reinecke [Tue, 21 Dec 2021 07:20:38 +0000 (08:20 +0100)]
ata: sata_mv: kill 'port' argument in mv_dump_all_regs()

Always '-1', so drop it and simplify the function.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: move DPRINTK to ata debugging
Hannes Reinecke [Tue, 21 Dec 2021 07:20:37 +0000 (08:20 +0100)]
ata: libata: move DPRINTK to ata debugging

Replace all DPRINTK calls with ata_dev_dbg().

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: revamp ata_get_cmd_descript()
Hannes Reinecke [Tue, 21 Dec 2021 07:20:36 +0000 (08:20 +0100)]
ata: libata: revamp ata_get_cmd_descript()

Rename ata_get_cmd_descrip() to ata_get_cmd_name() and simplify
it to return "unknown" instead of NULL.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: move ata_{port,link,dev}_dbg to standard pr_XXX() macros
Hannes Reinecke [Tue, 21 Dec 2021 07:20:35 +0000 (08:20 +0100)]
ata: libata: move ata_{port,link,dev}_dbg to standard pr_XXX() macros

Use standard pr_{debug,info,notice,warn,err} macros instead of the
hand-crafted printk helpers.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: add tracepoints for ATA error handling
Hannes Reinecke [Tue, 21 Dec 2021 07:20:34 +0000 (08:20 +0100)]
ata: libata: add tracepoints for ATA error handling

Add tracepoints for ATA error handling.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata-scsi: drop DPRINTK calls for cdb translation
Hannes Reinecke [Tue, 21 Dec 2021 07:20:33 +0000 (08:20 +0100)]
ata: libata-scsi: drop DPRINTK calls for cdb translation

Drop DPRINTK calls for cdb translation as they are already covered
by other traces, and also drop the DPRINTK calls in ata_scsi_hotplug().

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata-sff: tracepoints for HSM state machine
Hannes Reinecke [Tue, 21 Dec 2021 07:20:32 +0000 (08:20 +0100)]
ata: libata-sff: tracepoints for HSM state machine

Add tracepoints for the HSM state machine and drop DPRINTK calls

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: tracepoints for bus-master DMA
Hannes Reinecke [Tue, 21 Dec 2021 07:20:31 +0000 (08:20 +0100)]
ata: libata: tracepoints for bus-master DMA

Add tracepoints for bus-master DMA and taskfile related functions.
That allows us to drop the relevant DPRINTK() calls.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: add qc_prep tracepoint
Hannes Reinecke [Tue, 21 Dec 2021 07:20:30 +0000 (08:20 +0100)]
ata: libata: add qc_prep tracepoint

Convert the existing ata_qc_issue() tracepoint into a template,
and add tracepoints for ata_qc_prep() and ata_qc_issue() based
on that template.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: add reset tracepoints
Hannes Reinecke [Tue, 21 Dec 2021 07:20:29 +0000 (08:20 +0100)]
ata: libata: add reset tracepoints

To follow the flow of control we should be using tracepoints, as
they will tie in with the actual I/O flow and deliver a better
overview about what it happening.
This patch adds tracepoints for hard reset, soft reset, and postreset
and adds them in the libata-eh control flow.
With that we can drop the reset DPRINTK calls in the various drivers.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: sanitize ATA_HORKAGE_DUMP_ID
Hannes Reinecke [Tue, 21 Dec 2021 07:20:28 +0000 (08:20 +0100)]
ata: libata: sanitize ATA_HORKAGE_DUMP_ID

With moving ata_dev_dbg() over to dynamic debugging ATA_HORKAGE_DUMP_ID
will now print out the raw IDENTIFY data without a header unless
explicitly enable via dyndebug.
So move the logging level up to INFO and have the header printed
always.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: move ata_dump_id() to dynamic debugging
Hannes Reinecke [Tue, 21 Dec 2021 07:20:27 +0000 (08:20 +0100)]
ata: libata: move ata_dump_id() to dynamic debugging

Use ata_dev_dbg() to print out the information in ata_dump_id()
and remove the ata_msg_probe() conditional.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: Add ata_port_classify() helper
Hannes Reinecke [Tue, 21 Dec 2021 07:20:26 +0000 (08:20 +0100)]
ata: libata: Add ata_port_classify() helper

Add an ata_port_classify() helper to print out the results from
the device classification and remove the debugging statements
from ata_dev_classify().

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: whitespace cleanup
Hannes Reinecke [Tue, 21 Dec 2021 07:20:25 +0000 (08:20 +0100)]
ata: libata: whitespace cleanup

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: remove pointless debugging messages
Hannes Reinecke [Tue, 21 Dec 2021 07:20:24 +0000 (08:20 +0100)]
ata: libata: remove pointless debugging messages

Debugging messages in pci init functions or sg setup are pretty
much pointless, as the workflow pretty much decides what happened.
So drop them.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata: use min() to make code cleaner
Changcheng Deng [Mon, 20 Dec 2021 11:33:58 +0000 (11:33 +0000)]
ata: libata: use min() to make code cleaner

Use min() in order to make code cleaner.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libahci_platform: Get rid of dup message when IRQ can't be retrieved
Andy Shevchenko [Fri, 17 Dec 2021 11:28:32 +0000 (13:28 +0200)]
ata: libahci_platform: Get rid of dup message when IRQ can't be retrieved

platform_get_irq() will print a message when it fails.
No need to repeat this.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libahci_platform: Remove bogus 32-bit DMA mask attempt
Andy Shevchenko [Thu, 9 Dec 2021 14:59:37 +0000 (16:59 +0200)]
ata: libahci_platform: Remove bogus 32-bit DMA mask attempt

If 64-bit mask attempt fails, the 32-bit will fail by the very same reason.
Don't even try the latter. It's a continuation of the changes that contains,
e.g. dcc02c19cc06 ("sata_sil24: use dma_set_mask_and_coherent").

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_dwc_460ex: Remove unused forward declaration
Andy Shevchenko [Thu, 9 Dec 2021 14:35:19 +0000 (16:35 +0200)]
ata: sata_dwc_460ex: Remove unused forward declaration

sata_dwc_port_stop() is not used before being defined,
remove redundant forward declaration.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_dwc_460ex: Use temporary variable for struct device
Andy Shevchenko [Thu, 9 Dec 2021 14:35:18 +0000 (16:35 +0200)]
ata: sata_dwc_460ex: Use temporary variable for struct device

Use temporary variable for struct device to make code neater.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_dwc_460ex: Use devm_platform_*ioremap_resource() APIs
Andy Shevchenko [Thu, 9 Dec 2021 14:35:17 +0000 (16:35 +0200)]
ata: sata_dwc_460ex: Use devm_platform_*ioremap_resource() APIs

Use devm_platform_get_and_ioremap_resource() and
devm_platform_ioremap_resource() APIs instead of their
open coded analogues.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_fsl: use sysfs_emit()
Damien Le Moal [Thu, 2 Dec 2021 06:05:03 +0000 (15:05 +0900)]
ata: sata_fsl: use sysfs_emit()

Use sysfs_emit() instead of sprintf() in fsl_sata_intr_coalescing_show()
and fsl_sata_rx_watermark_show().

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: ahci: use sysfs_emit()
Damien Le Moal [Thu, 2 Dec 2021 06:02:17 +0000 (15:02 +0900)]
ata: ahci: use sysfs_emit()

Use sysfs_emit() instead of sprintf in remapped_nvme_show().

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata-scsi: use sysfs_emit()
Damien Le Moal [Thu, 2 Dec 2021 05:56:47 +0000 (14:56 +0900)]
ata: libata-scsi: use sysfs_emit()

Use sysfs_emit() instead of snprintf() in ata_scsi_park_show().

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: libata-sata: use sysfs_emit()
Damien Le Moal [Thu, 2 Dec 2021 05:52:57 +0000 (14:52 +0900)]
ata: libata-sata: use sysfs_emit()

Use sysfs_emit() instead of snprintf() in sysfs attibute show()
functions.

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: sata_fsl: Use struct_group() for memcpy() region
Kees Cook [Thu, 18 Nov 2021 18:38:07 +0000 (10:38 -0800)]
ata: sata_fsl: Use struct_group() for memcpy() region

In preparation for FORTIFY_SOURCE performing compile-time and run-time
field bounds checking for memcpy(), memmove(), and memset(), avoid
intentionally writing across neighboring fields.

Use struct_group() in struct command_desc around members acmd and fill,
so they can be referenced together. This will allow memset(), memcpy(),
and sizeof() to more easily reason about sizes, improve readability,
and avoid future warnings about writing beyond the end of acmd:

In function 'fortify_memset_chk',
    inlined from 'sata_fsl_qc_prep' at drivers/ata/sata_fsl.c:534:3:
./include/linux/fortify-string.h:199:4: warning: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
  199 |    __write_overflow_field();
      |    ^~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoata: pata_ali: no need to initialise statics to 0
Jason Wang [Sat, 13 Nov 2021 06:26:14 +0000 (14:26 +0800)]
ata: pata_ali: no need to initialise statics to 0

Static variables do not need to be initialized to 0.

Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
2 years agoLinux 5.16-rc8
Linus Torvalds [Sun, 2 Jan 2022 22:23:25 +0000 (14:23 -0800)]
Linux 5.16-rc8

2 years agoMerge tag 'perf-tools-fixes-for-v5.16-2022-01-02' of git://git.kernel.org/pub/scm...
Linus Torvalds [Sun, 2 Jan 2022 22:09:03 +0000 (14:09 -0800)]
Merge tag 'perf-tools-fixes-for-v5.16-2022-01-02' of git://git./linux/kernel/git/acme/linux

Pull perf tools fixes from Arnaldo Carvalho de Melo:

 - Fix TUI exit screen refresh race condition in 'perf top'.

 - Fix parsing of Intel PT VM time correlation arguments.

 - Honour CPU filtering command line request of a script's switch events
   in 'perf script'.

 - Fix printing of switch events in Intel PT python script.

 - Fix duplicate alias events list printing in 'perf list', noticed on
   heterogeneous arm64 systems.

 - Fix return value of ids__new(), users expect NULL for failure, not
   ERR_PTR(-ENOMEM).

* tag 'perf-tools-fixes-for-v5.16-2022-01-02' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
  perf top: Fix TUI exit screen refresh race condition
  perf pmu: Fix alias events list
  perf scripts python: intel-pt-events.py: Fix printing of switch events
  perf script: Fix CPU filtering of a script's switch events
  perf intel-pt: Fix parsing of VM time correlation arguments
  perf expr: Fix return value of ids__new()

2 years agoMerge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
Linus Torvalds [Sun, 2 Jan 2022 18:36:09 +0000 (10:36 -0800)]
Merge branch 'i2c/for-current' of git://git./linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
 "Better input validation for compat ioctls and a documentation bugfix
  for 5.16"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  Docs: Fixes link to I2C specification
  i2c: validate user data in compat ioctl

2 years agoMerge tag 'x86_urgent_for_v5.16_rc8' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 2 Jan 2022 17:02:54 +0000 (09:02 -0800)]
Merge tag 'x86_urgent_for_v5.16_rc8' of git://git./linux/kernel/git/tip/tip

Pull x86 fix from Borislav Petkov:

 - Use the proper CONFIG symbol in a preprocessor check.

* tag 'x86_urgent_for_v5.16_rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/build: Use the proper name CONFIG_FW_LOADER

2 years agoperf top: Fix TUI exit screen refresh race condition
yaowenbin [Wed, 29 Dec 2021 08:55:19 +0000 (16:55 +0800)]
perf top: Fix TUI exit screen refresh race condition

When the following command is executed several times, a coredump file is
generated.

$ timeout -k 9 5 perf top -e task-clock
*******
*******
*******
0.01%  [kernel]                  [k] __do_softirq
0.01%  libpthread-2.28.so        [.] __pthread_mutex_lock
0.01%  [kernel]                  [k] __ll_sc_atomic64_sub_return
double free or corruption (!prev) perf top --sort comm,dso
timeout: the monitored command dumped core

When we terminate "perf top" using sending signal method,
SLsmg_reset_smg() called. SLsmg_reset_smg() resets the SLsmg screen
management routines by freeing all memory allocated while it was active.

However SLsmg_reinit_smg() maybe be called by another thread.

SLsmg_reinit_smg() will free the same memory accessed by
SLsmg_reset_smg(), thus it results in a double free.

SLsmg_reinit_smg() is called already protected by ui__lock, so we fix
the problem by adding pthread_mutex_trylock of ui__lock when calling
SLsmg_reset_smg().

Signed-off-by: Wenyu Liu <liuwenyu7@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: wuxu.wu@huawei.com
Link: http://lore.kernel.org/lkml/a91e3943-7ddc-f5c0-a7f5-360f073c20e6@huawei.com
Signed-off-by: Hewenliang <hewenliang4@huawei.com>
Signed-off-by: yaowenbin <yaowenbin1@huawei.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2 years agoperf pmu: Fix alias events list
John Garry [Tue, 21 Dec 2021 16:11:30 +0000 (00:11 +0800)]
perf pmu: Fix alias events list

Commit 0e0ae8742207c3b4 ("perf list: Display hybrid PMU events with cpu
type") changes the event list for uncore PMUs or arm64 heterogeneous CPU
systems, such that duplicate aliases are incorrectly listed per PMU
(which they should not be), like:

  # perf list
  ...
  unc_cbo_cache_lookup.any_es
  [Unit: uncore_cbox L3 Lookup any request that access cache and found
  line in E or S-state]
  unc_cbo_cache_lookup.any_es
  [Unit: uncore_cbox L3 Lookup any request that access cache and found
  line in E or S-state]
  unc_cbo_cache_lookup.any_i
  [Unit: uncore_cbox L3 Lookup any request that access cache and found
  line in I-state]
  unc_cbo_cache_lookup.any_i
  [Unit: uncore_cbox L3 Lookup any request that access cache and found
  line in I-state]
  ...

Notice how the events are listed twice.

The named commit changed how we remove duplicate events, in that events
for different PMUs are not treated as duplicates. I suppose this is to
handle how "Each hybrid pmu event has been assigned with a pmu name".

Fix PMU alias listing by restoring behaviour to remove duplicates for
non-hybrid PMUs.

Fixes: 0e0ae8742207c3b4 ("perf list: Display hybrid PMU events with cpu type")
Signed-off-by: John Garry <john.garry@huawei.com>
Tested-by: Zhengjun Xing <zhengjun.xing@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/1640103090-140490-1-git-send-email-john.garry@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Linus Torvalds [Sat, 1 Jan 2022 18:21:49 +0000 (10:21 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/dtor/input

Pull input fixes from Dmitry Torokhov:
 "Two small fixups for spaceball joystick driver and appletouch touchpad
  driver"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: spaceball - fix parsing of movement data packets
  Input: appletouch - initialize work before device registration

2 years agomm: vmscan: reduce throttling due to a failure to make progress -fix
Mel Gorman [Fri, 31 Dec 2021 21:10:09 +0000 (13:10 -0800)]
mm: vmscan: reduce throttling due to a failure to make progress -fix

Hugh Dickins reported the following

My tmpfs swapping load (tweaked to use huge pages more heavily
than in real life) is far from being a realistic load: but it was
notably slowed down by your throttling mods in 5.16-rc, and this
patch makes it well again - thanks.

But: it very quickly hit NULL pointer until I changed that last
line to

        if (first_pgdat)
                consider_reclaim_throttle(first_pgdat, sc);

The likely issue is that huge pages are a major component of the test
workload.  When this is the case, first_pgdat may never get set if
compaction is ready to continue due to this check

        if (IS_ENABLED(CONFIG_COMPACTION) &&
            sc->order > PAGE_ALLOC_COSTLY_ORDER &&
            compaction_ready(zone, sc)) {
                sc->compaction_ready = true;
                continue;
        }

If this was true for every zone in the zonelist, first_pgdat would never
get set resulting in a NULL pointer exception.

Link: https://lkml.kernel.org/r/20211209095453.GM3366@techsingularity.net
Fixes: 1b4e3f26f9f75 ("mm: vmscan: Reduce throttling due to a failure to make progress")
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Reported-by: Hugh Dickins <hughd@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Rik van Riel <riel@surriel.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Darrick J. Wong <djwong@kernel.org>
Cc: Shakeel Butt <shakeelb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agomm: vmscan: Reduce throttling due to a failure to make progress
Mel Gorman [Thu, 2 Dec 2021 15:06:14 +0000 (15:06 +0000)]
mm: vmscan: Reduce throttling due to a failure to make progress

Mike Galbraith, Alexey Avramov and Darrick Wong all reported similar
problems due to reclaim throttling for excessive lengths of time.  In
Alexey's case, a memory hog that should go OOM quickly stalls for
several minutes before stalling.  In Mike and Darrick's cases, a small
memcg environment stalled excessively even though the system had enough
memory overall.

Commit 69392a403f49 ("mm/vmscan: throttle reclaim when no progress is
being made") introduced the problem although commit a19594ca4a8b
("mm/vmscan: increase the timeout if page reclaim is not making
progress") made it worse.  Systems at or near an OOM state that cannot
be recovered must reach OOM quickly and memcg should kill tasks if a
memcg is near OOM.

To address this, only stall for the first zone in the zonelist, reduce
the timeout to 1 tick for VMSCAN_THROTTLE_NOPROGRESS and only stall if
the scan control nr_reclaimed is 0, kswapd is still active and there
were excessive pages pending for writeback.  If kswapd has stopped
reclaiming due to excessive failures, do not stall at all so that OOM
triggers relatively quickly.  Similarly, if an LRU is simply congested,
only lightly throttle similar to NOPROGRESS.

Alexey's original case was the most straight forward

for i in {1..3}; do tail /dev/zero; done

On vanilla 5.16-rc1, this test stalled heavily, after the patch the test
completes in a few seconds similar to 5.15.

Alexey's second test case added watching a youtube video while tail runs
10 times.  On 5.15, playback only jitters slightly, 5.16-rc1 stalls a
lot with lots of frames missing and numerous audio glitches.  With this
patch applies, the video plays similarly to 5.15.

[lkp@intel.com: Fix W=1 build warning]

Link: https://lore.kernel.org/r/99e779783d6c7fce96448a3402061b9dc1b3b602.camel@gmx.de
Link: https://lore.kernel.org/r/20211124011954.7cab9bb4@mail.inbox.lv
Link: https://lore.kernel.org/r/20211022144651.19914-1-mgorman@techsingularity.net
Link: https://lore.kernel.org/r/20211202150614.22440-1-mgorman@techsingularity.net
Link: https://linux-regtracking.leemhuis.info/regzbot/regression/20211124011954.7cab9bb4@mail.inbox.lv/
Reported-and-tested-by: Alexey Avramov <hakavlad@inbox.lv>
Reported-and-tested-by: Mike Galbraith <efault@gmx.de>
Reported-and-tested-by: Darrick J. Wong <djwong@kernel.org>
Reported-by: kernel test robot <lkp@intel.com>
Acked-by: Hugh Dickins <hughd@google.com>
Tracked-by: Thorsten Leemhuis <regressions@leemhuis.info>
Fixes: 69392a403f49 ("mm/vmscan: throttle reclaim when no progress is being made")
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agoMerge branch 'akpm' (patches from Andrew)
Linus Torvalds [Fri, 31 Dec 2021 17:28:48 +0000 (09:28 -0800)]
Merge branch 'akpm' (patches from Andrew)

Merge misc mm fixes from Andrew Morton:
 "2 patches.

  Subsystems affected by this patch series: mm (userfaultfd and damon)"

* akpm:
  mm/damon/dbgfs: fix 'struct pid' leaks in 'dbgfs_target_ids_write()'
  userfaultfd/selftests: fix hugetlb area allocations

2 years agoMerge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Fri, 31 Dec 2021 17:22:25 +0000 (09:22 -0800)]
Merge tag 'scsi-fixes' of git://git./linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "Three fixes, all in drivers. The lpfc one doesn't look exploitable,
  but nasty things could happen in string operations if mybuf ends up
  with an on stack unterminated string"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: vmw_pvscsi: Set residual data length conditionally
  scsi: libiscsi: Fix UAF in iscsi_conn_get_param()/iscsi_conn_teardown()
  scsi: lpfc: Terminate string in lpfc_debugfs_nvmeio_trc_write()

2 years agomm/damon/dbgfs: fix 'struct pid' leaks in 'dbgfs_target_ids_write()'
SeongJae Park [Fri, 31 Dec 2021 04:12:34 +0000 (20:12 -0800)]
mm/damon/dbgfs: fix 'struct pid' leaks in 'dbgfs_target_ids_write()'

DAMON debugfs interface increases the reference counts of 'struct pid's
for targets from the 'target_ids' file write callback
('dbgfs_target_ids_write()'), but decreases the counts only in DAMON
monitoring termination callback ('dbgfs_before_terminate()').

Therefore, when 'target_ids' file is repeatedly written without DAMON
monitoring start/termination, the reference count is not decreased and
therefore memory for the 'struct pid' cannot be freed.  This commit
fixes this issue by decreasing the reference counts when 'target_ids' is
written.

Link: https://lkml.kernel.org/r/20211229124029.23348-1-sj@kernel.org
Fixes: 4bc05954d007 ("mm/damon: implement a debugfs-based user space interface")
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: <stable@vger.kernel.org> [5.15+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agouserfaultfd/selftests: fix hugetlb area allocations
Mike Kravetz [Fri, 31 Dec 2021 04:12:31 +0000 (20:12 -0800)]
userfaultfd/selftests: fix hugetlb area allocations

Currently, userfaultfd selftest for hugetlb as run from run_vmtests.sh
or any environment where there are 'just enough' hugetlb pages will
always fail with:

  testing events (fork, remap, remove):
ERROR: UFFDIO_COPY error: -12 (errno=12, line=616)

The ENOMEM error code implies there are not enough hugetlb pages.
However, there are free hugetlb pages but they are all reserved.  There
is a basic problem with the way the test allocates hugetlb pages which
has existed since the test was originally written.

Due to the way 'cleanup' was done between different phases of the test,
this issue was masked until recently.  The issue was uncovered by commit
8ba6e8640844 ("userfaultfd/selftests: reinitialize test context in each
test").

For the hugetlb test, src and dst areas are allocated as PRIVATE
mappings of a hugetlb file.  This means that at mmap time, pages are
reserved for the src and dst areas.  At the start of event testing (and
other tests) the src area is populated which results in allocation of
huge pages to fill the area and consumption of reserves associated with
the area.  Then, a child is forked to fault in the dst area.  Note that
the dst area was allocated in the parent and hence the parent owns the
reserves associated with the mapping.  The child has normal access to
the dst area, but can not use the reserves created/owned by the parent.
Thus, if there are no other huge pages available allocation of a page
for the dst by the child will fail.

Fix by not creating reserves for the dst area.  In this way the child
can use free (non-reserved) pages.

Also, MAP_PRIVATE of a file only makes sense if you are interested in
the contents of the file before making a COW copy.  The test does not do
this.  So, just use MAP_ANONYMOUS | MAP_HUGETLB to create an anonymous
hugetlb mapping.  There is no need to create a hugetlb file in the
non-shared case.

Link: https://lkml.kernel.org/r/20211217172919.7861-1-mike.kravetz@oracle.com
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Mina Almasry <almasrymina@google.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agoDocs: Fixes link to I2C specification
Deep Majumder [Fri, 19 Nov 2021 06:14:01 +0000 (11:44 +0530)]
Docs: Fixes link to I2C specification

The link to the I2C specification is broken. Although
"https://www.nxp.com" hosts Rev 7 (2021) of this specification, it is
behind a login-wall. Thus, an additional link has been added (which
doesn't require a login) and the NXP official docs link has been
updated.

Signed-off-by: Deep Majumder <deep@fastmail.in>
[wsa: minor updates to text and commit message]
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2 years agoi2c: validate user data in compat ioctl
Pavel Skripkin [Thu, 30 Dec 2021 22:47:50 +0000 (01:47 +0300)]
i2c: validate user data in compat ioctl

Wrong user data may cause warning in i2c_transfer(), ex: zero msgs.
Userspace should not be able to trigger warnings, so this patch adds
validation checks for user data in compact ioctl to prevent reported
warnings

Reported-and-tested-by: syzbot+e417648b303855b91d8a@syzkaller.appspotmail.com
Fixes: 7d5cb45655f2 ("i2c compat ioctls: move to ->compat_ioctl()")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>