5.19.4-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 292/365 mmc: tmio: avoid glitches when resetting
In reply to Greg Kroah-HartmanFrom: Wolfram Sang <[email protected]>
[ Upstream commit 2e586f8a5b0ed4a525014a692923ac96f6647816 ]
If we reset because of an error, we need to preserve values for the clock frequency. Otherwise, glitches may be seen on the bus.
To achieve that, we introduce a 'preserve' parameter to the reset function and the IP core specific reset callbacks to handle everything accordingly.
--- drivers/mmc/host/renesas_sdhi_core.c | 29 ++++++++++++++-------------- drivers/mmc/host/tmio_mmc.c | 2 +- drivers/mmc/host/tmio_mmc.h | 6 +++++- drivers/mmc/host/tmio_mmc_core.c | 28 +++++++++++++++++++++------ 4 files changed, 42 insertions(+), 23 deletions(-)
drivers/mmc/host/renesas_sdhi_core.c +14 -15
@@ -49,9 +49,6 @@#define HOST_MODE_GEN3_32BIT (HOST_MODE_GEN3_WMODE | HOST_MODE_GEN3_BUSWIDTH)#define HOST_MODE_GEN3_64BIT 0 -#define CTL_SDIF_MODE 0xe6 -#define SDIF_MODE_HS400 BIT(0) -#define SDHI_VER_GEN2_SDR50 0x490c#define SDHI_VER_RZ_A1 0x820b/* very old datasheets said 0x490c for SDR104, too. They are wrong! */
@@ -562,23 +559,25 @@ static void renesas_sdhi_scc_reset(struct tmio_mmc_host *host, struct renesas_sd }/* only populated for TMIO_MMC_MIN_RCAR2 */ -static void renesas_sdhi_reset (struct tmio_mmc_host *host) +static void renesas_sdhi_reset (struct tmio_mmc_host *host,bool preserve) {struct renesas_sdhi *priv =host_to_priv (host);int ret;u16 val; -if (priv->rstc) { -reset_control_reset (priv->rstc); -/* Unknown why but without polling reset status, it will hang */ -read_poll_timeout (reset_control_status, ret, ret ==0 ,1 ,100 , - false, priv->rstc); -/* At least SDHI_VER_GEN2_SDR50 needs manual release of reset */ -sd_ctrl_write16 (host,CTL_RESET_SD ,0x0001 ); - priv->needs_adjust_hs400 = false; -renesas_sdhi_set_clock (host, host->clk_cache); - }else if (priv->scc_ctl) { -renesas_sdhi_scc_reset (host, priv); +if (!preserve) { +if (priv->rstc) { +reset_control_reset (priv->rstc); +/* Unknown why but without polling reset status, it will hang */ +read_poll_timeout (reset_control_status, ret, ret ==0 ,1 ,100 , + false, priv->rstc); +/* At least SDHI_VER_GEN2_SDR50 needs manual release of reset */ +sd_ctrl_write16 (host,CTL_RESET_SD ,0x0001 ); + priv->needs_adjust_hs400 = false; +renesas_sdhi_set_clock (host, host->clk_cache); + }else if (priv->scc_ctl) { +renesas_sdhi_scc_reset (host, priv); + } }if (sd_ctrl_read16 (host,CTL_VERSION ) >=SDHI_VER_GEN3_SD ) {
drivers/mmc/host/tmio_mmc.c +1 -1
@@ -75,7 +75,7 @@ static void tmio_mmc_set_clock(struct tmio_mmc_host *host,tmio_mmc_clk_start (host); } -static void tmio_mmc_reset (struct tmio_mmc_host *host) +static void tmio_mmc_reset (struct tmio_mmc_host *host,bool preserve) {sd_ctrl_write16 (host,CTL_RESET_SDIO ,0x0000 );usleep_range (10000 ,11000 );
drivers/mmc/host/tmio_mmc.h +5 -1
@@ -42,6 +42,7 @@#define CTL_DMA_ENABLE 0xd8#define CTL_RESET_SD 0xe0#define CTL_VERSION 0xe2 +#define CTL_SDIF_MODE 0xe6/* only known on R-Car 2+ */ /* Definitions for values the CTL_STOP_INTERNAL_ACTION register can take */ #define TMIO_STOP_STP BIT(0)
@@ -98,6 +99,9 @@/* Definitions for values the CTL_DMA_ENABLE register can take */ #define DMA_ENABLE_DMASDRW BIT(1) +/* Definitions for values the CTL_SDIF_MODE register can take */ +#define SDIF_MODE_HS400 BIT(0)/* only known on R-Car 2+ */ +/* Define some IRQ masks */ /* This is the mask used at reset by the chip */ #define TMIO_MASK_ALL 0x837f031d
@@ -181,7 +185,7 @@ struct tmio_mmc_host {int (*multi_io_quirk)(struct mmc_card *card,unsigned int direction,int blk_size);int (*write16_hook)(struct tmio_mmc_host *host,int addr); -void (*reset)(struct tmio_mmc_host *host); +void (*reset)(struct tmio_mmc_host *host,bool preserve);bool (*check_retune)(struct tmio_mmc_host *host,struct mmc_request *mrq);void (*fixup_request)(struct tmio_mmc_host *host,struct mmc_request *mrq);unsigned int (*get_timeout_cycles)(struct tmio_mmc_host *host);
drivers/mmc/host/tmio_mmc_core.c +22 -6
@@ -179,8 +179,17 @@ static void tmio_mmc_set_bus_width(struct tmio_mmc_host *host,sd_ctrl_write16 (host,CTL_SD_MEM_CARD_OPT , reg); } -static void tmio_mmc_reset (struct tmio_mmc_host *host) +static void tmio_mmc_reset (struct tmio_mmc_host *host,bool preserve) { +u16 card_opt, clk_ctrl, sdif_mode; + +if (preserve) { + card_opt =sd_ctrl_read16 (host,CTL_SD_MEM_CARD_OPT ); + clk_ctrl =sd_ctrl_read16 (host,CTL_SD_CARD_CLK_CTL ); +if (host->pdata->flags &TMIO_MMC_MIN_RCAR2 ) + sdif_mode =sd_ctrl_read16 (host,CTL_SDIF_MODE ); + } +/* FIXME - should we set stop clock reg here */ sd_ctrl_write16 (host,CTL_RESET_SD ,0x0000 );usleep_range (10000 ,11000 );
@@ -190,7 +199,7 @@ static void tmio_mmc_reset(struct tmio_mmc_host *host)tmio_mmc_abort_dma (host);if (host->reset) - host->reset (host); + host->reset (host, preserve);sd_ctrl_write32_as_16_and_16 (host,CTL_IRQ_MASK , host->sdcard_irq_mask_all); host->sdcard_irq_mask = host->sdcard_irq_mask_all;
@@ -206,6 +215,13 @@ static void tmio_mmc_reset(struct tmio_mmc_host *host)sd_ctrl_write16 (host,CTL_TRANSACTION_CTL ,0x0001 ); } +if (preserve) { +sd_ctrl_write16 (host,CTL_SD_MEM_CARD_OPT , card_opt); +sd_ctrl_write16 (host,CTL_SD_CARD_CLK_CTL , clk_ctrl); +if (host->pdata->flags &TMIO_MMC_MIN_RCAR2 ) +sd_ctrl_write16 (host,CTL_SDIF_MODE , sdif_mode); + } +if (host->mmc->card)mmc_retune_needed (host->mmc); }
@@ -248,7 +264,7 @@ static void tmio_mmc_reset_work(struct work_struct *work)spin_unlock_irqrestore (&host->lock, flags); -tmio_mmc_reset (host); +tmio_mmc_reset (host, true);/* Ready for new calls */ host->mrq =NULL ;
@@ -961,7 +977,7 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)tmio_mmc_power_off (host);/* For R-Car Gen2+, we need to reset SDHI specific SCC */ if (host->pdata->flags &TMIO_MMC_MIN_RCAR2 ) -tmio_mmc_reset (host); +tmio_mmc_reset (host, false); host->set_clock (host,0 );break ;
@@ -1189,7 +1205,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) _host->sdcard_irq_mask_all =TMIO_MASK_ALL ; _host->set_clock (_host,0 ); -tmio_mmc_reset (_host); +tmio_mmc_reset (_host, false);spin_lock_init (&_host->lock);mutex_init (&_host->ios_lock);
@@ -1285,7 +1301,7 @@ int tmio_mmc_host_runtime_resume(struct device *dev)struct tmio_mmc_host *host =dev_get_drvdata (dev);tmio_mmc_clk_enable (host); -tmio_mmc_reset (host); +tmio_mmc_reset (host, false);if (host->clk_cache) host->set_clock (host, host->clk_cache);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 293/365 scsi: ufs: ufs-exynos: Change ufs phy control sequence
In reply to Greg Kroah-HartmanFrom: Chanho Park <[email protected]>
[ Upstream commit 3d73b200f9893d8f5ba5d105e8b69c8d16744fa2 ]
Since commit 1599069a62c6 ("phy: core: Warn when phy_power_on is called before phy_init"), the following warning has been reported:
phy_power_on was called before phy_init
To address this, we need to remove phy_power_on from exynos_ufs_phy_init() and move it after phy_init. phy_power_off and phy_exit are also necessary in exynos_ufs_remove().
--- drivers/ufs/host/ufs-exynos.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/ufs/host/ufs-exynos.c +10 -7
@@ -910,9 +910,13 @@ static int exynos_ufs_phy_init(struct exynos_ufs *ufs)if (ret) {dev_err (hba->dev,"%s: phy init failed, ret = %d\n" , __func__, ret); - goto out_exit_phy; +return ret; } + ret =phy_power_on (generic_phy); +if (ret) + goto out_exit_phy; +return 0 ; out_exit_phy:
@@ -1174,10 +1178,6 @@ static int exynos_ufs_init(struct ufs_hba *hba) goto out; } - ret =phy_power_on (ufs->phy); -if (ret) - goto phy_off; -exynos_ufs_priv_init (hba, ufs);if (ufs->drv_data->drv_init) {
@@ -1195,8 +1195,6 @@ static int exynos_ufs_init(struct ufs_hba *hba)exynos_ufs_config_smu (ufs);return 0 ; -phy_off: -phy_power_off (ufs->phy); out: hba->priv =NULL ;return ret;
@@ -1514,9 +1512,14 @@ static int exynos_ufs_probe(struct platform_device *pdev)static int exynos_ufs_remove (struct platform_device *pdev) {struct ufs_hba *hba =platform_get_drvdata (pdev); +struct exynos_ufs *ufs =ufshcd_get_variant (hba);pm_runtime_get_sync (&(pdev)->dev);ufshcd_remove (hba); + +phy_power_off (ufs->phy); +phy_exit (ufs->phy); +return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 294/365 pinctrl: intel: Check against matching data instead of ACPI companion
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit c551bd81d198bf1dcd4398d5454acdc0309dbe77 ]
In some cases we may get a platform device that has ACPI companion which is different to the pin control described in the ACPI tables. This is primarily happens when device is instantiated by board file.
In order to allow this device being enumerated, refactor intel_pinctrl_get_soc_data() to check the matching data instead of ACPI companion.
--- drivers/pinctrl/intel/pinctrl-intel.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/pinctrl/intel/pinctrl-intel.c +6 -8
@@ -1641,16 +1641,14 @@ EXPORT_SYMBOL_GPL(intel_pinctrl_probe_by_uid);const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data (struct platform_device *pdev) { +const struct intel_pinctrl_soc_data *const *table;const struct intel_pinctrl_soc_data *data =NULL ; -const struct intel_pinctrl_soc_data **table; -struct acpi_device *adev; -unsigned int i; - adev =ACPI_COMPANION (&pdev->dev); -if (adev) { -const void *match =device_get_match_data (&pdev->dev); + table =device_get_match_data (&pdev->dev); +if (table) { +struct acpi_device *adev =ACPI_COMPANION (&pdev->dev); +unsigned int i; - table = (const struct intel_pinctrl_soc_data **)match;for (i =0 ; table[i]; i++) {if (!strcmp (adev->pnp.unique_id, table[i]->uid)) { data = table[i];
@@ -1664,7 +1662,7 @@ const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data(struct platform_if (!id)return ERR_PTR (-ENODEV ); - table = (const struct intel_pinctrl_soc_data **)id->driver_data; + table = (const struct intel_pinctrl_soc_data *const *)id->driver_data; data = table[pdev->id]; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 295/365 cxl: Fix a memory leak in an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 3a15b45b5454da862376b5d69a4967f5c6fa1368 ]
A bitmap_zalloc() must be balanced by a corresponding bitmap_free() in the error handling path of afu_allocate_irqs().
--- drivers/misc/cxl/irq.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/cxl/irq.c +1 -0
@@ -350,6 +350,7 @@ int afu_allocate_irqs(struct cxl_context *ctx, u32 count) out: cxl_ops->release_irq_ranges (&ctx->irqs, ctx->afu->adapter); +bitmap_free (ctx->irq_bitmap);afu_irq_name_free (ctx);return -ENOMEM ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 296/365 PCI/ACPI: Guard ARM64-specific mcfg_quirks
In reply to Greg Kroah-HartmanFrom: Huacai Chen <[email protected]>
[ Upstream commit 40a6cc141b4b9580de140bcb3e893445708acc5d ]
Guard ARM64-specific quirks with CONFIG_ARM64 to avoid build errors, since mcfg_quirks will be shared by more than one architectures.
--- drivers/acpi/pci_mcfg.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/acpi/pci_mcfg.c +3 -0
@@ -41,6 +41,8 @@ struct mcfg_fixup { static struct mcfg_fixup mcfg_quirks[] = {/* { OEM_ID, OEM_TABLE_ID, REV, SEGMENT, BUS_RANGE, ops, cfgres }, */ +#ifdef CONFIG_ARM64 +#define AL_ECAM (table_id, rev, seg, ops) \ { "AMAZON", table_id, rev, seg, MCFG_BUS_ANY, ops }
@@ -169,6 +171,7 @@ static struct mcfg_fixup mcfg_quirks[] = {ALTRA_ECAM_QUIRK (1 ,13 ),ALTRA_ECAM_QUIRK (1 ,14 ), ALTRA_ECAM_QUIRK(1, 15), +#endif /* ARM64 */ };static char mcfg_oem_id[ACPI_OEM_ID_SIZE ];
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 297/365 um: add "noreboot" command line option for PANIC_TIMEOUT=-1 setups
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
[ Upstream commit dda520d07b95072a0b63f6c52a8eb566d08ea897 ]
QEMU has a -no-reboot option, which halts instead of reboots when the guest asks to reboot. This is invaluable when used with CONFIG_PANIC_TIMEOUT=-1 (and panic_on_warn), because it allows panics and warnings to be caught immediately in CI. Implement this in UML too, by way of a basic setup param.
--- arch/um/os-Linux/skas/process.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
arch/um/os-Linux/skas/process.c +16 -1
@@ -5,6 +5,7 @@*/ #include <stdlib.h> +#include <stdbool.h> #include <unistd.h> #include <sched.h> #include <errno.h>
@@ -707,10 +708,24 @@ void halt_skas(void)UML_LONGJMP (&initial_jmpbuf,INIT_JMP_HALT ); } +static bool noreboot; + +static int __init noreboot_cmd_param (char *str,int *add) +{ + noreboot = true; +return 0 ; +} + +__uml_setup ("noreboot" , noreboot_cmd_param, +"noreboot\n" +" Rather than rebooting, exit always, akin to QEMU's -no-reboot option.\n" +" This is useful if you're using CONFIG_PANIC_TIMEOUT in order to catch\n" +" crashes in CI\n" ); +void reboot_skas (void ) {block_signals_trace (); -UML_LONGJMP (&initial_jmpbuf,INIT_JMP_REBOOT ); +UML_LONGJMP (&initial_jmpbuf, noreboot ?INIT_JMP_HALT :INIT_JMP_REBOOT ); }void __switch_mm (struct mm_id *mm_idp)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 298/365 of: overlay: Move devicetree_corrupt() check up
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit e385b0ba6a137f34953e746d70d543660c2de1a0 ]
There is no point in doing several preparatory steps in of_overlay_fdt_apply(), only to see of_overlay_apply() return early because of a corrupt device tree.
Move the check for a corrupt device tree from of_overlay_apply() to of_overlay_fdt_apply(), to check for this as early as possible.
--- drivers/of/overlay.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/of/overlay.c +5 -6
@@ -903,12 +903,6 @@ static int of_overlay_apply(struct overlay_changeset *ovcs) {int ret =0 , ret_revert, ret_tmp; -if (devicetree_corrupt ()) { -pr_err ("devicetree state suspect, refuse to apply overlay\n" ); - ret = -EBUSY ; - goto out; - } - ret =of_resolve_phandles (ovcs->overlay_root);if (ret) goto out;
@@ -983,6 +977,11 @@ int of_overlay_fdt_apply(const void *overlay_fdt, u32 overlay_fdt_size, *ret_ovcs_id =0 ; +if (devicetree_corrupt ()) { +pr_err ("devicetree state suspect, refuse to apply overlay\n" ); +return -EBUSY ; + } +if (overlay_fdt_size <sizeof (struct fdt_header ) ||fdt_check_header (overlay_fdt)) {pr_err ("Invalid overlay_fdt header\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 299/365 dmaengine: dw-axi-dmac: do not print NULL LLI during error
In reply to Greg Kroah-HartmanFrom: Ben Dooks <[email protected]>
[ Upstream commit 86cb0defe0e275453bc39e856bb523eb425a6537 ]
During debugging we have seen an issue where axi_chan_dump_lli() is passed a NULL LLI pointer which ends up causing an OOPS due to trying to get fields from it. Simply print NULL LLI and exit to avoid this.
--- drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +5 -0
@@ -982,6 +982,11 @@ static int dw_axi_dma_chan_slave_config(struct dma_chan *dchan,static void axi_chan_dump_lli (struct axi_dma_chan *chan,struct axi_dma_hw_desc *desc) { +if (!desc->lli) { +dev_err (dchan2dev (&chan->vc.chan),"NULL LLI\n" ); +return ; + } + dev_err(dchan2dev(&chan->vc.chan), "SAR: 0x%llx DAR: 0x%llx LLP: 0x%llx BTS 0x%x CTL: 0x%x:%08x", le64_to_cpu(desc->lli->sar),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 300/365 dmaengine: dw-axi-dmac: ignore interrupt if no descriptor
In reply to Greg Kroah-HartmanFrom: Ben Dooks <[email protected]>
[ Upstream commit 820f5ce999d2f99961e88c16d65cd26764df0590 ]
If the channel has no descriptor and the interrupt is raised then the kernel will OOPS. Check the result of vchan_next_desc() in the handler axi_chan_block_xfer_complete() to avoid the error happening.
--- drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +6 -0
@@ -1054,6 +1054,11 @@ static void axi_chan_block_xfer_complete(struct axi_dma_chan *chan)/* The completed descriptor currently is in the head of vc list */ vd =vchan_next_desc (&chan->vc); +if (!vd) { +dev_err (chan2dev (chan),"BUG: %s, IRQ with no descriptors\n" , +axi_chan_name (chan)); + goto out; + }if (chan->cyclic) { desc =vd_to_axi_desc (vd);
@@ -1083,6 +1088,7 @@ static void axi_chan_block_xfer_complete(struct axi_dma_chan *chan)axi_chan_start_first_queued (chan); } +out:spin_unlock_irqrestore (&chan->vc.lock, flags); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 301/365 mmc: renesas_sdhi: newer SoCs dont need manual tap correction
In reply to Greg Kroah-HartmanFrom: Takeshi Saito <[email protected]>
[ Upstream commit 00e8c11c137b2e4b2bf54dc9881cf32e3441ddb4 ]
The newest Gen3 SoCs and Gen4 SoCs do not need manual tap correction with HS400 anymore. So, instead of checking the SDHI version, add a quirk flag and set manual tap correction only for affected SoCs.
--- drivers/mmc/host/renesas_sdhi.h | 1 + drivers/mmc/host/renesas_sdhi_core.c | 5 ++--- drivers/mmc/host/renesas_sdhi_internal_dmac.c | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-)
drivers/mmc/host/renesas_sdhi.h +1 -0
@@ -43,6 +43,7 @@ struct renesas_sdhi_quirks {bool hs400_4taps;bool fixed_addr_mode;bool dma_one_rx_only; +bool manual_tap_correction;u32 hs400_bad_taps;const u8 (*hs400_calib_table)[SDHI_CALIB_TABLE_MAX ]; };
drivers/mmc/host/renesas_sdhi_core.c +2 -3
@@ -380,8 +380,7 @@ static void renesas_sdhi_hs400_complete(struct mmc_host *mmc)sd_scc_write32 (host, priv,SH_MOBILE_SDHI_SCC_DT2FF , priv->scc_tappos_hs400); -/* Gen3 can't do automatic tap correction with HS400, so disable it */ -if (sd_ctrl_read16 (host,CTL_VERSION ) ==SDHI_VER_GEN3_SDMMC ) +if (priv->quirks && priv->quirks->manual_tap_correction)sd_scc_write32 (host, priv,SH_MOBILE_SDHI_SCC_RVSCNTL , ~SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN &sd_scc_read32 (host, priv,SH_MOBILE_SDHI_SCC_RVSCNTL ));
@@ -718,7 +717,7 @@ static bool renesas_sdhi_manual_correction(struct tmio_mmc_host *host, bool use_sd_scc_write32 (host, priv,SH_MOBILE_SDHI_SCC_RVSREQ ,0 );/* Change TAP position according to correction status */ -if (sd_ctrl_read16 (host,CTL_VERSION ) ==SDHI_VER_GEN3_SDMMC && +if (priv->quirks && priv->quirks->manual_tap_correction && host->mmc->ios.timing ==MMC_TIMING_MMC_HS400 ) {u32 bad_taps = priv->quirks ? priv->quirks->hs400_bad_taps :0 ;/*
drivers/mmc/host/renesas_sdhi_internal_dmac.c +6 -0
@@ -170,6 +170,7 @@ static const struct renesas_sdhi_quirks sdhi_quirks_4tap_nohs400_one_rx = {static const struct renesas_sdhi_quirks sdhi_quirks_4tap = { .hs400_4taps = true, .hs400_bad_taps =BIT (2 ) |BIT (3 ) |BIT (6 ) |BIT (7 ), + .manual_tap_correction = true, };static const struct renesas_sdhi_quirks sdhi_quirks_nohs400 = {
@@ -182,25 +183,30 @@ static const struct renesas_sdhi_quirks sdhi_quirks_fixed_addr = {static const struct renesas_sdhi_quirks sdhi_quirks_bad_taps1357 = { .hs400_bad_taps =BIT (1 ) |BIT (3 ) |BIT (5 ) |BIT (7 ), + .manual_tap_correction = true, };static const struct renesas_sdhi_quirks sdhi_quirks_bad_taps2367 = { .hs400_bad_taps =BIT (2 ) |BIT (3 ) |BIT (6 ) |BIT (7 ), + .manual_tap_correction = true, };static const struct renesas_sdhi_quirks sdhi_quirks_r8a7796_es13 = { .hs400_4taps = true, .hs400_bad_taps =BIT (2 ) |BIT (3 ) |BIT (6 ) |BIT (7 ), .hs400_calib_table = r8a7796_es13_calib_table, + .manual_tap_correction = true, };static const struct renesas_sdhi_quirks sdhi_quirks_r8a77965 = { .hs400_bad_taps =BIT (2 ) |BIT (3 ) |BIT (6 ) |BIT (7 ), .hs400_calib_table = r8a77965_calib_table, + .manual_tap_correction = true, };static const struct renesas_sdhi_quirks sdhi_quirks_r8a77990 = { .hs400_calib_table = r8a77990_calib_table, + .manual_tap_correction = true, };/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 302/365 ACPI: PPTT: Leave the table mapped for the runtime usage
In reply to Greg Kroah-HartmanFrom: Sudeep Holla <[email protected]>
[ Upstream commit 0c80f9e165f8f9cca743d7b6cbdb54362da297e0 ]
Currently, everytime an information needs to be fetched from the PPTT, the table is mapped via acpi_get_table() and unmapped after the use via acpi_put_table() which is fine. However we do this at runtime especially when the CPU is hotplugged out and plugged in back since we re-populate the cache topology and other information.
However, with the support to fetch LLC information from the PPTT in the cpuhotplug path which is executed in the atomic context, it is preferred to avoid mapping and unmapping of the PPTT for every single use as the acpi_get_table() might sleep waiting for a mutex.
In order to avoid the same, the table is needs to just mapped once on the boot CPU and is never unmapped allowing it to be used at runtime with out the hassle of mapping and unmapping the table.
--
Hi Rafael,
Sorry to bother you again on this PPTT changes. Guenter reported an issue with lockdep enabled in -next that include my cacheinfo/arch_topology changes to utilise LLC from PPTT in the CPU hotplug path.
Please ack the change once you are happy so that I can get it merged with other fixes via Greg's tree.
Regards,
Sudeep
--- drivers/acpi/pptt.c | 102 ++++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 55 deletions(-)
drivers/acpi/pptt.c +47 -55
@@ -532,21 +532,37 @@ static int topology_get_acpi_cpu_tag(struct acpi_table_header *table,return -ENOENT ; } + +static struct acpi_table_header *acpi_get_pptt (void ) +{ +static struct acpi_table_header *pptt; +acpi_status status; + +/* +* PPTT will be used at runtime on every CPU hotplug in path, so we +* don't need to call acpi_put_table() to release the table mapping. +*/ +if (!pptt) { + status =acpi_get_table (ACPI_SIG_PPTT ,0 , &pptt); +if (ACPI_FAILURE (status)) +acpi_pptt_warn_missing (); + } + +return pptt; +} +static int find_acpi_cpu_topology_tag (unsigned int cpu,int level,int flag) {struct acpi_table_header *table; -acpi_status status;int retval; - status =acpi_get_table (ACPI_SIG_PPTT ,0 , &table); -if (ACPI_FAILURE (status)) { -acpi_pptt_warn_missing (); + table =acpi_get_pptt (); +if (!table)return -ENOENT ; - } + retval =topology_get_acpi_cpu_tag (table, cpu, level, flag);pr_debug ("Topology Setup ACPI CPU %d, level %d ret = %d\n" , cpu, level, retval); -acpi_put_table (table);return retval; }
@@ -567,16 +583,13 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag)static int check_acpi_cpu_flag (unsigned int cpu,int rev,u32 flag) {struct acpi_table_header *table; -acpi_status status;u32 acpi_cpu_id =get_acpi_id_for_cpu (cpu);struct acpi_pptt_processor *cpu_node =NULL ;int ret = -ENOENT ; - status =acpi_get_table (ACPI_SIG_PPTT ,0 , &table); -if (ACPI_FAILURE (status)) { -acpi_pptt_warn_missing (); -return ret; - } + table =acpi_get_pptt (); +if (!table) +return -ENOENT ;if (table->revision >= rev) cpu_node =acpi_find_processor_node (table, acpi_cpu_id);
@@ -584,8 +597,6 @@ static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag)if (cpu_node) ret = (cpu_node->flags & flag) !=0 ; -acpi_put_table (table); -return ret; }
@@ -604,18 +615,15 @@ int acpi_find_last_cache_level(unsigned int cpu)u32 acpi_cpu_id;struct acpi_table_header *table;int number_of_levels =0 ; -acpi_status status; + + table =acpi_get_pptt (); +if (!table) +return -ENOENT ;pr_debug ("Cache Setup find last level CPU=%d\n" , cpu); acpi_cpu_id =get_acpi_id_for_cpu (cpu); - status =acpi_get_table (ACPI_SIG_PPTT ,0 , &table); -if (ACPI_FAILURE (status)) { -acpi_pptt_warn_missing (); - }else { - number_of_levels =acpi_find_cache_levels (table, acpi_cpu_id); -acpi_put_table (table); - } + number_of_levels =acpi_find_cache_levels (table, acpi_cpu_id);pr_debug ("Cache Setup find last level level=%d\n" , number_of_levels);return number_of_levels;
@@ -637,20 +645,16 @@ int acpi_find_last_cache_level(unsigned int cpu)int cache_setup_acpi (unsigned int cpu) {struct acpi_table_header *table; -acpi_status status; -pr_debug ("Cache Setup ACPI CPU %d\n" , cpu); - - status =acpi_get_table (ACPI_SIG_PPTT ,0 , &table); -if (ACPI_FAILURE (status)) { -acpi_pptt_warn_missing (); + table =acpi_get_pptt (); +if (!table)return -ENOENT ; - } + +pr_debug ("Cache Setup ACPI CPU %d\n" , cpu);cache_setup_acpi_cpu (table, cpu); -acpi_put_table (table); -return status; +return 0 ; }/**
@@ -766,50 +770,38 @@ int find_acpi_cpu_topology_package(unsigned int cpu)int find_acpi_cpu_topology_cluster (unsigned int cpu) {struct acpi_table_header *table; -acpi_status status;struct acpi_pptt_processor *cpu_node, *cluster_node;u32 acpi_cpu_id;int retval;int is_thread; - status =acpi_get_table (ACPI_SIG_PPTT ,0 , &table); -if (ACPI_FAILURE (status)) { -acpi_pptt_warn_missing (); + table =acpi_get_pptt (); +if (!table)return -ENOENT ; - } acpi_cpu_id =get_acpi_id_for_cpu (cpu); cpu_node =acpi_find_processor_node (table, acpi_cpu_id); -if (cpu_node ==NULL || !cpu_node->parent) { - retval = -ENOENT ; - goto put_table; - } +if (!cpu_node || !cpu_node->parent) +return -ENOENT ; is_thread = cpu_node->flags &ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD ; cluster_node =fetch_pptt_node (table, cpu_node->parent); -if (cluster_node ==NULL ) { - retval = -ENOENT ; - goto put_table; - } +if (!cluster_node) +return -ENOENT ; +if (is_thread) { -if (!cluster_node->parent) { - retval = -ENOENT ; - goto put_table; - } +if (!cluster_node->parent) +return -ENOENT ; + cluster_node =fetch_pptt_node (table, cluster_node->parent); -if (cluster_node ==NULL ) { - retval = -ENOENT ; - goto put_table; - } +if (!cluster_node) +return -ENOENT ; }if (cluster_node->flags &ACPI_PPTT_ACPI_PROCESSOR_ID_VALID ) retval = cluster_node->acpi_processor_id;else retval =ACPI_PTR_DIFF (cluster_node, table); -put_table: -acpi_put_table (table); -return retval; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 303/365 RDMA/rxe: Limit the number of calls to each tasklet
In reply to Greg Kroah-HartmanFrom: Bob Pearson <[email protected]>
[ Upstream commit eff6d998ca297cb0b2e53b032a56cf8e04dd8b17 ]
Limit the maximum number of calls to each tasklet from rxe_do_task() before yielding the cpu. When the limit is reached reschedule the tasklet and exit the calling loop. This patch prevents one tasklet from consuming 100% of a cpu core and causing a deadlock or soft lockup.
--- drivers/infiniband/sw/rxe/rxe_param.h | 6 ++++++ drivers/infiniband/sw/rxe/rxe_task.c | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-)
drivers/infiniband/sw/rxe/rxe_param.h +6 -0
@@ -105,6 +105,12 @@ enum rxe_device_param {RXE_INFLIGHT_SKBS_PER_QP_HIGH =64 ,RXE_INFLIGHT_SKBS_PER_QP_LOW =16 , +/* Max number of interations of each tasklet +* before yielding the cpu to let other +* work make progress +*/ +RXE_MAX_ITERATIONS =1024 , +/* Delay before calling arbiter timer */ RXE_NSEC_ARB_TIMER_DELAY = 200,
drivers/infiniband/sw/rxe/rxe_task.c +12 -4
@@ -8,7 +8,7 @@#include <linux/interrupt.h> #include <linux/hardirq.h> -#include "rxe_task.h" +#include "rxe.h" int __rxe_do_task (struct rxe_task *task)
@@ -33,6 +33,7 @@ void rxe_do_task(struct tasklet_struct *t)int cont;int ret;struct rxe_task *task =from_tasklet (task, t, tasklet); +unsigned int iterations =RXE_MAX_ITERATIONS ;spin_lock_bh (&task->state_lock);switch (task->state) {
@@ -61,13 +62,20 @@ void rxe_do_task(struct tasklet_struct *t)spin_lock_bh (&task->state_lock);switch (task->state) {case TASK_STATE_BUSY : -if (ret) +if (ret) { task->state =TASK_STATE_START ; -else + }else if (iterations--) { cont =1 ; + }else { +/* reschedule the tasklet and exit +* the loop to give up the cpu +*/ +tasklet_schedule (&task->tasklet); + task->state =TASK_STATE_START ; + }break ; -/* soneone tried to run the task since the last time we called +/* someone tried to run the task since the last time we called * func, so we will call one more time regardless of the * return value */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 304/365 csky/kprobe: reclaim insn_slot on kprobe unregistration
In reply to Greg Kroah-HartmanFrom: Liao Chang <[email protected]>
[ Upstream commit a2310c74d418deca0f1d749c45f1f43162510f51 ]
On kprobe registration kernel allocate one insn_slot for new kprobe, but it forget to reclaim the insn_slot on unregistration, leading to a potential leakage.
--- arch/csky/kernel/probes/kprobes.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/csky/kernel/probes/kprobes.c +4 -0
@@ -124,6 +124,10 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)void __kprobes arch_remove_kprobe (struct kprobe *p) { +if (p->ainsn.api.insn) { +free_insn_slot (p->ainsn.api.insn,0 ); + p->ainsn.api.insn =NULL ; + } }static void __kprobes save_previous_kprobe (struct kprobe_ctlblk *kcb)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 305/365 selftests/kprobe: Do not test for GRP/ without event failures
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
[ Upstream commit f5eab65ff2b76449286d18efc7fee3e0b72f7d9b ]
A new feature is added where kprobes (and other probes) do not need to explicitly state the event name when creating a probe. The event name will come from what is being attached.
That is:
# echo 'p:foo/ vfs_read' > kprobe_events
Will no longer error, but instead create an event:
# cat kprobe_events p:foo/p_vfs_read_0 vfs_read
This should not be tested as an error case anymore. Remove it from the selftest as now this feature "breaks" the selftest as it no longer fails as expected.
--- .../selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc | 1 - 1 file changed, 1 deletion(-)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +0 -1
@@ -21,7 +21,6 @@ check_error 'p:^/bar vfs_read' # NO_GROUP_NAME check_error 'p:^12345678901234567890123456789012345678901234567890123456789012345/bar vfs_read' # GROUP_TOO_LONG check_error 'p:^foo.1/bar vfs_read' # BAD_GROUP_NAME -check_error 'p:foo/^ vfs_read' # NO_EVENT_NAME check_error 'p:foo/^12345678901234567890123456789012345678901234567890123456789012345 vfs_read' # EVENT_TOO_LONG check_error 'p:foo/^bar.1 vfs_read' # BAD_EVENT_NAME
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 306/365 dmaengine: tegra: Add terminate() for Tegra234
In reply to Greg Kroah-HartmanFrom: Akhil R <[email protected]>
[ Upstream commit 36834c67016794b8fa03d7672a5b7f2cc4529298 ]
In certain cases where the DMA client bus gets corrupted or if the end device ceases to send/receive data, DMA can wait indefinitely for the data to be received/sent. Attempting to terminate the transfer will put the DMA in pause flush mode and it remains there.
The channel is irrecoverable once this pause times out in Tegra194 and earlier chips. Whereas, from Tegra234, it can be recovered by disabling the channel and reprograming it.
Hence add a new terminate() function that ignores the outcome of dma_pause() so that terminate_all() can proceed to disable the channel.
--- drivers/dma/tegra186-gpc-dma.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/dma/tegra186-gpc-dma.c +24 -2
@@ -157,8 +157,8 @@* If any burst is in flight and DMA paused then this is the time to complete * on-flight burst and update DMA status register. */ -#define TEGRA_GPCDMA_BURST_COMPLETE_TIME 20 -#define TEGRA_GPCDMA_BURST_COMPLETION_TIMEOUT 100 +#define TEGRA_GPCDMA_BURST_COMPLETE_TIME 10 +#define TEGRA_GPCDMA_BURST_COMPLETION_TIMEOUT 5000/* 5 msec */ /* Channel base address offset from GPCDMA base address */ #define TEGRA_GPCDMA_CHANNEL_BASE_ADD_OFFSET 0x20000
@@ -432,6 +432,17 @@ static int tegra_dma_device_resume(struct dma_chan *dc)return 0 ; } +static inline int tegra_dma_pause_noerr (struct tegra_dma_channel *tdc) +{ +/* Return 0 irrespective of PAUSE status. +* This is useful to recover channels that can exit out of flush +* state when the channel is disabled. +*/ + +tegra_dma_pause (tdc); +return 0 ; +} +static void tegra_dma_disable (struct tegra_dma_channel *tdc) {u32 csr, status;
@@ -1292,6 +1303,14 @@ static const struct tegra_dma_chip_data tegra194_dma_chip_data = { .terminate = tegra_dma_pause, }; +static const struct tegra_dma_chip_data tegra234_dma_chip_data = { + .nr_channels =31 , + .channel_reg_size =SZ_64K , + .max_dma_count =SZ_1G , + .hw_support_pause = true, + .terminate = tegra_dma_pause_noerr, +}; +static const struct of_device_id tegra_dma_of_match[] = { { .compatible ="nvidia,tegra186-gpcdma" ,
@@ -1299,6 +1318,9 @@ static const struct of_device_id tegra_dma_of_match[] = { }, { .compatible = "nvidia,tegra194-gpcdma", .data = &tegra194_dma_chip_data, + }, { + .compatible = "nvidia,tegra234-gpcdma", + .data = &tegra234_dma_chip_data, }, { }, };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 307/365 dmaengine: sprd: Cleanup in .remove() after pm_runtime_get_sync() failed
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 1e42f82cbec7b2cc4873751e7791e6611901c5fc ]
It's not allowed to quit remove early without cleaning up completely. Otherwise this results in resource leaks that probably yield graver problems later. Here for example some tasklets might survive the lifetime of the sprd-dma device and access sdev which is freed after .remove() returns.
As none of the device freeing requires an active device, just ignore the return value of pm_runtime_get_sync().
--- drivers/dma/sprd-dma.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/dma/sprd-dma.c +1 -4
@@ -1237,11 +1237,8 @@ static int sprd_dma_remove(struct platform_device *pdev) {struct sprd_dma_dev *sdev =platform_get_drvdata (pdev);struct sprd_dma_chn *c, *cn; -int ret; - ret =pm_runtime_get_sync (&pdev->dev); -if (ret <0 ) -return ret; +pm_runtime_get_sync (&pdev->dev);/* explicitly free the irq */ if (sdev->irq >0 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 308/365 Revert "RDMA/rxe: Create duplicate mapping tables for FMRs"
In reply to Greg Kroah-HartmanFrom: Li Zhijian <[email protected]>
[ Upstream commit 1e75550648da1fa1cd1969e7597355de8fe8caf6 ]
Below 2 commits will be reverted:
commit 8ff5f5d9d8cf ("RDMA/rxe: Prevent double freeing rxe_map_set()") commit 647bf13ce944 ("RDMA/rxe: Create duplicate mapping tables for FMRs")
The community has a few bug reports which pointed this commit at last. Some proposals are raised up in the meantime but all of them have no follow-up operation.
The previous commit led the map_set of FMR to be not available any more if the MR is registered again after invalidating. Although the mentioned patch try to fix a potential race in building/accessing the same table for fast memory regions, it broke rtrs etc ULPs. Since the latter could be worse, revert this patch.
With previous commit, it's observed that a same MR in rnbd server will trigger below code path:
-> rxe_mr_init_fast()
|-> alloc map_set() # map_set is uninitialized
|...-> rxe_map_mr_sg() # build the map_set
|-> rxe_mr_set_page()
|...-> rxe_reg_fast_mr() # mr->state change to VALID from FREE that means
# we can access host memory(such rxe_mr_copy)
|...-> rxe_invalidate_mr() # mr->state change to FREE from VALID
|...-> rxe_reg_fast_mr() # mr->state change to VALID from FREE,
# but map_set was not built again
|...-> rxe_mr_copy() # kernel crash due to access wild addresses
# that lookup from the map_setThe backtraces are not always identical.
[1st]----------
RIP: 0010:lookup_iova+0x66/0xa0 [rdma_rxe] Code: 00 00 00 48 d3 ee 89 32 c3 4c 8b 18 49 8b 3b 48 8b 47 08 48 39 c6 72 38 48 29 c6 45 31 d2 b8 01 00 00 00 48 63 c8 48 c1 e1 04 <48> 8b 4c 0f 08 48 39 f1 77 21 83 c0 01 48 29 ce 3d 00 01 00 00 75 RSP: 0018:ffffb7ff80063bf0 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff9b9949d86800 RCX: 0000000000000000 RDX: ffffb7ff80063c00 RSI: 0000000049f6b378 RDI: 002818da00000004 RBP: 0000000000000120 R08: ffffb7ff80063c08 R09: ffffb7ff80063c04 R10: 0000000000000002 R11: ffff9b9916f7eef8 R12: ffff9b99488a0038 R13: ffff9b99488a0038 R14: ffff9b9914fb346a R15: ffff9b990ab27000 FS: 0000000000000000(0000) GS:ffff9b997dc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007efc33a98ed0 CR3: 0000000014f32004 CR4: 00000000001706f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> rxe_mr_copy.part.0+0x6f/0x140 [rdma_rxe] rxe_responder+0x12ee/0x1b60 [rdma_rxe] ? rxe_icrc_check+0x7e/0x100 [rdma_rxe] ? rxe_rcv+0x1d0/0x780 [rdma_rxe] ? rxe_icrc_hdr.isra.0+0xf6/0x160 [rdma_rxe] rxe_do_task+0x67/0xb0 [rdma_rxe] rxe_xmit_packet+0xc7/0x210 [rdma_rxe] rxe_requester+0x680/0xee0 [rdma_rxe] ? update_load_avg+0x5f/0x690 ? update_load_avg+0x5f/0x690 ? rtrs_clt_recv_done+0x1b/0x30 [rtrs_client]
[2nd]----------
RIP: 0010:rxe_mr_copy.part.0+0xa8/0x140 [rdma_rxe] Code: 00 00 49 c1 e7 04 48 8b 00 4c 8d 2c d0 48 8b 44 24 10 4d 03 7d 00 85 ed 7f 10 eb 6c 89 54 24 0c 49 83 c7 10 31 c0 85 ed 7e 5e <49> 8b 3f 8b 14 24 4c 89 f6 48 01 c7 85 d2 74 06 48 89 fe 4c 89 f7 RSP: 0018:ffffae3580063bf8 EFLAGS: 00010202 RAX: 0000000000018978 RBX: ffff9d7ef7a03600 RCX: 0000000000000008 RDX: 000000000000007c RSI: 000000000000007c RDI: ffff9d7ef7a03600 RBP: 0000000000000120 R08: ffffae3580063c08 R09: ffffae3580063c04 R10: ffff9d7efece0038 R11: ffff9d7ec4b1db00 R12: ffff9d7efece0038 R13: ffff9d7ef4098260 R14: ffff9d7f11e23c6a R15: 4c79500065708144 FS: 0000000000000000(0000) GS:ffff9d7f3dc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fce47276c60 CR3: 0000000003f66004 CR4: 00000000001706f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> rxe_responder+0x12ee/0x1b60 [rdma_rxe] ? rxe_icrc_check+0x7e/0x100 [rdma_rxe] ? rxe_rcv+0x1d0/0x780 [rdma_rxe] ? rxe_icrc_hdr.isra.0+0xf6/0x160 [rdma_rxe] rxe_do_task+0x67/0xb0 [rdma_rxe] rxe_xmit_packet+0xc7/0x210 [rdma_rxe] rxe_requester+0x680/0xee0 [rdma_rxe] ? update_load_avg+0x5f/0x690 ? update_load_avg+0x5f/0x690 ? rtrs_clt_recv_done+0x1b/0x30 [rtrs_client] rxe_do_task+0x67/0xb0 [rdma_rxe] tasklet_action_common.constprop.0+0x92/0xc0 __do_softirq+0xe1/0x2d8 run_ksoftirqd+0x21/0x30 smpboot_thread_fn+0x183/0x220 ? sort_range+0x20/0x20 kthread+0xe2/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x22/0x30
--- drivers/infiniband/sw/rxe/rxe_loc.h | 1 - drivers/infiniband/sw/rxe/rxe_mr.c | 199 +++++++++----------------- drivers/infiniband/sw/rxe/rxe_mw.c | 6 +- drivers/infiniband/sw/rxe/rxe_verbs.c | 39 +++-- drivers/infiniband/sw/rxe/rxe_verbs.h | 21 ++- 5 files changed, 104 insertions(+), 162 deletions(-)
drivers/infiniband/sw/rxe/rxe_loc.h +0 -1
@@ -79,7 +79,6 @@ int mr_check_range(struct rxe_mr *mr, u64 iova, size_t length);int advance_dma_data (struct rxe_dma_info *dma,unsigned int length);int rxe_invalidate_mr (struct rxe_qp *qp,u32 key);int rxe_reg_fast_mr (struct rxe_qp *qp,struct rxe_send_wqe *wqe); -int rxe_mr_set_page (struct ib_mr *ibmr,u64 addr);int rxe_dereg_mr (struct ib_mr *ibmr,struct ib_udata *udata);void rxe_mr_cleanup (struct rxe_pool_elem *elem);
drivers/infiniband/sw/rxe/rxe_mr.c +66 -133
364 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_mw.c +3 -3
@@ -112,15 +112,15 @@ static int rxe_check_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe,/* C10-75 */ if (mw->access &IB_ZERO_BASED ) { -if (unlikely (wqe->wr.wr.mw.length > mr->cur_map_set->length)) { +if (unlikely (wqe->wr.wr.mw.length > mr->length)) {pr_err_once ("attempt to bind a ZB MW outside of the MR\n" );return -EINVAL ; } }else { -if (unlikely ((wqe->wr.wr.mw.addr < mr->cur_map_set->iova) || +if (unlikely ((wqe->wr.wr.mw.addr < mr->iova) || ((wqe->wr.wr.mw.addr + wqe->wr.wr.mw.length) > - (mr->cur_map_set->iova + mr->cur_map_set->length)))) { + (mr->iova + mr->length)))) {pr_err_once ("attempt to bind a VA MW outside of the MR\n" );return -EINVAL ;
drivers/infiniband/sw/rxe/rxe_verbs.c +27 -12
@@ -967,26 +967,41 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type,return ERR_PTR (err); } -/* build next_map_set from scatterlist -* The IB_WR_REG_MR WR will swap map_sets -*/ +static int rxe_set_page (struct ib_mr *ibmr,u64 addr) +{ +struct rxe_mr *mr =to_rmr (ibmr); +struct rxe_map *map; +struct rxe_phys_buf *buf; + +if (unlikely (mr->nbuf == mr->num_buf)) +return -ENOMEM ; + + map = mr->map[mr->nbuf /RXE_BUF_PER_MAP ]; + buf = &map->buf[mr->nbuf %RXE_BUF_PER_MAP ]; + + buf->addr = addr; + buf->size = ibmr->page_size; + mr->nbuf++; + +return 0 ; +} +static int rxe_map_mr_sg (struct ib_mr *ibmr,struct scatterlist *sg,int sg_nents,unsigned int *sg_offset) {struct rxe_mr *mr =to_rmr (ibmr); -struct rxe_map_set *set = mr->next_map_set;int n; - set->nbuf =0 ; + mr->nbuf =0 ; - n =ib_sg_to_pages (ibmr, sg, sg_nents, sg_offset, rxe_mr_set_page); + n =ib_sg_to_pages (ibmr, sg, sg_nents, sg_offset, rxe_set_page); - set->va = ibmr->iova; - set->iova = ibmr->iova; - set->length = ibmr->length; - set->page_shift =ilog2 (ibmr->page_size); - set->page_mask = ibmr->page_size -1 ; - set->offset = set->iova & set->page_mask; + mr->va = ibmr->iova; + mr->iova = ibmr->iova; + mr->length = ibmr->length; + mr->page_shift =ilog2 (ibmr->page_size); + mr->page_mask = ibmr->page_size -1 ; + mr->offset = mr->iova & mr->page_mask;return n; }
drivers/infiniband/sw/rxe/rxe_verbs.h +8 -13
@@ -289,17 +289,6 @@ struct rxe_map {struct rxe_phys_buf buf[RXE_BUF_PER_MAP ]; }; -struct rxe_map_set { -struct rxe_map **map; -u64 va; -u64 iova; -size_t length; -u32 offset; -u32 nbuf; -int page_shift; -int page_mask; -}; -static inline int rkey_is_mw (u32 rkey) {u32 index = rkey >>8 ;
@@ -317,20 +306,26 @@ struct rxe_mr {u32 rkey;enum rxe_mr_state state;enum ib_mr_type type; +u64 va; +u64 iova; +size_t length; +u32 offset;int access; +int page_shift; +int page_mask;int map_shift;int map_mask;u32 num_buf; +u32 nbuf;u32 max_buf;u32 num_map;atomic_t num_mw; -struct rxe_map_set *cur_map_set; -struct rxe_map_set *next_map_set; +struct rxe_map **map; };enum rxe_mw_state {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 309/365 openrisc: io: Define iounmap argument as volatile
In reply to Greg Kroah-HartmanFrom: Stafford Horne <[email protected]>
[ Upstream commit 52e0ea900202d23843daee8f7089817e81dd3dd7 ]
When OpenRISC enables PCI it allows for more drivers to be compiled resulting in exposing the following with -Werror.
drivers/video/fbdev/riva/fbdev.c: In function 'rivafb_probe':
drivers/video/fbdev/riva/fbdev.c:2062:42: error:
passing argument 1 of 'iounmap' discards 'volatile' qualifier from pointer target type
drivers/video/fbdev/nvidia/nvidia.c: In function 'nvidiafb_probe':
drivers/video/fbdev/nvidia/nvidia.c:1414:20: error:
passing argument 1 of 'iounmap' discards 'volatile' qualifier from pointer target type
drivers/scsi/aic7xxx/aic7xxx_osm.c: In function 'ahc_platform_free':
drivers/scsi/aic7xxx/aic7xxx_osm.c:1231:41: error:
passing argument 1 of 'iounmap' discards 'volatile' qualifier from pointer target type
Most architectures define the iounmap argument to be volatile. To fix this issue we do the same for OpenRISC. This patch must go before PCI is enabled on OpenRISC to avoid any compile failures.
--- arch/openrisc/include/asm/io.h | 2 +- arch/openrisc/mm/ioremap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/openrisc/include/asm/io.h +1 -1
@@ -31,7 +31,7 @@void __iomem *ioremap (phys_addr_t offset,unsigned long size);#define iounmap iounmap -extern void iounmap (void __iomem *addr); +extern void iounmap (volatile void __iomem *addr);#include <asm-generic/io.h>
arch/openrisc/mm/ioremap.c +1 -1
@@ -77,7 +77,7 @@ void __iomem *__ref ioremap(phys_addr_t addr, unsigned long size) }EXPORT_SYMBOL (ioremap); -void iounmap (void __iomem *addr) +void iounmap (volatile void __iomem *addr) {/* If the page is from the fixmap pool then we just clear out * the fixmap mapping.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 310/365 phy: samsung: phy-exynos-pcie: sanitize init/power_on callbacks
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
[ Upstream commit f2812227bb07e2eaee74253f11cea1576945df31 ]
The exynos-pcie driver called phy_power_on() before phy_init() for some historical reasons. However the generic PHY framework assumes that the proper sequence is to call phy_init() first, then phy_power_on(). The operations done by both functions should be considered as one action and as such they are called by the exynos-pcie driver (without doing anything between them). The initialization is just a sequence of register writes, which cannot be altered without breaking the hardware operation.
To match the generic PHY framework requirement, simply move all register writes to the phy_init()/phy_exit() and drop power_on()/power_off() callbacks. This way the driver will also work with the old (incorrect) PHY initialization call sequence.
--- drivers/phy/samsung/phy-exynos-pcie.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-)
drivers/phy/samsung/phy-exynos-pcie.c +9 -16
@@ -51,6 +51,13 @@ static int exynos5433_pcie_phy_init(struct phy *phy) {struct exynos_pcie_phy *ep =phy_get_drvdata (phy); +regmap_update_bits (ep->pmureg,EXYNOS5433_PMU_PCIE_PHY_OFFSET , +BIT (0 ),1 ); +regmap_update_bits (ep->fsysreg,PCIE_EXYNOS5433_PHY_GLOBAL_RESET , +PCIE_APP_REQ_EXIT_L1_MODE ,0 ); +regmap_update_bits (ep->fsysreg,PCIE_EXYNOS5433_PHY_L1SUB_CM_CON , +PCIE_REFCLK_GATING_EN ,0 ); +regmap_update_bits (ep->fsysreg,PCIE_EXYNOS5433_PHY_COMMON_RESET ,PCIE_PHY_RESET ,1 ); regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_MAC_RESET,
@@ -109,20 +116,7 @@ static int exynos5433_pcie_phy_init(struct phy *phy)return 0 ; } -static int exynos5433_pcie_phy_power_on (struct phy *phy) -{ -struct exynos_pcie_phy *ep =phy_get_drvdata (phy); - -regmap_update_bits (ep->pmureg,EXYNOS5433_PMU_PCIE_PHY_OFFSET , -BIT (0 ),1 ); -regmap_update_bits (ep->fsysreg,PCIE_EXYNOS5433_PHY_GLOBAL_RESET , -PCIE_APP_REQ_EXIT_L1_MODE ,0 ); -regmap_update_bits (ep->fsysreg,PCIE_EXYNOS5433_PHY_L1SUB_CM_CON , -PCIE_REFCLK_GATING_EN ,0 ); -return 0 ; -} - -static int exynos5433_pcie_phy_power_off (struct phy *phy) +static int exynos5433_pcie_phy_exit (struct phy *phy) {struct exynos_pcie_phy *ep =phy_get_drvdata (phy);
@@ -135,8 +129,7 @@ static int exynos5433_pcie_phy_power_off(struct phy *phy)static const struct phy_ops exynos5433_phy_ops = { .init = exynos5433_pcie_phy_init, - .power_on = exynos5433_pcie_phy_power_on, - .power_off = exynos5433_pcie_phy_power_off, + .exit = exynos5433_pcie_phy_exit, .owner =THIS_MODULE , };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 311/365 md: Notify sysfs sync_completed in md_reap_sync_thread()
In reply to Greg Kroah-HartmanFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit 9973f0fa7d20269fe6fefe6333997fb5914449c1 ]
The mdadm test 07layouts randomly produces a kernel hung task deadlock. The deadlock is caused by the suspend_lo/suspend_hi files being set by the mdadm background process during reshape and not being cleared because the process hangs. (Leaving aside the issue of the fragility of freezing kernel tasks by buggy userspace processes...)
When the background mdadm process hangs it, is waiting (without a timeout) on a change to the sync_completed file signalling that the reshape has completed. The process is woken up a couple times when the reshape finishes but it is woken up before MD_RECOVERY_RUNNING is cleared so sync_completed_show() reports 0 instead of "none".
To fix this, notify the sysfs file in md_reap_sync_thread() after MD_RECOVERY_RUNNING has been cleared. This wakes up mdadm and causes it to continue and write to suspend_lo/suspend_hi to allow IO to continue.
--- drivers/md/md.c | 1 + 1 file changed, 1 insertion(+)
drivers/md/md.c +1 -0
@@ -9466,6 +9466,7 @@ void md_reap_sync_thread(struct mddev *mddev)wake_up (&resync_wait);/* flag recovery needed just to double check */ set_bit (MD_RECOVERY_NEEDED , &mddev->recovery); +sysfs_notify_dirent_safe (mddev->sysfs_completed);sysfs_notify_dirent_safe (mddev->sysfs_action);md_new_event ();if (mddev->event_work.func)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 312/365 md/raid5: Make logic blocking check consistent with logic that blocks
In reply to Greg Kroah-HartmanFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit 6e3f50d30af847bebce072182bd735e90a294c6a ]
The check in raid5_make_request differs very slightly from the logic that causes it to block lower down. This likely does not cause a bug as the check is fuzzy anyway (as reshape may move on between the first check and the subsequent check). However, make it consistent so it can be cleaned up in a subsequent patch.
The condition which causes the schedule is:
!(mddev->reshape_backwards ? logical_sector < conf->reshape_progress :
logical_sector >= conf->reshape_progress) &&
(mddev->reshape_backwards ? logical_sector < conf->reshape_safe :
logical_sector >= conf->reshape_safe)
The condition that causes the early bailout is made to match this.
--- drivers/md/raid5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid5.c +1 -1
@@ -5841,7 +5841,7 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi)if ((bi->bi_opf &REQ_NOWAIT ) && (conf->reshape_progress != MaxSector) && (mddev->reshape_backwards - ? (logical_sector > conf->reshape_progress && logical_sector <= conf->reshape_safe) + ? (logical_sector >= conf->reshape_progress && logical_sector < conf->reshape_safe) : (logical_sector >= conf->reshape_safe && logical_sector < conf->reshape_progress))) {bio_wouldblock_error (bi);if (rw ==WRITE )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 313/365 nvmet-tcp: fix lockdep complaint on nvmet_tcp_wq flush during queue teardown
In reply to Greg Kroah-HartmanFrom: Sagi Grimberg <[email protected]>
[ Upstream commit 533d2e8b4d5e4c89772a0adce913525fb86cbbee ]
We probably need nvmet_tcp_wq to have MEM_RECLAIM as we are sending/receiving for the socket from works on this workqueue. Also this eliminates lockdep complaints:
--
[ 6174.010200] workqueue: WQ_MEM_RECLAIM nvmet-wq:nvmet_tcp_release_queue_work [nvmet_tcp] is flushing !WQ_MEM_RECLAIM nvmet_tcp_wq:nvmet_tcp_io_work [nvmet_tcp] [ 6174.010216] WARNING: CPU: 20 PID: 14456 at kernel/workqueue.c:2628
check_flush_dependency+0x110/0x14c
--- drivers/nvme/target/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/target/tcp.c +2 -1
@@ -1839,7 +1839,8 @@ static int __init nvmet_tcp_init(void) {int ret; - nvmet_tcp_wq =alloc_workqueue ("nvmet_tcp_wq" ,WQ_HIGHPRI ,0 ); + nvmet_tcp_wq =alloc_workqueue ("nvmet_tcp_wq" , +WQ_MEM_RECLAIM |WQ_HIGHPRI ,0 );if (!nvmet_tcp_wq)return -ENOMEM ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 314/365 drivers:md:fix a potential use-after-free bug
In reply to Greg Kroah-HartmanFrom: Wentao_Liang <[email protected]>
[ Upstream commit 104212471b1c1817b311771d817fb692af983173 ]
In line 2884, "raid5_release_stripe(sh);" drops the reference to sh and may cause sh to be released. However, sh is subsequently used in lines 2886 "if (sh->batch_head && sh != sh->batch_head)". This may result in an use-after-free bug.
It can be fixed by moving "raid5_release_stripe(sh);" to the bottom of the function.
--- drivers/md/raid5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid5.c +1 -1
@@ -2881,10 +2881,10 @@ static void raid5_end_write_request(struct bio *bi)if (!test_and_clear_bit (R5_DOUBLE_LOCKED , &sh->dev[i].flags))clear_bit (R5_LOCKED , &sh->dev[i].flags);set_bit (STRIPE_HANDLE , &sh->state); -raid5_release_stripe (sh);if (sh->batch_head && sh != sh->batch_head)raid5_release_stripe (sh->batch_head); +raid5_release_stripe (sh); }static void raid5_error (struct mddev *mddev,struct md_rdev *rdev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 315/365 ext4: avoid remove directory when directory is corrupted
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
[ Upstream commit b24e77ef1c6d4dbf42749ad4903c97539cc9755a ]
Now if check directoy entry is corrupted, ext4_empty_dir may return true then directory will be removed when file system mounted with "errors=continue". In order not to make things worse just return false when directory is corrupted.
--- fs/ext4/namei.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
fs/ext4/namei.c +2 -5
@@ -3090,11 +3090,8 @@ bool ext4_empty_dir(struct inode *inode) de = (struct ext4_dir_entry_2 *) (bh->b_data + (offset & (sb->s_blocksize -1 )));if (ext4_check_dir_entry (inode,NULL , de, bh, - bh->b_data, bh->b_size, offset)) { - offset = (offset | (sb->s_blocksize -1 )) +1 ; -continue ; - } -if (le32_to_cpu (de->inode)) { + bh->b_data, bh->b_size, offset) || +le32_to_cpu (de->inode)) {brelse (bh);return false; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 316/365 ext4: block range must be validated before use in ext4_mb_clear_bb()
In reply to Greg Kroah-HartmanFrom: Lukas Czerner <[email protected]>
[ Upstream commit 1e1c2b86ef86a8477fd9b9a4f48a6bfe235606f6 ]
Block range to free is validated in ext4_free_blocks() using ext4_inode_block_valid() and then it's passed to ext4_mb_clear_bb(). However in some situations on bigalloc file system the range might be adjusted after the validation in ext4_free_blocks() which can lead to troubles on corrupted file systems such as one found by syzkaller that resulted in the following BUG
kernel BUG at fs/ext4/ext4.h:3319!
PREEMPT SMP NOPTI
CPU: 28 PID: 4243 Comm: repro Kdump: loaded Not tainted 5.19.0-rc6+ #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.15.0-1.fc35 04/01/2014 RIP: 0010:ext4_free_blocks+0x95e/0xa90 Call Trace: <TASK> ? lock_timer_base+0x61/0x80 ? __es_remove_extent+0x5a/0x760 ? __mod_timer+0x256/0x380 ? ext4_ind_truncate_ensure_credits+0x90/0x220 ext4_clear_blocks+0x107/0x1b0 ext4_free_data+0x15b/0x170 ext4_ind_truncate+0x214/0x2c0 ? _raw_spin_unlock+0x15/0x30 ? ext4_discard_preallocations+0x15a/0x410 ? ext4_journal_check_start+0xe/0x90 ? __ext4_journal_start_sb+0x2f/0x110 ext4_truncate+0x1b5/0x460 ? __ext4_journal_start_sb+0x2f/0x110 ext4_evict_inode+0x2b4/0x6f0 evict+0xd0/0x1d0 ext4_enable_quotas+0x11f/0x1f0 ext4_orphan_cleanup+0x3de/0x430 ? proc_create_seq_private+0x43/0x50 ext4_fill_super+0x295f/0x3ae0 ? snprintf+0x39/0x40 ? sget_fc+0x19c/0x330 ? ext4_reconfigure+0x850/0x850 get_tree_bdev+0x16d/0x260 vfs_get_tree+0x25/0xb0 path_mount+0x431/0xa70 __x64_sys_mount+0xe2/0x120 do_syscall_64+0x5b/0x80 ? do_user_addr_fault+0x1e2/0x670 ? exc_page_fault+0x70/0x170 entry_SYSCALL_64_after_hwframe+0x46/0xb0 RIP: 0033:0x7fdf4e512ace
Fix it by making sure that the block range is properly validated before used every time it changes in ext4_free_blocks() or ext4_mb_clear_bb().
--- fs/ext4/mballoc.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
fs/ext4/mballoc.c +20 -1
@@ -5928,6 +5928,15 @@ static void ext4_mb_clear_bb(handle_t *handle, struct inode *inode, sbi =EXT4_SB (sb); +if (!(flags &EXT4_FREE_BLOCKS_VALIDATED ) && + !ext4_inode_block_valid (inode, block, count)) { +ext4_error (sb,"Freeing blocks in system zone - " +"Block = %llu, count = %lu" , block, count); +/* err = 0. ext4_std_error should be a no op */ + goto error_return; + } + flags |=EXT4_FREE_BLOCKS_VALIDATED ; + do_more: overflow =0 ;ext4_get_group_no_and_offset (sb, block, &block_group, &bit);
@@ -5944,6 +5953,8 @@ static void ext4_mb_clear_bb(handle_t *handle, struct inode *inode, overflow =EXT4_C2B (sbi, bit) + count -EXT4_BLOCKS_PER_GROUP (sb); count -= overflow; +/* The range changed so it's no longer validated */ + flags &= ~EXT4_FREE_BLOCKS_VALIDATED ; } count_clusters =EXT4_NUM_B2C (sbi, count); bitmap_bh =ext4_read_block_bitmap (sb, block_group);
@@ -5958,7 +5969,8 @@ static void ext4_mb_clear_bb(handle_t *handle, struct inode *inode, goto error_return; } -if (!ext4_inode_block_valid (inode, block, count)) { +if (!(flags &EXT4_FREE_BLOCKS_VALIDATED ) && + !ext4_inode_block_valid (inode, block, count)) {ext4_error (sb,"Freeing blocks in system zone - " "Block = %llu, count = %lu" , block, count);/* err = 0. ext4_std_error should be a no op */
@@ -6081,6 +6093,8 @@ static void ext4_mb_clear_bb(handle_t *handle, struct inode *inode, block += count; count = overflow;put_bh (bitmap_bh); +/* The range changed so it's no longer validated */ + flags &= ~EXT4_FREE_BLOCKS_VALIDATED ; goto do_more; } error_return:
@@ -6127,6 +6141,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode, "block = %llu, count = %lu", block, count);return ; } + flags |=EXT4_FREE_BLOCKS_VALIDATED ;ext4_debug ("freeing block %llu\n" , block);trace_ext4_free_blocks (inode, block, count, flags);
@@ -6158,6 +6173,8 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode, block -= overflow; count += overflow; } +/* The range changed so it's no longer validated */ + flags &= ~EXT4_FREE_BLOCKS_VALIDATED ; } overflow =EXT4_LBLK_COFF (sbi, count);if (overflow) {
@@ -6168,6 +6185,8 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,return ; }else count += sbi->s_cluster_ratio - overflow; +/* The range changed so it's no longer validated */ + flags &= ~EXT4_FREE_BLOCKS_VALIDATED ; }if (!bh && (flags &EXT4_FREE_BLOCKS_FORGET )) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 317/365 ext4: avoid resizing to a partial cluster size
In reply to Greg Kroah-HartmanFrom: Kiselev, Oleg <[email protected]>
[ Upstream commit 69cb8e9d8cd97cdf5e293b26d70a9dee3e35e6bd ]
This patch avoids an attempt to resize the filesystem to an unaligned cluster boundary. An online resize to a size that is not integral to cluster size results in the last iteration attempting to grow the fs by a negative amount, which trips a BUG_ON and leaves the fs with a corrupted in-memory superblock.
--- fs/ext4/resize.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/ext4/resize.c +10 -0
@@ -1989,6 +1989,16 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count) }brelse (bh); +/* +* For bigalloc, trim the requested size to the nearest cluster +* boundary to avoid creating an unusable filesystem. We do this +* silently, instead of returning an error, to avoid breaking +* callers that blindly resize the filesystem to the full size of +* the underlying block device. +*/ +if (ext4_has_feature_bigalloc (sb)) + n_blocks_count &= ~((1 <<EXT4_CLUSTER_BITS (sb)) -1 ); + retry: o_blocks_count =ext4_blocks_count (es);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 318/365 lib/list_debug.c: Detect uninitialized lists
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit 0cc011c576aaa4de505046f7a6c90933d7c749a9 ]
In some circumstances, attempts are made to add entries to or to remove entries from an uninitialized list. A prime example is amdgpu_bo_vm_destroy(): It is indirectly called from ttm_bo_init_reserved() if that function fails, and tries to remove an entry from a list. However, that list is only initialized in amdgpu_bo_create_vm() after the call to ttm_bo_init_reserved() returned success. This results in crashes such as
BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP NOPTI CPU: 1 PID: 1479 Comm: chrome Not tainted 5.10.110-15768-g29a72e65dae5 Hardware name: Google Grunt/Grunt, BIOS Google_Grunt.11031.149.0 07/15/2020 RIP: 0010:__list_del_entry_valid+0x26/0x7d ... Call Trace: amdgpu_bo_vm_destroy+0x48/0x8b ttm_bo_init_reserved+0x1d7/0x1e0 amdgpu_bo_create+0x212/0x476 ? amdgpu_bo_user_destroy+0x23/0x23 ? kmem_cache_alloc+0x60/0x271 amdgpu_bo_create_vm+0x40/0x7d amdgpu_vm_pt_create+0xe8/0x24b ...
Check if the list's prev and next pointers are NULL to catch such problems.
--- lib/list_debug.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
lib/list_debug.c +10 -2
@@ -20,7 +20,11 @@ bool __list_add_valid(struct list_head *new, struct list_head *prev, struct list_head *next) { - if (CHECK_DATA_CORRUPTION(next->prev != prev, + if (CHECK_DATA_CORRUPTION(prev == NULL, + "list_add corruption. prev is NULL.\n") || + CHECK_DATA_CORRUPTION(next == NULL, + "list_add corruption. next is NULL.\n") || + CHECK_DATA_CORRUPTION(next->prev != prev, "list_add corruption. next->prev should be prev (%px), but was %px. (next=%px).\n", prev, next->prev, next) || CHECK_DATA_CORRUPTION(prev->next != next,
@@ -42,7 +46,11 @@ bool __list_del_entry_valid(struct list_head *entry) prev = entry->prev; next = entry->next; -if (CHECK_DATA_CORRUPTION (next ==LIST_POISON1 , +if (CHECK_DATA_CORRUPTION (next ==NULL , +"list_del corruption, %px->next is NULL\n" , entry) || +CHECK_DATA_CORRUPTION (prev ==NULL , +"list_del corruption, %px->prev is NULL\n" , entry) || +CHECK_DATA_CORRUPTION (next ==LIST_POISON1 ,"list_del corruption, %px->next is LIST_POISON1 (%px)\n" , entry,LIST_POISON1 ) || CHECK_DATA_CORRUPTION(prev == LIST_POISON2,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 319/365 swiotlb: panic if nslabs is too small
In reply to Greg Kroah-HartmanFrom: Dongli Zhang <[email protected]>
[ Upstream commit 0bf28fc40d89b1a3e00d1b79473bad4e9ca20ad1 ]
Panic on purpose if nslabs is too small, in order to sync with the remap retry logic.
In addition, print the number of bytes for tlb alloc failure.
--- kernel/dma/swiotlb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
kernel/dma/swiotlb.c +5 -1
@@ -242,6 +242,9 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,if (swiotlb_force_disable)return ; +if (nslabs <IO_TLB_MIN_SLABS ) +panic ("%s: nslabs = %lu too small\n" , __func__, nslabs); +/* * By default allocate the bounce buffer memory from low memory, but * allow to pick a location everywhere for hypervisors with guest
@@ -254,7 +257,8 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,else tlb =memblock_alloc_low (bytes,PAGE_SIZE );if (!tlb) { -pr_warn ("%s: failed to allocate tlb structure\n" , __func__); +pr_warn ("%s: Failed to allocate %zu bytes tlb structure\n" , + __func__, bytes);return ; }
Signature · 1 line
2.35.1
Re: [PATCH 5.19 319/365] swiotlb: panic if nslabs is too small
Adding Robin, Yu and swiotlb list.
Hi Greg,
There is an on-going discussion whether to revert this patch, because it breaks a corner case in MIPS when many kernel CONFIGs are not enabled (related to PCI and device). As a result, MIPS pre-allocates only PAGE_SIZE buffer as swiotlb.
https://lore.kernel.org/all/[email protected]/
However, the core idea of the patch is to panic on purpose if the swiotlb is configured with <1MB memory, in order to sync with the remap failure handler in swiotlb_init_remap().
Therefore, I am waiting for suggestion from Christoph whether (1) to revert this patch, or (2) enforce the restriction to disallow <1MB allocation.
Thank you very much!
Dongli Zhang
Quoted 41 lines · Greg Kroah-Hartman
From: Dongli Zhang <[email protected]>
[ Upstream commit
0bf28fc40d89b1a3e00d1b79473bad4e9ca20ad1]Panic on purpose if nslabs is too small, in order to sync with the remap retry logic.
In addition, print the number of bytes for tlb alloc failure.
Signed-off-by Dongli Zhang <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- kernel/dma/swiotlb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)kernel/dma/swiotlb.c +5
-1@@ -242,6 +242,9 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,if (swiotlb_force_disable)return ; +if (nslabs <IO_TLB_MIN_SLABS ) +panic ("%s: nslabs = %lu too small\n" , __func__, nslabs); +/* * By default allocate the bounce buffer memory from low memory, but * allow to pick a location everywhere for hypervisors with guest @@ -254,7 +257,8 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,else tlb =memblock_alloc_low (bytes,PAGE_SIZE );if (!tlb) { -pr_warn ("%s: failed to allocate tlb structure\n" , __func__); +pr_warn ("%s: Failed to allocate %zu bytes tlb structure\n" , + __func__, bytes);return ; }
Re: [PATCH 5.19 319/365] swiotlb: panic if nslabs is too small
Quoted 2 lines · Dongli Zhang
Adding Robin, Yu and swiotlb list.
Thanks.
Quoted 2 lines
There is an on-going discussion whether to revert this patch, because it breaks a corner case in MIPS
I wouldn't call it a corner case. Cavium Octeon is the major platform we use to test Debian MIPS ports [1], and 4 out of 5 best-selling Wi-Fi routers are MIPS-based [2].
[1] https://wiki.debian.org/MIPSPort
[2] https://www.amazon.com/bestsellers/pc/300189
Quoted 11 lines
when many kernel CONFIGs are not enabled (related to PCI
and device). As a result, MIPS pre-allocates onlyPAGE_SIZEbuffer as swiotlb.https://lore.kernel.org/all/[email protected]/
However, the core idea of the patch is to panic on purpose if the swiotlb is configured with <1MB memory, in order to sync with the remap failure handler in
swiotlb_init_remap().Therefore, I am waiting for suggestion from Christoph whether (1) to revert this patch, or (2) enforce the restriction to disallow <1MB allocation.
There are other archs (arm, ppc, riscv, s390, etc.) that call swiotlb_init(). Have you verified them all?
Re: [PATCH 5.19 319/365] swiotlb: panic if nslabs is too small
Quoted 25 lines · Yu Zhao
Quoted 2 lines · Dongli Zhang
Adding Robin, Yu and swiotlb list.
Thanks.
Quoted 2 lines
There is an on-going discussion whether to revert this patch, because it breaks a corner case in MIPS
I wouldn't call it a corner case. Cavium Octeon is the major platform we use to test Debian MIPS ports [1], and 4 out of 5 best-selling Wi-Fi routers are MIPS-based [2].
[1] https://urldefense.com/v3/__https://wiki.debian.org/MIPSPort__;!!ACWV5N9M2RV99hQ!NDVwU_XfPmfl_OSGxbroJXOjYmdrb-Vmbnx-zq0UIxkYNCetx4ZWdl6KlftLS9F5ORGT4t8F5YapMSSBiA$
[2] https://urldefense.com/v3/__https://www.amazon.com/bestsellers/pc/300189__;!!ACWV5N9M2RV99hQ!NDVwU_XfPmfl_OSGxbroJXOjYmdrb-Vmbnx-zq0UIxkYNCetx4ZWdl6KlftLS9F5ORGT4t8F5YacDz0Zlg$Quoted 9 lines
when many kernel CONFIGs are not enabled (related to PCI
and device). As a result, MIPS pre-allocates onlyPAGE_SIZEbuffer as swiotlb.https://urldefense.com/v3/__https://lore.kernel.org/all/[email protected]/__;!!ACWV5N9M2RV99hQ!NDVwU_XfPmfl_OSGxbroJXOjYmdrb-Vmbnx-zq0UIxkYNCetx4ZWdl6KlftLS9F5ORGT4t8F5YbWJyEn2A$However, the core idea of the patch is to panic on purpose if the swiotlb is configured with <1MB memory, in order to sync with the remap failure handler in
swiotlb_init_remap().
Quoted 6 lines
Quoted 2 lines
Therefore, I am waiting for suggestion from Christoph whether (1) to revert this patch, or (2) enforce the restriction to disallow <1MB allocation.
There are other archs (arm, ppc, riscv, s390, etc.) that call
swiotlb_init(). Have you verified them all?
The issue is not about swiotlb_init(). It is about swiotlb_adjust_size() where the 'default_nslabs' is configured to a very small value (e.g., equivalent to swiotlb=2). I do not see any arch can directly configure 'default_nslabs'.
There are only two callers (archs) of swiotlb_adjust_size(): amd/sev and mips/cavium-octeon.
About amd/sev, it uses at least IO_TLB_DEFAULT_SIZE so that there is not any issue.
244 size = total_mem * 6 / 100; 245 size = clamp_val(size, IO_TLB_DEFAULT_SIZE, SZ_1G); 246 swiotlb_adjust_size(size);
In this case, only swiotlb=2 is allocated if PAGE_SIZE is 4K.
Thank you very much!
Dongli Zhang
Greg Kroah-Hartman
maintainerRe: [PATCH 5.19 319/365] swiotlb: panic if nslabs is too small
In reply to Dongli ZhangQuoted 8 lines · Dongli Zhang
Adding Robin, Yu and swiotlb list.
Hi Greg,
There is an on-going discussion whether to revert this patch, because it breaks a corner case in MIPS when many kernel CONFIGs are not enabled (related to PCI and device). As a result, MIPS pre-allocates only
PAGE_SIZEbuffer as swiotlb.
Quoted 5 lines
https://lore.kernel.org/all/[email protected]/
However, the core idea of the patch is to panic on purpose if the swiotlb is configured with <1MB memory, in order to sync with the remap failure handler in
swiotlb_init_remap().
Ok, I've dropped it from the 5.19 queue now. If you want it added to a future kernel release, just resend it.
thanks,
greg k-h
Greg Kroah-Hartman
maintainerPATCH 320/365 tty: serial: Fix refcount leak bug in ucc_uart.c
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit d24d7bb2cd947676f9b71fb944d045e09b8b282f ]
In soc_info(), of_find_node_by_type() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore.
--- drivers/tty/serial/ucc_uart.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/ucc_uart.c +2 -0
@@ -1137,6 +1137,8 @@ static unsigned int soc_info(unsigned int *rev_h, unsigned int *rev_l)/* No compatible property, so try the name. */ soc_string = np->name; +of_node_put (np); +/* Extract the SOC number from the "PowerPC," string */ if ((sscanf (soc_string,"PowerPC,%u" , &soc) !=1 ) || !soc)return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 321/365 KVM: PPC: Book3S HV: Fix "rm_exit" entry in debugfs timings
In reply to Greg Kroah-HartmanFrom: Fabiano Rosas <[email protected]>
[ Upstream commit 9981bace85d816ed8724ac46e49285e8488d29e6 ]
At debugfs/kvm/<pid>/vcpu0/timings we show how long each part of the code takes to run:
$ cat /sys/kernel/debug/kvm/*-*/vcpu0/timings rm_entry: 123785 49398892 118 4898 rm_intr: 123780 6075890 22 390 rm_exit: 0 0 0 0 <-- NOK guest: 123780 46732919988 402 9997638 cede: 0 0 0 0 <-- OK, no cede napping in P9
The "rm_exit" is always showing zero because it is the last one and end_timing does not increment the counter of the previous entry.
We can fix it by calling accumulate_time again instead of end_timing. That way the counter gets incremented. The rest of the arithmetic can be ignored because there are no timing points after this and the accumulators are reset before the next round.
--- arch/powerpc/kvm/book3s_hv_p9_entry.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
arch/powerpc/kvm/book3s_hv_p9_entry.c +2 -11
@@ -438,15 +438,6 @@ void restore_p9_host_os_sprs(struct kvm_vcpu *vcpu,EXPORT_SYMBOL_GPL (restore_p9_host_os_sprs);#ifdef CONFIG_KVM_BOOK3S_HV_EXIT_TIMING -static void __start_timing (struct kvm_vcpu *vcpu,struct kvmhv_tb_accumulator *next) -{ -struct kvmppc_vcore *vc = vcpu->arch.vcore; -u64 tb =mftb () - vc->tb_offset_applied; - - vcpu->arch.cur_activity = next; - vcpu->arch.cur_tb_start = tb; -} -static void __accumulate_time (struct kvm_vcpu *vcpu,struct kvmhv_tb_accumulator *next) {struct kvmppc_vcore *vc = vcpu->arch.vcore;
@@ -478,8 +469,8 @@ static void __accumulate_time(struct kvm_vcpu *vcpu, struct kvmhv_tb_accumulator curr->seqcount = seq + 2; } -#define start_timing (vcpu, next) __start_timing(vcpu, next) -#define end_timing (vcpu) __start_timing(vcpu, NULL) +#define start_timing (vcpu, next) __accumulate_time(vcpu, next) +#define end_timing (vcpu) __accumulate_time(vcpu, NULL)#define accumulate_time (vcpu, next) __accumulate_time(vcpu, next)#else #define start_timing (vcpu, next) do {} while (0)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 322/365 vfio: Clear the caps->buf to NULL after free
In reply to Greg Kroah-HartmanFrom: Schspa Shi <[email protected]>
[ Upstream commit 6641085e8d7b3f061911517f79a2a15a0a21b97b ]
On buffer resize failure, vfio_info_cap_add() will free the buffer, report zero for the size, and return -ENOMEM. As additional hardening, also clear the buffer pointer to prevent any chance of a double free.
--- drivers/vfio/vfio.c | 1 + 1 file changed, 1 insertion(+)
drivers/vfio/vfio.c +1 -0
@@ -1814,6 +1814,7 @@ struct vfio_info_cap_header *vfio_info_cap_add(struct vfio_info_cap *caps, buf =krealloc (caps->buf, caps->size + size,GFP_KERNEL );if (!buf) {kfree (caps->buf); + caps->buf =NULL ; caps->size =0 ;return ERR_PTR (-ENOMEM ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 323/365 mips: cavium-octeon: Fix missing of_node_put() in octeon2_usb_clocks_start
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 7a9f743ceead60ed454c46fbc3085ee9a79cbebb ]
We should call of_node_put() for the reference 'uctl_node' returned by of_get_parent() which will increase the refcount. Otherwise, there will be a refcount leak bug.
--- arch/mips/cavium-octeon/octeon-platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/mips/cavium-octeon/octeon-platform.c +2 -1
@@ -86,11 +86,12 @@ static void octeon2_usb_clocks_start(struct device *dev) "refclk-frequency", &clock_rate);if (i) {dev_err (dev,"No UCTL \"refclk-frequency\"\n" ); +of_node_put (uctl_node); goto exit; } i =of_property_read_string (uctl_node,"refclk-type" , &clock_type); - +of_node_put (uctl_node);if (!i &&strcmp ("crystal" , clock_type) ==0 ) is_crystal_clock = true; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 324/365 iommu/io-pgtable-arm-v7s: Add a quirk to allow pgtable PA up to 35bit
In reply to Greg Kroah-HartmanFrom: Yunfei Wang <[email protected]>
[ Upstream commit bfdd231374181254742c5e2faef0bef2d30c0ee4 ]
Single memory zone feature will remove ZONE_DMA32 and ZONE_DMA and cause pgtable PA size larger than 32bit.
Since Mediatek IOMMU hardware support at most 35bit PA in pgtable, so add a quirk to allow the PA of pgtables support up to bit35.
--- drivers/iommu/io-pgtable-arm-v7s.c | 75 ++++++++++++++++++++++-------- include/linux/io-pgtable.h | 15 ++++-- 2 files changed, 66 insertions(+), 24 deletions(-)
drivers/iommu/io-pgtable-arm-v7s.c +56 -19
@@ -182,14 +182,8 @@ static bool arm_v7s_is_mtk_enabled(struct io_pgtable_cfg *cfg) (cfg->quirks &IO_PGTABLE_QUIRK_ARM_MTK_EXT ); } -static arm_v7s_iopte paddr_to_iopte (phys_addr_t paddr,int lvl, -struct io_pgtable_cfg *cfg) +static arm_v7s_iopte to_mtk_iopte (phys_addr_t paddr,arm_v7s_iopte pte) { -arm_v7s_iopte pte = paddr &ARM_V7S_LVL_MASK (lvl); - -if (!arm_v7s_is_mtk_enabled (cfg)) -return pte; -if (paddr &BIT_ULL (32 )) pte |=ARM_V7S_ATTR_MTK_PA_BIT32 ;if (paddr &BIT_ULL (33 ))
@@ -199,6 +193,17 @@ static arm_v7s_iopte paddr_to_iopte(phys_addr_t paddr, int lvl,return pte; } +static arm_v7s_iopte paddr_to_iopte (phys_addr_t paddr,int lvl, +struct io_pgtable_cfg *cfg) +{ +arm_v7s_iopte pte = paddr &ARM_V7S_LVL_MASK (lvl); + +if (arm_v7s_is_mtk_enabled (cfg)) +return to_mtk_iopte (paddr, pte); + +return pte; +} +static phys_addr_t iopte_to_paddr (arm_v7s_iopte pte,int lvl,struct io_pgtable_cfg *cfg) {
@@ -240,10 +245,17 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp,dma_addr_t dma;size_t size =ARM_V7S_TABLE_SIZE (lvl, cfg);void *table =NULL ; +gfp_t gfp_l1; + +/* +* ARM_MTK_TTBR_EXT extend the translation table base support larger +* memory address. +*/ + gfp_l1 = cfg->quirks &IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT ? +GFP_KERNEL :ARM_V7S_TABLE_GFP_DMA ;if (lvl ==1 ) - table = (void *)__get_free_pages ( - __GFP_ZERO |ARM_V7S_TABLE_GFP_DMA ,get_order (size)); + table = (void *)__get_free_pages (gfp_l1 | __GFP_ZERO,get_order (size));else if (lvl ==2 ) table =kmem_cache_zalloc (data->l2_tables, gfp);
@@ -251,7 +263,8 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp,return NULL ; phys =virt_to_phys (table); -if (phys != (arm_v7s_iopte )phys) { +if (cfg->quirks &IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT ? + phys >= (1ULL << cfg->oas) : phys != (arm_v7s_iopte )phys) {/* Doesn't fit in PTE */ dev_err (dev,"Page table does not fit in PTE: %pa" , &phys); goto out_free;
@@ -457,9 +470,14 @@ static arm_v7s_iopte arm_v7s_install_table(arm_v7s_iopte *table,arm_v7s_iopte curr, struct io_pgtable_cfg *cfg) { + phys_addr_t phys = virt_to_phys(table);arm_v7s_iopte old, new; - new =virt_to_phys (table) |ARM_V7S_PTE_TYPE_TABLE ; + new = phys |ARM_V7S_PTE_TYPE_TABLE ; + +if (cfg->quirks &IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT ) + new =to_mtk_iopte (phys, new); +if (cfg->quirks &IO_PGTABLE_QUIRK_ARM_NS ) new |=ARM_V7S_ATTR_NS_TABLE ;
@@ -779,6 +797,8 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie) {struct arm_v7s_io_pgtable *data; +slab_flags_t slab_flag; +phys_addr_t paddr;if (cfg->ias > (arm_v7s_is_mtk_enabled (cfg) ?34 :ARM_V7S_ADDR_BITS ))return NULL ;
@@ -788,7 +808,8 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg,if (cfg->quirks & ~(IO_PGTABLE_QUIRK_ARM_NS |IO_PGTABLE_QUIRK_NO_PERMS | -IO_PGTABLE_QUIRK_ARM_MTK_EXT )) +IO_PGTABLE_QUIRK_ARM_MTK_EXT | +IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT ))return NULL ;/* If ARM_MTK_4GB is enabled, the NO_PERMS is also expected. */
@@ -796,15 +817,27 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg, !(cfg->quirks & IO_PGTABLE_QUIRK_NO_PERMS))return NULL ; +if ((cfg->quirks &IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT ) && + !arm_v7s_is_mtk_enabled (cfg)) +return NULL ; + data =kmalloc (sizeof (*data),GFP_KERNEL );if (!data)return NULL ;spin_lock_init (&data->split_lock); + +/* +* ARM_MTK_TTBR_EXT extend the translation table base support larger +* memory address. +*/ + slab_flag = cfg->quirks &IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT ? +0 :ARM_V7S_TABLE_SLAB_FLAGS ; + data->l2_tables =kmem_cache_create ("io-pgtable_armv7s_l2" ,ARM_V7S_TABLE_SIZE (2 , cfg),ARM_V7S_TABLE_SIZE (2 , cfg), -ARM_V7S_TABLE_SLAB_FLAGS ,NULL ); + slab_flag,NULL );if (!data->l2_tables) goto out_free_data;
@@ -850,12 +883,16 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg,wmb ();/* TTBR */ - cfg->arm_v7s_cfg.ttbr =virt_to_phys (data->pgd) |ARM_V7S_TTBR_S | - (cfg->coherent_walk ? (ARM_V7S_TTBR_NOS | -ARM_V7S_TTBR_IRGN_ATTR (ARM_V7S_RGN_WBWA ) | -ARM_V7S_TTBR_ORGN_ATTR (ARM_V7S_RGN_WBWA )) : - (ARM_V7S_TTBR_IRGN_ATTR (ARM_V7S_RGN_NC ) | -ARM_V7S_TTBR_ORGN_ATTR (ARM_V7S_RGN_NC ))); + paddr =virt_to_phys (data->pgd); +if (arm_v7s_is_mtk_enabled (cfg)) + cfg->arm_v7s_cfg.ttbr = paddr |upper_32_bits (paddr); +else + cfg->arm_v7s_cfg.ttbr = paddr |ARM_V7S_TTBR_S | + (cfg->coherent_walk ? (ARM_V7S_TTBR_NOS | +ARM_V7S_TTBR_IRGN_ATTR (ARM_V7S_RGN_WBWA ) | +ARM_V7S_TTBR_ORGN_ATTR (ARM_V7S_RGN_WBWA )) : + (ARM_V7S_TTBR_IRGN_ATTR (ARM_V7S_RGN_NC ) | +ARM_V7S_TTBR_ORGN_ATTR (ARM_V7S_RGN_NC )));return &data->iop; out_free_data:
include/linux/io-pgtable.h +10 -5
@@ -74,17 +74,22 @@ struct io_pgtable_cfg {* to support up to 35 bits PA where the bit32, bit33 and bit34 are * encoded in the bit9, bit4 and bit5 of the PTE respectively. * +* IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT: (ARM v7s format) MediaTek IOMMUs +* extend the translation table base support up to 35 bits PA, the +* encoding format is same with IO_PGTABLE_QUIRK_ARM_MTK_EXT. +* * IO_PGTABLE_QUIRK_ARM_TTBR1: (ARM LPAE format) Configure the table * for use in the upper half of a split address space. * * IO_PGTABLE_QUIRK_ARM_OUTER_WBWA: Override the outer-cacheability * attributes set in the TCR for a non-coherent page-table walker. */ -#define IO_PGTABLE_QUIRK_ARM_NS BIT(0) -#define IO_PGTABLE_QUIRK_NO_PERMS BIT(1) -#define IO_PGTABLE_QUIRK_ARM_MTK_EXT BIT(3) -#define IO_PGTABLE_QUIRK_ARM_TTBR1 BIT(5) -#define IO_PGTABLE_QUIRK_ARM_OUTER_WBWA BIT(6) +#define IO_PGTABLE_QUIRK_ARM_NS BIT(0) +#define IO_PGTABLE_QUIRK_NO_PERMS BIT(1) +#define IO_PGTABLE_QUIRK_ARM_MTK_EXT BIT(3) +#define IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT BIT(4) +#define IO_PGTABLE_QUIRK_ARM_TTBR1 BIT(5) +#define IO_PGTABLE_QUIRK_ARM_OUTER_WBWA BIT(6)unsigned long quirks;unsigned long pgsize_bitmap;unsigned int ias;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 325/365 ASoC: Intel: avs: Set max DMA segment size
In reply to Greg Kroah-HartmanFrom: Amadeusz Sławiński <[email protected]>
[ Upstream commit 8544eebc78c96f1834a46b26ade3e7ebe785d10c ]
Apparently it is possible for code to allocate large buffers which may cause warnings as reported in [1]. This was fixed for HDA, SOF and skylake in patchset [2], fix it also for avs driver.
[1] https://github.com/thesofproject/linux/issues/3430
[2] https://lore.kernel.org/all/[email protected]/
--- sound/soc/intel/avs/core.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/intel/avs/core.c +1 -0
@@ -445,6 +445,7 @@ static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)dma_set_mask (dev,DMA_BIT_MASK (32 ));dma_set_coherent_mask (dev,DMA_BIT_MASK (32 )); } +dma_set_max_seg_size (dev,UINT_MAX ); ret =avs_hdac_bus_init_streams (bus);if (ret <0 ) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 326/365 ALSA: hda: Fix page fault in snd_hda_codec_shutdown()
In reply to Greg Kroah-HartmanFrom: Cezary Rojewski <[email protected]>
[ Upstream commit 980b3a8790b402e959a6d773b38b771019682be1 ]
If early probe of HDAudio bus driver fails e.g.: due to missing firmware file, snd_hda_codec_shutdown() ends in manipulating uninitialized codec->pcm_list_head causing page fault.
Iinitialization of HDAudio codec in ASoC is split in two:
- snd_hda_codec_device_init()
- snd_hda_codec_device_new()
snd_hda_codec_device_init() is called during probe_codecs() by HDAudio bus driver while snd_hda_codec_device_new() is called by codec-component's ->probe(). The second call will not happen until all components required by related sound card are present within the ASoC framework. With firmware failing to load during the PCI's deferred initialization i.e.: probe_work(), no platform components are ever registered. HDAudio codec enumeration is done at that point though, so the codec components became registered to ASoC framework, calling snd_hda_codec_device_init() in the process.
Now, during platform reboot snd_hda_codec_shutdown() is called for every codec found on the HDAudio bus causing oops if any of them has not completed both of their initialization steps. Relocating field initialization fixes the issue.
--- sound/pci/hda/hda_codec.c | 41 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 21 deletions(-)
sound/pci/hda/hda_codec.c +20 -21
@@ -931,8 +931,28 @@ snd_hda_codec_device_init(struct hda_bus *bus, unsigned int codec_addr, } codec->bus = bus; + codec->depop_delay =-1 ; + codec->fixup_id =HDA_FIXUP_ID_NOT_SET ; + codec->core.dev.release = snd_hda_codec_dev_release; + codec->core.exec_verb = codec_exec_verb; codec->core.type =HDA_DEV_LEGACY ; +mutex_init (&codec->spdif_mutex); +mutex_init (&codec->control_mutex); +snd_array_init (&codec->mixers,sizeof (struct hda_nid_item ),32 ); +snd_array_init (&codec->nids,sizeof (struct hda_nid_item ),32 ); +snd_array_init (&codec->init_pins,sizeof (struct hda_pincfg ),16 ); +snd_array_init (&codec->driver_pins,sizeof (struct hda_pincfg ),16 ); +snd_array_init (&codec->cvt_setups,sizeof (struct hda_cvt_setup ),8 ); +snd_array_init (&codec->spdif_out,sizeof (struct hda_spdif_out ),16 ); +snd_array_init (&codec->jacktbl,sizeof (struct hda_jack_tbl ),16 ); +snd_array_init (&codec->verbs,sizeof (struct hda_verb *),8 ); +INIT_LIST_HEAD (&codec->conn_list); +INIT_LIST_HEAD (&codec->pcm_list_head); +INIT_DELAYED_WORK (&codec->jackpoll_work, hda_jackpoll_work); +refcount_set (&codec->pcm_ref,1 ); +init_waitqueue_head (&codec->remove_sleep); +return codec; }EXPORT_SYMBOL_GPL (snd_hda_codec_device_init);
@@ -980,29 +1000,8 @@ int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card,if (snd_BUG_ON (codec_addr >HDA_MAX_CODEC_ADDRESS ))return -EINVAL ; - codec->core.dev.release = snd_hda_codec_dev_release; - codec->core.exec_verb = codec_exec_verb; - codec->card = card; codec->addr = codec_addr; -mutex_init (&codec->spdif_mutex); -mutex_init (&codec->control_mutex); -snd_array_init (&codec->mixers,sizeof (struct hda_nid_item ),32 ); -snd_array_init (&codec->nids,sizeof (struct hda_nid_item ),32 ); -snd_array_init (&codec->init_pins,sizeof (struct hda_pincfg ),16 ); -snd_array_init (&codec->driver_pins,sizeof (struct hda_pincfg ),16 ); -snd_array_init (&codec->cvt_setups,sizeof (struct hda_cvt_setup ),8 ); -snd_array_init (&codec->spdif_out,sizeof (struct hda_spdif_out ),16 ); -snd_array_init (&codec->jacktbl,sizeof (struct hda_jack_tbl ),16 ); -snd_array_init (&codec->verbs,sizeof (struct hda_verb *),8 ); -INIT_LIST_HEAD (&codec->conn_list); -INIT_LIST_HEAD (&codec->pcm_list_head); -refcount_set (&codec->pcm_ref,1 ); -init_waitqueue_head (&codec->remove_sleep); - -INIT_DELAYED_WORK (&codec->jackpoll_work, hda_jackpoll_work); - codec->depop_delay =-1 ; - codec->fixup_id =HDA_FIXUP_ID_NOT_SET ;#ifdef CONFIG_PM codec->power_jiffies = jiffies;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 327/365 modules: Ensure natural alignment for .altinstructions and __bug_table sections
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
[ Upstream commit 87c482bdfa79f378297d92af49cdf265be199df5 ]
In the kernel image vmlinux.lds.S linker scripts the .altinstructions and __bug_table sections are 4- or 8-byte aligned because they hold 32- and/or 64-bit values.
Most architectures use altinstructions and BUG() or WARN() in modules as well, but in the module linker script (module.lds.S) those sections are currently missing. As consequence the linker will store their content byte-aligned by default, which then can lead to unnecessary unaligned memory accesses by the CPU when those tables are processed at runtime.
Usually unaligned memory accesses are unnoticed, because either the hardware (as on x86 CPUs) or in-kernel exception handlers (e.g. on parisc or sparc) emulate and fix them up at runtime. Nevertheless, such unaligned accesses introduce a performance penalty and can even crash the kernel if there is a bug in the unalignment exception handlers (which happened once to me on the parisc architecture and which is why I noticed that issue at all).
This patch fixes a non-critical issue and might be backported at any time. It's trivial and shouldn't introduce any regression because it simply tells the linker to use a different (8-byte alignment) for those sections by default.
--- scripts/module.lds.S | 2 ++ 1 file changed, 2 insertions(+)
scripts/module.lds.S +2 -0
@@ -27,6 +27,8 @@ SECTIONS { .ctors 0 : ALIGN(8) { *(SORT(.ctors.*)) *(.ctors) } .init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) } + .altinstructions 0 : ALIGN(8) { KEEP(*(.altinstructions)) } + __bug_table 0 : ALIGN(8) { KEEP(*(__bug_table)) } __jump_table 0 : ALIGN(8) { KEEP(*(__jump_table)) } __patchable_function_entries : { *(__patchable_function_entries) }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 328/365 ASoC: SOF: Intel: cnl: Do not process IPC reply before firmware boot
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit acacd9eefd0def5a83244d88e5483b5f38ee7287 ]
It is not yet clear, but it is possible to create a firmware so broken that it will send a reply message before a FW_READY message (it is not yet clear if FW_READY will arrive later).
Since the reply_data is allocated only after the FW_READY message, this will lead to a NULL pointer dereference if not filtered out.
The issue was reported with IPC4 firmware but the same condition is present for IPC3.
--- sound/soc/sof/intel/cnl.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-)
sound/soc/sof/intel/cnl.c +24 -13
@@ -60,17 +60,23 @@ irqreturn_t cnl_ipc4_irq_thread(int irq, void *context)if (primary &SOF_IPC4_MSG_DIR_MASK ) {/* Reply received */ -struct sof_ipc4_msg *data = sdev->ipc->msg.reply_data; +if (likely (sdev->fw_state ==SOF_FW_BOOT_COMPLETE )) { +struct sof_ipc4_msg *data = sdev->ipc->msg.reply_data; - data->primary = primary; - data->extension = extension; + data->primary = primary; + data->extension = extension; -spin_lock_irq (&sdev->ipc_lock); +spin_lock_irq (&sdev->ipc_lock); -snd_sof_ipc_get_reply (sdev); -snd_sof_ipc_reply (sdev, data->primary); +snd_sof_ipc_get_reply (sdev); +snd_sof_ipc_reply (sdev, data->primary); -spin_unlock_irq (&sdev->ipc_lock); +spin_unlock_irq (&sdev->ipc_lock); + }else { +dev_dbg_ratelimited (sdev->dev, +"IPC reply before FW_READY: %#x|%#x\n" , + primary, extension); + } }else {/* Notification received */ notification_data.primary = primary;
@@ -124,15 +130,20 @@ irqreturn_t cnl_ipc_irq_thread(int irq, void *context)CNL_DSP_REG_HIPCCTL , CNL_DSP_REG_HIPCCTL_DONE, 0); -spin_lock_irq (&sdev->ipc_lock); +if (likely (sdev->fw_state ==SOF_FW_BOOT_COMPLETE )) { +spin_lock_irq (&sdev->ipc_lock); -/* handle immediate reply from DSP core */ -hda_dsp_ipc_get_reply (sdev); -snd_sof_ipc_reply (sdev, msg); +/* handle immediate reply from DSP core */ +hda_dsp_ipc_get_reply (sdev); +snd_sof_ipc_reply (sdev, msg); -cnl_ipc_dsp_done (sdev); +cnl_ipc_dsp_done (sdev); -spin_unlock_irq (&sdev->ipc_lock); +spin_unlock_irq (&sdev->ipc_lock); + }else { +dev_dbg_ratelimited (sdev->dev,"IPC reply before FW_READY: %#x\n" , + msg); + } ipc_irq = true; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 329/365 ASoC: SOF: Intel: hda-ipc: Do not process IPC reply before firmware boot
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit 499cc881b09c8283ab5e75b0d6d21cb427722161 ]
It is not yet clear, but it is possible to create a firmware so broken that it will send a reply message before a FW_READY message (it is not yet clear if FW_READY will arrive later).
Since the reply_data is allocated only after the FW_READY message, this will lead to a NULL pointer dereference if not filtered out.
The issue was reported with IPC4 firmware but the same condition is present for IPC3.
--- sound/soc/sof/intel/hda-ipc.c | 39 ++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 14 deletions(-)
sound/soc/sof/intel/hda-ipc.c +25 -14
@@ -148,17 +148,23 @@ irqreturn_t hda_dsp_ipc4_irq_thread(int irq, void *context)if (primary &SOF_IPC4_MSG_DIR_MASK ) {/* Reply received */ -struct sof_ipc4_msg *data = sdev->ipc->msg.reply_data; +if (likely (sdev->fw_state ==SOF_FW_BOOT_COMPLETE )) { +struct sof_ipc4_msg *data = sdev->ipc->msg.reply_data; - data->primary = primary; - data->extension = extension; + data->primary = primary; + data->extension = extension; -spin_lock_irq (&sdev->ipc_lock); +spin_lock_irq (&sdev->ipc_lock); -snd_sof_ipc_get_reply (sdev); -snd_sof_ipc_reply (sdev, data->primary); +snd_sof_ipc_get_reply (sdev); +snd_sof_ipc_reply (sdev, data->primary); -spin_unlock_irq (&sdev->ipc_lock); +spin_unlock_irq (&sdev->ipc_lock); + }else { +dev_dbg_ratelimited (sdev->dev, +"IPC reply before FW_READY: %#x|%#x\n" , + primary, extension); + } }else {/* Notification received */
@@ -225,16 +231,21 @@ irqreturn_t hda_dsp_ipc_irq_thread(int irq, void *context)* place, the message might not yet be marked as expecting a * reply. */ -spin_lock_irq (&sdev->ipc_lock); +if (likely (sdev->fw_state ==SOF_FW_BOOT_COMPLETE )) { +spin_lock_irq (&sdev->ipc_lock); -/* handle immediate reply from DSP core */ -hda_dsp_ipc_get_reply (sdev); -snd_sof_ipc_reply (sdev, msg); +/* handle immediate reply from DSP core */ +hda_dsp_ipc_get_reply (sdev); +snd_sof_ipc_reply (sdev, msg); -/* set the done bit */ -hda_dsp_ipc_dsp_done (sdev); +/* set the done bit */ +hda_dsp_ipc_dsp_done (sdev); -spin_unlock_irq (&sdev->ipc_lock); +spin_unlock_irq (&sdev->ipc_lock); + }else { +dev_dbg_ratelimited (sdev->dev,"IPC reply before FW_READY: %#x\n" , + msg); + } ipc_irq = true; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 330/365 ASoC: SOF: sof-client-probes: Only load the driver if IPC3 is used
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit 9b93eda355089b36482f7a2f134bdd24be70f907 ]
The current implementation of probes only supports IPC3 and should not be loaded for other IPC implementation.
--- sound/soc/sof/sof-client-probes.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/soc/sof/sof-client-probes.c +4 -0
@@ -693,6 +693,10 @@ static int sof_probes_client_probe(struct auxiliary_device *auxdev,if (!sof_probes_enabled)return -ENXIO ; +/* only ipc3 is supported */ +if (sof_client_get_ipc_type (cdev) !=SOF_IPC ) +return -ENXIO ; +if (!dev->platform_data) {dev_err (dev,"missing platform data\n" );return -ENODEV ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 331/365 ASoC: rsnd: care default case on rsnd_ssiu_busif_err_irq_ctrl()
In reply to Greg Kroah-HartmanFrom: Kuninori Morimoto <[email protected]>
[ Upstream commit ef30911d3c39fd57884c348c29b9cbff88def155 ]
Before, ssiu.c didn't care SSI5-8, thus,
commit b1384d4c95088d0 ("ASoC: rsnd: care default case on rsnd_ssiu_busif_err_status_clear()") cares it for status clear.
But we should care it for error irq handling, too. This patch cares it.
--- sound/soc/sh/rcar/ssiu.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/sh/rcar/ssiu.c +2 -0
@@ -67,6 +67,8 @@ static void rsnd_ssiu_busif_err_irq_ctrl(struct rsnd_mod *mod, int enable) shift =1 ; offset =1 ;break ; +default : +return ; }for (i =0 ; i <4 ; i++) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 332/365 riscv: dts: sifive: Add fu540 topology information
In reply to Greg Kroah-HartmanFrom: Conor Dooley <[email protected]>
[ Upstream commit af8f260abc608c06e4466a282b53f1e2dc09f042 ]
The fu540 has no cpu-map node, so tools like hwloc cannot correctly parse the topology. Add the node using the existing node labels.
--- arch/riscv/boot/dts/sifive/fu540-c000.dtsi | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/riscv/boot/dts/sifive/fu540-c000.dtsi +24 -0
@@ -133,6 +133,30 @@ interrupt-controller; }; }; + + cpu-map { + cluster0 { + core0 { + cpu = <&cpu0>; + }; + + core1 { + cpu = <&cpu1>; + }; + + core2 { + cpu = <&cpu2>; + }; + + core3 { + cpu = <&cpu3>; + }; + + core4 { + cpu = <&cpu4>; + }; + }; + }; }; soc { #address-cells = <2>;
Signature · 1 line
2.35.1
Re: [PATCH 5.19 332/365] riscv: dts: sifive: Add fu540 topology information
Quoted 9 lines · Greg Kroah-Hartman
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
From: Conor Dooley <[email protected]>
[ Upstream commit
af8f260abc608c06e4466a282b53f1e2dc09f042]The fu540 has no cpu-map node, so tools like hwloc cannot correctly parse the topology. Add the node using the existing node labels.
Quoted 6 lines
Reported-by Brice Goglin <[email protected]>Signed-off-by Conor Dooley <[email protected]>Signed-off-by Palmer Dabbelt <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Hey Greg,
I pointed out on the AUTOSEL'd version of these patches that adding the optional dt property papers over the problem rather than really fixing it & Sudeep suggested the time that these patches were not stable worthy, hence the lack of a CC: stable.
The following has been merged into riscv/for-next & is pending for arm64/driver core as an actual fix for RISC-V's default topology reporting:
https://lore.kernel.org/linux-riscv/[email protected]/#t
As I said to Sasha, I defer to your (plural) better judgement here, but just so that you're aware of the context.
Thanks,
Conor.
This would apply to the following 3 patches:
riscv: dts: sifive: Add fu540 topology information
riscv: dts: sifive: Add fu740 topology information
riscv: dts: canaan: Add k210 topology information
AUTOSEL comments:
https://lore.kernel.org/stable/YwDwwEXgGundXB1X@sashalap/
Quoted 44 lines
--- arch/riscv/boot/dts/sifive/fu540-c000.dtsi | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+)arch/riscv/boot/dts/sifive/fu540-c000.dtsi +24
-1@@ -133,6 +133,30 @@ interrupt-controller; }; }; + + cpu-map { + cluster0 { + core0 { + cpu = <&cpu0>; + }; + + core1 { + cpu = <&cpu1>; + }; + + core2 { + cpu = <&cpu2>; + }; + + core3 { + cpu = <&cpu3>; + }; + + core4 { + cpu = <&cpu4>; + }; + }; + }; }; soc { #address-cells = <2>; --2.35.1
Greg KH
maintainerRe: [PATCH 5.19 332/365] riscv: dts: sifive: Add fu540 topology information
Quoted 23 lines · On Tue, Aug 23, 2022 at 09:49:35AM +0000, [email protected] wrote:
Quoted 9 lines · Greg Kroah-Hartman
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
From: Conor Dooley <[email protected]>
[ Upstream commit
af8f260abc608c06e4466a282b53f1e2dc09f042]The fu540 has no cpu-map node, so tools like hwloc cannot correctly parse the topology. Add the node using the existing node labels.
Quoted 6 lines
Reported-by Brice Goglin <[email protected]>Signed-off-by Conor Dooley <[email protected]>Signed-off-by Palmer Dabbelt <[email protected]>Signed-off-by Sasha Levin <[email protected]>Hey Greg,
I pointed out on the AUTOSEL'd version of these patches that adding the optional dt property papers over the problem rather than really fixing it & Sudeep suggested the time that these patches were not stable worthy, hence the lack of a CC: stable.
Quoted 7 lines
The following has been merged into riscv/for-next & is pending for arm64/driver core as an actual fix for RISC-V's default topology reporting:
https://lore.kernel.org/linux-riscv/[email protected]/#tAs I said to Sasha, I defer to your (plural) better judgement here, but just so that you're aware of the context.
Thanks for letting me know, I've now dropped it from all stable release queues.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 333/365 riscv: dts: sifive: Add fu740 topology information
In reply to Greg Kroah-HartmanFrom: Conor Dooley <[email protected]>
[ Upstream commit bf6cd1c01c959a31002dfa6784c0d8caffed4cf1 ]
The fu740 has no cpu-map node, so tools like hwloc cannot correctly parse the topology. Add the node using the existing node labels.
--- arch/riscv/boot/dts/sifive/fu740-c000.dtsi | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/riscv/boot/dts/sifive/fu740-c000.dtsi +24 -0
@@ -134,6 +134,30 @@ interrupt-controller; }; }; + + cpu-map { + cluster0 { + core0 { + cpu = <&cpu0>; + }; + + core1 { + cpu = <&cpu1>; + }; + + core2 { + cpu = <&cpu2>; + }; + + core3 { + cpu = <&cpu3>; + }; + + core4 { + cpu = <&cpu4>; + }; + }; + }; }; soc { #address-cells = <2>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 334/365 riscv: dts: canaan: Add k210 topology information
In reply to Greg Kroah-HartmanFrom: Conor Dooley <[email protected]>
[ Upstream commit d9d193dea8666bbf69fc21c5bdcdabaa34a466e3 ]
The k210 has no cpu-map node, so tools like hwloc cannot correctly parse the topology. Add the node using the existing node labels.
--- arch/riscv/boot/dts/canaan/k210.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/riscv/boot/dts/canaan/k210.dtsi +12 -0
@@ -65,6 +65,18 @@ compatible = "riscv,cpu-intc"; }; }; + + cpu-map { + cluster0 { + core0 { + cpu = <&cpu0>; + }; + + core1 { + cpu = <&cpu1>; + }; + }; + }; }; sram: memory@80000000 {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 335/365 ASoC: nau8821: Dont unconditionally free interrupt
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 2d86cef353b8f3d20b16f8c5615742fd6938c801 ]
The remove() operation unconditionally frees the interrupt for the device but we may not actually have an interrupt so there might be nothing to free. Since the interrupt is requested after all other resources we don't need the explicit free anyway, unwinding is guaranteed to be safe, so just delete the remove() function and let devm take care of things.
--- sound/soc/codecs/nau8821.c | 10 ---------- 1 file changed, 10 deletions(-)
sound/soc/codecs/nau8821.c +0 -10
@@ -1665,15 +1665,6 @@ static int nau8821_i2c_probe(struct i2c_client *i2c)return ret; } -static int nau8821_i2c_remove (struct i2c_client *i2c_client) -{ -struct nau8821 *nau8821 =i2c_get_clientdata (i2c_client); - -devm_free_irq (nau8821->dev, nau8821->irq, nau8821); - -return 0 ; -} -static const struct i2c_device_id nau8821_i2c_ids[] = { {"nau8821" ,0 }, { }
@@ -1703,7 +1694,6 @@ static struct i2c_driver nau8821_driver = { .acpi_match_table = ACPI_PTR(nau8821_acpi_match), }, .probe_new = nau8821_i2c_probe, - .remove = nau8821_i2c_remove, .id_table = nau8821_i2c_ids, };module_i2c_driver (nau8821_driver);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 336/365 riscv: mmap with PROT_WRITE but no PROT_READ is invalid
In reply to Greg Kroah-HartmanFrom: Celeste Liu <[email protected]>
[ Upstream commit 2139619bcad7ac44cc8f6f749089120594056613 ]
As mentioned in Table 4.5 in RISC-V spec Volume 2 Section 4.3, write but not read is "Reserved for future use.". For now, they are not valid. In the current code, -wx is marked as invalid, but -w- is not marked as invalid.
This patch refines that judgment.
--- arch/riscv/kernel/sys_riscv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/riscv/kernel/sys_riscv.c +2 -3
@@ -18,9 +18,8 @@ static long riscv_sys_mmap(unsigned long addr, unsigned long len,if (unlikely (offset & (~PAGE_MASK >> page_shift_offset)))return -EINVAL ; -if ((prot &PROT_WRITE ) && (prot &PROT_EXEC )) -if (unlikely (!(prot &PROT_READ ))) -return -EINVAL ; +if (unlikely ((prot &PROT_WRITE ) && !(prot &PROT_READ ))) +return -EINVAL ;return ksys_mmap_pgoff (addr, len, prot, flags, fd, offset >> (PAGE_SHIFT - page_shift_offset));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 337/365 RISC-V: Add fast call path of crash_kexec()
In reply to Greg Kroah-HartmanFrom: Xianting Tian <[email protected]>
[ Upstream commit 3f1901110a89b0e2e13adb2ac8d1a7102879ea98 ]
Currently, almost all archs (x86, arm64, mips...) support fast call of crash_kexec() when "regs && kexec_should_crash()" is true. But RISC-V not, it can only enter crash system via panic(). However panic() doesn't pass the regs of the real accident scene to crash_kexec(), it caused we can't get accurate backtrace via gdb,
$ riscv64-linux-gnu-gdb vmlinux vmcore Reading symbols from vmlinux... [New LWP 95] #0 console_unlock () at kernel/printk/printk.c:2557 2557 if (do_cond_resched) (gdb) bt #0 console_unlock () at kernel/printk/printk.c:2557 #1 0x0000000000000000 in ?? ()
With the patch we can get the accurate backtrace,
$ riscv64-linux-gnu-gdb vmlinux vmcore Reading symbols from vmlinux... [New LWP 95] #0 0xffffffe00063a4e0 in test_thread (data=<optimized out>) at drivers/test_crash.c:81 81 *(int *)p = 0xdead; (gdb) (gdb) bt #0 0xffffffe00064d5c0 in test_thread (data=<optimized out>) at drivers/test_crash.c:81 #1 0x0000000000000000 in ?? ()
Test code to produce NULL address dereference in test_crash.c,
void *p = NULL; *(int *)p = 0xdead;
--- arch/riscv/kernel/traps.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/riscv/kernel/traps.c +4 -0
@@ -16,6 +16,7 @@#include <linux/mm.h> #include <linux/module.h> #include <linux/irq.h> +#include <linux/kexec.h> #include <asm/asm-prototypes.h> #include <asm/bug.h>
@@ -44,6 +45,9 @@ void die(struct pt_regs *regs, const char *str) ret =notify_die (DIE_OOPS , str, regs,0 , regs->cause,SIGSEGV ); +if (regs &&kexec_should_crash (current)) +crash_kexec (regs); +bust_spinlocks (0 );add_taint (TAINT_DIE ,LOCKDEP_NOW_UNRELIABLE );spin_unlock_irq (&die_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 338/365 ALSA: hda/realtek: Enable speaker and mute LEDs for HP laptops
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit c578d5da10dc429c6676ab09f3fec0b79b31633a ]
Two more HP laptops that use cs35l41 AMP for speaker and GPIO for mute LEDs.
So use the existing quirk to enable them accordingly.
[ Sort the entries at the SSID order by tiwai ]
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -9234,6 +9234,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8aa3 ,"HP ProBook 450 G9 (MB 8AA1)" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8aa8 ,"HP EliteBook 640 G9 (MB 8AA6)" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8aab ,"HP EliteBook 650 G9 (MB 8AA9)" ,ALC236_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8ad1 ,"HP EliteBook 840 14 inch G9 Notebook PC" ,ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8ad2 ,"HP EliteBook 860 16 inch G9 Notebook PC" ,ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED ),SND_PCI_QUIRK (0x1043 ,0x103e ,"ASUS X540SA" ,ALC256_FIXUP_ASUS_MIC ),SND_PCI_QUIRK (0x1043 ,0x103f ,"ASUS TX300" ,ALC282_FIXUP_ASUS_TX300 ), SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 339/365 ASoC: SOF: Intel: hda: add sanity check on SSP index reported by NHLT
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit e51699505042fb365df3a0ce68b850ccd9ad0108 ]
We should have a limited trust in the BIOS and verify that the SSP index reported in NHLT is valid for each platform.
--- sound/soc/sof/intel/hda.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/sof/intel/hda.c +7 -0
@@ -1395,6 +1395,7 @@ struct snd_soc_acpi_mach *hda_machine_select(struct snd_sof_dev *sdev)if (mach->tplg_quirk_mask &SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER && mach->mach_params.i2s_link_mask) { +const struct sof_intel_dsp_desc *chip =get_chip_info (sdev->pdata);int ssp_num; if (hweight_long(mach->mach_params.i2s_link_mask) > 1 &&
@@ -1404,6 +1405,12 @@ struct snd_soc_acpi_mach *hda_machine_select(struct snd_sof_dev *sdev)/* fls returns 1-based results, SSPs indices are 0-based */ ssp_num =fls (mach->mach_params.i2s_link_mask) -1 ; +if (ssp_num >= chip->ssp_count) { +dev_err (sdev->dev,"Invalid SSP %d, max on this platform is %d\n" , + ssp_num, chip->ssp_count); +return NULL ; + } + tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL, "%s%s%d", sof_pdata->tplg_filename,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 340/365 ASoC: Intel: sof_es8336: Fix GPIO quirks set via module option
In reply to Greg Kroah-HartmanFrom: Andrey Turkin <[email protected]>
[ Upstream commit 5e60f1cfb830342304200437121f440b72b54f54 ]
The two GPIO quirk bits only affected actual GPIO selection when set by the quirks table. They were reported as being in effect when set via module options but actually did nothing.
--- sound/soc/intel/boards/sof_es8336.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
sound/soc/intel/boards/sof_es8336.c +12 -11
@@ -77,8 +77,6 @@ static const struct acpi_gpio_mapping acpi_enable_both_gpios_rev_order[] = { { } }; -static const struct acpi_gpio_mapping *gpio_mapping = acpi_speakers_enable_gpio0; -static void log_quirks (struct device *dev) {dev_info (dev,"quirk mask %#lx\n" , quirk);
@@ -272,15 +270,6 @@ static int sof_es8336_quirk_cb(const struct dmi_system_id *id) { quirk = (unsigned long )id->driver_data; -if (quirk &SOF_ES8336_HEADPHONE_GPIO ) { -if (quirk &SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK ) - gpio_mapping = acpi_enable_both_gpios; -else - gpio_mapping = acpi_enable_both_gpios_rev_order; - }else if (quirk &SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK ) { - gpio_mapping = acpi_speakers_enable_gpio1; - } -return 1 ; }
@@ -529,6 +518,7 @@ static int sof_es8336_probe(struct platform_device *pdev)struct acpi_device *adev;struct snd_soc_dai_link *dai_links;struct device *codec_dev; +const struct acpi_gpio_mapping *gpio_mapping;unsigned int cnt =0 ;int dmic_be_num =0 ;int hdmi_num =3 ;
@@ -635,6 +625,17 @@ static int sof_es8336_probe(struct platform_device *pdev) }/* get speaker enable GPIO */ +if (quirk &SOF_ES8336_HEADPHONE_GPIO ) { +if (quirk &SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK ) + gpio_mapping = acpi_enable_both_gpios; +else + gpio_mapping = acpi_enable_both_gpios_rev_order; + }else if (quirk &SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK ) { + gpio_mapping = acpi_speakers_enable_gpio1; + }else { + gpio_mapping = acpi_speakers_enable_gpio0; + } + ret =devm_acpi_dev_add_driver_gpios (codec_dev, gpio_mapping);if (ret)dev_warn (codec_dev,"unable to add GPIO mapping table\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 341/365 ASoC: Intel: sof_es8336: ignore GpioInt when looking for speaker/headset GPIO lines
In reply to Greg Kroah-HartmanFrom: Andrey Turkin <[email protected]>
[ Upstream commit 751e77011f7a43a204bf2a5d02fbf5f8219bc531 ]
This fixes speaker GPIO detection on machines those ACPI tables list their jack detection GpioInt before output GpioIo. GpioInt entry can never be the speaker/headphone amplifier control so it makes sense to only look for GpioIo entries when looking for them.
--- sound/soc/intel/boards/sof_es8336.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/soc/intel/boards/sof_es8336.c +6 -6
@@ -57,23 +57,23 @@ static const struct acpi_gpio_params enable_gpio0 = { 0, 0, true };static const struct acpi_gpio_params enable_gpio1 = {1 ,0 , true };static const struct acpi_gpio_mapping acpi_speakers_enable_gpio0[] = { - {"speakers-enable-gpios" , &enable_gpio0,1 }, + {"speakers-enable-gpios" , &enable_gpio0,1 ,ACPI_GPIO_QUIRK_ONLY_GPIOIO }, { } };static const struct acpi_gpio_mapping acpi_speakers_enable_gpio1[] = { - {"speakers-enable-gpios" , &enable_gpio1,1 }, + {"speakers-enable-gpios" , &enable_gpio1,1 ,ACPI_GPIO_QUIRK_ONLY_GPIOIO }, };static const struct acpi_gpio_mapping acpi_enable_both_gpios[] = { - {"speakers-enable-gpios" , &enable_gpio0,1 }, - {"headphone-enable-gpios" , &enable_gpio1,1 }, + {"speakers-enable-gpios" , &enable_gpio0,1 ,ACPI_GPIO_QUIRK_ONLY_GPIOIO }, + {"headphone-enable-gpios" , &enable_gpio1,1 ,ACPI_GPIO_QUIRK_ONLY_GPIOIO }, { } };static const struct acpi_gpio_mapping acpi_enable_both_gpios_rev_order[] = { - {"speakers-enable-gpios" , &enable_gpio1,1 }, - {"headphone-enable-gpios" , &enable_gpio0,1 }, + {"speakers-enable-gpios" , &enable_gpio1,1 ,ACPI_GPIO_QUIRK_ONLY_GPIOIO }, + {"headphone-enable-gpios" , &enable_gpio0,1 ,ACPI_GPIO_QUIRK_ONLY_GPIOIO }, { } };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 342/365 ASoC: Intel: sof_nau8825: Move quirk check to the front in late probe
In reply to Greg Kroah-HartmanFrom: Yong Zhi <[email protected]>
[ Upstream commit 5b56db90bbaf9d8581e5e6268727d8ad706555e4 ]
The sof_rt5682_quirk check was placed in the middle of hdmi handling code, move it to the front to be consistent with sof_rt5682.c/sof_card_late_probe().
--- sound/soc/intel/boards/sof_nau8825.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/intel/boards/sof_nau8825.c +5 -5
@@ -177,11 +177,6 @@ static int sof_card_late_probe(struct snd_soc_card *card)struct sof_hdmi_pcm *pcm;int err; -if (list_empty (&ctx->hdmi_pcm_list)) -return -EINVAL ; - - pcm = list_first_entry(&ctx->hdmi_pcm_list, struct sof_hdmi_pcm, head); -if (sof_nau8825_quirk &SOF_MAX98373_SPEAKER_AMP_PRESENT ) {/* Disable Left and Right Spk pin after boot */ snd_soc_dapm_disable_pin (dapm,"Left Spk" );
@@ -191,6 +186,11 @@ static int sof_card_late_probe(struct snd_soc_card *card)return err; } +if (list_empty (&ctx->hdmi_pcm_list)) +return -EINVAL ; + + pcm = list_first_entry(&ctx->hdmi_pcm_list, struct sof_hdmi_pcm, head); +return hda_dsp_hdmi_build_controls (card, pcm->codec_dai->component); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 343/365 watchdog: export lockup_detector_reconfigure
In reply to Greg Kroah-HartmanFrom: Laurent Dufour <[email protected]>
[ Upstream commit 7c56a8733d0a2a4be2438a7512566e5ce552fccf ]
In some circumstances it may be interesting to reconfigure the watchdog from inside the kernel.
On PowerPC, this may helpful before and after a LPAR migration (LPM) is initiated, because it implies some latencies, watchdog, and especially NMI watchdog is expected to be triggered during this operation. Reconfiguring the watchdog with a factor, would prevent it to happen too frequently during LPM.
Rename lockup_detector_reconfigure() as __lockup_detector_reconfigure() and create a new function lockup_detector_reconfigure() calling __lockup_detector_reconfigure() under the protection of watchdog_mutex.
--- include/linux/nmi.h | 2 ++ kernel/watchdog.c | 21 ++++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-)
include/linux/nmi.h +2 -0
@@ -122,6 +122,8 @@ int watchdog_nmi_probe(void);int watchdog_nmi_enable (unsigned int cpu);void watchdog_nmi_disable (unsigned int cpu); +void lockup_detector_reconfigure (void ); +/** * touch_nmi_watchdog - restart NMI watchdog timeout. *
kernel/watchdog.c +16 -5
@@ -537,7 +537,7 @@ int lockup_detector_offline_cpu(unsigned int cpu)return 0 ; } -static void lockup_detector_reconfigure (void ) +static void __lockup_detector_reconfigure (void ) {cpus_read_lock ();watchdog_nmi_stop ();
@@ -557,6 +557,13 @@ static void lockup_detector_reconfigure(void)__lockup_detector_cleanup (); } +void lockup_detector_reconfigure (void ) +{ +mutex_lock (&watchdog_mutex); +__lockup_detector_reconfigure (); +mutex_unlock (&watchdog_mutex); +} +/* * Create the watchdog infrastructure and configure the detector(s). */
@@ -573,13 +580,13 @@ static __init void lockup_detector_setup(void)return ;mutex_lock (&watchdog_mutex); -lockup_detector_reconfigure (); +__lockup_detector_reconfigure (); softlockup_initialized = true; mutex_unlock(&watchdog_mutex); }#else /* CONFIG_SOFTLOCKUP_DETECTOR */ -static void lockup_detector_reconfigure (void ) +static void __lockup_detector_reconfigure (void ) {cpus_read_lock ();watchdog_nmi_stop ();
@@ -587,9 +594,13 @@ static void lockup_detector_reconfigure(void)watchdog_nmi_start (); cpus_read_unlock(); } +void lockup_detector_reconfigure (void ) +{ +__lockup_detector_reconfigure (); +}static inline void lockup_detector_setup (void ) { -lockup_detector_reconfigure (); +__lockup_detector_reconfigure (); }#endif /* !CONFIG_SOFTLOCKUP_DETECTOR */
@@ -629,7 +640,7 @@ static void proc_watchdog_update(void) {/* Remove impossible cpus to keep sysctl output clean. */ cpumask_and (&watchdog_cpumask, &watchdog_cpumask, cpu_possible_mask); -lockup_detector_reconfigure (); +__lockup_detector_reconfigure (); }/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 344/365 powerpc/watchdog: introduce a NMI watchdogs factor
In reply to Greg Kroah-HartmanFrom: Laurent Dufour <[email protected]>
[ Upstream commit f5e74e836097d1004077390717d4bd95d4a2c27a ]
Introduce a factor which would apply to the NMI watchdog timeout.
This factor is a percentage added to the watchdog_tresh value. The value is set under the watchdog_mutex protection and lockup_detector_reconfigure() is called to recompute wd_panic_timeout_tb.
Once the factor is set, it remains until it is set back to 0, which means no impact.
--- arch/powerpc/include/asm/nmi.h | 2 ++ arch/powerpc/kernel/watchdog.c | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/nmi.h +2 -0
@@ -5,8 +5,10 @@#ifdef CONFIG_PPC_WATCHDOG extern void arch_touch_nmi_watchdog (void );long soft_nmi_interrupt (struct pt_regs *regs); +void watchdog_nmi_set_timeout_pct (u64 pct);#else static inline void arch_touch_nmi_watchdog (void ) {} +static inline void watchdog_nmi_set_timeout_pct (u64 pct) {}#endif #ifdef CONFIG_NMI_IPI
arch/powerpc/kernel/watchdog.c +20 -1
@@ -91,6 +91,10 @@ static cpumask_t wd_smp_cpus_pending;static cpumask_t wd_smp_cpus_stuck;static u64 wd_smp_last_reset_tb; +#ifdef CONFIG_PPC_PSERIES +static u64 wd_timeout_pct; +#endif +/* * Try to take the exclusive watchdog action / NMI IPI / printing lock. * wd_smp_lock must be held. If this fails, we should return and wait
@@ -527,7 +531,13 @@ static int stop_watchdog_on_cpu(unsigned int cpu)static void watchdog_calc_timeouts (void ) { - wd_panic_timeout_tb = watchdog_thresh * ppc_tb_freq; +u64 threshold = watchdog_thresh; + +#ifdef CONFIG_PPC_PSERIES + threshold += (READ_ONCE (wd_timeout_pct) * threshold) /100 ; +#endif + + wd_panic_timeout_tb = threshold * ppc_tb_freq;/* Have the SMP detector trigger a bit later */ wd_smp_panic_timeout_tb = wd_panic_timeout_tb *3 /2 ;
@@ -570,3 +580,12 @@ int __init watchdog_nmi_probe(void) }return 0 ; } + +#ifdef CONFIG_PPC_PSERIES +void watchdog_nmi_set_timeout_pct (u64 pct) +{ +pr_info ("Set the NMI watchdog timeout factor to %llu%%\n" , pct); +WRITE_ONCE (wd_timeout_pct, pct); +lockup_detector_reconfigure (); +} +#endif
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 345/365 powerpc/pseries/mobility: set NMI watchdog factor during an LPM
In reply to Greg Kroah-HartmanFrom: Laurent Dufour <[email protected]>
[ Upstream commit 118b1366930c8c833b8b36abef657f40d4e26610 ]
During an LPM, while the memory transfer is in progress on the arrival side, some latencies are generated when accessing not yet transferred pages on the arrival side. Thus, the NMI watchdog may be triggered too frequently, which increases the risk to hit an NMI interrupt in a bad place in the kernel, leading to a kernel panic.
Disabling the Hard Lockup Watchdog until the memory transfer could be a too strong work around, some users would want this timeout to be eventually triggered if the system is hanging even during an LPM.
Introduce a new sysctl variable nmi_watchdog_factor. It allows to apply a factor to the NMI watchdog timeout during an LPM. Just before the CPUs are stopped for the switchover sequence, the NMI watchdog timer is set to watchdog_thresh + factor%
A value of 0 has no effect. The default value is 200, meaning that the NMI watchdog is set to 30s during LPM (based on a 10s watchdog_thresh value). Once the memory transfer is achieved, the factor is reset to 0.
Setting this value to a high number is like disabling the NMI watchdog during an LPM.
--- Documentation/admin-guide/sysctl/kernel.rst | 12 ++++++ arch/powerpc/platforms/pseries/mobility.c | 43 +++++++++++++++++++++ 2 files changed, 55 insertions(+)
Documentation/admin-guide/sysctl/kernel.rst +12 -0
@@ -592,6 +592,18 @@ to the guest kernel command line (see Documentation/admin-guide/kernel-parameters.rst). +nmi_wd_lpm_factor (PPC only) +============================ + +Factor to apply to the NMI watchdog timeout (only when ``nmi_watchdog`` is +set to 1). This factor represents the percentage added to +``watchdog_thresh`` when calculating the NMI watchdog timeout during an +LPM. The soft lockup timeout is not impacted. + +A value of 0 means no change. The default value is 200 meaning the NMI +watchdog is set to 30s (based on ``watchdog_thresh`` equal to 10). + + numa_balancing ==============
arch/powerpc/platforms/pseries/mobility.c +43 -0
68 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 346/365 powerpc/32: Set an IBAT covering up to _einittext during init
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 2a0fb3c155c97c75176e557d61f8e66c1bd9b735 ]
Always set an IBAT covering up to _einittext during init because when CONFIG_MODULES is not selected there is no reason to have an exception handler for kernel instruction TLB misses.
It implies DBAT and IBAT are now totaly independent, IBATs are set by setibat() and DBAT by setbat().
This allows to revert commit 9bb162fa26ed ("powerpc/603: Fix boot failure with DEBUG_PAGEALLOC and KFENCE")
--- arch/powerpc/kernel/head_book3s_32.S | 4 ++-- arch/powerpc/mm/book3s32/mmu.c | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-)
arch/powerpc/kernel/head_book3s_32.S +2 -2
@@ -418,14 +418,14 @@ InstructionTLBMiss: */ /* Get PTE (linux-style) and check access */ mfspr r3,SPRN_IMISS -#if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE) +#ifdef CONFIG_MODULES lis r1, TASK_SIZE@h /* check if kernel address */ cmplw 0,r1,r3 #endif mfspr r2, SPRN_SDR1 li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC | _PAGE_USER rlwinm r2, r2, 28, 0xfffff000 -#if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE) +#ifdef CONFIG_MODULES bgt- 112f lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC
arch/powerpc/mm/book3s32/mmu.c +4 -6
@@ -159,7 +159,10 @@ unsigned long __init mmu_mapin_ram(unsigned long base, unsigned long top) {unsigned long done;unsigned long border = (unsigned long )__init_begin -PAGE_OFFSET ; +unsigned long size; + size =roundup_pow_of_two ((unsigned long )_einittext -PAGE_OFFSET ); +setibat (0 ,PAGE_OFFSET ,0 , size,PAGE_KERNEL_X );if (debug_pagealloc_enabled_or_kfence () || __map_without_bats) {pr_debug_once ("Read-Write memory mapped without BATs\n" );
@@ -245,10 +248,9 @@ void mmu_mark_rodata_ro(void) }/* -* Set up one of the I/D BAT (block address translation) register pairs. +* Set up one of the D BAT (block address translation) register pairs. * The parameters are not checked; in particular size must be a power * of 2 between 128k and 256M. -* On 603+, only set IBAT when _PAGE_EXEC is set */ void __init setbat (int index,unsigned long virt,phys_addr_t phys,unsigned int size,pgprot_t prot)
@@ -284,10 +286,6 @@ void __init setbat(int index, unsigned long virt, phys_addr_t phys,/* G bit must be zero in IBATs */ flags &= ~_PAGE_EXEC; } -if (flags & _PAGE_EXEC) - bat[0 ] = bat[1 ]; -else - bat[0 ].batu = bat[0 ].batl =0 ; bat_addrs[index].start = virt; bat_addrs[index].limit = virt + ((bl +1 ) <<17 ) -1 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 347/365 powerpc/32: Dont always pass -mcpu=powerpc to the compiler
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 446cda1b21d9a6b3697fe399c6a3a00ff4a285f5 ]
Since commit 4bf4f42a2feb ("powerpc/kbuild: Set default generic machine type for 32-bit compile"), when building a 32 bits kernel with a bi-arch version of GCC, or when building a book3s/32 kernel, the option -mcpu=powerpc is passed to GCC at all time, relying on it being eventually overriden by a subsequent -mcpu=xxxx.
But when building the same kernel with a 32 bits only version of GCC, that is not done, relying on gcc being built with the expected default CPU.
This logic has two problems. First, it is a bit fragile to rely on whether the GCC version is bi-arch or not, because today we can have bi-arch versions of GCC configured with a 32 bits default. Second, there are some versions of GCC which don't support -mcpu=powerpc, for instance for e500 SPE-only versions.
So, stop relying on this approximative logic and allow the user to decide whether he/she wants to use the toolchain's default CPU or if he/she wants to set one, and allow only possible CPUs based on the selected target.
--- arch/powerpc/Makefile | 26 +------------------------- arch/powerpc/platforms/Kconfig.cputype | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 28 deletions(-)
arch/powerpc/Makefile +1 -25
@@ -15,23 +15,6 @@ HAS_BIARCH := $(call cc-option-yn, -m32) # Set default 32 bits cross compilers for vdso and boot wrapper CROSS32_COMPILE ?= -ifeq ($(HAS_BIARCH),y) -ifeq ($(CROSS32_COMPILE),) -ifdef CONFIG_PPC32 -# These options will be overridden by any -mcpu option that the CPU -# or platform code sets later on the command line, but they are needed -# to set a sane 32-bit cpu target for the 64-bit cross compiler which -# may default to the wrong ISA. -KBUILD_CFLAGS += -mcpu=powerpc -KBUILD_AFLAGS += -mcpu=powerpc -endif -endif -endif - -ifdef CONFIG_PPC_BOOK3S_32 -KBUILD_CFLAGS += -mcpu=powerpc -endif - # If we're on a ppc/ppc64/ppc64le machine use that defconfig, otherwise just use # ppc64_defconfig because we have nothing better to go on. uname := $(shell uname -m)
@@ -183,6 +166,7 @@ endif endif CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU)) +AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU)) # Altivec option not allowed with e500mc64 in GCC. ifdef CONFIG_ALTIVEC
@@ -193,14 +177,6 @@ endif CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU) CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU)) -ifdef CONFIG_PPC32 -ifdef CONFIG_PPC_E500MC -CFLAGS-y += $(call cc-option,-mcpu=e500mc,-mcpu=powerpc) -else -CFLAGS-$(CONFIG_E500) += $(call cc-option,-mcpu=8540 -msoft-float,-mcpu=powerpc) -endif -endif - asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1) KBUILD_CPPFLAGS += -I $(srctree)/arch/$(ARCH) $(asinstr)
arch/powerpc/platforms/Kconfig.cputype +18 -3
@@ -136,9 +136,9 @@ config GENERIC_CPU select ARCH_HAS_FAST_MULTIPLIER select PPC_64S_HASH_MMU -config GENERIC_CPU +config POWERPC_CPU bool "Generic 32 bits powerpc" - depends on PPC32 && !PPC_8xx + depends on PPC32 && !PPC_8xx && !PPC_85xx config CELL_CPU bool "Cell Broadband Engine"
@@ -197,11 +197,23 @@ config G4_CPU depends on PPC_BOOK3S_32 select ALTIVEC +config E500_CPU + bool "e500 (8540)" + depends on PPC_85xx && !PPC_E500MC + +config E500MC_CPU + bool "e500mc" + depends on PPC_85xx && PPC_E500MC + +config TOOLCHAIN_DEFAULT_CPU + bool "Rely on the toolchain's implicit default CPU" + depends on PPC32 + endchoice config TARGET_CPU_BOOL bool - default !GENERIC_CPU + default !GENERIC_CPU && !TOOLCHAIN_DEFAULT_CPU config TARGET_CPU string
@@ -216,6 +228,9 @@ config TARGET_CPU default "e300c2" if E300C2_CPU default "e300c3" if E300C3_CPU default "G4" if G4_CPU + default "8540" if E500_CPU + default "e500mc" if E500MC_CPU + default "powerpc" if POWERPC_CPU config PPC_BOOK3S def_bool y
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 348/365 ASoC: codecs: va-macro: use fsgen as clock
In reply to Greg Kroah-HartmanFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit 30097967e0566cac817273ef76add100f6b0f463 ]
VA Macro fsgen clock is supplied to other LPASS Macros using proper clock apis, however the internal user uses the registers directly without clk apis. This approch has race condition where in external users of the clock might cut the clock while VA macro is actively using this.
Moving the internal usage to clk apis would provide a proper refcounting and avoid such race conditions.
This issue was noticed while headset was pulled out while recording is in progress and shifting record patch to DMIC.
--- sound/soc/codecs/lpass-va-macro.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
sound/soc/codecs/lpass-va-macro.c +9 -2
@@ -199,6 +199,7 @@ struct va_macro {struct clk *mclk;struct clk *macro;struct clk *dcodec; +struct clk *fsgen;struct clk_hw hw;struct lpass_macro *pds;
@@ -467,9 +468,9 @@ static int va_macro_mclk_event(struct snd_soc_dapm_widget *w,switch (event) {case SND_SOC_DAPM_PRE_PMU : -return va_macro_mclk_enable (va, true); +return clk_prepare_enable (va->fsgen);case SND_SOC_DAPM_POST_PMD : -return va_macro_mclk_enable (va, false); +clk_disable_unprepare (va->fsgen); }return 0 ;
@@ -1473,6 +1474,12 @@ static int va_macro_probe(struct platform_device *pdev)if (ret) goto err_clkout; + va->fsgen =clk_hw_get_clk (&va->hw,"fsgen" ); +if (IS_ERR (va->fsgen)) { + ret =PTR_ERR (va->fsgen); + goto err_clkout; + } + ret =devm_snd_soc_register_component (dev, &va_macro_component_drv, va_macro_dais,ARRAY_SIZE (va_macro_dais));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 349/365 ovl: warn if trusted xattr creation fails
In reply to Greg Kroah-HartmanFrom: Miklos Szeredi <[email protected]>
[ Upstream commit b10b85fe5149ee8b39fbbf86095b303632dde2cd ]
When mounting overlayfs in an unprivileged user namespace, trusted xattr creation will fail. This will lead to failures in some file operations, e.g. in the following situation:
mkdir lower upper work merged
mkdir lower/directory
mount -toverlay -olowerdir=lower,upperdir=upper,workdir=work none merged rmdir merged/directory
mkdir merged/directory
The last mkdir will fail:
mkdir: cannot create directory 'merged/directory': Input/output error
The cause for these failures is currently extremely non-obvious and hard to debug. Hence, warn the user and suggest using the userxattr mount option, if it is not already supplied and xattr creation fails during the self-check.
--- fs/overlayfs/super.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/overlayfs/super.c +5 -2
@@ -1418,11 +1418,12 @@ static int ovl_make_workdir(struct super_block *sb, struct ovl_fs *ofs,*/ err =ovl_setxattr (ofs, ofs->workdir,OVL_XATTR_OPAQUE ,"0" ,1 );if (err) { +pr_warn ("failed to set xattr on upper\n" ); ofs->noxattr = true;if (ofs->config.index || ofs->config.metacopy) { ofs->config.index = false; ofs->config.metacopy = false; -pr_warn ("upper fs does not support xattr, falling back to index=off,metacopy=off.\n" ); +pr_warn ("...falling back to index=off,metacopy=off.\n" ); }/* * xattr support is required for persistent st_ino.
@@ -1430,8 +1431,10 @@ static int ovl_make_workdir(struct super_block *sb, struct ovl_fs *ofs,*/ if (ofs->config.xino ==OVL_XINO_AUTO ) { ofs->config.xino =OVL_XINO_OFF ; -pr_warn ("upper fs does not support xattr, falling back to xino=off.\n" ); +pr_warn ("...falling back to xino=off.\n" ); } +if (err == -EPERM && !ofs->config.userxattr) +pr_info ("try mounting with 'userxattr' option\n" ); err =0 ; }else {ovl_removexattr (ofs, ofs->workdir,OVL_XATTR_OPAQUE );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 350/365 powerpc/ioda/iommu/debugfs: Generate unique debugfs entries
In reply to Greg Kroah-HartmanFrom: Alexey Kardashevskiy <[email protected]>
[ Upstream commit d73b46c3c1449bf27f793b9d9ee86ed70c7a7163 ]
The iommu_table::it_index is a LIOBN which is not initialized on PowerNV as it is not used except IOMMU debugfs where it is used for a node name.
This initializes it_index witn a unique number to avoid warnings and have a node for every iommu_table.
This should not cause any behavioral change without CONFIG_IOMMU_DEBUGFS.
--- arch/powerpc/platforms/powernv/pci-ioda.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/platforms/powernv/pci-ioda.c +2 -0
@@ -1609,6 +1609,7 @@ static void pnv_pci_ioda1_setup_dma_pe(struct pnv_phb *phb, tbl->it_ops = &pnv_ioda1_iommu_ops; pe->table_group.tce32_start = tbl->it_offset << tbl->it_page_shift; pe->table_group.tce32_size = tbl->it_size << tbl->it_page_shift; + tbl->it_index = (phb->hose->global_number <<16 ) | pe->pe_number;if (!iommu_init_table (tbl, phb->hose->node,0 ,0 ))panic ("Failed to initialize iommu table" );
@@ -1779,6 +1780,7 @@ static long pnv_pci_ioda2_setup_default_config(struct pnv_ioda_pe *pe) res_end =min (window_size,SZ_4G ) >> tbl->it_page_shift; } + tbl->it_index = (pe->phb->hose->global_number <<16 ) | pe->pe_number;if (iommu_init_table (tbl, pe->phb->hose->node, res_start, res_end)) rc =pnv_pci_ioda2_set_window (&pe->table_group,0 , tbl);else
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 351/365 ALSA: core: Add async signal helpers
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit ef34a0ae7a2654bc9e58675e36898217fb2799d8 ]
Currently the call of kill_fasync() from an interrupt handler might lead to potential spin deadlocks, as spotted by syzkaller. Unfortunately, it's not so trivial to fix this lock chain as it's involved with the tasklist_lock that is touched in allover places.
As a temporary workaround, this patch provides the way to defer the async signal notification in a work. The new helper functions, snd_fasync_helper() and snd_kill_faync() are replacements for fasync_helper() and kill_fasync(), respectively. In addition, snd_fasync_free() needs to be called at the destructor of the relevant file object.
--- include/sound/core.h | 8 ++++ sound/core/misc.c | 94 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+)
include/sound/core.h +8 -0
@@ -501,4 +501,12 @@ snd_pci_quirk_lookup_id(u16 vendor, u16 device, }#endif +/* async signal helpers */ +struct snd_fasync ; + +int snd_fasync_helper (int fd,struct file *file,int on, +struct snd_fasync **fasyncp); +void snd_kill_fasync (struct snd_fasync *fasync,int signal,int poll); +void snd_fasync_free (struct snd_fasync *fasync); +#endif /* __SOUND_CORE_H */
sound/core/misc.c +94 -0
103 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 352/365 ALSA: timer: Use deferred fasync helper
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 95cc637c1afd83fb7dd3d7c8a53710488f4caf9c ]
For avoiding the potential deadlock via kill_fasync() call, use the new fasync helpers to defer the invocation from PCI API. Note that it's merely a workaround.
--- sound/core/timer.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
sound/core/timer.c +6 -5
@@ -83,7 +83,7 @@ struct snd_timer_user {unsigned int filter;struct timespec64 tstamp;/* trigger tstamp */ wait_queue_head_t qchange_sleep; -struct fasync_struct *fasync; +struct snd_fasync *fasync;struct mutex ioctl_lock; };
@@ -1345,7 +1345,7 @@ static void snd_timer_user_interrupt(struct snd_timer_instance *timeri, } __wake:spin_unlock (&tu->qlock); -kill_fasync (&tu->fasync,SIGIO ,POLL_IN ); +snd_kill_fasync (tu->fasync,SIGIO ,POLL_IN );wake_up (&tu->qchange_sleep); }
@@ -1383,7 +1383,7 @@ static void snd_timer_user_ccallback(struct snd_timer_instance *timeri,spin_lock_irqsave (&tu->qlock, flags);snd_timer_user_append_to_tqueue (tu, &r1);spin_unlock_irqrestore (&tu->qlock, flags); -kill_fasync (&tu->fasync,SIGIO ,POLL_IN ); +snd_kill_fasync (tu->fasync,SIGIO ,POLL_IN );wake_up (&tu->qchange_sleep); }
@@ -1453,7 +1453,7 @@ static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri,spin_unlock (&tu->qlock);if (append ==0 )return ; -kill_fasync (&tu->fasync,SIGIO ,POLL_IN ); +snd_kill_fasync (tu->fasync,SIGIO ,POLL_IN );wake_up (&tu->qchange_sleep); }
@@ -1521,6 +1521,7 @@ static int snd_timer_user_release(struct inode *inode, struct file *file)snd_timer_instance_free (tu->timeri); }mutex_unlock (&tu->ioctl_lock); +snd_fasync_free (tu->fasync);kfree (tu->queue);kfree (tu->tqueue);kfree (tu);
@@ -2135,7 +2136,7 @@ static int snd_timer_user_fasync(int fd, struct file * file, int on)struct snd_timer_user *tu; tu = file->private_data; -return fasync_helper (fd, file, on, &tu->fasync); +return snd_fasync_helper (fd, file, on, &tu->fasync); } static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 353/365 ALSA: pcm: Use deferred fasync helper
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 96b097091c66df4f6fbf5cbff21df6cc02a2f055 ]
For avoiding the potential deadlock via kill_fasync() call, use the new fasync helpers to defer the invocation from timer API. Note that it's merely a workaround.
--- include/sound/pcm.h | 2 +- sound/core/pcm.c | 1 + sound/core/pcm_lib.c | 2 +- sound/core/pcm_native.c | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-)
include/sound/pcm.h +1 -1
@@ -399,7 +399,7 @@ struct snd_pcm_runtime {snd_pcm_uframes_t twake;/* do transfer (!poll) wakeup if non-zero */ wait_queue_head_t sleep;/* poll sleep */ wait_queue_head_t tsleep;/* transfer sleep */ -struct fasync_struct *fasync; +struct snd_fasync *fasync;bool stop_operating;/* sync_stop will be called */ struct mutex buffer_mutex;/* protect for buffer changes */ atomic_t buffer_accessing;/* >0: in r/w operation, <0: blocked */
sound/core/pcm.c +1 -0
@@ -1005,6 +1005,7 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream) substream->runtime =NULL ; }mutex_destroy (&runtime->buffer_mutex); +snd_fasync_free (runtime->fasync);kfree (runtime);put_pid (substream->pid); substream->pid =NULL ;
sound/core/pcm_lib.c +1 -1
@@ -1822,7 +1822,7 @@ void snd_pcm_period_elapsed_under_stream_lock(struct snd_pcm_substream *substreasnd_timer_interrupt (substream->timer,1 );#endif _end: -kill_fasync (&runtime->fasync,SIGIO ,POLL_IN ); +snd_kill_fasync (runtime->fasync,SIGIO ,POLL_IN ); }EXPORT_SYMBOL (snd_pcm_period_elapsed_under_stream_lock);
sound/core/pcm_native.c +1 -1
@@ -3945,7 +3945,7 @@ static int snd_pcm_fasync(int fd, struct file * file, int on) runtime = substream->runtime;if (runtime->status->state ==SNDRV_PCM_STATE_DISCONNECTED )return -EBADFD ; -return fasync_helper (fd, file, on, &runtime->fasync); +return snd_fasync_helper (fd, file, on, &runtime->fasync); }/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 354/365 ALSA: control: Use deferred fasync helper
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 4a971e84a7ae10a38d875cd2d4e487c8d1682ca3 ]
For avoiding the potential deadlock via kill_fasync() call, use the new fasync helpers to defer the invocation from the control API. Note that it's merely a workaround.
Another note: although we haven't received reports about the deadlock with the control API, the deadlock is still potentially possible, and it's better to align the behavior with other core APIs (PCM and timer); so let's move altogether.
--- include/sound/control.h | 2 +- sound/core/control.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-)
include/sound/control.h +1 -1
@@ -109,7 +109,7 @@ struct snd_ctl_file {int preferred_subdevice[SND_CTL_SUBDEV_ITEMS ];wait_queue_head_t change_sleep;spinlock_t read_lock; -struct fasync_struct *fasync; +struct snd_fasync *fasync;int subscribed;/* read interface is activated */ struct list_head events;/* waiting events for read */ };
sound/core/control.c +4 -3
@@ -127,6 +127,7 @@ static int snd_ctl_release(struct inode *inode, struct file *file)if (control->vd[idx].owner == ctl) control->vd[idx].owner =NULL ;up_write (&card->controls_rwsem); +snd_fasync_free (ctl->fasync);snd_ctl_empty_read_queue (ctl);put_pid (ctl->pid);kfree (ctl);
@@ -181,7 +182,7 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask, _found:wake_up (&ctl->change_sleep);spin_unlock (&ctl->read_lock); -kill_fasync (&ctl->fasync,SIGIO ,POLL_IN ); +snd_kill_fasync (ctl->fasync,SIGIO ,POLL_IN ); }read_unlock_irqrestore (&card->ctl_files_rwlock, flags); }
@@ -2002,7 +2003,7 @@ static int snd_ctl_fasync(int fd, struct file * file, int on)struct snd_ctl_file *ctl; ctl = file->private_data; -return fasync_helper (fd, file, on, &ctl->fasync); +return snd_fasync_helper (fd, file, on, &ctl->fasync); }/* return the preferred subdevice number if already assigned;
@@ -2170,7 +2171,7 @@ static int snd_ctl_dev_disconnect(struct snd_device *device)read_lock_irqsave (&card->ctl_files_rwlock, flags);list_for_each_entry (ctl, &card->ctl_files, list) {wake_up (&ctl->change_sleep); -kill_fasync (&ctl->fasync,SIGIO ,POLL_ERR ); +snd_kill_fasync (ctl->fasync,SIGIO ,POLL_ERR ); }read_unlock_irqrestore (&card->ctl_files_rwlock, flags);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 355/365 f2fs: fix to avoid use f2fs_bug_on() in f2fs_new_node_page()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 141170b759e03958f296033bb7001be62d1d363b ]
As Dipanjan Das <[email protected]> reported, syzkaller found a f2fs bug as below:
RIP: 0010:f2fs_new_node_page+0x19ac/0x1fc0 fs/f2fs/node.c:1295 Call Trace: write_all_xattrs fs/f2fs/xattr.c:487 [inline] __f2fs_setxattr+0xe76/0x2e10 fs/f2fs/xattr.c:743 f2fs_setxattr+0x233/0xab0 fs/f2fs/xattr.c:790 f2fs_xattr_generic_set+0x133/0x170 fs/f2fs/xattr.c:86 __vfs_setxattr+0x115/0x180 fs/xattr.c:182 __vfs_setxattr_noperm+0x125/0x5f0 fs/xattr.c:216 __vfs_setxattr_locked+0x1cf/0x260 fs/xattr.c:277 vfs_setxattr+0x13f/0x330 fs/xattr.c:303 setxattr+0x146/0x160 fs/xattr.c:611 path_setxattr+0x1a7/0x1d0 fs/xattr.c:630 __do_sys_lsetxattr fs/xattr.c:653 [inline] __se_sys_lsetxattr fs/xattr.c:649 [inline] __x64_sys_lsetxattr+0xbd/0x150 fs/xattr.c:649 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0
NAT entry and nat bitmap can be inconsistent, e.g. one nid is free in nat bitmap, and blkaddr in its NAT entry is not NULL_ADDR, it may trigger BUG_ON() in f2fs_new_node_page(), fix it.
--- fs/f2fs/node.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/f2fs/node.c +5 -1
@@ -1292,7 +1292,11 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs)dec_valid_node_count (sbi, dn->inode, !ofs); goto fail; } -f2fs_bug_on (sbi, new_ni.blk_addr !=NULL_ADDR ); +if (unlikely (new_ni.blk_addr !=NULL_ADDR )) { + err = -EFSCORRUPTED ; +set_sbi_flag (sbi,SBI_NEED_FSCK ); + goto fail; + }#endif new_ni.nid = dn->nid; new_ni.ino = dn->inode->i_ino;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 356/365 f2fs: fix to do sanity check on segment type in build_sit_entries()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 09beadf289d6e300553e60d6e76f13c0427ecab3 ]
As Wenqing Liu <[email protected]> reported in bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=216285
RIP: 0010:memcpy_erms+0x6/0x10 f2fs_update_meta_page+0x84/0x570 [f2fs] change_curseg.constprop.0+0x159/0xbd0 [f2fs] f2fs_do_replace_block+0x5c7/0x18a0 [f2fs] f2fs_replace_block+0xeb/0x180 [f2fs] recover_data+0x1abd/0x6f50 [f2fs] f2fs_recover_fsync_data+0x12ce/0x3250 [f2fs] f2fs_fill_super+0x4459/0x6190 [f2fs] mount_bdev+0x2cf/0x3b0 legacy_get_tree+0xed/0x1d0 vfs_get_tree+0x81/0x2b0 path_mount+0x47e/0x19d0 do_mount+0xce/0xf0 __x64_sys_mount+0x12c/0x1a0 do_syscall_64+0x38/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd
The root cause is segment type is invalid, so in f2fs_do_replace_block(), f2fs accesses f2fs_sm_info::curseg_array with out-of-range segment type, result in accessing invalid curseg->sum_blk during memcpy in f2fs_update_meta_page(). Fix this by adding sanity check on segment type in build_sit_entries().
--- fs/f2fs/segment.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
fs/f2fs/segment.c +13 -0
@@ -4362,6 +4362,12 @@ static int build_sit_entries(struct f2fs_sb_info *sbi)return err;seg_info_from_raw_sit (se, &sit); +if (se->type >=NR_PERSISTENT_LOG ) { +f2fs_err (sbi,"Invalid segment type: %u, segno: %u" , + se->type, start); +return -EFSCORRUPTED ; + } + sit_valid_blocks[SE_PAGETYPE (se)] += se->valid_blocks;if (f2fs_block_unit_discard (sbi)) {
@@ -4410,6 +4416,13 @@ static int build_sit_entries(struct f2fs_sb_info *sbi)break ;seg_info_from_raw_sit (se, &sit); +if (se->type >=NR_PERSISTENT_LOG ) { +f2fs_err (sbi,"Invalid segment type: %u, segno: %u" , + se->type, start); + err = -EFSCORRUPTED ; +break ; + } + sit_valid_blocks[SE_PAGETYPE (se)] += se->valid_blocks;if (f2fs_block_unit_discard (sbi)) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 357/365 smb3: check xattr value length earlier
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
[ Upstream commit 5fa2cffba0b82336a2244d941322eb1627ff787b ]
Coverity complains about assigning a pointer based on value length before checking that value length goes beyond the end of the SMB. Although this is even more unlikely as value length is a single byte, and the pointer is not dereferenced until laterm, it is clearer to check the lengths first.
Addresses-Coverity: 1467704 ("Speculative execution data leak")
--- fs/cifs/smb2ops.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/cifs/smb2ops.c +3 -2
@@ -1145,9 +1145,7 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size,size_t name_len, value_len, user_name_len;while (src_size >0 ) { - name = &src->ea_data[0 ]; name_len = (size_t )src->ea_name_length; - value = &src->ea_data[src->ea_name_length +1 ]; value_len = (size_t )le16_to_cpu (src->ea_value_length);if (name_len ==0 )
@@ -1159,6 +1157,9 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size, goto out; } + name = &src->ea_data[0 ]; + value = &src->ea_data[src->ea_name_length +1 ]; +if (ea_name) {if (ea_name_len == name_len &&memcmp (ea_name, name, name_len) ==0 ) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 358/365 powerpc/64: Init jump labels before parse_early_param()
In reply to Greg Kroah-HartmanFrom: Zhouyi Zhou <[email protected]>
[ Upstream commit ca829e05d3d4f728810cc5e4b468d9ebc7745eb3 ]
On 64-bit, calling jump_label_init() in setup_feature_keys() is too late because static keys may be used in subroutines of parse_early_param() which is again subroutine of early_init_devtree().
For example booting with "threadirqs":
static_key_enable_cpuslocked(): static key '0xc000000002953260' used before call to jump_label_init()
WARNING: CPU: 0 PID: 0 at kernel/jump_label.c:166 static_key_enable_cpuslocked+0xfc/0x120
...
NIP static_key_enable_cpuslocked+0xfc/0x120
LR static_key_enable_cpuslocked+0xf8/0x120
Call Trace:
static_key_enable_cpuslocked+0xf8/0x120 (unreliable)
static_key_enable+0x30/0x50
setup_forced_irqthreads+0x28/0x40
do_early_param+0xa0/0x108
parse_args+0x290/0x4e0
parse_early_options+0x48/0x5c
parse_early_param+0x58/0x84
early_init_devtree+0xd4/0x518
early_setup+0xb4/0x214So call jump_label_init() just before parse_early_param() in early_init_devtree().
--- arch/powerpc/kernel/prom.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/powerpc/kernel/prom.c +7 -0
@@ -751,6 +751,13 @@ void __init early_init_devtree(void *params)early_init_dt_scan_root ();early_init_dt_scan_memory_ppc (); +/* +* As generic code authors expect to be able to use static keys +* in early_param() handlers, we initialize the static keys just +* before parsing early params (it's fine to call jump_label_init() +* more than once). +*/ +jump_label_init ();parse_early_param ();/* make sure we've parsed cmdline for mem= before this */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 359/365 venus: pm_helpers: Fix warning in OPP during probe
In reply to Greg Kroah-HartmanFrom: Stanimir Varbanov <[email protected]>
[ Upstream commit 1d95af02f23031c2e1cca7607c514b86ce85bc6e ]
Fix the following WARN triggered during Venus driver probe on 5.19.0-rc8-next-20220728:
WARNING: CPU: 7 PID: 339 at drivers/opp/core.c:2471 dev_pm_opp_set_config+0x49c/0x610 Modules linked in: qcom_spmi_adc5 rtc_pm8xxx qcom_spmi_adc_tm5 leds_qcom_lpg led_class_multicolor qcom_pon qcom_vadc_common venus_core(+) qcom_spmi_temp_alarm v4l2_mem2mem videobuf2_v4l2 msm(+) videobuf2_common crct10dif_ce spi_geni_qcom snd_soc_sm8250 i2c_qcom_geni gpu_sched snd_soc_qcom_common videodev qcom_q6v5_pas soundwire_qcom drm_dp_aux_bus qcom_stats drm_display_helper qcom_pil_info soundwire_bus snd_soc_lpass_va_macro mc qcom_q6v5 phy_qcom_snps_femto_v2 qcom_rng snd_soc_lpass_macro_common snd_soc_lpass_wsa_macro lpass_gfm_sm8250 slimbus qcom_sysmon qcom_common qcom_glink_smem qmi_helpers qcom_wdt mdt_loader socinfo icc_osm_l3 display_connector drm_kms_helper qnoc_sm8250 drm fuse ip_tables x_tables ipv6 CPU: 7 PID: 339 Comm: systemd-udevd Not tainted 5.19.0-rc8-next-20220728 #4 Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT) pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : dev_pm_opp_set_config+0x49c/0x610 lr : dev_pm_opp_set_config+0x58/0x610 sp : ffff8000093c3710 x29: ffff8000093c3710 x28: ffffbca3959d82b8 x27: ffff8000093c3d00 x26: ffffbca3959d8e08 x25: ffff4396cac98118 x24: ffff4396c0e24810 x23: ffff4396c4272c40 x22: ffff4396c0e24810 x21: ffff8000093c3810 x20: ffff4396cac36800 x19: ffff4396cac96800 x18: 0000000000000000 x17: 0000000000000003 x16: ffffbca3f4edf198 x15: 0000001cba64a858 x14: 0000000000000180 x13: 000000000000017e x12: 0000000000000000 x11: 0000000000000002 x10: 0000000000000a60 x9 : ffff8000093c35c0 x8 : ffff4396c4273700 x7 : ffff43983efca6c0 x6 : ffff43983efca640 x5 : 00000000410fd0d0 x4 : ffff4396c4272c40 x3 : ffffbca3f5d1e008 x2 : 0000000000000000 x1 : ffff4396c2421600 x0 : ffff4396cac96860 Call trace: dev_pm_opp_set_config+0x49c/0x610 devm_pm_opp_set_config+0x18/0x70 vcodec_domains_get+0xb8/0x1638 [venus_core] core_get_v4+0x1d8/0x218 [venus_core] venus_probe+0xf4/0x468 [venus_core] platform_probe+0x68/0xd8 really_probe+0xbc/0x2a8 __driver_probe_device+0x78/0xe0 driver_probe_device+0x3c/0xf0 __driver_attach+0x70/0x120 bus_for_each_dev+0x70/0xc0 driver_attach+0x24/0x30 bus_add_driver+0x150/0x200 driver_register+0x64/0x120 __platform_driver_register+0x28/0x38 qcom_venus_driver_init+0x24/0x1000 [venus_core] do_one_initcall+0x54/0x1c8 do_init_module+0x44/0x1d0 load_module+0x16c8/0x1aa0 __do_sys_finit_module+0xbc/0x110 __arm64_sys_finit_module+0x20/0x30 invoke_syscall+0x44/0x108 el0_svc_common.constprop.0+0xcc/0xf0 do_el0_svc+0x2c/0xb8 el0_svc+0x2c/0x88 el0t_64_sync_handler+0xb8/0xc0 el0t_64_sync+0x18c/0x190 qcom-venus: probe of aa00000.video-codec failed with error -16
The fix is re-ordering the code related to OPP core. The OPP core expects all configuration options to be provided before the OPP table is added.
--- drivers/media/platform/qcom/venus/pm_helpers.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/media/platform/qcom/venus/pm_helpers.c +5 -5
@@ -875,7 +875,7 @@ static int vcodec_domains_get(struct venus_core *core) } skip_pmdomains: -if (!core->has_opp_table) +if (!core->res->opp_pmdomain)return 0 ;/* Attach the power domain for setting performance state */
@@ -1007,6 +1007,10 @@ static int core_get_v4(struct venus_core *core)if (ret)return ret; + ret =vcodec_domains_get (core); +if (ret) +return ret; +if (core->res->opp_pmdomain) { ret =devm_pm_opp_of_add_table (dev);if (!ret) {
@@ -1017,10 +1021,6 @@ static int core_get_v4(struct venus_core *core) } } - ret =vcodec_domains_get (core); -if (ret) -return ret; -return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 360/365 video: fbdev: i740fb: Check the argument of i740_calc_vclk()
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 40bf722f8064f50200b8c4f8946cd625b441dda9 ]
Since the user can control the arguments of the ioctl() from the user space, under special arguments that may result in a divide-by-zero bug.
If the user provides an improper 'pixclock' value that makes the argumet of i740_calc_vclk() less than 'I740_RFREQ_FIX', it will cause a divide-by-zero bug in:
drivers/video/fbdev/i740fb.c:353 p_best = min(15, ilog2(I740_MAX_VCO_FREQ / (freq / I740_RFREQ_FIX)));
The following log can reveal it:
divide error: 0000 [#1] PREEMPT SMP KASAN PTI
RIP: 0010:i740_calc_vclk drivers/video/fbdev/i740fb.c:353 [inline] RIP: 0010:i740fb_decode_var drivers/video/fbdev/i740fb.c:646 [inline] RIP: 0010:i740fb_set_par+0x163f/0x3b70 drivers/video/fbdev/i740fb.c:742 Call Trace: fb_set_var+0x604/0xeb0 drivers/video/fbdev/core/fbmem.c:1034 do_fb_ioctl+0x234/0x670 drivers/video/fbdev/core/fbmem.c:1110 fb_ioctl+0xdd/0x130 drivers/video/fbdev/core/fbmem.c:1189
Fix this by checking the argument of i740_calc_vclk() first.
--- drivers/video/fbdev/i740fb.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/video/fbdev/i740fb.c +7 -2
@@ -400,7 +400,7 @@ static int i740fb_decode_var(const struct fb_var_screeninfo *var,u32 xres, right, hslen, left, xtotal;u32 yres, lower, vslen, upper, ytotal;u32 vxres, xoffset, vyres, yoffset; -u32 bpp, base, dacspeed24, mem; +u32 bpp, base, dacspeed24, mem, freq;u8 r7;int i;
@@ -643,7 +643,12 @@ static int i740fb_decode_var(const struct fb_var_screeninfo *var, par->atc[VGA_ATC_OVERSCAN ] =0 ;/* Calculate VCLK that most closely matches the requested dot clock */ -i740_calc_vclk ((((u32 )1e9 ) / var->pixclock) * (u32)(1e3 ), par); + freq = (((u32 )1e9 ) / var->pixclock) * (u32)(1e3 ); +if (freq <I740_RFREQ_FIX ) { +fb_dbg (info,"invalid pixclock\n" ); + freq =I740_RFREQ_FIX ; + } +i740_calc_vclk (freq, par);/* Since we program the clocks ourselves, always use VCLK2. */ par->misc |=0x0C ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 361/365 MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 74de14fe05dd6b151d73cb0c73c8ec874cbdcde6 ]
When CONFIG_XPA is enabled, Clang warns:
arch/mips/mm/tlbex.c:629:24: error: converting the result of '<<' to a boolean; did you mean '(1 << _PAGE_NO_EXEC_SHIFT) != 0'? [-Werror,-Wint-in-bool-context]
if (cpu_has_rixi && !!_PAGE_NO_EXEC) {
^
arch/mips/include/asm/pgtable-bits.h:174:28: note: expanded from macro '_PAGE_NO_EXEC'
# define _PAGE_NO_EXEC (1 << _PAGE_NO_EXEC_SHIFT)
^
arch/mips/mm/tlbex.c:2568:24: error: converting the result of '<<' to a boolean; did you mean '(1 << _PAGE_NO_EXEC_SHIFT) != 0'? [-Werror,-Wint-in-bool-context]
if (!cpu_has_rixi || !_PAGE_NO_EXEC) {
^
arch/mips/include/asm/pgtable-bits.h:174:28: note: expanded from macro '_PAGE_NO_EXEC'
# define _PAGE_NO_EXEC (1 << _PAGE_NO_EXEC_SHIFT)
^
2 errors generated._PAGE_NO_EXEC can be '0' or '1 << _PAGE_NO_EXEC_SHIFT' depending on the build and runtime configuration, which is what the negation operators are trying to convey. To silence the warning, explicitly compare against 0 so the result of the '<<' operator is not implicitly converted to a boolean.
According to its documentation, GCC enables -Wint-in-bool-context with -Wall but this warning is not visible when building the same configuration with GCC. It appears GCC only warns when compiling C++, not C, although the documentation makes no note of this:
https://godbolt.org/z/x39q3brxf
--- arch/mips/mm/tlbex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/mm/tlbex.c +2 -2
@@ -626,7 +626,7 @@ static __maybe_unused void build_convert_pte_to_entrylo(u32 **p,return ; } -if (cpu_has_rixi && !!_PAGE_NO_EXEC) { +if (cpu_has_rixi && _PAGE_NO_EXEC !=0 ) {if (fill_includes_sw_bits) {UASM_i_ROTR (p, reg, reg,ilog2 (_PAGE_GLOBAL)); }else {
@@ -2565,7 +2565,7 @@ static void check_pabits(void)unsigned long entry;unsigned pabits, fillbits; -if (!cpu_has_rixi || !_PAGE_NO_EXEC) { +if (!cpu_has_rixi || _PAGE_NO_EXEC ==0 ) {/* * We'll only be making use of the fact that we can rotate bits * into the fill if the CPU supports RIXI, so don't bother
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 362/365 f2fs: revive F2FS_IOC_ABORT_VOLATILE_WRITE
In reply to Greg Kroah-HartmanFrom: Daeho Jeong <[email protected]>
[ Upstream commit 23339e5752d01a4b5e122759b002cf896d26f6c1 ]
F2FS_IOC_ABORT_VOLATILE_WRITE was used to abort a atomic write before. However it was removed accidentally. So revive it by changing the name, since volatile write had gone.
Fiexes: 7bc155fec5b3("f2fs: kill volatile write support")
--- fs/f2fs/file.c | 30 ++++++++++++++++++++++++++++-- include/uapi/linux/f2fs.h | 2 +- 2 files changed, 29 insertions(+), 3 deletions(-)
fs/f2fs/file.c +28 -2
@@ -2108,6 +2108,31 @@ static int f2fs_ioc_commit_atomic_write(struct file *filp)return ret; } +static int f2fs_ioc_abort_atomic_write (struct file *filp) +{ +struct inode *inode =file_inode (filp); +struct user_namespace *mnt_userns =file_mnt_user_ns (filp); +int ret; + +if (!inode_owner_or_capable (mnt_userns, inode)) +return -EACCES ; + + ret =mnt_want_write_file (filp); +if (ret) +return ret; + +inode_lock (inode); + +if (f2fs_is_atomic_file (inode)) +f2fs_abort_atomic_write (inode, true); + +inode_unlock (inode); + +mnt_drop_write_file (filp); +f2fs_update_time (F2FS_I_SB (inode),REQ_TIME ); +return ret; +} +static int f2fs_ioc_shutdown (struct file *filp,unsigned long arg) {struct inode *inode =file_inode (filp);
@@ -4063,9 +4088,10 @@ static long __f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)return f2fs_ioc_start_atomic_write (filp);case F2FS_IOC_COMMIT_ATOMIC_WRITE :return f2fs_ioc_commit_atomic_write (filp); +case F2FS_IOC_ABORT_ATOMIC_WRITE : +return f2fs_ioc_abort_atomic_write (filp);case F2FS_IOC_START_VOLATILE_WRITE :case F2FS_IOC_RELEASE_VOLATILE_WRITE : -case F2FS_IOC_ABORT_VOLATILE_WRITE :return -EOPNOTSUPP ;case F2FS_IOC_SHUTDOWN :return f2fs_ioc_shutdown (filp, arg);
@@ -4734,7 +4760,7 @@ long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)case F2FS_IOC_COMMIT_ATOMIC_WRITE :case F2FS_IOC_START_VOLATILE_WRITE :case F2FS_IOC_RELEASE_VOLATILE_WRITE : -case F2FS_IOC_ABORT_VOLATILE_WRITE : +case F2FS_IOC_ABORT_ATOMIC_WRITE :case F2FS_IOC_SHUTDOWN :case FITRIM :case FS_IOC_SET_ENCRYPTION_POLICY :
include/uapi/linux/f2fs.h +1 -1
@@ -13,7 +13,7 @@#define F2FS_IOC_COMMIT_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 2)#define F2FS_IOC_START_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 3)#define F2FS_IOC_RELEASE_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 4) -#define F2FS_IOC_ABORT_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 5) +#define F2FS_IOC_ABORT_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 5)#define F2FS_IOC_GARBAGE_COLLECT _IOW(F2FS_IOCTL_MAGIC, 6, __u32)#define F2FS_IOC_WRITE_CHECKPOINT _IO(F2FS_IOCTL_MAGIC, 7)#define F2FS_IOC_DEFRAGMENT _IOWR(F2FS_IOCTL_MAGIC, 8, \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 363/365 f2fs: fix null-ptr-deref in f2fs_get_dnode_of_data
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
[ Upstream commit 4a2c5b7994960fac29cf8a3f4e62855bae1b27d4 ]
There is issue as follows when test f2fs atomic write:
F2FS-fs (loop0): Can't find valid F2FS filesystem in 2th superblock F2FS-fs (loop0): invalid crc_offset: 0
F2FS-fs (loop0): f2fs_check_nid_range: out-of-range nid=1, run fsck to fix. F2FS-fs (loop0): f2fs_check_nid_range: out-of-range nid=2, run fsck to fix.
==================================================================
BUG: KASAN: null-ptr-deref in f2fs_get_dnode_of_data+0xac/0x16d0 Read of size 8 at addr 0000000000000028 by task rep/1990 CPU: 4 PID: 1990 Comm: rep Not tainted 5.19.0-rc6-next-20220715 #266 Call Trace: <TASK> dump_stack_lvl+0x6e/0x91 print_report.cold+0x49a/0x6bb kasan_report+0xa8/0x130 f2fs_get_dnode_of_data+0xac/0x16d0 f2fs_do_write_data_page+0x2a5/0x1030 move_data_page+0x3c5/0xdf0 do_garbage_collect+0x2015/0x36c0 f2fs_gc+0x554/0x1d30 f2fs_balance_fs+0x7f5/0xda0 f2fs_write_single_data_page+0xb66/0xdc0 f2fs_write_cache_pages+0x716/0x1420 f2fs_write_data_pages+0x84f/0x9a0 do_writepages+0x130/0x3a0 filemap_fdatawrite_wbc+0x87/0xa0 file_write_and_wait_range+0x157/0x1c0 f2fs_do_sync_file+0x206/0x12d0 f2fs_sync_file+0x99/0xc0 vfs_fsync_range+0x75/0x140 f2fs_file_write_iter+0xd7b/0x1850 vfs_write+0x645/0x780 ksys_write+0xf1/0x1e0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd
As 3db1de0e582c commit changed atomic write way which new a cow_inode for atomic write file, and also mark cow_inode as FI_ATOMIC_FILE. When f2fs_do_write_data_page write cow_inode will use cow_inode's cow_inode which is NULL. Then will trigger null-ptr-deref.
To solve above issue, introduce FI_COW_FILE flag for COW inode.
Fiexes: 3db1de0e582c("f2fs: change the current atomic write way")
--- fs/f2fs/f2fs.h | 6 ++++++ fs/f2fs/file.c | 2 +- fs/f2fs/segment.c | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-)
fs/f2fs/f2fs.h +6 -0
@@ -757,6 +757,7 @@ enum {FI_ENABLE_COMPRESS ,/* enable compression in "user" compression mode */ FI_COMPRESS_RELEASED ,/* compressed blocks were released */ FI_ALIGNED_WRITE ,/* enable aligned write */ +FI_COW_FILE ,/* indicate COW file */ FI_MAX, /* max flag, never be used */ };
@@ -3208,6 +3209,11 @@ static inline bool f2fs_is_atomic_file(sreturn is_inode_flag_set (inode,FI_ATOMIC_FILE ); } +static inline bool f2fs_is_cow_file (struct inode *inode) +{ +return is_inode_flag_set (inode,FI_COW_FILE ); +} +static inline bool f2fs_is_first_block_written (struct inode *inode) {return is_inode_flag_set (inode,FI_FIRST_BLOCK_WRITTEN );
fs/f2fs/file.c +1 -1
@@ -2061,7 +2061,7 @@ static int f2fs_ioc_start_atomic_write(sspin_unlock (&sbi->inode_lock[ATOMIC_FILE ]);set_inode_flag (inode,FI_ATOMIC_FILE ); -set_inode_flag (fi->cow_inode,FI_ATOMIC_FILE ); +set_inode_flag (fi->cow_inode,FI_COW_FILE );clear_inode_flag (fi->cow_inode,FI_INLINE_DATA );f2fs_up_write (&fi->i_gc_rwsem[WRITE ]);
fs/f2fs/segment.c +2 -2
@@ -193,7 +193,7 @@ void f2fs_abort_atomic_write(struct inodif (f2fs_is_atomic_file (inode)) {if (clean)truncate_inode_pages_final (inode->i_mapping); -clear_inode_flag (fi->cow_inode,FI_ATOMIC_FILE ); +clear_inode_flag (fi->cow_inode,FI_COW_FILE );iput (fi->cow_inode); fi->cow_inode =NULL ;clear_inode_flag (inode,FI_ATOMIC_FILE );
@@ -3166,7 +3166,7 @@ static int __get_segment_type_6(struct freturn CURSEG_COLD_DATA ;if (file_is_hot (inode) ||is_inode_flag_set (inode,FI_HOT_DATA ) || -f2fs_is_atomic_file (inode)) +f2fs_is_cow_file (inode))return CURSEG_HOT_DATA ;return f2fs_rw_hint_to_seg_type (inode->i_write_hint); }else {
Greg Kroah-Hartman
maintainerPATCH 364/365 scsi: ufs: ufs-mediatek: Fix build error and type mismatch
In reply to Greg Kroah-HartmanFrom: Ren Zhijie <[email protected]>
commit f54912b228a8df6c0133e31bc75628677bb8c6e5 upstream.
If CONFIG_PM_SLEEP is not set.
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-, will fail:
drivers/ufs/host/ufs-mediatek.c: In function ‘ufs_mtk_vreg_fix_vcc’:drivers/ufs/host/ufs-mediatek.c:688:46: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
snprintf(vcc_name, MAX_VCC_NAME, "vcc-opt%u", res.a1);
~^ ~~~~~~
%lu
drivers/ufs/host/ufs-mediatek.c: In function ‘ufs_mtk_system_suspend’:
drivers/ufs/host/ufs-mediatek.c:1371:8: error: implicit declaration of function ‘ufshcd_system_suspend’; did you mean ‘ufs_mtk_system_suspend’? [-Werror=implicit-function-declaration]
ret = ufshcd_system_suspend(dev);
^~~~~~~~~~~~~~~~~~~~~
ufs_mtk_system_suspend
drivers/ufs/host/ufs-mediatek.c: In function ‘ufs_mtk_system_resume’:
drivers/ufs/host/ufs-mediatek.c:1386:9: error: implicit declaration of function ‘ufshcd_system_resume’; did you mean ‘ufs_mtk_system_resume’? [-Werror=implicit-function-declaration]
return ufshcd_system_resume(dev);
^~~~~~~~~~~~~~~~~~~~
ufs_mtk_system_resumecc1: some warnings being treated as errors
The declaration of func "ufshcd_system_suspend()" depends on CONFIG_PM_SLEEP, so the function wrapper ufs_mtk_system_suspend() should wrapped by CONFIG_PM_SLEEP too.
--- drivers/ufs/host/ufs-mediatek.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/ufs/host/ufs-mediatek.c +2 -0
@@ -1220,6 +1220,7 @@ static int ufs_mtk_remove(struct platforreturn 0 ; } +#ifdef CONFIG_PM_SLEEP int ufs_mtk_system_suspend (struct device *dev) {struct ufs_hba *hba =dev_get_drvdata (dev);
@@ -1242,6 +1243,7 @@ int ufs_mtk_system_resume(struct device return ufshcd_system_resume(dev); } +#endif int ufs_mtk_runtime_suspend (struct device *dev) {
Greg Kroah-Hartman
maintainerPATCH 365/365 Revert "ALSA: hda: Fix page fault in snd_hda_codec_shutdown()"
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 53f07e9b010b966017e32be1ca1bbcbcc4cee73d upstream.
This reverts commit 980b3a8790b402e959a6d773b38b771019682be1.
The commit didn't consider the fact that ASoC hdac-hda driver initializes the HD-audio stuff without calling snd_hda_codec_device_init(). Hence this caused a regression leading to Oops.
Revert the commit to restore the behavior.
--- sound/pci/hda/hda_codec.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-)
sound/pci/hda/hda_codec.c +21 -20
@@ -931,28 +931,8 @@ snd_hda_codec_device_init(struct hda_bus } codec->bus = bus; - codec->depop_delay =-1 ; - codec->fixup_id =HDA_FIXUP_ID_NOT_SET ; - codec->core.dev.release = snd_hda_codec_dev_release; - codec->core.exec_verb = codec_exec_verb; codec->core.type =HDA_DEV_LEGACY ; -mutex_init (&codec->spdif_mutex); -mutex_init (&codec->control_mutex); -snd_array_init (&codec->mixers,sizeof (struct hda_nid_item ),32 ); -snd_array_init (&codec->nids,sizeof (struct hda_nid_item ),32 ); -snd_array_init (&codec->init_pins,sizeof (struct hda_pincfg ),16 ); -snd_array_init (&codec->driver_pins,sizeof (struct hda_pincfg ),16 ); -snd_array_init (&codec->cvt_setups,sizeof (struct hda_cvt_setup ),8 ); -snd_array_init (&codec->spdif_out,sizeof (struct hda_spdif_out ),16 ); -snd_array_init (&codec->jacktbl,sizeof (struct hda_jack_tbl ),16 ); -snd_array_init (&codec->verbs,sizeof (struct hda_verb *),8 ); -INIT_LIST_HEAD (&codec->conn_list); -INIT_LIST_HEAD (&codec->pcm_list_head); -INIT_DELAYED_WORK (&codec->jackpoll_work, hda_jackpoll_work); -refcount_set (&codec->pcm_ref,1 ); -init_waitqueue_head (&codec->remove_sleep); -return codec; }EXPORT_SYMBOL_GPL (snd_hda_codec_device_init);
@@ -1000,8 +980,29 @@ int snd_hda_codec_device_new(struct hda_if (snd_BUG_ON (codec_addr >HDA_MAX_CODEC_ADDRESS ))return -EINVAL ; + codec->core.dev.release = snd_hda_codec_dev_release; + codec->core.exec_verb = codec_exec_verb; + codec->card = card; codec->addr = codec_addr; +mutex_init (&codec->spdif_mutex); +mutex_init (&codec->control_mutex); +snd_array_init (&codec->mixers,sizeof (struct hda_nid_item ),32 ); +snd_array_init (&codec->nids,sizeof (struct hda_nid_item ),32 ); +snd_array_init (&codec->init_pins,sizeof (struct hda_pincfg ),16 ); +snd_array_init (&codec->driver_pins,sizeof (struct hda_pincfg ),16 ); +snd_array_init (&codec->cvt_setups,sizeof (struct hda_cvt_setup ),8 ); +snd_array_init (&codec->spdif_out,sizeof (struct hda_spdif_out ),16 ); +snd_array_init (&codec->jacktbl,sizeof (struct hda_jack_tbl ),16 ); +snd_array_init (&codec->verbs,sizeof (struct hda_verb *),8 ); +INIT_LIST_HEAD (&codec->conn_list); +INIT_LIST_HEAD (&codec->pcm_list_head); +refcount_set (&codec->pcm_ref,1 ); +init_waitqueue_head (&codec->remove_sleep); + +INIT_DELAYED_WORK (&codec->jackpoll_work, hda_jackpoll_work); + codec->depop_delay =-1 ; + codec->fixup_id =HDA_FIXUP_ID_NOT_SET ;#ifdef CONFIG_PM codec->power_jiffies = jiffies;
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.4 release. There are 365 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 25 Aug 2022 08:00:15 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.19.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.19.y
and the diffstat can be found below.thanks,
greg k-h
Tested rc1 against the Fedora build system (aarch64, armv7, ppc64le, s390x, x86_64), and boot tested x86_64. No regressions noted.
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.4 release. There are 365 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 25 Aug 2022 08:00:15 +0000. Anything received after that time might be too late.
Build results:
total: 150 pass: 149 fail: 1 Failed builds: um:defconfig Qemu test results: total: 489 pass: 489 fail: 0
arch/um/kernel/um_arch.c:447:6: error: redefinition of 'apply_returns'
I don't see the point of commit 89164a58fdc9 ("um: Add missing apply_returns()") because it results in two sets of apply_returns() functions.
Guenter
Greg Kroah-Hartman
maintainerQuoted 17 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.4 release. There are 365 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 25 Aug 2022 08:00:15 +0000. Anything received after that time might be too late.
Build results:
total: 150 pass: 149 fail: 1 Failed builds: um:defconfig Qemu test results: total: 489 pass: 489 fail: 0
Quoted 5 lines
arch/um/kernel/um_arch.c:447:6: error: redefinition of 'apply_returns'I don't see the point of commit
89164a58fdc9("um: Add missingapply_returns()") because it results in two sets ofapply_returns()functions.
Odd, the commit lied :)
I'll go delete this from 5.19.y, 5.15.y, and 5.10.y and push out a new -rc2 for all of them.
thanks,
greg k-h
Greg Kroah-Hartman
maintainerQuoted 20 lines · Greg Kroah-Hartman
Quoted 19 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.4 release. There are 365 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 25 Aug 2022 08:00:15 +0000. Anything received after that time might be too late.
Build results:
total: 150 pass: 149 fail: 1 Failed builds: um:defconfig Qemu test results: total: 489 pass: 489 fail: 0
arch/um/kernel/um_arch.c:447:6: error: redefinition of 'apply_returns'
Quoted 8 lines
Quoted 3 lines
I don't see the point of commit
89164a58fdc9("um: Add missingapply_returns()") because it results in two sets ofapply_returns()functions.Odd, the commit lied :)
I'll go delete this from 5.19.y, 5.15.y, and 5.10.y and push out a new -rc2 for all of them.
Well, -rc3 for 5.10.y, you get the idea...
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.4 release. There are 365 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 25 Aug 2022 08:00:15 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.19.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.19.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.4 release. There are 365 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 25 Aug 2022 08:00:15 +0000. Anything received after that time might be too late.
Hi Greg,
5.19.4-rc1 tested.
Run tested on:
- Intel Tiger Lake x86_64 (nuc11 i7-1165G7)
In addition - build tested for:
- Allwinner A64
- Allwinner H3
- Allwinner H5
- Allwinner H6
- NXP iMX6
- NXP iMX8
- Qualcomm Dragonboard
- Rockchip RK3288
- Rockchip RK3328
- Rockchip RK3399pro
- Samsung Exynos
--
Rudi
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.4 release. There are 365 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 25 Aug 2022 08:00:15 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.19.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.19.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).