scsi: hisi_sas: Fix I/O errors caused by hardware port ID changes
Subsystems (18)
Sasha Levin
maintainerPATCH 1/30 scsi: hisi_sas: Fix I/O errors caused by hardware port ID changes
From: Xingui Yang <[email protected]>
[ Upstream commit daff37f00c7506ca322ccfce95d342022f06ec58 ]
The hw port ID of phy may change when inserting disks in batches, causing the port ID in hisi_sas_port and itct to be inconsistent with the hardware, resulting in I/O errors. The solution is to set the device state to gone to intercept I/O sent to the device, and then execute linkreset to discard and find the disk to re-update its information.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/scsi/hisi_sas/hisi_sas_main.c +20 -0
@@ -935,8 +935,28 @@ static void hisi_sas_phyup_work_common(struct work_struct *work,container_of (work,typeof (*phy), works[event]);struct hisi_hba *hisi_hba = phy->hisi_hba;struct asd_sas_phy *sas_phy = &phy->sas_phy; +struct asd_sas_port *sas_port = sas_phy->port; +struct hisi_sas_port *port = phy->port; +struct device *dev = hisi_hba->dev; +struct domain_device *port_dev;int phy_no = sas_phy->id; +if (!test_bit (HISI_SAS_RESETTING_BIT , &hisi_hba->flags) && + sas_port && port && (port->id != phy->port_id)) { +dev_info (dev,"phy%d's hw port id changed from %d to %llu\n" , + phy_no, port->id, phy->port_id); + port_dev = sas_port->port_dev; +if (port_dev && !dev_is_expander (port_dev->dev_type)) { +/* +* Set the device state to gone to block +* sending IO to the device. +*/ +set_bit (SAS_DEV_GONE , &port_dev->state); +hisi_sas_notify_phy_event (phy,HISI_PHYE_LINK_RESET ); +return ; + } + } + phy->wait_phyup_cnt =0 ;if (phy->identify.target_port_protocols ==SAS_PROTOCOL_SSP ) hisi_hba->hw->sl_notify_ssp (hisi_hba, phy_no);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 2/30 scsi: ufs: exynos: Ensure pre_link() executes before exynos_ufs_phy_init()
From: Peter Griffin <[email protected]>
[ Upstream commit 3d101165e72316775947d71321d97194f03dfef3 ]
Ensure clocks are enabled before configuring unipro. Additionally move the pre_link() hook before the exynos_ufs_phy_init() calls. This means the register write sequence more closely resembles the ordering of the downstream driver.
--- drivers/ufs/host/ufs-exynos.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/ufs/host/ufs-exynos.c +5 -5
@@ -1049,9 +1049,14 @@ static int exynos_ufs_pre_link(struct ufs_hba *hba)exynos_ufs_config_intr (ufs,DFES_DEF_L4_ERRS ,UNIPRO_L4 );exynos_ufs_set_unipro_pclk_div (ufs); +exynos_ufs_setup_clocks (hba, true,PRE_CHANGE ); +/* unipro */ exynos_ufs_config_unipro (ufs); +if (ufs->drv_data->pre_link) + ufs->drv_data->pre_link (ufs); +/* m-phy */ exynos_ufs_phy_init (ufs);if (!(ufs->opts &EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR )) {
@@ -1059,11 +1064,6 @@ static int exynos_ufs_pre_link(struct ufs_hba *hba)exynos_ufs_config_phy_cap_attr (ufs); } -exynos_ufs_setup_clocks (hba, true,PRE_CHANGE ); - -if (ufs->drv_data->pre_link) - ufs->drv_data->pre_link (ufs); -return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 3/30 scsi: ufs: exynos: Enable PRDT pre-fetching with UFSHCD_CAP_CRYPTO
In reply to Sasha LevinFrom: Peter Griffin <[email protected]>
[ Upstream commit deac9ad496ec17e1ec06848964ecc635bdaca703 ]
PRDT_PREFETCH_ENABLE[31] bit should be set when desctype field of fmpsecurity0 register is type2 (double file encryption) or type3 (support for file and disk encryption). Setting this bit enables PRDT pre-fetching on both TXPRDT and RXPRDT.
--- drivers/ufs/host/ufs-exynos.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/ufs/host/ufs-exynos.c +7 -2
@@ -34,7 +34,7 @@* Exynos's Vendor specific registers for UFSHCI */ #define HCI_TXPRDT_ENTRY_SIZE 0x00 -#define PRDT_PREFECT_EN BIT(31) +#define PRDT_PREFETCH_EN BIT(31)#define HCI_RXPRDT_ENTRY_SIZE 0x04#define HCI_1US_TO_CNT_VAL 0x0C#define CNT_VAL_1US_MASK 0x3FF
@@ -1087,12 +1087,17 @@ static int exynos_ufs_post_link(struct ufs_hba *hba)struct exynos_ufs *ufs =ufshcd_get_variant (hba);struct phy *generic_phy = ufs->phy;struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; +u32 val =ilog2 (DATA_UNIT_SIZE );exynos_ufs_establish_connt (ufs);exynos_ufs_fit_aggr_timeout (ufs);hci_writel (ufs,0xa ,HCI_DATA_REORDER ); -hci_writel (ufs,ilog2 (DATA_UNIT_SIZE ),HCI_TXPRDT_ENTRY_SIZE ); + +if (hba->caps &UFSHCD_CAP_CRYPTO ) + val |=PRDT_PREFETCH_EN ; +hci_writel (ufs, val,HCI_TXPRDT_ENTRY_SIZE ); +hci_writel (ufs,ilog2 (DATA_UNIT_SIZE ),HCI_RXPRDT_ENTRY_SIZE );hci_writel (ufs, (1 << hba->nutrs) -1 ,HCI_UTRL_NEXUS_TYPE );hci_writel (ufs, (1 << hba->nutmrs) -1 ,HCI_UTMRL_NEXUS_TYPE );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 4/30 scsi: ufs: exynos: Move phy calls to .exit() callback
In reply to Sasha LevinFrom: Peter Griffin <[email protected]>
[ Upstream commit 67e4085015c33bf2fb552af1f171c58b81ef0616 ]
ufshcd_pltfrm_remove() calls ufshcd_remove(hba) which in turn calls ufshcd_hba_exit().
By moving the phy_power_off() and phy_exit() calls to the newly created .exit callback they get called by ufshcd_variant_hba_exit() before ufshcd_hba_exit() turns off the regulators. This is also similar flow to the ufs-qcom driver.
--- drivers/ufs/host/ufs-exynos.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/ufs/host/ufs-exynos.c +9 -6
@@ -1501,6 +1501,14 @@ static int exynos_ufs_init(struct ufs_hba *hba)return ret; } +static void exynos_ufs_exit (struct ufs_hba *hba) +{ +struct exynos_ufs *ufs =ufshcd_get_variant (hba); + +phy_power_off (ufs->phy); +phy_exit (ufs->phy); +} +static int exynos_ufs_host_reset (struct ufs_hba *hba) {struct exynos_ufs *ufs =ufshcd_get_variant (hba);
@@ -1956,6 +1964,7 @@ static int gs101_ufs_pre_pwr_change(struct exynos_ufs *ufs,static const struct ufs_hba_variant_ops ufs_hba_exynos_ops = { .name ="exynos_ufs" , .init = exynos_ufs_init, + .exit = exynos_ufs_exit, .hce_enable_notify = exynos_ufs_hce_enable_notify, .link_startup_notify = exynos_ufs_link_startup_notify, .pwr_change_notify = exynos_ufs_pwr_change_notify,
@@ -1994,13 +2003,7 @@ static int exynos_ufs_probe(struct platform_device *pdev)static void exynos_ufs_remove (struct platform_device *pdev) { -struct ufs_hba *hba =platform_get_drvdata (pdev); -struct exynos_ufs *ufs =ufshcd_get_variant (hba); -ufshcd_pltfrm_remove (pdev); - -phy_power_off (ufs->phy); -phy_exit (ufs->phy); }static struct exynos_ufs_uic_attr exynos7_uic_attr = {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 5/30 scsi: ufs: exynos: gs101: Put UFS device in reset on .suspend()
In reply to Sasha LevinFrom: Peter Griffin <[email protected]>
[ Upstream commit cd4c0025069f16fc666c6ffc56c49c9b1154841f ]
GPIO_OUT[0] is connected to the reset pin of embedded UFS device. Before powering off the phy assert the reset signal.
This is added as a gs101 specific suspend hook so as not to have any unintended consequences for other SoCs supported by this driver.
--- drivers/ufs/host/ufs-exynos.c | 10 ++++++++++ drivers/ufs/host/ufs-exynos.h | 1 + 2 files changed, 11 insertions(+)
drivers/ufs/host/ufs-exynos.c +10 -0
@@ -1679,6 +1679,12 @@ static void exynos_ufs_hibern8_notify(struct ufs_hba *hba, } } +static int gs101_ufs_suspend (struct exynos_ufs *ufs) +{ +hci_writel (ufs,0 <<0 ,HCI_GPIO_OUT ); +return 0 ; +} +static int exynos_ufs_suspend (struct ufs_hba *hba,enum ufs_pm_op pm_op,enum ufs_notify_change_status status) {
@@ -1687,6 +1693,9 @@ static int exynos_ufs_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op,if (status ==PRE_CHANGE )return 0 ; +if (ufs->drv_data->suspend) + ufs->drv_data->suspend (ufs); +if (!ufshcd_is_link_active (hba))phy_power_off (ufs->phy);
@@ -2147,6 +2156,7 @@ static const struct exynos_ufs_drv_data gs101_ufs_drvs = { .pre_link = gs101_ufs_pre_link, .post_link = gs101_ufs_post_link, .pre_pwr_change = gs101_ufs_pre_pwr_change, + .suspend = gs101_ufs_suspend, };static const struct of_device_id exynos_ufs_of_match[] = {
drivers/ufs/host/ufs-exynos.h +1 -0
@@ -191,6 +191,7 @@ struct exynos_ufs_drv_data { struct ufs_pa_layer_attr *pwr);int (*pre_hce_enable)(struct exynos_ufs *ufs);int (*post_hce_enable)(struct exynos_ufs *ufs); +int (*suspend)(struct exynos_ufs *ufs); };struct ufs_phy_time_cfg {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 6/30 scsi: pm80xx: Set phy_attached to zero when device is gone
In reply to Sasha LevinFrom: Igor Pylypiv <[email protected]>
[ Upstream commit f7b705c238d1483f0a766e2b20010f176e5c0fb7 ]
When a fatal error occurs, a phy down event may not be received to set phy->phy_attached to zero.
--- drivers/scsi/pm8001/pm8001_sas.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/pm8001/pm8001_sas.c +1 -0
@@ -766,6 +766,7 @@ static void pm8001_dev_gone_notify(struct domain_device *dev)spin_lock_irqsave (&pm8001_ha->lock, flags); }PM8001_CHIP_DISP ->dereg_dev_req (pm8001_ha, device_id); + pm8001_ha->phy[pm8001_dev->attached_phy].phy_attached =0 ;pm8001_free_dev (pm8001_dev); }else {pm8001_dbg (pm8001_ha,DISC ,"Found dev has gone.\n" );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 7/30 ASoC: fsl_asrc_dma: get codec or cpu dai from backend
In reply to Sasha LevinFrom: Shengjiu Wang <[email protected]>
[ Upstream commit ef5c23ae9ab380fa756f257411024a9b4518d1b9 ]
With audio graph card, original cpu dai is changed to codec device in backend, so if cpu dai is dummy device in backend, get the codec dai device, which is the real hardware device connected.
The specific case is ASRC->SAI->AMIX->CODEC.
--- sound/soc/fsl/fsl_asrc_dma.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
sound/soc/fsl/fsl_asrc_dma.c +14 -1
@@ -156,11 +156,24 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component,for_each_dpcm_be (rtd, stream, dpcm) {struct snd_soc_pcm_runtime *be = dpcm->be;struct snd_pcm_substream *substream_be; -struct snd_soc_dai *dai =snd_soc_rtd_to_cpu (be,0 ); +struct snd_soc_dai *dai_cpu =snd_soc_rtd_to_cpu (be,0 ); +struct snd_soc_dai *dai_codec =snd_soc_rtd_to_codec (be,0 ); +struct snd_soc_dai *dai;if (dpcm->fe != rtd)continue ; +/* +* With audio graph card, original cpu dai is changed to codec +* device in backend, so if cpu dai is dummy device in backend, +* get the codec dai device, which is the real hardware device +* connected. +*/ +if (!snd_soc_dai_is_dummy (dai_cpu)) + dai = dai_cpu; +else + dai = dai_codec; + substream_be =snd_soc_dpcm_get_substream (be, stream); dma_params_be =snd_soc_dai_get_dma_data (dai, substream_be); dev_be = dai->dev;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 8/30 ASoC: codecs: Add of_match_table for aw888081 driver
In reply to Sasha LevinFrom: Weidong Wang <[email protected]>
[ Upstream commit 6bbb2b1286f437b45ccf4828a537429153cd1096 ]
Add of_match_table for aw88081 driver to make matching between dts and driver more flexible
--- sound/soc/codecs/aw88081.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/soc/codecs/aw88081.c +10 -0
@@ -1295,9 +1295,19 @@ static int aw88081_i2c_probe(struct i2c_client *i2c) aw88081_dai, ARRAY_SIZE(aw88081_dai)); } +#if defined(CONFIG_OF ) +static const struct of_device_id aw88081_of_match[] = { + { .compatible ="awinic,aw88081" }, + { .compatible ="awinic,aw88083" }, + { } +}; +MODULE_DEVICE_TABLE (of, aw88081_of_match); +#endif +static struct i2c_driver aw88081_i2c_driver = { .driver = { .name =AW88081_I2C_NAME , + .of_match_table =of_match_ptr (aw88081_of_match), }, .probe = aw88081_i2c_probe, .id_table = aw88081_i2c_id,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 9/30 x86/i8253: Call clockevent_i8253_disable() with interrupts disabled
In reply to Sasha LevinFrom: Fernando Fernandez Mancera <[email protected]>
[ Upstream commit 3940f5349b476197fb079c5aa19c9a988de64efb ]
There's a lockdep false positive warning related to i8253_lock:
WARNING: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected
...
systemd-sleep/3324 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:
ffffffffb2c23398 (i8253_lock){+.+.}-{2:2}, at: pcspkr_event+0x3f/0xe0 [pcspkr]
...
... which became HARDIRQ-irq-unsafe at:
...
lock_acquire+0xd0/0x2f0
_raw_spin_lock+0x30/0x40
clockevent_i8253_disable+0x1c/0x60
pit_timer_init+0x25/0x50
hpet_time_init+0x46/0x50
x86_late_time_init+0x1b/0x40
start_kernel+0x962/0xa00
x86_64_start_reservations+0x24/0x30
x86_64_start_kernel+0xed/0xf0
common_startup_64+0x13e/0x141
...Lockdep complains due pit_timer_init() using the lock in an IRQ-unsafe fashion, but it's a false positive, because there is no deadlock possible at that point due to init ordering: at the point where pit_timer_init() is called there is no other possible usage of i8253_lock because the system is still in the very early boot stage with no interrupts.
But in any case, pit_timer_init() should disable interrupts before calling clockevent_i8253_disable() out of general principle, and to keep lockdep working even in this scenario.
Use scoped_guard() for that, as suggested by Thomas Gleixner.
[ mingo: Cleaned up the changelog. ]
--- arch/x86/kernel/i8253.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/i8253.c +2 -1
@@ -46,7 +46,8 @@ bool __init pit_timer_init(void)* VMMs otherwise steal CPU time just to pointlessly waggle * the (masked) IRQ. */ -clockevent_i8253_disable (); +scoped_guard (irq) +clockevent_i8253_disable ();return false; }clockevent_i8253_init (true);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 10/30 platform/x86: x86-android-tablets: Add "9v" to Vexia EDU ATLA 10 tablet symbols
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 3343b086c7035222c24956780ea4423655cad6d2 ]
The Vexia EDU ATLA 10 tablet comes in 2 different versions with significantly different mainboards. The only outward difference is that the charging barrel on one is marked 5V and the other is marked 9V.
Both need to be handled by the x86-android-tablets code. Add 9v to the symbols for the existing support for the 9V Vexia EDU ATLA 10 tablet symbols to prepare for adding support for the 5V version.
All this patch does is s/vexia_edu_atla10_info/vexia_edu_atla10_9v_info/.
--- .../platform/x86/x86-android-tablets/dmi.c | 2 +- .../platform/x86/x86-android-tablets/other.c | 64 +++++++++---------- .../x86-android-tablets/x86-android-tablets.h | 2 +- 3 files changed, 34 insertions(+), 34 deletions(-)
drivers/platform/x86/x86-android-tablets/dmi.c +1 -1
@@ -187,7 +187,7 @@ const struct dmi_system_id x86_android_tablet_ids[] __initconst = {/* Above strings are too generic, also match on BIOS date */ DMI_MATCH(DMI_BIOS_DATE, "08/25/2014"), }, - .driver_data = (void *)&vexia_edu_atla10_info, + .driver_data = (void *)&vexia_edu_atla10_9v_info, }, {/* Whitelabel (sold as various brands) TM800A550L */
drivers/platform/x86/x86-android-tablets/other.c +32 -32
154 lines not on this page · raw message
drivers/platform/x86/x86-android-tablets/x86-android-tablets.h +1 -1
@@ -127,7 +127,7 @@ extern const struct x86_dev_info nextbook_ares8_info;extern const struct x86_dev_info nextbook_ares8a_info;extern const struct x86_dev_info peaq_c1010_info;extern const struct x86_dev_info whitelabel_tm800a550l_info; -extern const struct x86_dev_info vexia_edu_atla10_info; +extern const struct x86_dev_info vexia_edu_atla10_9v_info;extern const struct x86_dev_info xiaomi_mipad2_info;extern const struct dmi_system_id x86_android_tablet_ids[];
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 11/30 platform/x86: x86-android-tablets: Add Vexia Edu Atla 10 tablet 5V data
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 59df54c67be3e587e4217bddd793350fbe8f5feb ]
The Vexia EDU ATLA 10 tablet comes in 2 different versions with significantly different mainboards. The only outward difference is that the charging barrel on one is marked 5V and the other is marked 9V.
Both are x86 ACPI tablets which ships with Android x86 as factory OS. with a DSDT which contains a bunch of I2C devices which are not actually there, causing various resource conflicts. Enumeration of these is skipped through the acpi_quirk_skip_i2c_client_enumeration().
Extend the existing support for the 9V version by adding support for manually instantiating the I2C devices which are actually present on the 5V version by adding the necessary device info to
the x86-android-tablets module.
--- .../platform/x86/x86-android-tablets/dmi.c | 12 ++++ .../platform/x86/x86-android-tablets/other.c | 60 +++++++++++++++++++ .../x86-android-tablets/x86-android-tablets.h | 1 + 3 files changed, 73 insertions(+)
drivers/platform/x86/x86-android-tablets/dmi.c +12 -0
@@ -179,6 +179,18 @@ const struct dmi_system_id x86_android_tablet_ids[] __initconst = { }, .driver_data = (void *)&peaq_c1010_info, }, + { +/* Vexia Edu Atla 10 tablet 5V version */ + .matches = { +/* Having all 3 of these not set is somewhat unique */ +DMI_MATCH (DMI_SYS_VENDOR ,"To be filled by O.E.M." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"To be filled by O.E.M." ), +DMI_MATCH (DMI_BOARD_NAME ,"To be filled by O.E.M." ), +/* Above strings are too generic, also match on BIOS date */ + DMI_MATCH(DMI_BIOS_DATE, "05/14/2015"), + }, + .driver_data = (void *)&vexia_edu_atla10_5v_info, + }, {/* Vexia Edu Atla 10 tablet 9V version */ .matches = {
drivers/platform/x86/x86-android-tablets/other.c +60 -0
66 lines not on this page · raw message
drivers/platform/x86/x86-android-tablets/x86-android-tablets.h +1 -0
@@ -127,6 +127,7 @@ extern const struct x86_dev_info nextbook_ares8_info;extern const struct x86_dev_info nextbook_ares8a_info;extern const struct x86_dev_info peaq_c1010_info;extern const struct x86_dev_info whitelabel_tm800a550l_info; +extern const struct x86_dev_info vexia_edu_atla10_5v_info;extern const struct x86_dev_info vexia_edu_atla10_9v_info;extern const struct x86_dev_info xiaomi_mipad2_info;extern const struct dmi_system_id x86_android_tablet_ids[];
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 12/30 netfs: Only create /proc/fs/netfs with CONFIG_PROC_FS
In reply to Sasha LevinFrom: Song Liu <[email protected]>
[ Upstream commit 40cb48eba3b4b79e110c1a35d33a48cac54507a2 ]
When testing a special config:
CONFIG_NETFS_SUPPORTS=yCONFIG_PROC_FS=n
The system crashes with something like:
[ 3.766197] ------------[ cut here ]------------ [ 3.766484] kernel BUG at mm/mempool.c:560! [ 3.766789] Oops: invalid opcode: 0000 [#1] SMP NOPTI [ 3.767123] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Tainted: G W [ 3.767777] Tainted: [W]=WARN [ 3.767968] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), [ 3.768523] RIP: 0010:mempool_alloc_slab.cold+0x17/0x19 [ 3.768847] Code: 50 fe ff 58 5b 5d 41 5c 41 5d 41 5e 41 5f e9 93 95 13 00 [ 3.769977] RSP: 0018:ffffc90000013998 EFLAGS: 00010286 [ 3.770315] RAX: 000000000000002f RBX: ffff888100ba8640 RCX: 0000000000000000 [ 3.770749] RDX: 0000000000000000 RSI: 0000000000000003 RDI: 00000000ffffffff [ 3.771217] RBP: 0000000000092880 R08: 0000000000000000 R09: ffffc90000013828 [ 3.771664] R10: 0000000000000001 R11: 00000000ffffffea R12: 0000000000092cc0 [ 3.772117] R13: 0000000000000400 R14: ffff8881004b1620 R15: ffffea0004ef7e40 [ 3.772554] FS: 0000000000000000(0000) GS:ffff8881b5f3c000(0000) knlGS:0000000000000000 [ 3.773061] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 3.773443] CR2: ffffffff830901b4 CR3: 0000000004296001 CR4: 0000000000770ef0 [ 3.773884] PKRU: 55555554 [ 3.774058] Call Trace: [ 3.774232] <TASK> [ 3.774371] mempool_alloc_noprof+0x6a/0x190 [ 3.774649] ? _printk+0x57/0x80 [ 3.774862] netfs_alloc_request+0x85/0x2ce [ 3.775147] netfs_readahead+0x28/0x170 [ 3.775395] read_pages+0x6c/0x350 [ 3.775623] ? srso_alias_return_thunk+0x5/0xfbef5 [ 3.775928] page_cache_ra_unbounded+0x1bd/0x2a0 [ 3.776247] filemap_get_pages+0x139/0x970 [ 3.776510] ? srso_alias_return_thunk+0x5/0xfbef5 [ 3.776820] filemap_read+0xf9/0x580 [ 3.777054] ? srso_alias_return_thunk+0x5/0xfbef5 [ 3.777368] ? srso_alias_return_thunk+0x5/0xfbef5 [ 3.777674] ? find_held_lock+0x32/0x90 [ 3.777929] ? netfs_start_io_read+0x19/0x70 [ 3.778221] ? netfs_start_io_read+0x19/0x70 [ 3.778489] ? srso_alias_return_thunk+0x5/0xfbef5 [ 3.778800] ? lock_acquired+0x1e6/0x450 [ 3.779054] ? srso_alias_return_thunk+0x5/0xfbef5 [ 3.779379] netfs_buffered_read_iter+0x57/0x80 [ 3.779670] __kernel_read+0x158/0x2c0 [ 3.779927] bprm_execve+0x300/0x7a0 [ 3.780185] kernel_execve+0x10c/0x140 [ 3.780423] ? __pfx_kernel_init+0x10/0x10 [ 3.780690] kernel_init+0xd5/0x150 [ 3.780910] ret_from_fork+0x2d/0x50 [ 3.781156] ? __pfx_kernel_init+0x10/0x10 [ 3.781414] ret_from_fork_asm+0x1a/0x30 [ 3.781677] </TASK> [ 3.781823] Modules linked in: [ 3.782065] ---[ end trace 0000000000000000 ]---
This is caused by the following error path in netfs_init():
if (!proc_mkdir("fs/netfs", NULL))
goto error_proc;Fix this by adding ifdef in netfs_main(), so that /proc/fs/netfs is only created with CONFIG_PROC_FS.
--- fs/netfs/main.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/netfs/main.c +4 -0
@@ -127,11 +127,13 @@ static int __init netfs_init(void)if (mempool_init_slab_pool (&netfs_subrequest_pool,100 , netfs_subrequest_slab) <0 ) goto error_subreqpool; +#ifdef CONFIG_PROC_FS if (!proc_mkdir ("fs/netfs" ,NULL )) goto error_proc;if (!proc_create_seq ("fs/netfs/requests" ,S_IFREG |0444 ,NULL , &netfs_requests_seq_ops)) goto error_procfile; +#endif #ifdef CONFIG_FSCACHE_STATS if (!proc_create_single ("fs/netfs/stats" ,S_IFREG |0444 ,NULL , netfs_stats_show))
@@ -144,9 +146,11 @@ static int __init netfs_init(void)return 0 ; error_fscache: +#ifdef CONFIG_PROC_FS error_procfile:remove_proc_subtree ("fs/netfs" ,NULL ); error_proc: +#endif mempool_exit (&netfs_subrequest_pool); error_subreqpool:kmem_cache_destroy (netfs_subrequest_slab);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 13/30 iomap: skip unnecessary ifs_block_is_uptodate check
In reply to Sasha LevinFrom: Gou Hao <[email protected]>
[ Upstream commit 8e3c15ee0d292c413c66fe10201d1b035a0bea72 ]
In iomap_adjust_read_range, i is either the first !uptodate block, or it is past last for the second loop looking for trailing uptodate blocks. Assuming there's no overflow (there's no combination of huge folios and tiny blksize) then yeah, there is no point in retesting that the same block pointed to by i is uptodate since we hold the folio lock so nobody else could have set it uptodate.
--- fs/iomap/buffered-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/iomap/buffered-io.c +1 -1
@@ -263,7 +263,7 @@ static void iomap_adjust_read_range(struct inode *inode, struct folio *folio, }/* truncate len if we find any trailing uptodate block(s) */ -for ( ; i <= last; i++) { +while (++i <= last) {if (ifs_block_is_uptodate (ifs, i)) { plen -= (last - i +1 ) * block_size; last = i -1 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 14/30 riscv: Provide all alternative macros all the time
In reply to Sasha LevinFrom: Andrew Jones <[email protected]>
[ Upstream commit fb53a9aa5f5b8bf302f3260a7f1f5a24345ce62a ]
We need to provide all six forms of the alternative macros (ALTERNATIVE, ALTERNATIVE_2, _ALTERNATIVE_CFG, _ALTERNATIVE_CFG_2, __ALTERNATIVE_CFG, __ALTERNATIVE_CFG_2) for all four cases derived from the two ifdefs (RISCV_ALTERNATIVE, __ASSEMBLY__) in order to ensure all configs can compile. Define this missing ones and ensure all are defined to consume all parameters passed.
--- arch/riscv/include/asm/alternative-macros.h | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
arch/riscv/include/asm/alternative-macros.h +7 -12
@@ -115,24 +115,19 @@ \old_c .endm -#define _ALTERNATIVE_CFG (old_c, ...) \ - ALTERNATIVE_CFG old_c - -#define _ALTERNATIVE_CFG_2 (old_c, ...) \ - ALTERNATIVE_CFG old_c +#define __ALTERNATIVE_CFG (old_c, ...) ALTERNATIVE_CFG old_c +#define __ALTERNATIVE_CFG_2 (old_c, ...) ALTERNATIVE_CFG old_c#else /* !__ASSEMBLY__ */ -#define __ALTERNATIVE_CFG (old_c) \ - old_c "\n" +#define __ALTERNATIVE_CFG (old_c, ...) old_c "\n" +#define __ALTERNATIVE_CFG_2 (old_c, ...) old_c "\n" -#define _ALTERNATIVE_CFG (old_c, ...) \ - __ALTERNATIVE_CFG(old_c) +#endif /* __ASSEMBLY__ */ -#define _ALTERNATIVE_CFG_2 (old_c, ...) \ - __ALTERNATIVE_CFG(old_c) +#define _ALTERNATIVE_CFG (old_c, ...) __ALTERNATIVE_CFG(old_c) +#define _ALTERNATIVE_CFG_2 (old_c, ...) __ALTERNATIVE_CFG_2(old_c) -#endif /* __ASSEMBLY__ */ #endif /* CONFIG_RISCV_ALTERNATIVE */ /*
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 15/30 ksmbd: fix WARNING "do not call blocking ops when !TASK_RUNNING"
In reply to Sasha LevinFrom: Namjae Jeon <[email protected]>
[ Upstream commit 1df0d4c616138784e033ad337961b6e1a6bcd999 ]
wait_event_timeout() will set the state of the current
task to TASK_UNINTERRUPTIBLE, before doing the condition check. This means that ksmbd_durable_scavenger_alive() will try to acquire the mutex while already in a sleeping state. The scheduler warns us by giving the following warning:
do not call blocking ops when !TASK_RUNNING; state=2 set at
[<0000000061515a6f>] prepare_to_wait_event+0x9f/0x6c0 WARNING: CPU: 2 PID: 4147 at kernel/sched/core.c:10099 __might_sleep+0x12f/0x160
mutex lock is not needed in ksmbd_durable_scavenger_alive().
--- fs/smb/server/vfs_cache.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
fs/smb/server/vfs_cache.c +1 -7
@@ -713,12 +713,8 @@ static bool tree_conn_fd_check(struct ksmbd_tree_connect *tcon,static bool ksmbd_durable_scavenger_alive (void ) { -mutex_lock (&durable_scavenger_lock); -if (!durable_scavenger_running) { -mutex_unlock (&durable_scavenger_lock); +if (!durable_scavenger_running)return false; - } -mutex_unlock (&durable_scavenger_lock);if (kthread_should_stop ())return false;
@@ -799,9 +795,7 @@ static int ksmbd_durable_scavenger(void *dummy)break ; } -mutex_lock (&durable_scavenger_lock); durable_scavenger_running = false; -mutex_unlock (&durable_scavenger_lock);module_put (THIS_MODULE );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 16/30 loop: aio inherit the ioprio of original request
In reply to Sasha LevinFrom: Yunlong Xing <[email protected]>
[ Upstream commit 1fdb8188c3d505452b40cdb365b1bb32be533a8e ]
Set cmd->iocb.ki_ioprio to the ioprio of loop device's request. The purpose is to inherit the original request ioprio in the aio flow.
--- drivers/block/loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/loop.c +1 -1
@@ -471,7 +471,7 @@ static int lo_rw_aio(struct loop_device *lo, struct loop_cmd *cmd, cmd->iocb.ki_filp = file; cmd->iocb.ki_complete = lo_rw_aio_complete; cmd->iocb.ki_flags =IOCB_DIRECT ; - cmd->iocb.ki_ioprio =IOPRIO_PRIO_VALUE (IOPRIO_CLASS_NONE ,0 ); + cmd->iocb.ki_ioprio =req_get_ioprio (rq);if (rw ==ITER_SOURCE ) ret = file->f_op->write_iter (&cmd->iocb, &iter);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 17/30 spi: tegra210-quad: use WARN_ON_ONCE instead of WARN_ON for timeouts
In reply to Sasha LevinFrom: Breno Leitao <[email protected]>
[ Upstream commit 41c721fc093938745d116c3a21326a0ee03bb491 ]
Some machines with tegra_qspi_combined_seq_xfer hardware issues generate excessive kernel warnings, severely polluting the logs:
dmesg | grep -i "WARNING:.*tegra_qspi_transfer_one_message" | wc -l 94451
This patch replaces WARN_ON with WARN_ON_ONCE for timeout conditions to reduce log spam. The subsequent error message still prints on each occurrence, providing sufficient information about the failure, while the stack trace is only needed once for debugging purposes.
--- drivers/spi/spi-tegra210-quad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-tegra210-quad.c +1 -1
@@ -1117,7 +1117,7 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi, (&tqspi->xfer_completion,QSPI_DMA_TIMEOUT ); -if (WARN_ON (ret ==0 )) { +if (WARN_ON_ONCE (ret ==0 )) {dev_err (tqspi->dev,"QSPI Transfer failed with timeout: %d\n" , ret); if (tqspi->is_curr_dma_xfer &&
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 18/30 spi: tegra210-quad: add rate limiting and simplify timeout error message
In reply to Sasha LevinFrom: Breno Leitao <[email protected]>
[ Upstream commit 21f4314e66ed8d40b2ee24185d1a06a07a512eb1 ]
On malfunctioning hardware, timeout error messages can appear thousands of times, creating unnecessary system pressure and log bloat. This patch makes two improvements:
1. Replace dev_err() with dev_err_ratelimited() to prevent log flooding when hardware errors persist
2. Remove the redundant timeout value parameter from the error message, as 'ret' is always zero in this error path
These changes reduce logging overhead while maintaining necessary error reporting for debugging purposes.
--- drivers/spi/spi-tegra210-quad.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-tegra210-quad.c +2 -2
@@ -1118,8 +1118,8 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi, QSPI_DMA_TIMEOUT);if (WARN_ON_ONCE (ret ==0 )) { -dev_err (tqspi->dev,"QSPI Transfer failed with timeout: %d\n" , - ret); +dev_err_ratelimited (tqspi->dev, +"QSPI Transfer failed with timeout\n" );if (tqspi->is_curr_dma_xfer && (tqspi->cur_direction &DATA_DIR_TX )) dmaengine_terminate_all
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 19/30 hardening: Disable GCC randstruct for COMPILE_TEST
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit f5c68a4e84f9feca3be578199ec648b676db2030 ]
There is a GCC crash bug in the randstruct for latest GCC versions that is being tickled by landlock[1]. Temporarily disable GCC randstruct for COMPILE_TEST builds to unbreak CI systems for the coming -rc2. This can be restored once the bug is fixed.
--- security/Kconfig.hardening | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/Kconfig.hardening +1 -1
@@ -311,7 +311,7 @@ config CC_HAS_RANDSTRUCT choice prompt "Randomize layout of sensitive kernel structures" - default RANDSTRUCT_FULL if COMPILE_TEST && (GCC_PLUGINS || CC_HAS_RANDSTRUCT) + default RANDSTRUCT_FULL if COMPILE_TEST && CC_HAS_RANDSTRUCT default RANDSTRUCT_NONE help If you enable this, the layouts of structures that are entirely
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 20/30 ubsan: Fix panic from test_ubsan_out_of_bounds
In reply to Sasha LevinFrom: Mostafa Saleh <[email protected]>
[ Upstream commit 9b044614be12d78d3a93767708b8d02fb7dfa9b0 ]
Running lib_ubsan.ko on arm64 (without CONFIG_UBSAN_TRAP) panics the kernel:
[ 31.616546] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: test_ubsan_out_of_bounds+0x158/0x158 [test_ubsan] [ 31.646817] CPU: 3 UID: 0 PID: 179 Comm: insmod Not tainted 6.15.0-rc2 #1 PREEMPT [ 31.648153] Hardware name: linux,dummy-virt (DT) [ 31.648970] Call trace: [ 31.649345] show_stack+0x18/0x24 (C) [ 31.650960] dump_stack_lvl+0x40/0x84 [ 31.651559] dump_stack+0x18/0x24 [ 31.652264] panic+0x138/0x3b4 [ 31.652812] __ktime_get_real_seconds+0x0/0x10 [ 31.653540] test_ubsan_load_invalid_value+0x0/0xa8 [test_ubsan] [ 31.654388] init_module+0x24/0xff4 [test_ubsan] [ 31.655077] do_one_initcall+0xd4/0x280 [ 31.655680] do_init_module+0x58/0x2b4
That happens because the test corrupts other data in the stack:
400: d5384108 mrs x8, sp_el0 404: f9426d08 ldr x8, [x8, #1240] 408: f85f83a9 ldur x9, [x29, #-8] 40c: eb09011f cmp x8, x9 410: 54000301 b.ne 470 <test_ubsan_out_of_bounds+0x154> // b.any
As there is no guarantee the compiler will order the local variables as declared in the module:
volatile char above[4] = { }; /* Protect surrounding memory. */ volatile int arr[4];
volatile char below[4] = { }; /* Protect surrounding memory. */
There is another problem where the out-of-bound index is 5 which is larger than the extra surrounding memory for protection.
So, use a struct to enforce the ordering, and fix the index to be 4. Also, remove some of the volatiles and rely on OPTIMIZER_HIDE_VAR()
--- lib/test_ubsan.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
lib/test_ubsan.c +11 -7
@@ -68,18 +68,22 @@ static void test_ubsan_shift_out_of_bounds(void)static void test_ubsan_out_of_bounds (void ) { -volatile int i =4 , j =5 , k =-1 ; -volatile char above[4 ] = { };/* Protect surrounding memory. */ -volatile int arr[4 ]; -volatile char below[4 ] = { };/* Protect surrounding memory. */ +int i =4 , j =4 , k =-1 ; +volatile struct { +char above[4 ];/* Protect surrounding memory. */ +int arr[4 ]; +char below[4 ];/* Protect surrounding memory. */ + } data; - above[0 ] = below[0 ]; +OPTIMIZER_HIDE_VAR (i); +OPTIMIZER_HIDE_VAR (j); +OPTIMIZER_HIDE_VAR (k);UBSAN_TEST (CONFIG_UBSAN_BOUNDS ,"above" ); - arr[j] = i; + data.arr[j] = i;UBSAN_TEST (CONFIG_UBSAN_BOUNDS ,"below" ); - arr[k] = i; + data.arr[k] = i; }enum ubsan_test_enum {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 21/30 nvmet: pci-epf: cleanup link state management
In reply to Sasha LevinFrom: Damien Le Moal <[email protected]>
[ Upstream commit ad91308d3bdeb9d90ef4a400f379ce461f0fb6a7 ]
Since the link_up boolean field of struct nvmet_pci_epf_ctrl is always set to true when nvmet_pci_epf_start_ctrl() is called, assign true to this field in nvmet_pci_epf_start_ctrl(). Conversely, since this field is set to false when nvmet_pci_epf_stop_ctrl() is called, set this field to false directly inside that function.
While at it, also add information messages to notify the user of the PCI link state changes to help troubleshoot any link stability issues without needing to enable debug messages.
--- drivers/nvme/target/pci-epf.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/nvme/target/pci-epf.c +8 -6
@@ -2084,11 +2084,18 @@ static int nvmet_pci_epf_create_ctrl(struct nvmet_pci_epf *nvme_epf,static void nvmet_pci_epf_start_ctrl (struct nvmet_pci_epf_ctrl *ctrl) { + +dev_info (ctrl->dev,"PCI link up\n" ); + ctrl->link_up = true; +schedule_delayed_work (&ctrl->poll_cc,NVMET_PCI_EPF_CC_POLL_INTERVAL ); }static void nvmet_pci_epf_stop_ctrl (struct nvmet_pci_epf_ctrl *ctrl) { +dev_info (ctrl->dev,"PCI link down\n" ); + ctrl->link_up = false; +cancel_delayed_work_sync (&ctrl->poll_cc);nvmet_pci_epf_disable_ctrl (ctrl);
@@ -2314,10 +2321,8 @@ static int nvmet_pci_epf_epc_init(struct pci_epf *epf)if (ret) goto out_clear_bar; -if (!epc_features->linkup_notifier) { - ctrl->link_up = true; +if (!epc_features->linkup_notifier)nvmet_pci_epf_start_ctrl (&nvme_epf->ctrl); - }return 0 ;
@@ -2333,7 +2338,6 @@ static void nvmet_pci_epf_epc_deinit(struct pci_epf *epf)struct nvmet_pci_epf *nvme_epf =epf_get_drvdata (epf);struct nvmet_pci_epf_ctrl *ctrl = &nvme_epf->ctrl; - ctrl->link_up = false;nvmet_pci_epf_destroy_ctrl (ctrl);nvmet_pci_epf_deinit_dma (nvme_epf);
@@ -2345,7 +2349,6 @@ static int nvmet_pci_epf_link_up(struct pci_epf *epf)struct nvmet_pci_epf *nvme_epf =epf_get_drvdata (epf);struct nvmet_pci_epf_ctrl *ctrl = &nvme_epf->ctrl; - ctrl->link_up = true;nvmet_pci_epf_start_ctrl (ctrl);return 0 ;
@@ -2356,7 +2359,6 @@ static int nvmet_pci_epf_link_down(struct pci_epf *epf)struct nvmet_pci_epf *nvme_epf =epf_get_drvdata (epf);struct nvmet_pci_epf_ctrl *ctrl = &nvme_epf->ctrl; - ctrl->link_up = false;nvmet_pci_epf_stop_ctrl (ctrl);return 0 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 22/30 x86/cpu: Add CPU model number for Bartlett Lake CPUs with Raptor Cove cores
In reply to Sasha LevinFrom: Pi Xiange <[email protected]>
[ Upstream commit d466304c4322ad391797437cd84cca7ce1660de0 ]
Bartlett Lake has a P-core only product with Raptor Cove.
[ mingo: Switch around the define as pointed out by Christian Ludloff:
Ratpr Cove is the core, Bartlett Lake is the product.
--- arch/x86/include/asm/intel-family.h | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/include/asm/intel-family.h +2 -0
@@ -115,6 +115,8 @@#define INTEL_GRANITERAPIDS_X IFM(6, 0xAD)#define INTEL_GRANITERAPIDS_D IFM(6, 0xAE) +#define INTEL_BARTLETTLAKE IFM(6, 0xD7)/* Raptor Cove */ +/* "Hybrid" Processors (P-Core/E-Core) */ #define INTEL_LAKEFIELD IFM(6, 0x8A)/* Sunny Cove / Tremont */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 23/30 md/raid1: Add check for missing source disk in process_checks()
In reply to Sasha LevinFrom: Meir Elisha <[email protected]>
[ Upstream commit b7c178d9e57c8fd4238ff77263b877f6f16182ba ]
During recovery/check operations, the process_checks function loops through available disks to find a 'primary' source with successfully read data.
If no suitable source disk is found after checking all possibilities, the 'primary' index will reach conf->raid_disks * 2. Add an explicit check for this condition after the loop. If no source disk was found, print an error message and return early to prevent further processing without a valid primary source.
--- drivers/md/raid1.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
drivers/md/raid1.c +16 -10
@@ -2199,14 +2199,9 @@ static int fix_sync_read_error(struct r1bio *r1_bio)if (!rdev_set_badblocks (rdev, sect, s,0 )) abort =1 ; } -if (abort) { - conf->recovery_disabled = - mddev->recovery_disabled; -set_bit (MD_RECOVERY_INTR , &mddev->recovery); -md_done_sync (mddev, r1_bio->sectors,0 ); -put_buf (r1_bio); +if (abort)return 0 ; - } +/* Try next page */ sectors -= s; sect += s;
@@ -2345,10 +2340,21 @@ static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio)int disks = conf->raid_disks *2 ;struct bio *wbio; -if (!test_bit (R1BIO_Uptodate, &r1_bio->state)) -/* ouch - failed to read all of that. */ -if (!fix_sync_read_error (r1_bio)) +if (!test_bit (R1BIO_Uptodate, &r1_bio->state)) { +/* +* ouch - failed to read all of that. +* No need to fix read error for check/repair +* because all member disks are read. +*/ +if (test_bit (MD_RECOVERY_REQUESTED , &mddev->recovery) || + !fix_sync_read_error (r1_bio)) { + conf->recovery_disabled = mddev->recovery_disabled; +set_bit (MD_RECOVERY_INTR , &mddev->recovery); +md_done_sync (mddev, r1_bio->sectors,0 ); +put_buf (r1_bio);return ; + } + }if (test_bit (MD_RECOVERY_REQUESTED , &mddev->recovery))process_checks (r1_bio);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 24/30 riscv: Avoid fortify warning in syscall_get_arguments()
In reply to Sasha LevinFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 1413708f990cb7d025affd706ba9c23e2bfc1a27 ]
When building with CONFIG_FORTIFY_SOURCE=y and W=1, there is a warning because of the memcpy() in syscall_get_arguments():
In file included from include/linux/string.h:392,
from include/linux/bitmap.h:13,
from include/linux/cpumask.h:12,
from arch/riscv/include/asm/processor.h:55,
from include/linux/sched.h:13,
from kernel/ptrace.c:13:
In function 'fortify_memcpy_chk',
inlined from 'syscall_get_arguments.isra' at arch/riscv/include/asm/syscall.h:66:2:
include/linux/fortify-string.h:580:25: error: call to '__read_overflow2_field' declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror=attribute-warning]
580 | __read_overflow2_field(q_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
The fortified memcpy() routine enforces that the source is not overread and the destination is not overwritten if the size of either field and the size of the copy are known at compile time. The memcpy() in syscall_get_arguments() intentionally overreads from a1 to a5 in 'struct pt_regs' but this is bigger than the size of a1.
Normally, this could be solved by wrapping a1 through a5 with struct_group() but there was already a struct_group() applied to these members in commit bba547810c66 ("riscv: tracing: Fix __write_overflow_field in ftrace_partial_regs()").
Just avoid memcpy() altogether and write the copying of args from regs manually, which clears up the warning at the expense of three extra lines of code.
--- arch/riscv/include/asm/syscall.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/riscv/include/asm/syscall.h +5 -2
@@ -62,8 +62,11 @@ static inline void syscall_get_arguments(struct task_struct *task, unsigned long *args) { args[0 ] = regs->orig_a0; - args++; -memcpy (args, ®s->a1,5 *sizeof (args[0 ])); + args[1 ] = regs->a1; + args[2 ] = regs->a2; + args[3 ] = regs->a3; + args[4 ] = regs->a4; + args[5 ] = regs->a5; }static inline int syscall_get_arch (struct task_struct *task)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 25/30 drm/amdgpu: use a dummy owner for sysfs triggered cleaner shaders v4
In reply to Sasha LevinFrom: Christian König <[email protected]>
[ Upstream commit 447fab30955cf7dba7dd563f42b67c02284860c8 ]
Otherwise triggering sysfs multiple times without other submissions in between only runs the shader once.
v2: add some comment
v3: re-add missing cast
v4: squash in semicolon fix
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +11 -3
@@ -1411,9 +1411,11 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;struct drm_gpu_scheduler *sched = &ring->sched;struct drm_sched_entity entity; +static atomic_t counter;struct dma_fence *f;struct amdgpu_job *job;struct amdgpu_ib *ib; +void *owner;int i, r;/* Initialize the scheduler entity */
@@ -1424,9 +1426,15 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring) goto err; } - r =amdgpu_job_alloc_with_ib (ring->adev, &entity,NULL , -64 ,0 , - &job); +/* +* Use some unique dummy value as the owner to make sure we execute +* the cleaner shader on each submission. The value just need to change +* for each submission and is otherwise meaningless. +*/ + owner = (void *)(unsigned long )atomic_inc_return (&counter); + + r =amdgpu_job_alloc_with_ib (ring->adev, &entity, owner, +64 ,0 , &job);if (r) goto err;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 26/30 drm/amd: Forbid suspending into non-default suspend states
In reply to Sasha LevinFrom: Mario Limonciello <[email protected]>
[ Upstream commit 1657793def101dac7c9d3b2250391f6a3dd934ba ]
On systems that default to 'deep' some userspace software likes to try to suspend in 'deep' first. If there is a failure for any reason (such as -ENOMEM) the failure is ignored and then it will try to use 's2idle' as a fallback. This fails, but more importantly it leads to graphical problems.
Forbid this behavior and only allow suspending in the last state supported by the system.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -1119,6 +1119,7 @@ struct amdgpu_device {bool in_s3;bool in_s4;bool in_s0ix; +suspend_state_t last_suspend_state;enum pp_mp1_state mp1_state;struct amdgpu_doorbell_index doorbell_index;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +13 -1
@@ -2511,8 +2511,20 @@ static int amdgpu_pmops_suspend(struct device *dev) adev->in_s0ix = true; else if (amdgpu_acpi_is_s3_active(adev)) adev->in_s3 = true; -if (!adev->in_s0ix && !adev->in_s3) +if (!adev->in_s0ix && !adev->in_s3) { +/* don't allow going deep first time followed by s2idle the next time */ +if (adev->last_suspend_state !=PM_SUSPEND_ON && + adev->last_suspend_state != pm_suspend_target_state) { +drm_err_once (drm_dev,"Unsupported suspend state %d\n" , + pm_suspend_target_state); +return -EINVAL ; + }return 0 ; + } + +/* cache the state last used for suspend */ + adev->last_suspend_state = pm_suspend_target_state; +return amdgpu_device_suspend (drm_dev, true); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 27/30 drm/amdgpu: Use the right function for hdp flush
In reply to Sasha LevinFrom: Lijo Lazar <[email protected]>
[ Upstream commit c235a7132258ac30bd43d228222986022d21f5de ]
There are a few prechecks made before HDP flush like a flush is not required on APU bare metal. Using hdp callback directly bypasses those checks. Use amdgpu_device_flush_hdp which takes care of prechecks.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 12 ++++++------ drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/psp_v13_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/psp_v14_0.c | 2 +- 10 files changed, 23 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +4 -4
@@ -6044,7 +6044,7 @@ static int gfx_v10_0_cp_gfx_load_pfp_microcode(struct amdgpu_device *adev) }if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , mmCP_PFP_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_PFP_IC_BASE_CNTL ,VMID ,0 );
@@ -6122,7 +6122,7 @@ static int gfx_v10_0_cp_gfx_load_ce_microcode(struct amdgpu_device *adev) }if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , mmCP_CE_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_CE_IC_BASE_CNTL ,VMID ,0 );
@@ -6199,7 +6199,7 @@ static int gfx_v10_0_cp_gfx_load_me_microcode(struct amdgpu_device *adev) }if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , mmCP_ME_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_ME_IC_BASE_CNTL ,VMID ,0 );
@@ -6574,7 +6574,7 @@ static int gfx_v10_0_cp_compute_load_microcode(struct amdgpu_device *adev) }if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , mmCP_CPC_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_CPC_IC_BASE_CNTL ,CACHE_POLICY ,0 );
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +6 -6
@@ -2391,7 +2391,7 @@ static int gfx_v11_0_config_me_cache(struct amdgpu_device *adev, uint64_t addr) }if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , regCP_ME_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_ME_IC_BASE_CNTL ,VMID ,0 );
@@ -2435,7 +2435,7 @@ static int gfx_v11_0_config_pfp_cache(struct amdgpu_device *adev, uint64_t addr) }if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , regCP_PFP_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_PFP_IC_BASE_CNTL ,VMID ,0 );
@@ -2480,7 +2480,7 @@ static int gfx_v11_0_config_mec_cache(struct amdgpu_device *adev, uint64_t addr) }if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); tmp =RREG32_SOC15 (GC ,0 , regCP_CPC_IC_BASE_CNTL); tmp =REG_SET_FIELD (tmp,CP_CPC_IC_BASE_CNTL ,CACHE_POLICY ,0 );
@@ -3115,7 +3115,7 @@ static int gfx_v11_0_cp_gfx_load_pfp_microcode_rs64(struct amdgpu_device *adev)amdgpu_bo_unreserve (adev->gfx.pfp.pfp_fw_data_obj);if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );WREG32_SOC15 (GC ,0 , regCP_PFP_IC_BASE_LO,lower_32_bits (adev->gfx.pfp.pfp_fw_gpu_addr));
@@ -3333,7 +3333,7 @@ static int gfx_v11_0_cp_gfx_load_me_microcode_rs64(struct amdgpu_device *adev)amdgpu_bo_unreserve (adev->gfx.me.me_fw_data_obj);if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );WREG32_SOC15 (GC ,0 , regCP_ME_IC_BASE_LO,lower_32_bits (adev->gfx.me.me_fw_gpu_addr));
@@ -4549,7 +4549,7 @@ static int gfx_v11_0_gfxhub_enable(struct amdgpu_device *adev)if (r)return r; - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); value = (amdgpu_vm_fault_stop ==AMDGPU_VM_FAULT_STOP_ALWAYS ) ? false : true;
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +3 -3
@@ -2306,7 +2306,7 @@ static int gfx_v12_0_cp_gfx_load_pfp_microcode_rs64(struct amdgpu_device *adev)amdgpu_bo_unreserve (adev->gfx.pfp.pfp_fw_data_obj);if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );WREG32_SOC15 (GC ,0 , regCP_PFP_IC_BASE_LO,lower_32_bits (adev->gfx.pfp.pfp_fw_gpu_addr));
@@ -2450,7 +2450,7 @@ static int gfx_v12_0_cp_gfx_load_me_microcode_rs64(struct amdgpu_device *adev)amdgpu_bo_unreserve (adev->gfx.me.me_fw_data_obj);if (amdgpu_emu_mode ==1 ) - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );WREG32_SOC15 (GC ,0 , regCP_ME_IC_BASE_LO,lower_32_bits (adev->gfx.me.me_fw_gpu_addr));
@@ -3469,7 +3469,7 @@ static int gfx_v12_0_gfxhub_enable(struct amdgpu_device *adev)if (r)return r; - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); value = (amdgpu_vm_fault_stop ==AMDGPU_VM_FAULT_STOP_ALWAYS ) ? false : true;
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2 -2
@@ -268,7 +268,7 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, ack = hub->vm_inv_eng0_ack + hub->eng_distance * eng;/* flush hdp cache */ - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );/* This is necessary for SRIOV as well as for GFXOFF to function * properly under bare metal
@@ -969,7 +969,7 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev) adev->hdp.funcs->init_registers (adev);/* Flush HDP after it is initialized */ - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); value = (amdgpu_vm_fault_stop ==AMDGPU_VM_FAULT_STOP_ALWAYS ) ? false : true;
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +2 -2
@@ -229,7 +229,7 @@ static void gmc_v11_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, ack = hub->vm_inv_eng0_ack + hub->eng_distance * eng;/* flush hdp cache */ - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );/* This is necessary for SRIOV as well as for GFXOFF to function * properly under bare metal
@@ -896,7 +896,7 @@ static int gmc_v11_0_gart_enable(struct amdgpu_device *adev)return r;/* Flush HDP after it is initialized */ - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); value = (amdgpu_vm_fault_stop ==AMDGPU_VM_FAULT_STOP_ALWAYS ) ? false : true;
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +2 -2
@@ -297,7 +297,7 @@ static void gmc_v12_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,return ;/* flush hdp cache */ - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );/* This is necessary for SRIOV as well as for GFXOFF to function * properly under bare metal
@@ -881,7 +881,7 @@ static int gmc_v12_0_gart_enable(struct amdgpu_device *adev)return r;/* Flush HDP after it is initialized */ - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL ); value = (amdgpu_vm_fault_stop ==AMDGPU_VM_FAULT_STOP_ALWAYS ) ? false : true;
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
@@ -2434,7 +2434,7 @@ static int gmc_v9_0_hw_init(struct amdgpu_ip_block *ip_block) adev->hdp.funcs->init_registers (adev);/* After HDP is initialized, flush HDP.*/ - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );if (amdgpu_vm_fault_stop ==AMDGPU_VM_FAULT_STOP_ALWAYS ) value = false;
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +1 -1
@@ -532,7 +532,7 @@ static int psp_v11_0_memory_training(struct psp_context *psp, uint32_t ops) }memcpy_toio (adev->mman.aper_base_kaddr, buf, sz); - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );vfree (buf);drm_dev_exit (idx); }else {
drivers/gpu/drm/amd/amdgpu/psp_v13_0.c +1 -1
@@ -610,7 +610,7 @@ static int psp_v13_0_memory_training(struct psp_context *psp, uint32_t ops) }memcpy_toio (adev->mman.aper_base_kaddr, buf, sz); - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );vfree (buf);drm_dev_exit (idx); }else {
drivers/gpu/drm/amd/amdgpu/psp_v14_0.c +1 -1
@@ -488,7 +488,7 @@ static int psp_v14_0_memory_training(struct psp_context *psp, uint32_t ops) }memcpy_toio (adev->mman.aper_base_kaddr, buf, sz); - adev->hdp.funcs->flush_hdp (adev,NULL ); +amdgpu_device_flush_hdp (adev,NULL );vfree (buf);drm_dev_exit (idx); }else {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 28/30 ublk: add ublk_force_abort_dev()
In reply to Sasha LevinFrom: Ming Lei <[email protected]>
[ Upstream commit 00b3b0d7cb454d614117c93f33351cdcd20b5b93 ]
Add ublk_force_abort_dev() for handling ublk_nosrv_dev_should_queue_io() in ublk_stop_dev(). Then queue quiesce and unquiesce can be paired in single function.
Meantime not change device state to QUIESCED any more, since the disk is going to be removed soon.
--- drivers/block/ublk_drv.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
drivers/block/ublk_drv.c +8 -13
@@ -1638,22 +1638,20 @@ static void __ublk_quiesce_dev(struct ublk_device *ub) ub->dev_info.state =UBLK_S_DEV_QUIESCED ; } -static void ublk_unquiesce_dev (struct ublk_device *ub) +static void ublk_force_abort_dev (struct ublk_device *ub) {int i; -pr_devel ("%s: unquiesce ub: dev_id %d state %s\n" , +pr_devel ("%s: force abort ub: dev_id %d state %s\n" , __func__, ub->dev_info.dev_id, ub->dev_info.state ==UBLK_S_DEV_LIVE ?"LIVE" :"QUIESCED" ); -/* quiesce_work has run. We let requeued rqs be aborted -* before running fallback_wq. "force_abort" must be seen -* after request queue is unqiuesced. Then del_gendisk() -* can move on. -*/ +blk_mq_quiesce_queue (ub->ub_disk->queue); +if (ub->dev_info.state ==UBLK_S_DEV_LIVE ) +ublk_wait_tagset_rqs_idle (ub); +for (i =0 ; i < ub->dev_info.nr_hw_queues; i++)ublk_get_queue (ub, i)->force_abort = true; -blk_mq_unquiesce_queue (ub->ub_disk->queue);/* We may have requeued some rqs in ublk_quiesce_queue() */ blk_mq_kick_requeue_list (ub->ub_disk->queue);
@@ -1681,11 +1679,8 @@ static void ublk_stop_dev(struct ublk_device *ub)mutex_lock (&ub->mutex);if (ub->dev_info.state ==UBLK_S_DEV_DEAD ) goto unlock; -if (ublk_nosrv_dev_should_queue_io (ub)) { -if (ub->dev_info.state ==UBLK_S_DEV_LIVE ) -__ublk_quiesce_dev (ub); -ublk_unquiesce_dev (ub); - } +if (ublk_nosrv_dev_should_queue_io (ub)) +ublk_force_abort_dev (ub);del_gendisk (ub->ub_disk); disk =ublk_detach_disk (ub);put_disk (disk);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 29/30 ublk: rely on ->canceling for dealing with ublk_nosrv_dev_should_queue_io
In reply to Sasha LevinFrom: Ming Lei <[email protected]>
[ Upstream commit 7e26cb69c5e62152a6f05a2ae23605a983a8ef31 ]
Now ublk deals with ublk_nosrv_dev_should_queue_io() by keeping request queue as quiesced. This way is fragile because queue quiesce crosses syscalls or process contexts.
Switch to rely on ubq->canceling for dealing with ublk_nosrv_dev_should_queue_io(), because it has been used for this purpose during io_uring context exiting, and it can be reused before recovering too. In ublk_queue_rq(), the request will be added to requeue list without kicking off requeue in case of ubq->canceling, and finally requests added in requeue list will be dispatched from either ublk_stop_dev() or ublk_ctrl_end_recovery().
Meantime we have to move reset of ubq->canceling from ublk_ctrl_start_recovery() to ublk_ctrl_end_recovery(), when IO handling can be recovered completely.
Then blk_mq_quiesce_queue() and blk_mq_unquiesce_queue() are always used in same context.
--- drivers/block/ublk_drv.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-)
drivers/block/ublk_drv.c +17 -14
@@ -1629,13 +1629,19 @@ static void ublk_wait_tagset_rqs_idle(struct ublk_device *ub)static void __ublk_quiesce_dev (struct ublk_device *ub) { +int i; +pr_devel ("%s: quiesce ub: dev_id %d state %s\n" , __func__, ub->dev_info.dev_id, ub->dev_info.state ==UBLK_S_DEV_LIVE ?"LIVE" :"QUIESCED" );blk_mq_quiesce_queue (ub->ub_disk->queue); +/* mark every queue as canceling */ +for (i =0 ; i < ub->dev_info.nr_hw_queues; i++) +ublk_get_queue (ub, i)->canceling = true;ublk_wait_tagset_rqs_idle (ub); ub->dev_info.state =UBLK_S_DEV_QUIESCED ; +blk_mq_unquiesce_queue (ub->ub_disk->queue); }static void ublk_force_abort_dev (struct ublk_device *ub)
@@ -2785,7 +2791,6 @@ static void ublk_queue_reinit(struct ublk_device *ub, struct ublk_queue *ubq)/* We have to reset it to NULL, otherwise ub won't accept new FETCH_REQ */ ubq->ubq_daemon =NULL ; ubq->timeout = false; - ubq->canceling = false;for (i =0 ; i < ubq->q_depth; i++) {struct ublk_io *io = &ubq->ios[i];
@@ -2874,20 +2879,18 @@ static int ublk_ctrl_end_recovery(struct ublk_device *ub,pr_devel ("%s: new ublksrv_pid %d, dev id %d\n" , __func__, ublksrv_pid, header->dev_id); -if (ublk_nosrv_dev_should_queue_io (ub)) { - ub->dev_info.state =UBLK_S_DEV_LIVE ; -blk_mq_unquiesce_queue (ub->ub_disk->queue); -pr_devel ("%s: queue unquiesced, dev id %d.\n" , - __func__, header->dev_id); -blk_mq_kick_requeue_list (ub->ub_disk->queue); - }else { -blk_mq_quiesce_queue (ub->ub_disk->queue); - ub->dev_info.state =UBLK_S_DEV_LIVE ; -for (i =0 ; i < ub->dev_info.nr_hw_queues; i++) { -ublk_get_queue (ub, i)->fail_io = false; - } -blk_mq_unquiesce_queue (ub->ub_disk->queue); +blk_mq_quiesce_queue (ub->ub_disk->queue); + ub->dev_info.state =UBLK_S_DEV_LIVE ; +for (i =0 ; i < ub->dev_info.nr_hw_queues; i++) { +struct ublk_queue *ubq =ublk_get_queue (ub, i); + + ubq->canceling = false; + ubq->fail_io = false; } +blk_mq_unquiesce_queue (ub->ub_disk->queue); +pr_devel ("%s: queue unquiesced, dev id %d.\n" , + __func__, header->dev_id); +blk_mq_kick_requeue_list (ub->ub_disk->queue); ret =0 ; out_unlock:
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 30/30 spi: spi-imx: Add check for spi_imx_setupxfer()
In reply to Sasha LevinFrom: Tamura Dai <[email protected]>
[ Upstream commit 951a04ab3a2db4029debfa48d380ef834b93207e ]
Add check for the return value of spi_imx_setupxfer(). spi_imx->rx and spi_imx->tx function pointer can be NULL when spi_imx_setupxfer() return error, and make NULL pointer dereference.
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 Call trace: 0x0 spi_imx_pio_transfer+0x50/0xd8 spi_imx_transfer_one+0x18c/0x858 spi_transfer_one_message+0x43c/0x790 __spi_pump_transfer_message+0x238/0x5d4 __spi_sync+0x2b0/0x454 spi_write_then_read+0x11c/0x200
--- drivers/spi/spi-imx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/spi/spi-imx.c +4 -1
@@ -1695,9 +1695,12 @@ static int spi_imx_transfer_one(struct spi_controller *controller,struct spi_device *spi, struct spi_transfer *transfer) { + int ret;struct spi_imx_data *spi_imx =spi_controller_get_devdata (spi->controller); -spi_imx_setupxfer (spi, transfer); + ret =spi_imx_setupxfer (spi, transfer); +if (ret <0 ) +return ret; transfer->effective_speed_hz = spi_imx->spi_bus_clk;/* flush rxfifo before transfer */
Signature · 1 line
2.39.5