drm/amdgpu: remove set but not used variable 'mc_shared_chmap' from 'gfx_v6_0.c' and 'gfx_v7_0.c'
Subsystems (63)
Sasha Levin
maintainerPATCH 5/459 drm/qxl: Complete exception handling in qxl_device_init()
In reply to Sasha LevinFrom: Markus Elfring <[email protected]>
[ Upstream commit dbe3ad61dcebc49fe3efca70a0f752a95b4600f2 ]
A coccicheck run provided information like the following.
drivers/gpu/drm/qxl/qxl_kms.c:295:1-7: ERROR: missing iounmap; ioremap on line 178 and execution via conditional on line 185
Generated by: scripts/coccinelle/free/iounmap.cocci
A jump target was specified in an if branch. The corresponding function call did not release the desired system resource then.
Thus use the label “rom_unmap” instead to fix the exception handling for this function implementation.
--- drivers/gpu/drm/qxl/qxl_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/qxl/qxl_kms.c +1 -1
@@ -184,7 +184,7 @@ int qxl_device_init(struct qxl_device *qdev,if (!qxl_check_device (qdev)) { r = -ENODEV ; - goto surface_mapping_free; + goto rom_unmap; } r =qxl_bo_init (qdev);
Signature · 6 lines
2.20.1 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Sasha Levin
maintainerPATCH 33/459 pxa168fb: Fix the function used to release some memory in an error handling path
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 3c911fe799d1c338d94b78e7182ad452c37af897 ]
In the probe function, some resources are allocated using 'dma_alloc_wc()', they should be released with 'dma_free_wc()', not 'dma_free_coherent()'.
We already use 'dma_free_wc()' in the remove function, but not in the error handling path of the probe function.
Also, remove a useless 'PAGE_ALIGN()'. 'info->fix.smem_len' is already PAGE_ALIGNed.
--- drivers/video/fbdev/pxa168fb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/video/fbdev/pxa168fb.c +3 -3
@@ -766,8 +766,8 @@ static int pxa168fb_probe(struct platform_device *pdev) failed_free_clk:clk_disable_unprepare (fbi->clk); failed_free_fbmem: -dma_free_coherent (fbi->dev, info->fix.smem_len, - info->screen_base, fbi->fb_start_dma); +dma_free_wc (fbi->dev, info->fix.smem_len, + info->screen_base, fbi->fb_start_dma); failed_free_info:kfree (info);
@@ -801,7 +801,7 @@ static int pxa168fb_remove(struct platform_device *pdev) irq =platform_get_irq (pdev,0 ); -dma_free_wc (fbi->dev,PAGE_ALIGN (info->fix.smem_len), +dma_free_wc (fbi->dev, info->fix.smem_len, info->screen_base, info->fix.smem_start);clk_disable_unprepare (fbi->clk);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 54/459 PCI: tegra: Fix afi_pex2_ctrl reg offset for Tegra30
In reply to Sasha LevinFrom: Marcel Ziswiler <[email protected]>
[ Upstream commit 21a92676e1fe292acb077b13106b08c22ed36b14 ]
Fix AFI_PEX2_CTRL reg offset for Tegra30 by moving it from the Tegra20 SoC struct where it erroneously got added. This fixes the AFI_PEX2_CTRL reg offset being uninitialised subsequently failing to bring up the third PCIe port.
--- drivers/pci/controller/pci-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pci-tegra.c +1 -1
@@ -2499,7 +2499,6 @@ static const struct tegra_pcie_soc tegra20_pcie = { .num_ports = 2, .ports = tegra20_pcie_ports, .msi_base_shift = 0, - .afi_pex2_ctrl = 0x128, .pads_pll_ctl = PADS_PLL_CTL_TEGRA20, .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_DIV10, .pads_refclk_cfg0 = 0xfa5cfa5c,
@@ -2528,6 +2527,7 @@ static const struct tegra_pcie_soc tegra30_pcie = { .num_ports = 3, .ports = tegra30_pcie_ports, .msi_base_shift = 8, + .afi_pex2_ctrl = 0x128, .pads_pll_ctl = PADS_PLL_CTL_TEGRA30, .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_BUF_EN, .pads_refclk_cfg0 = 0xfa5cfa5c,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 55/459 efi/x86: Map the entire EFI vendor string before copying it
In reply to Sasha LevinFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit ffc2760bcf2dba0dbef74013ed73eea8310cc52c ]
Fix a couple of issues with the way we map and copy the vendor string:
- we map only 2 bytes, which usually works since you get at least a page, but if the vendor string happens to cross a page boundary, a crash will result
- only call early_memunmap() if early_memremap() succeeded, or we will call it with a NULL address which it doesn't like,
- while at it, switch to early_memremap_ro(), and array indexing rather than pointer dereferencing to read the CHAR16 characters.
--- arch/x86/platform/efi/efi.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
arch/x86/platform/efi/efi.c +7 -6
@@ -504,7 +504,6 @@ void __init efi_init(void)efi_char16_t *c16;char vendor[100 ] ="unknown" ;int i =0 ; -void *tmp;#ifdef CONFIG_X86_32 if (boot_params.efi_info.efi_systab_hi ||
@@ -529,14 +528,16 @@ void __init efi_init(void)/* * Show what we know for posterity */ - c16 = tmp =early_memremap (efi.systab->fw_vendor,2 ); + c16 =early_memremap_ro (efi.systab->fw_vendor, +sizeof (vendor) *sizeof (efi_char16_t));if (c16) { -for (i =0 ; i <sizeof (vendor) -1 && *c16; ++i) - vendor[i] = *c16++; +for (i =0 ; i <sizeof (vendor) -1 && c16[i]; ++i) + vendor[i] = c16[i]; vendor[i] ='\0' ; - }else +early_memunmap (c16,sizeof (vendor) *sizeof (efi_char16_t)); + }else {pr_err ("Could not map the firmware vendor!\n" ); -early_memunmap (tmp,2 ); + } pr_info("EFI v%u.%.02u by %s\n", efi.systab->hdr.revision >> 16,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 57/459 sparc: Add .exit.data section.
In reply to Sasha LevinFrom: "David S. Miller" <[email protected]>
[ Upstream commit 548f0b9a5f4cffa0cecf62eb12aa8db682e4eee6 ]
This fixes build errors of all sorts.
Also, emit .exit.text unconditionally.
--- arch/sparc/kernel/vmlinux.lds.S | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/sparc/kernel/vmlinux.lds.S +4 -2
@@ -172,12 +172,14 @@ SECTIONS } PERCPU_SECTION(SMP_CACHE_BYTES) -#ifdef CONFIG_JUMP_LABEL . = ALIGN(PAGE_SIZE); .exit.text : { EXIT_TEXT } -#endif + + .exit.data : { + EXIT_DATA + } . = ALIGN(PAGE_SIZE); __init_end = .;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 59/459 raid6/test: fix a compilation error
In reply to Sasha LevinFrom: Zhengyuan Liu <[email protected]>
[ Upstream commit 6b8651aac1dca6140dd7fb4c9fec2736ed3f6223 ]
The compilation error is redeclaration showed as following:
In file included from ../../../include/linux/limits.h:6,
from /usr/include/x86_64-linux-gnu/bits/local_lim.h:38,
from /usr/include/x86_64-linux-gnu/bits/posix1_lim.h:161,
from /usr/include/limits.h:183,
from /usr/lib/gcc/x86_64-linux-gnu/8/include-fixed/limits.h:194,
from /usr/lib/gcc/x86_64-linux-gnu/8/include-fixed/syslimits.h:7,
from /usr/lib/gcc/x86_64-linux-gnu/8/include-fixed/limits.h:34,
from ../../../include/linux/raid/pq.h:30,
from algos.c:14:
../../../include/linux/types.h:114:15: error: conflicting types for ‘int64_t’
typedef s64 int64_t;
^~~~~~~
In file included from /usr/include/stdint.h:34,
from /usr/lib/gcc/x86_64-linux-gnu/8/include/stdint.h:9,
from /usr/include/inttypes.h:27,
from ../../../include/linux/raid/pq.h:29,
from algos.c:14:
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:27:19: note: previous \
declaration of ‘int64_t’ was here
typedef __int64_t int64_t;--- include/linux/raid/pq.h | 1 - 1 file changed, 1 deletion(-)
include/linux/raid/pq.h +0 -1
@@ -27,7 +27,6 @@ extern const char raid6_empty_zero_page[PAGE_SIZE];#include <errno.h> #include <inttypes.h> -#include <limits.h> #include <stddef.h> #include <sys/mman.h> #include <sys/time.h>
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 62/459 spi: fsl-lpspi: fix only one cs-gpio working
In reply to Sasha LevinFrom: Philippe Schenker <[email protected]>
[ Upstream commit bc3a8b295e5bca9d1ec2622a6ba38289f9fd3d8a ]
Why it does not work at the moment:
- num_chipselect sets the number of cs-gpios that are in the DT. This comes from drivers/spi/spi.c
- num_chipselect gets set with devm_spi_register_controller, that is called in drivers/spi/spi.c
- devm_spi_register_controller got called after num_chipselect has been used.
How this commit fixes the issue:
- devm_spi_register_controller gets called before num_chipselect is being used.
--- drivers/spi/spi-fsl-lpspi.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/spi/spi-fsl-lpspi.c +16 -16
@@ -862,6 +862,22 @@ static int fsl_lpspi_probe(struct platform_device *pdev) fsl_lpspi->dev = &pdev->dev; fsl_lpspi->is_slave = is_slave; + controller->bits_per_word_mask =SPI_BPW_RANGE_MASK (8 ,32 ); + controller->transfer_one = fsl_lpspi_transfer_one; + controller->prepare_transfer_hardware = lpspi_prepare_xfer_hardware; + controller->unprepare_transfer_hardware = lpspi_unprepare_xfer_hardware; + controller->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH ; + controller->flags =SPI_MASTER_MUST_RX |SPI_MASTER_MUST_TX ; + controller->dev.of_node = pdev->dev.of_node; + controller->bus_num = pdev->id; + controller->slave_abort = fsl_lpspi_slave_abort; + + ret =devm_spi_register_controller (&pdev->dev, controller); +if (ret <0 ) { +dev_err (&pdev->dev,"spi_register_controller error.\n" ); + goto out_controller_put; + } +if (!fsl_lpspi->is_slave) {for (i =0 ; i < controller->num_chipselect; i++) {int cs_gpio =of_get_named_gpio (np,"cs-gpios" , i);
@@ -885,16 +901,6 @@ static int fsl_lpspi_probe(struct platform_device *pdev) controller->prepare_message = fsl_lpspi_prepare_message; } - controller->bits_per_word_mask =SPI_BPW_RANGE_MASK (8 ,32 ); - controller->transfer_one = fsl_lpspi_transfer_one; - controller->prepare_transfer_hardware = lpspi_prepare_xfer_hardware; - controller->unprepare_transfer_hardware = lpspi_unprepare_xfer_hardware; - controller->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH ; - controller->flags =SPI_MASTER_MUST_RX |SPI_MASTER_MUST_TX ; - controller->dev.of_node = pdev->dev.of_node; - controller->bus_num = pdev->id; - controller->slave_abort = fsl_lpspi_slave_abort; -init_completion (&fsl_lpspi->xfer_done); res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
@@ -952,12 +958,6 @@ static int fsl_lpspi_probe(struct platform_device *pdev)if (ret <0 )dev_err (&pdev->dev,"dma setup error %d, use pio\n" , ret); - ret =devm_spi_register_controller (&pdev->dev, controller); -if (ret <0 ) { -dev_err (&pdev->dev,"spi_register_controller error.\n" ); - goto out_controller_put; - } -return 0 ; out_controller_put:
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 63/459 dt-bindings: iio: adc: ad7606: Fix wrong maxItems value
In reply to Sasha LevinFrom: Beniamin Bia <[email protected]>
[ Upstream commit a6c4f77cb3b11f81077b53c4a38f21b92d41f21e ]
This patch set the correct value for oversampling maxItems. In the original example, appears 3 items for oversampling while the maxItems is set to 1, this patch fixes those issues.
--- Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml +4 -4
@@ -85,7 +85,7 @@ properties: Must be the device tree identifier of the over-sampling mode pins. As the line is active high, it should be marked GPIO_ACTIVE_HIGH. - maxItems: 1 + maxItems: 3 adi,sw-mode: description:
@@ -128,9 +128,9 @@ examples: adi,conversion-start-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>; reset-gpios = <&gpio 27 GPIO_ACTIVE_HIGH>; adi,first-data-gpios = <&gpio 22 GPIO_ACTIVE_HIGH>; - adi,oversampling-ratio-gpios = <&gpio 18 GPIO_ACTIVE_HIGH - &gpio 23 GPIO_ACTIVE_HIGH - &gpio 26 GPIO_ACTIVE_HIGH>; + adi,oversampling-ratio-gpios = <&gpio 18 GPIO_ACTIVE_HIGH>, + <&gpio 23 GPIO_ACTIVE_HIGH>, + <&gpio 26 GPIO_ACTIVE_HIGH>; standby-gpios = <&gpio 24 GPIO_ACTIVE_LOW>; adi,sw-mode; };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 65/459 drm/nouveau/nouveau: fix incorrect sizeof on args.src an args.dst
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit f42e4b337b327b1336c978c4b5174990a25f68a0 ]
The sizeof is currently on args.src and args.dst and should be on *args.src and *args.dst. Fortunately these sizes just so happen to be the same size so it worked, however, this should be fixed and it also cleans up static analysis warnings
Addresses-Coverity: ("sizeof not portable")
--- drivers/gpu/drm/nouveau/nouveau_dmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nouveau_dmem.c +2 -2
@@ -635,10 +635,10 @@ nouveau_dmem_migrate_vma(struct nouveau_drm *drm,unsigned long c, i;int ret = -ENOMEM ; - args.src =kcalloc (max,sizeof (args.src),GFP_KERNEL ); + args.src =kcalloc (max,sizeof (*args.src),GFP_KERNEL );if (!args.src) goto out; - args.dst =kcalloc (max,sizeof (args.dst),GFP_KERNEL ); + args.dst =kcalloc (max,sizeof (*args.dst),GFP_KERNEL );if (!args.dst) goto out_free_src;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 77/459 pwm: omap-dmtimer: Simplify error handling
In reply to Sasha LevinFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit c4cf7aa57eb83b108d2d9c6c37c143388fee2a4d ]
Instead of doing error handling in the middle of ->probe(), move error handling and freeing the reference to timer to the end.
This fixes a resource leak as dm_timer wasn't freed when allocating *omap failed.
Implementation note: The put: label was never reached without a goto and ret being unequal to 0, so the removed return statement is fine.
--- drivers/pwm/pwm-omap-dmtimer.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
drivers/pwm/pwm-omap-dmtimer.c +19 -9
@@ -298,15 +298,10 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) goto put; } -put: -of_node_put (timer); -if (ret <0 ) -return ret; - omap =devm_kzalloc (&pdev->dev,sizeof (*omap),GFP_KERNEL );if (!omap) { - pdata->free (dm_timer); -return -ENOMEM ; + ret = -ENOMEM ; + goto err_alloc_omap; } omap->pdata = pdata;
@@ -339,13 +334,28 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) ret =pwmchip_add (&omap->chip);if (ret <0 ) {dev_err (&pdev->dev,"failed to register PWM\n" ); - omap->pdata->free (omap->dm_timer); -return ret; + goto err_pwmchip_add; } +of_node_put (timer); +platform_set_drvdata (pdev, omap);return 0 ; + +err_pwmchip_add: + +/* +* *omap is allocated using devm_kzalloc, +* so no free necessary here +*/ +err_alloc_omap: + + pdata->free (dm_timer); +put: +of_node_put (timer); + +return ret; }static int pwm_omap_dmtimer_remove (struct platform_device *pdev)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 148/459 arm64: dts: rockchip: Fix NanoPC-T4 cooling maps
In reply to Sasha LevinFrom: Robin Murphy <[email protected]>
[ Upstream commit a793e19c15f25a126138ac4ae9facf9204754af3 ]
Although it appeared to follow logically from the bindings, apparently the thermal framework can't properly cope with a single cooling device being shared between multiple maps. The CPU zone is probably easier to overheat, so remove the references to the (optional) fan from the GPU cooling zone to avoid things getting confused. Hopefully GPU-intensive tasks will leak enough heat across to the CPU zone to still hit the fan trips before reaching critical GPU temperatures.
--- .../boot/dts/rockchip/rk3399-nanopc-t4.dts | 27 ------------------- 1 file changed, 27 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts +0 -27
@@ -94,33 +94,6 @@ }; }; -&gpu_thermal { - trips { - gpu_warm: gpu_warm { - temperature = <55000>; - hysteresis = <2000>; - type = "active"; - }; - - gpu_hot: gpu_hot { - temperature = <65000>; - hysteresis = <2000>; - type = "active"; - }; - }; - cooling-maps { - map1 { - trip = <&gpu_warm>; - cooling-device = <&fan THERMAL_NO_LIMIT 1>; - }; - - map2 { - trip = <&gpu_hot>; - cooling-device = <&fan 2 THERMAL_NO_LIMIT>; - }; - }; -}; - &pinctrl { ir { ir_rx: ir-rx {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 185/459 reiserfs: Fix spurious unlock in reiserfs_fill_super() error handling
In reply to Sasha LevinFrom: Jan Kara <[email protected]>
[ Upstream commit 4d5c1adaf893b8aa52525d2b81995e949bcb3239 ]
When we fail to allocate string for journal device name we jump to 'error' label which tries to unlock reiserfs write lock which is not held. Jump to 'error_unlocked' instead.
--- fs/reiserfs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/reiserfs/super.c +1 -1
@@ -1948,7 +1948,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)if (!sbi->s_jdev) {SWARN (silent, s,"" ,"Cannot allocate memory for " "journal device name" ); - goto error; + goto error_unlocked; } }#ifdef CONFIG_QUOTA
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 209/459 scsi: ibmvscsi_tgt: remove set but not used variables 'iue' and 'sd'
In reply to Sasha LevinFrom: Chen Zhou <[email protected]>
[ Upstream commit 4aca8fe7716669e39f7857b2e1fc5dfd4475b7e5 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c: In function ibmvscsis_send_messages:drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:1888:19: warning: variable iue set but not used [-Wunused-but-set-variable] drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c: In function ibmvscsis_queue_data_in:drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:3806:8: warning: variable sd set but not used [-Wunused-but-set-variable]
--- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +0 -5
@@ -1877,7 +1877,6 @@ static void ibmvscsis_send_messages(struct scsi_info *vscsi)*/ struct viosrp_crq *crq = (struct viosrp_crq *)&msg_hi;struct ibmvscsis_cmd *cmd, *nxt; -struct iu_entry *iue;long rc =ADAPT_SUCCESS ;bool retry = false;
@@ -1931,8 +1930,6 @@ static void ibmvscsis_send_messages(struct scsi_info *vscsi)*/ vscsi->credit +=1 ; }else { - iue = cmd->iue; - crq->valid =VALID_CMD_RESP_EL ; crq->format = cmd->rsp.format;
@@ -3797,7 +3794,6 @@ static int ibmvscsis_queue_data_in(struct se_cmd *se_cmd) se_cmd);struct iu_entry *iue = cmd->iue;struct scsi_info *vscsi = cmd->adapter; -char *sd;uint len =0 ;int rc;
@@ -3805,7 +3801,6 @@ static int ibmvscsis_queue_data_in(struct se_cmd *se_cmd) 1);if (rc) {dev_err (&vscsi->dev,"srp_transfer_data failed: %d\n" , rc); - sd = se_cmd->sense_buffer; se_cmd->scsi_sense_length =18 ;memset (se_cmd->sense_buffer,0 , se_cmd->scsi_sense_length);/* Logical Unit Communication Time-out asc/ascq = 0x0801 */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 236/459 pinctrl: sh-pfc: sh7269: Fix CAN function GPIOs
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 02aeb2f21530c98fc3ca51028eda742a3fafbd9f ]
pinmux_func_gpios[] contains a hole due to the missing function GPIO definition for the "CTX0&CTX1" signal, which is the logical "AND" of the first two CAN outputs.
A closer look reveals other issues:
- Some functionality is available on alternative pins, but the PINMUX_DATA() entries is using the wrong marks,
- Several configurations are missing.
Fix this by:
- Renaming CTX0CTX1CTX2_MARK, CRX0CRX1_PJ22_MARK, and CRX0CRX1CRX2_PJ20_MARK to CTX0_CTX1_CTX2_MARK, CRX0_CRX1_PJ22_MARK, resp. CRX0_CRX1_CRX2_PJ20_MARK for consistency with the corresponding enum IDs,
- Adding all missing enum IDs and marks,
- Use the right (*_PJ2x) variants for alternative pins,
- Adding all missing configurations to pinmux_data[],
- Adding all missing function GPIO definitions to pinmux_func_gpios[].
See SH7268 Group, SH7269 Group User’s Manual: Hardware, Rev. 2.00:
[1] Table 1.4 List of Pins
[2] Figure 23.29 Connection Example when Using Channels 0 and 1 as One Channel (64 Mailboxes × 1 Channel) and Channel 2 as One Channel (32 Mailboxes × 1 Channel),
[3] Figure 23.30 Connection Example when Using Channels 0, 1, and 2 as One Channel (96 Mailboxes × 1 Channel),
[4] Table 48.3 Multiplexed Pins (Port B),
[5] Table 48.4 Multiplexed Pins (Port C),
[6] Table 48.10 Multiplexed Pins (Port J),
[7] Section 48.2.4 Port B Control Registers 0 to 5 (PBCR0 to PBCR5).
--- arch/sh/include/cpu-sh2a/cpu/sh7269.h | 11 ++++++-- drivers/pinctrl/sh-pfc/pfc-sh7269.c | 39 ++++++++++++++++++--------- 2 files changed, 36 insertions(+), 14 deletions(-)
arch/sh/include/cpu-sh2a/cpu/sh7269.h +9 -2
@@ -78,8 +78,15 @@ enum {GPIO_FN_WDTOVF ,/* CAN */ -GPIO_FN_CTX1 ,GPIO_FN_CRX1 ,GPIO_FN_CTX0 ,GPIO_FN_CTX0_CTX1 , -GPIO_FN_CRX0 ,GPIO_FN_CRX0_CRX1 ,GPIO_FN_CRX0_CRX1_CRX2 , +GPIO_FN_CTX2 ,GPIO_FN_CRX2 , +GPIO_FN_CTX1 ,GPIO_FN_CRX1 , +GPIO_FN_CTX0 ,GPIO_FN_CRX0 , +GPIO_FN_CTX0_CTX1 ,GPIO_FN_CRX0_CRX1 , +GPIO_FN_CTX0_CTX1_CTX2 ,GPIO_FN_CRX0_CRX1_CRX2 , +GPIO_FN_CTX2_PJ21 ,GPIO_FN_CRX2_PJ20 , +GPIO_FN_CTX1_PJ23 ,GPIO_FN_CRX1_PJ22 , +GPIO_FN_CTX0_CTX1_PJ23 ,GPIO_FN_CRX0_CRX1_PJ22 , +GPIO_FN_CTX0_CTX1_CTX2_PJ21 ,GPIO_FN_CRX0_CRX1_CRX2_PJ20 ,/* DMAC */ GPIO_FN_TEND0, GPIO_FN_DACK0, GPIO_FN_DREQ0,
drivers/pinctrl/sh-pfc/pfc-sh7269.c +27 -12
@@ -737,13 +737,12 @@ enum {CRX0_MARK ,CTX0_MARK ,CRX1_MARK ,CTX1_MARK ,CRX2_MARK ,CTX2_MARK , -CRX0_CRX1_MARK , -CRX0_CRX1_CRX2_MARK , -CTX0CTX1CTX2_MARK , +CRX0_CRX1_MARK ,CTX0_CTX1_MARK , +CRX0_CRX1_CRX2_MARK ,CTX0_CTX1_CTX2_MARK ,CRX1_PJ22_MARK ,CTX1_PJ23_MARK ,CRX2_PJ20_MARK ,CTX2_PJ21_MARK , -CRX0CRX1_PJ22_MARK , -CRX0CRX1CRX2_PJ20_MARK , +CRX0_CRX1_PJ22_MARK ,CTX0_CTX1_PJ23_MARK , +CRX0_CRX1_CRX2_PJ20_MARK ,CTX0_CTX1_CTX2_PJ21_MARK ,/* VDC */ DV_CLK_MARK,
@@ -821,6 +820,7 @@ static const u16 pinmux_data[] = {PINMUX_DATA (CS3_MARK ,PC8MD_001 ),PINMUX_DATA (TXD7_MARK ,PC8MD_010 ),PINMUX_DATA (CTX1_MARK ,PC8MD_011 ), +PINMUX_DATA (CTX0_CTX1_MARK ,PC8MD_100 ),PINMUX_DATA (PC7_DATA ,PC7MD_000 ), PINMUX_DATA(CKE_MARK, PC7MD_001),
@@ -833,11 +833,12 @@ static const u16 pinmux_data[] = {PINMUX_DATA (CAS_MARK ,PC6MD_001 ),PINMUX_DATA (SCK7_MARK ,PC6MD_010 ),PINMUX_DATA (CTX0_MARK ,PC6MD_011 ), +PINMUX_DATA (CTX0_CTX1_CTX2_MARK ,PC6MD_100 ),PINMUX_DATA (PC5_DATA ,PC5MD_000 ),PINMUX_DATA (RAS_MARK ,PC5MD_001 ),PINMUX_DATA (CRX0_MARK ,PC5MD_011 ), -PINMUX_DATA (CTX0CTX1CTX2_MARK ,PC5MD_100 ), +PINMUX_DATA (CTX0_CTX1_CTX2_MARK ,PC5MD_100 ),PINMUX_DATA (IRQ0_PC_MARK ,PC5MD_101 ), PINMUX_DATA(PC4_DATA, PC4MD_00),
@@ -1289,30 +1290,32 @@ static const u16 pinmux_data[] = {PINMUX_DATA (LCD_DATA23_PJ23_MARK ,PJ23MD_010 ),PINMUX_DATA (LCD_TCON6_MARK ,PJ23MD_011 ),PINMUX_DATA (IRQ3_PJ_MARK ,PJ23MD_100 ), -PINMUX_DATA (CTX1_MARK ,PJ23MD_101 ), +PINMUX_DATA (CTX1_PJ23_MARK ,PJ23MD_101 ), +PINMUX_DATA (CTX0_CTX1_PJ23_MARK ,PJ23MD_110 ),PINMUX_DATA (PJ22_DATA ,PJ22MD_000 ),PINMUX_DATA (DV_DATA22_MARK ,PJ22MD_001 ),PINMUX_DATA (LCD_DATA22_PJ22_MARK ,PJ22MD_010 ),PINMUX_DATA (LCD_TCON5_MARK ,PJ22MD_011 ),PINMUX_DATA (IRQ2_PJ_MARK ,PJ22MD_100 ), -PINMUX_DATA (CRX1_MARK ,PJ22MD_101 ), -PINMUX_DATA (CRX0_CRX1_MARK ,PJ22MD_110 ), +PINMUX_DATA (CRX1_PJ22_MARK ,PJ22MD_101 ), +PINMUX_DATA (CRX0_CRX1_PJ22_MARK ,PJ22MD_110 ),PINMUX_DATA (PJ21_DATA ,PJ21MD_000 ),PINMUX_DATA (DV_DATA21_MARK ,PJ21MD_001 ),PINMUX_DATA (LCD_DATA21_PJ21_MARK ,PJ21MD_010 ),PINMUX_DATA (LCD_TCON4_MARK ,PJ21MD_011 ),PINMUX_DATA (IRQ1_PJ_MARK ,PJ21MD_100 ), -PINMUX_DATA (CTX2_MARK ,PJ21MD_101 ), +PINMUX_DATA (CTX2_PJ21_MARK ,PJ21MD_101 ), +PINMUX_DATA (CTX0_CTX1_CTX2_PJ21_MARK ,PJ21MD_110 ),PINMUX_DATA (PJ20_DATA ,PJ20MD_000 ),PINMUX_DATA (DV_DATA20_MARK ,PJ20MD_001 ),PINMUX_DATA (LCD_DATA20_PJ20_MARK ,PJ20MD_010 ),PINMUX_DATA (LCD_TCON3_MARK ,PJ20MD_011 ),PINMUX_DATA (IRQ0_PJ_MARK ,PJ20MD_100 ), -PINMUX_DATA (CRX2_MARK ,PJ20MD_101 ), -PINMUX_DATA (CRX0CRX1CRX2_PJ20_MARK ,PJ20MD_110 ), +PINMUX_DATA (CRX2_PJ20_MARK ,PJ20MD_101 ), +PINMUX_DATA (CRX0_CRX1_CRX2_PJ20_MARK ,PJ20MD_110 ),PINMUX_DATA (PJ19_DATA ,PJ19MD_000 ), PINMUX_DATA(DV_DATA19_MARK, PJ19MD_001),
@@ -1663,12 +1666,24 @@ static const struct pinmux_func pinmux_func_gpios[] = {GPIO_FN (WDTOVF ),/* CAN */ +GPIO_FN (CTX2 ), +GPIO_FN (CRX2 ),GPIO_FN (CTX1 ),GPIO_FN (CRX1 ),GPIO_FN (CTX0 ),GPIO_FN (CRX0 ), +GPIO_FN (CTX0_CTX1 ),GPIO_FN (CRX0_CRX1 ), +GPIO_FN (CTX0_CTX1_CTX2 ),GPIO_FN (CRX0_CRX1_CRX2 ), +GPIO_FN (CTX2_PJ21 ), +GPIO_FN (CRX2_PJ20 ), +GPIO_FN (CTX1_PJ23 ), +GPIO_FN (CRX1_PJ22 ), +GPIO_FN (CTX0_CTX1_PJ23 ), +GPIO_FN (CRX0_CRX1_PJ22 ), +GPIO_FN (CTX0_CTX1_CTX2_PJ21 ), +GPIO_FN (CRX0_CRX1_CRX2_PJ20 ),/* DMAC */ GPIO_FN(TEND0),
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 239/459 fbdev: fix numbering of fbcon options
In reply to Sasha LevinFrom: Peter Rosin <[email protected]>
[ Upstream commit fd933c00ebe220060e66fb136a7050a242456566 ]
Three shall be the number thou shalt count, and the number of the counting shall be three. Four shalt thou not count...
One! Two! Five!
--- Documentation/fb/fbcon.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Documentation/fb/fbcon.rst +4 -4
@@ -127,7 +127,7 @@ C. Boot options is typically located on the same video card. Thus, the consoles that are controlled by the VGA console will be garbled. -4. fbcon=rotate:<n> +5. fbcon=rotate:<n> This option changes the orientation angle of the console display. The value 'n' accepts the following:
@@ -152,21 +152,21 @@ C. Boot options Actually, the underlying fb driver is totally ignorant of console rotation. -5. fbcon=margin:<color> +6. fbcon=margin:<color> This option specifies the color of the margins. The margins are the leftover area at the right and the bottom of the screen that are not used by text. By default, this area will be black. The 'color' value is an integer number that depends on the framebuffer driver being used. -6. fbcon=nodefer +7. fbcon=nodefer If the kernel is compiled with deferred fbcon takeover support, normally the framebuffer contents, left in place by the firmware/bootloader, will be preserved until there actually is some text is output to the console. This option causes fbcon to bind immediately to the fbdev device. -7. fbcon=logo-pos:<location> +8. fbcon=logo-pos:<location> The only possible 'location' is 'center' (without quotes), and when given, the bootup logo is moved from the default top-left corner
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 276/459 soc/tegra: fuse: Correct straps' address for older Tegra124 device trees
In reply to Sasha LevinFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit 2d9ea1934f8ef0dfb862d103389562cc28b4fc03 ]
Trying to read out Chip ID before APBMISC registers are mapped won't succeed, in a result Tegra124 gets a wrong address for the HW straps register if machine uses an old outdated device tree.
--- drivers/soc/tegra/fuse/tegra-apbmisc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/tegra/fuse/tegra-apbmisc.c +1 -1
@@ -123,7 +123,7 @@ void __init tegra_init_apbmisc(void) apbmisc.flags =IORESOURCE_MEM ;/* strapping options */ -if (tegra_get_chip_id () ==TEGRA124 ) { +if (of_machine_is_compatible ("nvidia,tegra124" )) { straps.start =0x7000e864 ; straps.end =0x7000e867 ; }else {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 279/459 efi/x86: Don't panic or BUG() on non-critical error conditions
In reply to Sasha LevinFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit e2d68a955e49d61fd0384f23e92058dc9b79be5e ]
The logic in __efi_enter_virtual_mode() does a number of steps in sequence, all of which may fail in one way or the other. In most cases, we simply print an error and disable EFI runtime services support, but in some cases, we BUG() or panic() and bring down the system when encountering conditions that we could easily handle in the same way.
While at it, replace a pointless page-to-virt-phys conversion with one that goes straight from struct page to physical.
--- arch/x86/platform/efi/efi.c | 28 ++++++++++++++-------------- arch/x86/platform/efi/efi_64.c | 9 +++++---- 2 files changed, 19 insertions(+), 18 deletions(-)
arch/x86/platform/efi/efi.c +14 -14
@@ -954,16 +954,14 @@ static void __init __efi_enter_virtual_mode(void)if (efi_alloc_page_tables ()) {pr_err ("Failed to allocate EFI page tables\n" ); -clear_bit (EFI_RUNTIME_SERVICES , &efi.flags); -return ; + goto err; }efi_merge_regions (); new_memmap =efi_map_regions (&count, &pg_shift);if (!new_memmap) {pr_err ("Error reallocating memory, EFI runtime non-functional!\n" ); -clear_bit (EFI_RUNTIME_SERVICES , &efi.flags); -return ; + goto err; } pa =__pa (new_memmap);
@@ -977,8 +975,7 @@ static void __init __efi_enter_virtual_mode(void)if (efi_memmap_init_late (pa, efi.memmap.desc_size * count)) {pr_err ("Failed to remap late EFI memory map\n" ); -clear_bit (EFI_RUNTIME_SERVICES , &efi.flags); -return ; + goto err; }if (efi_enabled (EFI_DBG )) {
@@ -986,12 +983,11 @@ static void __init __efi_enter_virtual_mode(void)efi_print_memmap (); } -BUG_ON (!efi.systab); +if (WARN_ON (!efi.systab)) + goto err; -if (efi_setup_page_tables (pa,1 << pg_shift)) { -clear_bit (EFI_RUNTIME_SERVICES , &efi.flags); -return ; - } +if (efi_setup_page_tables (pa,1 << pg_shift)) + goto err;efi_sync_low_kernel_mappings ();
@@ -1011,9 +1007,9 @@ static void __init __efi_enter_virtual_mode(void) }if (status !=EFI_SUCCESS ) { -pr_alert ("Unable to switch EFI into virtual mode (status=%lx)!\n" , - status); -panic ("EFI call to SetVirtualAddressMap() failed!" ); +pr_err ("Unable to switch EFI into virtual mode (status=%lx)!\n" , + status); + goto err; }efi_free_boot_services ();
@@ -1042,6 +1038,10 @@ static void __init __efi_enter_virtual_mode(void)/* clean DUMMY object */ efi_delete_dummy_variable (); +return ; + +err: +clear_bit (EFI_RUNTIME_SERVICES , &efi.flags); }void __init efi_enter_virtual_mode (void )
arch/x86/platform/efi/efi_64.c +5 -4
@@ -392,11 +392,12 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)return 0 ; page =alloc_page (GFP_KERNEL |__GFP_DMA32); -if (!page) -panic ("Unable to allocate EFI runtime stack < 4GB\n" ); +if (!page) { +pr_err ("Unable to allocate EFI runtime stack < 4GB\n" ); +return 1 ; + } - efi_scratch.phys_stack =virt_to_phys (page_address (page)); - efi_scratch.phys_stack +=PAGE_SIZE ;/* stack grows down */ + efi_scratch.phys_stack =page_to_phys (page +1 );/* stack grows down */ npages = (_etext - _text) >>PAGE_SHIFT ; text =__pa (_text);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 288/459 arm64: dts: rockchip: fix dwmmc clock name for px30
In reply to Sasha LevinFrom: Johan Jonker <[email protected]>
[ Upstream commit 7f2147350291569acd1df5a26dcdfc573916016f ]
An experimental test with the command below gives this error:px30-evb.dt.yaml: dwmmc@ff390000: clock-names:2:
'ciu-drive' was expected
'ciu-drv' is not a valid dwmmc clock name,
so fix this by changing it to 'ciu-drive'.
make ARCH=arm64 dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.yaml
--- arch/arm64/boot/dts/rockchip/px30.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/rockchip/px30.dtsi +3 -3
@@ -768,7 +768,7 @@ interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>, <&cru SCLK_SDMMC_DRV>, <&cru SCLK_SDMMC_SAMPLE>; - clock-names = "biu", "ciu", "ciu-drv", "ciu-sample"; + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; fifo-depth = <0x100>; max-frequency = <150000000>; pinctrl-names = "default";
@@ -783,7 +783,7 @@ interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru HCLK_SDIO>, <&cru SCLK_SDIO>, <&cru SCLK_SDIO_DRV>, <&cru SCLK_SDIO_SAMPLE>; - clock-names = "biu", "ciu", "ciu-drv", "ciu-sample"; + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; fifo-depth = <0x100>; max-frequency = <150000000>; pinctrl-names = "default";
@@ -798,7 +798,7 @@ interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>, <&cru SCLK_EMMC_DRV>, <&cru SCLK_EMMC_SAMPLE>; - clock-names = "biu", "ciu", "ciu-drv", "ciu-sample"; + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; fifo-depth = <0x100>; max-frequency = <150000000>; power-domains = <&power PX30_PD_MMC_NAND>;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 289/459 arm64: dts: rockchip: add reg property to brcmf sub-nodes
In reply to Sasha LevinFrom: Johan Jonker <[email protected]>
[ Upstream commit 96ff264bccb22175bbe2185a1eb5204ca3c5f03f ]
An experimental test with the command below gives this error:rk3399-firefly.dt.yaml: dwmmc@fe310000: wifi@1:
'reg' is a required propertyrk3399-orangepi.dt.yaml: dwmmc@fe310000: wifi@1:
'reg' is a required property rk3399-khadas-edge.dt.yaml: dwmmc@fe310000: wifi@1:
'reg' is a required property rk3399-khadas-edge-captain.dt.yaml: dwmmc@fe310000: wifi@1:
'reg' is a required property rk3399-khadas-edge-v.dt.yaml: dwmmc@fe310000: wifi@1:
'reg' is a required property
So fix this by adding a reg property to the brcmf sub node. Also add #address-cells and #size-cells to prevent more warnings.
make ARCH=arm64 dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.yaml
--- arch/arm64/boot/dts/rockchip/rk3399-firefly.dts | 3 +++ arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi | 3 +++ arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts | 3 +++ 3 files changed, 9 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-firefly.dts +3 -0
@@ -669,9 +669,12 @@ vqmmc-supply = &vcc1v8_s3; /* IO line */ vmmc-supply = &vcc_sdio; /* card's power */ + #address-cells = <1>; + #size-cells = <0>; status = "okay"; brcmf: wifi@1 { + reg = <1>; compatible = "brcm,bcm4329-fmac"; interrupt-parent = <&gpio0>; interrupts = <RK_PA3 GPIO_ACTIVE_HIGH>;
arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi +3 -0
@@ -654,9 +654,12 @@ sd-uhs-sdr104; vqmmc-supply = <&vcc1v8_s3>; vmmc-supply = <&vccio_sd>; + #address-cells = <1>; + #size-cells = <0>; status = "okay"; brcmf: wifi@1 { + reg = <1>; compatible = "brcm,bcm4329-fmac"; interrupt-parent = <&gpio0>; interrupts = <RK_PA3 GPIO_ACTIVE_HIGH>;
arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts +3 -0
@@ -648,9 +648,12 @@ pinctrl-names = "default"; pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; sd-uhs-sdr104; + #address-cells = <1>; + #size-cells = <0>; status = "okay"; brcmf: wifi@1 { + reg = <1>; compatible = "brcm,bcm4329-fmac"; interrupt-parent = <&gpio0>; interrupts = <RK_PA3 GPIO_ACTIVE_HIGH>;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 290/459 ARM: dts: rockchip: add reg property to brcmf sub node for rk3188-bqedison2qc
In reply to Sasha LevinFrom: Johan Jonker <[email protected]>
[ Upstream commit cf206bca178cd5b5a436494b2e0cea75295944f4 ]
An experimental test with the command below gives this error:rk3188-bqedison2qc.dt.yaml: dwmmc@10218000: wifi@1:
'reg' is a required property
So fix this by adding a reg property to the brcmf sub node. Also add #address-cells and #size-cells to prevent more warnings.
make ARCH=arm dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.yaml
--- arch/arm/boot/dts/rk3188-bqedison2qc.dts | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/rk3188-bqedison2qc.dts +3 -0
@@ -466,9 +466,12 @@ pinctrl-names = "default"; pinctrl-0 = <&sd1_clk>, <&sd1_cmd>, <&sd1_bus4>; vmmcq-supply = <&vccio_wl>; + #address-cells = <1>; + #size-cells = <0>; status = "okay"; brcmf: wifi@1 { + reg = <1>; compatible = "brcm,bcm4329-fmac"; interrupt-parent = <&gpio3>; interrupts = <RK_PD2 GPIO_ACTIVE_HIGH>;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 294/459 raid6/test: fix a compilation warning
In reply to Sasha LevinFrom: Zhengyuan Liu <[email protected]>
[ Upstream commit 5e5ac01c2b8802921fee680518a986011cb59820 ]
The compilation warning is redefination showed as following:
In file included from tables.c:2:
../../../include/linux/export.h:180: warning: "EXPORT_SYMBOL" redefined
#define EXPORT_SYMBOL(sym) __EXPORT_SYMBOL(sym, "")
In file included from tables.c:1:
../../../include/linux/raid/pq.h:61: note: this is the location of the previous definition
#define EXPORT_SYMBOL(sym)
--- include/linux/raid/pq.h | 2 ++ lib/raid6/mktables.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
include/linux/raid/pq.h +2 -0
@@ -58,7 +58,9 @@ extern const char raid6_empty_zero_page[PAGE_SIZE];#define enable_kernel_altivec ()#define disable_kernel_altivec () +#undef EXPORT_SYMBOL#define EXPORT_SYMBOL (sym) +#undef EXPORT_SYMBOL_GPL#define EXPORT_SYMBOL_GPL (sym)#define MODULE_LICENSE (licence)#define MODULE_DESCRIPTION (desc)
lib/raid6/mktables.c +1 -1
@@ -56,8 +56,8 @@ int main(int argc, char *argv[])uint8_t v;uint8_t exptbl[256 ], invtbl[256 ]; -printf ("#include <linux/raid/pq.h>\n" );printf ("#include <linux/export.h>\n" ); +printf ("#include <linux/raid/pq.h>\n" );/* Compute multiplication table */ printf("\nconst u8 __attribute__((aligned(256)))\n"
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 309/459 drm/nouveau/secboot/gm20b: initialize pointer in gm20b_secboot_new()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 3613a9bea95a1470dd42e4ed1cc7d86ebe0a2dc0 ]
We accidentally set "psb" which is a no-op instead of "*psb" so it generates a static checker warning. We should probably set it before the first error return so that it's always initialized.
--- drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c +2 -3
@@ -108,6 +108,7 @@ gm20b_secboot_new(struct nvkm_device *device, int index,struct gm200_secboot *gsb;struct nvkm_acr *acr; + *psb =NULL ; acr =acr_r352_new (BIT (NVKM_SECBOOT_FALCON_FECS ) |BIT (NVKM_SECBOOT_FALCON_PMU ));if (IS_ERR (acr))
@@ -116,10 +117,8 @@ gm20b_secboot_new(struct nvkm_device *device, int index, acr->optional_falcons =BIT (NVKM_SECBOOT_FALCON_PMU ); gsb =kzalloc (sizeof (*gsb),GFP_KERNEL ); -if (!gsb) { - psb =NULL ; +if (!gsb)return -ENOMEM ; - } *psb = &gsb->base; ret =nvkm_secboot_ctor (&gm20b_secboot, acr, device, index, &gsb->base);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 310/459 drm/nouveau/gr/gk20a,gm200-: add terminators to method lists read from fw
In reply to Sasha LevinFrom: Ben Skeggs <[email protected]>
[ Upstream commit 7adc77aa0e11f25b0e762859219c70852cd8d56f ]
Method init is typically ordered by class in the FW image as ThreeD, TwoD, Compute.
Due to a bug in parsing the FW into our internal format, we've been accidentally sending Twod + Compute methods to the ThreeD class, as well as Compute methods to the TwoD class - oops.
--- .../gpu/drm/nouveau/nvkm/engine/gr/gk20a.c | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c +11 -10
@@ -143,23 +143,24 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name, nent = (fuc.size /sizeof (struct gk20a_fw_av )); - pack =vzalloc ((sizeof (*pack) * max_classes) + - (sizeof (*init) * (nent +1 ))); + pack =vzalloc ((sizeof (*pack) * (max_classes +1 )) + + (sizeof (*init) * (nent + max_classes +1 )));if (!pack) { ret = -ENOMEM ; goto end; } - init = (void *)(pack + max_classes); + init = (void *)(pack + max_classes +1 ); -for (i =0 ; i < nent; i++) { -struct gf100_gr_init *ent = &init[i]; +for (i =0 ; i < nent; i++, init++) {struct gk20a_fw_av *av = &((struct gk20a_fw_av *)fuc.data)[i];u32 class = av->addr &0xffff ;u32 addr = (av->addr &0xffff0000 ) >>14 ;if (prevclass != class) { - pack[classidx].init = ent; +if (prevclass)/* Add terminator to the method list. */ + init++; + pack[classidx].init = init; pack[classidx].type = class; prevclass = class;if (++classidx >= max_classes) {
@@ -169,10 +170,10 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name, } } - ent->addr = addr; - ent->data = av->data; - ent->count =1 ; - ent->pitch =1 ; + init->addr = addr; + init->data = av->data; + init->count =1 ; + init->pitch =1 ; } *ppack = pack;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 311/459 drm/nouveau: Fix copy-paste error in nouveau_fence_wait_uevent_handler
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit 1eb013473bff5f95b6fe1ca4dd7deda47257b9c2 ]
Like other cases, it should use rcu protected 'chan' rather than 'fence->channel' in nouveau_fence_wait_uevent_handler.
--- drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_fence.c +1 -1
@@ -156,7 +156,7 @@ nouveau_fence_wait_uevent_handler(struct nvif_notify *notify) fence =list_entry (fctx->pending.next,typeof (*fence), head); chan =rcu_dereference_protected (fence->channel,lockdep_is_held (&fctx->lock)); -if (nouveau_fence_update (fence->channel, fctx)) +if (nouveau_fence_update (chan, fctx)) ret =NVIF_NOTIFY_DROP ; }spin_unlock_irqrestore (&fctx->lock, flags);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 312/459 drm/nouveau/drm/ttm: Remove set but not used variable 'mem'
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit 2e4534a22794746b11a794b2229b8d58797eccce ]
drivers/gpu/drm/nouveau/nouveau_ttm.c: In function nouveau_vram_manager_new:drivers/gpu/drm/nouveau/nouveau_ttm.c:66:22: warning: variable mem set but not used [-Wunused-but-set-variable] drivers/gpu/drm/nouveau/nouveau_ttm.c: In function nouveau_gart_manager_new:drivers/gpu/drm/nouveau/nouveau_ttm.c:106:22: warning: variable mem set but not used [-Wunused-but-set-variable]
They are not used any more, so remove it.
--- drivers/gpu/drm/nouveau/nouveau_ttm.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/nouveau/nouveau_ttm.c +0 -4
@@ -63,14 +63,12 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man, {struct nouveau_bo *nvbo =nouveau_bo (bo);struct nouveau_drm *drm =nouveau_bdev (bo->bdev); -struct nouveau_mem *mem;int ret;if (drm->client.device.info.ram_size ==0 )return -ENOMEM ; ret =nouveau_mem_new (&drm->master, nvbo->kind, nvbo->comp, reg); - mem =nouveau_mem (reg);if (ret)return ret;
@@ -103,11 +101,9 @@ nouveau_gart_manager_new(struct ttm_mem_type_manager *man, {struct nouveau_bo *nvbo =nouveau_bo (bo);struct nouveau_drm *drm =nouveau_bdev (bo->bdev); -struct nouveau_mem *mem;int ret; ret =nouveau_mem_new (&drm->master, nvbo->kind, nvbo->comp, reg); - mem =nouveau_mem (reg);if (ret)return ret;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 313/459 drm/nouveau/fault/gv100-: fix memory leak on module unload
In reply to Sasha LevinFrom: Ben Skeggs <[email protected]>
[ Upstream commit 633cc9beeb6f9b5fa2f17a2a9d0e2790cb6c3de7 ]
--- drivers/gpu/drm/nouveau/nvkm/subdev/fault/base.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nvkm/subdev/fault/base.c +1 -0
@@ -146,6 +146,7 @@ nvkm_fault_dtor(struct nvkm_subdev *subdev)struct nvkm_fault *fault =nvkm_fault (subdev);int i; +nvkm_notify_fini (&fault->nrpfb);nvkm_event_fini (&fault->event);for (i =0 ; i < fault->buffer_nr; i++) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 314/459 dm thin: don't allow changing data device during thin-pool reload
In reply to Sasha LevinFrom: Mikulas Patocka <[email protected]>
[ Upstream commit 873937e75f9a8ea231a502c3d29d9cb6ad91b3ef ]
The existing code allows changing the data device when the thin-pool target is reloaded.
This capability is not required and only complicates device lifetime guarantees. This can cause crashes like the one reported here:
https://bugzilla.redhat.com/show_bug.cgi?id=1788596
where the kernel tries to issue a flush bio located in a structure that was already freed.
Take the first step to simplifying the thin-pool's data device lifetime by disallowing changing it. Like the thin-pool's metadata device, the data device is now set in pool_create() and it cannot be changed for a given thin-pool.
--- drivers/md/dm-thin.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/md/dm-thin.c +13 -5
@@ -231,6 +231,7 @@ struct pool {struct dm_target *ti;/* Only set if a pool target is bound */ struct mapped_device *pool_md; +struct block_device *data_dev;struct block_device *md_dev;struct dm_pool_metadata *pmd;
@@ -2945,6 +2946,7 @@ static struct kmem_cache *_new_mapping_cache;static struct pool *pool_create (struct mapped_device *pool_md,struct block_device *metadata_dev, +struct block_device *data_dev,unsigned long block_size,int read_only,char **error) {
@@ -3052,6 +3054,7 @@ static struct pool *pool_create(struct mapped_device *pool_md, pool->last_commit_jiffies = jiffies; pool->pool_md = pool_md; pool->md_dev = metadata_dev; + pool->data_dev = data_dev;__pool_table_insert (pool);return pool;
@@ -3093,6 +3096,7 @@ static void __pool_dec(struct pool *pool)static struct pool *__pool_find (struct mapped_device *pool_md,struct block_device *metadata_dev, +struct block_device *data_dev,unsigned long block_size,int read_only,char **error,int *created) {
@@ -3103,19 +3107,23 @@ static struct pool *__pool_find(struct mapped_device *pool_md, *error ="metadata device already in use by a pool" ;return ERR_PTR (-EBUSY ); } +if (pool->data_dev != data_dev) { + *error ="data device already in use by a pool" ; +return ERR_PTR (-EBUSY ); + }__pool_inc (pool); }else { pool =__pool_table_lookup (pool_md);if (pool) { -if (pool->md_dev != metadata_dev) { +if (pool->md_dev != metadata_dev || pool->data_dev != data_dev) { *error ="different pool cannot replace a pool" ;return ERR_PTR (-EINVAL ); }__pool_inc (pool); }else { - pool =pool_create (pool_md, metadata_dev, block_size, read_only, error); + pool =pool_create (pool_md, metadata_dev, data_dev, block_size, read_only, error); *created =1 ; } }
@@ -3368,7 +3376,7 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) goto out; } - pool =__pool_find (dm_table_get_md (ti->table), metadata_dev->bdev, + pool =__pool_find (dm_table_get_md (ti->table), metadata_dev->bdev, data_dev->bdev, block_size, pf.mode ==PM_READ_ONLY , &ti->error, &pool_created);if (IS_ERR (pool)) { r =PTR_ERR (pool);
@@ -4114,7 +4122,7 @@ static struct target_type pool_target = { .name = "thin-pool", .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | DM_TARGET_IMMUTABLE, - .version = {1, 21, 0}, + .version = {1, 22, 0}, .module = THIS_MODULE, .ctr = pool_ctr, .dtr = pool_dtr,
@@ -4493,7 +4501,7 @@ static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits)static struct target_type thin_target = { .name ="thin" , - .version = {1 ,21 ,0 }, + .version = {1 ,22 ,0 }, .module =THIS_MODULE , .ctr = thin_ctr, .dtr = thin_dtr,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 341/459 KVM: PPC: Remove set but not used variable 'ra', 'rs', 'rt'
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit 4de0a8355463e068e443b48eb5ae32370155368b ]
Fixes gcc '-Wunused-but-set-variable' warning:
arch/powerpc/kvm/emulate_loadstore.c: In function kvmppc_emulate_loadstore:arch/powerpc/kvm/emulate_loadstore.c:87:6: warning: variable ra set but not used [-Wunused-but-set-variable] arch/powerpc/kvm/emulate_loadstore.c: In function kvmppc_emulate_loadstore:arch/powerpc/kvm/emulate_loadstore.c:87:10: warning: variable rs set but not used [-Wunused-but-set-variable] arch/powerpc/kvm/emulate_loadstore.c: In function kvmppc_emulate_loadstore:arch/powerpc/kvm/emulate_loadstore.c:87:14: warning: variable rt set but not used [-Wunused-but-set-variable]
They are not used since commit 2b33cb585f94 ("KVM: PPC: Reimplement LOAD_FP/STORE_FP instruction mmio emulation with analyse_instr() input")
--- arch/powerpc/kvm/emulate_loadstore.c | 5 ----- 1 file changed, 5 deletions(-)
arch/powerpc/kvm/emulate_loadstore.c +0 -5
@@ -73,7 +73,6 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu) {struct kvm_run *run = vcpu->run;u32 inst; -int ra, rs, rt;enum emulation_result emulated =EMULATE_FAIL ;int advance =1 ;struct instruction_op op;
@@ -85,10 +84,6 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)if (emulated !=EMULATE_DONE )return emulated; - ra =get_ra (inst); - rs =get_rs (inst); - rt =get_rt (inst); - vcpu->arch.mmio_vsx_copy_nums =0 ; vcpu->arch.mmio_vsx_offset =0 ; vcpu->arch.mmio_copy_type =KVMPPC_VSX_COPY_NONE ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 353/459 pwm: omap-dmtimer: Remove PWM chip in .remove before making it unfunctional
In reply to Sasha LevinFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 43efdc8f0e6d7088ec61bd55a73bf853f002d043 ]
In the old code (e.g.) mutex_destroy() was called before pwmchip_remove(). Between these two calls it is possible that a PWM callback is used which tries to grab the mutex.
--- drivers/pwm/pwm-omap-dmtimer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/pwm/pwm-omap-dmtimer.c +6 -1
@@ -361,6 +361,11 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)static int pwm_omap_dmtimer_remove (struct platform_device *pdev) {struct pwm_omap_dmtimer_chip *omap =platform_get_drvdata (pdev); +int ret; + + ret =pwmchip_remove (&omap->chip); +if (ret) +return ret;if (pm_runtime_active (&omap->dm_timer_pdev->dev)) omap->pdata->stop (omap->dm_timer);
@@ -369,7 +374,7 @@ static int pwm_omap_dmtimer_remove(struct platform_device *pdev)mutex_destroy (&omap->mutex); -return pwmchip_remove (&omap->chip); +return 0 ; }static const struct of_device_id pwm_omap_dmtimer_of_match[] = {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 358/459 pwm: Remove set but not set variable 'pwm'
In reply to Sasha LevinFrom: yu kuai <[email protected]>
[ Upstream commit 9871abffc81048e20f02e15d6aa4558a44ad53ea ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/pwm/pwm-pca9685.c: In function ‘pca9685_pwm_gpio_free’: drivers/pwm/pwm-pca9685.c:162:21: warning: variable ‘pwm’ set but not used [-Wunused-but-set-variable]
It is never used, and so can be removed. In that case, hold and release the lock 'pca->lock' can be removed since nothing will be done between them.
--- drivers/pwm/pwm-pca9685.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/pwm/pwm-pca9685.c +0 -4
@@ -159,13 +159,9 @@ static void pca9685_pwm_gpio_set(struct gpio_chip *gpio, unsigned int offset,static void pca9685_pwm_gpio_free (struct gpio_chip *gpio,unsigned int offset) {struct pca9685 *pca =gpiochip_get_data (gpio); -struct pwm_device *pwm;pca9685_pwm_gpio_set (gpio, offset,0 );pm_runtime_put (pca->chip.dev); -mutex_lock (&pca->lock); - pwm = &pca->chip.pwms[offset]; -mutex_unlock (&pca->lock); } static int pca9685_pwm_gpio_get_direction(struct gpio_chip *chip,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 367/459 spi: spi-fsl-qspi: Ensure width is respected in spi-mem operations
In reply to Sasha LevinFrom: Michael Walle <[email protected]>
[ Upstream commit b0177aca7aea7e8917d4e463334b51facb293d02 ]
Make use of a core helper to ensure the desired width is respected when calling spi-mem operators.
Otherwise only the SPI controller will be matched with the flash chip, which might lead to wrong widths. Also consider the width specified by the user in the device tree.
--- drivers/spi/spi-fsl-qspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-fsl-qspi.c +1 -1
@@ -398,7 +398,7 @@ static bool fsl_qspi_supports_op(struct spi_mem *mem, op->data.nbytes > q->devtype_data->txfifo)return false; -return true; +return spi_mem_default_supports_op (mem, op); } static void fsl_qspi_prepare_lut(struct fsl_qspi *q,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 375/459 platform/x86: intel_mid_powerbtn: Take a copy of ddata
In reply to Sasha LevinFrom: Mika Westerberg <[email protected]>
[ Upstream commit 5e0c94d3aeeecc68c573033f08d9678fecf253bd ]
The driver gets driver_data from memory that is marked as const (which is probably put to read-only memory) and it then modifies it. This likely causes some sort of fault to happen.
Fix this by taking a copy of the structure.
--- drivers/platform/x86/intel_mid_powerbtn.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/platform/x86/intel_mid_powerbtn.c +3 -2
@@ -146,9 +146,10 @@ static int mid_pb_probe(struct platform_device *pdev)input_set_capability (input,EV_KEY ,KEY_POWER ); - ddata = (struct mid_pb_ddata *)id->driver_data; + ddata =devm_kmemdup (&pdev->dev, (void *)id->driver_data, +sizeof (*ddata),GFP_KERNEL );if (!ddata) -return -ENODATA ; +return -ENOMEM ; ddata->dev = &pdev->dev; ddata->irq = irq;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 379/459 drm/nouveau/mmu: fix comptag memory leak
In reply to Sasha LevinFrom: Ben Skeggs <[email protected]>
[ Upstream commit 35e4909b6a2b4005ced3c4238da60d926b78fdea ]
--- drivers/gpu/drm/nouveau/nvkm/core/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/core/memory.c +1 -1
@@ -91,8 +91,8 @@ nvkm_memory_tags_get(struct nvkm_memory *memory, struct nvkm_device *device, }refcount_set (&tags->refcount,1 ); + *ptags = memory->tags = tags;mutex_unlock (&fb->subdev.mutex); - *ptags = tags;return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 380/459 drm/nouveau/kms/nv50: remove set but not unused variable 'nv_connector'
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit 39496368ba96b40b1dca07315418e473998eef15 ]
drivers/gpu/drm/nouveau/dispnv50/disp.c: In function nv50_pior_enable:drivers/gpu/drm/nouveau/dispnv50/disp.c:1672:28: warning:
variable nv_connector set but not used [-Wunused-but-set-variable]
commit ac2d9275f371 ("drm/nouveau/kms/nv50-: Store the bpc we're using in nv50_head_atom") left behind this.
--- drivers/gpu/drm/nouveau/dispnv50/disp.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/nouveau/dispnv50/disp.c +0 -2
@@ -1673,7 +1673,6 @@ nv50_pior_enable(struct drm_encoder *encoder) {struct nouveau_encoder *nv_encoder =nouveau_encoder (encoder);struct nouveau_crtc *nv_crtc =nouveau_crtc (encoder->crtc); -struct nouveau_connector *nv_connector;struct nv50_head_atom *asyh =nv50_head_atom (nv_crtc->base.state);struct nv50_core *core =nv50_disp (encoder->dev)->core;u8 owner =1 << nv_crtc->index;
@@ -1681,7 +1680,6 @@ nv50_pior_enable(struct drm_encoder *encoder)nv50_outp_acquire (nv_encoder); - nv_connector =nouveau_encoder_connector_get (nv_encoder);switch (asyh->or.bpc) {case 10 : asyh->or.depth =0x6 ;break ;case 8 : asyh->or.depth =0x5 ;break ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 389/459 bcache: cached_dev_free needs to put the sb page
In reply to Sasha LevinFrom: Liang Chen <[email protected]>
[ Upstream commit e8547d42095e58bee658f00fef8e33d2a185c927 ]
Same as cache device, the buffer page needs to be put while freeing cached_dev. Otherwise a page would be leaked every time a cached_dev is stopped.
--- drivers/md/bcache/super.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/md/bcache/super.c +3 -0
@@ -1274,6 +1274,9 @@ static void cached_dev_free(struct closure *cl)mutex_unlock (&bch_register_lock); +if (dc->sb_bio.bi_inline_vecs[0 ].bv_page) +put_page (bio_first_page_all (&dc->sb_bio)); +if (!IS_ERR_OR_NULL (dc->bdev))blkdev_put (dc->bdev,FMODE_READ |FMODE_WRITE |FMODE_EXCL );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 390/459 bcache: rework error unwinding in register_bcache
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 50246693f81fe887f4db78bf7089051d7f1894cc ]
Split the successful and error return path, and use one goto label for each resource to unwind. This also fixes some small errors like leaking the module reference count in the reboot case (which seems entirely harmless) or printing the wrong warning messages for early failures.
--- drivers/md/bcache/super.c | 75 +++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 30 deletions(-)
drivers/md/bcache/super.c +45 -30
@@ -2372,29 +2372,33 @@ static bool bch_is_open(struct block_device *bdev)static ssize_t register_bcache (struct kobject *k,struct kobj_attribute *attr,const char *buffer,size_t size) { -ssize_t ret = -EINVAL ; -const char *err ="cannot allocate memory" ; -char *path =NULL ; -struct cache_sb *sb =NULL ; +const char *err; +char *path; +struct cache_sb *sb;struct block_device *bdev =NULL ; -struct page *sb_page =NULL ; +struct page *sb_page; +ssize_t ret; + ret = -EBUSY ;if (!try_module_get (THIS_MODULE )) -return -EBUSY ; + goto out;/* For latest state of bcache_is_reboot */ smp_mb ();if (bcache_is_reboot) -return -EBUSY ; + goto out_module_put; + ret = -ENOMEM ; + err ="cannot allocate memory" ; path =kstrndup (buffer, size,GFP_KERNEL );if (!path) - goto err; + goto out_module_put; sb =kmalloc (sizeof (struct cache_sb ),GFP_KERNEL );if (!sb) - goto err; + goto out_free_path; + ret = -EINVAL ; err ="failed to open device" ; bdev = blkdev_get_by_path(strim(path), FMODE_READ|FMODE_WRITE|FMODE_EXCL,
@@ -2411,57 +2415,68 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,if (!IS_ERR (bdev))bdput (bdev);if (attr == &ksysfs_register_quiet) - goto quiet_out; + goto done; } - goto err; + goto out_free_sb; } err ="failed to set blocksize" ;if (set_blocksize (bdev,4096 )) - goto err_close; + goto out_blkdev_put; err =read_super (sb, bdev, &sb_page);if (err) - goto err_close; + goto out_blkdev_put; err ="failed to register device" ;if (SB_IS_BDEV (sb)) {struct cached_dev *dc =kzalloc (sizeof (*dc),GFP_KERNEL );if (!dc) - goto err_close; + goto out_put_sb_page;mutex_lock (&bch_register_lock); ret =register_bdev (sb, sb_page, bdev, dc);mutex_unlock (&bch_register_lock);/* blkdev_put() will be called in cached_dev_free() */ -if (ret <0 ) - goto err; +if (ret <0 ) { + bdev =NULL ; + goto out_put_sb_page; + } }else {struct cache *ca =kzalloc (sizeof (*ca),GFP_KERNEL );if (!ca) - goto err_close; + goto out_put_sb_page;/* blkdev_put() will be called in bch_cache_release() */ -if (register_cache (sb, sb_page, bdev, ca) !=0 ) - goto err; +if (register_cache (sb, sb_page, bdev, ca) !=0 ) { + bdev =NULL ; + goto out_put_sb_page; + } } -quiet_out: - ret = size; -out: -if (sb_page) -put_page (sb_page); + +put_page (sb_page); +done:kfree (sb);kfree (path);module_put (THIS_MODULE ); -return ret; - -err_close: -blkdev_put (bdev,FMODE_READ |FMODE_WRITE |FMODE_EXCL ); -err: +return size; + +out_put_sb_page: +put_page (sb_page); +out_blkdev_put: +if (bdev) +blkdev_put (bdev,FMODE_READ |FMODE_WRITE |FMODE_EXCL ); +out_free_sb: +kfree (sb); +out_free_path: +kfree (path); +out_module_put: +module_put (THIS_MODULE ); +out:pr_info ("error %s: %s" , path, err); - goto out; +return ret; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 391/459 bcache: fix use-after-free in register_bcache()
In reply to Sasha LevinFrom: Coly Li <[email protected]>
[ Upstream commit ae3cd299919af6eb670d5af0bc9d7ba14086bd8e ]
The patch "bcache: rework error unwinding in register_bcache" introduces a use-after-free regression in register_bcache(). Here are current code,
2510 out_free_path:
2511 kfree(path);
2512 out_module_put:
2513 module_put(THIS_MODULE);
2514 out:
2515 pr_info("error %s: %s", path, err);
2516 return ret;If some error happens and the above code path is executed, at line 2511 path is released, but referenced at line 2515. Then KASAN reports a use- after-free error message.
This patch changes line 2515 in the following way to fix the problem,
2515 pr_info("error %s: %s", path?path:"", err);--- drivers/md/bcache/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/bcache/super.c +2 -1
@@ -2472,10 +2472,11 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,kfree (sb); out_free_path:kfree (path); + path =NULL ; out_module_put:module_put (THIS_MODULE ); out: -pr_info ("error %s: %s" , path, err); +pr_info ("error %s: %s" , path?path:"" , err);return ret; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 392/459 bcache: avoid unnecessary btree nodes flushing in btree_flush_write()
In reply to Sasha LevinFrom: Coly Li <[email protected]>
[ Upstream commit 2aa8c529387c25606fdc1484154b92f8bfbc5746 ]
the commit 91be66e1318f ("bcache: performance improvement for btree_flush_write()") was an effort to flushing btree node with oldest btree node faster in following methods,
- Only iterate dirty btree nodes in c->btree_cache, avoid scanning a lot of clean btree nodes.
- Take c->btree_cache as a LRU-like list, aggressively flushing all dirty nodes from tail of c->btree_cache util the btree node with oldest journal entry is flushed. This is to reduce the time of holding c->bucket_lock.
Guoju Fang and Shuang Li reported that they observe unexptected extra write I/Os on cache device after applying the above patch. Guoju Fang provideed more detailed diagnose information that the aggressive btree nodes flushing may cause 10x more btree nodes to flush in his workload. He points out when system memory is large enough to hold all btree nodes in memory, c->btree_cache is not a LRU-like list any more. Then the btree node with oldest journal entry is very probably not- close to the tail of c->btree_cache list. In such situation much more dirty btree nodes will be aggressively flushed before the target node is flushed. When slow SATA SSD is used as cache device, such over- aggressive flushing behavior will cause performance regression.
After spending a lot of time on debug and diagnose, I find the real condition is more complicated, aggressive flushing dirty btree nodes from tail of c->btree_cache list is not a good solution.
- When all btree nodes are cached in memory, c->btree_cache is not a LRU-like list, the btree nodes with oldest journal entry won't be close to the tail of the list.
- There can be hundreds dirty btree nodes reference the oldest journal entry, before flushing all the nodes the oldest journal entry cannot be reclaimed.
When the above two conditions mixed together, a simply flushing from tail of c->btree_cache list is really NOT a good idea.
Fortunately there is still chance to make btree_flush_write() work better. Here is how this patch avoids unnecessary btree nodes flushing,
- Only acquire c->journal.lock when getting oldest journal entry of fifo c->journal.pin. In rested locations check the journal entries locklessly, so their values can be changed on other cores in parallel.
- In loop list_for_each_entry_safe_reverse(), checking latest front point of fifo c->journal.pin. If it is different from the original point which we get with locking c->journal.lock, it means the oldest journal entry is reclaim on other cores. At this moment, all selected dirty nodes recorded in array btree_nodes[] are all flushed and clean on other CPU cores, it is unncessary to iterate c->btree_cache any longer. Just quit the list_for_each_entry_safe_reverse() loop and the following for-loop will skip all the selected clean nodes.
- Find a proper time to quit the list_for_each_entry_safe_reverse() loop. Check the refcount value of orignial fifo front point, if the value is larger than selected node number of btree_nodes[], it means more matching btree nodes should be scanned. Otherwise it means no more matching btee nodes in rest of c->btree_cache list, the loop can be quit. If the original oldest journal entry is reclaimed and fifo front point is updated, the refcount of original fifo front point will be 0, then the loop will be quit too.
- Not hold c->bucket_lock too long time. c->bucket_lock is also required for space allocation for cached data, hold it for too long time will block regular I/O requests. When iterating list c->btree_cache, even there are a lot of maching btree nodes, in order to not holding c->bucket_lock for too long time, only BTREE_FLUSH_NR nodes are selected and to flush in following for-loop.
With this patch, only btree nodes referencing oldest journal entry are flushed to cache device, no aggressive flushing for unnecessary btree node any more. And in order to avoid blocking regluar I/O requests, each time when btree_flush_write() called, at most only BTREE_FLUSH_NR btree nodes are selected to flush, even there are more maching btree nodes in list c->btree_cache.
At last, one more thing to explain: Why it is safe to read front point of c->journal.pin without holding c->journal.lock inside the list_for_each_entry_safe_reverse() loop ?
Here is my answer: When reading the front point of fifo c->journal.pin, we don't need to know the exact value of front point, we just want to check whether the value is different from the original front point (which is accurate value because we get it while c->jouranl.lock is held). For such purpose, it works as expected without holding c->journal.lock. Even the front point is changed on other CPU core and not updated to local core, and current iterating btree node has identical journal entry local as original fetched fifo front point, it is still safe. Because after holding mutex b->write_lock (with memory barrier) this btree node can be found as clean and skipped, the loop will quite latter when iterate on next node of list c->btree_cache.
--- drivers/md/bcache/journal.c | 80 ++++++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 5 deletions(-)
drivers/md/bcache/journal.c +75 -5
@@ -417,10 +417,14 @@ int bch_journal_replay(struct cache_set *s, struct list_head *list)/* Journalling */ +#define nr_to_fifo_front (p, front_p, mask) (((p) - (front_p)) & (mask)) +static void btree_flush_write (struct cache_set *c) {struct btree *b, *t, *btree_nodes[BTREE_FLUSH_NR ]; -unsigned int i, n; +unsigned int i, nr, ref_nr; +atomic_t *fifo_front_p, *now_fifo_front_p; +size_t mask;if (c->journal.btree_flushing)return ;
@@ -433,12 +437,50 @@ static void btree_flush_write(struct cache_set *c) c->journal.btree_flushing = true;spin_unlock (&c->journal.flush_write_lock); +/* get the oldest journal entry and check its refcount */ +spin_lock (&c->journal.lock); + fifo_front_p = &fifo_front (&c->journal.pin); + ref_nr =atomic_read (fifo_front_p); +if (ref_nr <=0 ) { +/* +* do nothing if no btree node references +* the oldest journal entry +*/ +spin_unlock (&c->journal.lock); + goto out; + } +spin_unlock (&c->journal.lock); + + mask = c->journal.pin.mask; + nr =0 ;atomic_long_inc (&c->flush_write);memset (btree_nodes,0 ,sizeof (btree_nodes)); - n =0 ;mutex_lock (&c->bucket_lock);list_for_each_entry_safe_reverse (b, t, &c->btree_cache, list) { +/* +* It is safe to get now_fifo_front_p without holding +* c->journal.lock here, because we don't need to know +* the exactly accurate value, just check whether the +* front pointer of c->journal.pin is changed. +*/ + now_fifo_front_p = &fifo_front (&c->journal.pin); +/* +* If the oldest journal entry is reclaimed and front +* pointer of c->journal.pin changes, it is unnecessary +* to scan c->btree_cache anymore, just quit the loop and +* flush out what we have already. +*/ +if (now_fifo_front_p != fifo_front_p) +break ; +/* +* quit this loop if all matching btree nodes are +* scanned and record in btree_nodes[] already. +*/ + ref_nr =atomic_read (fifo_front_p); +if (nr >= ref_nr) +break ; +if (btree_node_journal_flush (b))pr_err ("BUG: flush_write bit should not be set here!" );
@@ -454,17 +496,44 @@ static void btree_flush_write(struct cache_set *c)continue ; } +/* +* Only select the btree node which exactly references +* the oldest journal entry. +* +* If the journal entry pointed by fifo_front_p is +* reclaimed in parallel, don't worry: +* - the list_for_each_xxx loop will quit when checking +* next now_fifo_front_p. +* - If there are matched nodes recorded in btree_nodes[], +* they are clean now (this is why and how the oldest +* journal entry can be reclaimed). These selected nodes +* will be ignored and skipped in the folowing for-loop. +*/ +if (nr_to_fifo_front (btree_current_write (b)->journal, + fifo_front_p, + mask) !=0 ) { +mutex_unlock (&b->write_lock); +continue ; + } +set_btree_node_journal_flush (b);mutex_unlock (&b->write_lock); - btree_nodes[n++] = b; -if (n ==BTREE_FLUSH_NR ) + btree_nodes[nr++] = b; +/* +* To avoid holding c->bucket_lock too long time, +* only scan for BTREE_FLUSH_NR matched btree nodes +* at most. If there are more btree nodes reference +* the oldest journal entry, try to flush them next +* time when btree_flush_write() is called. +*/ +if (nr ==BTREE_FLUSH_NR )break ; }mutex_unlock (&c->bucket_lock); -for (i =0 ; i < n; i++) { +for (i =0 ; i < nr; i++) { b = btree_nodes[i];if (!b) {pr_err ("BUG: btree_nodes[%d] is NULL" , i);
@@ -497,6 +566,7 @@ static void btree_flush_write(struct cache_set *c)mutex_unlock (&b->write_lock); } +out:spin_lock (&c->journal.flush_write_lock); c->journal.btree_flushing = false;spin_unlock (&c->journal.flush_write_lock);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 424/459 drm/nouveau/disp/nv50-: prevent oops when no channel method map provided
In reply to Sasha LevinFrom: Ben Skeggs <[email protected]>
[ Upstream commit 0e6176c6d286316e9431b4f695940cfac4ffe6c2 ]
The implementations for most channel types contains a map of methods to priv registers in order to provide debugging info when a disp exception has been raised.
This info is missing from the implementation of PIO channels as they're rather simplistic already, however, if an exception is raised by one of them, we'd end up triggering a NULL-pointer deref. Not ideal...
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=206299
--- drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c +2 -0
@@ -74,6 +74,8 @@ nv50_disp_chan_mthd(struct nv50_disp_chan *chan, int debug)if (debug > subdev->debug)return ; +if (!mthd) +return ;for (i =0 ; (list = mthd->data[i].mthd) !=NULL ; i++) {u32 base = chan->head * mthd->addr;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 425/459 docs: i2c: writing-clients: properly name the stop condition
In reply to Sasha LevinFrom: Luca Ceresoli <[email protected]>
[ Upstream commit 4fcb445ec688a62da9c864ab05a4bd39b0307cdc ]
In I2C there is no such thing as a "stop bit". Use the proper naming: "stop condition".
--- Documentation/i2c/writing-clients.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/i2c/writing-clients.rst +3 -3
@@ -357,9 +357,9 @@ read/written. This sends a series of messages. Each message can be a read or write, and they can be mixed in any way. The transactions are combined: no -stop bit is sent between transaction. The i2c_msg structure contains -for each message the client address, the number of bytes of the message -and the message data itself. +stop condition is issued between transaction. The i2c_msg structure +contains for each message the client address, the number of bytes of the +message and the message data itself. You can read the file ``i2c-protocol`` for more information about the actual I2C protocol.
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 432/459 ocfs2: make local header paths relative to C files
In reply to Sasha LevinFrom: Masahiro Yamada <[email protected]>
[ Upstream commit ca322fb6030956c2337fbf1c1beeb08c5dd5c943 ]
Gang He reports the failure of building fs/ocfs2/ as an external module of the kernel installed on the system:
$ cd fs/ocfs2 $ make -C /lib/modules/`uname -r`/build M=`pwd` modules
If you want to make it work reliably, I'd recommend to remove ccflags-y from the Makefiles, and to make header paths relative to the C files. I think this is the correct usage of the #include "..." directive.
--- fs/ocfs2/dlm/Makefile | 2 -- fs/ocfs2/dlm/dlmast.c | 8 ++++---- fs/ocfs2/dlm/dlmconvert.c | 8 ++++---- fs/ocfs2/dlm/dlmdebug.c | 8 ++++---- fs/ocfs2/dlm/dlmdomain.c | 8 ++++---- fs/ocfs2/dlm/dlmlock.c | 8 ++++---- fs/ocfs2/dlm/dlmmaster.c | 8 ++++---- fs/ocfs2/dlm/dlmrecovery.c | 8 ++++---- fs/ocfs2/dlm/dlmthread.c | 8 ++++---- fs/ocfs2/dlm/dlmunlock.c | 8 ++++---- fs/ocfs2/dlmfs/Makefile | 2 -- fs/ocfs2/dlmfs/dlmfs.c | 4 ++-- fs/ocfs2/dlmfs/userdlm.c | 6 +++--- 13 files changed, 41 insertions(+), 45 deletions(-)
fs/ocfs2/dlm/Makefile +0 -2
@@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only -ccflags-y := -I $(srctree)/$(src)/.. - obj-$(CONFIG_OCFS2_FS_O2CB) += ocfs2_dlm.o ocfs2_dlm-objs := dlmdomain.o dlmdebug.o dlmthread.o dlmrecovery.o \
fs/ocfs2/dlm/dlmast.c +4 -4
@@ -23,15 +23,15 @@#include <linux/spinlock.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h" #define MLOG_MASK_PREFIX ML_DLM -#include "cluster/masklog.h" +#include "../cluster/masklog.h" static void dlm_update_lvb (struct dlm_ctxt *dlm,struct dlm_lock_resource *res,struct dlm_lock *lock);
fs/ocfs2/dlm/dlmconvert.c +4 -4
@@ -23,9 +23,9 @@#include <linux/spinlock.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h"
@@ -33,7 +33,7 @@#include "dlmconvert.h" #define MLOG_MASK_PREFIX ML_DLM -#include "cluster/masklog.h" +#include "../cluster/masklog.h" /* NOTE: __dlmconvert_master is the only function in here that * needs a spinlock held on entry (res->spinlock) and it is the
fs/ocfs2/dlm/dlmdebug.c +4 -4
@@ -17,9 +17,9 @@#include <linux/debugfs.h> #include <linux/export.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h"
@@ -27,7 +27,7 @@#include "dlmdebug.h" #define MLOG_MASK_PREFIX ML_DLM -#include "cluster/masklog.h" +#include "../cluster/masklog.h" static int stringify_lockname (const char *lockname,int locklen,char *buf,int len);
fs/ocfs2/dlm/dlmdomain.c +4 -4
@@ -20,9 +20,9 @@#include <linux/debugfs.h> #include <linux/sched/signal.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h"
@@ -30,7 +30,7 @@#include "dlmdebug.h" #define MLOG_MASK_PREFIX (ML_DLM|ML_DLM_DOMAIN) -#include "cluster/masklog.h" +#include "../cluster/masklog.h" /* * ocfs2 node maps are array of long int, which limits to send them freely
fs/ocfs2/dlm/dlmlock.c +4 -4
@@ -25,9 +25,9 @@#include <linux/delay.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h"
@@ -35,7 +35,7 @@#include "dlmconvert.h" #define MLOG_MASK_PREFIX ML_DLM -#include "cluster/masklog.h" +#include "../cluster/masklog.h" static struct kmem_cache *dlm_lock_cache;
fs/ocfs2/dlm/dlmmaster.c +4 -4
@@ -25,9 +25,9 @@#include <linux/delay.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h"
@@ -35,7 +35,7 @@#include "dlmdebug.h" #define MLOG_MASK_PREFIX (ML_DLM|ML_DLM_MASTER) -#include "cluster/masklog.h" +#include "../cluster/masklog.h" static void dlm_mle_node_down(struct dlm_ctxt *dlm, struct dlm_master_list_entry *mle,
fs/ocfs2/dlm/dlmrecovery.c +4 -4
@@ -26,16 +26,16 @@#include <linux/delay.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h" #include "dlmdomain.h" #define MLOG_MASK_PREFIX (ML_DLM|ML_DLM_RECOVERY) -#include "cluster/masklog.h" +#include "../cluster/masklog.h" static void dlm_do_local_recovery_cleanup (struct dlm_ctxt *dlm,u8 dead_node);
fs/ocfs2/dlm/dlmthread.c +4 -4
@@ -25,16 +25,16 @@#include <linux/delay.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h" #include "dlmdomain.h" #define MLOG_MASK_PREFIX (ML_DLM|ML_DLM_THREAD) -#include "cluster/masklog.h" +#include "../cluster/masklog.h" static int dlm_thread (void *data);static void dlm_flush_asts (struct dlm_ctxt *dlm);
fs/ocfs2/dlm/dlmunlock.c +4 -4
@@ -23,15 +23,15 @@#include <linux/spinlock.h> #include <linux/delay.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h" #define MLOG_MASK_PREFIX ML_DLM -#include "cluster/masklog.h" +#include "../cluster/masklog.h" #define DLM_UNLOCK_FREE_LOCK 0x00000001#define DLM_UNLOCK_CALL_AST 0x00000002
fs/ocfs2/dlmfs/Makefile +0 -2
@@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only -ccflags-y := -I $(srctree)/$(src)/.. - obj-$(CONFIG_OCFS2_FS) += ocfs2_dlmfs.o ocfs2_dlmfs-objs := userdlm.o dlmfs.o
fs/ocfs2/dlmfs/dlmfs.c +2 -2
@@ -33,11 +33,11 @@#include <linux/uaccess.h> -#include "stackglue.h" +#include "../stackglue.h" #include "userdlm.h" #define MLOG_MASK_PREFIX ML_DLMFS -#include "cluster/masklog.h" +#include "../cluster/masklog.h" static const struct super_operations dlmfs_ops;
fs/ocfs2/dlmfs/userdlm.c +3 -3
@@ -21,12 +21,12 @@#include <linux/types.h> #include <linux/crc32.h> -#include "ocfs2_lockingver.h" -#include "stackglue.h" +#include "../ocfs2_lockingver.h" +#include "../stackglue.h" #include "userdlm.h" #define MLOG_MASK_PREFIX ML_DLMFS -#include "cluster/masklog.h" +#include "../cluster/masklog.h" static inline struct user_lock_res *user_lksb_to_lock_res (struct ocfs2_dlm_lksb *lksb)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 433/459 ocfs2: fix a NULL pointer dereference when call ocfs2_update_inode_fsync_trans()
In reply to Sasha LevinFrom: wangyan <[email protected]>
[ Upstream commit 9f16ca48fc818a17de8be1f75d08e7f4addc4497 ]
I found a NULL pointer dereference in ocfs2_update_inode_fsync_trans(), handle->h_transaction may be NULL in this situation:
ocfs2_file_write_iter
->__generic_file_write_iter
->generic_perform_write
->ocfs2_write_begin
->ocfs2_write_begin_nolock
->ocfs2_write_cluster_by_desc
->ocfs2_write_cluster
->ocfs2_mark_extent_written
->ocfs2_change_extent_flag
->ocfs2_split_extent
->ocfs2_try_to_merge_extent
->ocfs2_extend_rotate_transaction
->ocfs2_extend_trans
->jbd2_journal_restart
->jbd2__journal_restart
// handle->h_transaction is NULL here
->handle->h_transaction = NULL;
->start_this_handle
/* journal aborted due to storage
network disconnection, return error */
->return -EROFS;
/* line 3806 in ocfs2_try_to_merge_extent (),
it will ignore ret error. */
->ret = 0;
->...
->ocfs2_write_end
->ocfs2_write_end_nolock
->ocfs2_update_inode_fsync_trans
// NULL pointer dereference
->oi->i_sync_tid = handle->h_transaction->t_tid;The information of NULL pointer dereference as follows:
JBD2: Detected IO errors while flushing file data on dm-11-45
Aborting journal on device dm-11-45.
JBD2: Error -5 detected when updating journal superblock for dm-11-45.
(dd,22081,3):ocfs2_extend_trans:474 ERROR: status = -30
(dd,22081,3):ocfs2_try_to_merge_extent:3877 ERROR: status = -30
Unable to handle kernel NULL pointer dereference at
virtual address 0000000000000008
Mem abort info:
ESR = 0x96000004
Exception class = DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
Data abort info:
ISV = 0, ISS = 0x00000004
CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgdp = 00000000e74e1338
[0000000000000008] pgd=0000000000000000
Internal error: Oops: 96000004 [#1] SMP
Process dd (pid: 22081, stack limit = 0x00000000584f35a9)
CPU: 3 PID: 22081 Comm: dd Kdump: loaded
Hardware name: Huawei TaiShan 2280 V2/BC82AMDD, BIOS 0.98 08/25/2019
pstate: 60400009 (nZCv daif +PAN -UAO)
pc : ocfs2_write_end_nolock+0x2b8/0x550 [ocfs2]
lr : ocfs2_write_end_nolock+0x2a0/0x550 [ocfs2]
sp : ffff0000459fba70
x29: ffff0000459fba70 x28: 0000000000000000
x27: ffff807ccf7f1000 x26: 0000000000000001
x25: ffff807bdff57970 x24: ffff807caf1d4000
x23: ffff807cc79e9000 x22: 0000000000001000
x21: 000000006c6cd000 x20: ffff0000091d9000
x19: ffff807ccb239db0 x18: ffffffffffffffff
x17: 000000000000000e x16: 0000000000000007
x15: ffff807c5e15bd78 x14: 0000000000000000
x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000001
x9 : 0000000000000228 x8 : 000000000000000c
x7 : 0000000000000fff x6 : ffff807a308ed6b0
x5 : ffff7e01f10967c0 x4 : 0000000000000018
x3 : d0bc661572445600 x2 : 0000000000000000
x1 : 000000001b2e0200 x0 : 0000000000000000
Call trace:
ocfs2_write_end_nolock+0x2b8/0x550 [ocfs2]
ocfs2_write_end+0x4c/0x80 [ocfs2]
generic_perform_write+0x108/0x1a8
__generic_file_write_iter+0x158/0x1c8
ocfs2_file_write_iter+0x668/0x950 [ocfs2]
__vfs_write+0x11c/0x190
vfs_write+0xac/0x1c0
ksys_write+0x6c/0xd8
__arm64_sys_write+0x24/0x30
el0_svc_common+0x78/0x130
el0_svc_handler+0x38/0x78
el0_svc+0x8/0xcTo prevent NULL pointer dereference in this situation, we use is_handle_aborted() before using handle->h_transaction->t_tid.
--- fs/ocfs2/journal.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/ocfs2/journal.h +5 -3
@@ -597,9 +597,11 @@ static inline void ocfs2_update_inode_fsync_trans(handle_t *handle, {struct ocfs2_inode_info *oi =OCFS2_I (inode); - oi->i_sync_tid = handle->h_transaction->t_tid; -if (datasync) - oi->i_datasync_tid = handle->h_transaction->t_tid; +if (!is_handle_aborted (handle)) { + oi->i_sync_tid = handle->h_transaction->t_tid; +if (datasync) + oi->i_datasync_tid = handle->h_transaction->t_tid; + } }#endif /* OCFS2_JOURNAL_H */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 435/459 reiserfs: prevent NULL pointer dereference in reiserfs_insert_item()
In reply to Sasha LevinFrom: Yunfeng Ye <[email protected]>
[ Upstream commit aacee5446a2a1aa35d0a49dab289552578657fb4 ]
The variable inode may be NULL in reiserfs_insert_item(), but there is no check before accessing the member of inode.
Fix this by adding NULL pointer check before calling reiserfs_debug().
--- fs/reiserfs/stree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/reiserfs/stree.c +2 -1
@@ -2246,7 +2246,8 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th,/* also releases the path */ unfix_nodes (&s_ins_balance);#ifdef REISERQUOTA_DEBUG -reiserfs_debug (th->t_super,REISERFS_DEBUG_CODE , +if (inode) +reiserfs_debug (th->t_super,REISERFS_DEBUG_CODE ,"reiserquota insert_item(): freeing %u id=%u type=%c" , quota_bytes, inode->i_uid,head2type (ih));#endif
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 437/459 bcache: explicity type cast in bset_bkey_last()
In reply to Sasha LevinFrom: Coly Li <[email protected]>
[ Upstream commit 7c02b0055f774ed9afb6e1c7724f33bf148ffdc0 ]
In bset.h, macro bset_bkey_last() is defined as,
bkey_idx((struct bkey *) (i)->d, (i)->keys)
Parameter i can be variable type of data structure, the macro always works once the type of struct i has member 'd' and 'keys'.
bset_bkey_last() is also used in macro csum_set() to calculate the checksum of a on-disk data structure. When csum_set() is used to calculate checksum of on-disk bcache super block, the parameter 'i' data type is struct cache_sb_disk. Inside struct cache_sb_disk (also in struct cache_sb) the member keys is __u16 type. But bkey_idx() expects unsigned int (a 32bit width), so there is problem when sending parameters via stack to call bkey_idx().
Sparse tool from Intel 0day kbuild system reports this incompatible problem. bkey_idx() is part of user space API, so the simplest fix is to cast the (i)->keys to unsigned int type in macro bset_bkey_last().
--- drivers/md/bcache/bset.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/bcache/bset.h +2 -1
@@ -397,7 +397,8 @@ void bch_btree_keys_stats(struct btree_keys *b, struct bset_stats *state);/* Bkey utility code */ -#define bset_bkey_last (i) bkey_idx((struct bkey *) (i)->d, (i)->keys) +#define bset_bkey_last (i) bkey_idx((struct bkey *) (i)->d, \ + (unsigned int)(i)->keys)static inline struct bkey *bset_bkey_idx (struct bset *i,unsigned int idx) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 438/459 bcache: fix incorrect data type usage in btree_flush_write()
In reply to Sasha LevinFrom: Coly Li <[email protected]>
[ Upstream commit d1c3cc34f5a78b38d2b809b289d912c3560545df ]
Dan Carpenter points out that from commit 2aa8c529387c ("bcache: avoid unnecessary btree nodes flushing in btree_flush_write()"), there is a incorrect data type usage which leads to the following static checker warning:
drivers/md/bcache/journal.c:444 btree_flush_write()
warn: 'ref_nr' unsigned <= 0
drivers/md/bcache/journal.c
422 static void btree_flush_write(struct cache_set *c) 423 {
424 struct btree *b, *t, *btree_nodes[BTREE_FLUSH_NR];
425 unsigned int i, nr, ref_nr;
^^^^^^ 426 atomic_t *fifo_front_p, *now_fifo_front_p;
427 size_t mask;
428
429 if (c->journal.btree_flushing)
430 return;
431
432 spin_lock(&c->journal.flush_write_lock);
433 if (c->journal.btree_flushing) {
434 spin_unlock(&c->journal.flush_write_lock);
435 return;
436 }
437 c->journal.btree_flushing = true;
438 spin_unlock(&c->journal.flush_write_lock);
439
440 /* get the oldest journal entry and check its refcount */
441 spin_lock(&c->journal.lock);
442 fifo_front_p = &fifo_front(&c->journal.pin);
443 ref_nr = atomic_read(fifo_front_p);
444 if (ref_nr <= 0) {
^^^^^^^^^^^Unsigned can't be less than zero.
445 /* 446 * do nothing if no btree node references 447 * the oldest journal entry 448 */ 449 spin_unlock(&c->journal.lock); 450 goto out; 451 } 452 spin_unlock(&c->journal.lock);
As the warning information indicates, local varaible ref_nr in unsigned int type is wrong, which does not matche atomic_read() and the "<= 0" checking.
This patch fixes the above error by defining local variable ref_nr as int type.
--- drivers/md/bcache/journal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/bcache/journal.c +2 -1
@@ -422,7 +422,8 @@ int bch_journal_replay(struct cache_set *s, struct list_head *list)static void btree_flush_write (struct cache_set *c) {struct btree *b, *t, *btree_nodes[BTREE_FLUSH_NR ]; -unsigned int i, nr, ref_nr; +unsigned int i, nr; +int ref_nr;atomic_t *fifo_front_p, *now_fifo_front_p;size_t mask;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 455/459 i40e: Relax i40e_xsk_wakeup's return value when PF is busy
In reply to Sasha LevinFrom: Maciej Fijalkowski <[email protected]>
[ Upstream commit c77e9f09143822623dd71a0fdc84331129e97c3a ]
Return -EAGAIN instead of -ENETDOWN to provide a slightly milder information to user space so that an application will know to retry the syscall when __I40E_CONFIG_BUSY bit is set on pf->state.
--- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_xsk.c +1 -1
@@ -791,7 +791,7 @@ int i40e_xsk_wakeup(struct net_device *dev, u32 queue_id, u32 flags)struct i40e_ring *ring;if (test_bit (__I40E_CONFIG_BUSY, pf->state)) -return -ENETDOWN ; +return -EAGAIN ;if (test_bit (__I40E_VSI_DOWN, vsi->state))return -ENETDOWN ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 457/459 virtio_balloon: prevent pfn array overflow
In reply to Sasha LevinFrom: "Michael S. Tsirkin" <[email protected]>
[ Upstream commit 6e9826e77249355c09db6ba41cd3f84e89f4b614 ]
Make sure, at build time, that pfn array is big enough to hold a single page. It happens to be true since the PAGE_SHIFT value at the moment is 20, which is 1M - exactly 256 4K balloon pages.
--- drivers/virtio/virtio_balloon.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/virtio/virtio_balloon.c +2 -0
@@ -157,6 +157,8 @@ static void set_page_pfns(struct virtio_balloon *vb, {unsigned int i; +BUILD_BUG_ON (VIRTIO_BALLOON_PAGES_PER_PAGE >VIRTIO_BALLOON_ARRAY_PFNS_MAX ); +/* * Set balloon pfns pointing at this page. * Note that the first pfn points at start of the page.
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 1/459 drm/amdgpu: remove set but not used variable 'mc_shared_chmap' from 'gfx_v6_0.c' and 'gfx_v7_0.c'
From: yu kuai <[email protected]>
[ Upstream commit 747a397d394fac0001e4b3c03d7dce3a118af567 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c: In function ‘gfx_v6_0_constants_init’:drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c:1579:6: warning: variable ‘mc_shared_chmap’ set but not used [-Wunused-but-set-variable]
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c: In function ‘gfx_v7_0_gpu_early_init’:drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4262:6: warning: variable ‘mc_shared_chmap’ set but not used [-Wunused-but-set-variable]
--- drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 3 +-- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +1 -2
@@ -1576,7 +1576,7 @@ static void gfx_v6_0_config_init(struct amdgpu_device *adev)static void gfx_v6_0_constants_init (struct amdgpu_device *adev) {u32 gb_addr_config =0 ; -u32 mc_shared_chmap, mc_arb_ramcfg; +u32 mc_arb_ramcfg;u32 sx_debug_1;u32 hdp_host_path_cntl;u32 tmp;
@@ -1678,7 +1678,6 @@ static void gfx_v6_0_constants_init(struct amdgpu_device *adev)WREG32 (mmBIF_FB_EN,BIF_FB_EN__FB_READ_EN_MASK |BIF_FB_EN__FB_WRITE_EN_MASK ); - mc_shared_chmap =RREG32 (mmMC_SHARED_CHMAP); adev->gfx.config.mc_arb_ramcfg =RREG32 (mmMC_ARB_RAMCFG); mc_arb_ramcfg = adev->gfx.config.mc_arb_ramcfg;
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +1 -2
@@ -4258,7 +4258,7 @@ static int gfx_v7_0_late_init(void *handle)static void gfx_v7_0_gpu_early_init (struct amdgpu_device *adev) {u32 gb_addr_config; -u32 mc_shared_chmap, mc_arb_ramcfg; +u32 mc_arb_ramcfg;u32 dimm00_addr_map, dimm01_addr_map, dimm10_addr_map, dimm11_addr_map;u32 tmp;
@@ -4335,7 +4335,6 @@ static void gfx_v7_0_gpu_early_init(struct amdgpu_device *adev)break ; } - mc_shared_chmap =RREG32 (mmMC_SHARED_CHMAP); adev->gfx.config.mc_arb_ramcfg =RREG32 (mmMC_ARB_RAMCFG); mc_arb_ramcfg = adev->gfx.config.mc_arb_ramcfg;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 2/459 drm/gma500: Fixup fbdev stolen size usage evaluation
From: Paul Kocialkowski <[email protected]>
[ Upstream commit fd1a5e521c3c083bb43ea731aae0f8b95f12b9bd ]
psbfb_probe performs an evaluation of the required size from the stolen GTT memory, but gets it wrong in two distinct ways:
- The resulting size must be page-size-aligned;
- The size to allocate is derived from the surface dimensions, not the fb dimensions.
When two connectors are connected with different modes, the smallest will be stored in the fb dimensions, but the size that needs to be allocated must match the largest (surface) dimensions. This is what is used in the actual allocation code.
Fix this by correcting the evaluation to conform to the two points above. It allows correctly switching to 16bpp when one connector is e.g. 1920x1080 and the other is 1024x768.
--- drivers/gpu/drm/gma500/framebuffer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/gma500/framebuffer.c +6 -2
@@ -462,6 +462,7 @@ static int psbfb_probe(struct drm_fb_helper *helper, container_of(helper, struct psb_fbdev, psb_fb_helper);struct drm_device *dev = psb_fbdev->psb_fb_helper.dev;struct drm_psb_private *dev_priv = dev->dev_private; +unsigned int fb_size;int bytespp; bytespp = sizes->surface_bpp /8 ;
@@ -471,8 +472,11 @@ static int psbfb_probe(struct drm_fb_helper *helper,/* If the mode will not fit in 32bit then switch to 16bit to get a console on full resolution. The X mode setting server will allocate its own 32bit GEM framebuffer */ -if (ALIGN (sizes->fb_width * bytespp,64 ) * sizes->fb_height > - dev_priv->vram_stolen_size) { + fb_size =ALIGN (sizes->surface_width * bytespp,64 ) * + sizes->surface_height; + fb_size =ALIGN (fb_size,PAGE_SIZE ); + +if (fb_size > dev_priv->vram_stolen_size) { sizes->surface_bpp =16 ; sizes->surface_depth =16 ; }
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 3/459 ath10k: Fix qmi init error handling
In reply to Sasha LevinFrom: Jeffrey Hugo <[email protected]>
[ Upstream commit f8a595a87e93a33a10879f4b856be818d2f53c84 ]
When ath10k_qmi_init() fails, the error handling does not free the irq resources, which causes an issue if we EPROBE_DEFER as we'll attempt to (re-)register irqs which are already registered.
Fix this by doing a power off since we just powered on the hardware, and freeing the irqs as error handling.
--- drivers/net/wireless/ath/ath10k/snoc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/snoc.c +4 -1
@@ -1729,13 +1729,16 @@ static int ath10k_snoc_probe(struct platform_device *pdev) ret =ath10k_qmi_init (ar, msa_size);if (ret) {ath10k_warn (ar,"failed to register wlfw qmi client: %d\n" , ret); - goto err_core_destroy; + goto err_power_off; }ath10k_dbg (ar,ATH10K_DBG_SNOC ,"snoc probe\n" );return 0 ; +err_power_off: +ath10k_hw_power_off (ar); + err_free_irq:ath10k_snoc_free_irq (ar);
Signature · 7 lines
2.20.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 4/459 wil6210: fix break that is never reached because of zero'ing of a retry counter
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit 5b1413f00b5beb9f5fed94e43ea0c497d5db9633 ]
There is a check on the retry counter invalid_buf_id_retry that is always false because invalid_buf_id_retry is initialized to zero on each iteration of a while-loop. Fix this by initializing the retry counter before the while-loop starts.
Addresses-Coverity: ("Logically dead code")
--- drivers/net/wireless/ath/wil6210/txrx_edma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/wil6210/txrx_edma.c +2 -1
@@ -880,6 +880,7 @@ static struct sk_buff *wil_sring_reap_rx_edma(struct wil6210_priv *wil,u8 data_offset;struct wil_rx_status_extended *s;u16 sring_idx = sring - wil->srings; +int invalid_buff_id_retry;BUILD_BUG_ON (sizeof (struct wil_rx_status_extended ) >sizeof (skb->cb));
@@ -893,9 +894,9 @@ static struct sk_buff *wil_sring_reap_rx_edma(struct wil6210_priv *wil,/* Extract the buffer ID from the status message */ buff_id =le16_to_cpu (wil_rx_status_get_buff_id (msg)); + invalid_buff_id_retry =0 ;while (!buff_id) {struct wil_rx_status_extended *s; -int invalid_buff_id_retry =0 ; wil_dbg_txrx(wil, "buff_id is not updated yet by HW, (swhead 0x%x)\n",
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 9/459 soc: fsl: qe: change return type of cpm_muram_alloc() to s32
In reply to Sasha LevinFrom: Rasmus Villemoes <[email protected]>
[ Upstream commit 800cd6fb76f0ec7711deb72a86c924db1ae42648 ]
There are a number of problems with cpm_muram_alloc() and its callers. Most callers assign the return value to some variable and then use IS_ERR_VALUE to check for allocation failure. However, when that variable is not sizeof(long), this leads to warnings - and it is indeed broken to do e.g.
u32 foo = cpm_muram_alloc(); if (IS_ERR_VALUE(foo))
on a 64-bit platform, since the condition
foo >= (unsigned long)-ENOMEM
is tautologically false. There are also callers that ignore the possibility of error, and then there are those that check for error by comparing the return value to 0...
One could fix that by changing all callers to store the return value temporarily in an "unsigned long" and test that. However, use of IS_ERR_VALUE() is error-prone and should be restricted to things which are inherently long-sized (stuff in pt_regs etc.). Instead, let's aim for changing to the standard kernel style
int foo = cpm_muram_alloc();
if (foo < 0)
deal_with_it()
some->where = foo;Changing the return type from unsigned long to s32 (aka signed int) doesn't change the value that gets stored into any of the callers' variables except if the caller was storing the result in a u64 _and_ the allocation failed, so in itself this patch should be a no-op.
Another problem with cpm_muram_alloc() is that it can certainly validly return 0 - and except if some cpm_muram_alloc_fixed() call interferes, the very first cpm_muram_alloc() call will return just that. But that shows that both ucc_slow_free() and ucc_fast_free() are buggy, since they assume that a value of 0 means "that field was never allocated". We'll later change cpm_muram_free() to accept (and ignore) a negative offset, so callers can use a sentinel of -1 instead of 0 and just unconditionally call cpm_muram_free().
--- drivers/soc/fsl/qe/qe_common.c | 29 ++++++++++++++++------------- include/soc/fsl/qe/qe.h | 16 ++++++++-------- 2 files changed, 24 insertions(+), 21 deletions(-)
drivers/soc/fsl/qe/qe_common.c +16 -13
@@ -32,7 +32,7 @@ static phys_addr_t muram_pbase;struct muram_block {struct list_head head; -unsigned long start; +s32 start;int size; };
@@ -110,13 +110,14 @@ int cpm_muram_init(void)* @algo: algorithm for alloc. * @data: data for genalloc's algorithm. * -* This function returns an offset into the muram area. +* This function returns a non-negative offset into the muram area, or +* a negative errno on failure. */ -static unsigned long cpm_muram_alloc_common (unsigned long size, -genpool_algo_t algo,void *data) +static s32 cpm_muram_alloc_common (unsigned long size, +genpool_algo_t algo,void *data) {struct muram_block *entry; -unsigned long start; +s32 start;if (!muram_pool &&cpm_muram_init ()) goto out2;
@@ -137,7 +138,7 @@ static unsigned long cpm_muram_alloc_common(unsigned long size, out1:gen_pool_free (muram_pool, start, size); out2: -return (unsigned long )-ENOMEM ; +return -ENOMEM ; }/*
@@ -145,13 +146,14 @@ static unsigned long cpm_muram_alloc_common(unsigned long size,* @size: number of bytes to allocate * @align: requested alignment, in bytes * -* This function returns an offset into the muram area. +* This function returns a non-negative offset into the muram area, or +* a negative errno on failure. * Use cpm_dpram_addr() to get the virtual address of the area. * Use cpm_muram_free() to free the allocation. */ -unsigned long cpm_muram_alloc (unsigned long size,unsigned long align) +s32 cpm_muram_alloc (unsigned long size,unsigned long align) { -unsigned long start; +s32 start;unsigned long flags;struct genpool_data_align muram_pool_data;
@@ -168,7 +170,7 @@ EXPORT_SYMBOL(cpm_muram_alloc);* cpm_muram_free - free a chunk of multi-user ram * @offset: The beginning of the chunk as returned by cpm_muram_alloc(). */ -int cpm_muram_free (unsigned long offset) +int cpm_muram_free (s32 offset) {unsigned long flags;int size;
@@ -194,13 +196,14 @@ EXPORT_SYMBOL(cpm_muram_free);* cpm_muram_alloc_fixed - reserve a specific region of multi-user ram * @offset: offset of allocation start address * @size: number of bytes to allocate -* This function returns an offset into the muram area +* This function returns @offset if the area was available, a negative +* errno otherwise. * Use cpm_dpram_addr() to get the virtual address of the area. * Use cpm_muram_free() to free the allocation. */ -unsigned long cpm_muram_alloc_fixed (unsigned long offset,unsigned long size) +s32 cpm_muram_alloc_fixed (unsigned long offset,unsigned long size) { -unsigned long start; +s32 start;unsigned long flags;struct genpool_data_fixed muram_pool_data_fixed;
include/soc/fsl/qe/qe.h +8 -8
@@ -98,26 +98,26 @@ static inline void qe_reset(void) {}int cpm_muram_init (void );#if defined(CONFIG_CPM ) || defined(CONFIG_QUICC_ENGINE ) -unsigned long cpm_muram_alloc (unsigned long size,unsigned long align); -int cpm_muram_free (unsigned long offset); -unsigned long cpm_muram_alloc_fixed (unsigned long offset,unsigned long size); +s32 cpm_muram_alloc (unsigned long size,unsigned long align); +int cpm_muram_free (s32 offset); +s32 cpm_muram_alloc_fixed (unsigned long offset,unsigned long size);void __iomem *cpm_muram_addr (unsigned long offset);unsigned long cpm_muram_offset (void __iomem *addr);dma_addr_t cpm_muram_dma (void __iomem *addr);#else -static inline unsigned long cpm_muram_alloc (unsigned long size, -unsigned long align) +static inline s32 cpm_muram_alloc (unsigned long size, +unsigned long align) {return -ENOSYS ; } -static inline int cpm_muram_free (unsigned long offset) +static inline int cpm_muram_free (s32 offset) {return -ENOSYS ; } -static inline unsigned long cpm_muram_alloc_fixed (unsigned long offset, -unsigned long size) +static inline s32 cpm_muram_alloc_fixed (unsigned long offset, +unsigned long size) {return -ENOSYS ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 12/459 f2fs: call f2fs_balance_fs outside of locked page
In reply to Sasha LevinFrom: Jaegeuk Kim <[email protected]>
[ Upstream commit bdf03299248916640a835a05d32841bb3d31912d ]
Otherwise, we can hit deadlock by waiting for the locked page in move_data_block in GC.
Thread A Thread B
- do_page_mkwrite
- f2fs_vm_page_mkwrite
- lock_page
- f2fs_balance_fs
- mutex_lock(gc_mutex)
- f2fs_gc
- do_garbage_collect
- ra_data_block
- grab_cache_page
- f2fs_balance_fs
- mutex_lock(gc_mutex)
--- fs/f2fs/file.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/f2fs/file.c +4 -3
@@ -50,7 +50,7 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf)struct page *page = vmf->page;struct inode *inode =file_inode (vmf->vma->vm_file);struct f2fs_sb_info *sbi =F2FS_I_SB (inode); -struct dnode_of_data dn = { .node_changed = false }; +struct dnode_of_data dn;int err;if (unlikely (f2fs_cp_error (sbi))) {
@@ -63,6 +63,9 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf) goto err; } +/* should do out of any locked page */ +f2fs_balance_fs (sbi, true); +sb_start_pagefault (inode->i_sb);f2fs_bug_on (sbi,f2fs_has_inline_data (inode));
@@ -120,8 +123,6 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf) out_sem:up_read (&F2FS_I (inode)->i_mmap_sem); -f2fs_balance_fs (sbi, dn.node_changed); -sb_end_pagefault (inode->i_sb); err:return block_page_mkwrite_return (err);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 13/459 crypto: testmgr - don't try to decrypt uninitialized buffers
In reply to Sasha LevinFrom: Eric Biggers <[email protected]>
[ Upstream commit eb455dbd02cb1074b37872ffca30a81cb2a18eaa ]
Currently if the comparison fuzz tests encounter an encryption error when generating an skcipher or AEAD test vector, they will still test the decryption side (passing it the uninitialized ciphertext buffer) and expect it to fail with the same error.
This is sort of broken because it's not well-defined usage of the API to pass an uninitialized buffer, and furthermore in the AEAD case it's acceptable for the decryption error to be EBADMSG (meaning "inauthentic input") even if the encryption error was something else like EINVAL.
Fix this for skcipher by explicitly initializing the ciphertext buffer on error, and for AEAD by skipping the decryption test on error.
--- crypto/testmgr.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
crypto/testmgr.c +16 -4
@@ -2102,6 +2102,7 @@ static void generate_random_aead_testvec(struct aead_request *req,* If the key or authentication tag size couldn't be set, no need to * continue to encrypt. */ + vec->crypt_error =0 ;if (vec->setkey_error || vec->setauthsize_error) goto done;
@@ -2245,10 +2246,12 @@ static int test_aead_vs_generic_impl(const char *driver, req, tsgls);if (err) goto out; - err =test_aead_vec_cfg (driver,DECRYPT , &vec, vec_name, cfg, - req, tsgls); -if (err) - goto out; +if (vec.crypt_error ==0 ) { + err =test_aead_vec_cfg (driver,DECRYPT , &vec, vec_name, + cfg, req, tsgls); +if (err) + goto out; + }cond_resched (); } err =0 ;
@@ -2678,6 +2681,15 @@ static void generate_random_cipher_testvec(struct skcipher_request *req,skcipher_request_set_callback (req,0 , crypto_req_done, &wait);skcipher_request_set_crypt (req, &src, &dst, vec->len, iv); vec->crypt_error =crypto_wait_req (crypto_skcipher_encrypt (req), &wait); +if (vec->crypt_error !=0 ) { +/* +* The only acceptable error here is for an invalid length, so +* skcipher decryption should fail with the same error too. +* We'll test for this. But to keep the API usage well-defined, +* explicitly initialize the ciphertext buffer too. +*/ +memset ((u8 *)vec->ctext,0 , vec->len); + } done:snprintf (name, max_namelen,"\"random: len=%u klen=%u\"" , vec->len, vec->klen);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 11/459 f2fs: preallocate DIO blocks when forcing buffered_io
In reply to Sasha LevinFrom: Jaegeuk Kim <[email protected]>
[ Upstream commit 47501f87c61ad2aa234add63e1ae231521dbc3f5 ]
The previous preallocation and DIO decision like below.
allow_outplace_dio !allow_outplace_dio f2fs_force_buffered_io (*) No_Prealloc / Buffered_IO Prealloc / Buffered_IO !f2fs_force_buffered_io No_Prealloc / DIO Prealloc / DIO
But, Javier reported Case (*) where zoned device bypassed preallocation but fell back to buffered writes in f2fs_direct_IO(), resulting in stale data being read.
In order to fix the issue, actually we need to preallocate blocks whenever we fall back to buffered IO like this. No change is made in the other cases.
allow_outplace_dio !allow_outplace_dio f2fs_force_buffered_io (*) Prealloc / Buffered_IO Prealloc / Buffered_IO !f2fs_force_buffered_io No_Prealloc / DIO Prealloc / DIO
--- fs/f2fs/data.c | 13 ------------- fs/f2fs/file.c | 43 +++++++++++++++++++++++++++++++++---------- 2 files changed, 33 insertions(+), 23 deletions(-)
fs/f2fs/data.c +0 -13
@@ -1074,19 +1074,6 @@ int f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *from)int err =0 ;bool direct_io = iocb->ki_flags &IOCB_DIRECT ; -/* convert inline data for Direct I/O*/ -if (direct_io) { - err =f2fs_convert_inline_inode (inode); -if (err) -return err; - } - -if (direct_io &&allow_outplace_dio (inode, iocb, from)) -return 0 ; - -if (is_inode_flag_set (inode,FI_NO_PREALLOC )) -return 0 ; - map.m_lblk =F2FS_BLK_ALIGN (iocb->ki_pos); map.m_len =F2FS_BYTES_TO_BLK (iocb->ki_pos +iov_iter_count (from));if (map.m_len > map.m_lblk)
fs/f2fs/file.c +33 -10
51 lines not on this page · raw message
Signature · 8 lines
2.20.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Sasha Levin
maintainerPATCH 14/459 media: i2c: adv748x: Fix unsafe macros
In reply to Sasha LevinFrom: "Gustavo A. R. Silva" <[email protected]>
[ Upstream commit 0d962e061abcf1b9105f88fb850158b5887fbca3 ]
Enclose multiple macro parameters in parentheses in order to make such macros safer and fix the Clang warning below:
drivers/media/i2c/adv748x/adv748x-afe.c:452:12: warning: operator '?:' has lower precedence than '|'; '|' will be evaluated first [-Wbitwise-conditional-parentheses]
ret = sdp_clrset(state, ADV748X_SDP_FRP, ADV748X_SDP_FRP_MASK, enable ? ctrl->val - 1 : 0);
--- drivers/media/i2c/adv748x/adv748x.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/i2c/adv748x/adv748x.h +4 -4
@@ -394,10 +394,10 @@ int adv748x_write_block(struct adv748x_state *state, int client_page,#define io_read (s, r) adv748x_read(s, ADV748X_PAGE_IO, r)#define io_write (s, r, v) adv748x_write(s, ADV748X_PAGE_IO, r, v) -#define io_clrset (s, r, m, v) io_write(s, r, (io_read(s, r) & ~m) | v) +#define io_clrset (s, r, m, v) io_write(s, r, (io_read(s, r) & ~(m)) | (v))#define hdmi_read (s, r) adv748x_read(s, ADV748X_PAGE_HDMI, r) -#define hdmi_read16 (s, r, m) (((hdmi_read(s, r) << 8) | hdmi_read(s, r+1)) & m) +#define hdmi_read16 (s, r, m) (((hdmi_read(s, r) << 8) | hdmi_read(s, (r)+1)) & (m))#define hdmi_write (s, r, v) adv748x_write(s, ADV748X_PAGE_HDMI, r, v)#define repeater_read (s, r) adv748x_read(s, ADV748X_PAGE_REPEATER, r)
@@ -405,11 +405,11 @@ int adv748x_write_block(struct adv748x_state *state, int client_page,#define sdp_read (s, r) adv748x_read(s, ADV748X_PAGE_SDP, r)#define sdp_write (s, r, v) adv748x_write(s, ADV748X_PAGE_SDP, r, v) -#define sdp_clrset (s, r, m, v) sdp_write(s, r, (sdp_read(s, r) & ~m) | v) +#define sdp_clrset (s, r, m, v) sdp_write(s, r, (sdp_read(s, r) & ~(m)) | (v))#define cp_read (s, r) adv748x_read(s, ADV748X_PAGE_CP, r)#define cp_write (s, r, v) adv748x_write(s, ADV748X_PAGE_CP, r, v) -#define cp_clrset (s, r, m, v) cp_write(s, r, (cp_read(s, r) & ~m) | v) +#define cp_clrset (s, r, m, v) cp_write(s, r, (cp_read(s, r) & ~(m)) | (v))#define tx_read (t, r) adv748x_read(t->state, t->page, r)#define tx_write (t, r, v) adv748x_write(t->state, t->page, r, v)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 20/459 brcmfmac: Fix memory leak in brcmf_p2p_create_p2pdev()
In reply to Sasha LevinFrom: Navid Emamdoost <[email protected]>
[ Upstream commit 5cc509aa83c6acd2c5cd94f99065c39d2bd0a490 ]
In the implementation of brcmf_p2p_create_p2pdev() the allocated memory for p2p_vif is leaked when the mac address is the same as primary interface. To fix this, go to error path to release p2p_vif via brcmf_free_vif().
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +2 -1
@@ -2092,7 +2092,8 @@ static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p,/* firmware requires unique mac address for p2pdev interface */ if (addr &ðer_addr_equal (addr, pri_ifp->mac_addr)) {bphy_err (drvr,"discovery vif must be different from primary interface\n" ); -return ERR_PTR (-EINVAL ); + err = -EINVAL ; + goto fail; }brcmf_p2p_generate_bss_mac (p2p, addr);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 21/459 brcmfmac: Fix use after free in brcmf_sdio_readframes()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 216b44000ada87a63891a8214c347e05a4aea8fe ]
The brcmu_pkt_buf_free_skb() function frees "pkt" so it leads to a static checker warning:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:1974 brcmf_sdio_readframes()
error: dereferencing freed memory 'pkt'
It looks like there was supposed to be a continue after we free "pkt".
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +1 -0
@@ -1935,6 +1935,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) BRCMF_SDIO_FT_NORMAL)) { rd->len =0 ;brcmu_pkt_buf_free_skb (pkt); +continue ; } bus->sdcnt.rx_readahead_cnt++;if (rd->len !=roundup (rd_new.len,16 )) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 23/459 drm/amd/display: Map ODM memory correctly when doing ODM combine
In reply to Sasha LevinFrom: Nikola Cornij <[email protected]>
[ Upstream commit ec5b356c58941bb8930858155d9ce14ceb3d30a0 ]
[why]
Up to 4 ODM memory pieces are required per ODM combine and cannot overlap, i.e. each ODM "session" has to use its own memory pieces. The ODM-memory mapping is currently broken for generic case.
The maximum number of memory pieces is ASIC-dependent, but it's always big enough to satisfy maximum number of ODM combines. Memory pieces are mapped as a bit-map, i.e. one memory piece corresponds to one bit. The OPTC doing ODM needs to select memory pieces by setting the corresponding bits, making sure there's no overlap with other OPTC instances that might be doing ODM.
The current mapping works only for OPTC instance indexes smaller than
3. For instance indexes 3 and up it practically maps no ODM memory, causing black, gray or white screen in display configs that include ODM on OPTC instance 3 or up.
[how]
Statically map two unique ODM memory pieces for each OPTC instance and piece them together when programming ODM combine mode.
--- .../gpu/drm/amd/display/dc/dcn20/dcn20_optc.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.c +12 -4
@@ -233,12 +233,13 @@ void optc2_set_odm_combine(struct timing_generator *optc, int *opp_id, int opp_c struct dc_crtc_timing *timing) {struct optc *optc1 =DCN10TG_FROM_TG (optc); -/* 2 pieces of memory required for up to 5120 displays, 4 for up to 8192 */ int mpcc_hactive = (timing->h_addressable + timing->h_border_left + timing->h_border_right) / opp_cnt; -int memory_mask = mpcc_hactive <=2560 ?0x3 :0xf ; +uint32_t memory_mask;uint32_t data_fmt =0 ; +ASSERT (opp_cnt ==2 ); +/* TODO: In pseudocode but does not affect maximus, delete comment if we dont need on asic * REG_SET(OTG_GLOBAL_CONTROL2, 0, GLOBAL_UPDATE_LOCK_EN, 1); * Program OTG register MASTER_UPDATE_LOCK_DB_X/Y to the position before DP frame start
@@ -246,9 +247,17 @@ void optc2_set_odm_combine(struct timing_generator *optc, int *opp_id, int opp_c* MASTER_UPDATE_LOCK_DB_X, 160, * MASTER_UPDATE_LOCK_DB_Y, 240); */ + +/* 2 pieces of memory required for up to 5120 displays, 4 for up to 8192, +* however, for ODM combine we can simplify by always using 4. +* To make sure there's no overlap, each instance "reserves" 2 memories and +* they are uniquely combined here. +*/ + memory_mask =0x3 << (opp_id[0 ] *2 ) |0x3 << (opp_id[1 ] *2 ); +if (REG (OPTC_MEMORY_CONFIG ))REG_SET (OPTC_MEMORY_CONFIG ,0 , -OPTC_MEM_SEL , memory_mask << (optc->inst *4 )); +OPTC_MEM_SEL , memory_mask);if (timing->pixel_encoding ==PIXEL_ENCODING_YCBCR422 ) data_fmt =1 ;
@@ -257,7 +266,6 @@ void optc2_set_odm_combine(struct timing_generator *optc, int *opp_id, int opp_cREG_UPDATE (OPTC_DATA_FORMAT_CONTROL ,OPTC_DATA_FORMAT , data_fmt); -ASSERT (opp_cnt ==2 ); REG_SET_3(OPTC_DATA_SOURCE_SELECT, 0, OPTC_NUM_OF_INPUT_SEGMENT, 1, OPTC_SEG0_SRC_SEL, opp_id[0],
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 24/459 pinctrl: sh-pfc: r8a77965: Fix DU_DOTCLKIN3 drive/bias control
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit a34cd9dfd03fa9ec380405969f1d638bc63b8d63 ]
R-Car Gen3 Hardware Manual Errata for Rev. 2.00 of October 24, 2019 changed the configuration bits for drive and bias control for the DU_DOTCLKIN3 pin on R-Car M3-N, to match the same pin on R-Car H3. Update the driver to reflect this.
After this, the handling of drive and bias control for the various DU_DOTCLKINx pins is consistent across all of the R-Car H3, M3-W, M3-W+, and M3-N SoCs.
--- drivers/pinctrl/sh-pfc/pfc-r8a77965.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pinctrl/sh-pfc/pfc-r8a77965.c +3 -3
@@ -5984,7 +5984,7 @@ static const struct pinmux_drive_reg pinmux_drive_regs[] = { { PIN_DU_DOTCLKIN1, 0, 2 }, /* DU_DOTCLKIN1 */ } }, { PINMUX_DRIVE_REG("DRVCTRL12", 0xe6060330) { - { PIN_DU_DOTCLKIN3, 28, 2 }, /* DU_DOTCLKIN3 */ + { PIN_DU_DOTCLKIN3, 24, 2 }, /* DU_DOTCLKIN3 */ { PIN_FSCLKST, 20, 2 }, /* FSCLKST */ { PIN_TMS, 4, 2 }, /* TMS */ } },
@@ -6240,8 +6240,8 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = { [31 ] =PIN_DU_DOTCLKIN1 ,/* DU_DOTCLKIN1 */ } }, { PINMUX_BIAS_REG("PUEN3", 0xe606040c, "PUD3", 0xe606044c) { - [ 0] = PIN_DU_DOTCLKIN3, /* DU_DOTCLKIN3 */ - [ 1] = SH_PFC_PIN_NONE, + [ 0] = SH_PFC_PIN_NONE, + [ 1] = PIN_DU_DOTCLKIN3, /* DU_DOTCLKIN3 */ [ 2] = PIN_FSCLKST, /* FSCLKST */ [ 3] = PIN_EXTALR, /* EXTALR*/ [ 4] = PIN_TRST_N, /* TRST# */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 15/459 media: meson: add missing allocation failure check on new_buf
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit 11e0e167d071a28288a7a0a211d48c571d19b56f ]
Currently if the allocation of new_buf fails then a null pointer dereference occurs when assiging new_buf->vb. Avoid this by returning early on a memory allocation failure as there is not much more can be done at this point.
Addresses-Coverity: ("Dereference null return")
--- drivers/staging/media/meson/vdec/vdec.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/media/meson/vdec/vdec.c +2 -0
@@ -133,6 +133,8 @@ vdec_queue_recycle(struct amvdec_session *sess, struct vb2_buffer *vb)struct amvdec_buffer *new_buf; new_buf =kmalloc (sizeof (*new_buf),GFP_KERNEL ); +if (!new_buf) +return ; new_buf->vb = vb;mutex_lock (&sess->bufs_recycle_lock);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 25/459 leds: pca963x: Fix open-drain initialization
In reply to Sasha LevinFrom: Zahari Petkov <[email protected]>
[ Upstream commit 697529091ac7a0a90ca349b914bb30641c13c753 ]
Before commit bb29b9cccd95 ("leds: pca963x: Add bindings to invert polarity") Mode register 2 was initialized directly with either 0x01 or 0x05 for open-drain or totem pole (push-pull) configuration.
Afterwards, MODE2 initialization started using bitwise operations on top of the default MODE2 register value (0x05). Using bitwise OR for setting OUTDRV with 0x01 and 0x05 does not produce correct results. When open-drain is used, instead of setting OUTDRV to 0, the driver keeps it as 1:
Open-drain: 0x05 | 0x01 -> 0x05 (0b101 - incorrect) Totem pole: 0x05 | 0x05 -> 0x05 (0b101 - correct but still wrong)
Now OUTDRV setting uses correct bitwise operations for initialization:
Open-drain: 0x05 & ~0x04 -> 0x01 (0b001 - correct) Totem pole: 0x05 | 0x04 -> 0x05 (0b101 - correct)
Additional MODE2 register definitions are introduced now as well.
--- drivers/leds/leds-pca963x.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/leds/leds-pca963x.c +5 -3
@@ -40,6 +40,8 @@#define PCA963X_LED_PWM 0x2/* Controlled through PWM */ #define PCA963X_LED_GRP_PWM 0x3/* Controlled through PWM/GRPPWM */ +#define PCA963X_MODE2_OUTDRV 0x04/* Open-drain or totem pole */ +#define PCA963X_MODE2_INVRT 0x10/* Normal or inverted direction */ #define PCA963X_MODE2_DMBLNK 0x20/* Enable blinking */ #define PCA963X_MODE1 0x00
@@ -438,12 +440,12 @@ static int pca963x_probe(struct i2c_client *client, PCA963X_MODE2);/* Configure output: open-drain or totem pole (push-pull) */ if (pdata->outdrv ==PCA963X_OPEN_DRAIN ) - mode2 |=0x01 ; + mode2 &= ~PCA963X_MODE2_OUTDRV ;else - mode2 |=0x05 ; + mode2 |=PCA963X_MODE2_OUTDRV ;/* Configure direction: normal or inverted */ if (pdata->dir ==PCA963X_INVERTED ) - mode2 |=0x10 ; + mode2 |=PCA963X_MODE2_INVRT ;i2c_smbus_write_byte_data (pca963x->chip->client,PCA963X_MODE2 , mode2); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 27/459 ALSA: ctl: allow TLV read operation for callback type of element in locked case
In reply to Sasha LevinFrom: Takashi Sakamoto <[email protected]>
[ Upstream commit d61fe22c2ae42d9fd76c34ef4224064cca4b04b0 ]
A design of ALSA control core allows applications to execute three operations for TLV feature; read, write and command. Furthermore, it allows driver developers to process the operations by two ways; allocated array or callback function. In the former, read operation is just allowed, thus developers uses the latter when device driver supports variety of models or the target model is expected to dynamically change information stored in TLV container.
The core also allows applications to lock any element so that the other applications can't perform write operation to the element for element value and TLV information. When the element is locked, write and command operation for TLV information are prohibited as well as element value. Any read operation should be allowed in the case.
At present, when an element has callback function for TLV information, TLV read operation returns EPERM if the element is locked. On the other hand, the read operation is success when an element has allocated array for TLV information. In both cases, read operation is success for element value expectedly.
This commit fixes the bug. This change can be backported to v4.14 kernel or later.
--- sound/core/control.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/core/control.c +3 -2
@@ -1430,8 +1430,9 @@ static int call_tlv_handler(struct snd_ctl_file *file, int op_flag,if (kctl->tlv.c ==NULL )return -ENXIO ; -/* When locked, this is unavailable. */ -if (vd->owner !=NULL && vd->owner != file) +/* Write and command operations are not allowed for locked element. */ +if (op_flag !=SNDRV_CTL_TLV_OP_READ && + vd->owner !=NULL && vd->owner != file)return -EPERM ;return kctl->tlv.c (kctl, op_flag, size, buf);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 30/459 printk: fix exclusive_console replaying
In reply to Sasha LevinFrom: John Ogness <[email protected]>
[ Upstream commit def97da136515cb289a14729292c193e0a93bc64 ]
Commit f92b070f2dc8 ("printk: Do not miss new messages when replaying the log") introduced a new variable @exclusive_console_stop_seq to store when an exclusive console should stop printing. It should be set to the @console_seq value at registration. However, @console_seq is previously set to @syslog_seq so that the exclusive console knows where to begin. This results in the exclusive console immediately reactivating all the other consoles and thus repeating the messages for those consoles.
Set @console_seq after @exclusive_console_stop_seq has stored the current @console_seq value.
--- kernel/printk/printk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/printk/printk.c +2 -2
@@ -2770,8 +2770,6 @@ void register_console(struct console *newcon)* for us. */ logbuf_lock_irqsave (flags); - console_seq = syslog_seq; - console_idx = syslog_idx;/* * We're about to replay the log buffer. Only do this to the * just-registered console to avoid excessive message spam to
@@ -2783,6 +2781,8 @@ void register_console(struct console *newcon)*/ exclusive_console = newcon; exclusive_console_stop_seq = console_seq; + console_seq = syslog_seq; + console_idx = syslog_idx;logbuf_unlock_irqrestore (flags); }console_unlock ();
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 31/459 drm/mipi_dbi: Fix off-by-one bugs in mipi_dbi_blank()
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 2ce18249af5a28031b3f909cfafccc88ea966c9d ]
When configuring the frame memory window, the last column and row numbers are written to the column resp. page address registers. These numbers are thus one less than the actual window width resp. height.
While this is handled correctly in mipi_dbi_fb_dirty() since commit 03ceb1c8dfd1e293 ("drm/tinydrm: Fix setting of the column/page end addresses."), it is not in mipi_dbi_blank(). The latter still forgets to subtract one when calculating the most significant bytes of the column and row numbers, thus programming wrong values when the display width or height is a multiple of 256.
--- drivers/gpu/drm/drm_mipi_dbi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_mipi_dbi.c +2 -2
@@ -367,9 +367,9 @@ static void mipi_dbi_blank(struct mipi_dbi_dev *dbidev)memset (dbidev->tx_buf,0 , len);mipi_dbi_command (dbi,MIPI_DCS_SET_COLUMN_ADDRESS ,0 ,0 , - (width >>8 ) &0xFF , (width -1 ) &0xFF ); + ((width -1 ) >>8 ) &0xFF , (width -1 ) &0xFF );mipi_dbi_command (dbi,MIPI_DCS_SET_PAGE_ADDRESS ,0 ,0 , - (height >>8 ) &0xFF , (height -1 ) &0xFF ); + ((height -1 ) >>8 ) &0xFF , (height -1 ) &0xFF );mipi_dbi_command_buf (dbi,MIPI_DCS_WRITE_MEMORY_START , (u8 *)dbidev->tx_buf, len);
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 32/459 drm/msm/adreno: fix zap vs no-zap handling
In reply to Sasha LevinFrom: Rob Clark <[email protected]>
[ Upstream commit 15ab987c423df561e0949d77fb5043921ae59956 ]
We can have two cases, when it comes to "zap" fw. Either the fw requires zap fw to take the GPU out of secure mode at boot, or it does not and we can write RBBM_SECVID_TRUST_CNTL directly. Previously we decided based on whether zap fw load succeeded, but this is not a great plan because:
1) we could have zap fw in the filesystem on a device where it is not required
2) we could have the inverse case
Instead, shift to deciding based on whether we have a 'zap-shader' node in dt. In practice, there is only one device (currently) with upstream dt that does not use zap (cheza), and it already has a /delete-node/ for the zap-shader node.
--- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 11 +++++++++-- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +9 -2
@@ -726,11 +726,18 @@ static int a5xx_hw_init(struct msm_gpu *gpu) gpu->funcs->flush (gpu, gpu->rb[0 ]);if (!a5xx_idle (gpu, gpu->rb[0 ]))return -EINVAL ; - }else { -/* Print a warning so if we die, we know why */ + }else if (ret == -ENODEV ) { +/* +* This device does not use zap shader (but print a warning +* just in case someone got their dt wrong.. hopefully they +* have a debug UART to realize the error of their ways... +* if you mess this up you are about to crash horribly) +*/ dev_warn_once (gpu->dev->dev,"Zap shader not enabled - using SECVID_TRUST_CNTL instead\n" );gpu_write (gpu,REG_A5XX_RBBM_SECVID_TRUST_CNTL ,0x0 ); + }else { +return ret; }/* Last step - yield the ringbuffer */
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +9 -2
@@ -537,12 +537,19 @@ static int a6xx_hw_init(struct msm_gpu *gpu)a6xx_flush (gpu, gpu->rb[0 ]);if (!a6xx_idle (gpu, gpu->rb[0 ]))return -EINVAL ; - }else { -/* Print a warning so if we die, we know why */ + }else if (ret == -ENODEV ) { +/* +* This device does not use zap shader (but print a warning +* just in case someone got their dt wrong.. hopefully they +* have a debug UART to realize the error of their ways... +* if you mess this up you are about to crash horribly) +*/ dev_warn_once (gpu->dev->dev,"Zap shader not enabled - using SECVID_TRUST_CNTL instead\n" );gpu_write (gpu,REG_A6XX_RBBM_SECVID_TRUST_CNTL ,0x0 ); ret =0 ; + }else { +return ret; } out:
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 34/459 RDMA/i40iw: fix a potential NULL pointer dereference
In reply to Sasha LevinFrom: Xiyu Yang <[email protected]>
[ Upstream commit 04db1580b5e48a79e24aa51ecae0cd4b2296ec23 ]
A NULL pointer can be returned by in_dev_get(). Thus add a corresponding check so that a NULL pointer dereference will be avoided at this place.
--- drivers/infiniband/hw/i40iw/i40iw_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/i40iw/i40iw_main.c +2 -0
@@ -1225,6 +1225,8 @@ static void i40iw_add_ipv4_addr(struct i40iw_device *iwdev)const struct in_ifaddr *ifa; idev =in_dev_get (dev); +if (!idev) +continue ;in_dev_for_each_ifa_rtnl (ifa, idev) { i40iw_debug(&iwdev->sc_dev, I40IW_DEBUG_CM, "IP=%pI4, vlan_id=%d, MAC=%pM\n", &ifa->ifa_address,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 35/459 media: ov5640: Fix check for PLL1 exceeding max allowed rate
In reply to Sasha LevinFrom: Adam Ford <[email protected]>
[ Upstream commit 2e3df204f9af42a47823ee955c08950373417420 ]
The variable _rate is by ov5640_compute_sys_clk() which returns zero if the PLL exceeds 1GHz. Unfortunately, the check to see if the max PLL1 output is checking 'rate' and not '_rate' and 'rate' does not ever appear to be 0.
This patch changes the check against the returned value of '_rate' to determine if the PLL1 output exceeds 1GHz.
--- drivers/media/i2c/ov5640.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov5640.c +1 -1
@@ -874,7 +874,7 @@ static unsigned long ov5640_calc_sys_clk(struct ov5640_dev *sensor,* We have reached the maximum allowed PLL1 output, * increase sysdiv. */ -if (!rate) +if (!_rate)break ;/*
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 36/459 media: i2c: mt9v032: fix enum mbus codes and frame sizes
In reply to Sasha LevinFrom: Eugen Hristev <[email protected]>
[ Upstream commit 1451d5ae351d938a0ab1677498c893f17b9ee21d ]
This driver supports both the mt9v032 (color) and the mt9v022 (mono) sensors. Depending on which sensor is used, the format from the sensor is different. The format.code inside the dev struct holds this information. The enum mbus and enum frame sizes need to take into account both type of sensors, not just the color one. To solve this, use the format.code in these functions instead of the hardcoded bayer color format (which is only used for mt9v032).
[Sakari Ailus: rewrapped commit message]
--- drivers/media/i2c/mt9v032.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/media/i2c/mt9v032.c +8 -2
@@ -428,10 +428,12 @@ static int mt9v032_enum_mbus_code(struct v4l2_subdev *subdev,struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_mbus_code_enum *code) { + struct mt9v032 *mt9v032 = to_mt9v032(subdev); +if (code->index >0 )return -EINVAL ; - code->code =MEDIA_BUS_FMT_SGRBG10_1X10 ; + code->code = mt9v032->format.code;return 0 ; }
@@ -439,7 +441,11 @@ static int mt9v032_enum_frame_size(struct v4l2_subdev *subdev,struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_frame_size_enum *fse) { -if (fse->index >=3 || fse->code !=MEDIA_BUS_FMT_SGRBG10_1X10 ) + struct mt9v032 *mt9v032 = to_mt9v032(subdev); + +if (fse->index >=3 ) +return -EINVAL ; +if (mt9v032->format.code != fse->code)return -EINVAL ; fse->min_width =MT9V032_WINDOW_WIDTH_DEF / (1 << fse->index);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 28/459 gianfar: Fix TX timestamping with a stacked DSA driver
In reply to Sasha LevinFrom: Vladimir Oltean <[email protected]>
[ Upstream commit c26a2c2ddc0115eb088873f5c309cf46b982f522 ]
The driver wrongly assumes that it is the only entity that can set the SKBTX_IN_PROGRESS bit of the current skb. Therefore, in the gfar_clean_tx_ring function, where the TX timestamp is collected if necessary, the aforementioned bit is used to discriminate whether or not the TX timestamp should be delivered to the socket's error queue.
But a stacked driver such as a DSA switch can also set the SKBTX_IN_PROGRESS bit, which is actually exactly what it should do in order to denote that the hardware timestamping process is undergoing.
Therefore, gianfar would misinterpret the "in progress" bit as being its own, and deliver a second skb clone in the socket's error queue, completely throwing off a PTP process which is not expecting to receive it, _even though_ TX timestamping is not enabled for gianfar.
There have been discussions [0] as to whether non-MAC drivers need or not to set SKBTX_IN_PROGRESS at all (whose purpose is to avoid sending 2 timestamps, a sw and a hw one, to applications which only expect one). But as of this patch, there are at least 2 PTP drivers that would break in conjunction with gianfar: the sja1105 DSA switch and the felix switch, by way of its ocelot core driver.
So regardless of that conclusion, fix the gianfar driver to not do stuff based on flags set by others and not intended for it.
[0]: https://www.spinics.net/lists/netdev/msg619699.html
--- drivers/net/ethernet/freescale/gianfar.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/freescale/gianfar.c +7 -3
@@ -2204,13 +2204,17 @@ static void gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue) skb_dirtytx = tx_queue->skb_dirtytx;while ((skb = tx_queue->tx_skbuff[skb_dirtytx])) { +bool do_tstamp; + + do_tstamp = (skb_shinfo (skb)->tx_flags &SKBTX_HW_TSTAMP ) && + priv->hwts_tx_en; frags =skb_shinfo (skb)->nr_frags;/* When time stamping, one additional TxBD must be freed. * Also, we need to dma_unmap_single() the TxPAL. */ -if (unlikely (skb_shinfo (skb)->tx_flags &SKBTX_IN_PROGRESS )) +if (unlikely (do_tstamp)) nr_txbds = frags +2 ;else nr_txbds = frags +1 ;
@@ -2224,7 +2228,7 @@ static void gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue) (lstatus & BD_LENGTH_MASK))break ; -if (unlikely (skb_shinfo (skb)->tx_flags &SKBTX_IN_PROGRESS )) { +if (unlikely (do_tstamp)) { next =next_txbd (bdp, base, tx_ring_size); buflen =be16_to_cpu (next->length) +GMAC_FCB_LEN +GMAC_TXPAL_LEN ;
@@ -2234,7 +2238,7 @@ static void gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)dma_unmap_single (priv->dev,be32_to_cpu (bdp->bufPtr), buflen,DMA_TO_DEVICE ); -if (unlikely (skb_shinfo (skb)->tx_flags &SKBTX_IN_PROGRESS )) { +if (unlikely (do_tstamp)) {struct skb_shared_hwtstamps shhwtstamps;u64 *ns = (u64 *)(((uintptr_t )skb->data +0x10 ) & ~0x7UL );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 45/459 iommu/vt-d: Fix off-by-one in PASID allocation
In reply to Sasha LevinFrom: Jacob Pan <[email protected]>
[ Upstream commit 39d630e332144028f56abba83d94291978e72df1 ]
PASID allocator uses IDR which is exclusive for the end of the allocation range. There is no need to decrement pasid_max.
--- drivers/iommu/intel-svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel-svm.c +1 -1
@@ -317,7 +317,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_/* Do not use PASID 0 in caching mode (virtualised IOMMU) */ ret =intel_pasid_alloc_id (svm, !!cap_caching_mode (iommu->cap), - pasid_max -1 ,GFP_KERNEL ); + pasid_max,GFP_KERNEL );if (ret <0 ) {kfree (svm);kfree (sdev);
Signature · 6 lines
2.20.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 50/459 arm64: dts: marvell: clearfog-gt-8k: fix switch cpu port node
In reply to Sasha LevinFrom: Baruch Siach <[email protected]>
[ Upstream commit 62bba54d99407aedfe9b0a02e72e23c06e2b0116 ]
Explicitly set the switch cpu (upstream) port phy-mode and managed properties. This fixes the Marvell 88E6141 switch serdes configuration with the recently enabled phylink layer.
--- arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts +2 -0
@@ -408,6 +408,8 @@ reg = <5>; label = "cpu"; ethernet = <&cp1_eth2>; + phy-mode = "2500base-x"; + managed = "in-band-status"; }; };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 37/459 media: sun4i-csi: Deal with DRAM offset
In reply to Sasha LevinFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 249b286171fa9c358e8d5c825b48c4ebea97c498 ]
On Allwinner SoCs, some high memory bandwidth devices do DMA directly over the memory bus (called MBUS), instead of the system bus. These devices include the CSI camera sensor interface, video (codec) engine, display subsystem, etc.. The memory bus has a different addressing scheme without the DRAM starting offset.
Deal with this using the "interconnects" property from the device tree, or if that is not available, set dev->dma_pfn_offset to PHYS_PFN_OFFSET.
--- .../platform/sunxi/sun4i-csi/sun4i_csi.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c +22 -0
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/mutex.h> #include <linux/of.h> +#include <linux/of_device.h> #include <linux/of_graph.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h>
@@ -155,6 +156,27 @@ static int sun4i_csi_probe(struct platform_device *pdev) subdev = &csi->subdev; vdev = &csi->vdev; +/* +* On Allwinner SoCs, some high memory bandwidth devices do DMA +* directly over the memory bus (called MBUS), instead of the +* system bus. The memory bus has a different addressing scheme +* without the DRAM starting offset. +* +* In some cases this can be described by an interconnect in +* the device tree. In other cases where the hardware is not +* fully understood and the interconnect is left out of the +* device tree, fall back to a default offset. +*/ +if (of_find_property (csi->dev->of_node,"interconnects" ,NULL )) { + ret =of_dma_configure (csi->dev, csi->dev->of_node, true); +if (ret) +return ret; + }else { +#ifdef PHYS_PFN_OFFSET + csi->dev->dma_pfn_offset =PHYS_PFN_OFFSET ; +#endif + } + csi->mdev.dev = csi->dev;strscpy (csi->mdev.model,"Allwinner Video Capture Device" ,sizeof (csi->mdev.model));
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 39/459 RDMA/netlink: Do not always generate an ACK for some netlink operations
In reply to Sasha LevinFrom: Håkon Bugge <[email protected]>
[ Upstream commit a242c36951ecd24bc16086940dbe6b522205c461 ]
In rdma_nl_rcv_skb(), the local variable err is assigned the return value of the supplied callback function, which could be one of ib_nl_handle_resolve_resp(), ib_nl_handle_set_timeout(), or ib_nl_handle_ip_res_resp(). These three functions all return skb->len on success.
rdma_nl_rcv_skb() is merely a copy of netlink_rcv_skb(). The callback functions used by the latter have the convention: "Returns 0 on success or a negative error code".
In particular, the statement (equal for both functions):
if (nlh->nlmsg_flags & NLM_F_ACK || err)
implies that rdma_nl_rcv_skb() always will ack a message, independent of the NLM_F_ACK being set in nlmsg_flags or not.
The fix could be to change the above statement, but it is better to keep the two *_rcv_skb() functions equal in this respect and instead change the three callback functions in the rdma subsystem to the correct convention.
--- drivers/infiniband/core/addr.c | 2 +- drivers/infiniband/core/sa_query.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/core/addr.c +1 -1
@@ -139,7 +139,7 @@ int ib_nl_handle_ip_res_resp(struct sk_buff *skb,if (ib_nl_is_good_ip_resp (nlh))ib_nl_process_good_ip_rsep (nlh); -return skb->len; +return 0 ; } static int ib_nl_ip_send_msg(struct rdma_dev_addr *dev_addr,
drivers/infiniband/core/sa_query.c +2 -2
@@ -1068,7 +1068,7 @@ int ib_nl_handle_set_timeout(struct sk_buff *skb, } settimeout_out: -return skb->len; +return 0 ; }static inline int ib_nl_is_good_resolve_resp (const struct nlmsghdr *nlh)
@@ -1139,7 +1139,7 @@ int ib_nl_handle_resolve_resp(struct sk_buff *skb, } resp_out: -return skb->len; +return 0 ; }static void free_sm_ah (struct kref *kref)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 42/459 powerpc/powernv/iov: Ensure the pdn for VFs always contains a valid PE number
In reply to Sasha LevinFrom: Oliver O'Halloran <[email protected]>
[ Upstream commit 3b5b9997b331e77ce967eba2c4bc80dc3134a7fe ]
On pseries there is a bug with adding hotplugged devices to an IOMMU group. For a number of dumb reasons fixing that bug first requires re-working how VFs are configured on PowerNV. For background, on PowerNV we use the pcibios_sriov_enable() hook to do two things:
1. Create a pci_dn structure for each of the VFs, and
2. Configure the PHB's internal BARs so the MMIO range for each VF maps to a unique PE.
Roughly speaking a PE is the hardware counterpart to a Linux IOMMU group since all the devices in a PE share the same IOMMU table. A PE also defines the set of devices that should be isolated in response to a PCI error (i.e. bad DMA, UR/CA, AER events, etc). When isolated all MMIO and DMA traffic to and from devicein the PE is blocked by the root complex until the PE is recovered by the OS.
The requirement to block MMIO causes a giant headache because the P8 PHB generally uses a fixed mapping between MMIO addresses and PEs. As a result we need to delay configuring the IOMMU groups for device until after MMIO resources are assigned. For physical devices (i.e. non-VFs) the PE assignment is done in pcibios_setup_bridge() which is called immediately after the MMIO resources for downstream devices (and the bridge's windows) are assigned. For VFs the setup is more complicated because:
a) pcibios_setup_bridge() is not called again when VFs are activated, and
b) The pci_dev for VFs are created by generic code which runs after pcibios_sriov_enable() is called.
The work around for this is a two step process:
1. A fixup in pcibios_add_device() is used to initialised the cached pe_number in pci_dn, then
2. A bus notifier then adds the device to the IOMMU group for the PE
specified in pci_dn->pe_number.
A side effect fixing the pseries bug mentioned in the first paragraph is moving the fixup out of pcibios_add_device() and into pcibios_bus_add_device(), which is called much later. This results in step 2. failing because pci_dn->pe_number won't be initialised when the bus notifier is run.
We can fix this by removing the need for the fixup. The PE for a VF is known before the VF is even scanned so we can initialise pci_dn->pe_number pcibios_sriov_enable() instead. Unfortunately, moving the initialisation causes two problems:
1. We trip the WARN_ON() in the current fixup code, and
2. The EEH core clears pdn->pe_number when recovering a VF and relies on the fixup to correctly re-set it.
The only justification for either of these is a comment in eeh_rmv_device() suggesting that pdn->pe_number *must* be set to IODA_INVALID_PE in order for the VF to be scanned. However, this comment appears to have no basis in reality. Both bugs can be fixed by just deleting the code.
--- arch/powerpc/kernel/eeh_driver.c | 6 ------ arch/powerpc/platforms/powernv/pci-ioda.c | 19 +++++++++++++++---- arch/powerpc/platforms/powernv/pci.c | 4 ---- 3 files changed, 15 insertions(+), 14 deletions(-)
arch/powerpc/kernel/eeh_driver.c +0 -6
@@ -541,12 +541,6 @@ static void eeh_rmv_device(struct eeh_dev *edev, void *userdata)pci_iov_remove_virtfn (edev->physfn, pdn->vf_index); edev->pdev =NULL ; - -/* -* We have to set the VF PE number to invalid one, which is -* required to plug the VF successfully. -*/ - pdn->pe_number =IODA_INVALID_PE ;#endif if (rmv_data)list_add (&edev->rmv_entry, &rmv_data->removed_vf_list);
arch/powerpc/platforms/powernv/pci-ioda.c +15 -4
@@ -1558,6 +1558,10 @@ static void pnv_ioda_setup_vf_PE(struct pci_dev *pdev, u16 num_vfs)/* Reserve PE for each VF */ for (vf_index =0 ; vf_index < num_vfs; vf_index++) { +int vf_devfn =pci_iov_virtfn_devfn (pdev, vf_index); +int vf_bus =pci_iov_virtfn_bus (pdev, vf_index); +struct pci_dn *vf_pdn; +if (pdn->m64_single_mode) pe_num = pdn->pe_num_map[vf_index];else
@@ -1570,13 +1574,11 @@ static void pnv_ioda_setup_vf_PE(struct pci_dev *pdev, u16 num_vfs) pe->pbus =NULL ; pe->parent_dev = pdev; pe->mve_number =-1 ; - pe->rid = (pci_iov_virtfn_bus (pdev, vf_index) <<8 ) | -pci_iov_virtfn_devfn (pdev, vf_index); + pe->rid = (vf_bus <<8 ) | vf_devfn;pe_info (pe,"VF %04d:%02d:%02d.%d associated with PE#%x\n" , hose->global_number, pdev->bus->number, -PCI_SLOT (pci_iov_virtfn_devfn (pdev, vf_index)), -PCI_FUNC (pci_iov_virtfn_devfn (pdev, vf_index)), pe_num); +PCI_SLOT (vf_devfn),PCI_FUNC (vf_devfn), pe_num);if (pnv_ioda_configure_pe (phb, pe)) {/* XXX What do we do here ? */
@@ -1590,6 +1592,15 @@ static void pnv_ioda_setup_vf_PE(struct pci_dev *pdev, u16 num_vfs)list_add_tail (&pe->list, &phb->ioda.pe_list);mutex_unlock (&phb->ioda.pe_list_mutex); +/* associate this pe to it's pdn */ +list_for_each_entry (vf_pdn, &pdn->parent->child_list, list) { +if (vf_pdn->busno == vf_bus && + vf_pdn->devfn == vf_devfn) { + vf_pdn->pe_number = pe_num; +break ; + } + } +pnv_pci_ioda2_setup_dma_pe (phb, pe);#ifdef CONFIG_IOMMU_API iommu_register_group(&pe->table_group,
arch/powerpc/platforms/powernv/pci.c +0 -4
@@ -816,16 +816,12 @@ void pnv_pci_dma_dev_setup(struct pci_dev *pdev)struct pnv_phb *phb = hose->private_data;#ifdef CONFIG_PCI_IOV struct pnv_ioda_pe *pe; -struct pci_dn *pdn;/* Fix the VF pdn PE number */ if (pdev->is_virtfn) { - pdn =pci_get_pdn (pdev); -WARN_ON (pdn->pe_number !=IODA_INVALID_PE );list_for_each_entry (pe, &phb->ioda.pe_list, list) {if (pe->rid == ((pdev->bus->number <<8 ) | (pdev->devfn &0xff ))) { - pdn->pe_number = pe->pe_number; pe->pdev = pdev;break ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 56/459 MIPS: Loongson: Fix potential NULL dereference in loongson3_platform_init()
In reply to Sasha LevinFrom: Tiezhu Yang <[email protected]>
[ Upstream commit 72d052e28d1d2363f9107be63ef3a3afdea6143c ]
If kzalloc fails, it should return -ENOMEM, otherwise may trigger a NULL pointer dereference.
--- arch/mips/loongson64/loongson-3/platform.c | 3 +++ 1 file changed, 3 insertions(+)
arch/mips/loongson64/loongson-3/platform.c +3 -0
@@ -27,6 +27,9 @@ static int __init loongson3_platform_init(void)continue ; pdev =kzalloc (sizeof (struct platform_device ),GFP_KERNEL ); +if (!pdev) +return -ENOMEM ; + pdev->name = loongson_sysconf.sensors[i].name; pdev->id = loongson_sysconf.sensors[i].id; pdev->dev.platform_data = &loongson_sysconf.sensors[i];
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 43/459 clk: meson: meson8b: make the CCF use the glitch-free mali mux
In reply to Sasha LevinFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 8daeaea99caabe24a0929fac17977ebfb882fa86 ]
The "mali_0" or "mali_1" clock trees should not be updated while the clock is running. Enforce this by setting CLK_SET_RATE_GATE on the "mali_0" and "mali_1" gates. This makes the CCF switch to the "mali_1" tree when "mali_0" is currently active and vice versa, which is exactly what the vendor driver does when updating the frequency of the mali clock.
This fixes a potential hang when changing the GPU frequency at runtime.
--- drivers/clk/meson/meson8b.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/clk/meson/meson8b.c +7 -4
@@ -1764,8 +1764,11 @@ static struct clk_regmap meson8b_hdmi_sys = {/* * The MALI IP is clocked by two identical clocks (mali_0 and mali_1) -* muxed by a glitch-free switch on Meson8b and Meson8m2. Meson8 only -* has mali_0 and no glitch-free mux. +* muxed by a glitch-free switch on Meson8b and Meson8m2. The CCF can +* actually manage this glitch-free mux because it does top-to-bottom +* updates the each clock tree and switches to the "inactive" one when +* CLK_SET_RATE_GATE is set. +* Meson8 only has mali_0 and no glitch-free mux. */ static const struct clk_hw *meson8b_mali_0_1_parent_hws[] = { &meson8b_xtal.hw,
@@ -1830,7 +1833,7 @@ static struct clk_regmap meson8b_mali_0 = { &meson8b_mali_0_div.hw }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT, }, };
@@ -1885,7 +1888,7 @@ static struct clk_regmap meson8b_mali_1 = { &meson8b_mali_1_div.hw }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT, }, };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 61/459 drm/amdgpu/sriov: workaround on rev_id for Navi12 under sriov
In reply to Sasha LevinFrom: Tiecheng Zhou <[email protected]>
[ Upstream commit df5e984c8bd414561c320d6cbbb66d53abf4c7e2 ]
guest vm gets 0xffffffff when reading RCC_DEV0_EPF0_STRAP0, as a consequence, the rev_id and external_rev_id are wrong.
workaround it by hardcoding the rev_id to 0, which is the default value.
v2. add comment in the code
--- drivers/gpu/drm/amd/amdgpu/nv.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/nv.c +6 -0
@@ -660,6 +660,12 @@ static int nv_common_early_init(void *handle) adev->pg_flags =AMD_PG_SUPPORT_VCN |AMD_PG_SUPPORT_VCN_DPG |AMD_PG_SUPPORT_ATHUB ; +/* guest vm gets 0xffffffff when reading RCC_DEV0_EPF0_STRAP0, +* as a consequence, the rev_id and external_rev_id are wrong. +* workaround it by hardcoding rev_id to 0 (default value). +*/ +if (amdgpu_sriov_vf (adev)) + adev->rev_id =0 ; adev->external_rev_id = adev->rev_id +0xa ;break ;default :
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 47/459 char/random: silence a lockdep splat with printk()
In reply to Sasha LevinFrom: Sergey Senozhatsky <[email protected]>
[ Upstream commit 1b710b1b10eff9d46666064ea25f079f70bc67a8 ]
Sergey didn't like the locking order,
uart_port->lock -> tty_port->lock
uart_write (uart_port->lock)
__uart_start
pl011_start_tx
pl011_tx_chars
uart_write_wakeup
tty_port_tty_wakeup
tty_port_default
tty_port_tty_get (tty_port->lock)but those code is so old, and I have no clue how to de-couple it after checking other locks in the splat. There is an onging effort to make all printk() as deferred, so until that happens, workaround it for now as a short-term fix.
LTP: starting iogen01 (export LTPROOT; rwtest -N iogen01 -i 120s -s read,write -Da -Dv -n 2 500b:$TMPDIR/doio.f1.$$ 1000b:$TMPDIR/doio.f2.$$)
WARNING: possible circular locking dependency detected
------------------------------------------------------
doio/49441 is trying to acquire lock:ffff008b7cff7290 (&(&zone->lock)->rlock){..-.}, at: rmqueue+0x138/0x2050
but task is already holding lock:60ff000822352818 (&pool->lock/1){-.-.}, at: start_flush_work+0xd8/0x3f0
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #4 (&pool->lock/1){-.-.}:
lock_acquire+0x320/0x360
_raw_spin_lock+0x64/0x80
__queue_work+0x4b4/0xa10
queue_work_on+0xac/0x11c
tty_schedule_flip+0x84/0xbc
tty_flip_buffer_push+0x1c/0x28
pty_write+0x98/0xd0
n_tty_write+0x450/0x60c
tty_write+0x338/0x474
__vfs_write+0x88/0x214
vfs_write+0x12c/0x1a4
redirected_tty_write+0x90/0xdc
do_loop_readv_writev+0x140/0x180
do_iter_write+0xe0/0x10c
vfs_writev+0x134/0x1cc
do_writev+0xbc/0x130
__arm64_sys_writev+0x58/0x8c
el0_svc_handler+0x170/0x240
el0_sync_handler+0x150/0x250
el0_sync+0x164/0x180-> #3 (&(&port->lock)->rlock){-.-.}:
lock_acquire+0x320/0x360
_raw_spin_lock_irqsave+0x7c/0x9c
tty_port_tty_get+0x24/0x60
tty_port_default_wakeup+0x1c/0x3c
tty_port_tty_wakeup+0x34/0x40
uart_write_wakeup+0x28/0x44
pl011_tx_chars+0x1b8/0x270
pl011_start_tx+0x24/0x70
__uart_start+0x5c/0x68
uart_write+0x164/0x1c8
do_output_char+0x33c/0x348
n_tty_write+0x4bc/0x60c
tty_write+0x338/0x474
redirected_tty_write+0xc0/0xdc
do_loop_readv_writev+0x140/0x180
do_iter_write+0xe0/0x10c
vfs_writev+0x134/0x1cc
do_writev+0xbc/0x130
__arm64_sys_writev+0x58/0x8c
el0_svc_handler+0x170/0x240
el0_sync_handler+0x150/0x250
el0_sync+0x164/0x180-> #2 (&port_lock_key){-.-.}:
lock_acquire+0x320/0x360
_raw_spin_lock+0x64/0x80
pl011_console_write+0xec/0x2cc
console_unlock+0x794/0x96c
vprintk_emit+0x260/0x31c
vprintk_default+0x54/0x7c
vprintk_func+0x218/0x254
printk+0x7c/0xa4
register_console+0x734/0x7b0
uart_add_one_port+0x734/0x834
pl011_register_port+0x6c/0xac
sbsa_uart_probe+0x234/0x2ec
platform_drv_probe+0xd4/0x124
really_probe+0x250/0x71c
driver_probe_device+0xb4/0x200
__device_attach_driver+0xd8/0x188
bus_for_each_drv+0xbc/0x110
__device_attach+0x120/0x220
device_initial_probe+0x20/0x2c
bus_probe_device+0x54/0x100
device_add+0xae8/0xc2c
platform_device_add+0x278/0x3b8
platform_device_register_full+0x238/0x2ac
acpi_create_platform_device+0x2dc/0x3a8
acpi_bus_attach+0x390/0x3cc
acpi_bus_attach+0x108/0x3cc
acpi_bus_attach+0x108/0x3cc
acpi_bus_attach+0x108/0x3cc
acpi_bus_scan+0x7c/0xb0
acpi_scan_init+0xe4/0x304
acpi_init+0x100/0x114
do_one_initcall+0x348/0x6a0
do_initcall_level+0x190/0x1fc
do_basic_setup+0x34/0x4c
kernel_init_freeable+0x19c/0x260
kernel_init+0x18/0x338
ret_from_fork+0x10/0x18-> #1 (console_owner){-...}:
lock_acquire+0x320/0x360
console_lock_spinning_enable+0x6c/0x7c
console_unlock+0x4f8/0x96c
vprintk_emit+0x260/0x31c
vprintk_default+0x54/0x7c
vprintk_func+0x218/0x254
printk+0x7c/0xa4
get_random_u64+0x1c4/0x1dc
shuffle_pick_tail+0x40/0xac
__free_one_page+0x424/0x710
free_one_page+0x70/0x120
__free_pages_ok+0x61c/0xa94
__free_pages_core+0x1bc/0x294
memblock_free_pages+0x38/0x48
__free_pages_memory+0xcc/0xfc
__free_memory_core+0x70/0x78
free_low_memory_core_early+0x148/0x18c
memblock_free_all+0x18/0x54
mem_init+0xb4/0x17c
mm_init+0x14/0x38
start_kernel+0x19c/0x530-> #0 (&(&zone->lock)->rlock){..-.}:
validate_chain+0xf6c/0x2e2c
__lock_acquire+0x868/0xc2c
lock_acquire+0x320/0x360
_raw_spin_lock+0x64/0x80
rmqueue+0x138/0x2050
get_page_from_freelist+0x474/0x688
__alloc_pages_nodemask+0x3b4/0x18dc
alloc_pages_current+0xd0/0xe0
alloc_slab_page+0x2b4/0x5e0
new_slab+0xc8/0x6bc
___slab_alloc+0x3b8/0x640
kmem_cache_alloc+0x4b4/0x588
__debug_object_init+0x778/0x8b4
debug_object_init_on_stack+0x40/0x50
start_flush_work+0x16c/0x3f0
__flush_work+0xb8/0x124
flush_work+0x20/0x30
xlog_cil_force_lsn+0x88/0x204 [xfs]
xfs_log_force_lsn+0x128/0x1b8 [xfs]
xfs_file_fsync+0x3c4/0x488 [xfs]
vfs_fsync_range+0xb0/0xd0
generic_write_sync+0x80/0xa0 [xfs]
xfs_file_buffered_aio_write+0x66c/0x6e4 [xfs]
xfs_file_write_iter+0x1a0/0x218 [xfs]
__vfs_write+0x1cc/0x214
vfs_write+0x12c/0x1a4
ksys_write+0xb0/0x120
__arm64_sys_write+0x54/0x88
el0_svc_handler+0x170/0x240
el0_sync_handler+0x150/0x250
el0_sync+0x164/0x180other info that might help us debug this:
Chain exists of: &(&zone->lock)->rlock --> &(&port->lock)->rlock --> &pool->lock/1 Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&pool->lock/1);
lock(&(&port->lock)->rlock);
lock(&pool->lock/1);lock(&(&zone->lock)->rlock);
*** DEADLOCK ***
4 locks held by doio/49441:
#0: a0ff00886fc27408 (sb_writers#8){.+.+}, at: vfs_write+0x118/0x1a4 #1: 8fff00080810dfe0 (&xfs_nondir_ilock_class){++++}, at:
xfs_ilock+0x2a8/0x300 [xfs]
#2: ffff9000129f2390 (rcu_read_lock){....}, at:
rcu_lock_acquire+0x8/0x38
#3: 60ff000822352818 (&pool->lock/1){-.-.}, at:
start_flush_work+0xd8/0x3f0
stack backtrace:
CPU: 48 PID: 49441 Comm: doio Tainted: G W
Hardware name: HPE Apollo 70 /C01_APACHE_MB , BIOS
L50_5.13_1.11 06/18/2019
Call trace:
dump_backtrace+0x0/0x248
show_stack+0x20/0x2c
dump_stack+0xe8/0x150
print_circular_bug+0x368/0x380
check_noncircular+0x28c/0x294
validate_chain+0xf6c/0x2e2c
__lock_acquire+0x868/0xc2c
lock_acquire+0x320/0x360
_raw_spin_lock+0x64/0x80
rmqueue+0x138/0x2050
get_page_from_freelist+0x474/0x688
__alloc_pages_nodemask+0x3b4/0x18dc
alloc_pages_current+0xd0/0xe0
alloc_slab_page+0x2b4/0x5e0
new_slab+0xc8/0x6bc
___slab_alloc+0x3b8/0x640
kmem_cache_alloc+0x4b4/0x588
__debug_object_init+0x778/0x8b4
debug_object_init_on_stack+0x40/0x50
start_flush_work+0x16c/0x3f0
__flush_work+0xb8/0x124
flush_work+0x20/0x30
xlog_cil_force_lsn+0x88/0x204 [xfs]
xfs_log_force_lsn+0x128/0x1b8 [xfs]
xfs_file_fsync+0x3c4/0x488 [xfs]
vfs_fsync_range+0xb0/0xd0
generic_write_sync+0x80/0xa0 [xfs]
xfs_file_buffered_aio_write+0x66c/0x6e4 [xfs]
xfs_file_write_iter+0x1a0/0x218 [xfs]
__vfs_write+0x1cc/0x214
vfs_write+0x12c/0x1a4
ksys_write+0xb0/0x120
__arm64_sys_write+0x54/0x88
el0_svc_handler+0x170/0x240
el0_sync_handler+0x150/0x250
el0_sync+0x164/0x180--- drivers/char/random.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/char/random.c +3 -2
@@ -1687,8 +1687,9 @@ static void _warn_unseeded_randomness(const char *func_name, void *caller, print_once = true;#endif if (__ratelimit (&unseeded_warning)) -pr_notice ("random: %s called from %pS with crng_init=%d\n" , - func_name, caller, crng_init); +printk_deferred (KERN_NOTICE "random: %s called from %pS " +"with crng_init=%d\n" , func_name, caller, + crng_init); }/*
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 51/459 PCI/switchtec: Fix vep_vector_number ioread width
In reply to Sasha LevinFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit 9375646b4cf03aee81bc6c305aa18cc80b682796 ]
vep_vector_number is actually a 16 bit register which should be read with ioread16() instead of ioread32().
--- drivers/pci/switch/switchtec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/switch/switchtec.c +1 -1
@@ -1276,7 +1276,7 @@ static int switchtec_init_isr(struct switchtec_dev *stdev)if (nvecs <0 )return nvecs; - event_irq =ioread32 (&stdev->mmio_part_cfg->vep_vector_number); + event_irq =ioread16 (&stdev->mmio_part_cfg->vep_vector_number);if (event_irq <0 || event_irq >= nvecs)return -EFAULT ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 52/459 IB/core: Let IB core distribute cache update events
In reply to Sasha LevinFrom: Parav Pandit <[email protected]>
[ Upstream commit 6b57cea9221b0247ad5111b348522625e489a8e4 ]
Currently when the low level driver notifies Pkey, GID, and port change events they are notified to the registered handlers in the order they are registered.
IB core and other ULPs such as IPoIB are interested in GID, LID, Pkey change events.
Since all GID queries done by ULPs are serviced by IB core, and the IB core deferes cache updates to a work queue, it is possible for other clients to see stale cache data when they handle their own events.
For example, the below call tree shows how ipoib will call rdma_query_gid() concurrently with the update to the cache sitting in the WQ.
mlx5_ib_handle_event()
ib_dispatch_event()
ib_cache_event()
queue_work() -> slow cache update
[..]
ipoib_event()
queue_work()
[..]
work handler
ipoib_ib_dev_flush_light()
__ipoib_ib_dev_flush()
ipoib_dev_addr_changed_valid()
rdma_query_gid() <- Returns old GID, cache not updated.Move all the event dispatch to a work queue so that the cache update is always done before any clients are notified.
--- drivers/infiniband/core/cache.c | 121 +++++++++++++++++----------- drivers/infiniband/core/core_priv.h | 1 + drivers/infiniband/core/device.c | 33 +++----- include/rdma/ib_verbs.h | 9 ++- 4 files changed, 92 insertions(+), 72 deletions(-)
drivers/infiniband/core/cache.c +75 -46
@@ -51,9 +51,8 @@ struct ib_pkey_cache {struct ib_update_work {struct work_struct work; -struct ib_device *device; -u8 port_num; -bool enforce_security; +struct ib_event event; +bool enforce_security; };union ib_gid zgid;
@@ -130,7 +129,7 @@ static void dispatch_gid_change_event(struct ib_device *ib_dev, u8 port) event.element.port_num = port; event.event =IB_EVENT_GID_CHANGE ; -ib_dispatch_event (&event); +ib_dispatch_event_clients (&event); }static const char *const gid_type_str[] = {
@@ -1387,9 +1386,8 @@ static int config_non_roce_gid_cache(struct ib_device *device,return ret; } -static void ib_cache_update (struct ib_device *device, -u8 port, -bool enforce_security) +static int +ib_cache_update (struct ib_device *device,u8 port,bool enforce_security) {struct ib_port_attr *tprops =NULL ;struct ib_pkey_cache *pkey_cache =NULL , *old_pkey_cache;
@@ -1397,11 +1395,11 @@ static void ib_cache_update(struct ib_device *device,int ret;if (!rdma_is_port_valid (device, port)) -return ; +return -EINVAL ; tprops =kmalloc (sizeof *tprops,GFP_KERNEL );if (!tprops) -return ; +return -ENOMEM ; ret =ib_query_port (device, port, tprops);if (ret) {
@@ -1419,8 +1417,10 @@ static void ib_cache_update(struct ib_device *device, pkey_cache =kmalloc (struct_size (pkey_cache, table, tprops->pkey_tbl_len),GFP_KERNEL ); -if (!pkey_cache) +if (!pkey_cache) { + ret = -ENOMEM ; goto err; + } pkey_cache->table_len = tprops->pkey_tbl_len;
@@ -1452,50 +1452,84 @@ static void ib_cache_update(struct ib_device *device,kfree (old_pkey_cache);kfree (tprops); -return ; +return 0 ; err:kfree (pkey_cache);kfree (tprops); +return ret; +} + +static void ib_cache_event_task (struct work_struct *_work) +{ +struct ib_update_work *work = + container_of(_work, struct ib_update_work, work); +int ret; + +/* Before distributing the cache update event, first sync +* the cache. +*/ + ret =ib_cache_update (work->event.device, work->event.element.port_num, + work->enforce_security); + +/* GID event is notified already for individual GID entries by +* dispatch_gid_change_event(). Hence, notifiy for rest of the +* events. +*/ +if (!ret && work->event.event !=IB_EVENT_GID_CHANGE ) +ib_dispatch_event_clients (&work->event); + +kfree (work); } -static void ib_cache_task (struct work_struct *_work) +static void ib_generic_event_task (struct work_struct *_work) {struct ib_update_work *work = container_of(_work, struct ib_update_work, work); -ib_cache_update (work->device, - work->port_num, - work->enforce_security); +ib_dispatch_event_clients (&work->event);kfree (work); } -static void ib_cache_event (struct ib_event_handler *handler, -struct ib_event *event) +static bool is_cache_update_event (const struct ib_event *event) +{ +return (event->event ==IB_EVENT_PORT_ERR || + event->event ==IB_EVENT_PORT_ACTIVE || + event->event ==IB_EVENT_LID_CHANGE || + event->event ==IB_EVENT_PKEY_CHANGE || + event->event ==IB_EVENT_CLIENT_REREGISTER || + event->event ==IB_EVENT_GID_CHANGE ); +} + +/** +* ib_dispatch_event - Dispatch an asynchronous event +* @event:Event to dispatch +* +* Low-level drivers must call ib_dispatch_event() to dispatch the +* event to all registered event handlers when an asynchronous event +* occurs. +*/ +void ib_dispatch_event (const struct ib_event *event) {struct ib_update_work *work; -if (event->event ==IB_EVENT_PORT_ERR || - event->event ==IB_EVENT_PORT_ACTIVE || - event->event ==IB_EVENT_LID_CHANGE || - event->event ==IB_EVENT_PKEY_CHANGE || - event->event ==IB_EVENT_CLIENT_REREGISTER || - event->event ==IB_EVENT_GID_CHANGE ) { - work =kmalloc (sizeof *work,GFP_ATOMIC ); -if (work) { -INIT_WORK (&work->work, ib_cache_task); - work->device = event->device; - work->port_num = event->element.port_num; -if (event->event ==IB_EVENT_PKEY_CHANGE || - event->event ==IB_EVENT_GID_CHANGE ) - work->enforce_security = true; -else - work->enforce_security = false; - -queue_work (ib_wq, &work->work); - } - } + work =kzalloc (sizeof (*work),GFP_ATOMIC ); +if (!work) +return ; + +if (is_cache_update_event (event)) +INIT_WORK (&work->work, ib_cache_event_task); +else +INIT_WORK (&work->work, ib_generic_event_task); + + work->event = *event; +if (event->event ==IB_EVENT_PKEY_CHANGE || + event->event ==IB_EVENT_GID_CHANGE ) + work->enforce_security = true; + +queue_work (ib_wq, &work->work); } +EXPORT_SYMBOL (ib_dispatch_event);int ib_cache_setup_one (struct ib_device *device) {
@@ -1511,9 +1545,6 @@ int ib_cache_setup_one(struct ib_device *device) rdma_for_each_port (device, p)ib_cache_update (device, p, true); -INIT_IB_EVENT_HANDLER (&device->cache.event_handler, - device, ib_cache_event); -ib_register_event_handler (&device->cache.event_handler);return 0 ; }
@@ -1535,14 +1566,12 @@ void ib_cache_release_one(struct ib_device *device)void ib_cache_cleanup_one (struct ib_device *device) { -/* The cleanup function unregisters the event handler, -* waits for all in-progress workqueue elements and cleans -* up the GID cache. This function should be called after -* the device was removed from the devices list and all -* clients were removed, so the cache exists but is +/* The cleanup function waits for all in-progress workqueue +* elements and cleans up the GID cache. This function should be +* called after the device was removed from the devices list and +* all clients were removed, so the cache exists but is * non-functional and shouldn't be updated anymore. */ -ib_unregister_event_handler (&device->cache.event_handler);flush_workqueue (ib_wq);gid_table_cleanup_one (device);
drivers/infiniband/core/core_priv.h +1 -0
@@ -149,6 +149,7 @@ unsigned long roce_gid_type_mask_support(struct ib_device *ib_dev, u8 port);int ib_cache_setup_one (struct ib_device *device);void ib_cache_cleanup_one (struct ib_device *device);void ib_cache_release_one (struct ib_device *device); +void ib_dispatch_event_clients (struct ib_event *event);#ifdef CONFIG_CGROUP_RDMA void ib_device_register_rdmacg (struct ib_device *device);
drivers/infiniband/core/device.c +10 -23
@@ -591,6 +591,7 @@ struct ib_device *_ib_alloc_device(size_t size)INIT_LIST_HEAD (&device->event_handler_list);spin_lock_init (&device->event_handler_lock); +init_rwsem (&device->event_handler_rwsem);mutex_init (&device->unregistration_lock);/* * client_data needs to be alloc because we don't want our mark to be
@@ -1932,17 +1933,15 @@ EXPORT_SYMBOL(ib_set_client_data);* * ib_register_event_handler() registers an event handler that will be * called back when asynchronous IB events occur (as defined in -* chapter 11 of the InfiniBand Architecture Specification). This -* callback may occur in interrupt context. +* chapter 11 of the InfiniBand Architecture Specification). This +* callback occurs in workqueue context. */ void ib_register_event_handler (struct ib_event_handler *event_handler) { -unsigned long flags; - -spin_lock_irqsave (&event_handler->device->event_handler_lock, flags); +down_write (&event_handler->device->event_handler_rwsem);list_add_tail (&event_handler->list, &event_handler->device->event_handler_list); -spin_unlock_irqrestore (&event_handler->device->event_handler_lock, flags); +up_write (&event_handler->device->event_handler_rwsem); }EXPORT_SYMBOL (ib_register_event_handler);
@@ -1955,35 +1954,23 @@ EXPORT_SYMBOL(ib_register_event_handler);*/ void ib_unregister_event_handler (struct ib_event_handler *event_handler) { -unsigned long flags; - -spin_lock_irqsave (&event_handler->device->event_handler_lock, flags); +down_write (&event_handler->device->event_handler_rwsem);list_del (&event_handler->list); -spin_unlock_irqrestore (&event_handler->device->event_handler_lock, flags); +up_write (&event_handler->device->event_handler_rwsem); }EXPORT_SYMBOL (ib_unregister_event_handler); -/** -* ib_dispatch_event - Dispatch an asynchronous event -* @event:Event to dispatch -* -* Low-level drivers must call ib_dispatch_event() to dispatch the -* event to all registered event handlers when an asynchronous event -* occurs. -*/ -void ib_dispatch_event (struct ib_event *event) +void ib_dispatch_event_clients (struct ib_event *event) { -unsigned long flags;struct ib_event_handler *handler; -spin_lock_irqsave (&event->device->event_handler_lock, flags); +down_read (&event->device->event_handler_rwsem);list_for_each_entry (handler, &event->device->event_handler_list, list) handler->handler (handler, event); -spin_unlock_irqrestore (&event->device->event_handler_lock, flags); +up_read (&event->device->event_handler_rwsem); } -EXPORT_SYMBOL (ib_dispatch_event); static int iw_query_port(struct ib_device *device, u8 port_num,
include/rdma/ib_verbs.h +6 -3
@@ -2146,7 +2146,6 @@ struct ib_port_cache {struct ib_cache {rwlock_t lock; -struct ib_event_handler event_handler; };struct ib_port_immutable {
@@ -2590,7 +2589,11 @@ struct ib_device {struct rcu_head rcu_head;struct list_head event_handler_list; -spinlock_t event_handler_lock; +/* Protects event_handler_list */ +struct rw_semaphore event_handler_rwsem; + +/* Protects QP's event_handler calls and open_qp list */ +spinlock_t event_handler_lock;struct rw_semaphore client_data_rwsem;struct xarray client_data;
@@ -2897,7 +2900,7 @@ bool ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state,void ib_register_event_handler (struct ib_event_handler *event_handler);void ib_unregister_event_handler (struct ib_event_handler *event_handler); -void ib_dispatch_event (struct ib_event *event); +void ib_dispatch_event (const struct ib_event *event);int ib_query_port (struct ib_device *device,u8 port_num,struct ib_port_attr *port_attr);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 70/459 drm/amd/display: Clear state after exiting fixed active VRR state
In reply to Sasha LevinFrom: Amanda Liu <[email protected]>
[ Upstream commit 6f8f76444baf405bacb0591d97549a71a9aaa1ac ]
[why]
Upon exiting a fixed active VRR state, the state isn't cleared. This leads to the variable VRR range to be calculated incorrectly.
[how]
Set fixed active state to false when updating vrr params
--- drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +2 -0
@@ -803,6 +803,7 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync, 2 * in_out_vrr->min_refresh_in_uhz) in_out_vrr->btr.btr_enabled = false; + in_out_vrr->fixed.fixed_active = false; in_out_vrr->btr.btr_active = false; in_out_vrr->btr.inserted_duration_in_us =0 ; in_out_vrr->btr.frames_to_insert =0 ;
@@ -822,6 +823,7 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync, in_out_vrr->adjust.v_total_max = stream->timing.v_total; }else if (in_out_vrr->state ==VRR_STATE_ACTIVE_VARIABLE && refresh_range >=MIN_REFRESH_RANGE_IN_US ) { + in_out_vrr->adjust.v_total_min =calc_v_total_from_refresh (stream, in_out_vrr->max_refresh_in_uhz);
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 71/459 kselftest: Minimise dependency of get_size on C library interfaces
In reply to Sasha LevinFrom: Siddhesh Poyarekar <[email protected]>
[ Upstream commit 6b64a650f0b2ae3940698f401732988699eecf7a ]
It was observed[1] on arm64 that __builtin_strlen led to an infinite loop in the get_size selftest. This is because __builtin_strlen (and other builtins) may sometimes result in a call to the C library function. The C library implementation of strlen uses an IFUNC resolver to load the most efficient strlen implementation for the underlying machine and hence has a PLT indirection even for static binaries. Because this binary avoids the C library startup routines, the PLT initialization never happens and hence the program gets stuck in an infinite loop.
On x86_64 the __builtin_strlen just happens to expand inline and avoid the call but that is not always guaranteed.
Further, while testing on x86_64 (Fedora 31), it was observed that the test also failed with a segfault inside write() because the generated code for the write function in glibc seems to access TLS before the syscall (probably due to the cancellation point check) and fails because TLS is not initialised.
To mitigate these problems, this patch reduces the interface with the C library to just the syscall function. The syscall function still sets errno on failure, which is undesirable but for now it only affects cases where syscalls fail.
[1] https://bugs.linaro.org/show_bug.cgi?id=5479
--- tools/testing/selftests/size/get_size.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
tools/testing/selftests/size/get_size.c +18 -6
@@ -11,23 +11,35 @@* own execution. It also attempts to have as few dependencies * on kernel features as possible. * -* It should be statically linked, with startup libs avoided. -* It uses no library calls, and only the following 3 syscalls: +* It should be statically linked, with startup libs avoided. It uses +* no library calls except the syscall() function for the following 3 +* syscalls: * sysinfo(), write(), and _exit() * * For output, it avoids printf (which in some C libraries * has large external dependencies) by implementing it's own * number output and print routines, and using __builtin_strlen() +* +* The test may crash if any of the above syscalls fails because in some +* libc implementations (e.g. the GNU C Library) errno is saved in +* thread-local storage, which does not get initialized due to avoiding +* startup libs. */ #include <sys/sysinfo.h> #include <unistd.h> +#include <sys/syscall.h> #define STDOUT_FILENO 1static int const char *s) { -return write (STDOUT_FILENO , s,__builtin_strlen (s)); +size_t len =0 ; + +while (s[len] !='\0' ) + len++; + +return syscall (SYS_write,STDOUT_FILENO , s, len); }static inline char *num_to_str (unsigned long num,char *buf,int len)
@@ -79,12 +91,12 @@ void _start(void)"TAP version 13\n" );"# Testing system size.\n" ); - ccode =sysinfo (&info); + ccode =syscall (SYS_sysinfo, &info);if (ccode <0 ) {"not ok 1" );" ---\n reason: \"could not get sysinfo\"\n ...\n" ); -_exit (ccode); +syscall (SYS_exit, ccode); }"ok 1" );
@@ -100,5 +112,5 @@ void _start(void)" ...\n" );"1..1\n" ); -_exit (0 ); +syscall (SYS_exit,0 ); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 60/459 uio: fix a sleep-in-atomic-context bug in uio_dmem_genirq_irqcontrol()
In reply to Sasha LevinFrom: Jia-Ju Bai <[email protected]>
[ Upstream commit b74351287d4bd90636c3f48bc188c2f53824c2d4 ]
The driver may sleep while holding a spinlock.
The function call path (from bottom to top) in Linux 4.19 is:
kernel/irq/manage.c, 523:
synchronize_irq in disable_irqdrivers/uio/uio_dmem_genirq.c, 140:
disable_irq in uio_dmem_genirq_irqcontroldrivers/uio/uio_dmem_genirq.c, 134:
_raw_spin_lock_irqsave in uio_dmem_genirq_irqcontrol
synchronize_irq() can sleep at runtime.
To fix this bug, disable_irq() is called without holding the spinlock.
This bug is found by a static analysis tool STCheck written by myself.
--- drivers/uio/uio_dmem_genirq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/uio/uio_dmem_genirq.c +4 -2
@@ -132,11 +132,13 @@ static int uio_dmem_genirq_irqcontrol(struct uio_info *dev_info, s32 irq_on)if (irq_on) {if (test_and_clear_bit (0 , &priv->flags))enable_irq (dev_info->irq); +spin_unlock_irqrestore (&priv->lock, flags); }else { -if (!test_and_set_bit (0 , &priv->flags)) +if (!test_and_set_bit (0 , &priv->flags)) { +spin_unlock_irqrestore (&priv->lock, flags);disable_irq (dev_info->irq); + } } -spin_unlock_irqrestore (&priv->lock, flags);return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 74/459 ext4: fix deadlock allocating bio_post_read_ctx from mempool
In reply to Sasha LevinFrom: Eric Biggers <[email protected]>
[ Upstream commit 68e45330e341dad2d3a0a3f8ef2ec46a2a0a3bbc ]
Without any form of coordination, any case where multiple allocations from the same mempool are needed at a time to make forward progress can deadlock under memory pressure.
This is the case for struct bio_post_read_ctx, as one can be allocated to decrypt a Merkle tree page during fsverity_verify_bio(), which itself is running from a post-read callback for a data bio which has its own struct bio_post_read_ctx.
Fix this by freeing the first bio_post_read_ctx before calling fsverity_verify_bio(). This works because verity (if enabled) is always the last post-read step.
This deadlock can be reproduced by trying to read from an encrypted verity file after reducing NUM_PREALLOC_POST_READ_CTXS to 1 and patching mempool_alloc() to pretend that pool->alloc() always fails.
Note that since NUM_PREALLOC_POST_READ_CTXS is actually 128, to actually hit this bug in practice would require reading from lots of encrypted verity files at the same time. But it's theoretically possible, as N available objects isn't enough to guarantee forward progress when > N/2 threads each need 2 objects at a time.
--- fs/ext4/readpage.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
fs/ext4/readpage.c +15 -2
@@ -57,6 +57,7 @@ enum bio_post_read_step {STEP_INITIAL =0 ,STEP_DECRYPT ,STEP_VERITY , + STEP_MAX, }; struct bio_post_read_ctx {
@@ -106,10 +107,22 @@ static void verity_work(struct work_struct *work) {struct bio_post_read_ctx *ctx = container_of(work, struct bio_post_read_ctx, work); +struct bio *bio = ctx->bio; -fsverity_verify_bio (ctx->bio); +/* +* fsverity_verify_bio() may call readpages() again, and although verity +* will be disabled for that, decryption may still be needed, causing +* another bio_post_read_ctx to be allocated. So to guarantee that +* mempool_alloc() never deadlocks we must free the current ctx first. +* This is safe because verity is the last post-read step. +*/ +BUILD_BUG_ON (STEP_VERITY +1 !=STEP_MAX ); +mempool_free (ctx, bio_post_read_ctx_pool); + bio->bi_private =NULL ; -bio_post_read_processing (ctx); +fsverity_verify_bio (bio); + +__read_end_io (bio); }static void bio_post_read_processing (struct bio_post_read_ctx *ctx)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 75/459 clk: ti: dra7: fix parent for gmac_clkctrl
In reply to Sasha LevinFrom: Grygorii Strashko <[email protected]>
[ Upstream commit 69e300283796dae7e8c2e6acdabcd31336c0c93e ]
The parent clk for gmac clk ctrl has to be gmac_main_clk (125MHz) instead of dpll_gmac_ck (1GHz). This is caused incorrect CPSW MDIO operation. Hence, fix it.
--- drivers/clk/ti/clk-7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/ti/clk-7xx.c +1 -1
@@ -405,7 +405,7 @@ static const struct omap_clkctrl_bit_data dra7_gmac_bit_data[] __initconst = { };static const struct omap_clkctrl_reg_data dra7_gmac_clkctrl_regs[]__initconst = { - {DRA7_GMAC_GMAC_CLKCTRL , dra7_gmac_bit_data,CLKF_SW_SUP ,"dpll_gmac_ck" }, + {DRA7_GMAC_GMAC_CLKCTRL , dra7_gmac_bit_data,CLKF_SW_SUP ,"gmac_main_clk" }, {0 }, };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 76/459 x86/sysfb: Fix check for bad VRAM size
In reply to Sasha LevinFrom: Arvind Sankar <[email protected]>
[ Upstream commit dacc9092336be20b01642afe1a51720b31f60369 ]
When checking whether the reported lfb_size makes sense, the height
* stride result is page-aligned before seeing whether it exceeds the reported size.
This doesn't work if height * stride is not an exact number of pages. For example, as reported in the kernel bugzilla below, an 800x600x32 EFI framebuffer gets skipped because of this.
Move the PAGE_ALIGN to after the check vs size.
--- arch/x86/kernel/sysfb_simplefb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/sysfb_simplefb.c +1 -1
@@ -90,11 +90,11 @@ __init int create_simplefb(const struct screen_info *si,if (si->orig_video_isVGA ==VIDEO_TYPE_VLFB ) size <<=16 ; length = mode->height * mode->stride; - length =PAGE_ALIGN (length);if (length > size) {printk (KERN_WARNING "sysfb: VRAM smaller than advertised\n" );return -EINVAL ; } + length =PAGE_ALIGN (length);/* setup IORESOURCE_MEM as framebuffer memory */ memset (&res,0 ,sizeof (res));
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 82/459 s390/pci: Fix possible deadlock in recover_store()
In reply to Sasha LevinFrom: Niklas Schnelle <[email protected]>
[ Upstream commit 576c75e36c689bec6a940e807bae27291ab0c0de ]
With zpci_disable() working, lockdep detected a potential deadlock (lockdep output at the end).
The deadlock is between recovering a PCI function via the
/sys/bus/pci/devices/<dev>/recover
attribute vs powering it off via
/sys/bus/pci/slots/<slot>/power.
The fix is analogous to the changes in commit 0ee223b2e1f6 ("scsi: core:
Avoid that SCSI device removal through sysfs triggers a deadlock") that fixed a potential deadlock on removing a SCSI device via sysfs.
[ 204.830107] ======================================================
[ 204.830109] WARNING: possible circular locking dependency detected
[ 204.830111] 5.5.0-rc2-06072-gbc03ecc9a672 #6 Tainted: G W
[ 204.830112] ------------------------------------------------------
[ 204.830113] bash/1034 is trying to acquire lock:
[ 204.830115] 0000000192a1a610 (kn->count#200){++++}, at: kernfs_remove_by_name_ns+0x5c/0xa8
[ 204.830122]
but task is already holding lock:
[ 204.830123] 00000000c16134a8 (pci_rescan_remove_lock){+.+.}, at: pci_stop_and_remove_bus_device_locked+0x26/0x48
[ 204.830128]
which lock already depends on the new lock.[ 204.830129]
the existing dependency chain (in reverse order) is:
[ 204.830130]
-> #1 (pci_rescan_remove_lock){+.+.}:
[ 204.830134] validate_chain+0x93a/0xd08
[ 204.830136] __lock_acquire+0x4ae/0x9d0
[ 204.830137] lock_acquire+0x114/0x280
[ 204.830140] __mutex_lock+0xa2/0x960
[ 204.830142] mutex_lock_nested+0x32/0x40
[ 204.830145] recover_store+0x4c/0xa8
[ 204.830147] kernfs_fop_write+0xe6/0x218
[ 204.830151] vfs_write+0xb0/0x1b8
[ 204.830152] ksys_write+0x6c/0xf8
[ 204.830154] system_call+0xd8/0x2d8
[ 204.830155]
-> #0 (kn->count#200){++++}:
[ 204.830187] check_noncircular+0x1e6/0x240
[ 204.830189] check_prev_add+0xfc/0xdb0
[ 204.830190] validate_chain+0x93a/0xd08
[ 204.830192] __lock_acquire+0x4ae/0x9d0
[ 204.830193] lock_acquire+0x114/0x280
[ 204.830194] __kernfs_remove.part.0+0x2e4/0x360
[ 204.830196] kernfs_remove_by_name_ns+0x5c/0xa8
[ 204.830198] remove_files.isra.0+0x4c/0x98
[ 204.830199] sysfs_remove_group+0x66/0xc8
[ 204.830201] sysfs_remove_groups+0x46/0x68
[ 204.830204] device_remove_attrs+0x52/0x90
[ 204.830207] device_del+0x182/0x418
[ 204.830208] pci_remove_bus_device+0x8a/0x130
[ 204.830210] pci_stop_and_remove_bus_device_locked+0x3a/0x48
[ 204.830212] disable_slot+0x68/0x100
[ 204.830213] power_write_file+0x7c/0x130
[ 204.830215] kernfs_fop_write+0xe6/0x218
[ 204.830217] vfs_write+0xb0/0x1b8
[ 204.830218] ksys_write+0x6c/0xf8
[ 204.830220] system_call+0xd8/0x2d8
[ 204.830221]
other info that might help us debug this:[ 204.830223] Possible unsafe locking scenario:
[ 204.830224] CPU0 CPU1
[ 204.830225] ---- ----
[ 204.830226] lock(pci_rescan_remove_lock);
[ 204.830227] lock(kn->count#200);
[ 204.830229] lock(pci_rescan_remove_lock);
[ 204.830231] lock(kn->count#200);
[ 204.830233]
*** DEADLOCK ***[ 204.830234] 4 locks held by bash/1034:
[ 204.830235] #0: 00000001b6fbc498 (sb_writers#4){.+.+}, at: vfs_write+0x158/0x1b8
[ 204.830239] #1: 000000018c9f5090 (&of->mutex){+.+.}, at: kernfs_fop_write+0xaa/0x218
[ 204.830242] #2: 00000001f7da0810 (kn->count#235){.+.+}, at: kernfs_fop_write+0xb6/0x218
[ 204.830245] #3: 00000000c16134a8 (pci_rescan_remove_lock){+.+.}, at: pci_stop_and_remove_bus_device_locked+0x26/0x48
[ 204.830248]
stack backtrace:
[ 204.830250] CPU: 2 PID: 1034 Comm: bash Tainted: G W 5.5.0-rc2-06072-gbc03ecc9a672 #6
[ 204.830252] Hardware name: IBM 8561 T01 703 (LPAR)
[ 204.830253] Call Trace:
[ 204.830257] [<00000000c05e10c0>] show_stack+0x88/0xf0
[ 204.830260] [<00000000c112dca4>] dump_stack+0xa4/0xe0
[ 204.830261] [<00000000c0694c06>] check_noncircular+0x1e6/0x240
[ 204.830263] [<00000000c0695bec>] check_prev_add+0xfc/0xdb0
[ 204.830264] [<00000000c06971da>] validate_chain+0x93a/0xd08
[ 204.830266] [<00000000c06994c6>] __lock_acquire+0x4ae/0x9d0
[ 204.830267] [<00000000c069867c>] lock_acquire+0x114/0x280
[ 204.830269] [<00000000c09ca15c>] __kernfs_remove.part.0+0x2e4/0x360
[ 204.830270] [<00000000c09cb5c4>] kernfs_remove_by_name_ns+0x5c/0xa8
[ 204.830272] [<00000000c09cee14>] remove_files.isra.0+0x4c/0x98
[ 204.830274] [<00000000c09cf2ae>] sysfs_remove_group+0x66/0xc8
[ 204.830276] [<00000000c09cf356>] sysfs_remove_groups+0x46/0x68
[ 204.830278] [<00000000c0e3dfe2>] device_remove_attrs+0x52/0x90
[ 204.830280] [<00000000c0e40382>] device_del+0x182/0x418
[ 204.830281] [<00000000c0dcfd7a>] pci_remove_bus_device+0x8a/0x130
[ 204.830283] [<00000000c0dcfe92>] pci_stop_and_remove_bus_device_locked+0x3a/0x48
[ 204.830285] [<00000000c0de7190>] disable_slot+0x68/0x100
[ 204.830286] [<00000000c0de6514>] power_write_file+0x7c/0x130
[ 204.830288] [<00000000c09cc846>] kernfs_fop_write+0xe6/0x218
[ 204.830290] [<00000000c08f3480>] vfs_write+0xb0/0x1b8
[ 204.830291] [<00000000c08f378c>] ksys_write+0x6c/0xf8
[ 204.830293] [<00000000c1154374>] system_call+0xd8/0x2d8
[ 204.830294] INFO: lockdep is turned off.--- arch/s390/pci/pci_sysfs.c | 63 ++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 21 deletions(-)
arch/s390/pci/pci_sysfs.c +42 -21
@@ -13,6 +13,8 @@#include <linux/stat.h> #include <linux/pci.h> +#include "../../../drivers/pci/pci.h" +#include <asm/sclp.h> #define zpci_attr (name, fmt, member) \
@@ -49,31 +51,50 @@ static DEVICE_ATTR_RO(mio_enabled);static ssize_t recover_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) { +struct kernfs_node *kn;struct pci_dev *pdev =to_pci_dev (dev);struct zpci_dev *zdev =to_zpci (pdev); -int ret; - -if (!device_remove_file_self (dev, attr)) -return count; - +int ret =0 ; + +/* Can't use device_remove_self() here as that would lead us to lock +* the pci_rescan_remove_lock while holding the device' kernfs lock. +* This would create a possible deadlock with disable_slot() which is +* not directly protected by the device' kernfs lock but takes it +* during the device removal which happens under +* pci_rescan_remove_lock. +* +* This is analogous to sdev_store_delete() in +* drivers/scsi/scsi_sysfs.c +*/ + kn =sysfs_break_active_protection (&dev->kobj, &attr->attr); +WARN_ON_ONCE (!kn); +/* device_remove_file() serializes concurrent calls ignoring all but +* the first +*/ +device_remove_file (dev, attr); + +/* A concurrent call to recover_store() may slip between +* sysfs_break_active_protection() and the sysfs file removal. +* Once it unblocks from pci_lock_rescan_remove() the original pdev +* will already be removed. +*/ pci_lock_rescan_remove (); -pci_stop_and_remove_bus_device (pdev); - ret =zpci_disable_device (zdev); -if (ret) - goto error; - - ret =zpci_enable_device (zdev); -if (ret) - goto error; - -pci_rescan_bus (zdev->bus); +if (pci_dev_is_added (pdev)) { +pci_stop_and_remove_bus_device (pdev); + ret =zpci_disable_device (zdev); +if (ret) + goto out; + + ret =zpci_enable_device (zdev); +if (ret) + goto out; +pci_rescan_bus (zdev->bus); + } +out:pci_unlock_rescan_remove (); - -return count; - -error: -pci_unlock_rescan_remove (); -return ret; +if (kn) +sysfs_unbreak_active_protection (kn); +return ret ? ret : count; }static DEVICE_ATTR_WO (recover);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 84/459 powerpc/iov: Move VF pdev fixup into pcibios_fixup_iov()
In reply to Sasha LevinFrom: Oliver O'Halloran <[email protected]>
[ Upstream commit 965c94f309be58fbcc6c8d3e4f123376c5970d79 ]
An ioda_pe for each VF is allocated in pnv_pci_sriov_enable() before the pci_dev for the VF is created. We need to set the pe->pdev pointer at some point after the pci_dev is created. Currently we do that in:
pcibios_bus_add_device()
pnv_pci_dma_dev_setup() (via phb->ops.dma_dev_setup) /* fixup is done here */ pnv_pci_ioda_dma_dev_setup() (via pnv_phb->dma_dev_setup)
The fixup needs to be done before setting up DMA for for the VF's PE, but there's no real reason to delay it until this point. Move the fixup into pnv_pci_ioda_fixup_iov() so the ordering is:
pcibios_add_device() pnv_pci_ioda_fixup_iov() (via ppc_md.pcibios_fixup_sriov) pcibios_bus_add_device() ...
This isn't strictly required, but it's a slightly more logical place to do the fixup and it simplifies pnv_pci_dma_dev_setup().
--- arch/powerpc/platforms/powernv/pci-ioda.c | 29 +++++++++++++++++++---- arch/powerpc/platforms/powernv/pci.c | 14 ----------- 2 files changed, 25 insertions(+), 18 deletions(-)
arch/powerpc/platforms/powernv/pci-ioda.c +25 -4
@@ -2905,9 +2905,6 @@ static void pnv_pci_ioda_fixup_iov_resources(struct pci_dev *pdev)struct pci_dn *pdn;int mul, total_vfs; -if (!pdev->is_physfn ||pci_dev_is_added (pdev)) -return ; - pdn =pci_get_pdn (pdev); pdn->vfs_expanded =0 ; pdn->m64_single_mode = false;
@@ -2982,6 +2979,30 @@ static void pnv_pci_ioda_fixup_iov_resources(struct pci_dev *pdev) res->end = res->start - 1; } } + +static void pnv_pci_ioda_fixup_iov (struct pci_dev *pdev) +{ +if (WARN_ON (pci_dev_is_added (pdev))) +return ; + +if (pdev->is_virtfn) { +struct pnv_ioda_pe *pe =pnv_ioda_get_pe (pdev); + +/* +* VF PEs are single-device PEs so their pdev pointer needs to +* be set. The pdev doesn't exist when the PE is allocated (in +* (pcibios_sriov_enable()) so we fix it up here. +*/ + pe->pdev = pdev; +WARN_ON (!(pe->flags &PNV_IODA_PE_VF )); + }else if (pdev->is_physfn) { +/* +* For PFs adjust their allocated IOV resources to match what +* the PHB can support using it's M64 BAR table. +*/ +pnv_pci_ioda_fixup_iov_resources (pdev); + } +}#endif /* CONFIG_PCI_IOV */ static void pnv_ioda_setup_pe_res(struct pnv_ioda_pe *pe,
@@ -3878,7 +3899,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, ppc_md.pcibios_default_alignment = pnv_pci_default_alignment;#ifdef CONFIG_PCI_IOV - ppc_md.pcibios_fixup_sriov = pnv_pci_ioda_fixup_iov_resources; + ppc_md.pcibios_fixup_sriov = pnv_pci_ioda_fixup_iov; ppc_md.pcibios_iov_resource_alignment = pnv_pci_iov_resource_alignment; ppc_md.pcibios_sriov_enable = pnv_pcibios_sriov_enable; ppc_md.pcibios_sriov_disable = pnv_pcibios_sriov_disable;
arch/powerpc/platforms/powernv/pci.c +0 -14
@@ -814,20 +814,6 @@ void pnv_pci_dma_dev_setup(struct pci_dev *pdev) {struct pci_controller *hose =pci_bus_to_host (pdev->bus);struct pnv_phb *phb = hose->private_data; -#ifdef CONFIG_PCI_IOV -struct pnv_ioda_pe *pe; - -/* Fix the VF pdn PE number */ -if (pdev->is_virtfn) { -list_for_each_entry (pe, &phb->ioda.pe_list, list) { -if (pe->rid == ((pdev->bus->number <<8 ) | - (pdev->devfn &0xff ))) { - pe->pdev = pdev; -break ; - } - } - } -#endif /* CONFIG_PCI_IOV */ if (phb && phb->dma_dev_setup) phb->dma_dev_setup (phb, pdev);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 79/459 scsi: ufs: Fix ufshcd_probe_hba() reture value in case ufshcd_scsi_add_wlus() fails
In reply to Sasha LevinFrom: Bean Huo <[email protected]>
[ Upstream commit b9fc5320212efdfb4e08b825aaa007815fd11d16 ]
A non-zero error value likely being returned by ufshcd_scsi_add_wlus() in case of failure of adding the WLs, but ufshcd_probe_hba() doesn't use this value, and doesn't report this failure to upper caller. This patch is to fix this issue.
--- drivers/scsi/ufs/ufshcd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +2 -1
@@ -6953,7 +6953,8 @@ static int ufshcd_probe_hba(struct ufs_hba *hba)ufshcd_init_icc_levels (hba);/* Add required well known logical units to scsi mid layer */ -if (ufshcd_scsi_add_wlus (hba)) + ret =ufshcd_scsi_add_wlus (hba); +if (ret) goto out;/* Initialize devfreq after UFS device is detected */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 87/459 tracing: Fix very unlikely race of registering two stat tracers
In reply to Sasha LevinFrom: "Steven Rostedt (VMware)" <[email protected]>
[ Upstream commit dfb6cd1e654315168e36d947471bd2a0ccd834ae ]
Looking through old emails in my INBOX, I came across a patch from Luis Henriques that attempted to fix a race of two stat tracers registering the same stat trace (extremely unlikely, as this is done in the kernel, and probably doesn't even exist). The submitted patch wasn't quite right as it needed to deal with clean up a bit better (if two stat tracers were the same, it would have the same files).
But to make the code cleaner, all we needed to do is to keep the all_stat_sessions_mutex held for most of the registering function.
--- kernel/trace/trace_stat.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
kernel/trace/trace_stat.c +9 -10
@@ -310,7 +310,7 @@ static int init_stat_file(struct stat_session *session)int register_stat_tracer (struct tracer_stat *trace) {struct stat_session *session, *node; -int ret; +int ret = -EINVAL ;if (!trace)return -EINVAL ;
@@ -321,17 +321,15 @@ int register_stat_tracer(struct tracer_stat *trace)/* Already registered? */ mutex_lock (&all_stat_sessions_mutex);list_for_each_entry (node, &all_stat_sessions, session_list) { -if (node->ts == trace) { -mutex_unlock (&all_stat_sessions_mutex); -return -EINVAL ; - } +if (node->ts == trace) + goto out; } -mutex_unlock (&all_stat_sessions_mutex); + ret = -ENOMEM ;/* Init the session */ session =kzalloc (sizeof (*session),GFP_KERNEL );if (!session) -return -ENOMEM ; + goto out; session->ts = trace;INIT_LIST_HEAD (&session->session_list);
@@ -340,15 +338,16 @@ int register_stat_tracer(struct tracer_stat *trace) ret =init_stat_file (session);if (ret) {destroy_session (session); -return ret; + goto out; } + ret =0 ;/* Register */ -mutex_lock (&all_stat_sessions_mutex);list_add_tail (&session->session_list, &all_stat_sessions); + out:mutex_unlock (&all_stat_sessions_mutex); -return 0 ; +return ret; }void unregister_stat_tracer (struct tracer_stat *trace)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 90/459 ARM: 8952/1: Disable kmemleak on XIP kernels
In reply to Sasha LevinFrom: Vincenzo Frascino <[email protected]>
[ Upstream commit bc420c6ceefbb86cbbc8c00061bd779c17fa6997 ]
Kmemleak relies on specific symbols to register the read only data during init (e.g. __start_ro_after_init).
Trying to build an XIP kernel on arm results in the linking error reported below because when this option is selected read only data after init are not allowed since .data is read only (.rodata).
arm-linux-gnueabihf-ld: mm/kmemleak.o: in function `kmemleak_init':
kmemleak.c:(.init.text+0x148): undefined reference to `__end_ro_after_init'
arm-linux-gnueabihf-ld: kmemleak.c:(.init.text+0x14c):
undefined reference to `__end_ro_after_init'
arm-linux-gnueabihf-ld: kmemleak.c:(.init.text+0x150):
undefined reference to `__start_ro_after_init'
arm-linux-gnueabihf-ld: kmemleak.c:(.init.text+0x156):
undefined reference to `__start_ro_after_init'
arm-linux-gnueabihf-ld: kmemleak.c:(.init.text+0x162):
undefined reference to `__start_ro_after_init'
arm-linux-gnueabihf-ld: kmemleak.c:(.init.text+0x16a):
undefined reference to `__start_ro_after_init'
linux/Makefile:1078: recipe for target 'vmlinux' failed
Fix the issue enabling kmemleak only on non XIP kernels.
--- arch/arm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/Kconfig +1 -1
@@ -75,7 +75,7 @@ config ARM select HAVE_CONTEXT_TRACKING select HAVE_COPY_THREAD_TLS select HAVE_C_RECORDMCOUNT - select HAVE_DEBUG_KMEMLEAK + select HAVE_DEBUG_KMEMLEAK if !XIP_KERNEL select HAVE_DMA_CONTIGUOUS if MMU select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 85/459 mfd: max77650: Select REGMAP_IRQ in Kconfig
In reply to Sasha LevinFrom: Bartosz Golaszewski <[email protected]>
[ Upstream commit cb7a374a5e7a5af3f8c839f74439193add6d0589 ]
MAX77650 MFD driver uses regmap_irq API but doesn't select the required REGMAP_IRQ option in Kconfig. This can cause the following build error if regmap irq is not enabled implicitly by someone else:
ld: drivers/mfd/max77650.o: in function `max77650_i2c_probe':
max77650.c:(.text+0xcb): undefined reference to `devm_regmap_add_irq_chip'
ld: max77650.c:(.text+0xdb): undefined reference to `regmap_irq_get_domain'
make: *** [Makefile:1079: vmlinux] Error 1Fix it by adding the missing option.
--- drivers/mfd/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/Kconfig +1 -0
@@ -758,6 +758,7 @@ config MFD_MAX77650 depends on OF || COMPILE_TEST select MFD_CORE select REGMAP_I2C + select REGMAP_IRQ help Say Y here to add support for Maxim Semiconductor MAX77650 and MAX77651 Power Management ICs. This is the core multifunction
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 92/459 ath10k: Correct the DMA direction for management tx buffers
In reply to Sasha LevinFrom: Rakesh Pillai <[email protected]>
[ Upstream commit 6ba8b3b6bd772f575f7736c8fd893c6981fcce16 ]
The management packets, send to firmware via WMI, are mapped using the direction DMA_TO_DEVICE. Currently in case of wmi cleanup, these buffers are being unmapped using an incorrect DMA direction. This can cause unwanted behavior when the host driver is handling a restart of the wlan firmware.
We might see a trace like below
[<ffffff8008098b18>] __dma_inv_area+0x28/0x58 [<ffffff8001176734>] ath10k_wmi_mgmt_tx_clean_up_pending+0x60/0xb0 [ath10k_core] [<ffffff80088c7c50>] idr_for_each+0x78/0xe4 [<ffffff80011766a4>] ath10k_wmi_detach+0x4c/0x7c [ath10k_core] [<ffffff8001163d7c>] ath10k_core_stop+0x58/0x68 [ath10k_core] [<ffffff800114fb74>] ath10k_halt+0xec/0x13c [ath10k_core] [<ffffff8001165110>] ath10k_core_restart+0x11c/0x1a8 [ath10k_core] [<ffffff80080c36bc>] process_one_work+0x16c/0x31c
Fix the incorrect DMA direction during the wmi
management tx buffer cleanup.
Tested HW: WCN3990
Tested FW: WLAN.HL.3.1-00784-QCAHLSWMTPLZ-1
--- drivers/net/wireless/ath/ath10k/wmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/wmi.c +1 -1
@@ -9422,7 +9422,7 @@ static int ath10k_wmi_mgmt_tx_clean_up_pending(int msdu_id, void *ptr, msdu = pkt_addr->vaddr;dma_unmap_single (ar->dev, pkt_addr->paddr, - msdu->len,DMA_FROM_DEVICE ); + msdu->len,DMA_TO_DEVICE );ieee80211_free_txskb (ar->hw, msdu);return 0 ;
Signature · 7 lines
2.20.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 98/459 watchdog: qcom: Use platform_get_irq_optional() for bark irq
In reply to Sasha LevinFrom: Sai Prakash Ranjan <[email protected]>
[ Upstream commit e0b4f4e0cf7fa9d62628d4249c765ec18dffd143 ]
platform_get_irq() prints an error message when the interrupt is not available. So on platforms where bark interrupt is not specified, following error message is observed on SDM845.
[ 2.975888] qcom_wdt 17980000.watchdog: IRQ index 0 not found
This is also seen on SC7180, SM8150 SoCs as well. Fix this by using platform_get_irq_optional() instead.
--- drivers/watchdog/qcom-wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/qcom-wdt.c +1 -1
@@ -246,7 +246,7 @@ static int qcom_wdt_probe(struct platform_device *pdev) }/* check if there is pretimeout support */ - irq =platform_get_irq (pdev,0 ); + irq =platform_get_irq_optional (pdev,0 );if (irq >0 ) { ret = devm_request_irq(dev, irq, qcom_wdt_isr, IRQF_TRIGGER_RISING,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 99/459 selftests: settings: tests can be in subsubdirs
In reply to Sasha LevinFrom: Matthieu Baerts <[email protected]>
[ Upstream commit ac87813d4372f4c005264acbe3b7f00c1dee37c4 ]
Commit 852c8cbf34d3 ("selftests/kselftest/runner.sh: Add 45 second timeout per test") adds support for a new per-test-directory "settings" file. But this only works for tests not in a sub-subdirectories, e.g.
- tools/testing/selftests/rtc (rtc) is OK,
- tools/testing/selftests/net/mptcp (net/mptcp) is not.
We have to increase the timeout for net/mptcp tests which are not upstreamed yet but this fix is valid for other tests if they need to add a "settings" file, see the full list with:
tools/testing/selftests/*/*/**/Makefile
Note that this patch changes the text header message printed at the end of the execution but this text is modified only for the tests that are in sub-subdirectories, e.g.
ok 1 selftests: net/mptcp: mptcp_connect.sh
Before we had:
ok 1 selftests: mptcp: mptcp_connect.sh
But showing the full target name is probably better, just in case a subsubdir has the same name as another one in another subdirectory.
--- tools/testing/selftests/kselftest/runner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/kselftest/runner.sh +1 -1
@@ -91,7 +91,7 @@ run_one() run_many() { echo "TAP version 13" - DIR=$(basename "$PWD") + DIR="${PWD#${BASE_DIR}/}" test_num=0 total=$(echo "$@" | wc -w) echo "1..$total"
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 93/459 rtw88: fix rate mask for 1SS chip
In reply to Sasha LevinFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit 35a68fa5f96a80797e11b6952a47c5a84939a7bf ]
The rate mask is used to tell firmware the supported rate depends on negotiation. We loop 2 times for all VHT/HT 2SS rate mask first, and then only keep the part according to chip's NSS.
This commit fixes the logic error of '&' operations for VHT/HT rate, and we should run this logic before adding legacy rate.
To access HT MCS map, index 0/1 represent MCS 0-7/8-15 respectively. Use NL80211_BAND_xxx is incorrect, so fix it as well.
--- drivers/net/wireless/realtek/rtw88/main.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/net/wireless/realtek/rtw88/main.c +5 -7
@@ -556,8 +556,8 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si)if (sta->vht_cap.cap &IEEE80211_VHT_CAP_SHORT_GI_80 ) is_support_sgi = true; }else if (sta->ht_cap.ht_supported) { - ra_mask |= (sta->ht_cap.mcs.rx_mask[NL80211_BAND_5GHZ ] <<20 ) | - (sta->ht_cap.mcs.rx_mask[NL80211_BAND_2GHZ ] <<12 ); + ra_mask |= (sta->ht_cap.mcs.rx_mask[1 ] <<20 ) | + (sta->ht_cap.mcs.rx_mask[0 ] <<12 );if (sta->ht_cap.cap &IEEE80211_HT_CAP_RX_STBC ) stbc_en =HT_STBC_EN ;if (sta->ht_cap.cap &IEEE80211_HT_CAP_LDPC_CODING )
@@ -567,6 +567,9 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si) is_support_sgi = true; } +if (efuse->hw_cap.nss ==1 ) + ra_mask &=RA_MASK_VHT_RATES_1SS |RA_MASK_HT_RATES_1SS ; +if (hal->current_band_type ==RTW_BAND_5G ) { ra_mask |= (u64 )sta->supp_rates[NL80211_BAND_5GHZ ] <<4 ;if (sta->vht_cap.vht_supported) {
@@ -600,11 +603,6 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si) wireless_set =0 ; } -if (efuse->hw_cap.nss ==1 ) { - ra_mask &=RA_MASK_VHT_RATES_1SS ; - ra_mask &=RA_MASK_HT_RATES_1SS ; - } -switch (sta->bandwidth) {case IEEE80211_STA_RX_BW_80 : bw_mode =RTW_CHANNEL_WIDTH_80 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 100/459 rtc: i2c/spi: Avoid inclusion of REGMAP support when not needed
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 34719de919af07682861cb0fa2bcf64da33ecf44 ]
Merely enabling I2C and RTC selects REGMAP_I2C and REGMAP_SPI, even when no driver needs it. While the former can be moduler, the latter cannot, and thus becomes built-in.
Fix this by moving the select statements for REGMAP_I2C and REGMAP_SPI from the RTC_I2C_AND_SPI helper to the individual drivers that depend on it.
Note that the comment for RTC_I2C_AND_SPI refers to SND_SOC_I2C_AND_SPI for more information, but the latter does not select REGMAP_{I2C,SPI} itself, and defers that to the individual drivers, too.
--- drivers/rtc/Kconfig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/rtc/Kconfig +6 -2
@@ -859,14 +859,14 @@ config RTC_I2C_AND_SPI default m if I2C=m default y if I2C=y default y if SPI_MASTER=y - select REGMAP_I2C if I2C - select REGMAP_SPI if SPI_MASTER comment "SPI and I2C RTC drivers" config RTC_DRV_DS3232 tristate "Dallas/Maxim DS3232/DS3234" depends on RTC_I2C_AND_SPI + select REGMAP_I2C if I2C + select REGMAP_SPI if SPI_MASTER help If you say yes here you get support for Dallas Semiconductor DS3232 and DS3234 real-time clock chips. If an interrupt is associated
@@ -886,6 +886,8 @@ config RTC_DRV_DS3232_HWMON config RTC_DRV_PCF2127 tristate "NXP PCF2127" depends on RTC_I2C_AND_SPI + select REGMAP_I2C if I2C + select REGMAP_SPI if SPI_MASTER select WATCHDOG_CORE if WATCHDOG help If you say yes here you get support for the NXP PCF2127/29 RTC
@@ -902,6 +904,8 @@ config RTC_DRV_PCF2127 config RTC_DRV_RV3029C2 tristate "Micro Crystal RV3029/3049" depends on RTC_I2C_AND_SPI + select REGMAP_I2C if I2C + select REGMAP_SPI if SPI_MASTER help If you say yes here you get support for the Micro Crystal RV3029 and RV3049 RTC chips.
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 101/459 drm/amd/display: Retrain dongles when SINK_COUNT becomes non-zero
In reply to Sasha LevinFrom: Harry Wentland <[email protected]>
[ Upstream commit 3eb6d7aca53d81ce888624f09cd44dc0302161e8 ]
[WHY]
Two years ago the patch referenced by the Fixes tag stopped running dp_verify_link_cap_with_retries during DP detection when the reason for the detection was a short-pulse interrupt. This effectively meant that we were no longer doing the verify_link_cap training on active dongles when their SINK_COUNT changed from 0 to 1.
A year ago this was partly remedied with:
commit 80adaebd2d41 ("drm/amd/display: Don't skip link training for empty dongle")
This made sure that we trained the dongle on initial hotplug (without connected downstream devices).
This is all fine and dandy if it weren't for the fact that there are some dongles on the market that don't like link training when SINK_COUNT is 0 These dongles will in fact indicate a SINK_COUNT of 0 immediately after hotplug, even when a downstream device is connected, and then trigger a shortpulse interrupt indicating a SINK_COUNT change to 1.
In order to play nicely we will need our policy to not link train an active DP dongle when SINK_COUNT is 0 but ensure we train it when the SINK_COUNT changes to 1.
[HOW]
Call dp_verify_link_cap_with_retries on detection even when the detection is triggered from a short pulse interrupt.
With this change we can also revert this commit which we'll do in a separate follow-up change:
commit 80adaebd2d41 ("drm/amd/display: Don't skip link training for empty dongle")
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1 -2
@@ -948,8 +948,7 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason) same_edid =is_same_edid (&prev_sink->dc_edid, &sink->dc_edid);if (link->connector_signal ==SIGNAL_TYPE_DISPLAY_PORT && - sink_caps.transaction_type ==DDC_TRANSACTION_TYPE_I2C_OVER_AUX && - reason !=DETECT_REASON_HPDRX ) { + sink_caps.transaction_type ==DDC_TRANSACTION_TYPE_I2C_OVER_AUX ) {/* * TODO debug why Dell 2413 doesn't like * two link trainings
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 95/459 libertas: don't exit from lbs_ibss_join_existing() with RCU read lock held
In reply to Sasha LevinFrom: Nicolai Stange <[email protected]>
[ Upstream commit c7bf1fb7ddca331780b9a733ae308737b39f1ad4 ]
Commit e5e884b42639 ("libertas: Fix two buffer overflows at parsing bss descriptor") introduced a bounds check on the number of supplied rates to lbs_ibss_join_existing().
Unfortunately, it introduced a return path from within a RCU read side critical section without a corresponding rcu_read_unlock(). Fix this.
--- drivers/net/wireless/marvell/libertas/cfg.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/marvell/libertas/cfg.c +1 -0
@@ -1785,6 +1785,7 @@ static int lbs_ibss_join_existing(struct lbs_private *priv, rates_max = rates_eid[1 ];if (rates_max >MAX_RATES ) {lbs_deb_join ("invalid rates" ); +rcu_read_unlock (); goto out; } rates = cmd.bss.rates;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 102/459 RDMA/umem: Fix ib_umem_find_best_pgsz()
In reply to Sasha LevinFrom: Artemy Kovalyov <[email protected]>
[ Upstream commit 36798d5ae1af62e830c5e045b2e41ce038690c61 ]
Except for the last entry, the ending iova alignment sets the maximum possible page size as the low bits of the iova must be zero when starting the next chunk.
--- drivers/infiniband/core/umem.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/infiniband/core/umem.c +6 -3
@@ -166,10 +166,13 @@ unsigned long ib_umem_find_best_pgsz(struct ib_umem *umem,* for any address. */ mask |= (sg_dma_address (sg) + pgoff) ^ va; -if (i && i != (umem->nmap -1 )) -/* restrict by length as well for interior SGEs */ - mask |=sg_dma_len (sg); va +=sg_dma_len (sg) - pgoff; +/* Except for the last entry, the ending iova alignment sets +* the maximum possible page size as the low bits of the iova +* must be zero when starting the next chunk. +*/ +if (i != (umem->nmap -1 )) + mask |= va; pgoff =0 ; } best_pg_bit =rdma_find_pg_bit (mask, pgsz_bitmap);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 106/459 KVM: s390: ENOTSUPP -> EOPNOTSUPP fixups
In reply to Sasha LevinFrom: Christian Borntraeger <[email protected]>
[ Upstream commit c611990844c28c61ca4b35ff69d3a2ae95ccd486 ]
There is no ENOTSUPP for userspace.
--- arch/s390/kvm/interrupt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/s390/kvm/interrupt.c +3 -3
@@ -2191,7 +2191,7 @@ static int flic_ais_mode_get_all(struct kvm *kvm, struct kvm_device_attr *attr)return -EINVAL ;if (!test_kvm_facility (kvm,72 )) -return -ENOTSUPP ; +return -EOPNOTSUPP ;mutex_lock (&fi->ais_lock); ais.simm = fi->simm;
@@ -2500,7 +2500,7 @@ static int modify_ais_mode(struct kvm *kvm, struct kvm_device_attr *attr)int ret =0 ;if (!test_kvm_facility (kvm,72 )) -return -ENOTSUPP ; +return -EOPNOTSUPP ;if (copy_from_user (&req, (void __user *)attr->addr,sizeof (req)))return -EFAULT ;
@@ -2580,7 +2580,7 @@ static int flic_ais_mode_set_all(struct kvm *kvm, struct kvm_device_attr *attr)struct kvm_s390_ais_all ais;if (!test_kvm_facility (kvm,72 )) -return -ENOTSUPP ; +return -EOPNOTSUPP ;if (copy_from_user (&ais, (void __user *)attr->addr,sizeof (ais)))return -EFAULT ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 107/459 Btrfs: keep pages dirty when using btrfs_writepage_fixup_worker
In reply to Sasha LevinFrom: Chris Mason <[email protected]>
[ Upstream commit 25f3c5021985e885292980d04a1423fd83c967bb ]
For COW, btrfs expects pages dirty pages to have been through a few setup steps. This includes reserving space for the new block allocations and marking the range in the state tree for delayed allocation.
A few places outside btrfs will dirty pages directly, especially when unmapping mmap'd pages. In order for these to properly go through COW, we run them through a fixup worker to wait for stable pages, and do the delalloc prep.
87826df0ec36 added a window where the dirty pages were cleaned, but pending more action from the fixup worker. We clear_page_dirty_for_io() before we call into writepage, so the page is no longer dirty. The commit changed it so now we leave the page clean between unlocking it here and the fixup worker starting at some point in the future.
During this window, page migration can jump in and relocate the page. Once our fixup work actually starts, it finds page->mapping is NULL and we end up freeing the page without ever writing it.
This leads to crc errors and other exciting problems, since it screws up the whole statemachine for waiting for ordered extents. The fix here is to keep the page dirty while we're waiting for the fixup worker to get to work. This is accomplished by returning -EAGAIN from btrfs_writepage_cow_fixup if we queued the page up for fixup, which will cause the writepage function to redirty the page.
Because we now expect the page to be dirty once it gets to the fixup worker we must adjust the error cases to call clear_page_dirty_for_io() on the page. That is the bulk of the patch, but it is not the fix, the fix is the -EAGAIN from btrfs_writepage_cow_fixup. We cannot separate these two changes out because the error conditions change with the new expectations.
--- fs/btrfs/inode.c | 61 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 17 deletions(-)
fs/btrfs/inode.c +44 -17
@@ -2181,17 +2181,27 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)struct inode *inode;u64 page_start;u64 page_end; -int ret; +int ret =0 ; fixup = container_of(work, struct btrfs_writepage_fixup, work); page = fixup->page; again:lock_page (page); -if (!page->mapping || !PageDirty (page) || !PageChecked (page)) { -ClearPageChecked (page); + +/* +* Before we queued this fixup, we took a reference on the page. +* page->mapping may go NULL, but it shouldn't be moved to a different +* address space. +*/ +if (!page->mapping || !PageDirty (page) || !PageChecked (page)) goto out_page; - } +/* +* We keep the PageChecked() bit set until we're done with the +* btrfs_start_ordered_extent() dance that we do below. That drops and +* retakes the page lock, so we don't want new fixup workers queued for +* this page during the churn. +*/ inode = page->mapping->host; page_start =page_offset (page); page_end =page_offset (page) +PAGE_SIZE -1 ;
@@ -2216,24 +2226,22 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work) ret =btrfs_delalloc_reserve_space (inode, &data_reserved, page_start,PAGE_SIZE ); -if (ret) { -mapping_set_error (page->mapping, ret); -end_extent_writepage (page, ret, page_start, page_end); -ClearPageChecked (page); +if (ret) goto out; - } ret =btrfs_set_extent_delalloc (inode, page_start, page_end,0 , &cached_state); -if (ret) { -mapping_set_error (page->mapping, ret); -end_extent_writepage (page, ret, page_start, page_end); -ClearPageChecked (page); +if (ret) goto out_reserved; - } -ClearPageChecked (page); -set_page_dirty (page); +/* +* Everything went as planned, we're now the owner of a dirty page with +* delayed allocation bits set and space reserved for our COW +* destination. +* +* The page was dirty when we started, nothing should have cleaned it. +*/ +BUG_ON (!PageDirty (page)); out_reserved:btrfs_delalloc_release_extents (BTRFS_I (inode),PAGE_SIZE );if (ret)
@@ -2243,6 +2251,17 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)unlock_extent_cached (&BTRFS_I (inode)->io_tree, page_start, page_end, &cached_state); out_page: +if (ret) { +/* +* We hit ENOSPC or other errors. Update the mapping and page +* to reflect the errors and clean the page. +*/ +mapping_set_error (page->mapping, ret); +end_extent_writepage (page, ret, page_start, page_end); +clear_page_dirty_for_io (page); +SetPageError (page); + } +ClearPageChecked (page);unlock_page (page);put_page (page);kfree (fixup);
@@ -2270,6 +2289,13 @@ int btrfs_writepage_cow_fixup(struct page *page, u64 start, u64 end)if (TestClearPagePrivate2 (page))return 0 ; +/* +* PageChecked is set below when we create a fixup worker for this page, +* don't try to create another one if we're already PageChecked() +* +* The extent_io writepage code will redirty the page if we send back +* EAGAIN. +*/ if (PageChecked (page))return -EAGAIN ;
@@ -2282,7 +2308,8 @@ int btrfs_writepage_cow_fixup(struct page *page, u64 start, u64 end)btrfs_init_work (&fixup->work, btrfs_writepage_fixup_worker,NULL ,NULL ); fixup->page = page;btrfs_queue_work (fs_info->fixup_workers, &fixup->work); -return -EBUSY ; + +return -EAGAIN ; } static int insert_reserved_file_extent(struct btrfs_trans_handle *trans,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 110/459 kconfig: fix broken dependency in randconfig-generated .config
In reply to Sasha LevinFrom: Masahiro Yamada <[email protected]>
[ Upstream commit c8fb7d7e48d11520ad24808cfce7afb7b9c9f798 ]
Running randconfig on arm64 using KCONFIG_SEED=0x40C5E904 (e.g. on v5.5) produces the .config with CONFIG_EFI=y and CONFIG_CPU_BIG_ENDIAN=y, which does not meet the !CONFIG_CPU_BIG_ENDIAN dependency.
This is because the user choice for CONFIG_CPU_LITTLE_ENDIAN vs CONFIG_CPU_BIG_ENDIAN is set by randomize_choice_values() after the value of CONFIG_EFI is calculated.
When this happens, the has_changed flag should be set.
Currently, it takes the result from the last iteration. It should accumulate all the results of the loop.
--- scripts/kconfig/confdata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/confdata.c +1 -1
@@ -1353,7 +1353,7 @@ bool conf_set_all_new_symbols(enum conf_def_mode mode)sym_calc_value (csym);if (mode == def_random) - has_changed =randomize_choice_values (csym); + has_changed |=randomize_choice_values (csym);else {set_all_choice_values (csym); has_changed = true;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 109/459 block, bfq: do not plug I/O for bfq_queues with no proc refs
In reply to Sasha LevinFrom: Paolo Valente <[email protected]>
[ Upstream commit f718b093277df582fbf8775548a4f163e664d282 ]
Commit 478de3380c1c ("block, bfq: deschedule empty bfq_queues not referred by any process") fixed commit 3726112ec731 ("block, bfq:
re-schedule empty queues if they deserve I/O plugging") by descheduling an empty bfq_queue when it remains with not process reference. Yet, this still left a case uncovered: an empty bfq_queue with not process reference that remains in service. This happens for an in-service sync bfq_queue that is deemed to deserve I/O-dispatch plugging when it remains empty. Yet no new requests will arrive for such a bfq_queue if no process sends requests to it any longer. Even worse, the bfq_queue may happen to be prematurely freed while still in service (because there may remain no reference to it any longer).
This commit solves this problem by preventing I/O dispatch from being plugged for the in-service bfq_queue, if the latter has no process reference (the bfq_queue is then prevented from remaining in service).
--- block/bfq-iosched.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
block/bfq-iosched.c +12 -0
@@ -3444,6 +3444,10 @@ static void bfq_dispatch_remove(struct request_queue *q, struct request *rq)static bool idling_needed_for_service_guarantees (struct bfq_data *bfqd,struct bfq_queue *bfqq) { +/* No point in idling for bfqq if it won't get requests any longer */ +if (unlikely (!bfqq_process_refs (bfqq))) +return false; + return (bfqq->wr_coeff > 1 && (bfqd->wr_busy_queues < bfq_tot_busy_queues(bfqd) ||
@@ -4077,6 +4081,10 @@ static bool idling_boosts_thr_without_issues(struct bfq_data *bfqd, bfqq_sequential_and_IO_bound, idling_boosts_thr; +/* No point in idling for bfqq if it won't get requests any longer */ +if (unlikely (!bfqq_process_refs (bfqq))) +return false; + bfqq_sequential_and_IO_bound = !BFQQ_SEEKY (bfqq) &&bfq_bfqq_IO_bound (bfqq) &&bfq_bfqq_has_short_ttime (bfqq);
@@ -4170,6 +4178,10 @@ static bool bfq_better_to_idle(struct bfq_queue *bfqq)struct bfq_data *bfqd = bfqq->bfqd;bool idling_boosts_thr_with_no_issue, idling_needed_for_service_guar; +/* No point in idling for bfqq if it won't get requests any longer */ +if (unlikely (!bfqq_process_refs (bfqq))) +return false; +if (unlikely (bfqd->strict_guarantees))return true;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 113/459 drm/amdkfd: Fix a bug in SDMA RLC queue counting under HWS mode
In reply to Sasha LevinFrom: Yong Zhao <[email protected]>
[ Upstream commit f38abc15d157b7b31fa7f651dc8bf92858c963f8 ]
The sdma_queue_count increment should be done before execute_queues_cpsch(), which calls pm_calc_rlib_size() where sdma_queue_count is used to calculate whether over_subscription is triggered.
With the previous code, when a SDMA queue is created, compute_queue_count in pm_calc_rlib_size() is one more than the actual compute queue number, because the queue_count has been incremented while sdma_queue_count has not. This patch fixes that.
--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +6 -4
@@ -1181,16 +1181,18 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,list_add (&q->list, &qpd->queues_list); qpd->queue_count++; + +if (q->properties.type ==KFD_QUEUE_TYPE_SDMA ) + dqm->sdma_queue_count++; +else if (q->properties.type ==KFD_QUEUE_TYPE_SDMA_XGMI ) + dqm->xgmi_sdma_queue_count++; +if (q->properties.is_active) { dqm->queue_count++; retval =execute_queues_cpsch (dqm,KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES ,0 ); } -if (q->properties.type ==KFD_QUEUE_TYPE_SDMA ) - dqm->sdma_queue_count++; -else if (q->properties.type ==KFD_QUEUE_TYPE_SDMA_XGMI ) - dqm->xgmi_sdma_queue_count++;/* * Unconditionally increment this counter, regardless of the queue's * type or whether the queue is active.
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 103/459 RDMA/cma: Fix unbalanced cm_id reference count during address resolve
In reply to Sasha LevinFrom: Parav Pandit <[email protected]>
[ Upstream commit b4fb4cc5ba83b20dae13cef116c33648e81d2f44 ]
Below commit missed the AF_IB and loopback code flow in rdma_resolve_addr(). This leads to an unbalanced cm_id refcount in cma_work_handler() which puts the refcount which was not incremented prior to queuing the work.
A call trace is observed with such code flow:
BUG: unable to handle kernel NULL pointer dereference at (null) [<ffffffff96b67e16>] __mutex_lock_slowpath+0x166/0x1d0 [<ffffffff96b6715f>] mutex_lock+0x1f/0x2f [<ffffffffc0beabb5>] cma_work_handler+0x25/0xa0 [<ffffffff964b9ebf>] process_one_work+0x17f/0x440 [<ffffffff964baf56>] worker_thread+0x126/0x3c0
Hence, hold the cm_id reference when scheduling the resolve work item.
--- drivers/infiniband/core/cma.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/core/cma.c +2 -0
@@ -3091,6 +3091,7 @@ static int cma_resolve_loopback(struct rdma_id_private *id_priv)rdma_addr_get_sgid (&id_priv->id.route.addr.dev_addr, &gid);rdma_addr_set_dgid (&id_priv->id.route.addr.dev_addr, &gid); +atomic_inc (&id_priv->refcount);cma_init_resolve_addr_work (work, id_priv);queue_work (cma_wq, &work->work);return 0 ;
@@ -3117,6 +3118,7 @@ static int cma_resolve_ib_addr(struct rdma_id_private *id_priv)rdma_addr_set_dgid (&id_priv->id.route.addr.dev_addr, (union ib_gid *) &(((struct sockaddr_ib *) &id_priv->id.route.addr.dst_addr)->sib_addr)); +atomic_inc (&id_priv->refcount);cma_init_resolve_addr_work (work, id_priv);queue_work (cma_wq, &work->work);return 0 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 114/459 bpftool: Don't crash on missing xlated program instructions
In reply to Sasha LevinFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit d95f1e8b462c4372ac409886070bb8719d8a4d3a ]
Turns out the xlated program instructions can also be missing if kptr_restrict sysctl is set. This means that the previous fix to check the jited_prog_insns pointer was insufficient; add another check of the xlated_prog_insns pointer as well.
--- tools/bpf/bpftool/prog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/prog.c +1 -1
@@ -500,7 +500,7 @@ static int do_dump(int argc, char **argv) buf = (unsigned char *)(info->jited_prog_insns); member_len = info->jited_prog_len; }else {/* DUMP_XLATED */ -if (info->xlated_prog_len ==0 ) { +if (info->xlated_prog_len ==0 || !info->xlated_prog_insns) {p_err ("error retrieving insn dump: kernel.kptr_restrict set?" ); goto err_free; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 105/459 nbd: add a flush_workqueue in nbd_start_device
In reply to Sasha LevinFrom: Sun Ke <[email protected]>
[ Upstream commit 5c0dd228b5fc30a3b732c7ae2657e0161ec7ed80 ]
When kzalloc fail, may cause trying to destroy the workqueue from inside the workqueue.
If num_connections is m (2 < m), and NO.1 ~ NO.n (1 < n < m) kzalloc are successful. The NO.(n + 1) failed. Then, nbd_start_device will return ENOMEM to nbd_start_device_ioctl, and nbd_start_device_ioctl will return immediately without running flush_workqueue. However, we still have n recv threads. If nbd_release run first, recv threads may have to drop the last config_refs and try to destroy the workqueue from inside the workqueue.
To fix it, add a flush_workqueue in nbd_start_device.
--- drivers/block/nbd.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/block/nbd.c +10 -0
@@ -1265,6 +1265,16 @@ static int nbd_start_device(struct nbd_device *nbd) args =kzalloc (sizeof (*args),GFP_KERNEL );if (!args) {sock_shutdown (nbd); +/* +* If num_connections is m (2 < m), +* and NO.1 ~ NO.n(1 < n < m) kzallocs are successful. +* But NO.(n + 1) failed. We still have n recv threads. +* So, add flush_workqueue here to prevent recv threads +* dropping the last config_refs and trying to destroy +* the workqueue from inside the workqueue. +*/ +if (i) +flush_workqueue (nbd->recv_workq);return -ENOMEM ; }sk_set_memalloc (config->socks[i]->sock->sk);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 115/459 bpf, sockhash: Synchronize_rcu before free'ing map
In reply to Sasha LevinFrom: Jakub Sitnicki <[email protected]>
[ Upstream commit 0b2dc83906cf1e694e48003eae5df8fa63f76fd9 ]
We need to have a synchronize_rcu before free'ing the sockhash because any outstanding psock references will have a pointer to the map and when they use it, this could trigger a use after free.
This is a sister fix for sockhash, following commit 2bb90e5cc90e ("bpf:
sockmap, synchronize_rcu before free'ing map") which addressed sockmap, which comes from a manual audit.
--- net/core/sock_map.c | 4 ++++ 1 file changed, 4 insertions(+)
net/core/sock_map.c +4 -0
@@ -250,6 +250,7 @@ static void sock_map_free(struct bpf_map *map)raw_spin_unlock_bh (&stab->lock);rcu_read_unlock (); +/* wait for psock readers accessing its map link */ synchronize_rcu ();bpf_map_area_free (stab->sks);
@@ -873,6 +874,9 @@ static void sock_hash_free(struct bpf_map *map) }rcu_read_unlock (); +/* wait for psock readers accessing its map link */ +synchronize_rcu (); +bpf_map_area_free (htab->buckets);kfree (htab); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 117/459 bpf: Improve bucket_log calculation logic
In reply to Sasha LevinFrom: Martin KaFai Lau <[email protected]>
[ Upstream commit 88d6f130e5632bbf419a2e184ec7adcbe241260b ]
It was reported that the max_t, ilog2, and roundup_pow_of_two macros have exponential effects on the number of states in the sparse checker.
This patch breaks them up by calculating the "nbuckets" first so that the "bucket_log" only needs to take ilog2().
In addition, Linus mentioned:
Patch looks good, but I'd like to point out that it's not just sparse.
You can see it with a simple
make net/core/bpf_sk_storage.i
grep 'smap->bucket_log = ' net/core/bpf_sk_storage.i | wcand see the end result:
1 365071 2686974
That's one line (the assignment line) that is 2,686,974 characters in length.
Now, sparse does happen to react particularly badly to that (I didn't look to why, but I suspect it's just that evaluating all the types that don't actually ever end up getting used ends up being much more expensive than it should be), but I bet it's not good for gcc either.
--- net/core/bpf_sk_storage.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/core/bpf_sk_storage.c +3 -2
@@ -643,9 +643,10 @@ static struct bpf_map *bpf_sk_storage_map_alloc(union bpf_attr *attr)return ERR_PTR (-ENOMEM );bpf_map_init_from_attr (&smap->map, attr); + nbuckets =roundup_pow_of_two (num_possible_cpus ());/* Use at least 2 buckets, select_bucket() is undefined behavior with 1 bucket */ - smap->bucket_log =max_t (u32,1 ,ilog2 (roundup_pow_of_two (num_possible_cpus ()))); - nbuckets =1U << smap->bucket_log; + nbuckets =max_t (u32,2 , nbuckets); + smap->bucket_log =ilog2 (nbuckets); cost =sizeof (*smap->buckets) * nbuckets +sizeof (*smap); ret =bpf_map_charge_init (&smap->map.memory, cost);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 119/459 drm/amdgpu: remove 4 set but not used variable in amdgpu_atombios_get_connector_info_from_object_table
In reply to Sasha LevinFrom: yu kuai <[email protected]>
[ Upstream commit bae028e3e521e8cb8caf2cc16a455ce4c55f2332 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c: In function 'amdgpu_atombios_get_connector_info_from_object_table':drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c:376:26: warning: variable 'grph_obj_num' set but not used [-Wunused-but-set-variable] drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c:376:13: warning: variable 'grph_obj_id' set but not used [-Wunused-but-set-variable] drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c:341:37: warning: variable 'con_obj_type' set but not used [-Wunused-but-set-variable] drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c:341:24: warning: variable 'con_obj_num' set but not used [-Wunused-but-set-variable]
They are never used, so can be removed.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +2 -17
@@ -338,17 +338,9 @@ bool amdgpu_atombios_get_connector_info_from_object_table(struct amdgpu_device * path_size +=le16_to_cpu (path->usSize);if (device_support &le16_to_cpu (path->usDeviceTag)) { -uint8_t con_obj_id, con_obj_num, con_obj_type; - - con_obj_id = +uint8_t con_obj_id = (le16_to_cpu (path->usConnObjectId) &OBJECT_ID_MASK ) >>OBJECT_ID_SHIFT ; - con_obj_num = - (le16_to_cpu (path->usConnObjectId) &ENUM_ID_MASK ) - >>ENUM_ID_SHIFT ; - con_obj_type = - (le16_to_cpu (path->usConnObjectId) & -OBJECT_TYPE_MASK ) >>OBJECT_TYPE_SHIFT ;/* Skip TV/CV support */ if ((le16_to_cpu(path->usDeviceTag) ==
@@ -373,14 +365,7 @@ bool amdgpu_atombios_get_connector_info_from_object_table(struct amdgpu_device * router.ddc_valid = false; router.cd_valid = false;for (j =0 ; j < ((le16_to_cpu (path->usSize) -8 ) /2 ); j++) { -uint8_t grph_obj_id, grph_obj_num, grph_obj_type; - - grph_obj_id = - (le16_to_cpu (path->usGraphicObjIds[j]) & -OBJECT_ID_MASK ) >>OBJECT_ID_SHIFT ; - grph_obj_num = - (le16_to_cpu (path->usGraphicObjIds[j]) & -ENUM_ID_MASK ) >>ENUM_ID_SHIFT ; +uint8_t grph_obj_type= grph_obj_type = (le16_to_cpu (path->usGraphicObjIds[j]) &OBJECT_TYPE_MASK ) >>OBJECT_TYPE_SHIFT ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 116/459 bpf, sockmap: Check update requirements after locking
In reply to Sasha LevinFrom: Lorenz Bauer <[email protected]>
[ Upstream commit 85b8ac01a421791d66c3a458a7f83cfd173fe3fa ]
It's currently possible to insert sockets in unexpected states into a sockmap, due to a TOCTTOU when updating the map from a syscall. sock_map_update_elem checks that sk->sk_state == TCP_ESTABLISHED, locks the socket and then calls sock_map_update_common. At this point, the socket may have transitioned into another state, and the earlier assumptions don't hold anymore. Crucially, it's conceivable (though very unlikely) that a socket has become unhashed. This breaks the sockmap's assumption that it will get a callback via sk->sk_prot->unhash.
Fix this by checking the (fixed) sk_type and sk_protocol without the lock, followed by a locked check of sk_state.
Unfortunately it's not possible to push the check down into sock_(map|hash)_update_common, since BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB run before the socket has transitioned from TCP_SYN_RECV into TCP_ESTABLISHED.
--- net/core/sock_map.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
net/core/sock_map.c +10 -6
@@ -417,14 +417,16 @@ static int sock_map_update_elem(struct bpf_map *map, void *key, ret = -EINVAL ; goto out; } -if (!sock_map_sk_is_suitable (sk) || - sk->sk_state !=TCP_ESTABLISHED ) { +if (!sock_map_sk_is_suitable (sk)) { ret = -EOPNOTSUPP ; goto out; }sock_map_sk_acquire (sk); - ret =sock_map_update_common (map, idx, sk, flags); +if (sk->sk_state !=TCP_ESTABLISHED ) + ret = -EOPNOTSUPP ; +else + ret =sock_map_update_common (map, idx, sk, flags);sock_map_sk_release (sk); out:fput (sock->file);
@@ -740,14 +742,16 @@ static int sock_hash_update_elem(struct bpf_map *map, void *key, ret = -EINVAL ; goto out; } -if (!sock_map_sk_is_suitable (sk) || - sk->sk_state !=TCP_ESTABLISHED ) { +if (!sock_map_sk_is_suitable (sk)) { ret = -EOPNOTSUPP ; goto out; }sock_map_sk_acquire (sk); - ret =sock_hash_update_common (map, key, sk, flags); +if (sk->sk_state !=TCP_ESTABLISHED ) + ret = -EOPNOTSUPP ; +else + ret =sock_hash_update_common (map, key, sk, flags);sock_map_sk_release (sk); out:fput (sock->file);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 121/459 drm/amdgpu: remove set but not used variable 'dig'
In reply to Sasha LevinFrom: yu kuai <[email protected]>
[ Upstream commit d1d09dc417826f5a983e0f4f212f227beeb65e29 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/amdgpu/atombios_dp.c: In function ‘amdgpu_atombios_dp_link_train’:drivers/gpu/drm/amd/amdgpu/atombios_dp.c:716:34: warning: variable ‘dig’ set but not used [-Wunused-but-set-variable]
--- drivers/gpu/drm/amd/amdgpu/atombios_dp.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/atombios_dp.c +0 -2
@@ -710,7 +710,6 @@ void amdgpu_atombios_dp_link_train(struct drm_encoder *encoder,struct drm_device *dev = encoder->dev;struct amdgpu_device *adev = dev->dev_private;struct amdgpu_encoder *amdgpu_encoder =to_amdgpu_encoder (encoder); -struct amdgpu_encoder_atom_dig *dig;struct amdgpu_connector *amdgpu_connector;struct amdgpu_connector_atom_dig *dig_connector;struct amdgpu_atombios_dp_link_train_info dp_info;
@@ -718,7 +717,6 @@ void amdgpu_atombios_dp_link_train(struct drm_encoder *encoder,if (!amdgpu_encoder->enc_priv)return ; - dig = amdgpu_encoder->enc_priv; amdgpu_connector =to_amdgpu_connector (connector);if (!amdgpu_connector->con_priv)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 120/459 drm/amdgpu: remove set but not used variable 'dig_connector'
In reply to Sasha LevinFrom: yu kuai <[email protected]>
[ Upstream commit 5bea7fedb7fe4d5e6d3ba9f385dd3619fb004ce7 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/amdgpu/atombios_dp.c: In function ‘amdgpu_atombios_dp_get_panel_mode’:drivers/gpu/drm/amd/amdgpu/atombios_dp.c:364:36: warning: variable ‘dig_connector’ set but not used [-Wunused-but-set-variable]
It is never used, so can be removed.
--- drivers/gpu/drm/amd/amdgpu/atombios_dp.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/atombios_dp.c +0 -3
@@ -361,7 +361,6 @@ int amdgpu_atombios_dp_get_panel_mode(struct drm_encoder *encoder, struct drm_connector *connector) {struct amdgpu_connector *amdgpu_connector =to_amdgpu_connector (connector); -struct amdgpu_connector_atom_dig *dig_connector;int panel_mode =DP_PANEL_MODE_EXTERNAL_DP_MODE ;u16 dp_bridge =amdgpu_connector_encoder_get_dp_bridge_encoder_id (connector);u8 tmp;
@@ -369,8 +368,6 @@ int amdgpu_atombios_dp_get_panel_mode(struct drm_encoder *encoder,if (!amdgpu_connector->con_priv)return panel_mode; - dig_connector = amdgpu_connector->con_priv; -if (dp_bridge !=ENCODER_OBJECT_ID_NONE ) {/* DP bridge chips */ if (drm_dp_dpcd_readb(&amdgpu_connector->ddc_bus->aux,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 122/459 drm/amdgpu: remove always false comparison in 'amdgpu_atombios_i2c_process_i2c_ch'
In reply to Sasha LevinFrom: yu kuai <[email protected]>
[ Upstream commit 220ac8d1444054ade07ce14498fcda266410f90e ]
Fixes gcc '-Wtype-limits' warning:
drivers/gpu/drm/amd/amdgpu/atombios_i2c.c: In function ‘amdgpu_atombios_i2c_process_i2c_ch’:drivers/gpu/drm/amd/amdgpu/atombios_i2c.c:79:11: warning: comparison is always false due to limited range of data type [-Wtype-limits]
'num' is 'u8', so it will never be greater than 'TOM_MAX_HW_I2C_READ', which is defined as 255. Therefore, the comparison can be removed.
--- drivers/gpu/drm/amd/amdgpu/atombios_i2c.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/atombios_i2c.c +0 -5
@@ -76,11 +76,6 @@ static int amdgpu_atombios_i2c_process_i2c_ch(struct amdgpu_i2c_chan *chan, } args.lpI2CDataOut =cpu_to_le16 (out); }else { -if (num >ATOM_MAX_HW_I2C_READ ) { -DRM_ERROR ("hw i2c: tried to read too many bytes (%d vs 255)\n" , num); - r = -EINVAL ; - goto done; - } args.ucRegIndex =0 ; args.lpI2CDataOut =0 ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 108/459 drivers/block/zram/zram_drv.c: fix error return codes not being returned in writeback_store
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit 3b82a051c10143639a378dcd12019f2353cc9054 ]
Currently when an error code -EIO or -ENOSPC in the for-loop of writeback_store the error code is being overwritten by a ret = len assignment at the end of the function and the error codes are being lost. Fix this by assigning ret = len at the start of the function and remove the assignment from the end, hence allowing ret to be preserved when error codes are assigned to it.
Addresses Coverity ("Unused value")
--- drivers/block/zram/zram_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/block/zram/zram_drv.c +1 -2
@@ -626,7 +626,7 @@ static ssize_t writeback_store(struct device *dev,struct bio bio;struct bio_vec bio_vec;struct page *page; -ssize_t ret; +ssize_t ret = len;int mode;unsigned long blk_idx =0 ;
@@ -762,7 +762,6 @@ static ssize_t writeback_store(struct device *dev,if (blk_idx)free_block_bdev (zram, blk_idx); - ret = len;__free_page (page); release_init_lock:up_read (&zram->init_lock);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 123/459 drm/amdgpu: remove set but not used variable 'mc_shared_chmap'
In reply to Sasha LevinFrom: yu kuai <[email protected]>
[ Upstream commit e98042db2cb8d0b728cd76e05b9c2e1c84b7f72b ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c: In function ‘gfx_v8_0_gpu_early_init’:drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c:1713:6: warning: variable ‘mc_shared_chmap’ set but not used [-Wunused-but-set-variable]
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -2
@@ -1710,7 +1710,7 @@ static int gfx_v8_0_do_edc_gpr_workarounds(struct amdgpu_device *adev)static int gfx_v8_0_gpu_early_init (struct amdgpu_device *adev) {u32 gb_addr_config; -u32 mc_shared_chmap, mc_arb_ramcfg; +u32 mc_arb_ramcfg;u32 dimm00_addr_map, dimm01_addr_map, dimm10_addr_map, dimm11_addr_map;u32 tmp;int ret;
@@ -1850,7 +1850,6 @@ static int gfx_v8_0_gpu_early_init(struct amdgpu_device *adev)break ; } - mc_shared_chmap =RREG32 (mmMC_SHARED_CHMAP); adev->gfx.config.mc_arb_ramcfg =RREG32 (mmMC_ARB_RAMCFG); mc_arb_ramcfg = adev->gfx.config.mc_arb_ramcfg;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 124/459 drm/amd/powerplay: remove set but not used variable 'vbios_version', 'data'
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit cb7709223b39287a020e92ff880d11d377dc53a1 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c: In function smu7_check_mc_firmware:drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c:4215:11: warning: variable vbios_version set but not used [-Wunused-but-set-variable] drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c: In function smu7_get_performance_level:drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c:5054:21: warning: variable data set but not used [-Wunused-but-set-variable]
'vbios_version' is introduced by commit 599a7e9fe1b6 ("drm/amd/powerplay:
implement smu7 hwmgr to manager asics with smu ip version 7."), but never used, so remove it.
'data' is introduced by commit f688b614b643 ("drm/amd/pp:
Implement get_performance_level for legacy dgpu"), but never used, so remove it.
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -4
@@ -4232,7 +4232,6 @@ static int smu7_check_mc_firmware(struct pp_hwmgr *hwmgr) {struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); -uint32_t vbios_version;uint32_t tmp;/* Read MC indirect register offset 0x9F bits [3:0] to see
@@ -4241,7 +4240,6 @@ static int smu7_check_mc_firmware(struct pp_hwmgr *hwmgr)*/ smu7_get_mc_microcode_version (hwmgr); - vbios_version = hwmgr->microcode_version_info.MC &0xf ; data->need_long_memory_training = false;
@@ -5071,13 +5069,11 @@ static int smu7_get_performance_level(struct pp_hwmgr *hwmgr, const struct pp_hw PHM_PerformanceLevel *level) {const struct smu7_power_state *ps; -struct smu7_hwmgr *data;uint32_t i;if (level ==NULL || hwmgr ==NULL || state ==NULL )return -EINVAL ; - data = hwmgr->backend; ps =cast_const_phw_smu7_power_state (state); i = index > ps->performance_level_count - 1 ?
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 125/459 drm/amd/powerplay: remove set but not used variable 'data'
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit 4bf321c177c74f7d834956387cd74805c3098322 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c: In function vega10_get_performance_level:drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c:5217:23: warning: variable data set but not used [-Wunused-but-set-variable]
'data' is introduced by commit f688b614b643 ("drm/amd/pp:
Implement get_performance_level for legacy dgpu"), but never used, so remove it.
--- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -2
@@ -5247,13 +5247,11 @@ static int vega10_get_performance_level(struct pp_hwmgr *hwmgr, const struct pp_ PHM_PerformanceLevel *level) {const struct vega10_power_state *ps; -struct vega10_hwmgr *data;uint32_t i;if (level ==NULL || hwmgr ==NULL || state ==NULL )return -EINVAL ; - data = hwmgr->backend; ps =cast_const_phw_vega10_power_state (state); i = index > ps->performance_level_count - 1 ?
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 126/459 drm/amd/powerplay: remove set but not used variable 'threshold', 'state'
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit f5ac1595156a8b63812ed6fa0803ddf7207cced7 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c: In function fiji_populate_single_graphic_level:drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c:943:11: warning: variable threshold set but not used [-Wunused-but-set-variable] drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c: In function fiji_populate_memory_timing_parameters:drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c:1504:8: warning: variable state set but not used [-Wunused-but-set-variable]
They are introduced by commit 2e112b4ae3ba ("drm/amd/pp:
remove fiji_smc/smumgr split."), but never used, so remove it.
--- drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c +2 -5
@@ -940,7 +940,7 @@ static int fiji_populate_single_graphic_level(struct pp_hwmgr *hwmgr, {int result;/* PP_Clocks minClocks; */ -uint32_t threshold, mvdd; +uint32_t mvdd;struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);struct phm_ppt_v1_information *table_info = (struct phm_ppt_v1_information *)(hwmgr->pptable);
@@ -973,8 +973,6 @@ static int fiji_populate_single_graphic_level(struct pp_hwmgr *hwmgr, level->VoltageDownHyst =0 ; level->PowerThrottle =0 ; - threshold = clock * data->fast_watermark_threshold /100 ; - data->display_timing.min_clock_in_sr = hwmgr->display_config->min_core_set_clock_in_sr;if (phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep))
@@ -1501,7 +1499,7 @@ static int fiji_populate_memory_timing_parameters(struct pp_hwmgr *hwmgr,uint32_t dram_timing;uint32_t dram_timing2;uint32_t burstTime; -ULONG state, trrds, trrdl; +ULONG trrds, trrdl;int result; result = atomctrl_set_engine_dram_timings_rv770(hwmgr,
@@ -1513,7 +1511,6 @@ static int fiji_populate_memory_timing_parameters(struct pp_hwmgr *hwmgr, dram_timing2 =cgs_read_register (hwmgr->device, mmMC_ARB_DRAM_TIMING2); burstTime =cgs_read_register (hwmgr->device, mmMC_ARB_BURST_TIME); - state =PHM_GET_FIELD (burstTime,MC_ARB_BURST_TIME ,STATE0 ); trrds =PHM_GET_FIELD (burstTime,MC_ARB_BURST_TIME ,TRRDS0 ); trrdl =PHM_GET_FIELD (burstTime,MC_ARB_BURST_TIME ,TRRDL0 );
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 129/459 drm/amdgpu: remove set but not used variable 'invalid'
In reply to Sasha LevinFrom: yu kuai <[email protected]>
[ Upstream commit 9e089a29c696d86d26e79737bafbce94738fb462 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c: In function ‘amdgpu_amdkfd_evict_userptr’:drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:1665:6: warning:
variable ‘invalid’ set but not used [-Wunused-but-set-variable]
'invalid' is never used, so can be removed. Thus 'atomic_inc_return' can be replaced as 'atomic_inc'
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +2 -2
@@ -1657,10 +1657,10 @@ int amdgpu_amdkfd_evict_userptr(struct kgd_mem *mem, struct mm_struct *mm) {struct amdkfd_process_info *process_info = mem->process_info; -int invalid, evicted_bos; +int evicted_bos;int r =0 ; - invalid =atomic_inc_return (&mem->invalid); +atomic_inc (&mem->invalid); evicted_bos =atomic_inc_return (&process_info->evicted_bos);if (evicted_bos ==1 ) {/* First eviction, stop the queues */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 111/459 clk: qcom: Don't overwrite 'cfg' in clk_rcg2_dfs_populate_freq()
In reply to Sasha LevinFrom: Stephen Boyd <[email protected]>
[ Upstream commit 21e157c62eeded8b1558a991b4820b761d48a730 ]
The DFS frequency table logic overwrites 'cfg' while detecting the parent clk and then later on in clk_rcg2_dfs_populate_freq() we use that same variable to figure out the mode of the clk, either MND or not. Add a new variable to hold the parent clk bit so that 'cfg' is left untouched for use later.
This fixes problems in detecting the supported frequencies for any clks in DFS mode.
--- drivers/clk/qcom/clk-rcg2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/qcom/clk-rcg2.c +4 -4
@@ -952,7 +952,7 @@ static void clk_rcg2_dfs_populate_freq(struct clk_hw *hw, unsigned int l,struct clk_rcg2 *rcg =to_clk_rcg2 (hw);struct clk_hw *p;unsigned long prate =0 ; -u32 val, mask, cfg, mode; +u32 val, mask, cfg, mode, src;int i, num_parents;regmap_read (rcg->clkr.regmap, rcg->cmd_rcgr +SE_PERF_DFSR (l), &cfg);
@@ -962,12 +962,12 @@ static void clk_rcg2_dfs_populate_freq(struct clk_hw *hw, unsigned int l,if (cfg & mask) f->pre_div = cfg & mask; - cfg &=CFG_SRC_SEL_MASK ; - cfg >>=CFG_SRC_SEL_SHIFT ; + src = cfg &CFG_SRC_SEL_MASK ; + src >>=CFG_SRC_SEL_SHIFT ; num_parents =clk_hw_get_num_parents (hw);for (i =0 ; i < num_parents; i++) { -if (cfg == rcg->parent_map[i].cfg) { +if (src == rcg->parent_map[i].cfg) { f->src = rcg->parent_map[i].src; p =clk_hw_get_parent_by_index (&rcg->clkr.hw, i); prate =clk_hw_get_rate (p);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 127/459 drm/amdgpu: remove set but not used variable 'amdgpu_connector'
In reply to Sasha LevinFrom: yu kuai <[email protected]>
[ Upstream commit 4f2922d12d6c63d0f4aa4e859ad95aee6d0d4ea0 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c: In function ‘amdgpu_display_crtc_scaling_mode_fixup’:drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:693:27: warning: variable ‘amdgpu_connector’ set but not used [-Wunused-but-set-variable]
--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +0 -2
@@ -687,7 +687,6 @@ bool amdgpu_display_crtc_scaling_mode_fixup(struct drm_crtc *crtc,struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);struct amdgpu_encoder *amdgpu_encoder;struct drm_connector *connector; -struct amdgpu_connector *amdgpu_connector;u32 src_v =1 , dst_v =1 ;u32 src_h =1 , dst_h =1 ;
@@ -699,7 +698,6 @@ bool amdgpu_display_crtc_scaling_mode_fixup(struct drm_crtc *crtc,continue ; amdgpu_encoder =to_amdgpu_encoder (encoder); connector =amdgpu_get_connector_for_encoder (encoder); - amdgpu_connector =to_amdgpu_connector (connector);/* set scaling */ if (amdgpu_encoder->rmx_type ==RMX_OFF )
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 112/459 clk: qcom: rcg2: Don't crash if our parent can't be found; return an error
In reply to Sasha LevinFrom: Douglas Anderson <[email protected]>
[ Upstream commit 908b050114d8fefdddc57ec9fbc213c3690e7f5f ]
When I got my clock parenting slightly wrong I ended up with a crash that looked like this:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 ... pc : clk_hw_get_rate+0x14/0x44 ... Call trace: clk_hw_get_rate+0x14/0x44 _freq_tbl_determine_rate+0x94/0xfc clk_rcg2_determine_rate+0x2c/0x38 clk_core_determine_round_nolock+0x4c/0x88 clk_core_round_rate_nolock+0x6c/0xa8 clk_core_round_rate_nolock+0x9c/0xa8 clk_core_set_rate_nolock+0x70/0x180 clk_set_rate+0x3c/0x6c of_clk_set_defaults+0x254/0x360 platform_drv_probe+0x28/0xb0 really_probe+0x120/0x2dc driver_probe_device+0x64/0xfc device_driver_attach+0x4c/0x6c __driver_attach+0xac/0xc0 bus_for_each_dev+0x84/0xcc driver_attach+0x2c/0x38 bus_add_driver+0xfc/0x1d0 driver_register+0x64/0xf8 __platform_driver_register+0x4c/0x58 msm_drm_register+0x5c/0x60 ...
It turned out that clk_hw_get_parent_by_index() was returning NULL and we weren't checking. Let's check it so that we don't crash.
--- drivers/clk/qcom/clk-rcg2.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/clk/qcom/clk-rcg2.c +3 -0
@@ -217,6 +217,9 @@ static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f, clk_flags =clk_hw_get_flags (hw); p =clk_hw_get_parent_by_index (hw, index); +if (!p) +return -EINVAL ; +if (clk_flags &CLK_SET_RATE_PARENT ) { rate = f->freq;if (f->pre_div) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 133/459 drm/gma500: remove set but not used variable 'is_hdmi','is_crt'
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit 834c43a97f341d319aa7b74099bbce2c4e75bc72 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/gma500/cdv_intel_display.c: In function cdv_intel_crtc_mode_set:drivers/gpu/drm/gma500/cdv_intel_display.c:594:7: warning: variable is_hdmi set but not used [-Wunused-but-set-variable] drivers/gpu/drm/gma500/cdv_intel_display.c: In function cdv_intel_crtc_mode_set:drivers/gpu/drm/gma500/cdv_intel_display.c:593:7: warning: variable is_crt set but not used [-Wunused-but-set-variable]
They are not used since commit acd7ef927e06 ("gma500:
Update the Cedarview clock handling")
--- drivers/gpu/drm/gma500/cdv_intel_display.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/gma500/cdv_intel_display.c +2 -5
@@ -580,8 +580,8 @@ static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc,struct gma_clock_t clock;u32 dpll =0 , dspcntr, pipeconf;bool ok; -bool is_crt = false, is_lvds = false, is_tv = false; -bool is_hdmi = false, is_dp = false; +bool is_lvds = false, is_tv = false; +bool is_dp = false;struct drm_mode_config *mode_config = &dev->mode_config;struct drm_connector *connector;const struct gma_limit_t *limit;
@@ -605,10 +605,7 @@ static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc, is_tv = true;break ;case INTEL_OUTPUT_ANALOG : - is_crt = true; -break ;case INTEL_OUTPUT_HDMI : - is_hdmi = true;break ;case INTEL_OUTPUT_DISPLAYPORT : is_dp = true;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 128/459 drm/amdgpu: remove set but not used variable 'count'
In reply to Sasha LevinFrom: yu kuai <[email protected]>
[ Upstream commit a1bd079fca6219e18bb0892f0a7228a76dd6292c ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/amdkfd/kfd_device.c: In function ‘kgd2kfd_post_reset’:drivers/gpu/drm/amd/amdkfd/kfd_device.c:745:11: warning:
variable ‘count’ set but not used [-Wunused-but-set-variable]
'count' is never used, so can be removed. Thus 'atomic_dec_return' can be replaced as 'atomic_dec'
--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +2 -2
@@ -766,7 +766,7 @@ int kgd2kfd_pre_reset(struct kfd_dev *kfd)int kgd2kfd_post_reset (struct kfd_dev *kfd) { -int ret, count; +int ret;if (!kfd->init_complete)return 0 ;
@@ -776,7 +776,7 @@ int kgd2kfd_post_reset(struct kfd_dev *kfd) ret =kfd_resume (kfd);if (ret)return ret; - count =atomic_dec_return (&kfd_locked); +atomic_dec (&kfd_locked);atomic_set (&kfd->sram_ecc_flag,0 );
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 130/459 drm/amd/powerplay: remove set but not used variable 'us_mvdd'
In reply to Sasha LevinFrom: yu kuai <[email protected]>
[ Upstream commit 472b36a2ab67880e89d6b0cd0e243830e8cb75e1 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c: In function ‘vegam_populate_smc_acpi_level’:drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c:1117:11:
warning: variable 'us_mvdd' set but not used [-Wunused-but-set-variable]
It is never used, so can be removed.
--- drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c +0 -12
@@ -1114,7 +1114,6 @@ static int vegam_populate_smc_acpi_level(struct pp_hwmgr *hwmgr, (struct phm_ppt_v1_information *)(hwmgr->pptable);SMIO_Pattern vol_level;uint32_t mvdd; -uint16_t us_mvdd; table->ACPILevel.Flags &= ~PPSMC_SWSTATE_FLAG_DC ;
@@ -1168,17 +1167,6 @@ static int vegam_populate_smc_acpi_level(struct pp_hwmgr *hwmgr, "in Clock Dependency Table", ); - us_mvdd =0 ; -if ((SMU7_VOLTAGE_CONTROL_NONE == data->mvdd_control) || - (data->mclk_dpm_key_disabled)) - us_mvdd = data->vbios_boot_state.mvdd_bootup_value; -else { -if (!vegam_populate_mvdd_value (hwmgr, - data->dpm_table.mclk_table.dpm_levels[0 ].value, - &vol_level)) - us_mvdd = vol_level.Voltage; - } -if (!vegam_populate_mvdd_value (hwmgr,0 , &vol_level)) table->MemoryACPILevel.MinMvdd =PP_HOST_TO_SMC_UL (vol_level.Voltage);else
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 134/459 drm/gma500: remove set but not used variable 'channel_eq'
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit a7adabeece570b8a566dd592219410456676796e ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/gma500/cdv_intel_dp.c: In function cdv_intel_dp_complete_link_train:drivers/gpu/drm/gma500/cdv_intel_dp.c:1596:7: warning: variable channel_eq set but not used [-Wunused-but-set-variable]
It is never used, so remove it.
--- drivers/gpu/drm/gma500/cdv_intel_dp.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/gma500/cdv_intel_dp.c +0 -3
@@ -1594,7 +1594,6 @@ cdv_intel_dp_complete_link_train(struct gma_encoder *encoder) {struct drm_device *dev = encoder->base.dev;struct cdv_intel_dp *intel_dp = encoder->dev_priv; -bool channel_eq = false;int tries, cr_tries;u32 reg;uint32_t DP = intel_dp->DP;
@@ -1602,7 +1601,6 @@ cdv_intel_dp_complete_link_train(struct gma_encoder *encoder)/* channel equalization */ tries =0 ; cr_tries =0 ; - channel_eq = false;DRM_DEBUG_KMS ("\n" ); reg =DP |DP_LINK_TRAIN_PAT_2 ;
@@ -1648,7 +1646,6 @@ cdv_intel_dp_complete_link_train(struct gma_encoder *encoder)if (cdv_intel_channel_eq_ok (encoder)) {DRM_DEBUG_KMS ("PT2 train is done\n" ); - channel_eq = true;break ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 131/459 drm/gma500: remove set but not used variable 'htotal'
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit dfa703b6f91818fa9f652c00e3589c104c518930 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/gma500/oaktrail_hdmi.c: In function htotal_calculate:drivers/gpu/drm/gma500/oaktrail_hdmi.c:160:6: warning: variable htotal set but not used [-Wunused-but-set-variable]
It is introduced by commit 39ec748f7174 ("gma600: Enable HDMI support"), but never used, so remove it.
--- drivers/gpu/drm/gma500/oaktrail_hdmi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/gma500/oaktrail_hdmi.c +1 -3
@@ -159,9 +159,7 @@ static void oaktrail_hdmi_audio_disable(struct drm_device *dev)static unsigned int htotal_calculate (struct drm_display_mode *mode) { -u32 htotal, new_crtc_htotal; - - htotal = (mode->crtc_hdisplay -1 ) | ((mode->crtc_htotal -1 ) <<16 ); +u32 new_crtc_htotal;/* * 1024 x 768 new_crtc_htotal = 0x1024;
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 140/459 drm/radeon: remove set but not used variable 'backbias_response_time'
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit ac52caecbcf2c30ce95b2536c1caf2643c49b91c ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/radeon/si_dpm.c: In function si_program_response_times:drivers/gpu/drm/radeon/si_dpm.c:3640:29: warning: variable backbias_response_time set but not used [-Wunused-but-set-variable]
It is introduced by commit a9e61410921b ("drm/radeon/kms:
add dpm support for SI (v7)"), but never used, so remove it.
--- drivers/gpu/drm/radeon/si_dpm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/radeon/si_dpm.c +1 -2
@@ -3640,14 +3640,13 @@ static int si_notify_smc_display_change(struct radeon_device *rdev,static void si_program_response_times (struct radeon_device *rdev) { -u32 voltage_response_time, backbias_response_time, acpi_delay_time, vbi_time_out; +u32 voltage_response_time, acpi_delay_time, vbi_time_out;u32 vddc_dly, acpi_dly, vbi_dly;u32 reference_clock;si_write_smc_soft_register (rdev, SI_SMC_SOFT_REGISTER_mvdd_chg_time,1 ); voltage_response_time = (u32 )rdev->pm.dpm.voltage_response_time; - backbias_response_time = (u32 )rdev->pm.dpm.backbias_response_time;if (voltage_response_time ==0 ) voltage_response_time =1000 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 141/459 drm/radeon: remove set but not used variable 'dig_connector'
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit 3f47f0301594c4f930a32bd7d8125cfdeb6b4b6e ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/radeon/atombios_dp.c: In function radeon_dp_get_panel_mode:drivers/gpu/drm/radeon/atombios_dp.c:415:36: warning: variable dig_connector set but not used [-Wunused-but-set-variable]
It is not used since commit 379dfc25e257 ("drm/radeon/dp:
switch to the common i2c over aux code")
--- drivers/gpu/drm/radeon/atombios_dp.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/radeon/atombios_dp.c +0 -3
@@ -412,7 +412,6 @@ int radeon_dp_get_panel_mode(struct drm_encoder *encoder,struct drm_device *dev = encoder->dev;struct radeon_device *rdev = dev->dev_private;struct radeon_connector *radeon_connector =to_radeon_connector (connector); -struct radeon_connector_atom_dig *dig_connector;int panel_mode =DP_PANEL_MODE_EXTERNAL_DP_MODE ;u16 dp_bridge =radeon_connector_encoder_get_dp_bridge_encoder_id (connector);u8 tmp;
@@ -423,8 +422,6 @@ int radeon_dp_get_panel_mode(struct drm_encoder *encoder,if (!radeon_connector->con_priv)return panel_mode; - dig_connector = radeon_connector->con_priv; -if (dp_bridge !=ENCODER_OBJECT_ID_NONE ) {/* DP bridge chips */ if (drm_dp_dpcd_readb(&radeon_connector->ddc_bus->aux,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 136/459 drm/amd/display: remove set but not used variable 'old_plane_crtc'
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit d3b65841b31c0192f997e0f9bc64dccbfaa97bcc ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c: In function dm_determine_update_type_for_commit:drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:6516:36: warning: variable old_plane_crtc set but not used [-Wunused-but-set-variable]
It is introduced by commit a87fa9938749 ("drm/amd/display:
Build stream update and plane updates in dm"), but never used, so remove it.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -2
@@ -7040,7 +7040,7 @@ dm_determine_update_type_for_commit(struct amdgpu_display_manager *dm,int i, j, num_plane, ret =0 ;struct drm_plane_state *old_plane_state, *new_plane_state;struct dm_plane_state *new_dm_plane_state, *old_dm_plane_state; -struct drm_crtc *new_plane_crtc, *old_plane_crtc; +struct drm_crtc *new_plane_crtc;struct drm_plane *plane;struct drm_crtc *crtc;
@@ -7086,7 +7086,6 @@ dm_determine_update_type_for_commit(struct amdgpu_display_manager *dm,uint64_t tiling_flags; new_plane_crtc = new_plane_state->crtc; - old_plane_crtc = old_plane_state->crtc; new_dm_plane_state =to_dm_plane_state (new_plane_state); old_dm_plane_state =to_dm_plane_state (old_plane_state);
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 145/459 ath10k: correct the tlv len of ath10k_wmi_tlv_op_gen_config_pno_start
In reply to Sasha LevinFrom: Wen Gong <[email protected]>
[ Upstream commit e01cc82c4d1ec3bddcbb7cd991cf5dc0131ed9a1 ]
the tlv len is set to the total len of the wmi cmd, it will trigger firmware crash, correct the tlv len.
Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00017-QCARMSWP-1 and QCA6174 PCIE with firmware WLAN.RM.4.4.1-00110-QCARMSWPZ-1.
--- drivers/net/wireless/ath/ath10k/wmi-tlv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/wmi-tlv.c +4 -1
@@ -3650,6 +3650,7 @@ ath10k_wmi_tlv_op_gen_config_pno_start(struct ath10k *ar,struct wmi_tlv *tlv;struct sk_buff *skb;__le32 *channel_list; +u16 tlv_len;size_t len;void *ptr;u32 i;
@@ -3707,10 +3708,12 @@ ath10k_wmi_tlv_op_gen_config_pno_start(struct ath10k *ar,/* nlo_configured_parameters(nlo_list) */ cmd->no_of_ssids =__cpu_to_le32 (min_t (u8, pno->uc_networks_count,WMI_NLO_MAX_SSIDS )); + tlv_len =__le32_to_cpu (cmd->no_of_ssids) * +sizeof (struct nlo_configured_parameters ); tlv = ptr; tlv->tag =__cpu_to_le16 (WMI_TLV_TAG_ARRAY_STRUCT ); - tlv->len =__cpu_to_le16 (len); + tlv->len =__cpu_to_le16 (tlv_len); ptr +=sizeof (*tlv); nlo_list = ptr;
Signature · 7 lines
2.20.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 118/459 bpf, sockmap: Don't sleep while holding RCU lock on tear-down
In reply to Sasha LevinFrom: Jakub Sitnicki <[email protected]>
[ Upstream commit db6a5018b6e008c1d69c6628cdaa9541b8e70940 ]
rcu_read_lock is needed to protect access to psock inside sock_map_unref when tearing down the map. However, we can't afford to sleep in lock_sock while in RCU read-side critical section. Grab the RCU lock only after we have locked the socket.
This fixes RCU warnings triggerable on a VM with 1 vCPU when free'ing a sockmap/sockhash that contains at least one socket:
| =============================
| WARNING: suspicious RCU usage
| 5.5.0-04005-g8fc91b972b73 #450 Not tainted
| -----------------------------
| include/linux/rcupdate.h:272 Illegal context switch in RCU read-side critical section!
|
| other info that might help us debug this:
|
|
| rcu_scheduler_active = 2, debug_locks = 1
| 4 locks held by kworker/0:1/62:
| #0: ffff88813b019748 ((wq_completion)events){+.+.}, at: process_one_work+0x1d7/0x5e0
| #1: ffffc900000abe50 ((work_completion)(&map->work)){+.+.}, at: process_one_work+0x1d7/0x5e0
| #2: ffffffff82065d20 (rcu_read_lock){....}, at: sock_map_free+0x5/0x170
| #3: ffff8881368c5df8 (&stab->lock){+...}, at: sock_map_free+0x64/0x170
|
| stack backtrace:
| CPU: 0 PID: 62 Comm: kworker/0:1 Not tainted 5.5.0-04005-g8fc91b972b73 #450
| Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_073836-buildvm-ppc64le-16.ppc.fedoraproject.org-3.fc31 04/01/2014
| Workqueue: events bpf_map_free_deferred
| Call Trace:
| dump_stack+0x71/0xa0
| ___might_sleep+0x105/0x190
| lock_sock_nested+0x28/0x90
| sock_map_free+0x95/0x170
| bpf_map_free_deferred+0x58/0x80
| process_one_work+0x260/0x5e0
| worker_thread+0x4d/0x3e0
| kthread+0x108/0x140
| ? process_one_work+0x5e0/0x5e0
| ? kthread_park+0x90/0x90
| ret_from_fork+0x3a/0x50| =============================
| WARNING: suspicious RCU usage
| 5.5.0-04005-g8fc91b972b73-dirty #452 Not tainted
| -----------------------------
| include/linux/rcupdate.h:272 Illegal context switch in RCU read-side critical section!
|
| other info that might help us debug this:
|
|
| rcu_scheduler_active = 2, debug_locks = 1
| 4 locks held by kworker/0:1/62:
| #0: ffff88813b019748 ((wq_completion)events){+.+.}, at: process_one_work+0x1d7/0x5e0
| #1: ffffc900000abe50 ((work_completion)(&map->work)){+.+.}, at: process_one_work+0x1d7/0x5e0
| #2: ffffffff82065d20 (rcu_read_lock){....}, at: sock_hash_free+0x5/0x1d0
| #3: ffff888139966e00 (&htab->buckets[i].lock){+...}, at: sock_hash_free+0x92/0x1d0
|
| stack backtrace:
| CPU: 0 PID: 62 Comm: kworker/0:1 Not tainted 5.5.0-04005-g8fc91b972b73-dirty #452
| Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_073836-buildvm-ppc64le-16.ppc.fedoraproject.org-3.fc31 04/01/2014
| Workqueue: events bpf_map_free_deferred
| Call Trace:
| dump_stack+0x71/0xa0
| ___might_sleep+0x105/0x190
| lock_sock_nested+0x28/0x90
| sock_hash_free+0xec/0x1d0
| bpf_map_free_deferred+0x58/0x80
| process_one_work+0x260/0x5e0
| worker_thread+0x4d/0x3e0
| kthread+0x108/0x140
| ? process_one_work+0x5e0/0x5e0
| ? kthread_park+0x90/0x90
| ret_from_fork+0x3a/0x50--- net/core/sock_map.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/core/sock_map.c +4 -4
@@ -234,7 +234,6 @@ static void sock_map_free(struct bpf_map *map)int i;synchronize_rcu (); -rcu_read_lock ();raw_spin_lock_bh (&stab->lock);for (i =0 ; i < stab->map.max_entries; i++) {struct sock **psk = &stab->sks[i];
@@ -243,12 +242,13 @@ static void sock_map_free(struct bpf_map *map) sk =xchg (psk,NULL );if (sk) {lock_sock (sk); +rcu_read_lock ();sock_map_unref (sk, psk); +rcu_read_unlock ();release_sock (sk); } }raw_spin_unlock_bh (&stab->lock); -rcu_read_unlock ();/* wait for psock readers accessing its map link */ synchronize_rcu ();
@@ -864,19 +864,19 @@ static void sock_hash_free(struct bpf_map *map)int i;synchronize_rcu (); -rcu_read_lock ();for (i =0 ; i < htab->buckets_num; i++) { bucket =sock_hash_select_bucket (htab, i);raw_spin_lock_bh (&bucket->lock);hlist_for_each_entry_safe (elem, node, &bucket->head, node) {hlist_del_rcu (&elem->node);lock_sock (elem->sk); +rcu_read_lock ();sock_map_unref (elem->sk, elem); +rcu_read_unlock ();release_sock (elem->sk); }raw_spin_unlock_bh (&bucket->lock); } -rcu_read_unlock ();/* wait for psock readers accessing its map link */ synchronize_rcu ();
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 132/459 drm/gma500: remove set but not used variable 'error'
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit a5eb29a9d2fc03d07af7d02f6c2e7ae1e6d985f9 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/gma500/psb_irq.c: In function psb_sgx_interrupt:drivers/gpu/drm/gma500/psb_irq.c:210:6: warning: variable error set but not used [-Wunused-but-set-variable]
It is introduced by commit 64a4aff283ac ("drm/gma500:
Add support for SGX interrupts"), but never used, so remove it.
--- drivers/gpu/drm/gma500/psb_irq.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/gma500/psb_irq.c +0 -2
@@ -194,7 +194,6 @@ static void psb_sgx_interrupt(struct drm_device *dev, u32 stat_1, u32 stat_2) {struct drm_psb_private *dev_priv = dev->dev_private;u32 val, addr; -int error = false;if (stat_1 & _PSB_CE_TWOD_COMPLETE) val =PSB_RSGX32 (PSB_CR_2D_BLIT_STATUS );
@@ -229,7 +228,6 @@ static void psb_sgx_interrupt(struct drm_device *dev, u32 stat_1, u32 stat_2)DRM_ERROR ("\tMMU failing address is 0x%08x.\n" , (unsigned int )addr); - error = true; } }
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 135/459 drm/amdkfd: remove set but not used variable 'top_dev'
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit d191bd678153307573d615bb42da4fcca19fe477 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/amdkfd/kfd_iommu.c: In function kfd_iommu_device_init:drivers/gpu/drm/amd/amdkfd/kfd_iommu.c:65:30: warning: variable top_dev set but not used [-Wunused-but-set-variable]
--- drivers/gpu/drm/amd/amdkfd/kfd_iommu.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_iommu.c +0 -3
@@ -62,9 +62,6 @@ int kfd_iommu_device_init(struct kfd_dev *kfd)struct amd_iommu_device_info iommu_info;unsigned int pasid_limit;int err; -struct kfd_topology_device *top_dev; - - top_dev =kfd_topology_device_by_id (kfd->id);if (!kfd->device_info->needs_iommu_device)return 0 ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 139/459 drm/radeon: remove set but not used variable 'size', 'relocs_chunk'
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit e9f782dd22c0e17874b8b8e12aafcd3a06810dd0 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/radeon/r600_cs.c: In function r600_cs_track_validate_cb:drivers/gpu/drm/radeon/r600_cs.c:353:22: warning: variable size set but not used [-Wunused-but-set-variable] drivers/gpu/drm/radeon/r600_cs.c: In function r600_cs_track_validate_db:drivers/gpu/drm/radeon/r600_cs.c:520:27: warning: variable size set but not used [-Wunused-but-set-variable] drivers/gpu/drm/radeon/r600_cs.c: In function r600_dma_cs_next_reloc:drivers/gpu/drm/radeon/r600_cs.c:2345:26: warning: variable relocs_chunk set but not used [-Wunused-but-set-variable]
The first 'size' is not used since commit f30df2fad0c9 ("drm/radeon/r600:
fix tiling issues in CS checker.")
The second 'size' is introduced by commit 88f50c80748b ("drm/radeon/kms:
add htile support to the cs checker v3"), but never used, so remove it.
'relocs_chunk' is not used since commit 9305ede6afe2 ("radeon/kms:
fix dma relocation checking")
--- drivers/gpu/drm/radeon/r600_cs.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/r600_cs.c +2 -6
@@ -350,7 +350,7 @@ static void r600_cs_track_init(struct r600_cs_track *track)static int r600_cs_track_validate_cb (struct radeon_cs_parser *p,int i) {struct r600_cs_track *track = p->track; -u32 slice_tile_max, size, tmp; +u32 slice_tile_max, tmp;u32 height, height_align, pitch, pitch_align, depth_align;u64 base_offset, base_align;struct array_mode_checker array_check;
@@ -360,7 +360,6 @@ static int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i)/* When resolve is used, the second colorbuffer has always 1 sample. */ unsigned nsamples = track->is_resolve && i ==1 ?1 : track->nsamples; - size =radeon_bo_size (track->cb_color_bo[i]) - track->cb_color_bo_offset[i]; format =G_0280A0_FORMAT (track->cb_color_info[i]);if (!r600_fmt_is_valid_color (format)) { dev_warn(p->dev, "%s:%d cb invalid format %d for %d (0x%08X)\n",
@@ -517,7 +516,7 @@ static int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i)static int r600_cs_track_validate_db (struct radeon_cs_parser *p) {struct r600_cs_track *track = p->track; -u32 nviews, bpe, ntiles, size, slice_tile_max, tmp; +u32 nviews, bpe, ntiles, slice_tile_max, tmp;u32 height_align, pitch_align, depth_align;u32 pitch =8192 ;u32 height =8192 ;
@@ -564,7 +563,6 @@ static int r600_cs_track_validate_db(struct radeon_cs_parser *p) } ib[track->db_depth_size_idx] =S_028000_SLICE_TILE_MAX (tmp -1 ) | (track->db_depth_size &0x3FF ); }else { - size =radeon_bo_size (track->db_bo);/* pitch in pixels */ pitch = (G_028000_PITCH_TILE_MAX (track->db_depth_size) +1 ) *8 ; slice_tile_max =G_028000_SLICE_TILE_MAX (track->db_depth_size) +1 ;
@@ -2342,7 +2340,6 @@ int r600_cs_parse(struct radeon_cs_parser *p)int r600_dma_cs_next_reloc (struct radeon_cs_parser *p,struct radeon_bo_list **cs_reloc) { -struct radeon_cs_chunk *relocs_chunk;unsigned idx; *cs_reloc =NULL ;
@@ -2350,7 +2347,6 @@ int r600_dma_cs_next_reloc(struct radeon_cs_parser *p,DRM_ERROR ("No relocation chunk !\n" );return -EINVAL ; } - relocs_chunk = p->chunk_relocs; idx = p->dma_reloc_idx;if (idx >= p->nrelocs) { DRM_ERROR("Relocs at %d after relocations chunk end %d !\n",
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 149/459 modules: lockdep: Suppress suspicious RCU usage warning
In reply to Sasha LevinFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit bf08949cc8b98b7d1e20cfbba169a5938d42dae8 ]
While running kprobe module test, find_module_all() caused a suspicious RCU usage warning.
-----
=============================
WARNING: suspicious RCU usage
5.4.0-next-20191202+ #63 Not tainted
-----------------------------
kernel/module.c:619 RCU-list traversed in non-reader section!!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
1 lock held by rmmod/642:
#0: ffffffff8227da80 (module_mutex){+.+.}, at: __x64_sys_delete_module+0x9a/0x230
stack backtrace: CPU: 0 PID: 642 Comm: rmmod Not tainted 5.4.0-next-20191202+ #63 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014 Call Trace: dump_stack+0x71/0xa0 find_module_all+0xc1/0xd0 __x64_sys_delete_module+0xac/0x230 ? do_syscall_64+0x12/0x1f0 do_syscall_64+0x50/0x1f0 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4b6d49
-----
This is because list_for_each_entry_rcu(modules) is called without rcu_read_lock(). This is safe because the module_mutex is locked.
Pass lockdep_is_held(&module_mutex) to the list_for_each_entry_rcu() to suppress this warning, This also fixes similar issue in mod_find() and each_symbol_section().
--- kernel/module.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/module.c +6 -3
@@ -214,7 +214,8 @@ static struct module *mod_find(unsigned long addr) {struct module *mod; -list_for_each_entry_rcu (mod, &modules, list) { +list_for_each_entry_rcu (mod, &modules, list, +lockdep_is_held (&module_mutex)) {if (within_module (addr, mod))return mod; }
@@ -448,7 +449,8 @@ bool each_symbol_section(bool (*fn)(const struct symsearch *arr,if (each_symbol_in_section (arr,ARRAY_SIZE (arr),NULL , fn, data))return true; -list_for_each_entry_rcu (mod, &modules, list) { +list_for_each_entry_rcu (mod, &modules, list, +lockdep_is_held (&module_mutex)) {struct symsearch arr[] = { { mod->syms, mod->syms + mod->num_syms, mod->crcs,NOT_GPL_ONLY , false },
@@ -616,7 +618,8 @@ static struct module *find_module_all(const char *name, size_t len,module_assert_mutex_or_preempt (); -list_for_each_entry_rcu (mod, &modules, list) { +list_for_each_entry_rcu (mod, &modules, list, +lockdep_is_held (&module_mutex)) {if (!even_unformed && mod->state ==MODULE_STATE_UNFORMED )continue ;if (strlen (mod->name) == len && !memcmp (mod->name, name, len))
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 138/459 drm/amd/display: remove set but not used variable 'bp' in bios_parser.c
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit 7e30402bed151fc6222baafe5aa1abe3e65c3065 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c: In function bios_get_board_layout_info:drivers/gpu/drm/amd/display/dc/bios/bios_parser.c:2743:22: warning: variable bp set but not used [-Wunused-but-set-variable]
It is introduced by commit 1eeedbcc20d6 ("drm/amd/display:
get board layout for edid emulation"), but never used, so remove it.
--- drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +0 -2
@@ -2742,7 +2742,6 @@ static enum bp_result bios_get_board_layout_info( struct board_layout_info *board_layout_info) {unsigned int i; -struct bios_parser *bp;enum bp_result record_result;const unsigned int slot_index_to_vbios_id[MAX_BOARD_SLOTS ] = {
@@ -2751,7 +2750,6 @@ static enum bp_result bios_get_board_layout_info( 0, 0 }; - bp =BP_FROM_DCB (dcb);if (board_layout_info ==NULL ) {DC_LOG_DETECTION_EDID_PARSER ("Invalid board_layout_info\n" );return BP_RESULT_BADINPUT ;
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 137/459 drm/amd/display: remove set but not used variable 'bp' in bios_parser2.c
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit 589d8d282ebe1eab2dd8b1fba3e60322787a50e6 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c: In function bios_get_board_layout_info:drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c:1826:22: warning: variable bp set but not used [-Wunused-but-set-variable]
It is introduced by commit 1eeedbcc20d6 ("drm/amd/display:
get board layout for edid emulation"), but never used, so remove it.
--- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +0 -2
@@ -1829,7 +1829,6 @@ static enum bp_result bios_get_board_layout_info( struct board_layout_info *board_layout_info) {unsigned int i; -struct bios_parser *bp;enum bp_result record_result;const unsigned int slot_index_to_vbios_id[MAX_BOARD_SLOTS ] = {
@@ -1838,7 +1837,6 @@ static enum bp_result bios_get_board_layout_info( 0, 0 }; - bp =BP_FROM_DCB (dcb);if (board_layout_info ==NULL ) {DC_LOG_DETECTION_EDID_PARSER ("Invalid board_layout_info\n" );return BP_RESULT_BADINPUT ;
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 142/459 drm/radeon: remove set but not used variable 'radeon_connector'
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit 5952c48993375a9da2de39be30df475cf590b0ce ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/radeon/radeon_display.c: In function radeon_crtc_scaling_mode_fixup:drivers/gpu/drm/radeon/radeon_display.c:1685:27: warning: variable radeon_connector set but not used [-Wunused-but-set-variable]
It is not used since commit 377bd8a98d7d ("drm/radeon:
use a fetch function to get the edid")
--- drivers/gpu/drm/radeon/radeon_display.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/radeon/radeon_display.c +0 -2
@@ -1687,7 +1687,6 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,struct radeon_crtc *radeon_crtc =to_radeon_crtc (crtc);struct radeon_encoder *radeon_encoder;struct drm_connector *connector; -struct radeon_connector *radeon_connector;bool first = true;u32 src_v =1 , dst_v =1 ;u32 src_h =1 , dst_h =1 ;
@@ -1700,7 +1699,6 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,continue ; radeon_encoder =to_radeon_encoder (encoder); connector =radeon_get_connector_for_encoder (encoder); - radeon_connector =to_radeon_connector (connector);if (first) {/* set scaling */
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 144/459 drm/radeon: remove set but not used variable 'tv_pll_cntl1'
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit dc9b3dbd28744510b78490dc6312848a8f918749 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/radeon/radeon_legacy_tv.c: In function radeon_legacy_tv_mode_set:drivers/gpu/drm/radeon/radeon_legacy_tv.c:538:24: warning: variable tv_pll_cntl1 set but not used [-Wunused-but-set-variable]
It is introduced by commit 4ce001abafaf ("drm/radeon/kms:
add initial radeon tv-out support."), but never used, so remove it.
--- drivers/gpu/drm/radeon/radeon_legacy_tv.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpu/drm/radeon/radeon_legacy_tv.c +1 -7
@@ -537,7 +537,7 @@ void radeon_legacy_tv_mode_set(struct drm_encoder *encoder,uint32_t tv_master_cntl, tv_rgb_cntl, tv_dac_cntl;uint32_t tv_modulator_cntl1, tv_modulator_cntl2;uint32_t tv_vscaler_cntl1, tv_vscaler_cntl2; -uint32_t tv_pll_cntl, tv_pll_cntl1, tv_ftotal; +uint32_t tv_pll_cntl, tv_ftotal;uint32_t tv_y_fall_cntl, tv_y_rise_cntl, tv_y_saw_tooth_cntl;uint32_t m, n, p;const uint16_t *hor_timing;
@@ -709,12 +709,6 @@ void radeon_legacy_tv_mode_set(struct drm_encoder *encoder, (((n >>9 ) &RADEON_TV_N0HI_MASK ) <<RADEON_TV_N0HI_SHIFT ) | ((p &RADEON_TV_P_MASK ) <<RADEON_TV_P_SHIFT ); - tv_pll_cntl1 = (((4 &RADEON_TVPCP_MASK ) <<RADEON_TVPCP_SHIFT ) | - ((4 &RADEON_TVPVG_MASK ) <<RADEON_TVPVG_SHIFT ) | - ((1 &RADEON_TVPDC_MASK ) <<RADEON_TVPDC_SHIFT ) | -RADEON_TVCLK_SRC_SEL_TVPLL | -RADEON_TVPLL_TEST_DIS ); - tv_dac->tv.tv_uv_adr =0xc8 ; if (tv_dac->tv_std == TV_STD_NTSC ||
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 159/459 arm64: dts: allwinner: H6: Add PMU mode
In reply to Sasha LevinFrom: Andre Przywara <[email protected]>
[ Upstream commit 7aa9b9eb7d6a8fde7acbe0446444f7e3fae1fe3b ]
Add the Performance Monitoring Unit (PMU) device tree node to the H6 .dtsi, which tells DT users which interrupts are triggered by PMU overflow events on each core. The numbers come from the manual and have been checked in U-Boot and with perf in Linux.
Tested with perf record and taskset on a Pine H64.
--- arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +10 -0
@@ -70,6 +70,16 @@ clock-output-names = "ext_osc32k"; }; + pmu { + compatible = "arm,cortex-a53-pmu", + "arm,armv8-pmuv3"; + interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>; + interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>; + }; + psci { compatible = "arm,psci-0.2"; method = "smc";
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 143/459 drm/radeon: remove set but not used variable 'blocks'
In reply to Sasha LevinFrom: zhengbin <[email protected]>
[ Upstream commit 77441f77949807fda4a0aec0bdf3e86ae863fd56 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/radeon/radeon_combios.c: In function radeon_combios_get_power_modes:drivers/gpu/drm/radeon/radeon_combios.c:2638:10: warning: variable blocks set but not used [-Wunused-but-set-variable]
It is introduced by commit 56278a8edace ("drm/radeon/kms:
pull power mode info from bios tables (v3)"), but never used, so remove it.
--- drivers/gpu/drm/radeon/radeon_combios.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_combios.c +1 -2
@@ -2638,7 +2638,7 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev) {struct drm_device *dev = rdev->ddev;u16 offset, misc, misc2 =0 ; -u8 rev, blocks, tmp; +u8 rev, tmp;int state_index =0 ;struct radeon_i2c_bus_rec i2c_bus;
@@ -2731,7 +2731,6 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev) offset =combios_get_table_offset (dev,COMBIOS_POWERPLAY_INFO_TABLE );if (offset) { rev =RBIOS8 (offset); - blocks =RBIOS8 (offset +0x2 );/* power mode 0 tends to be the only valid one */ rdev->pm.power_state[state_index].num_clock_modes =1 ; rdev->pm.power_state[state_index].clock_info[0 ].mclk =RBIOS32 (offset +0x5 +0x2 );
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 160/459 arm64: dts: allwinner: H5: Add PMU node
In reply to Sasha LevinFrom: Andre Przywara <[email protected]>
[ Upstream commit c35a516a46187c8eeb7a56c64505ec6f7e22a0c7 ]
Add the Performance Monitoring Unit (PMU) device tree node to the H5 .dtsi, which tells DT users which interrupts are triggered by PMU overflow events on each core.
As with the A64, the interrupt numbers from the manual were wrong (off by 4), the actual SPI IDs have been gathered in U-Boot, and were verified with perf in Linux.
Tested with perf record and taskset on an OrangePi PC2.
--- arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi +13 -3
@@ -54,21 +54,21 @@ enable-method = "psci"; }; - cpu@1 { + cpu1: cpu@1 { compatible = "arm,cortex-a53"; device_type = "cpu"; reg = <1>; enable-method = "psci"; }; - cpu@2 { + cpu2: cpu@2 { compatible = "arm,cortex-a53"; device_type = "cpu"; reg = <2>; enable-method = "psci"; }; - cpu@3 { + cpu3: cpu@3 { compatible = "arm,cortex-a53"; device_type = "cpu"; reg = <3>;
@@ -76,6 +76,16 @@ }; }; + pmu { + compatible = "arm,cortex-a53-pmu", + "arm,armv8-pmuv3"; + interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>; + interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>; + }; + psci { compatible = "arm,psci-0.2"; method = "smc";
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 146/459 drm/amdgpu: Ensure ret is always initialized when using SOC15_WAIT_ON_RREG
In reply to Sasha LevinFrom: Nathan Chancellor <[email protected]>
[ Upstream commit a63141e31764f8daf3f29e8e2d450dcf9199d1c8 ]
Commit b0f3cd3191cd ("drm/amdgpu: remove unnecessary JPEG2.0 code from VCN2.0") introduced a new clang warning in the vcn_v2_0_stop function:
../drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1082:2: warning: variable 'r' is used uninitialized whenever 'while' loop exits because its condition is false [-Wsometimes-uninitialized]
SOC15_WAIT_ON_RREG(VCN, 0, mmUVD_STATUS, UVD_STATUS__IDLE, 0x7, r);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../drivers/gpu/drm/amd/amdgpu/../amdgpu/soc15_common.h:55:10: note:
expanded from macro 'SOC15_WAIT_ON_RREG'
while ((tmp_ & (mask)) != (expected_value)) { \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1083:6: note: uninitialized use
occurs here
if (r)
^
../drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1082:2: note: remove the
condition if it is always true
SOC15_WAIT_ON_RREG(VCN, 0, mmUVD_STATUS, UVD_STATUS__IDLE, 0x7, r);
^
../drivers/gpu/drm/amd/amdgpu/../amdgpu/soc15_common.h:55:10: note:
expanded from macro 'SOC15_WAIT_ON_RREG'
while ((tmp_ & (mask)) != (expected_value)) { \
^
../drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c:1072:7: note: initialize the
variable 'r' to silence this warning
int r;
^
= 01 warning generated.
To prevent warnings like this from happening in the future, make the SOC15_WAIT_ON_RREG macro initialize its ret variable before the while loop that can time out. This macro's return value is always checked so it should set ret in both the success and fail path.
--- drivers/gpu/drm/amd/amdgpu/soc15_common.h | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/soc15_common.h +1 -0
@@ -52,6 +52,7 @@uint32_t old_ =0 ; \ uint32_t tmp_ = RREG32(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg); \uint32_t loop = adev->usec_timeout; \ + ret =0 ; \while ((tmp_ & (mask)) != (expected_value)) { \if (old_ != tmp_) { \ loop = adev->usec_timeout; \
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 147/459 drm/panel: simple: Add Logic PD Type 28 display support
In reply to Sasha LevinFrom: Adam Ford <[email protected]>
[ Upstream commit 0d35408afbeb603bc9972ae91e4dd2638bcffe52 ]
Previously, there was an omap panel-dpi driver that would read generic timings from the device tree and set the display timing accordingly. This driver was removed so the screen no longer functions. This patch modifies the panel-simple file to setup the timings to the same values previously used.
--- drivers/gpu/drm/panel/panel-simple.c | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
drivers/gpu/drm/panel/panel-simple.c +37 -0
@@ -2048,6 +2048,40 @@ static const struct drm_display_mode mitsubishi_aa070mc01_mode = { .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, }; +static const struct drm_display_mode logicpd_type_28_mode = { + .clock =9000 , + .hdisplay =480 , + .hsync_start =480 +3 , + .hsync_end =480 +3 +42 , + .htotal =480 +3 +42 +2 , + + .vdisplay =272 , + .vsync_start =272 +2 , + .vsync_end =272 +2 +11 , + .vtotal =272 +2 +11 +3 , + .vrefresh =60 , + .flags =DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_PVSYNC , +}; + +static const struct panel_desc logicpd_type_28 = { + .modes = &logicpd_type_28_mode, + .num_modes =1 , + .bpc =8 , + .size = { + .width =105 , + .height =67 , + }, + .delay = { + .prepare =200 , + .enable =200 , + .unprepare =200 , + .disable =200 , + }, + .bus_format =MEDIA_BUS_FMT_RGB888_1X24 , + .bus_flags =DRM_BUS_FLAG_DE_HIGH |DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE | +DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE , +}; +static const struct panel_desc mitsubishi_aa070mc01 = { .modes = &mitsubishi_aa070mc01_mode, .num_modes =1 ,
@@ -3264,6 +3298,9 @@ static const struct of_device_id platform_of_match[] = { }, { .compatible = "lg,lp129qe", .data = &lg_lp129qe, + }, { + .compatible = "logicpd,type28", + .data = &logicpd_type_28, }, { .compatible = "mitsubishi,aa070mc01-ca1", .data = &mitsubishi_aa070mc01,
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 166/459 selinux: ensure we cleanup the internal AVC counters on error in avc_insert()
In reply to Sasha LevinFrom: Paul Moore <[email protected]>
[ Upstream commit d8db60cb23e49a92cf8cada3297395c7fa50fdf8 ]
Fix avc_insert() to call avc_node_kill() if we've already allocated an AVC node and the code fails to insert the node in the cache.
--- security/selinux/avc.c | 51 ++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 27 deletions(-)
security/selinux/avc.c +24 -27
@@ -617,40 +617,37 @@ static struct avc_node *avc_insert(struct selinux_avc *avc,struct avc_node *pos, *node =NULL ;int hvalue;unsigned long flag; +spinlock_t *lock; +struct hlist_head *head;if (avc_latest_notif_update (avc, avd->seqno,1 )) - goto out; +return NULL ; node =avc_alloc_node (avc); -if (node) { -struct hlist_head *head; -spinlock_t *lock; -int rc =0 ; - - hvalue =avc_hash (ssid, tsid, tclass); -avc_node_populate (node, ssid, tsid, tclass, avd); - rc =avc_xperms_populate (node, xp_node); -if (rc) { -kmem_cache_free (avc_node_cachep, node); -return NULL ; - } - head = &avc->avc_cache.slots[hvalue]; - lock = &avc->avc_cache.slots_lock[hvalue]; +if (!node) +return NULL ; -spin_lock_irqsave (lock, flag); -hlist_for_each_entry (pos, head, list) { -if (pos->ae.ssid == ssid && - pos->ae.tsid == tsid && - pos->ae.tclass == tclass) { -avc_node_replace (avc, node, pos); - goto found; - } +avc_node_populate (node, ssid, tsid, tclass, avd); +if (avc_xperms_populate (node, xp_node)) { +avc_node_kill (avc, node); +return NULL ; + } + + hvalue =avc_hash (ssid, tsid, tclass); + head = &avc->avc_cache.slots[hvalue]; + lock = &avc->avc_cache.slots_lock[hvalue]; +spin_lock_irqsave (lock, flag); +hlist_for_each_entry (pos, head, list) { +if (pos->ae.ssid == ssid && + pos->ae.tsid == tsid && + pos->ae.tclass == tclass) { +avc_node_replace (avc, node, pos); + goto found; } -hlist_add_head_rcu (&node->list, head); -found: -spin_unlock_irqrestore (lock, flag); } -out: +hlist_add_head_rcu (&node->list, head); +found: +spin_unlock_irqrestore (lock, flag);return node; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 167/459 arm64: dts: qcom: msm8996: Disable USB2 PHY suspend by core
In reply to Sasha LevinFrom: Manu Gautam <[email protected]>
[ Upstream commit d026c96b25b7ce5df89526aad2df988d553edb4d ]
QUSB2 PHY on msm8996 doesn't work well when autosuspend by dwc3 core using USB2PHYCFG register is enabled. One of the issue seen is that PHY driver reports PLL lock failure and fails phy_init() if dwc3 core has USB2 PHY suspend enabled. Fix this by using quirks to disable USB2 PHY LPM/suspend and dwc3 core already takes care of explicitly suspending PHY during suspend if quirks are specified.
--- arch/arm64/boot/dts/qcom/msm8996.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/qcom/msm8996.dtsi +4 -0
@@ -1598,6 +1598,8 @@ interrupts = <0 138 IRQ_TYPE_LEVEL_HIGH>; phys = <&hsusb_phy2>; phy-names = "usb2-phy"; + snps,dis_u2_susphy_quirk; + snps,dis_enblslpm_quirk; }; };
@@ -1628,6 +1630,8 @@ interrupts = <0 131 IRQ_TYPE_LEVEL_HIGH>; phys = <&hsusb_phy1>, <&ssusb_phy_0>; phy-names = "usb2-phy", "usb3-phy"; + snps,dis_u2_susphy_quirk; + snps,dis_enblslpm_quirk; }; };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 169/459 padata: always acquire cpu_hotplug_lock before pinst->lock
In reply to Sasha LevinFrom: Daniel Jordan <[email protected]>
[ Upstream commit 38228e8848cd7dd86ccb90406af32de0cad24be3 ]
lockdep complains when padata's paths to update cpumasks via CPU hotplug and sysfs are both taken:
# echo 0 > /sys/devices/system/cpu/cpu1/online # echo ff > /sys/kernel/pcrypt/pencrypt/parallel_cpumask
======================================================
WARNING: possible circular locking dependency detected 5.4.0-rc8-padata-cpuhp-v3+ #1 Not tainted
------------------------------------------------------
bash/205 is trying to acquire lock:
ffffffff8286bcd0 (cpu_hotplug_lock.rw_sem){++++}, at: padata_set_cpumask+0x2b/0x120
but task is already holding lock:
ffff8880001abfa0 (&pinst->lock){+.+.}, at: padata_set_cpumask+0x26/0x120
which lock already depends on the new lock.
padata doesn't take cpu_hotplug_lock and pinst->lock in a consistent order. Which should be first? CPU hotplug calls into padata with cpu_hotplug_lock already held, so it should have priority.
--- kernel/padata.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/padata.c +2 -2
@@ -643,8 +643,8 @@ int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type,struct cpumask *serial_mask, *parallel_mask;int err = -EINVAL ; -mutex_lock (&pinst->lock);get_online_cpus (); +mutex_lock (&pinst->lock);switch (cpumask_type) {case PADATA_CPU_PARALLEL :
@@ -662,8 +662,8 @@ int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type, err =__padata_set_cpumasks (pinst, parallel_mask, serial_mask); out: -put_online_cpus ();mutex_unlock (&pinst->lock); +put_online_cpus ();return err; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 170/459 dmaengine: axi-dmac: add a check for devm_regmap_init_mmio
In reply to Sasha LevinFrom: Chuhong Yuan <[email protected]>
[ Upstream commit a5b982af953bcc838cd198b0434834cc1dff14ec ]
The driver misses checking the result of devm_regmap_init_mmio(). Add a check to fix it.
--- drivers/dma/dma-axi-dmac.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/dma/dma-axi-dmac.c +9 -1
@@ -830,6 +830,7 @@ static int axi_dmac_probe(struct platform_device *pdev)struct dma_device *dma_dev;struct axi_dmac *dmac;struct resource *res; +struct regmap *regmap;int ret; dmac =devm_kzalloc (&pdev->dev,sizeof (*dmac),GFP_KERNEL );
@@ -921,10 +922,17 @@ static int axi_dmac_probe(struct platform_device *pdev)platform_set_drvdata (pdev, dmac); -devm_regmap_init_mmio (&pdev->dev, dmac->base, &axi_dmac_regmap_config); + regmap =devm_regmap_init_mmio (&pdev->dev, dmac->base, + &axi_dmac_regmap_config); +if (IS_ERR (regmap)) { + ret =PTR_ERR (regmap); + goto err_free_irq; + }return 0 ; +err_free_irq: +free_irq (dmac->irq, dmac); err_unregister_of:of_dma_controller_free (pdev->dev.of_node); err_unregister_device:
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 174/459 ARM: dts: imx6: rdu2: Limit USBH1 to Full Speed
In reply to Sasha LevinFrom: Andrey Smirnov <[email protected]>
[ Upstream commit 6bb1e09c4c375db29770444f689f35f5cbe696bc ]
Cabling used to connect devices to USBH1 on RDU2 does not meet USB spec cable quality and cable length requirements to operate at High Speed, so limit the port to Full Speed only.
--- arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi +1 -0
@@ -774,6 +774,7 @@ &usbh1 { vbus-supply = <®_5p0v_main>; disable-over-current; + maximum-speed = "full-speed"; status = "okay"; };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 182/459 gpu/drm: ingenic: Avoid null pointer deference in plane atomic update
In reply to Sasha LevinFrom: Paul Cercueil <[email protected]>
[ Upstream commit 354b051c5dcbeb35bbfd5d54161364fc7a75a58a ]
It is possible that there is no drm_framebuffer associated with a given plane state.
v2: Handle drm_plane->state which can be NULL too
# *** extracted tags ***
--- drivers/gpu/drm/ingenic/ingenic-drm.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/ingenic/ingenic-drm.c +10 -6
@@ -371,14 +371,18 @@ static void ingenic_drm_plane_atomic_update(struct drm_plane *plane,struct ingenic_drm *priv =drm_plane_get_priv (plane);struct drm_plane_state *state = plane->state;unsigned int width, height, cpp; +dma_addr_t addr; - width = state->crtc->state->adjusted_mode.hdisplay; - height = state->crtc->state->adjusted_mode.vdisplay; - cpp = state->fb->format->cpp[plane->index]; +if (state && state->fb) { + addr =drm_fb_cma_get_gem_addr (state->fb, state,0 ); + width = state->crtc->state->adjusted_mode.hdisplay; + height = state->crtc->state->adjusted_mode.vdisplay; + cpp = state->fb->format->cpp[plane->index]; - priv->dma_hwdesc->addr =drm_fb_cma_get_gem_addr (state->fb, state,0 ); - priv->dma_hwdesc->cmd = width * height * cpp /4 ; - priv->dma_hwdesc->cmd |=JZ_LCD_CMD_EOF_IRQ ; + priv->dma_hwdesc->addr = addr; + priv->dma_hwdesc->cmd = width * height * cpp /4 ; + priv->dma_hwdesc->cmd |=JZ_LCD_CMD_EOF_IRQ ; + } } static void ingenic_drm_encoder_atomic_mode_set(struct drm_encoder *encoder,
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 150/459 arm64: dts: uDPU: fix broken ethernet
In reply to Sasha LevinFrom: Russell King <[email protected]>
[ Upstream commit 1eebac0240580b531954b02c05068051df41142a ]
The uDPU uses both ethernet controllers, which ties up COMPHY 0 for eth1 and COMPHY 1 for eth0, with no USB3 comphy. The addition of COMPHY support made the kernel override the setup by the boot loader breaking this platform by assuming that COMPHY 0 was always used for USB3. Delete the USB3 COMPHY definition at platform level, and add phy specifications for the ethernet channels.
--- arch/arm64/boot/dts/marvell/armada-3720-uDPU.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/marvell/armada-3720-uDPU.dts +4 -0
@@ -143,6 +143,7 @@ phy-mode = "sgmii"; status = "okay"; managed = "in-band-status"; + phys = <&comphy1 0>; sfp = <&sfp_eth0>; };
@@ -150,11 +151,14 @@ phy-mode = "sgmii"; status = "okay"; managed = "in-band-status"; + phys = <&comphy0 1>; sfp = <&sfp_eth1>; }; &usb3 { status = "okay"; + phys = <&usb2_utmi_otg_phy>; + phy-names = "usb2-utmi-otg-phy"; }; &uart0 {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 183/459 selftests/net: make so_txtime more robust to timer variance
In reply to Sasha LevinFrom: Willem de Bruijn <[email protected]>
[ Upstream commit ea6a547669b37453f2b1a5d85188d75b3613dfaa ]
The SO_TXTIME test depends on accurate timers. In some virtualized environments the test has been reported to be flaky. This is easily reproduced by disabling kvm acceleration in Qemu.
Allow greater variance in a run and retry to further reduce flakiness.
Observed errors are one of two kinds: either the packet arrives too early or late at recv(), or it was dropped in the qdisc itself and the recv() call times out.
In the latter case, the qdisc queues a notification to the error queue of the send socket. Also explicitly report this cause.
--- tools/testing/selftests/net/so_txtime.c | 84 +++++++++++++++++++++++- tools/testing/selftests/net/so_txtime.sh | 9 ++- 2 files changed, 88 insertions(+), 5 deletions(-)
tools/testing/selftests/net/so_txtime.c +81 -3
@@ -12,7 +12,11 @@#include <arpa/inet.h> #include <error.h> #include <errno.h> +#include <inttypes.h> #include <linux/net_tstamp.h> +#include <linux/errqueue.h> +#include <linux/ipv6.h> +#include <linux/tcp.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h>
@@ -28,7 +32,7 @@ static int cfg_clockid = CLOCK_TAI;static bool cfg_do_ipv4;static bool cfg_do_ipv6;static uint16_t cfg_port =8000 ; -static int cfg_variance_us =2000 ; +static int cfg_variance_us =4000 ;static uint64_t glob_tstart;
@@ -43,6 +47,9 @@ static struct timed_send cfg_in[MAX_NUM_PKT];static struct timed_send cfg_out[MAX_NUM_PKT ];static int cfg_num_pkt; +static int cfg_errq_level; +static int cfg_errq_type; +static uint64_t gettime_ns (void ) {struct timespec ts;
@@ -90,13 +97,15 @@ static void do_send_one(int fdt, struct timed_send *ts) } -static void do_recv_one (int fdr,struct timed_send *ts) +static bool do_recv_one (int fdr,struct timed_send *ts) {int64_t tstop, texpect;char rbuf[2 ];int ret; ret =recv (fdr, rbuf,sizeof (rbuf),0 ); +if (ret ==-1 && errno ==EAGAIN ) +return true;if (ret ==-1 )error (1 , errno,"read" );if (ret !=1 )
@@ -113,6 +122,8 @@ static void do_recv_one(int fdr, struct timed_send *ts)if (labs (tstop - texpect) > cfg_variance_us)error (1 ,0 ,"exceeds variance (%d us)" , cfg_variance_us); + +return false; }static void do_recv_verify_empty (int fdr)
@@ -125,12 +136,70 @@ static void do_recv_verify_empty(int fdr)error (1 ,0 ,"recv: not empty as expected (%d, %d)" , ret, errno); } +static void do_recv_errqueue_timeout (int fdt) +{ +char control[CMSG_SPACE (sizeof (struct sock_extended_err )) + +CMSG_SPACE (sizeof (struct sockaddr_in6 ))] = {0 }; +char data[sizeof (struct ipv6hdr ) + +sizeof (struct tcphdr ) +1 ]; +struct sock_extended_err *err; +struct msghdr msg = {0 }; +struct iovec iov = {0 }; +struct cmsghdr *cm; +int64_t tstamp =0 ; +int ret; + + iov.iov_base = data; + iov.iov_len =sizeof (data); + + msg.msg_iov = &iov; + msg.msg_iovlen =1 ; + + msg.msg_control = control; + msg.msg_controllen =sizeof (control); + +while (1 ) { + ret =recvmsg (fdt, &msg,MSG_ERRQUEUE ); +if (ret ==-1 && errno ==EAGAIN ) +break ; +if (ret ==-1 ) +error (1 , errno,"errqueue" ); +if (msg.msg_flags !=MSG_ERRQUEUE ) +error (1 ,0 ,"errqueue: flags 0x%x\n" , msg.msg_flags); + + cm =CMSG_FIRSTHDR (&msg); +if (cm->cmsg_level != cfg_errq_level || + cm->cmsg_type != cfg_errq_type) +error (1 ,0 ,"errqueue: type 0x%x.0x%x\n" , + cm->cmsg_level, cm->cmsg_type); + + err = (struct sock_extended_err *)CMSG_DATA (cm); +if (err->ee_origin !=SO_EE_ORIGIN_TXTIME ) +error (1 ,0 ,"errqueue: origin 0x%x\n" , err->ee_origin); +if (err->ee_code !=ECANCELED ) +error (1 ,0 ,"errqueue: code 0x%x\n" , err->ee_code); + + tstamp = ((int64_t ) err->ee_data) <<32 | err->ee_info; + tstamp -= (int64_t ) glob_tstart; + tstamp /=1000 *1000 ; +fprintf (stderr,"send: pkt %c at %" PRId64"ms dropped\n" , + data[ret -1 ], tstamp); + + msg.msg_flags =0 ; + msg.msg_controllen =sizeof (control); + } + +error (1 ,0 ,"recv: timeout" ); +} +static void setsockopt_txtime (int fd) {struct sock_txtime so_txtime_val = { .clockid = cfg_clockid };struct sock_txtime so_txtime_val_read = {0 };socklen_t vallen =sizeof (so_txtime_val); + so_txtime_val.flags =SOF_TXTIME_REPORT_ERRORS ; +if (setsockopt (fd,SOL_SOCKET ,SO_TXTIME , &so_txtime_val,sizeof (so_txtime_val)))error (1 , errno,"setsockopt txtime" );
@@ -194,7 +263,8 @@ static void do_test(struct sockaddr *addr, socklen_t alen)for (i =0 ; i < cfg_num_pkt; i++)do_send_one (fdt, &cfg_in[i]);for (i =0 ; i < cfg_num_pkt; i++) -do_recv_one (fdr, &cfg_out[i]); +if (do_recv_one (fdr, &cfg_out[i])) +do_recv_errqueue_timeout (fdt);do_recv_verify_empty (fdr);
@@ -280,6 +350,10 @@ int main(int argc, char **argv) addr6.sin6_family =AF_INET6 ; addr6.sin6_port =htons (cfg_port); addr6.sin6_addr = in6addr_loopback; + + cfg_errq_level =SOL_IPV6 ; + cfg_errq_type =IPV6_RECVERR ; +do_test ((void *)&addr6,sizeof (addr6)); }
@@ -289,6 +363,10 @@ int main(int argc, char **argv) addr4.sin_family =AF_INET ; addr4.sin_port =htons (cfg_port); addr4.sin_addr.s_addr =htonl (INADDR_LOOPBACK ); + + cfg_errq_level =SOL_IP ; + cfg_errq_type =IP_RECVERR ; +do_test ((void *)&addr4,sizeof (addr4)); }
tools/testing/selftests/net/so_txtime.sh +7 -2
@@ -5,7 +5,12 @@ # Run in network namespace if [[ $# -eq 0 ]]; then - ./in_netns.sh $0 __subprocess + if ! ./in_netns.sh $0 __subprocess; then + # test is time sensitive, can be flaky + echo "test failed: retry once" + ./in_netns.sh $0 __subprocess + fi + exit $? fi
@@ -18,7 +23,7 @@ tc qdisc add dev lo root fq ./so_txtime -4 -6 -c mono a,10,b,20 a,10,b,20 ./so_txtime -4 -6 -c mono a,20,b,10 b,20,a,20 -if tc qdisc replace dev lo root etf clockid CLOCK_TAI delta 200000; then +if tc qdisc replace dev lo root etf clockid CLOCK_TAI delta 400000; then ! ./so_txtime -4 -6 -c tai a,-1 a,-1 ! ./so_txtime -4 -6 -c tai a,0 a,0 ./so_txtime -4 -6 -c tai a,10 a,10
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 186/459 samples/bpf: Set -fno-stack-protector when building BPF programs
In reply to Sasha LevinFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 450278977acbf494a20367c22fbb38729772d1fc ]
It seems Clang can in some cases turn on stack protection by default, which doesn't work with BPF. This was reported once before[0], but it seems the flag to explicitly turn off the stack protector wasn't added to the Makefile, so do that now.
The symptom of this is compile errors like the following:
error: <unknown>:0:0: in function bpf_prog1 i32 (%struct.__sk_buff*): A call to built-in function '__stack_chk_fail' is not supported.
[0] https://www.spinics.net/lists/netdev/msg556400.html
--- samples/bpf/Makefile | 1 + 1 file changed, 1 insertion(+)
samples/bpf/Makefile +1 -0
@@ -219,6 +219,7 @@ BTF_LLVM_PROBE := $(shell echo "int main() { return 0; }" | \ readelf -S ./llvm_btf_verify.o | grep BTF; \ /bin/rm -f ./llvm_btf_verify.o) +BPF_EXTRA_CFLAGS += -fno-stack-protector ifneq ($(BTF_LLVM_PROBE),) EXTRA_CFLAGS += -g else
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 156/459 NFC: port100: Convert cpu_to_le16(le16_to_cpu(E1) + E2) to use le16_add_cpu().
In reply to Sasha LevinFrom: Mao Wenan <[email protected]>
[ Upstream commit 718eae277e62a26e5862eb72a830b5e0fe37b04a ]
Convert cpu_to_le16(le16_to_cpu(frame->datalen) + len) to use le16_add_cpu(), which is more concise and does the same thing.
--- drivers/nfc/port100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nfc/port100.c +1 -1
@@ -565,7 +565,7 @@ static void port100_tx_update_payload_len(void *_frame, int len) {struct port100_frame *frame = _frame; - frame->datalen =cpu_to_le16 (le16_to_cpu (frame->datalen) + len); +le16_add_cpu (&frame->datalen, len); }static bool port100_rx_frame_is_valid (void *_frame)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 190/459 ARM: OMAP2+: pdata-quirks: add PRM data for reset support
In reply to Sasha LevinFrom: Tero Kristo <[email protected]>
[ Upstream commit 8de44fb70659a5bc0c53a443e6129ea1bf00fd8b ]
The parent clockdomain for reset must be in force wakeup mode, otherwise the reset may never complete. Add pdata quirks for this purpose for PRM driver.
--- arch/arm/mach-omap2/pdata-quirks.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/mach-omap2/pdata-quirks.c +8 -0
@@ -24,6 +24,7 @@#include <linux/platform_data/ti-sysc.h> #include <linux/platform_data/wkup_m3.h> #include <linux/platform_data/asoc-ti-mcbsp.h> +#include <linux/platform_data/ti-prm.h> #include "clockdomain.h" #include "common.h"
@@ -463,6 +464,12 @@ void omap_pcs_legacy_init(int irq, void (*rearm)(void)) pcs_pdata.rearm = rearm; } +static struct ti_prm_platform_data ti_prm_pdata = { + .clkdm_deny_idle = clkdm_deny_idle, + .clkdm_allow_idle = clkdm_allow_idle, + .clkdm_lookup = clkdm_lookup, +}; +/* * GPIOs for TWL are initialized by the I2C bus and need custom * handing until DSS has device tree bindings.
@@ -565,6 +572,7 @@ static struct of_dev_auxdata omap_auxdata_lookup[] = {/* Common auxdata */ OF_DEV_AUXDATA ("ti,sysc" ,0 ,NULL , &ti_sysc_pdata),OF_DEV_AUXDATA ("pinctrl-single" ,0 ,NULL , &pcs_pdata), + OF_DEV_AUXDATA("ti,omap-prm-inst", 0, NULL, &ti_prm_pdata), { /* sentinel */ }, };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 164/459 tty: omap-serial: remove set but unused variable
In reply to Sasha LevinFrom: Xiongfeng Wang <[email protected]>
[ Upstream commit e83c6587c47caa2278aa3bd603b5a85eddc4cec9 ]
Fix the following warning:drivers/tty/serial/omap-serial.c: In function serial_omap_rlsi:drivers/tty/serial/omap-serial.c:496:16: warning: variable ch set but not used [-Wunused-but-set-variable]
The character read is useless according to the table 23-246 of the omap4 TRM. So we can drop it.
--- drivers/tty/serial/omap-serial.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/tty/serial/omap-serial.c +5 -2
@@ -493,10 +493,13 @@ static unsigned int check_modem_status(struct uart_omap_port *up)static void serial_omap_rlsi (struct uart_omap_port *up,unsigned int lsr) {unsigned int flag; -unsigned char ch =0 ; +/* +* Read one data character out to avoid stalling the receiver according +* to the table 23-246 of the omap4 TRM. +*/ if (likely (lsr &UART_LSR_DR )) - ch =serial_in (up,UART_RX ); +serial_in (up,UART_RX ); up->port.icount.rx++; flag =TTY_NORMAL ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 196/459 PCI: Add nr_devfns parameter to pci_add_dma_alias()
In reply to Sasha LevinFrom: James Sewart <[email protected]>
[ Upstream commit 09298542cd891b43778db1f65aa3613aa5a562eb ]
Add a "nr_devfns" parameter to pci_add_dma_alias() so it can be used to create DMA aliases for a range of devfns.
[bhelgaas: incorporate nr_devfns fix from James, update quirk_pex_vca_alias() and setup_aliases()]
--- drivers/iommu/amd_iommu.c | 7 ++----- drivers/pci/pci.c | 22 +++++++++++++++++----- drivers/pci/quirks.c | 23 +++++++++-------------- include/linux/pci.h | 2 +- 4 files changed, 29 insertions(+), 25 deletions(-)
drivers/iommu/amd_iommu.c +2 -5
@@ -272,11 +272,8 @@ static struct pci_dev *setup_aliases(struct device *dev)*/ ivrs_alias = amd_iommu_alias_table[pci_dev_id (pdev)];if (ivrs_alias !=pci_dev_id (pdev) && -PCI_BUS_NUM (ivrs_alias) == pdev->bus->number) { -pci_add_dma_alias (pdev, ivrs_alias &0xff ); -pci_info (pdev,"Added PCI DMA alias %02x.%d\n" , -PCI_SLOT (ivrs_alias),PCI_FUNC (ivrs_alias)); - } +PCI_BUS_NUM (ivrs_alias) == pdev->bus->number) +pci_add_dma_alias (pdev, ivrs_alias &0xff ,1 );clone_aliases (pdev);
drivers/pci/pci.c +17 -5
@@ -5875,7 +5875,8 @@ EXPORT_SYMBOL_GPL(pci_pr3_present);/** * pci_add_dma_alias - Add a DMA devfn alias for a device * @dev: the PCI device for which alias is added -* @devfn: alias slot and function +* @devfn_from: alias slot and function +* @nr_devfns: number of subsequent devfns to alias * * This helper encodes an 8-bit devfn as a bit number in dma_alias_mask * which is used to program permissible bus-devfn source addresses for DMA
@@ -5891,8 +5892,13 @@ EXPORT_SYMBOL_GPL(pci_pr3_present);* cannot be left as a userspace activity). DMA aliases should therefore * be configured via quirks, such as the PCI fixup header quirk. */ -void pci_add_dma_alias (struct pci_dev *dev,u8 devfn) +void pci_add_dma_alias (struct pci_dev *dev,u8 devfn_from,unsigned nr_devfns) { +int devfn_to; + + nr_devfns =min (nr_devfns, (unsigned )MAX_NR_DEVFNS - devfn_from); + devfn_to = devfn_from + nr_devfns -1 ; +if (!dev->dma_alias_mask) dev->dma_alias_mask =bitmap_zalloc (MAX_NR_DEVFNS ,GFP_KERNEL );if (!dev->dma_alias_mask) {
@@ -5900,9 +5906,15 @@ void pci_add_dma_alias(struct pci_dev *dev, u8 devfn)return ; } -set_bit (devfn, dev->dma_alias_mask); -pci_info (dev,"Enabling fixed DMA alias to %02x.%d\n" , -PCI_SLOT (devfn),PCI_FUNC (devfn)); +bitmap_set (dev->dma_alias_mask, devfn_from, nr_devfns); + +if (nr_devfns ==1 ) +pci_info (dev,"Enabling fixed DMA alias to %02x.%d\n" , +PCI_SLOT (devfn_from),PCI_FUNC (devfn_from)); +else if (nr_devfns >1 ) +pci_info (dev,"Enabling fixed DMA alias for devfn range from %02x.%d to %02x.%d\n" , +PCI_SLOT (devfn_from),PCI_FUNC (devfn_from), +PCI_SLOT (devfn_to),PCI_FUNC (devfn_to)); }bool pci_devs_are_dma_aliases (struct pci_dev *dev1,struct pci_dev *dev2)
drivers/pci/quirks.c +9 -14
@@ -3927,7 +3927,7 @@ int pci_dev_specific_reset(struct pci_dev *dev, int probe)static void quirk_dma_func0_alias (struct pci_dev *dev) {if (PCI_FUNC (dev->devfn) !=0 ) -pci_add_dma_alias (dev,PCI_DEVFN (PCI_SLOT (dev->devfn),0 )); +pci_add_dma_alias (dev,PCI_DEVFN (PCI_SLOT (dev->devfn),0 ),1 ); }/*
@@ -3941,7 +3941,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe476, quirk_dma_func0_alias);static void quirk_dma_func1_alias (struct pci_dev *dev) {if (PCI_FUNC (dev->devfn) !=1 ) -pci_add_dma_alias (dev,PCI_DEVFN (PCI_SLOT (dev->devfn),1 )); +pci_add_dma_alias (dev,PCI_DEVFN (PCI_SLOT (dev->devfn),1 ),1 ); }/*
@@ -4026,7 +4026,7 @@ static void quirk_fixed_dma_alias(struct pci_dev *dev) id =pci_match_id (fixed_dma_alias_tbl, dev);if (id) -pci_add_dma_alias (dev, id->driver_data); +pci_add_dma_alias (dev, id->driver_data,1 ); }DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ADAPTEC2 ,0x0285 , quirk_fixed_dma_alias);
@@ -4068,9 +4068,9 @@ DECLARE_PCI_FIXUP_HEADER(0x8086, 0x244e, quirk_use_pcie_bridge_dma_alias);*/ static void quirk_mic_x200_dma_alias (struct pci_dev *pdev) { -pci_add_dma_alias (pdev,PCI_DEVFN (0x10 ,0x0 )); -pci_add_dma_alias (pdev,PCI_DEVFN (0x11 ,0x0 )); -pci_add_dma_alias (pdev,PCI_DEVFN (0x12 ,0x3 )); +pci_add_dma_alias (pdev,PCI_DEVFN (0x10 ,0x0 ),1 ); +pci_add_dma_alias (pdev,PCI_DEVFN (0x11 ,0x0 ),1 ); +pci_add_dma_alias (pdev,PCI_DEVFN (0x12 ,0x3 ),1 ); }DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x2260 , quirk_mic_x200_dma_alias);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x2264 , quirk_mic_x200_dma_alias);
@@ -4094,13 +4094,8 @@ static void quirk_pex_vca_alias(struct pci_dev *pdev)const unsigned int num_pci_slots =0x20 ;unsigned int slot; -for (slot =0 ; slot < num_pci_slots; slot++) { -pci_add_dma_alias (pdev,PCI_DEVFN (slot,0x0 )); -pci_add_dma_alias (pdev,PCI_DEVFN (slot,0x1 )); -pci_add_dma_alias (pdev,PCI_DEVFN (slot,0x2 )); -pci_add_dma_alias (pdev,PCI_DEVFN (slot,0x3 )); -pci_add_dma_alias (pdev,PCI_DEVFN (slot,0x4 )); - } +for (slot =0 ; slot < num_pci_slots; slot++) +pci_add_dma_alias (pdev,PCI_DEVFN (slot,0x0 ),5 ); }DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x2954 , quirk_pex_vca_alias);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x2955 , quirk_pex_vca_alias);
@@ -5315,7 +5310,7 @@ static void quirk_switchtec_ntb_dma_alias(struct pci_dev *pdev)pci_dbg (pdev,"Aliasing Partition %d Proxy ID %02x.%d\n" , pp,PCI_SLOT (devfn),PCI_FUNC (devfn)); -pci_add_dma_alias (pdev, devfn); +pci_add_dma_alias (pdev, devfn,1 ); } }
include/linux/pci.h +1 -1
@@ -2324,7 +2324,7 @@ static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev) }#endif -void pci_add_dma_alias (struct pci_dev *dev,u8 devfn); +void pci_add_dma_alias (struct pci_dev *dev,u8 devfn_from,unsigned nr_devfns);bool pci_devs_are_dma_aliases (struct pci_dev *dev1,struct pci_dev *dev2); int pci_for_each_dma_alias(struct pci_dev *pdev, int (*fn)(struct pci_dev *pdev,
Signature · 6 lines
2.20.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 201/459 rtlwifi: rtl_pci: Fix -Wcast-function-type
In reply to Sasha LevinFrom: Phong Tran <[email protected]>
[ Upstream commit cb775c88da5d48a85d99d95219f637b6fad2e0e9 ]
correct usage prototype of callback in tasklet_init(). Report by https://github.com/KSPP/linux/issues/20
--- drivers/net/wireless/realtek/rtlwifi/pci.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtlwifi/pci.c +6 -4
@@ -1061,13 +1061,15 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)return ret; } -static void _rtl_pci_irq_tasklet (struct ieee80211_hw *hw) +static void _rtl_pci_irq_tasklet (unsigned long data) { +struct ieee80211_hw *hw = (struct ieee80211_hw *)data;_rtl_pci_tx_chk_waitq (hw); } -static void _rtl_pci_prepare_bcn_tasklet (struct ieee80211_hw *hw) +static void _rtl_pci_prepare_bcn_tasklet (unsigned long data) { +struct ieee80211_hw *hw = (struct ieee80211_hw *)data;struct rtl_priv *rtlpriv =rtl_priv (hw);struct rtl_pci *rtlpci =rtl_pcidev (rtl_pcipriv (hw));struct rtl_mac *mac =rtl_mac (rtl_priv (hw));
@@ -1193,10 +1195,10 @@ static void _rtl_pci_init_struct(struct ieee80211_hw *hw,/*task */ tasklet_init (&rtlpriv->works.irq_tasklet, - (void (*)(unsigned long ))_rtl_pci_irq_tasklet, + _rtl_pci_irq_tasklet, (unsigned long )hw);tasklet_init (&rtlpriv->works.irq_prepare_bcn_tasklet, - (void (*)(unsigned long ))_rtl_pci_prepare_bcn_tasklet, + _rtl_pci_prepare_bcn_tasklet, (unsigned long )hw);INIT_WORK (&rtlpriv->works.lps_change_work, rtl_lps_change_work_callback);
Signature · 1 line
2.20.1