6.1.9-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 149/313 ASoC: mediatek: mt8186: support rt5682s_max98360
In reply to Greg Kroah-HartmanFrom: tongjian <[email protected]>
[ Upstream commit 6e1dbf694d7cd1737ee14866e9e05016ccc9ac40 ]
Add support for using the rt5682s codec together with max98360a on MT8186-MT6366-RT1019-RT5682S machines.
--- .../mt8186/mt8186-mt6366-rt1019-rt5682s.c | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c +21 -1
@@ -991,6 +991,21 @@ static struct snd_soc_card mt8186_mt6366_rt1019_rt5682s_soc_card = { .num_configs = ARRAY_SIZE(mt8186_mt6366_rt1019_rt5682s_codec_conf), }; +static struct snd_soc_card mt8186_mt6366_rt5682s_max98360_soc_card = { + .name ="mt8186_rt5682s_max98360" , + .owner =THIS_MODULE , + .dai_link = mt8186_mt6366_rt1019_rt5682s_dai_links, + .num_links =ARRAY_SIZE (mt8186_mt6366_rt1019_rt5682s_dai_links), + .controls = mt8186_mt6366_rt1019_rt5682s_controls, + .num_controls =ARRAY_SIZE (mt8186_mt6366_rt1019_rt5682s_controls), + .dapm_widgets = mt8186_mt6366_rt1019_rt5682s_widgets, + .num_dapm_widgets =ARRAY_SIZE (mt8186_mt6366_rt1019_rt5682s_widgets), + .dapm_routes = mt8186_mt6366_rt1019_rt5682s_routes, + .num_dapm_routes =ARRAY_SIZE (mt8186_mt6366_rt1019_rt5682s_routes), + .codec_conf = mt8186_mt6366_rt1019_rt5682s_codec_conf, + .num_configs =ARRAY_SIZE (mt8186_mt6366_rt1019_rt5682s_codec_conf), +}; +static int mt8186_mt6366_rt1019_rt5682s_dev_probe (struct platform_device *pdev) {struct snd_soc_card *card;
@@ -1132,9 +1147,14 @@ static int mt8186_mt6366_rt1019_rt5682s_dev_probe(struct platform_device *pdev)#if IS_ENABLED (CONFIG_OF )static const struct of_device_id mt8186_mt6366_rt1019_rt5682s_dt_match[] = { - { .compatible ="mediatek,mt8186-mt6366-rt1019-rt5682s-sound" , + { + .compatible ="mediatek,mt8186-mt6366-rt1019-rt5682s-sound" , .data = &mt8186_mt6366_rt1019_rt5682s_soc_card, }, + { + .compatible ="mediatek,mt8186-mt6366-rt5682s-max98360-sound" , + .data = &mt8186_mt6366_rt5682s_max98360_soc_card, + }, {} };#endif
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 150/313 ASoC: mediatek: mt8186: Add machine support for max98357a
In reply to Greg Kroah-HartmanFrom: Allen-KH Cheng <[email protected]>
[ Upstream commit 8a54f666db581bbf07494cca44a0124acbced581 ]
Add support for mt8186 with mt6366 and max98357a.
--- sound/soc/mediatek/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/mediatek/Kconfig +2 -1
@@ -182,9 +182,10 @@ config SND_SOC_MT8186_MT6366_DA7219_MAX98357 If unsure select "N". config SND_SOC_MT8186_MT6366_RT1019_RT5682S - tristate "ASoC Audio driver for MT8186 with RT1019 RT5682S codec" + tristate "ASoC Audio driver for MT8186 with RT1019 RT5682S MAX98357A/MAX98360 codec" depends on I2C && GPIOLIB depends on SND_SOC_MT8186 && MTK_PMIC_WRAP + select SND_SOC_MAX98357A select SND_SOC_MT6358 select SND_SOC_RT1015P select SND_SOC_RT5682S
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 151/313 ASoC: amd: yc: Add ASUS M5402RA into DMI table
In reply to Greg Kroah-HartmanFrom: Aniol Martí <[email protected]>
[ Upstream commit a0dd7fcab5cd221fa960f594c586e1f9f16c02c0 ]
ASUS VivoBook 13 OLED (M5402RA) needs this quirk to get the built-in microphone working properly.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -206,6 +206,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "UM5302TA"), } }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"ASUSTeK COMPUTER INC." ), + DMI_MATCH(DMI_PRODUCT_NAME, "M5402RA"), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 152/313 ASoC: support machine driver with max98360
In reply to Greg Kroah-HartmanFrom: Mars Chen <[email protected]>
[ Upstream commit 810948f45d99c46b60852ef2a5a2777c12d6bb3e ]
--- sound/soc/mediatek/Kconfig | 1 + 1 file changed, 1 insertion(+)
sound/soc/mediatek/Kconfig +1 -0
@@ -187,6 +187,7 @@ config SND_SOC_MT8186_MT6366_RT1019_RT5682S depends on SND_SOC_MT8186 && MTK_PMIC_WRAP select SND_SOC_MAX98357A select SND_SOC_MT6358 + select SND_SOC_MAX98357A select SND_SOC_RT1015P select SND_SOC_RT5682S select SND_SOC_BT_SCO
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 153/313 kcsan: test: dont put the expect array on the stack
In reply to Greg Kroah-HartmanFrom: Max Filippov <[email protected]>
[ Upstream commit 5b24ac2dfd3eb3e36f794af3aa7f2828b19035bd ]
Size of the 'expect' array in the __report_matches is 1536 bytes, which is exactly the default frame size warning limit of the xtensa architecture.
As a result allmodconfig xtensa kernel builds with the gcc that does not support the compiler plugins (which otherwise would push the said warning limit to 2K) fail with the following message:
kernel/kcsan/kcsan_test.c:257:1: error: the frame size of 1680 bytes
is larger than 1536 bytes
Fix it by dynamically allocating the 'expect' array.
--- kernel/kcsan/kcsan_test.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/kcsan/kcsan_test.c +6 -1
@@ -159,7 +159,7 @@ static bool __report_matches(const struct expect_report *r)const bool is_assert = (r->access[0 ].type | r->access[1 ].type) &KCSAN_ACCESS_ASSERT ;bool ret = false;unsigned long flags; - typeof(observed.lines) expect; +typeof (*observed.lines) *expect;const char *end;char *cur;int i;
@@ -168,6 +168,10 @@ static bool __report_matches(const struct expect_report *r)if (!report_available ())return false; + expect =kmalloc (sizeof (observed.lines),GFP_KERNEL ); +if (WARN_ON (!expect)) +return false; +/* Generate expected report contents. */ /* Title */
@@ -253,6 +257,7 @@ static bool __report_matches(const struct expect_report *r) strstr(observed.lines[2], expect[1]))); out:spin_unlock_irqrestore (&observed.lock, flags); +kfree (expect);return ret; }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 154/313 cpufreq: Add SM6375 to cpufreq-dt-platdev blocklist
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit faf28e240dd118d9521c68aeb9388b9b8f02d9d0 ]
The Qualcomm SM6375 platform uses the qcom-cpufreq-hw driver, so add it to the cpufreq-dt-platdev driver's blocklist.
--- drivers/cpufreq/cpufreq-dt-platdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/cpufreq-dt-platdev.c +1 -0
@@ -149,6 +149,7 @@ static const struct of_device_id blocklist[] __initconst = { { .compatible = "qcom,sdm845", }, { .compatible = "qcom,sm6115", }, { .compatible = "qcom,sm6350", }, + { .compatible = "qcom,sm6375", }, { .compatible = "qcom,sm8150", }, { .compatible = "qcom,sm8250", }, { .compatible = "qcom,sm8350", },
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 155/313 ASoC: fsl_micfil: Correct the number of steps on SX controls
In reply to Greg Kroah-HartmanFrom: Chancel Liu <[email protected]>
[ Upstream commit cdfa92eb90f5770b26a79824ef213ebdbbd988b1 ]
The parameter "max" of SOC_SINGLE_SX_TLV() means the number of steps rather than maximum value. This patch corrects the minimum value to -8 and the number of steps to 15.
--- sound/soc/fsl/fsl_micfil.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
sound/soc/fsl/fsl_micfil.c +8 -8
@@ -154,21 +154,21 @@ static int micfil_quality_set(struct snd_kcontrol *kcontrol,static const struct snd_kcontrol_new fsl_micfil_snd_controls[] = {SOC_SINGLE_SX_TLV ("CH0 Volume" ,REG_MICFIL_OUT_CTRL , -MICFIL_OUTGAIN_CHX_SHIFT (0 ),0xF ,0x7 , gain_tlv), +MICFIL_OUTGAIN_CHX_SHIFT (0 ),0x8 ,0xF , gain_tlv),SOC_SINGLE_SX_TLV ("CH1 Volume" ,REG_MICFIL_OUT_CTRL , -MICFIL_OUTGAIN_CHX_SHIFT (1 ),0xF ,0x7 , gain_tlv), +MICFIL_OUTGAIN_CHX_SHIFT (1 ),0x8 ,0xF , gain_tlv),SOC_SINGLE_SX_TLV ("CH2 Volume" ,REG_MICFIL_OUT_CTRL , -MICFIL_OUTGAIN_CHX_SHIFT (2 ),0xF ,0x7 , gain_tlv), +MICFIL_OUTGAIN_CHX_SHIFT (2 ),0x8 ,0xF , gain_tlv),SOC_SINGLE_SX_TLV ("CH3 Volume" ,REG_MICFIL_OUT_CTRL , -MICFIL_OUTGAIN_CHX_SHIFT (3 ),0xF ,0x7 , gain_tlv), +MICFIL_OUTGAIN_CHX_SHIFT (3 ),0x8 ,0xF , gain_tlv),SOC_SINGLE_SX_TLV ("CH4 Volume" ,REG_MICFIL_OUT_CTRL , -MICFIL_OUTGAIN_CHX_SHIFT (4 ),0xF ,0x7 , gain_tlv), +MICFIL_OUTGAIN_CHX_SHIFT (4 ),0x8 ,0xF , gain_tlv),SOC_SINGLE_SX_TLV ("CH5 Volume" ,REG_MICFIL_OUT_CTRL , -MICFIL_OUTGAIN_CHX_SHIFT (5 ),0xF ,0x7 , gain_tlv), +MICFIL_OUTGAIN_CHX_SHIFT (5 ),0x8 ,0xF , gain_tlv),SOC_SINGLE_SX_TLV ("CH6 Volume" ,REG_MICFIL_OUT_CTRL , -MICFIL_OUTGAIN_CHX_SHIFT (6 ),0xF ,0x7 , gain_tlv), +MICFIL_OUTGAIN_CHX_SHIFT (6 ),0x8 ,0xF , gain_tlv),SOC_SINGLE_SX_TLV ("CH7 Volume" ,REG_MICFIL_OUT_CTRL , -MICFIL_OUTGAIN_CHX_SHIFT (7 ),0xF ,0x7 , gain_tlv), +MICFIL_OUTGAIN_CHX_SHIFT (7 ),0x8 ,0xF , gain_tlv),SOC_ENUM_EXT ("MICFIL Quality Select" , fsl_micfil_quality_enum, micfil_quality_get, micfil_quality_set),
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 156/313 drm/msm/a6xx: Avoid gx gbit halt during rpm suspend
In reply to Greg Kroah-HartmanFrom: Akhil P Oommen <[email protected]>
[ Upstream commit f4a75b5933c998e60fd812a7680e0971eb1c7cee ]
As per the downstream driver, gx gbif halt is required only during recovery sequence. So lets avoid it during regular rpm suspend.
Patchwork: https://patchwork.freedesktop.org/patch/515279/
--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 15 +++++++++------ drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 7 +++++++ drivers/gpu/drm/msm/adreno/a6xx_gpu.h | 1 + 3 files changed, 17 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +9 -6
@@ -876,7 +876,8 @@ static void a6xx_gmu_rpmh_off(struct a6xx_gmu *gmu)#define GBIF_CLIENT_HALT_MASK BIT(0)#define GBIF_ARB_HALT_MASK BIT(1) -static void a6xx_bus_clear_pending_transactions (struct adreno_gpu *adreno_gpu) +static void a6xx_bus_clear_pending_transactions (struct adreno_gpu *adreno_gpu, +bool gx_off) {struct msm_gpu *gpu = &adreno_gpu->base;
@@ -889,9 +890,11 @@ static void a6xx_bus_clear_pending_transactions(struct adreno_gpu *adreno_gpu)return ; } -/* Halt the gx side of GBIF */ -gpu_write (gpu,REG_A6XX_RBBM_GBIF_HALT ,1 ); -spin_until (gpu_read (gpu,REG_A6XX_RBBM_GBIF_HALT_ACK ) &1 ); +if (gx_off) { +/* Halt the gx side of GBIF */ +gpu_write (gpu,REG_A6XX_RBBM_GBIF_HALT ,1 ); +spin_until (gpu_read (gpu,REG_A6XX_RBBM_GBIF_HALT_ACK ) &1 ); + }/* Halt new client requests on GBIF */ gpu_write (gpu,REG_A6XX_GBIF_HALT ,GBIF_CLIENT_HALT_MASK );
@@ -929,7 +932,7 @@ static void a6xx_gmu_force_off(struct a6xx_gmu *gmu)/* Halt the gmu cm3 core */ gmu_write (gmu,REG_A6XX_GMU_CM3_SYSRESET ,1 ); -a6xx_bus_clear_pending_transactions (adreno_gpu); +a6xx_bus_clear_pending_transactions (adreno_gpu, true);/* Reset GPU core blocks */ gpu_write (gpu,REG_A6XX_RBBM_SW_RESET_CMD ,1 );
@@ -1083,7 +1086,7 @@ static void a6xx_gmu_shutdown(struct a6xx_gmu *gmu)return ; } -a6xx_bus_clear_pending_transactions (adreno_gpu); +a6xx_bus_clear_pending_transactions (adreno_gpu, a6xx_gpu->hung);/* tell the GMU we want to slumber */ ret =a6xx_gmu_notify_slumber (gmu);
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +7 -0
@@ -1277,6 +1277,12 @@ static void a6xx_recover(struct msm_gpu *gpu)if (hang_debug)a6xx_dump (gpu); +/* +* To handle recovery specific sequences during the rpm suspend we are +* about to trigger +*/ + a6xx_gpu->hung = true; +/* Halt SQE first */ gpu_write (gpu,REG_A6XX_CP_SQE_CNTL ,3 );
@@ -1319,6 +1325,7 @@ static void a6xx_recover(struct msm_gpu *gpu)mutex_unlock (&gpu->active_lock);msm_gpu_hw_init (gpu); + a6xx_gpu->hung = false; }static const char *a6xx_uche_fault_block (struct msm_gpu *gpu,u32 mid)
drivers/gpu/drm/msm/adreno/a6xx_gpu.h +1 -0
@@ -32,6 +32,7 @@ struct a6xx_gpu {void *llc_slice;void *htw_llc_slice;bool have_mmu500; +bool hung; };#define to_a6xx_gpu (x) container_of(x, struct a6xx_gpu, base)
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 157/313 net: usb: cdc_ether: add support for Thales Cinterion PLS62-W modem
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
[ Upstream commit eea8ce81fbb544e3caad1a1c876ba1af467b3d3c ]
This modem has 7 interfaces, 5 of them are serial interfaces and are driven by cdc_acm, while 2 of them are wwan interfaces and are driven by cdc_ether:
If 0: Abstract (modem)
If 1: Abstract (modem)
If 2: Abstract (modem)
If 3: Abstract (modem)
If 4: Abstract (modem)
If 5: Ethernet Networking
If 6: Ethernet Networking
Without this change, the 2 network interfaces will be named to usb0 and usb1, our QA think the names are confusing and filed a bug on it.
After applying this change, the name will be wwan0 and wwan1, and they could work well with modem manager.
--- drivers/net/usb/cdc_ether.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/usb/cdc_ether.c +6 -0
@@ -1001,6 +1001,12 @@ static const struct usb_device_id products[] = { USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), .driver_info = (unsigned long)&wwan_info, +}, { +/* Cinterion PLS62-W modem by GEMALTO/THALES */ +USB_DEVICE_AND_INTERFACE_INFO (0x1e2d ,0x005b ,USB_CLASS_COMM , +USB_CDC_SUBCLASS_ETHERNET , + USB_CDC_PROTO_NONE), + .driver_info = (unsigned long )&wwan_info, }, {/* Cinterion PLS83/PLS63 modem by GEMALTO/THALES */ USB_DEVICE_AND_INTERFACE_INFO(0x1e2d, 0x0069, USB_CLASS_COMM,
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 158/313 drm: Add orientation quirk for Lenovo ideapad D330-10IGL
In reply to Greg Kroah-HartmanFrom: Patrick Thompson <[email protected]>
[ Upstream commit 0688773f0710528e1ab302c3d6317e269f2e2e6e ]
Panel is 800x1280 but mounted on a detachable form factor sideways.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -304,6 +304,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), }, .driver_data = (void *)&lcd1200x1920_rightside_up, + }, { /* Lenovo Ideapad D330-10IGL (HD) */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGL"), + }, + .driver_data = (void *)&lcd800x1280_rightside_up, }, { /* Lenovo Yoga Book X90F / X91F / X91L */ .matches = {/* Non exact match to match all versions */
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 159/313 s390/debug: add _ASM_S390_ prefix to header guard
In reply to Greg Kroah-HartmanFrom: Niklas Schnelle <[email protected]>
[ Upstream commit 0d4d52361b6c29bf771acd4fa461f06d78fb2fac ]
Using DEBUG_H without a prefix is very generic and inconsistent with other header guards in arch/s390/include/asm. In fact it collides with the same name in the ath9k wireless driver though that depends on !S390 via disabled wireless support. Let's just use a consistent header guard name and prevent possible future trouble.
--- arch/s390/include/asm/debug.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/s390/include/asm/debug.h +3 -3
@@ -4,8 +4,8 @@* * Copyright IBM Corp. 1999, 2020 */ -#ifndef DEBUG_H -#define DEBUG_H +#ifndef _ASM_S390_DEBUG_H +#define _ASM_S390_DEBUG_H#include <linux/string.h> #include <linux/spinlock.h>
@@ -487,4 +487,4 @@ void debug_register_static(debug_info_t *id, int pages_per_area, int nr_areas);#endif /* MODULE */ -#endif /* DEBUG_H */ +#endif /* _ASM_S390_DEBUG_H */
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 160/313 s390: expicitly align _edata and _end symbols on page boundary
In reply to Greg Kroah-HartmanFrom: Alexander Gordeev <[email protected]>
[ Upstream commit 45d619bdaf799196d702a9ae464b07066d6db2f9 ]
Symbols _edata and _end in the linker script are the only unaligned expicitly on page boundary. Although _end is aligned implicitly by BSS_SECTION macro that is still inconsistent and could lead to a bug if a tool or function would assume that _edata is as aligned as others.
For example, vmem_map_init() function does not align symbols _etext, _einittext etc. Should these symbols be unaligned as well, the size of ranges to update were short on one page.
Instead of fixing every occurrence of this kind in the code and external tools just force the alignment on these two symbols.
--- arch/s390/kernel/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/kernel/vmlinux.lds.S +2 -0
@@ -79,6 +79,7 @@ SECTIONS _end_amode31_refs = .; } + . = ALIGN(PAGE_SIZE); _edata = .; /* End of data section */ /* will be freed after init */
@@ -193,6 +194,7 @@ SECTIONS BSS_SECTION(PAGE_SIZE, 4 * PAGE_SIZE, PAGE_SIZE) + . = ALIGN(PAGE_SIZE); _end = . ; /*
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 161/313 xen/pvcalls: free active map buffer on pvcalls_front_free_map
In reply to Greg Kroah-HartmanFrom: Oleksii Moisieiev <[email protected]>
[ Upstream commit f57034cedeb6e00256313a2a6ee67f974d709b0b ]
Data buffer for active map is allocated in alloc_active_ring and freed in free_active_ring function, which is used only for the error cleanup. pvcalls_front_release is calling pvcalls_front_free_map which ends foreign access for this buffer, but doesn't free allocated pages. Call free_active_ring to clean all allocated resources.
--- drivers/xen/pvcalls-front.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/xen/pvcalls-front.c +3 -1
@@ -225,6 +225,8 @@ static irqreturn_t pvcalls_front_event_handler(int irq, void *dev_id)return IRQ_HANDLED ; } +static void free_active_ring (struct sock_mapping *map); +static void pvcalls_front_free_map (struct pvcalls_bedata *bedata,struct sock_mapping *map) {
@@ -240,7 +242,7 @@ static void pvcalls_front_free_map(struct pvcalls_bedata *bedata,for (i =0 ; i < (1 <<PVCALLS_RING_ORDER ); i++)gnttab_end_foreign_access (map->active.ring->ref[i],NULL );gnttab_end_foreign_access (map->active.ref,NULL ); -free_page ((unsigned long )map->active.ring); +free_active_ring (map);kfree (map); }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 162/313 perf/x86/cstate: Add Meteor Lake support
In reply to Greg Kroah-HartmanFrom: Kan Liang <[email protected]>
[ Upstream commit 01f2ea5bcf89dbd7a6530dbce7f2fb4e327e7006 ]
Meteor Lake is Intel's successor to Raptor lake. From the perspective of Intel cstate residency counters, there is nothing changed compared with Raptor lake.
Share adl_cstates with Raptor lake.
Update the comments for Meteor Lake.
--- arch/x86/events/intel/cstate.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
arch/x86/events/intel/cstate.c +12 -9
@@ -41,6 +41,7 @@* MSR_CORE_C1_RES: CORE C1 Residency Counter * perf code: 0x00 * Available model: SLM,AMT,GLM,CNL,ICX,TNT,ADL,RPL +* MTL * Scope: Core (each processor core has a MSR) * MSR_CORE_C3_RESIDENCY: CORE C3 Residency Counter * perf code: 0x01
@@ -51,50 +52,50 @@* perf code: 0x02 * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW, * SKL,KNL,GLM,CNL,KBL,CML,ICL,ICX, -* TGL,TNT,RKL,ADL,RPL,SPR +* TGL,TNT,RKL,ADL,RPL,SPR,MTL * Scope: Core * MSR_CORE_C7_RESIDENCY: CORE C7 Residency Counter * perf code: 0x03 * Available model: SNB,IVB,HSW,BDW,SKL,CNL,KBL,CML, -* ICL,TGL,RKL,ADL,RPL +* ICL,TGL,RKL,ADL,RPL,MTL * Scope: Core * MSR_PKG_C2_RESIDENCY: Package C2 Residency Counter. * perf code: 0x00 * Available model: SNB,IVB,HSW,BDW,SKL,KNL,GLM,CNL, * KBL,CML,ICL,ICX,TGL,TNT,RKL,ADL, -* RPL,SPR +* RPL,SPR,MTL * Scope: Package (physical package) * MSR_PKG_C3_RESIDENCY: Package C3 Residency Counter. * perf code: 0x01 * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,KNL, * GLM,CNL,KBL,CML,ICL,TGL,TNT,RKL, -* ADL,RPL +* ADL,RPL,MTL * Scope: Package (physical package) * MSR_PKG_C6_RESIDENCY: Package C6 Residency Counter. * perf code: 0x02 * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW, * SKL,KNL,GLM,CNL,KBL,CML,ICL,ICX, -* TGL,TNT,RKL,ADL,RPL,SPR +* TGL,TNT,RKL,ADL,RPL,SPR,MTL * Scope: Package (physical package) * MSR_PKG_C7_RESIDENCY: Package C7 Residency Counter. * perf code: 0x03 * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,CNL, -* KBL,CML,ICL,TGL,RKL,ADL,RPL +* KBL,CML,ICL,TGL,RKL,ADL,RPL,MTL * Scope: Package (physical package) * MSR_PKG_C8_RESIDENCY: Package C8 Residency Counter. * perf code: 0x04 * Available model: HSW ULT,KBL,CNL,CML,ICL,TGL,RKL, -* ADL,RPL +* ADL,RPL,MTL * Scope: Package (physical package) * MSR_PKG_C9_RESIDENCY: Package C9 Residency Counter. * perf code: 0x05 * Available model: HSW ULT,KBL,CNL,CML,ICL,TGL,RKL, -* ADL,RPL +* ADL,RPL,MTL * Scope: Package (physical package) * MSR_PKG_C10_RESIDENCY: Package C10 Residency Counter. * perf code: 0x06 * Available model: HSW ULT,KBL,GLM,CNL,CML,ICL,TGL, -* TNT,RKL,ADL,RPL +* TNT,RKL,ADL,RPL,MTL * Scope: Package (physical package) * */
@@ -686,6 +687,8 @@ static const struct x86_cpu_id intel_cstates_match[] __initconst = {X86_MATCH_INTEL_FAM6_MODEL (RAPTORLAKE , &adl_cstates),X86_MATCH_INTEL_FAM6_MODEL (RAPTORLAKE_P , &adl_cstates),X86_MATCH_INTEL_FAM6_MODEL (RAPTORLAKE_S , &adl_cstates), +X86_MATCH_INTEL_FAM6_MODEL (METEORLAKE , &adl_cstates), +X86_MATCH_INTEL_FAM6_MODEL (METEORLAKE_L , &adl_cstates), { }, };MODULE_DEVICE_TABLE (x86cpu, intel_cstates_match);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 163/313 perf/x86/msr: Add Meteor Lake support
In reply to Greg Kroah-HartmanFrom: Kan Liang <[email protected]>
[ Upstream commit 6887a4d3aede084bf08b70fbc9736c69fce05d7f ]
Meteor Lake is Intel's successor to Raptor lake. PPERF and SMI_COUNT MSRs are also supported.
--- arch/x86/events/msr.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/events/msr.c +2 -0
@@ -107,6 +107,8 @@ static bool test_intel(int idx, void *data)case INTEL_FAM6_RAPTORLAKE :case INTEL_FAM6_RAPTORLAKE_P :case INTEL_FAM6_RAPTORLAKE_S : +case INTEL_FAM6_METEORLAKE : +case INTEL_FAM6_METEORLAKE_L :if (idx ==PERF_MSR_SMI || idx ==PERF_MSR_PPERF )return true;break ;
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 164/313 perf/x86/msr: Add Emerald Rapids
In reply to Greg Kroah-HartmanFrom: Kan Liang <[email protected]>
[ Upstream commit 69ced4160969025821f2999ff92163ed26568f1c ]
The same as Sapphire Rapids, the SMI_COUNT MSR is also supported on Emerald Rapids. Add Emerald Rapids model.
--- arch/x86/events/msr.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/events/msr.c +1 -0
@@ -69,6 +69,7 @@ static bool test_intel(int idx, void *data)case INTEL_FAM6_BROADWELL_G :case INTEL_FAM6_BROADWELL_X :case INTEL_FAM6_SAPPHIRERAPIDS_X : +case INTEL_FAM6_EMERALDRAPIDS_X :case INTEL_FAM6_ATOM_SILVERMONT :case INTEL_FAM6_ATOM_SILVERMONT_D :
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 165/313 perf/x86/intel/uncore: Add Emerald Rapids
In reply to Greg Kroah-HartmanFrom: Kan Liang <[email protected]>
[ Upstream commit 5268a2842066c227e6ccd94bac562f1e1000244f ]
Quoted 1 line
From the perspective of the uncore PMU, the new Emerald Rapids is the
same as the Sapphire Rapids. The only difference is the event list, which will be supported in the perf tool later.
--- arch/x86/events/intel/uncore.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/events/intel/uncore.c +1 -0
@@ -1833,6 +1833,7 @@ static const struct x86_cpu_id intel_uncore_match[] __initconst = {X86_MATCH_INTEL_FAM6_MODEL (RAPTORLAKE_P , &adl_uncore_init),X86_MATCH_INTEL_FAM6_MODEL (RAPTORLAKE_S , &adl_uncore_init),X86_MATCH_INTEL_FAM6_MODEL (SAPPHIRERAPIDS_X , &spr_uncore_init), +X86_MATCH_INTEL_FAM6_MODEL (EMERALDRAPIDS_X , &spr_uncore_init), X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_D, &snr_uncore_init), {}, };
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 166/313 nolibc: fix fd_set type
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
[ Upstream commit feaf75658783a919410f8c2039dbc24b6a29603d ]
The kernel uses unsigned long for the fd_set bitmap, but nolibc use u32. This works fine on little endian machines, but fails on big endian. Convert to unsigned long to fix this.
--- tools/include/nolibc/types.h | 53 ++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 23 deletions(-)
tools/include/nolibc/types.h +30 -23
@@ -89,39 +89,46 @@#define EXIT_SUCCESS 0#define EXIT_FAILURE 1 +#define FD_SETIDXMASK (8 * sizeof(unsigned long)) +#define FD_SETBITMASK (8 * sizeof(unsigned long)-1) +/* for select() */ typedef struct { -uint32_t fd32[(FD_SETSIZE +31 ) /32 ]; +unsigned long fds[(FD_SETSIZE +FD_SETBITMASK ) /FD_SETIDXMASK ]; }fd_set ; -#define FD_CLR (fd, set) do { \ - fd_set *__set = (set); \ - int __fd = (fd); \ - if (__fd >= 0) \ - __set->fd32[__fd / 32] &= ~(1U << (__fd & 31)); \ +#define FD_CLR (fd, set) do { \ + fd_set *__set = (set); \ + int __fd = (fd); \ + if (__fd >= 0) \ + __set->fds[__fd / FD_SETIDXMASK] &= \ + ~(1U << (__fd & FX_SETBITMASK)); \ } while (0) -#define FD_SET (fd, set) do { \ - fd_set *__set = (set); \ - int __fd = (fd); \ - if (__fd >= 0) \ - __set->fd32[__fd / 32] |= 1U << (__fd & 31); \ +#define FD_SET (fd, set) do { \ + fd_set *__set = (set); \ + int __fd = (fd); \ + if (__fd >= 0) \ + __set->fds[__fd / FD_SETIDXMASK] |= \ + 1 << (__fd & FD_SETBITMASK); \ } while (0) -#define FD_ISSET (fd, set) ({ \ - fd_set *__set = (set); \ - int __fd = (fd); \ - int __r = 0; \ - if (__fd >= 0) \ - __r = !!(__set->fd32[__fd / 32] & 1U << (__fd & 31)); \ - __r; \ +#define FD_ISSET (fd, set) ({ \ + fd_set *__set = (set); \ + int __fd = (fd); \ + int __r = 0; \ + if (__fd >= 0) \ + __r = !!(__set->fds[__fd / FD_SETIDXMASK] & \ +1U << (__fd & FD_SET_BITMASK)); \ + __r; \ }) -#define FD_ZERO (set) do { \ - fd_set *__set = (set); \ - int __idx; \ - for (__idx = 0; __idx < (FD_SETSIZE+31) / 32; __idx ++) \ - __set->fd32[__idx] = 0; \ +#define FD_ZERO (set) do { \ + fd_set *__set = (set); \ + int __idx; \ + int __size = (FD_SETSIZE+FD_SETBITMASK) / FD_SETIDXMASK;\ + for (__idx = 0; __idx < __size; __idx++) \ + __set->fds[__idx] = 0; \ } while (0)/* for poll() */
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 167/313 tools/nolibc: Fix S_ISxxx macros
In reply to Greg Kroah-HartmanFrom: Warner Losh <[email protected]>
[ Upstream commit 16f5cea74179b5795af7ce359971f5128d10f80e ]
The mode field has the type encoded as an value in a field, not as a bit mask. Mask the mode with S_IFMT instead of each type to test. Otherwise, false positives are possible: eg S_ISDIR will return true for block devices because S_IFDIR = 0040000 and S_IFBLK = 0060000 since mode is masked with S_IFDIR instead of S_IFMT. These macros now match the similar definitions in tools/include/uapi/linux/stat.h.
--- tools/include/nolibc/types.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
tools/include/nolibc/types.h +7 -7
@@ -26,13 +26,13 @@#define S_IFSOCK 0140000#define S_IFMT 0170000 -#define S_ISDIR (mode) (((mode) & S_IFDIR) == S_IFDIR) -#define S_ISCHR (mode) (((mode) & S_IFCHR) == S_IFCHR) -#define S_ISBLK (mode) (((mode) & S_IFBLK) == S_IFBLK) -#define S_ISREG (mode) (((mode) & S_IFREG) == S_IFREG) -#define S_ISFIFO (mode) (((mode) & S_IFIFO) == S_IFIFO) -#define S_ISLNK (mode) (((mode) & S_IFLNK) == S_IFLNK) -#define S_ISSOCK (mode) (((mode) & S_IFSOCK) == S_IFSOCK) +#define S_ISDIR (mode) (((mode) & S_IFMT) == S_IFDIR) +#define S_ISCHR (mode) (((mode) & S_IFMT) == S_IFCHR) +#define S_ISBLK (mode) (((mode) & S_IFMT) == S_IFBLK) +#define S_ISREG (mode) (((mode) & S_IFMT) == S_IFREG) +#define S_ISFIFO (mode) (((mode) & S_IFMT) == S_IFIFO) +#define S_ISLNK (mode) (((mode) & S_IFMT) == S_IFLNK) +#define S_ISSOCK (mode) (((mode) & S_IFMT) == S_IFSOCK)/* dirent types */ #define DT_UNKNOWN 0x0
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 168/313 tools/nolibc: fix missing includes causing build issues at -O0
In reply to Greg Kroah-HartmanFrom: Willy Tarreau <[email protected]>
[ Upstream commit 55abdd1f5e1e07418bf4a46c233a92f83cb5ae97 ]
After the nolibc includes were split to facilitate portability from standard libcs, programs that include only what they need may miss some symbols which are needed by libgcc. This is the case for raise() which is needed by the divide by zero code in some architectures for example.
Regardless, being able to include only the apparently needed files is convenient.
Instead of trying to move all exported definitions to a single file, since this can change over time, this patch takes another approach consisting in including the nolibc header at the end of all standard include files. This way their types and functions are already known at the moment of inclusion, and including any single one of them is sufficient to bring all the required ones.
--- tools/include/nolibc/ctype.h | 3 +++ tools/include/nolibc/errno.h | 3 +++ tools/include/nolibc/signal.h | 3 +++ tools/include/nolibc/stdio.h | 3 +++ tools/include/nolibc/stdlib.h | 3 +++ tools/include/nolibc/string.h | 3 +++ tools/include/nolibc/sys.h | 2 ++ tools/include/nolibc/time.h | 3 +++ tools/include/nolibc/types.h | 3 +++ tools/include/nolibc/unistd.h | 3 +++ 10 files changed, 29 insertions(+)
tools/include/nolibc/ctype.h +3 -0
@@ -96,4 +96,7 @@ int ispunct(int c) return isgraph(c) && !isalnum(c); } +/* make sure to include all global symbols */ +#include "nolibc.h" +#endif /* _NOLIBC_CTYPE_H */
tools/include/nolibc/errno.h +3 -0
@@ -24,4 +24,7 @@ static int errno;*/ #define MAX_ERRNO 4095 +/* make sure to include all global symbols */ +#include "nolibc.h" +#endif /* _NOLIBC_ERRNO_H */
tools/include/nolibc/signal.h +3 -0
@@ -19,4 +19,7 @@ int raise(int signal) return sys_kill(sys_getpid(), signal); } +/* make sure to include all global symbols */ +#include "nolibc.h" +#endif /* _NOLIBC_SIGNAL_H */
tools/include/nolibc/stdio.h +3 -0
@@ -303,4 +303,7 @@ void perror(const char *msg) fprintf(stderr, "%s%serrno=%d\n", (msg && *msg) ? msg : "", (msg && *msg) ? ": " : "", errno); } +/* make sure to include all global symbols */ +#include "nolibc.h" +#endif /* _NOLIBC_STDIO_H */
tools/include/nolibc/stdlib.h +3 -0
@@ -419,4 +419,7 @@ char *u64toa(uint64_t in) return itoa_buffer; } +/* make sure to include all global symbols */ +#include "nolibc.h" +#endif /* _NOLIBC_STDLIB_H */
tools/include/nolibc/string.h +3 -0
@@ -285,4 +285,7 @@ char *strrchr(const char *s, int c) return (char *)ret; } +/* make sure to include all global symbols */ +#include "nolibc.h" +#endif /* _NOLIBC_STRING_H */
tools/include/nolibc/sys.h +2 -0
@@ -1243,5 +1243,7 @@ ssize_t write(int fd, const void *buf, size_t count) return ret; } +/* make sure to include all global symbols */ +#include "nolibc.h" #endif /* _NOLIBC_SYS_H */
tools/include/nolibc/time.h +3 -0
@@ -25,4 +25,7 @@ time_t time(time_t *tptr) return tv.tv_sec; } +/* make sure to include all global symbols */ +#include "nolibc.h" +#endif /* _NOLIBC_TIME_H */
tools/include/nolibc/types.h +3 -0
@@ -209,4 +209,7 @@ struct stat { })#endif +/* make sure to include all global symbols */ +#include "nolibc.h" +#endif /* _NOLIBC_TYPES_H */
tools/include/nolibc/unistd.h +3 -0
@@ -51,4 +51,7 @@ int tcsetpgrp(int fd, pid_t pid) return ioctl(fd, TIOCSPGRP, &pid); } +/* make sure to include all global symbols */ +#include "nolibc.h" +#endif /* _NOLIBC_UNISTD_H */
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 169/313 tools/nolibc: prevent gcc from making memset() loop over itself
In reply to Greg Kroah-HartmanFrom: Willy Tarreau <[email protected]>
[ Upstream commit 1bfbe1f3e96720daf185f03d101f072d69753f88 ]
When building on ARM in thumb mode with gcc-11.3 at -O2 or -O3, nolibc-test segfaults during the select() tests. It turns out that at this level, gcc recognizes an opportunity for using memset() to zero the fd_set, but it miscompiles it because it also recognizes a memset pattern as well, and decides to call memset() from the memset() code:
000122bc <memset>:
122bc: b510 push {r4, lr}
122be: 0004 movs r4, r0
122c0: 2a00 cmp r2, #0
122c2: d003 beq.n 122cc <memset+0x10>
122c4: 23ff movs r3, #255 ; 0xff
122c6: 4019 ands r1, r3
122c8: f7ff fff8 bl 122bc <memset>
122cc: 0020 movs r0, r4
122ce: bd10 pop {r4, pc}Simply placing an empty asm() statement inside the loop suffices to avoid this.
--- tools/include/nolibc/string.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/include/nolibc/string.h +4 -1
@@ -88,8 +88,11 @@ void *memset(void *dst, int b, size_t len) {char *p = dst; -while (len--) +while (len--) { +/* prevent gcc from recognizing memset() here */ + asmvolatile ("" ); *(p++) = b; + }return dst; }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 170/313 cpufreq: armada-37xx: stop using 0 as NULL pointer
In reply to Greg Kroah-HartmanFrom: Miles Chen <[email protected]>
[ Upstream commit 08f0adb193c008de640fde34a2e00a666c01d77c ]
Use NULL for NULL pointer to fix the following sparse warning:drivers/cpufreq/armada-37xx-cpufreq.c:448:32: sparse: warning: Using plain integer as NULL pointer
--- drivers/cpufreq/armada-37xx-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/armada-37xx-cpufreq.c +1 -1
@@ -445,7 +445,7 @@ static int __init armada37xx_cpufreq_driver_init(void)return -ENODEV ; } - clk =clk_get (cpu_dev,0 ); + clk =clk_get (cpu_dev,NULL );if (IS_ERR (clk)) {dev_err (cpu_dev,"Cannot get clock for CPU0\n" );return PTR_ERR (clk);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 171/313 ASoC: fsl_ssi: Rename AC97 streams to avoid collisions with AC97 CODEC
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 8c6a42b5b0ed6f96624f56954e93eeae107440a6 ]
The SSI driver calls the AC'97 playback and transmit streams "AC97 Playback" and "AC97 Capture" respectively. This is the same name used by the generic AC'97 CODEC driver in ASoC, creating confusion for the Freescale ASoC card when it attempts to use these widgets in routing. Add a "CPU" in the name like the regular DAIs registered by the driver to disambiguate.
--- sound/soc/fsl/fsl-asoc-card.c | 8 ++++---- sound/soc/fsl/fsl_ssi.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
sound/soc/fsl/fsl-asoc-card.c +4 -4
@@ -121,11 +121,11 @@ static const struct snd_soc_dapm_route audio_map[] = {static const struct snd_soc_dapm_route audio_map_ac97[] = {/* 1st half -- Normal DAPM routes */ - {"Playback" ,NULL ,"AC97 Playback" }, - {"AC97 Capture" ,NULL ,"Capture" }, + {"Playback" ,NULL ,"CPU AC97 Playback" }, + {"CPU AC97 Capture" ,NULL ,"Capture" },/* 2nd half -- ASRC DAPM routes */ - {"AC97 Playback" ,NULL ,"ASRC-Playback" }, - {"ASRC-Capture" ,NULL ,"AC97 Capture" }, + {"CPU AC97 Playback" ,NULL ,"ASRC-Playback" }, + {"ASRC-Capture" ,NULL ,"CPU AC97 Capture" }, };static const struct snd_soc_dapm_route audio_map_tx[] = {
sound/soc/fsl/fsl_ssi.c +2 -2
@@ -1189,14 +1189,14 @@ static struct snd_soc_dai_driver fsl_ssi_ac97_dai = { .symmetric_channels = 1, .probe = fsl_ssi_dai_probe, .playback = { - .stream_name = "AC97 Playback", + .stream_name = "CPU AC97 Playback", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_48000, .formats = SNDRV_PCM_FMTBIT_S16 | SNDRV_PCM_FMTBIT_S20, }, .capture = { - .stream_name = "AC97 Capture", + .stream_name = "CPU AC97 Capture", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_48000,
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 172/313 ASoC: fsl-asoc-card: Fix naming of AC97 CODEC widgets
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 242fc66ae6e1e2b8519daacc7590a73cd0e8a6e4 ]
The fsl-asoc-card AC'97 support currently tries to route to Playback and Capture widgets provided by the AC'97 CODEC. This doesn't work since the generic AC'97 driver registers with an "AC97" at the front of the stream and hence widget names, update to reflect reality. It's not clear to me if or how this ever worked.
--- sound/soc/fsl/fsl-asoc-card.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/fsl/fsl-asoc-card.c +2 -2
@@ -121,8 +121,8 @@ static const struct snd_soc_dapm_route audio_map[] = {static const struct snd_soc_dapm_route audio_map_ac97[] = {/* 1st half -- Normal DAPM routes */ - {"Playback" ,NULL ,"CPU AC97 Playback" }, - {"CPU AC97 Capture" ,NULL ,"Capture" }, + {"AC97 Playback" ,NULL ,"CPU AC97 Playback" }, + {"CPU AC97 Capture" ,NULL ,"AC97 Capture" },/* 2nd half -- ASRC DAPM routes */ {"CPU AC97 Playback" ,NULL ,"ASRC-Playback" }, {"ASRC-Capture" ,NULL ,"CPU AC97 Capture" },
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 173/313 ACPI: resource: Skip IRQ override on Asus Expertbook B2402CBA
In reply to Greg Kroah-HartmanFrom: Tamim Khan <[email protected]>
[ Upstream commit 77c7248882385397cd7dffe9e1437f59f32ce2de ]
Like the Asus Expertbook B2502CBA and various Asus Vivobook laptops, the Asus Expertbook B2402CBA has an ACPI DSDT table that describes IRQ 1 as ActiveLow while the kernel overrides it to Edge_High. This prevents the keyboard from working. To fix this issue, add this laptop to the skip_override_table so that the kernel does not override IRQ 1.
--- drivers/acpi/resource.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/acpi/resource.c +7 -0
@@ -432,6 +432,13 @@ static const struct dmi_system_id asus_laptop[] = { DMI_MATCH(DMI_BOARD_NAME, "S5602ZA"), }, }, + { + .ident = "Asus ExpertBook B2402CBA", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ), + DMI_MATCH(DMI_BOARD_NAME, "B2402CBA"), + }, + }, { .ident ="Asus ExpertBook B2502" , .matches = {
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 174/313 drm/amdkfd: Add sync after creating vram bo
In reply to Greg Kroah-HartmanFrom: Eric Huang <[email protected]>
[ Upstream commit ba029e9991d9be90a28b6a0ceb25e9a6fb348829 ]
There will be data corruption on vram allocated by svm if the initialization is not complete and application is writting on the memory. Adding sync to wait for the initialization completion is to resolve this issue.
--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +9 -0
@@ -570,6 +570,15 @@ svm_range_vram_node_new(struct amdgpu_device *adev, struct svm_range *prange, goto reserve_bo_failed; } +if (clear) { + r =amdgpu_bo_sync_wait (bo,AMDGPU_FENCE_OWNER_KFD , false); +if (r) { +pr_debug ("failed %d to sync bo\n" , r); +amdgpu_bo_unreserve (bo); + goto reserve_bo_failed; + } + } + r =dma_resv_reserve_fences (bo->tbo.base.resv,1 );if (r) {pr_debug ("failed %d to reserve bo\n" , r);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 175/313 drm/amdkfd: Fix NULL pointer error for GC 11.0.1 on mGPU
In reply to Greg Kroah-HartmanFrom: Eric Huang <[email protected]>
[ Upstream commit a6941f89d7c6a6ba49316bbd7da2fb2f719119a7 ]
The point bo->kfd_bo is NULL for queue's write pointer BO when creating queue on mGPU. To avoid using the pointer fixes the error.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +1 -1
@@ -2130,7 +2130,7 @@ int amdgpu_amdkfd_map_gtt_bo_to_gart(struct amdgpu_device *adev, struct amdgpu_b }amdgpu_amdkfd_remove_eviction_fence ( - bo, bo->kfd_bo->process_info->eviction_fence); + bo, bo->vm_bo->vm->process_info->eviction_fence);amdgpu_bo_unreserve (bo);
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1 -1
@@ -200,7 +200,7 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q, queue_input.wptr_addr = (uint64_t )q->properties.write_ptr;if (q->wptr_bo) { - wptr_addr_off = (uint64_t )q->properties.write_ptr - (uint64_t )q->wptr_bo->kfd_bo->va; + wptr_addr_off = (uint64_t )q->properties.write_ptr & (PAGE_SIZE -1 ); queue_input.wptr_mc_addr = ((uint64_t )q->wptr_bo->tbo.resource->start <<PAGE_SHIFT ) + wptr_addr_off; }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 176/313 cifs: fix potential memory leaks in session setup
In reply to Greg Kroah-HartmanFrom: Paulo Alcantara <[email protected]>
[ Upstream commit 2fe58d977ee05da5bb89ef5dc4f5bf2dc15db46f ]
Make sure to free cifs_ses::auth_key.response before allocating it as we might end up leaking memory in reconnect or mounting.
--- fs/cifs/cifsencrypt.c | 1 + fs/cifs/sess.c | 2 ++ fs/cifs/smb2pdu.c | 1 + 3 files changed, 4 insertions(+)
fs/cifs/cifsencrypt.c +1 -0
@@ -278,6 +278,7 @@ build_avpair_blob(struct cifs_ses *ses, const struct nls_table *nls_cp)* ( for NTLMSSP_AV_NB_DOMAIN_NAME followed by NTLMSSP_AV_EOL ) + * unicode length of a netbios domain name */ +kfree_sensitive (ses->auth_key.response); ses->auth_key.len = size +2 * dlen; ses->auth_key.response =kzalloc (ses->auth_key.len,GFP_KERNEL );if (!ses->auth_key.response) {
fs/cifs/sess.c +2 -0
@@ -815,6 +815,7 @@ int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len,return -EINVAL ; }if (tilen) { +kfree_sensitive (ses->auth_key.response); ses->auth_key.response =kmemdup (bcc_ptr + tioffset, tilen,GFP_KERNEL );if (!ses->auth_key.response) {
@@ -1428,6 +1429,7 @@ sess_auth_kerberos(struct sess_data *sess_data) goto out_put_spnego_key; } +kfree_sensitive (ses->auth_key.response); ses->auth_key.response =kmemdup (msg->data, msg->sesskey_len,GFP_KERNEL );if (!ses->auth_key.response) {
fs/cifs/smb2pdu.c +1 -0
@@ -1453,6 +1453,7 @@ SMB2_auth_kerberos(struct SMB2_sess_data *sess_data)/* keep session key if binding */ if (!is_binding) { +kfree_sensitive (ses->auth_key.response); ses->auth_key.response =kmemdup (msg->data, msg->sesskey_len,GFP_KERNEL );if (!ses->auth_key.response) {
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 177/313 spi: spidev: remove debug messages that access spidev->spi without locking
In reply to Greg Kroah-HartmanFrom: Bartosz Golaszewski <[email protected]>
[ Upstream commit 6b35b173dbc1711f8d272e3f322d2ad697015919 ]
The two debug messages in spidev_open() dereference spidev->spi without taking the lock and without checking if it's not null. This can lead to a crash. Drop the messages as they're not needed - the user-space will get informed about ENOMEM with the syscall return value.
--- drivers/spi/spidev.c | 2 -- 1 file changed, 2 deletions(-)
drivers/spi/spidev.c +0 -2
@@ -601,7 +601,6 @@ static int spidev_open(struct inode *inode, struct file *filp)if (!spidev->tx_buffer) { spidev->tx_buffer =kmalloc (bufsiz,GFP_KERNEL );if (!spidev->tx_buffer) { -dev_dbg (&spidev->spi->dev,"open/ENOMEM\n" ); status = -ENOMEM ; goto err_find_dev; }
@@ -610,7 +609,6 @@ static int spidev_open(struct inode *inode, struct file *filp)if (!spidev->rx_buffer) { spidev->rx_buffer =kmalloc (bufsiz,GFP_KERNEL );if (!spidev->rx_buffer) { -dev_dbg (&spidev->spi->dev,"open/ENOMEM\n" ); status = -ENOMEM ; goto err_alloc_rx_buf; }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 178/313 KVM: s390: interrupt: use READ_ONCE() before cmpxchg()
In reply to Greg Kroah-HartmanFrom: Heiko Carstens <[email protected]>
[ Upstream commit 42400d99e9f0728c17240edb9645637ead40f6b9 ]
Use READ_ONCE() before cmpxchg() to prevent that the compiler generates code that fetches the to be compared old value several times from memory.
--- arch/s390/kvm/interrupt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
arch/s390/kvm/interrupt.c +8 -4
@@ -83,8 +83,9 @@ static int sca_inject_ext_call(struct kvm_vcpu *vcpu, int src_id)struct esca_block *sca = vcpu->kvm->arch.sca;union esca_sigp_ctrl *sigp_ctrl = &(sca->cpu[vcpu->vcpu_id].sigp_ctrl); -union esca_sigp_ctrl new_val = {0 }, old_val = *sigp_ctrl; +union esca_sigp_ctrl new_val = {0 }, old_val; + old_val =READ_ONCE (*sigp_ctrl); new_val.scn = src_id; new_val.c =1 ; old_val.c =0 ;
@@ -95,8 +96,9 @@ static int sca_inject_ext_call(struct kvm_vcpu *vcpu, int src_id)struct bsca_block *sca = vcpu->kvm->arch.sca;union bsca_sigp_ctrl *sigp_ctrl = &(sca->cpu[vcpu->vcpu_id].sigp_ctrl); -union bsca_sigp_ctrl new_val = {0 }, old_val = *sigp_ctrl; +union bsca_sigp_ctrl new_val = {0 }, old_val; + old_val =READ_ONCE (*sigp_ctrl); new_val.scn = src_id; new_val.c =1 ; old_val.c =0 ;
@@ -126,16 +128,18 @@ static void sca_clear_ext_call(struct kvm_vcpu *vcpu)struct esca_block *sca = vcpu->kvm->arch.sca;union esca_sigp_ctrl *sigp_ctrl = &(sca->cpu[vcpu->vcpu_id].sigp_ctrl); -union esca_sigp_ctrl old = *sigp_ctrl; +union esca_sigp_ctrl old; + old =READ_ONCE (*sigp_ctrl); expect = old.value; rc =cmpxchg (&sigp_ctrl->value, old.value,0 ); }else {struct bsca_block *sca = vcpu->kvm->arch.sca;union bsca_sigp_ctrl *sigp_ctrl = &(sca->cpu[vcpu->vcpu_id].sigp_ctrl); -union bsca_sigp_ctrl old = *sigp_ctrl; +union bsca_sigp_ctrl old; + old =READ_ONCE (*sigp_ctrl); expect = old.value; rc =cmpxchg (&sigp_ctrl->value, old.value,0 ); }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 179/313 scsi: hisi_sas: Use abort task set to reset SAS disks when discovered
In reply to Greg Kroah-HartmanFrom: Xingui Yang <[email protected]>
[ Upstream commit 037b48057e8b485a8d72f808122796aeadbbee32 ]
Currently clear task set is used to abort all commands remaining in the disk when the SAS disk is discovered, and if the disk is discovered by two initiators, other I_T nexuses are also affected. So use abort task set instead and take effect only on the specified I_T nexus.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +1 -1
@@ -714,7 +714,7 @@ static int hisi_sas_init_device(struct domain_device *device)int_to_scsilun (0 , &lun);while (retry-- >0 ) { - rc =sas_clear_task_set (device, lun.scsi_lun); + rc =sas_abort_task_set (device, lun.scsi_lun);if (rc ==TMF_RESP_FUNC_COMPLETE ) {hisi_sas_release_task (hisi_hba, device);break ;
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 180/313 scsi: hisi_sas: Set a port invalid only if there are no devices attached when refreshing port id
In reply to Greg Kroah-HartmanFrom: Yihang Li <[email protected]>
[ Upstream commit f58c89700630da6554b24fd3df293a24874c10c1 ]
Currently the driver sets the port invalid if one phy in the port is not enabled, which may cause issues in expander situation. In directly attached situation, if phy up doesn't occur in time when refreshing port id, the port is incorrectly set to invalid which will also cause disk lost.
Therefore set a port invalid only if there are no devices attached to the port.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +1 -1
@@ -1334,7 +1334,7 @@ static void hisi_sas_refresh_port_id(struct hisi_hba *hisi_hba) device->linkrate = phy->sas_phy.linkrate; hisi_hba->hw->setup_itct (hisi_hba, sas_dev); - }else + }else if (!port->port_attached) port->id =0xff ; } }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 181/313 r8152: add vendor/device ID pair for Microsoft Devkit
In reply to Greg Kroah-HartmanFrom: Andre Przywara <[email protected]>
[ Upstream commit be53771c87f4e322a9835d3faa9cd73a4ecdec5b ]
The Microsoft Devkit 2023 is a an ARM64 based machine featuring a Realtek 8153 USB3.0-to-GBit Ethernet adapter. As in their other machines, Microsoft uses a custom USB device ID.
Add the respective ID values to the driver. This makes Ethernet work on the MS Devkit device. The chip has been visually confirmed to be a RTL8153.
--- drivers/net/usb/r8152.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/r8152.c +1 -0
@@ -9836,6 +9836,7 @@ static const struct usb_device_id rtl8152_table[] = {REALTEK_USB_DEVICE (VENDOR_ID_MICROSOFT ,0x07ab ),REALTEK_USB_DEVICE (VENDOR_ID_MICROSOFT ,0x07c6 ),REALTEK_USB_DEVICE (VENDOR_ID_MICROSOFT ,0x0927 ), +REALTEK_USB_DEVICE (VENDOR_ID_MICROSOFT ,0x0c5e ),REALTEK_USB_DEVICE (VENDOR_ID_SAMSUNG ,0xa101 ),REALTEK_USB_DEVICE (VENDOR_ID_LENOVO ,0x304f ), REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3054),
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 182/313 platform/x86: touchscreen_dmi: Add info for the CSL Panther Tab HD
In reply to Greg Kroah-HartmanFrom: Michael Klein <[email protected]>
[ Upstream commit 36c2b9d6710427f802494ba070621cb415198293 ]
Add touchscreen info for the CSL Panther Tab HD.
--- drivers/platform/x86/touchscreen_dmi.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/platform/x86/touchscreen_dmi.c +25 -0
@@ -264,6 +264,23 @@ static const struct ts_dmi_data connect_tablet9_data = { .properties = connect_tablet9_props, }; +static const struct property_entry csl_panther_tab_hd_props[] = { +PROPERTY_ENTRY_U32 ("touchscreen-min-x" ,1 ), +PROPERTY_ENTRY_U32 ("touchscreen-min-y" ,20 ), +PROPERTY_ENTRY_U32 ("touchscreen-size-x" ,1980 ), +PROPERTY_ENTRY_U32 ("touchscreen-size-y" ,1526 ), +PROPERTY_ENTRY_BOOL ("touchscreen-inverted-y" ), +PROPERTY_ENTRY_BOOL ("touchscreen-swapped-x-y" ), +PROPERTY_ENTRY_STRING ("firmware-name" ,"gsl1680-csl-panther-tab-hd.fw" ), +PROPERTY_ENTRY_U32 ("silead,max-fingers" ,10 ), + { } +}; + +static const struct ts_dmi_data csl_panther_tab_hd_data = { + .acpi_name ="MSSL1680:00" , + .properties = csl_panther_tab_hd_props, +}; +static const struct property_entry cube_iwork8_air_props[] = {PROPERTY_ENTRY_U32 ("touchscreen-min-x" ,1 ),PROPERTY_ENTRY_U32 ("touchscreen-min-y" ,3 ),
@@ -1124,6 +1141,14 @@ const struct dmi_system_id touchscreen_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Tablet 9"), }, }, + { +/* CSL Panther Tab HD */ + .driver_data = (void *)&csl_panther_tab_hd_data, + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"CSL Computer GmbH & Co. KG" ), + DMI_MATCH(DMI_PRODUCT_NAME, "CSL Panther Tab HD"), + }, + }, {/* CUBE iwork8 Air */ .driver_data = (void *)&cube_iwork8_air_data,
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 183/313 platform/x86: asus-nb-wmi: Add alternate mapping for KEY_CAMERA
In reply to Greg Kroah-HartmanFrom: Thomas Weißschuh <[email protected]>
[ Upstream commit c78a4e191839edc1e8c3e51565cf2e71d40e8883 ]
This keycode is emitted on a Asus VivoBook E410MAB with firmware E410MAB.304.
The physical key has a strikken-through camera printed on it.
--- drivers/platform/x86/asus-nb-wmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/asus-nb-wmi.c +1 -0
@@ -544,6 +544,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = { { KE_KEY, 0x7D, { KEY_BLUETOOTH } }, /* Bluetooth Enable */ { KE_KEY, 0x7E, { KEY_BLUETOOTH } }, /* Bluetooth Disable */ { KE_KEY, 0x82, { KEY_CAMERA } }, + { KE_KEY, 0x85, { KEY_CAMERA } }, { KE_KEY, 0x86, { KEY_PROG1 } }, /* MyASUS Key */ { KE_KEY, 0x88, { KEY_RFKILL } }, /* Radio Toggle Key */ { KE_KEY, 0x8A, { KEY_PROG1 } }, /* Color enhancement mode */
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 184/313 platform/x86: asus-nb-wmi: Add alternate mapping for KEY_SCREENLOCK
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit db9494895b405bf318dc7e563dee6daa51b3b6ed ]
The 0x33 keycode is emitted by Fn + F6 on a ASUS FX705GE laptop.
--- drivers/platform/x86/asus-nb-wmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/asus-nb-wmi.c +1 -0
@@ -511,6 +511,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = { { KE_KEY, 0x30, { KEY_VOLUMEUP } }, { KE_KEY, 0x31, { KEY_VOLUMEDOWN } }, { KE_KEY, 0x32, { KEY_MUTE } }, + { KE_KEY, 0x33, { KEY_SCREENLOCK } }, { KE_KEY, 0x35, { KEY_SCREENLOCK } }, { KE_KEY, 0x38, { KEY_PROG3 } }, /* Armoury Crate */ { KE_KEY, 0x40, { KEY_PREVIOUSSONG } },
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 185/313 platform/x86: asus-wmi: Add quirk wmi_ignore_fan
In reply to Greg Kroah-HartmanFrom: Thomas Weißschuh <[email protected]>
[ Upstream commit c874b6de4cdfa2822a07b479887cd5f87fb5d078 ]
Some laptops have a fan device listed in their ACPI tables but do not actually contain a fan.
Introduce a quirk that can be used to override the fan detection logic.
This was observed with a ASUS VivoBook E410MA running firmware E410MAB.304.
--- drivers/platform/x86/asus-wmi.c | 4 +++- drivers/platform/x86/asus-wmi.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-wmi.c +3 -1
@@ -2243,7 +2243,9 @@ static int asus_wmi_fan_init(struct asus_wmi *asus) asus->fan_type =FAN_TYPE_NONE ; asus->agfn_pwm =-1 ; -if (asus_wmi_dev_is_present (asus,ASUS_WMI_DEVID_CPU_FAN_CTRL )) +if (asus->driver->quirks->wmi_ignore_fan) + asus->fan_type =FAN_TYPE_NONE ; +else if (asus_wmi_dev_is_present (asus,ASUS_WMI_DEVID_CPU_FAN_CTRL )) asus->fan_type =FAN_TYPE_SPEC83 ;else if (asus_wmi_has_agfn_fan (asus)) asus->fan_type =FAN_TYPE_AGFN ;
drivers/platform/x86/asus-wmi.h +1 -0
@@ -38,6 +38,7 @@ struct quirk_entry {bool store_backlight_power;bool wmi_backlight_set_devstate;bool wmi_force_als_set; +bool wmi_ignore_fan;enum asus_wmi_tablet_switch_mode tablet_switch_mode;int wapf;/*
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 186/313 platform/x86: asus-wmi: Ignore fan on E410MA
In reply to Greg Kroah-HartmanFrom: Thomas Weißschuh <[email protected]>
[ Upstream commit 82cc5c6c624c63f7b57214e325e2ea685d924e89 ]
The ASUS VivoBook has a fan device described in its ACPI tables but does not actually contain any physical fan.
Use the quirk to inhibit fan handling.
--- drivers/platform/x86/asus-nb-wmi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/platform/x86/asus-nb-wmi.c +13 -0
@@ -121,6 +121,10 @@ static struct quirk_entry quirk_asus_tablet_mode = { .tablet_switch_mode = asus_wmi_lid_flip_rog_devid, }; +static struct quirk_entry quirk_asus_ignore_fan = { + .wmi_ignore_fan = true, +}; +static int dmi_matched (const struct dmi_system_id *dmi) {pr_info ("Identified laptop model '%s'\n" , dmi->ident);
@@ -473,6 +477,15 @@ static const struct dmi_system_id asus_quirks[] = { }, .driver_data = &quirk_asus_tablet_mode, }, + { + .callback = dmi_matched, + .ident = "ASUS VivoBook E410MA", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "E410MA"), + }, + .driver_data = &quirk_asus_ignore_fan, + }, {}, };
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 187/313 platform/x86: simatic-ipc: correct name of a model
In reply to Greg Kroah-HartmanFrom: Henning Schild <[email protected]>
[ Upstream commit ed058eab22d64c00663563e8e1e112989c65c59f ]
What we called IPC427G should be renamed to BX-39A to be more in line with the actual product name.
--- drivers/platform/x86/simatic-ipc.c | 2 +- include/linux/platform_data/x86/simatic-ipc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/simatic-ipc.c +1 -1
@@ -46,7 +46,7 @@ static struct { {SIMATIC_IPC_IPC427D, SIMATIC_IPC_DEVICE_427E, SIMATIC_IPC_DEVICE_NONE}, {SIMATIC_IPC_IPC427E, SIMATIC_IPC_DEVICE_427E, SIMATIC_IPC_DEVICE_427E}, {SIMATIC_IPC_IPC477E, SIMATIC_IPC_DEVICE_NONE, SIMATIC_IPC_DEVICE_427E}, - {SIMATIC_IPC_IPC427G, SIMATIC_IPC_DEVICE_227G, SIMATIC_IPC_DEVICE_227G}, + {SIMATIC_IPC_IPCBX_39A, SIMATIC_IPC_DEVICE_227G, SIMATIC_IPC_DEVICE_227G}, };static int register_platform_devices (u32 station_id)
include/linux/platform_data/x86/simatic-ipc.h +1 -1
@@ -32,7 +32,7 @@ enum simatic_ipc_station_ids {SIMATIC_IPC_IPC477E =0x00000A02 ,SIMATIC_IPC_IPC127E =0x00000D01 ,SIMATIC_IPC_IPC227G =0x00000F01 , - SIMATIC_IPC_IPC427G = 0x00001001, + SIMATIC_IPC_IPCBX_39A = 0x00001001, };static inline u32 simatic_ipc_get_station_id (u8 *data,int max_len)
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 188/313 platform/x86: simatic-ipc: add another model
In reply to Greg Kroah-HartmanFrom: Henning Schild <[email protected]>
[ Upstream commit d348b1d761e358a4ba03fb34aa7e3dbd278db236 ]
Add IPC PX-39A support.
--- drivers/platform/x86/simatic-ipc.c | 1 + include/linux/platform_data/x86/simatic-ipc.h | 1 + 2 files changed, 2 insertions(+)
drivers/platform/x86/simatic-ipc.c +1 -0
@@ -47,6 +47,7 @@ static struct { {SIMATIC_IPC_IPC427E, SIMATIC_IPC_DEVICE_427E, SIMATIC_IPC_DEVICE_427E}, {SIMATIC_IPC_IPC477E, SIMATIC_IPC_DEVICE_NONE, SIMATIC_IPC_DEVICE_427E}, {SIMATIC_IPC_IPCBX_39A, SIMATIC_IPC_DEVICE_227G, SIMATIC_IPC_DEVICE_227G}, + {SIMATIC_IPC_IPCPX_39A, SIMATIC_IPC_DEVICE_NONE, SIMATIC_IPC_DEVICE_227G}, };static int register_platform_devices (u32 station_id)
include/linux/platform_data/x86/simatic-ipc.h +1 -0
@@ -33,6 +33,7 @@ enum simatic_ipc_station_ids {SIMATIC_IPC_IPC127E =0x00000D01 ,SIMATIC_IPC_IPC227G =0x00000F01 ,SIMATIC_IPC_IPCBX_39A =0x00001001 , + SIMATIC_IPC_IPCPX_39A = 0x00001002, };static inline u32 simatic_ipc_get_station_id (u8 *data,int max_len)
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 189/313 lockref: stop doing cpu_relax in the cmpxchg loop
In reply to Greg Kroah-HartmanFrom: Mateusz Guzik <[email protected]>
[ Upstream commit f5fe24ef17b5fbe6db49534163e77499fb10ae8c ]
On the x86-64 architecture even a failing cmpxchg grants exclusive access to the cacheline, making it preferable to retry the failed op immediately instead of stalling with the pause instruction.
To illustrate the impact, below are benchmark results obtained by running various will-it-scale tests on top of the 6.2-rc3 kernel and Cascade Lake (2 sockets * 24 cores * 2 threads) CPU.
All results in ops/s. Note there is some variance in re-runs, but the code is consistently faster when contention is present.
open3 ("Same file open/close"):
proc stock no-pause
1 805603 814942 (+%1)
2 1054980 1054781 (-0%)
8 1544802 1822858 (+18%)
24 1191064 2199665 (+84%)
48 851582 1469860 (+72%)
96 609481 1427170 (+134%) fstat2 ("Same file fstat"):
proc stock no-pause
1 3013872 3047636 (+1%)
2 4284687 4400421 (+2%)
8 3257721 5530156 (+69%)
24 2239819 5466127 (+144%)
48 1701072 5256609 (+209%)
96 1269157 6649326 (+423%)Additionally, a kernel with a private patch to help access() scalability:
access2 ("Same file access"):
proc stock patched patched
+nopause
24 2378041 2005501 5370335 (-15% / +125%)That is, fixing the problems in access itself *reduces* scalability after the cacheline ping-pong only happens in lockref with the pause instruction.
Note that fstat and access benchmarks are not currently integrated into will-it-scale, but interested parties can find them in pull requests to said project.
Code at hand has a rather tortured history. First modification showed up in commit d472d9d98b46 ("lockref: Relax in cmpxchg loop"), written with Itanium in mind. Later it got patched up to use an arch-dependent macro to stop doing it on s390 where it caused a significant regression. Said macro had undergone revisions and was ultimately eliminated later, going back to cpu_relax.
While I intended to only remove cpu_relax for x86-64, I got the following comment from Linus:
I would actually prefer just removing it entirely and see if somebody else hollers. You have the numbers to prove it hurts on real hardware, and I don't think we have any numbers to the contrary.
So I think it's better to trust the numbers and remove it as a failure, than say "let's just remove it on x86-64 and leave everybody else with the potentially broken code"
Additionally, Will Deacon (maintainer of the arm64 port, one of the architectures previously benchmarked):
So, from the arm64 side of the fence, I'm perfectly happy just removing the cpu_relax() calls from lockref.
As such, come back full circle in history and whack it altogether.
--- lib/lockref.c | 1 - 1 file changed, 1 deletion(-)
lib/lockref.c +0 -1
@@ -23,7 +23,6 @@ } \if (!--retry) \break ; \ -cpu_relax (); \ } \ }while (0 )
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 190/313 ata: pata_cs5535: Dont build on UML
In reply to Greg Kroah-HartmanFrom: Peter Foley <[email protected]>
[ Upstream commit 22eebaa631c40f3dac169ba781e0de471b83bf45 ]
This driver uses MSR functions that aren't implemented under UML. Avoid building it to prevent tripping up allyesconfig.
e.g./usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: pata_cs5535.c:(.text+0x3a3): undefined reference to __tracepoint_read_msr' /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: pata_cs5535.c:(.text+0x3d2): undefined reference to __tracepoint_write_msr' /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: pata_cs5535.c:(.text+0x457): undefined reference to __tracepoint_write_msr' /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: pata_cs5535.c:(.text+0x481): undefined reference to do_trace_write_msr' /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: pata_cs5535.c:(.text+0x4d5): undefined reference to do_trace_write_msr' /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: pata_cs5535.c:(.text+0x4f5): undefined reference to do_trace_read_msr' /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: pata_cs5535.c:(.text+0x51c): undefined reference to `do_trace_write_msr'
--- drivers/ata/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/ata/Kconfig +1 -0
@@ -650,6 +650,7 @@ config PATA_CS5530 config PATA_CS5535 tristate "CS5535 PATA support (Experimental)" depends on PCI && (X86_32 || (X86_64 && COMPILE_TEST)) + depends on !UML help This option enables support for the NatSemi/AMD CS5535 companion chip used with the Geode processor family.
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 191/313 firmware: coreboot: Check size of table entry and use flex-array
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 3b293487b8752cc42c1cbf8a0447bc6076c075fa ]
The memcpy() of the data following a coreboot_table_entry couldn't be evaluated by the compiler under CONFIG_FORTIFY_SOURCE. To make it easier to reason about, add an explicit flexible array member to struct coreboot_device so the entire entry can be copied at once. Additionally, validate the sizes before copying. Avoids this run-time false positive warning:
memcpy: detected field-spanning write (size 168) of single field "&device->entry" at drivers/firmware/google/coreboot_table.c:103 (size 8)
--- drivers/firmware/google/coreboot_table.c | 9 +++++++-- drivers/firmware/google/coreboot_table.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/firmware/google/coreboot_table.c +7 -2
@@ -93,7 +93,12 @@ static int coreboot_table_populate(struct device *dev, void *ptr)for (i =0 ; i < header->table_entries; i++) { entry = ptr_entry; - device =kzalloc (sizeof (struct device ) + entry->size,GFP_KERNEL ); +if (entry->size <sizeof (*entry)) { +dev_warn (dev,"coreboot table entry too small!\n" ); +return -EINVAL ; + } + + device =kzalloc (sizeof (device->dev) + entry->size,GFP_KERNEL );if (!device)return -ENOMEM ;
@@ -101,7 +106,7 @@ static int coreboot_table_populate(struct device *dev, void *ptr) device->dev.parent = dev; device->dev.bus = &coreboot_bus_type; device->dev.release = coreboot_device_release; -memcpy (&device->entry, ptr_entry, entry->size); +memcpy (device->raw, ptr_entry, entry->size); ret =device_register (&device->dev);if (ret) {
drivers/firmware/google/coreboot_table.h +1 -0
@@ -66,6 +66,7 @@ struct coreboot_device {struct coreboot_table_entry entry;struct lb_cbmem_ref cbmem_ref;struct lb_framebuffer framebuffer; +DECLARE_FLEX_ARRAY (u8, raw); }; };
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 192/313 btrfs: zoned: enable metadata over-commit for non-ZNS setup
In reply to Greg Kroah-HartmanFrom: Naohiro Aota <[email protected]>
[ Upstream commit 85e79ec7b78f863178ca488fd8cb5b3de6347756 ]
The commit 79417d040f4f ("btrfs: zoned: disable metadata overcommit for zoned") disabled the metadata over-commit to track active zones properly.
However, it also introduced a heavy overhead by allocating new metadata block groups and/or flushing dirty buffers to release the space reservations. Specifically, a workload (write only without any sync operations) worsen its performance from 343.77 MB/sec (v5.19) to 182.89 MB/sec (v6.0).
The performance is still bad on current misc-next which is 187.95 MB/sec. And, with this patch applied, it improves back to 326.70 MB/sec (+73.82%).
This patch introduces a new fs_info->flag BTRFS_FS_NO_OVERCOMMIT to indicate it needs to disable the metadata over-commit. The flag is enabled when a device with max active zones limit is loaded into a file-system.
--- fs/btrfs/ctree.h | 6 ++++++ fs/btrfs/space-info.c | 3 ++- fs/btrfs/zoned.c | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-)
fs/btrfs/ctree.h +6 -0
@@ -590,6 +590,12 @@ enum {/* Indicate we have to finish a zone to do next allocation. */ BTRFS_FS_NEED_ZONE_FINISH , +/* +* Indicate metadata over-commit is disabled. This is set when active +* zone tracking is needed. +*/ +BTRFS_FS_NO_OVERCOMMIT , + #if BITS_PER_LONG == 32/* Indicate if we have error/warn message printed on 32bit systems */ BTRFS_FS_32BIT_ERROR,
fs/btrfs/space-info.c +2 -1
@@ -404,7 +404,8 @@ int btrfs_can_overcommit(struct btrfs_fs_info *fs_info,return 0 ; used =btrfs_space_info_used (space_info, true); -if (btrfs_is_zoned (fs_info) && (space_info->flags &BTRFS_BLOCK_GROUP_METADATA )) +if (test_bit (BTRFS_FS_NO_OVERCOMMIT , &fs_info->flags) && + (space_info->flags &BTRFS_BLOCK_GROUP_METADATA )) avail =0 ;else avail =calc_available_free_space (fs_info, space_info, flush);
fs/btrfs/zoned.c +2 -0
@@ -538,6 +538,8 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache) }atomic_set (&zone_info->active_zones_left, max_active_zones - nactive); +/* Overcommit does not work well with active zone tacking. */ +set_bit (BTRFS_FS_NO_OVERCOMMIT , &fs_info->flags); }/* Validate superblock log */
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 193/313 Revert "selftests/bpf: check null propagation only neither reg is PTR_TO_BTF_ID"
In reply to Greg Kroah-HartmanThis reverts commit 2e5d5c4ae77dedc7eba0e496474ab93f05b25adf.
--- .../bpf/prog_tests/jeq_infer_not_null.c | 9 ---- .../bpf/progs/jeq_infer_not_null_fail.c | 42 ------------------- 2 files changed, 51 deletions(-) delete mode 100644 tools/testing/selftests/bpf/prog_tests/jeq_infer_not_null.c delete mode 100644 tools/testing/selftests/bpf/progs/jeq_infer_not_null_fail.c
tools/testing/selftests/bpf/prog_tests/jeq_infer_not_null.c deleted +0 -9
@@ -1,9 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -#include <test_progs.h> -#include "jeq_infer_not_null_fail.skel.h" - -void test_jeq_infer_not_null (void ) -{ -RUN_TESTS (jeq_infer_not_null_fail); -}
tools/testing/selftests/bpf/progs/jeq_infer_not_null_fail.c deleted +0 -42
42 lines not on this page · raw message
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 194/313 arm64: efi: Recover from synchronous exceptions occurring in firmware
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit e8dfdf3162eb549d064b8c10b1564f7e8ee82591 ]
Unlike x86, which has machinery to deal with page faults that occur during the execution of EFI runtime services, arm64 has nothing like that, and a synchronous exception raised by firmware code brings down the whole system.
With more EFI based systems appearing that were not built to run Linux (such as the Windows-on-ARM laptops based on Qualcomm SOCs), as well as the introduction of PRM (platform specific firmware routines that are callable just like EFI runtime services), we are more likely to run into issues of this sort, and it is much more likely that we can identify and work around such issues if they don't bring down the system entirely.
Since we already use a EFI runtime services call wrapper in assembler, we can quite easily add some code that captures the execution state at the point where the call is made, allowing us to revert to this state and proceed execution if the call triggered a synchronous exception.
Given that the kernel and the firmware don't share any data structures that could end up in an indeterminate state, we can happily continue running, as long as we mark the EFI runtime services as unavailable from that point on.
Stable-dep-of: 8a9a1a18731e ("arm64: efi: Avoid workqueue to check whether EFI runtime is live")
--- arch/arm64/include/asm/efi.h | 8 +++++++ arch/arm64/kernel/efi-rt-wrapper.S | 32 +++++++++++++++++++++---- arch/arm64/kernel/efi.c | 22 +++++++++++++++++ arch/arm64/mm/fault.c | 4 ++++ drivers/firmware/efi/runtime-wrappers.c | 1 + 5 files changed, 62 insertions(+), 5 deletions(-)
arch/arm64/include/asm/efi.h +8 -0
@@ -14,8 +14,16 @@#ifdef CONFIG_EFI extern void efi_init (void ); + +bool efi_runtime_fixup_exception (struct pt_regs *regs,const char *msg);#else #define efi_init () + +static inline +bool efi_runtime_fixup_exception (struct pt_regs *regs,const char *msg) +{ +return false; +}#endif int efi_create_mapping (struct mm_struct *mm,efi_memory_desc_t *md);
arch/arm64/kernel/efi-rt-wrapper.S +27 -5
@@ -7,7 +7,7 @@ #include <asm/assembler.h> SYM_FUNC_START(__efi_rt_asm_wrapper) - stp x29, x30, [sp, #-32]! + stp x29, x30, [sp, #-112]! mov x29, sp /*
@@ -17,11 +17,21 @@ SYM_FUNC_START(__efi_rt_asm_wrapper) */ stp x1, x18, [sp, #16] + /* + * Preserve all callee saved registers and preserve the stack pointer + * value at the base of the EFI runtime stack so we can recover from + * synchronous exceptions occurring while executing the firmware + * routines. + */ + stp x19, x20, [sp, #32] + stp x21, x22, [sp, #48] + stp x23, x24, [sp, #64] + stp x25, x26, [sp, #80] + stp x27, x28, [sp, #96] + ldr_l x16, efi_rt_stack_top mov sp, x16 -#ifdef CONFIG_SHADOW_CALL_STACK - str x18, [sp, #-16]! -#endif + stp x18, x29, [sp, #-16]! /* * We are lucky enough that no EFI runtime services take more than
@@ -39,7 +49,7 @@ SYM_FUNC_START(__efi_rt_asm_wrapper) mov sp, x29 ldp x1, x2, [sp, #16] cmp x2, x18 - ldp x29, x30, [sp], #32 + ldp x29, x30, [sp], #112 b.ne 0f ret 0:
@@ -57,3 +67,15 @@ SYM_FUNC_START(__efi_rt_asm_wrapper) b efi_handle_corrupted_x18 // tail call SYM_FUNC_END(__efi_rt_asm_wrapper) + +SYM_CODE_START(__efi_rt_asm_recover) + mov sp, x30 + + ldp x19, x20, [sp, #32] + ldp x21, x22, [sp, #48] + ldp x23, x24, [sp, #64] + ldp x25, x26, [sp, #80] + ldp x27, x28, [sp, #96] + ldp x29, x30, [sp], #112 + ret +SYM_CODE_END(__efi_rt_asm_recover)
arch/arm64/kernel/efi.c +22 -0
@@ -149,6 +149,28 @@ DEFINE_SPINLOCK(efi_rt_lock); asmlinkage u64 *efi_rt_stack_top __ro_after_init; +asmlinkage efi_status_t __efi_rt_asm_recover(void); + +bool efi_runtime_fixup_exception (struct pt_regs *regs,const char *msg) +{ +/* Check whether the exception occurred while running the firmware */ +if (current_work () != &efi_rts_work.work || regs->pc >=TASK_SIZE_64 ) +return false; + +pr_err (FW_BUG "Unable to handle %s in EFI runtime service\n" , msg); +add_taint (TAINT_FIRMWARE_WORKAROUND ,LOCKDEP_STILL_OK ); +clear_bit (EFI_RUNTIME_SERVICES , &efi.flags); + + regs->regs[0 ] =EFI_ABORTED ; + regs->regs[30 ] = efi_rt_stack_top[-1 ]; + regs->pc = (u64 )__efi_rt_asm_recover; + +if (IS_ENABLED (CONFIG_SHADOW_CALL_STACK )) + regs->regs[18 ] = efi_rt_stack_top[-2 ]; + +return true; +} +/* EFI requires 8 KiB of stack space for runtime services */ static_assert (THREAD_SIZE >=SZ_8K );
arch/arm64/mm/fault.c +4 -0
@@ -30,6 +30,7 @@#include <asm/bug.h> #include <asm/cmpxchg.h> #include <asm/cpufeature.h> +#include <asm/efi.h> #include <asm/exception.h> #include <asm/daifflags.h> #include <asm/debug-monitors.h>
@@ -397,6 +398,9 @@ static void __do_kernel_fault(unsigned long addr, unsigned long esr, msg ="paging request" ; } +if (efi_runtime_fixup_exception (regs, msg)) +return ; +die_kernel_fault (msg, addr, esr, regs); }
drivers/firmware/efi/runtime-wrappers.c +1 -0
@@ -84,6 +84,7 @@ struct efi_runtime_work efi_rts_work; else \ pr_err("Failed to queue work to efi_rts_wq.\n"); \ \ +WARN_ON_ONCE (efi_rts_work.status ==EFI_ABORTED ); \ exit: \ efi_rts_work.efi_rts_id =EFI_NONE ; \ efi_rts_work.status; \
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 195/313 arm64: efi: Avoid workqueue to check whether EFI runtime is live
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 8a9a1a18731eb123e35f48176380a18b9782845e ]
Comparing current_work() against efi_rts_work.work is sufficient to decide whether current is currently running EFI runtime services code at any level in its call stack.
However, there are other potential users of the EFI runtime stack, such as the ACPI subsystem, which may invoke efi_call_virt_pointer() directly, and so any sync exceptions occurring in firmware during those calls are currently misidentified.
So instead, let's check whether the stashed value of the thread stack pointer points into current's thread stack. This can only be the case if current was interrupted while running EFI runtime code. Note that this implies that we should clear the stashed value after switching back, to avoid false positives.
--- arch/arm64/include/asm/efi.h | 9 +++++++++ arch/arm64/kernel/efi-rt-wrapper.S | 6 ++++++ arch/arm64/kernel/efi.c | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-)
arch/arm64/include/asm/efi.h +9 -0
@@ -48,8 +48,17 @@ int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md); })extern spinlock_t efi_rt_lock; +extern u64 *efi_rt_stack_top;efi_status_t __efi_rt_asm_wrapper (void *,const char *, ...); +/* +* efi_rt_stack_top[-1] contains the value the stack pointer had before +* switching to the EFI runtime stack. +*/ +#define current_in_efi () \ + (!preemptible() && efi_rt_stack_top != NULL && \ + on_task_stack(current, READ_ONCE(efi_rt_stack_top[-1]), 1)) +#define ARCH_EFI_IRQ_FLAGS_MASK (PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT)/*
arch/arm64/kernel/efi-rt-wrapper.S +6 -0
@@ -46,7 +46,10 @@ SYM_FUNC_START(__efi_rt_asm_wrapper) mov x4, x6 blr x8 + mov x16, sp mov sp, x29 + str xzr, [x16, #8] // clear recorded task SP value + ldp x1, x2, [sp, #16] cmp x2, x18 ldp x29, x30, [sp], #112
@@ -71,6 +74,9 @@ SYM_FUNC_END(__efi_rt_asm_wrapper) SYM_CODE_START(__efi_rt_asm_recover) mov sp, x30 + ldr_l x16, efi_rt_stack_top // clear recorded task SP value + str xzr, [x16, #-8] + ldp x19, x20, [sp, #32] ldp x21, x22, [sp, #48] ldp x23, x24, [sp, #64]
arch/arm64/kernel/efi.c +2 -1
@@ -11,6 +11,7 @@#include <linux/init.h> #include <asm/efi.h> +#include <asm/stacktrace.h> static bool region_is_misaligned (const efi_memory_desc_t *md) {
@@ -154,7 +155,7 @@ asmlinkage efi_status_t __efi_rt_asm_recover(void);bool efi_runtime_fixup_exception (struct pt_regs *regs,const char *msg) {/* Check whether the exception occurred while running the firmware */ -if (current_work () != &efi_rts_work.work || regs->pc >=TASK_SIZE_64 ) +if (!current_in_efi () || regs->pc >=TASK_SIZE_64 )return false;pr_err (FW_BUG "Unable to handle %s in EFI runtime service\n" , msg);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 196/313 arm64: efi: Account for the EFI runtime stack in stack unwinder
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 7ea55715c421d22c1b63f7129cae6a654091b695 ]
The EFI runtime services run from a dedicated stack now, and so the stack unwinder needs to be informed about this.
--- arch/arm64/include/asm/stacktrace.h | 15 +++++++++++++++ arch/arm64/kernel/stacktrace.c | 12 ++++++++++++ 2 files changed, 27 insertions(+)
arch/arm64/include/asm/stacktrace.h +15 -0
@@ -104,4 +104,19 @@ static inline struct stack_info stackinfo_get_sdei_critical(void)#define stackinfo_get_sdei_critical () stackinfo_get_unknown()#endif +#ifdef CONFIG_EFI +extern u64 *efi_rt_stack_top; + +static inline struct stack_info stackinfo_get_efi (void ) +{ +unsigned long high = (u64 )efi_rt_stack_top; +unsigned long low = high -THREAD_SIZE ; + +return (struct stack_info ) { + .low = low, + .high = high, + }; +} +#endif +#endif /* __ASM_STACKTRACE_H */
arch/arm64/kernel/stacktrace.c +12 -0
@@ -5,6 +5,7 @@* Copyright (C) 2012 ARM Ltd. */ #include <linux/kernel.h> +#include <linux/efi.h> #include <linux/export.h> #include <linux/ftrace.h> #include <linux/sched.h>
@@ -12,6 +13,7 @@#include <linux/sched/task_stack.h> #include <linux/stacktrace.h> +#include <asm/efi.h> #include <asm/irq.h> #include <asm/stack_pointer.h> #include <asm/stacktrace.h>
@@ -186,6 +188,13 @@ void show_stack(struct task_struct *tsk, unsigned long *sp, const char *loglvl) : stackinfo_get_unknown(); \ }) +#define STACKINFO_EFI \ + ({ \ + ((task == current) && current_in_efi()) \ + ? stackinfo_get_efi() \ + : stackinfo_get_unknown(); \ + }) + noinline noinstr void arch_stack_walk(stack_trace_consume_fn consume_entry,void *cookie,struct task_struct *task,struct pt_regs *regs)
@@ -199,6 +208,9 @@ noinline noinstr void arch_stack_walk(stack_trace_consume_fn consume_entry,#if defined(CONFIG_VMAP_STACK ) && defined(CONFIG_ARM_SDE_INTERFACE ) STACKINFO_SDEI(normal), STACKINFO_SDEI(critical), +#endif +#ifdef CONFIG_EFI + STACKINFO_EFI,#endif };struct unwind_state state = {
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 197/313 Bluetooth: hci_sync: cancel cmd_timer if hci_open failed
In reply to Greg Kroah-HartmanFrom: Archie Pusaka <[email protected]>
commit 97dfaf073f5881c624856ef293be307b6166115c upstream.
If a command is already sent, we take care of freeing it, but we also need to cancel the timeout as well.
--- net/bluetooth/hci_sync.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/hci_sync.c +1 -0
@@ -4703,6 +4703,7 @@ int hci_dev_open_sync(struct hci_dev *hdev) hdev->flush (hdev);if (hdev->sent_cmd) { +cancel_delayed_work_sync (&hdev->cmd_timer);kfree_skb (hdev->sent_cmd); hdev->sent_cmd =NULL ; }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 198/313 drm/i915: Allow panel fixed modes to have differing sync polarities
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
[ Upstream commit 2bd0db4b3f0bd529f75b32538fc5a3775e3591c0 ]
Apparently some panels declare multiple modes with random sync polarities. Seems a bit weird, but looks like Windows/GOP doesn't care, so let follow suit and accept alternate fixed modes regardless of their sync polarities.
v2: Don't pollute the DRM_ namespace with a define (Jani)
--- drivers/gpu/drm/i915/display/intel_panel.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_panel.c +4 -3
@@ -85,9 +85,10 @@ static bool is_alt_drrs_mode(const struct drm_display_mode *mode,static bool is_alt_fixed_mode (const struct drm_display_mode *mode,const struct drm_display_mode *preferred_mode) { -return drm_mode_match (mode, preferred_mode, -DRM_MODE_MATCH_FLAGS | -DRM_MODE_MATCH_3D_FLAGS ) && +u32 sync_flags =DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_NHSYNC | +DRM_MODE_FLAG_PVSYNC |DRM_MODE_FLAG_NVSYNC ; + +return (mode->flags & ~sync_flags) == (preferred_mode->flags & ~sync_flags) && mode->hdisplay == preferred_mode->hdisplay && mode->vdisplay == preferred_mode->vdisplay; }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 199/313 drm/i915: Allow alternate fixed modes always for eDP
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
[ Upstream commit 55cfeecc2197de68e9cc30f77c711dcbcdf27510 ]
Stop considering VBT's static DRRS support when deciding whether to use alternate fixed modes or not. It looks like Windows more or less just uses that to decide whether to automagically switch refresh rates on AC<->battery changes, or perhaps whether to even expose a control for that in some UI thing. Either way it seems happy to always use all EDID modes, and I guess the DRRS/VRR stuff more or less adjusts how said modes get actually used.
Let's do the same and just accept all the suitable looking modes from EDID, whether we have DRRS or VRR.
--- drivers/gpu/drm/i915/display/intel_dp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_dp.c +1 -3
@@ -5216,9 +5216,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,intel_bios_init_panel (dev_priv, &intel_connector->panel, encoder->devdata,IS_ERR (edid) ?NULL : edid); -intel_panel_add_edid_fixed_modes (intel_connector, - intel_connector->panel.vbt.drrs_type !=DRRS_TYPE_NONE || -intel_vrr_is_capable (intel_connector)); +intel_panel_add_edid_fixed_modes (intel_connector, true);/* MSO requires information from the EDID */ intel_edp_mso_init (intel_dp);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 200/313 drm/amdgpu: complete gfxoff allow signal during suspend without delay
In reply to Greg Kroah-HartmanFrom: Harsh Jain <[email protected]>
commit 4b31b92b143f7d209f3d494c56d4c4673e9fc53d upstream.
change guarantees that gfxoff is allowed before moving further in s2idle sequence to add more reliablity about gfxoff in amdgpu IP's suspend flow
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +7 -3
@@ -586,10 +586,14 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_dif (adev->gfx.gfx_off_req_count ==0 && !adev->gfx.gfx_off_state) {/* If going to s2idle, no need to wait */ -if (adev->in_s0ix) - delay =GFX_OFF_NO_DELAY ; -schedule_delayed_work (&adev->gfx.gfx_off_delay_work, +if (adev->in_s0ix) { +if (!amdgpu_dpm_set_powergating_by_smu (adev, +AMD_IP_BLOCK_TYPE_GFX , true)) + adev->gfx.gfx_off_state = true; + }else { +schedule_delayed_work (&adev->gfx.gfx_off_delay_work, delay); + } } }else {if (adev->gfx.gfx_off_req_count ==0 ) {
Greg Kroah-Hartman
maintainerPATCH 201/313 io_uring/msg_ring: fix remote queue to disabled ring
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
commit 8579538c89e33ce78be2feb41e07489c8cbf8f31 upstream.
IORING_SETUP_R_DISABLED rings don't have the submitter task set, so it's not always safe to use ->submitter_task. Disallow posting msg_ring messaged to disabled rings. Also add task NULL check for loosy sync around testing for IORING_SETUP_R_DISABLED.
--- io_uring/msg_ring.c | 4 ++++ 1 file changed, 4 insertions(+)
io_uring/msg_ring.c +4 -0
@@ -30,6 +30,8 @@ static int io_msg_ring_data(struct io_kiif (msg->src_fd || msg->dst_fd || msg->flags)return -EINVAL ; +if (target_ctx->flags &IORING_SETUP_R_DISABLED ) +return -EBADFD ;if (io_post_aux_cqe (target_ctx, msg->user_data, msg->len,0 , true))return 0 ;
@@ -84,6 +86,8 @@ static int io_msg_send_fd(struct io_kiocif (target_ctx == ctx)return -EINVAL ; +if (target_ctx->flags &IORING_SETUP_R_DISABLED ) +return -EBADFD ; ret =io_double_lock_ctx (ctx, target_ctx, issue_flags);if (unlikely (ret))
Greg Kroah-Hartman
maintainerPATCH 202/313 wifi: mac80211: Proper mark iTXQs for resumption
In reply to Greg Kroah-HartmanFrom: Alexander Wetzel <[email protected]>
commit 4444bc2116aecdcde87dce80373540adc8bd478b upstream.
When a running wake_tx_queue() call is aborted due to a hw queue stop the corresponding iTXQ is not always correctly marked for resumption:wake_tx_push_queue() can stops the queue run without setting @IEEE80211_TXQ_STOP_NETIF_TX.
Without the @IEEE80211_TXQ_STOP_NETIF_TX flag __ieee80211_wake_txqs() will not schedule a new queue run and remaining frames in the queue get stuck till another frame is queued to it.
Fix the issue for all drivers - also the ones with custom wake_tx_queue callbacks - by moving the logic into ieee80211_tx_dequeue() and drop the redundant @txqs_stopped.
@IEEE80211_TXQ_STOP_NETIF_TX is also renamed to @IEEE80211_TXQ_DIRTY to better describe the flag.
--- include/net/mac80211.h | 4 ---- net/mac80211/debugfs_sta.c | 5 +++-- net/mac80211/driver-ops.h | 2 +- net/mac80211/ieee80211_i.h | 2 +- net/mac80211/tx.c | 23 +++++++++++++++-------- net/mac80211/util.c | 20 ++++++-------------- 6 files changed, 26 insertions(+), 30 deletions(-)
include/net/mac80211.h +0 -4
@@ -1827,8 +1827,6 @@ struct ieee80211_vif_cfg {* @drv_priv: data area for driver use, will always be aligned to * sizeof(void \*). * @txq: the multicast data TX queue (if driver uses the TXQ abstraction) -* @txqs_stopped: per AC flag to indicate that intermediate TXQs are stopped, -* protected by fq->lock. * @offload_flags: 802.3 -> 802.11 enapsulation offload flags, see * &enum ieee80211_offload_flags. * @mbssid_tx_vif: Pointer to the transmitting interface if MBSSID is enabled.
@@ -1857,8 +1855,6 @@ struct ieee80211_vif {bool probe_req_reg;bool rx_mcast_action_reg; -bool txqs_stopped[IEEE80211_NUM_ACS ]; -struct ieee80211_vif *mbssid_tx_vif;/* must be last */
net/mac80211/debugfs_sta.c +3 -2
@@ -167,7 +167,7 @@ static ssize_t sta_aqm_read(struct filecontinue ; txqi =to_txq_info (sta->sta.txq[i]); p += scnprintf(p, bufsz + buf - p, - "%d %d %u %u %u %u %u %u %u %u %u 0x%lx(%s%s%s)\n", + "%d %d %u %u %u %u %u %u %u %u %u 0x%lx(%s%s%s%s)\n", txqi->txq.tid, txqi->txq.ac, txqi->tin.backlog_bytes,
@@ -182,7 +182,8 @@ static ssize_t sta_aqm_read(struct file txqi->flags,test_bit (IEEE80211_TXQ_STOP , &txqi->flags) ?"STOP" :"RUN" ,test_bit (IEEE80211_TXQ_AMPDU , &txqi->flags) ?" AMPDU" :"" , - test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags) ? " NO-AMSDU" : ""); +test_bit (IEEE80211_TXQ_NO_AMSDU , &txqi->flags) ?" NO-AMSDU" :"" , + test_bit(IEEE80211_TXQ_DIRTY, &txqi->flags) ? " DIRTY" : ""); }rcu_read_unlock ();
net/mac80211/driver-ops.h +1 -1
@@ -1183,7 +1183,7 @@ static inline void drv_wake_tx_queue(str/* In reconfig don't transmit now, but mark for waking later */ if (local->in_reconfig) { -set_bit (IEEE80211_TXQ_STOP_NETIF_TX , &txq->flags); +set_bit (IEEE80211_TXQ_DIRTY , &txq->flags);return ; }
net/mac80211/ieee80211_i.h +1 -1
@@ -836,7 +836,7 @@ enum txq_info_flags {IEEE80211_TXQ_STOP ,IEEE80211_TXQ_AMPDU ,IEEE80211_TXQ_NO_AMSDU , - IEEE80211_TXQ_STOP_NETIF_TX, + IEEE80211_TXQ_DIRTY, };/**
net/mac80211/tx.c +15 -8
@@ -3709,13 +3709,15 @@ struct sk_buff *ieee80211_tx_dequeue(strstruct ieee80211_local *local =hw_to_local (hw); struct txq_info *txqi = container_of(txq, struct txq_info, txq);struct ieee80211_hdr *hdr; -struct sk_buff *skb =NULL ;struct fq *fq = &local->fq;struct fq_tin *tin = &txqi->tin;struct ieee80211_tx_info *info;struct ieee80211_tx_data tx; +struct sk_buff *skb;ieee80211_tx_result r;struct ieee80211_vif *vif = txq->vif; +int q = vif->hw_queue[txq->ac]; +bool q_stopped;WARN_ON_ONCE (softirq_count () ==0 );
@@ -3723,16 +3725,21 @@ struct sk_buff *ieee80211_tx_dequeue(strreturn NULL ; begin: -spin_lock_bh (&fq->lock); + skb =NULL ; +spin_lock (&local->queue_stop_reason_lock); + q_stopped = local->queue_stop_reasons[q]; +spin_unlock (&local->queue_stop_reason_lock); + +if (unlikely (q_stopped)) { +/* mark for waking later */ +set_bit (IEEE80211_TXQ_DIRTY , &txqi->flags); +return NULL ; + } -if (test_bit (IEEE80211_TXQ_STOP , &txqi->flags) || -test_bit (IEEE80211_TXQ_STOP_NETIF_TX , &txqi->flags)) - goto out; +spin_lock_bh (&fq->lock); -if (vif->txqs_stopped[txq->ac]) { -set_bit (IEEE80211_TXQ_STOP_NETIF_TX , &txqi->flags); +if (unlikely (test_bit (IEEE80211_TXQ_STOP , &txqi->flags))) goto out; - }/* Make sure fragments stay together. */ skb =__skb_dequeue (&txqi->frags);
net/mac80211/util.c +6 -14
@@ -301,8 +301,6 @@ static void __ieee80211_wake_txqs(structlocal_bh_disable ();spin_lock (&fq->lock); - sdata->vif.txqs_stopped[ac] = false; -if (!test_bit (SDATA_STATE_RUNNING , &sdata->state)) goto out;
@@ -324,7 +322,7 @@ static void __ieee80211_wake_txqs(structif (ac != txq->ac)continue ; -if (!test_and_clear_bit (IEEE80211_TXQ_STOP_NETIF_TX , +if (!test_and_clear_bit (IEEE80211_TXQ_DIRTY , &txqi->flags))continue ;
@@ -339,7 +337,7 @@ static void __ieee80211_wake_txqs(struct txqi =to_txq_info (vif->txq); -if (!test_and_clear_bit (IEEE80211_TXQ_STOP_NETIF_TX , &txqi->flags) || +if (!test_and_clear_bit (IEEE80211_TXQ_DIRTY , &txqi->flags) || (ps &&atomic_read (&ps->num_sta_ps)) || ac != vif->txq->ac) goto out;
@@ -537,16 +535,10 @@ static void __ieee80211_stop_queue(struccontinue ;for (ac =0 ; ac < n_acs; ac++) { -if (sdata->vif.hw_queue[ac] == queue || - sdata->vif.cab_queue == queue) { -if (!local->ops->wake_tx_queue) { -netif_stop_subqueue (sdata->dev, ac); -continue ; - } -spin_lock (&local->fq.lock); - sdata->vif.txqs_stopped[ac] = true; -spin_unlock (&local->fq.lock); - } +if (!local->ops->wake_tx_queue && + (sdata->vif.hw_queue[ac] == queue || + sdata->vif.cab_queue == queue)) +netif_stop_subqueue (sdata->dev, ac); } }rcu_read_unlock ();
Greg Kroah-Hartman
maintainerPATCH 203/313 wifi: mac80211: Fix iTXQ AMPDU fragmentation handling
In reply to Greg Kroah-HartmanFrom: Alexander Wetzel <[email protected]>
commit 592234e941f1addaa598601c9227e3b72d608625 upstream.
mac80211 must not enable aggregation wile transmitting a fragmented MPDU. Enforce that for mac80211 internal TX queues (iTXQs).
--- net/mac80211/agg-tx.c | 2 -- net/mac80211/ht.c | 37 +++++++++++++++++++++++++++++++++++++ net/mac80211/tx.c | 13 +++++++------ 3 files changed, 44 insertions(+), 8 deletions(-)
net/mac80211/agg-tx.c +0 -2
@@ -511,8 +511,6 @@ void ieee80211_tx_ba_session_handle_star*/ clear_bit (HT_AGG_STATE_WANT_START , &tid_tx->state); -ieee80211_agg_stop_txq (sta, tid); -/* * Make sure no packets are being processed. This ensures that * we have a valid starting sequence number and that in-flight
net/mac80211/ht.c +37 -0
@@ -391,6 +391,43 @@ void ieee80211_ba_session_work(struct wo tid_tx = sta->ampdu_mlme.tid_start_tx[tid];if (!blocked && tid_tx) { +struct ieee80211_sub_if_data *sdata = sta->sdata; +struct ieee80211_local *local = sdata->local; + +if (local->ops->wake_tx_queue) { +struct txq_info *txqi = +to_txq_info (sta->sta.txq[tid]); +struct fq *fq = &local->fq; + +spin_lock_bh (&fq->lock); + +/* Allow only frags to be dequeued */ +set_bit (IEEE80211_TXQ_STOP , &txqi->flags); + +if (!skb_queue_empty (&txqi->frags)) { +/* Fragmented Tx is ongoing, wait for it +* to finish. Reschedule worker to retry +* later. +*/ + +spin_unlock_bh (&fq->lock); +spin_unlock_bh (&sta->lock); + +/* Give the task working on the txq a +* chance to send out the queued frags +*/ +synchronize_net (); + +mutex_unlock (&sta->ampdu_mlme.mtx); + +ieee80211_queue_work (&sdata->local->hw, + work); +return ; + } + +spin_unlock_bh (&fq->lock); + } +/* * Assign it over to the normal tid_tx array * where it "goes live".
net/mac80211/tx.c +7 -6
@@ -1295,7 +1295,8 @@ ieee80211_tx_prepare(struct ieee80211_suif (!(info->flags &IEEE80211_TX_CTL_DONTFRAG )) {if (!(tx->flags &IEEE80211_TX_UNICAST ) || skb->len +FCS_LEN <= local->hw.wiphy->frag_threshold || - info->flags &IEEE80211_TX_CTL_AMPDU ) + (info->flags &IEEE80211_TX_CTL_AMPDU && + !local->ops->wake_tx_queue)) info->flags |=IEEE80211_TX_CTL_DONTFRAG ; }
@@ -3725,7 +3726,6 @@ struct sk_buff *ieee80211_tx_dequeue(strreturn NULL ; begin: - skb =NULL ;spin_lock (&local->queue_stop_reason_lock); q_stopped = local->queue_stop_reasons[q];spin_unlock (&local->queue_stop_reason_lock);
@@ -3738,9 +3738,6 @@ begin:spin_lock_bh (&fq->lock); -if (unlikely (test_bit (IEEE80211_TXQ_STOP , &txqi->flags))) - goto out; -/* Make sure fragments stay together. */ skb =__skb_dequeue (&txqi->frags);if (unlikely (skb)) {
@@ -3750,6 +3747,9 @@ begin:IEEE80211_SKB_CB (skb)->control.flags &= ~IEEE80211_TX_INTCFL_NEED_TXPROCESSING ; }else { +if (unlikely (test_bit (IEEE80211_TXQ_STOP , &txqi->flags))) + goto out; + skb =fq_tin_dequeue (fq, tin, fq_tin_dequeue_func); }
@@ -3800,7 +3800,8 @@ begin: }if (test_bit (IEEE80211_TXQ_AMPDU , &txqi->flags)) - info->flags |=IEEE80211_TX_CTL_AMPDU ; + info->flags |= (IEEE80211_TX_CTL_AMPDU | +IEEE80211_TX_CTL_DONTFRAG );else info->flags &= ~IEEE80211_TX_CTL_AMPDU ;
Greg Kroah-Hartman
maintainerPATCH 204/313 sched/fair: Check if prev_cpu has highest spare cap in feec()
In reply to Greg Kroah-HartmanFrom: Pierre Gondois <[email protected]>
[ Upstream commit ad841e569f5c88e3332b32a000f251f33ff32187 ]
When evaluating the CPU candidates in the perf domain (pd) containing the previously used CPU (prev_cpu), find_energy_efficient_cpu() evaluates the energy of the pd:
- without the task (base_energy)
- with the task placed on prev_cpu (if the task fits)
- with the task placed on the CPU with the highest spare capacity, prev_cpu being excluded from this set
If prev_cpu is already the CPU with the highest spare capacity, max_spare_cap_cpu will be the CPU with the second highest spare capacity.
On an Arm64 Juno-r2, with a workload of 10 tasks at a 10% duty cycle, when prev_cpu and max_spare_cap_cpu are both valid candidates, prev_spare_cap > max_spare_cap at ~82%.
Thus the energy of the pd when placing the task on max_spare_cap_cpu is computed with no possible positive outcome 82% most of the time.
Do not consider max_spare_cap_cpu as a valid candidate if prev_spare_cap > max_spare_cap.
Stable-dep-of: e26fd28db828 ("sched/uclamp: Fix a uninitialized variable warnings")
--- kernel/sched/fair.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
kernel/sched/fair.c +7 -6
@@ -7217,7 +7217,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)unsigned long cur_delta, max_spare_cap =0 ;unsigned long rq_util_min, rq_util_max;unsigned long util_min, util_max; -bool compute_prev_delta = false; +unsigned long prev_spare_cap =0 ;int max_spare_cap_cpu =-1 ;unsigned long base_energy;
@@ -7279,18 +7279,19 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)if (cpu == prev_cpu) {/* Always use prev_cpu as a candidate. */ - compute_prev_delta = true; + prev_spare_cap = cpu_cap; }else if (cpu_cap > max_spare_cap) {/* * Find the CPU with the maximum spare capacity -* in the performance domain. +* among the remaining CPUs in the performance +* domain. */ max_spare_cap = cpu_cap; max_spare_cap_cpu = cpu; } } -if (max_spare_cap_cpu <0 && !compute_prev_delta) +if (max_spare_cap_cpu <0 && prev_spare_cap ==0 )continue ;eenv_pd_busy_time (&eenv, cpus, p);
@@ -7298,7 +7299,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu) base_energy =compute_energy (&eenv, pd, cpus, p,-1 );/* Evaluate the energy impact of using prev_cpu. */ -if (compute_prev_delta) { +if (prev_spare_cap >0 ) { prev_delta =compute_energy (&eenv, pd, cpus, p, prev_cpu);/* CPU utilization has changed */
@@ -7309,7 +7310,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu) }/* Evaluate the energy impact of using max_spare_cap_cpu. */ -if (max_spare_cap_cpu >=0 ) { +if (max_spare_cap_cpu >=0 && max_spare_cap > prev_spare_cap) { cur_delta =compute_energy (&eenv, pd, cpus, p, max_spare_cap_cpu);/* CPU utilization has changed */
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 205/313 sched/uclamp: Fix a uninitialized variable warnings
In reply to Greg Kroah-HartmanFrom: Qais Yousef <[email protected]>
[ Upstream commit e26fd28db82899be71b4b949527373d0a6be1e65 ]
Addresses the following warnings:
Quoted 6 lines
config: riscv-randconfig-m031-20221111
compiler: riscv64-linux-gcc (GCC) 12.1.0smatch warnings:
kernel/sched/fair.c:7263find_energy_efficient_cpu()error: uninitialized symbol 'util_min'.kernel/sched/fair.c:7263find_energy_efficient_cpu()error: uninitialized symbol 'util_max'.
--- kernel/sched/fair.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-)
kernel/sched/fair.c +16 -19
@@ -7213,10 +7213,10 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)eenv_task_busy_time (&eenv, p, prev_cpu);for (; pd; pd = pd->next) { +unsigned long util_min = p_util_min, util_max = p_util_max;unsigned long cpu_cap, cpu_thermal_cap, util;unsigned long cur_delta, max_spare_cap =0 ;unsigned long rq_util_min, rq_util_max; -unsigned long util_min, util_max;unsigned long prev_spare_cap =0 ;int max_spare_cap_cpu =-1 ;unsigned long base_energy;
@@ -7235,6 +7235,8 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu) eenv.pd_cap =0 ;for_each_cpu (cpu, cpus) { +struct rq *rq =cpu_rq (cpu); + eenv.pd_cap += cpu_thermal_cap;if (!cpumask_test_cpu (cpu,sched_domain_span (sd)))
@@ -7253,24 +7255,19 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)* much capacity we can get out of the CPU; this is * aligned with sched_cpu_util(). */ -if (uclamp_is_used ()) { -if (uclamp_rq_is_idle (cpu_rq (cpu))) { - util_min = p_util_min; - util_max = p_util_max; - }else { -/* -* Open code uclamp_rq_util_with() except for -* the clamp() part. Ie: apply max aggregation -* only. util_fits_cpu() logic requires to -* operate on non clamped util but must use the -* max-aggregated uclamp_{min, max}. -*/ - rq_util_min =uclamp_rq_get (cpu_rq (cpu),UCLAMP_MIN ); - rq_util_max =uclamp_rq_get (cpu_rq (cpu),UCLAMP_MAX ); - - util_min =max (rq_util_min, p_util_min); - util_max =max (rq_util_max, p_util_max); - } +if (uclamp_is_used () && !uclamp_rq_is_idle (rq)) { +/* +* Open code uclamp_rq_util_with() except for +* the clamp() part. Ie: apply max aggregation +* only. util_fits_cpu() logic requires to +* operate on non clamped util but must use the +* max-aggregated uclamp_{min, max}. +*/ + rq_util_min =uclamp_rq_get (rq,UCLAMP_MIN ); + rq_util_max =uclamp_rq_get (rq,UCLAMP_MAX ); + + util_min =max (rq_util_min, p_util_min); + util_max =max (rq_util_max, p_util_max); }if (!util_fits_cpu (util, util_min, util_max, cpu))continue ;
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 206/313 vfio/type1: Respect IOMMU reserved regions in vfio_test_domain_fgsp()
In reply to Greg Kroah-HartmanFrom: Niklas Schnelle <[email protected]>
[ Upstream commit 895c0747f726bb50c9b7a805613a61d1b6f9fa06 ]
Since commit cbf7827bc5dc ("iommu/s390: Fix potential s390_domain aperture shrinking") the s390 IOMMU driver uses reserved regions for the system provided DMA ranges of PCI devices. Previously it reduced the size of the IOMMU aperture and checked it on each mapping operation. On current machines the system denies use of DMA addresses below 2^32 for all PCI devices.
Usually mapping IOVAs in a reserved regions is harmless until a DMA actually tries to utilize the mapping. However on s390 there is a virtual PCI device called ISM which is implemented in firmware and used for cross LPAR communication. Unlike real PCI devices this device does not use the hardware IOMMU but inspects IOMMU translation tables directly on IOTLB flush (s390 RPCIT instruction). If it detects IOVA mappings outside the allowed ranges it goes into an error state. This error state then causes the device to be unavailable to the KVM guest.
Analysing this we found that vfio_test_domain_fgsp() maps 2 pages at DMA address 0 irrespective of the IOMMUs reserved regions. Even if usually harmless this seems wrong in the general case so instead go through the freshly updated IOVA list and try to find a range that isn't reserved, and fits 2 pages, is PAGE_SIZE * 2 aligned. If found use that for testing for fine grained super pages.
--- drivers/vfio/vfio_iommu_type1.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)
drivers/vfio/vfio_iommu_type1.c +20 -11
@@ -1856,24 +1856,33 @@ static int vfio_iommu_replay(struct vfio_iommu *iommu,* significantly boosts non-hugetlbfs mappings and doesn't seem to hurt when * hugetlbfs is in use. */ -static void vfio_test_domain_fgsp (struct vfio_domain *domain) +static void vfio_test_domain_fgsp (struct vfio_domain *domain,struct list_head *regions) { -struct page *pages;int ret, order =get_order (PAGE_SIZE *2 ); +struct vfio_iova *region; +struct page *pages; +dma_addr_t start; pages =alloc_pages (GFP_KERNEL | __GFP_ZERO, order);if (!pages)return ; - ret =iommu_map (domain->domain,0 ,page_to_phys (pages),PAGE_SIZE *2 , -IOMMU_READ |IOMMU_WRITE |IOMMU_CACHE ); -if (!ret) { -size_t unmapped =iommu_unmap (domain->domain,0 ,PAGE_SIZE ); +list_for_each_entry (region, regions, list) { + start =ALIGN (region->start,PAGE_SIZE *2 ); +if (start >= region->end || (region->end - start <PAGE_SIZE *2 )) +continue ; -if (unmapped ==PAGE_SIZE ) -iommu_unmap (domain->domain,PAGE_SIZE ,PAGE_SIZE ); -else - domain->fgsp = true; + ret =iommu_map (domain->domain, start,page_to_phys (pages),PAGE_SIZE *2 , +IOMMU_READ |IOMMU_WRITE |IOMMU_CACHE ); +if (!ret) { +size_t unmapped =iommu_unmap (domain->domain, start,PAGE_SIZE ); + +if (unmapped ==PAGE_SIZE ) +iommu_unmap (domain->domain, start +PAGE_SIZE ,PAGE_SIZE ); +else + domain->fgsp = true; + } +break ; }__free_pages (pages, order);
@@ -2326,7 +2335,7 @@ static int vfio_iommu_type1_attach_group(void *iommu_data, } } -vfio_test_domain_fgsp (domain); +vfio_test_domain_fgsp (domain, &iova_copy);/* replay mappings on new domains */ ret =vfio_iommu_replay (iommu, domain);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 207/313 scsi: hpsa: Fix allocation size for scsi_host_alloc()
In reply to Greg Kroah-HartmanFrom: Alexey V. Vissarionov <[email protected]>
[ Upstream commit bbbd25499100c810ceaf5193c3cfcab9f7402a33 ]
The 'h' is a pointer to struct ctlr_info, so it's just 4 or 8 bytes, while the structure itself is much bigger.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/scsi/hpsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hpsa.c +1 -1
@@ -5850,7 +5850,7 @@ static int hpsa_scsi_host_alloc(struct ctlr_info *h) {struct Scsi_Host *sh; - sh =scsi_host_alloc (&hpsa_driver_template,sizeof (h)); + sh =scsi_host_alloc (&hpsa_driver_template,sizeof (struct ctlr_info ));if (sh ==NULL ) {dev_err (&h->pdev->dev,"scsi_host_alloc failed\n" );return -ENOMEM ;
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 208/313 kvm/vfio: Fix potential deadlock on vfio group_lock
In reply to Greg Kroah-HartmanFrom: Yi Liu <[email protected]>
[ Upstream commit 51cdc8bc120ef6e42f6fb758341f5d91bc955952 ]
Currently it is possible that the final put of a KVM reference comes from vfio during its device close operation. This occurs while the vfio group lock is held; however, if the vfio device is still in the kvm device list, then the following call chain could result in a deadlock:
VFIO holds group->group_lock/group_rwsem
-> kvm_put_kvm
-> kvm_destroy_vm
-> kvm_destroy_devices
-> kvm_vfio_destroy
-> kvm_vfio_file_set_kvm
-> vfio_file_set_kvm
-> try to hold group->group_lock/group_rwsemThe key function is the kvm_destroy_devices() which triggers destroy cb of kvm_device_ops. It calls back to vfio and try to hold group_lock. So if this path doesn't call back to vfio, this dead lock would be fixed. Actually, there is a way for it. KVM provides another point to free the kvm-vfio device which is the point when the device file descriptor is closed. This can be achieved by providing the release cb instead of the destroy cb. Also rename kvm_vfio_destroy() to be kvm_vfio_release().
/*
* Destroy is responsible for freeing dev.
*
* Destroy may be called before or after destructors are called
* on emulated I/O regions, depending on whether a reference is
* held by a vcpu or other kvm component that gets destroyed
* after the emulated I/O.
*/
void (*destroy)(struct kvm_device *dev);
/*
* Release is an alternative method to free the device. It is
* called when the device file descriptor is closed. Once
* release is called, the destroy method will not be called
* anymore as the device is removed from the device list of
* the VM. kvm->lock is held.
*/
void (*release)(struct kvm_device *dev);
--- virt/kvm/vfio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
virt/kvm/vfio.c +3 -3
@@ -336,7 +336,7 @@ static int kvm_vfio_has_attr(struct kvm_device *dev,return -ENXIO ; } -static void kvm_vfio_destroy (struct kvm_device *dev) +static void kvm_vfio_release (struct kvm_device *dev) {struct kvm_vfio *kv = dev->private;struct kvm_vfio_group *kvg, *tmp;
@@ -355,7 +355,7 @@ static void kvm_vfio_destroy(struct kvm_device *dev)kvm_vfio_update_coherency (dev);kfree (kv); -kfree (dev);/* alloc by kvm_ioctl_create_device, free by .destroy */ +kfree (dev);/* alloc by kvm_ioctl_create_device, free by .release */ }static int kvm_vfio_create (struct kvm_device *dev,u32 type);
@@ -363,7 +363,7 @@ static int kvm_vfio_create(struct kvm_device *dev, u32 type);static struct kvm_device_ops kvm_vfio_ops = { .name ="kvm-vfio" , .create = kvm_vfio_create, - .destroy = kvm_vfio_destroy, + .release = kvm_vfio_release, .set_attr = kvm_vfio_set_attr, .has_attr = kvm_vfio_has_attr, };
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 209/313 nfsd: dont free files unconditionally in __nfsd_file_cache_purge
In reply to Greg Kroah-HartmanFrom: Jeff Layton <[email protected]>
[ Upstream commit 4bdbba54e9b1c769da8ded9abd209d765715e1d6 ]
nfsd_file_cache_purge is called when the server is shutting down, in which case, tearing things down is generally fine, but it also gets called when the exports cache is flushed.
Instead of walking the cache and freeing everything unconditionally, handle it the same as when we have a notification of conflicting access.
--- fs/nfsd/filecache.c | 61 ++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 25 deletions(-)
fs/nfsd/filecache.c +36 -25
@@ -638,6 +638,39 @@ static struct shrinker nfsd_file_shrinker = { .seeks = 1, }; +/** +* nfsd_file_cond_queue - conditionally unhash and queue a nfsd_file +* @nf: nfsd_file to attempt to queue +* @dispose: private list to queue successfully-put objects +* +* Unhash an nfsd_file, try to get a reference to it, and then put that +* reference. If it's the last reference, queue it to the dispose list. +*/ +static void +nfsd_file_cond_queue (struct nfsd_file *nf,struct list_head *dispose) +__must_hold (RCU ) +{ +int decrement =1 ; + +/* If we raced with someone else unhashing, ignore it */ +if (!nfsd_file_unhash (nf)) +return ; + +/* If we can't get a reference, ignore it */ +if (!nfsd_file_get (nf)) +return ; + +/* Extra decrement if we remove from the LRU */ +if (nfsd_file_lru_remove (nf)) + ++decrement; + +/* If refcount goes to 0, then put on the dispose list */ +if (refcount_sub_and_test (decrement, &nf->nf_ref)) { +list_add (&nf->nf_lru, dispose); +trace_nfsd_file_closing (nf); + } +} +/** * nfsd_file_queue_for_close: try to close out any open nfsd_files for an inode * @inode: inode on which to close out nfsd_files
@@ -665,30 +698,11 @@ nfsd_file_queue_for_close(struct inode *inode, struct list_head *dispose)rcu_read_lock ();do { -int decrement =1 ; - nf =rhashtable_lookup (&nfsd_file_rhash_tbl, &key, nfsd_file_rhash_params);if (!nf)break ; - -/* If we raced with someone else unhashing, ignore it */ -if (!nfsd_file_unhash (nf)) -continue ; - -/* If we can't get a reference, ignore it */ -if (!nfsd_file_get (nf)) -continue ; - -/* Extra decrement if we remove from the LRU */ -if (nfsd_file_lru_remove (nf)) - ++decrement; - -/* If refcount goes to 0, then put on the dispose list */ -if (refcount_sub_and_test (decrement, &nf->nf_ref)) { -list_add (&nf->nf_lru, dispose); -trace_nfsd_file_closing (nf); - } +nfsd_file_cond_queue (nf, dispose); }while (1 );rcu_read_unlock (); }
@@ -905,11 +919,8 @@ __nfsd_file_cache_purge(struct net *net) nf =rhashtable_walk_next (&iter);while (!IS_ERR_OR_NULL (nf)) { -if (!net || nf->nf_net == net) { -nfsd_file_unhash (nf); -nfsd_file_lru_remove (nf); -list_add (&nf->nf_lru, &dispose); - } +if (!net || nf->nf_net == net) +nfsd_file_cond_queue (nf, &dispose); nf =rhashtable_walk_next (&iter); }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 210/313 module: Dont wait for GOING modules
In reply to Greg Kroah-HartmanFrom: Petr Pavlu <[email protected]>
commit 0254127ab977e70798707a7a2b757c9f3c971210 upstream.
During a system boot, it can happen that the kernel receives a burst of requests to insert the same module but loading it eventually fails during its init call. For instance, udev can make a request to insert a frequency module for each individual CPU when another frequency module is already loaded which causes the init function of the new module to return an error.
Since commit 6e6de3dee51a ("kernel/module.c: Only return -EEXIST for modules that have finished loading"), the kernel waits for modules in MODULE_STATE_GOING state to finish unloading before making another attempt to load the same module.
This creates unnecessary work in the described scenario and delays the boot. In the worst case, it can prevent udev from loading drivers for other devices and might cause timeouts of services waiting on them and subsequently a failed boot.
This patch attempts a different solution for the problem 6e6de3dee51a was trying to solve. Rather than waiting for the unloading to complete, it returns a different error code (-EBUSY) for modules in the GOING state. This should avoid the error situation that was described in 6e6de3dee51a (user space attempting to load a dependent module because the -EEXIST error code would suggest to user space that the first module had been loaded successfully), while avoiding the delay situation too.
This has been tested on linux-next since December 2022 and passes all kmod selftests except test 0009 with module compression enabled but it has been confirmed that this issue has existed and has gone unnoticed since prior to this commit and can also be reproduced without module compression with a simple usleep(5000000) on tools/modprobe.c [0]. These failures are caused by hitting the kernel mod_concurrent_max and can happen either due to a self inflicted kernel module auto-loead DoS somehow or on a system with large CPU count and each CPU count incorrectly triggering many module auto-loads. Both of those issues need to be fixed in-kernel.
[0] https://lore.kernel.org/all/Y9A4fiobL6IHp%2F%[email protected]/
--- kernel/module/main.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)
kernel/module/main.c +21 -5
@@ -2386,7 +2386,8 @@ static bool finished_loading(const charsched_annotate_sleep ();mutex_lock (&module_mutex); mod =find_module_all (name,strlen (name), true); - ret = !mod || mod->state ==MODULE_STATE_LIVE ; + ret = !mod || mod->state ==MODULE_STATE_LIVE + || mod->state ==MODULE_STATE_GOING ;mutex_unlock (&module_mutex);return ret;
@@ -2562,20 +2563,35 @@ static int add_unformed_module(struct mo mod->state =MODULE_STATE_UNFORMED ; -again:mutex_lock (&module_mutex); old =find_module_all (mod->name,strlen (mod->name), true);if (old !=NULL ) { -if (old->state !=MODULE_STATE_LIVE ) { +if (old->state ==MODULE_STATE_COMING + || old->state ==MODULE_STATE_UNFORMED ) {/* Wait in case it fails to load. */ mutex_unlock (&module_mutex); err =wait_event_interruptible (module_wq,finished_loading (mod->name));if (err) goto out_unlocked; - goto again; + +/* The module might have gone in the meantime. */ +mutex_lock (&module_mutex); + old =find_module_all (mod->name,strlen (mod->name), + true); } - err = -EEXIST ; + +/* +* We are here only when the same module was being loaded. Do +* not try to load it again right now. It prevents long delays +* caused by serialized module load failures. It might happen +* when more devices of the same type trigger load of +* a particular module. +*/ +if (old && old->state ==MODULE_STATE_LIVE ) + err = -EEXIST ; +else + err = -EBUSY ; goto out; }mod_update_bounds (mod);
Greg Kroah-Hartman
maintainerPATCH 211/313 ftrace: Export ftrace_free_filter() to modules
In reply to Greg Kroah-HartmanFrom: Mark Rutland <[email protected]>
commit 8be9fbd5345da52f4a74f7f81d55ff9fa0a2958e upstream.
Setting filters on an ftrace ops results in some memory being allocated for the filter hashes, which must be freed before the ops can be freed. This can be done by removing every individual element of the hash by calling ftrace_set_filter_ip() or ftrace_set_filter_ips() with remove set, but this is somewhat error prone as it's easy to forget to remove an element.
Make it easier to clean this up by exporting ftrace_free_filter(), which can be used to clean up all of the filter hashes after an ftrace_ops has been unregistered.
Using this, fix the ftrace-direct* samples to free hashes prior to being unloaded. All other code either removes individual filters explicitly or is built-in and already calls ftrace_free_filter().
--- kernel/trace/ftrace.c | 23 ++++++++++++++++++++++- samples/ftrace/ftrace-direct-multi-modify.c | 1 + samples/ftrace/ftrace-direct-multi.c | 1 + 3 files changed, 24 insertions(+), 1 deletion(-)
kernel/trace/ftrace.c +22 -1
@@ -1248,12 +1248,17 @@ static void free_ftrace_hash_rcu(structcall_rcu (&hash->rcu, __free_ftrace_hash_rcu); } +/** +* ftrace_free_filter - remove all filters for an ftrace_ops +* @ops - the ops to remove the filters from +*/ void ftrace_free_filter (struct ftrace_ops *ops) {ftrace_ops_init (ops);free_ftrace_hash (ops->func_hash->filter_hash);free_ftrace_hash (ops->func_hash->notrace_hash); } +EXPORT_SYMBOL_GPL (ftrace_free_filter);static struct ftrace_hash *alloc_ftrace_hash (int size_bits) {
@@ -5828,6 +5833,10 @@ EXPORT_SYMBOL_GPL(modify_ftrace_direct_m* * Filters denote which functions should be enabled when tracing is enabled * If @ip is NULL, it fails to update filter. +* +* This can allocate memory which must be freed before @ops can be freed, +* either by removing each filtered addr or by using +* ftrace_free_filter(@ops). */ int ftrace_set_filter_ip (struct ftrace_ops *ops,unsigned long ip,int remove,int reset)
@@ -5847,7 +5856,11 @@ EXPORT_SYMBOL_GPL(ftrace_set_filter_ip);* * Filters denote which functions should be enabled when tracing is enabled * If @ips array or any ip specified within is NULL , it fails to update filter. -*/ +* +* This can allocate memory which must be freed before @ops can be freed, +* either by removing each filtered addr or by using +* ftrace_free_filter(@ops). +*/ int ftrace_set_filter_ips (struct ftrace_ops *ops,unsigned long *ips,unsigned int cnt,int remove,int reset) {
@@ -5889,6 +5902,10 @@ ftrace_set_regex(struct ftrace_ops *ops,* * Filters denote which functions should be enabled when tracing is enabled. * If @buf is NULL and reset is set, all functions will be enabled for tracing. +* +* This can allocate memory which must be freed before @ops can be freed, +* either by removing each filtered addr or by using +* ftrace_free_filter(@ops). */ int ftrace_set_filter (struct ftrace_ops *ops,unsigned char *buf,int len,int reset)
@@ -5908,6 +5925,10 @@ EXPORT_SYMBOL_GPL(ftrace_set_filter);* Notrace Filters denote which functions should not be enabled when tracing * is enabled. If @buf is NULL and reset is set, all functions will be enabled * for tracing. +* +* This can allocate memory which must be freed before @ops can be freed, +* either by removing each filtered addr or by using +* ftrace_free_filter(@ops). */ int ftrace_set_notrace (struct ftrace_ops *ops,unsigned char *buf,int len,int reset)
samples/ftrace/ftrace-direct-multi-modify.c +1 -0
@@ -149,6 +149,7 @@ static void __exit ftrace_direct_multi_e {kthread_stop (simple_tsk);unregister_ftrace_direct_multi (&direct, my_tramp); +ftrace_free_filter (&direct); }module_init (ftrace_direct_multi_init);
samples/ftrace/ftrace-direct-multi.c +1 -0
@@ -77,6 +77,7 @@ static int __init ftrace_direct_multi_in static void __exit ftrace_direct_multi_exit(void) {unregister_ftrace_direct_multi (&direct, (unsigned long ) my_tramp); +ftrace_free_filter (&direct); }module_init (ftrace_direct_multi_init);
Greg Kroah-Hartman
maintainerPATCH 212/313 tracing: Make sure trace_printk() can output as soon as it can be used
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
commit 3bb06eb6e9acf7c4a3e1b5bc87aed398ff8e2253 upstream.
Currently trace_printk() can be used as soon as early_trace_init() is called from start_kernel(). But if a crash happens, and "ftrace_dump_on_oops" is set on the kernel command line, all you get will be:
[ 0.456075] <idle>-0 0dN.2. 347519us : Unknown type 6 [ 0.456075] <idle>-0 0dN.2. 353141us : Unknown type 6 [ 0.456075] <idle>-0 0dN.2. 358684us : Unknown type 6
This is because the trace_printk() event (type 6) hasn't been registered yet. That gets done via an early_initcall(), which may be early, but not early enough.
Instead of registering the trace_printk() event (and other ftrace events, which are not trace events) via an early_initcall(), have them registered at the same time that trace_printk() can be used. This way, if there is a crash before early_initcall(), then the trace_printk()s will actually be useful.
--- kernel/trace/trace.c | 2 ++ kernel/trace/trace.h | 1 + kernel/trace/trace_output.c | 3 +-- 3 files changed, 4 insertions(+), 2 deletions(-)
kernel/trace/trace.c +2 -0
@@ -10291,6 +10291,8 @@ void __init early_trace_init(void)static_key_enable (&tracepoint_printk_key.key); }tracer_alloc_buffers (); + +init_events (); }void __init trace_init (void )
kernel/trace/trace.h +1 -0
@@ -1490,6 +1490,7 @@ extern void trace_event_enable_cmd_recorextern void trace_event_enable_tgid_record (bool enable);extern int event_trace_init (void ); +extern int init_events (void );extern int event_trace_add_tracer (struct dentry *parent,struct trace_array *tr);extern int event_trace_del_tracer (struct trace_array *tr);extern void __trace_early_add_events (struct trace_array *tr);
kernel/trace/trace_output.c +1 -2
@@ -1568,7 +1568,7 @@ static struct trace_event *events[] __in NULL }; -__init static int init_events (void ) +__init int init_events (void ) {struct trace_event *event;int i, ret;
@@ -1581,4 +1581,3 @@ __init static int init_events(void)return 0 ; } -early_initcall (init_events);
Greg Kroah-Hartman
maintainerPATCH 213/313 trace_events_hist: add check for return value of create_hist_field
In reply to Greg Kroah-HartmanFrom: Natalia Petrova <[email protected]>
commit 8b152e9150d07a885f95e1fd401fc81af202d9a4 upstream.
Function 'create_hist_field' is called recursively at trace_events_hist.c:1954 and can return NULL-value that's why we have to check it to avoid null pointer dereference.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- kernel/trace/trace_events_hist.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/trace/trace_events_hist.c +2 -0
@@ -1975,6 +1975,8 @@ static struct hist_field *create_hist_fi hist_field->fn_num = flags &HIST_FIELD_FL_LOG2 ?HIST_FIELD_FN_LOG2 :HIST_FIELD_FN_BUCKET ; hist_field->operands[0 ] =create_hist_field (hist_data, field, fl,NULL ); +if (!hist_field->operands[0 ]) + goto free; hist_field->size = hist_field->operands[0 ]->size; hist_field->type =kstrdup_const (hist_field->operands[0 ]->type,GFP_KERNEL );if (!hist_field->type)
Greg Kroah-Hartman
maintainerPATCH 214/313 ftrace/scripts: Update the instructions for ftrace-bisect.sh
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
commit 7ae4ba7195b1bac04a4210a499da9d8c63b0ba9c upstream.
The instructions for the ftrace-bisect.sh script, which is used to find what function is being traced that is causing a kernel crash, and possibly a triple fault reboot, uses the old method. In 5.1, a new feature was added that let the user write in the index into available_filter_functions that maps to the function a user wants to set in set_ftrace_filter (or set_ftrace_notrace). This takes O(1) to set, as suppose to writing a function name, which takes O(n) (where n is the number of functions in available_filter_functions).
The ftrace-bisect.sh requires setting half of the functions in available_filter_functions, which is O(n^2) using the name method to enable and can take several minutes to complete. The number method is O(n) which takes less than a second to complete. Using the number method for any kernel 5.1 and after is the proper way to do the bisect.
Update the usage to reflect the new change, as well as using the /sys/kernel/tracing path instead of the obsolete debugfs path.
--- scripts/tracing/ftrace-bisect.sh | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-)
scripts/tracing/ftrace-bisect.sh +26 -8
@@ -12,7 +12,7 @@ # (note, if this is a problem with function_graph tracing, then simply # replace "function" with "function_graph" in the following steps). # -# # cd /sys/kernel/debug/tracing +# # cd /sys/kernel/tracing # # echo schedule > set_ftrace_filter # # echo function > current_tracer #
@@ -20,22 +20,40 @@ # # # echo nop > current_tracer # -# # cat available_filter_functions > ~/full-file +# Starting with v5.1 this can be done with numbers, making it much faster: +# +# The old (slow) way, for kernels before v5.1. +# +# [old-way] # cat available_filter_functions > ~/full-file +# +# [old-way] *** Note *** this process will take several minutes to update the +# [old-way] filters. Setting multiple functions is an O(n^2) operation, and we +# [old-way] are dealing with thousands of functions. So go have coffee, talk +# [old-way] with your coworkers, read facebook. And eventually, this operation +# [old-way] will end. +# +# The new way (using numbers) is an O(n) operation, and usually takes less than a second. +# +# seq `wc -l available_filter_functions | cut -d' ' -f1` > ~/full-file +# +# This will create a sequence of numbers that match the functions in +# available_filter_functions, and when echoing in a number into the +# set_ftrace_filter file, it will enable the corresponding function in +# O(1) time. Making enabling all functions O(n) where n is the number of +# functions to enable. +# +# For either the new or old way, the rest of the operations remain the same. +# # # ftrace-bisect ~/full-file ~/test-file ~/non-test-file # # cat ~/test-file > set_ftrace_filter # -# *** Note *** this will take several minutes. Setting multiple functions is -# an O(n^2) operation, and we are dealing with thousands of functions. So go -# have coffee, talk with your coworkers, read facebook. And eventually, this -# operation will end. -# # # echo function > current_tracer # # If it crashes, we know that ~/test-file has a bad function. # # Reboot back to test kernel. # -# # cd /sys/kernel/debug/tracing +# # cd /sys/kernel/tracing # # mv ~/test-file ~/full-file # # If it didn't crash.
Greg Kroah-Hartman
maintainerPATCH 215/313 cifs: Fix oops due to uncleared server->smbd_conn in reconnect
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
commit b7ab9161cf5ddc42a288edf9d1a61f3bdffe17c7 upstream.
In smbd_destroy(), clear the server->smbd_conn pointer after freeing the smbd_connection struct that it points to so that reconnection doesn't get confused.
--- fs/cifs/smbdirect.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/smbdirect.c +1 -0
@@ -1405,6 +1405,7 @@ void smbd_destroy(struct TCP_Server_Infodestroy_workqueue (info->workqueue);log_rdma_event (INFO ,"rdma session destroyed\n" );kfree (info); + server->smbd_conn =NULL ; }/*
Greg Kroah-Hartman
maintainerPATCH 216/313 ksmbd: add max connections parameter
In reply to Greg Kroah-HartmanFrom: Namjae Jeon <[email protected]>
commit 0d0d4680db22eda1eea785c47bbf66a9b33a8b16 upstream.
Add max connections parameter to limit number of maximum simultaneous connections.
--- fs/ksmbd/ksmbd_netlink.h | 3 ++- fs/ksmbd/server.h | 1 + fs/ksmbd/transport_ipc.c | 3 +++ fs/ksmbd/transport_tcp.c | 17 ++++++++++++++++- 4 files changed, 22 insertions(+), 2 deletions(-)
fs/ksmbd/ksmbd_netlink.h +2 -1
@@ -105,7 +105,8 @@ struct ksmbd_startup_request {__u32 sub_auth[3 ];/* Subauth value for Security ID */ __u32 smb2_max_credits;/* MAX credits */ __u32 smbd_max_io_size;/* smbd read write size */ -__u32 reserved[127 ];/* Reserved room */ +__u32 max_connections;/* Number of maximum simultaneous connections */ +__u32 reserved[126 ];/* Reserved room */ __u32 ifc_list_sz;/* interfaces list size */ __s8 ____payload[]; };
fs/ksmbd/server.h +1 -0
@@ -41,6 +41,7 @@ struct ksmbd_server_config {unsigned int share_fake_fscaps;struct smb_sid domain_sid;unsigned int auth_mechs; +unsigned int max_connections;char *conf[SERVER_CONF_WORK_GROUP +1 ]; };
fs/ksmbd/transport_ipc.c +3 -0
@@ -308,6 +308,9 @@ static int ipc_server_config_on_startup(if (req->smbd_max_io_size)init_smbd_max_io_size (req->smbd_max_io_size); +if (req->max_connections) + server_conf.max_connections = req->max_connections; + ret =ksmbd_set_netbios_name (req->netbios_name); ret |=ksmbd_set_server_string (req->server_string); ret |=ksmbd_set_work_group (req->work_group);
fs/ksmbd/transport_tcp.c +16 -1
@@ -15,6 +15,8 @@#define IFACE_STATE_DOWN BIT(0)#define IFACE_STATE_CONFIGURED BIT(1) +static atomic_t active_num_conn; +struct interface {struct task_struct *ksmbd_kthread;struct socket *ksmbd_socket;
@@ -185,8 +187,10 @@ static int ksmbd_tcp_new_connection(strustruct tcp_transport *t; t =alloc_transport (client_sk); -if (!t) +if (!t) { +sock_release (client_sk);return -ENOMEM ; + } csin =KSMBD_TCP_PEER_SOCKADDR (KSMBD_TRANS (t)->conn);if (kernel_getpeername (client_sk, csin) <0 ) {
@@ -239,6 +243,15 @@ static int ksmbd_kthread_fn(void *p)continue ; } +if (server_conf.max_connections && +atomic_inc_return (&active_num_conn) >= server_conf.max_connections) { +pr_info_ratelimited ("Limit the maximum number of connections(%u)\n" , +atomic_read (&active_num_conn)); +atomic_dec (&active_num_conn); +sock_release (client_sk); +continue ; + } +ksmbd_debug (CONN ,"connect success: accepted new connection\n" ); client_sk->sk->sk_rcvtimeo =KSMBD_TCP_RECV_TIMEOUT ; client_sk->sk->sk_sndtimeo =KSMBD_TCP_SEND_TIMEOUT ;
@@ -368,6 +381,8 @@ static int ksmbd_tcp_writev(struct ksmbdstatic void ksmbd_tcp_disconnect (struct ksmbd_transport *t) {free_transport (TCP_TRANS (t)); +if (server_conf.max_connections) +atomic_dec (&active_num_conn); }static void tcp_destroy_socket (struct socket *ksmbd_socket)
Greg Kroah-Hartman
maintainerPATCH 217/313 ksmbd: do not sign response to session request for guest login
In reply to Greg Kroah-HartmanFrom: Marios Makassikis <[email protected]>
commit 5fde3c21cf33830eda7bfd006dc7f4bf07ec9fe6 upstream.
If ksmbd.mountd is configured to assign unknown users to the guest account ("map to guest = bad user" in the config), ksmbd signs the response.
This is wrong according to MS-SMB2 3.3.5.5.3:
12. If the SMB2_SESSION_FLAG_IS_GUEST bit is not set in the SessionFlags field, and Session.IsAnonymous is FALSE, the server MUST sign the final session setup response before sending it to the client, as follows:
[...]
This fixes libsmb2 based applications failing to establish a session ("Wrong signature in received").
--- fs/ksmbd/smb2pdu.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ksmbd/smb2pdu.c +2 -0
@@ -8657,6 +8657,7 @@ int smb3_decrypt_req(struct ksmbd_work *bool smb3_11_final_sess_setup_resp (struct ksmbd_work *work) {struct ksmbd_conn *conn = work->conn; +struct ksmbd_session *sess = work->sess;struct smb2_hdr *rsp =smb2_get_msg (work->response_buf);if (conn->dialect <SMB30_PROT_ID )
@@ -8666,6 +8667,7 @@ bool smb3_11_final_sess_setup_resp(struc rsp =ksmbd_resp_buf_next (work);if (le16_to_cpu (rsp->Command) ==SMB2_SESSION_SETUP_HE && + sess->user && !user_guest (sess->user) && rsp->Status ==STATUS_SUCCESS )return true;return false;
Greg Kroah-Hartman
maintainerPATCH 218/313 ksmbd: downgrade ndr version error message to debug
In reply to Greg Kroah-HartmanFrom: Namjae Jeon <[email protected]>
commit a34dc4a9b9e2fb3a45c179a60bb0b26539c96189 upstream.
When user switch samba to ksmbd, The following message flood is coming when accessing files. Samba seems to changs dos attribute version to v5. This patch downgrade ndr version error message to debug.
$ dmesg ... [68971.766914] ksmbd: v5 version is not supported [68971.779808] ksmbd: v5 version is not supported [68971.871544] ksmbd: v5 version is not supported [68971.910135] ksmbd: v5 version is not supported ...
--- fs/ksmbd/ndr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/ksmbd/ndr.c +4 -4
@@ -242,7 +242,7 @@ int ndr_decode_dos_attr(struct ndr *n, sreturn ret;if (da->version !=3 && da->version !=4 ) { -pr_err ("v%d version is not supported\n" , da->version); +ksmbd_debug (VFS ,"v%d version is not supported\n" , da->version);return -EINVAL ; }
@@ -251,7 +251,7 @@ int ndr_decode_dos_attr(struct ndr *n, sreturn ret;if (da->version != version2) { -pr_err ("ndr version mismatched(version: %d, version2: %d)\n" , +ksmbd_debug (VFS ,"ndr version mismatched(version: %d, version2: %d)\n" , da->version, version2);return -EINVAL ; }
@@ -457,7 +457,7 @@ int ndr_decode_v4_ntacl(struct ndr *n, sif (ret)return ret;if (acl->version !=4 ) { -pr_err ("v%d version is not supported\n" , acl->version); +ksmbd_debug (VFS ,"v%d version is not supported\n" , acl->version);return -EINVAL ; }
@@ -465,7 +465,7 @@ int ndr_decode_v4_ntacl(struct ndr *n, sif (ret)return ret;if (acl->version != version2) { -pr_err ("ndr version mismatched(version: %d, version2: %d)\n" , +ksmbd_debug (VFS ,"ndr version mismatched(version: %d, version2: %d)\n" , acl->version, version2);return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 219/313 ksmbd: limit pdu length size according to connection status
In reply to Greg Kroah-HartmanFrom: Namjae Jeon <[email protected]>
commit 62c487b53a7ff31e322cf2874d3796b8202c54a5 upstream.
Stream protocol length will never be larger than 16KB until session setup. After session setup, the size of requests will not be larger than 16KB + SMB2 MAX WRITE size. This patch limits these invalidly oversized requests and closes the connection immediately.
--- fs/ksmbd/connection.c | 17 +++++++++++++++-- fs/ksmbd/smb2pdu.h | 5 +++-- 2 files changed, 18 insertions(+), 4 deletions(-)
fs/ksmbd/connection.c +15 -2
@@ -280,7 +280,7 @@ int ksmbd_conn_handler_loop(void *p) {struct ksmbd_conn *conn = (struct ksmbd_conn *)p;struct ksmbd_transport *t = conn->transport; -unsigned int pdu_size; +unsigned int pdu_size, max_allowed_pdu_size;char hdr_buf[4 ] = {0 ,};int size;
@@ -305,13 +305,26 @@ int ksmbd_conn_handler_loop(void *p) pdu_size =get_rfc1002_len (hdr_buf);ksmbd_debug (CONN ,"RFC1002 header %u bytes\n" , pdu_size); +if (conn->status ==KSMBD_SESS_GOOD ) + max_allowed_pdu_size = +SMB3_MAX_MSGSIZE + conn->vals->max_write_size; +else + max_allowed_pdu_size =SMB3_MAX_MSGSIZE ; + +if (pdu_size > max_allowed_pdu_size) { +pr_err_ratelimited ("PDU length(%u) excceed maximum allowed pdu size(%u) on connection(%d)\n" , + pdu_size, max_allowed_pdu_size, + conn->status); +break ; + } +/* * Check if pdu size is valid (min : smb header size, * max : 0x00FFFFFF). */ if (pdu_size < __SMB2_HEADER_STRUCTURE_SIZE || pdu_size >MAX_STREAM_PROT_LEN ) { -continue ; +break ; }/* 4 for rfc1002 length field */
fs/ksmbd/smb2pdu.h +3 -2
@@ -24,8 +24,9 @@#define SMB21_DEFAULT_IOSIZE (1024 * 1024)#define SMB3_DEFAULT_TRANS_SIZE (1024 * 1024) -#define SMB3_MIN_IOSIZE (64 * 1024) -#define SMB3_MAX_IOSIZE (8 * 1024 * 1024) +#define SMB3_MIN_IOSIZE (64 * 1024) +#define SMB3_MAX_IOSIZE (8 * 1024 * 1024) +#define SMB3_MAX_MSGSIZE (4 * 4096)/* * Definitions for SMB2 Protocol Data Units (network frames)
Greg Kroah-Hartman
maintainerPATCH 220/313 ovl: fix tmpfile leak
In reply to Greg Kroah-HartmanFrom: Miklos Szeredi <[email protected]>
commit baabaa505563362b71f2637aedd7b807d270656c upstream.
Missed an error cleanup.
--- fs/overlayfs/copy_up.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/overlayfs/copy_up.c +1 -1
@@ -754,7 +754,7 @@ static int ovl_copy_up_tmpfile(struct ovif (!c->metacopy && c->stat.size) { err =ovl_copy_up_file (ofs, c->dentry, tmpfile, c->stat.size);if (err) -return err; + goto out_fput; } err =ovl_copy_up_metadata (c, temp);
Greg Kroah-Hartman
maintainerPATCH 221/313 ovl: fail on invalid uid/gid mapping at copy up
In reply to Greg Kroah-HartmanFrom: Miklos Szeredi <[email protected]>
commit 4f11ada10d0ad3fd53e2bd67806351de63a4f9c3 upstream.
If st_uid/st_gid doesn't have a mapping in the mounter's user_ns, then copy-up should fail, just like it would fail if the mounter task was doing the copy using "cp -a".
There's a corner case where the "cp -a" would succeed but copy up fail: if there's a mapping of the invalid uid/gid (65534 by default) in the user namespace. This is because stat(2) will return this value if the mapping doesn't exist in the current user_ns and "cp -a" will in turn be able to create a file with this uid/gid.
This behavior would be inconsistent with POSIX ACL's, which return -1 for invalid uid/gid which result in a failed copy.
For consistency and simplicity fail the copy of the st_uid/st_gid are invalid.
--- fs/overlayfs/copy_up.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/overlayfs/copy_up.c +4 -0
@@ -973,6 +973,10 @@ static int ovl_copy_up_one(struct dentryif (err)return err; +if (!kuid_has_mapping (current_user_ns (), ctx.stat.uid) || + !kgid_has_mapping (current_user_ns (), ctx.stat.gid)) +return -EOVERFLOW ; + ctx.metacopy =ovl_need_meta_copy_up (dentry, ctx.stat.mode, flags);if (parent) {
Greg Kroah-Hartman
maintainerPATCH 222/313 io_uring/net: cache provided buffer group value for multishot receives
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
commit b00c51ef8f72ced0965d021a291b98ff822c5337 upstream.
If we're using ring provided buffers with multishot receive, and we end up doing an io-wq based issue at some points that also needs to select a buffer, we'll lose the initially assigned buffer group as io_ring_buffer_select() correctly clears the buffer group list as the issue isn't serialized by the ctx uring_lock. This is fine for normal receives as the request puts the buffer and finishes, but for multishot, we will re-arm and do further receives. On the next trigger for this multishot receive, the receive will try and pick from a buffer group whose value is the same as the buffer ID of the las receive. That is obviously incorrect, and will result in a premature -ENOUFS error for the receive even if we had available buffers in the correct group.
Cache the buffer group value at prep time, so we can restore it for future receives. This only needs doing for the above mentioned case, but just do it by default to keep it easier to read.
--- io_uring/net.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
io_uring/net.c +11 -0
@@ -62,6 +62,7 @@ struct io_sr_msg {u16 flags;/* initialised and used only by !msg send variants */ u16 addr_len; +u16 buf_group;void __user *addr;/* used only for send zerocopy */ struct io_kiocb *notif;
@@ -565,6 +566,15 @@ int io_recvmsg_prep(struct io_kiocb *reqif (req->opcode ==IORING_OP_RECV && sr->len)return -EINVAL ; req->flags |=REQ_F_APOLL_MULTISHOT ; +/* +* Store the buffer group for this multishot receive separately, +* as if we end up doing an io-wq based issue that selects a +* buffer, it has to be committed immediately and that will +* clear ->buf_list. This means we lose the link to the buffer +* list, and the eventual buffer put on completion then cannot +* restore it. +*/ + sr->buf_group = req->buf_index; }#ifdef CONFIG_COMPAT
@@ -581,6 +591,7 @@ static inline void io_recv_prep_retry(st sr->done_io =0 ; sr->len =0 ;/* get from the provided buffer */ + req->buf_index = sr->buf_group; }/*
Greg Kroah-Hartman
maintainerPATCH 223/313 KVM: x86/vmx: Do not skip segment attributes if unusable bit is set
In reply to Greg Kroah-HartmanFrom: Hendrik Borghorst <[email protected]>
commit a44b331614e6f7e63902ed7dff7adc8c85edd8bc upstream.
When serializing and deserializing kvm_sregs, attributes of the segment descriptors are stored by user space. For unusable segments, vmx_segment_access_rights skips all attributes and sets them to 0.
This means we zero out the DPL (Descriptor Privilege Level) for unusable entries.
Unusable segments are - contrary to their name - usable in 64bit mode and are used by guests to for example create a linear map through the NULL selector.
VMENTER checks if SS.DPL is correct depending on the CS segment type. For types 9 (Execute Only) and 11 (Execute Read), CS.DPL must be equal to SS.DPL [1].
We have seen real world guests setting CS to a usable segment with DPL=3 and SS to an unusable segment with DPL=3. Once we go through an sregs get/set cycle, SS.DPL turns to 0. This causes the virtual machine to crash reproducibly.
This commit changes the attribute logic to always preserve attributes for unusable segments. According to [2] SS.DPL is always saved on VM exits, regardless of the unusable bit so user space applications should have saved the information on serialization correctly.
[3] specifies that besides SS.DPL the rest of the attributes of the descriptors are undefined after VM entry if unusable bit is set. So, there should be no harm in setting them all to the previous state.
[1] Intel SDM Vol 3C 26.3.1.2 Checks on Guest Segment Registers
[2] Intel SDM Vol 3C 27.3.2 Saving Segment Registers and Descriptor-Table Registers
[3] Intel SDM Vol 3C 26.3.2.2 Loading Guest Segment Registers and Descriptor-Table Registers
Message-Id: <[email protected]>
--- arch/x86/kvm/vmx/vmx.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
arch/x86/kvm/vmx/vmx.c +9 -12
@@ -3412,18 +3412,15 @@ static u32 vmx_segment_access_rights(str {u32 ar; -if (var->unusable || !var->present) - ar =1 <<16 ; -else { - ar = var->type &15 ; - ar |= (var->s &1 ) <<4 ; - ar |= (var->dpl &3 ) <<5 ; - ar |= (var->present &1 ) <<7 ; - ar |= (var->avl &1 ) <<12 ; - ar |= (var->l &1 ) <<13 ; - ar |= (var->db &1 ) <<14 ; - ar |= (var->g &1 ) <<15 ; - } + ar = var->type &15 ; + ar |= (var->s &1 ) <<4 ; + ar |= (var->dpl &3 ) <<5 ; + ar |= (var->present &1 ) <<7 ; + ar |= (var->avl &1 ) <<12 ; + ar |= (var->l &1 ) <<13 ; + ar |= (var->db &1 ) <<14 ; + ar |= (var->g &1 ) <<15 ; + ar |= (var->unusable || !var->present) <<16 ;return ar; }
Greg Kroah-Hartman
maintainerPATCH 224/313 KVM: arm64: GICv4.1: Fix race with doorbell on VPE activation/deactivation
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
commit ef3691683d7bfd0a2acf48812e4ffe894f10bfa8 upstream.
To save the vgic LPI pending state with GICv4.1, the VPEs must all be unmapped from the ITSs so that the sGIC caches can be flushed. The opposite is done once the state is saved.
This is all done by using the activate/deactivate irqdomain callbacks directly from the vgic code. Crutially, this is done without holding the irqdesc lock for the interrupts that represent the VPE. And these callbacks are changing the state of the irqdesc. What could possibly go wrong?
If a doorbell fires while we are messing with the irqdesc state, it will acquire the lock and change the interrupt state concurrently. Since we don't hole the lock, curruption occurs in on the interrupt state. Oh well.
While acquiring the lock would fix this (and this was Shanker's initial approach), this is still a layering violation we could do without. A better approach is actually to free the VPE interrupt, do what we have to do, and re-request it.
It is more work, but this usually happens only once in the lifetime of the VM and we don't really care about this sort of overhead.
--- arch/arm64/kvm/vgic/vgic-v3.c | 25 +++++++++++-------------- arch/arm64/kvm/vgic/vgic-v4.c | 8 ++++++-- arch/arm64/kvm/vgic/vgic.h | 1 + 3 files changed, 18 insertions(+), 16 deletions(-)
arch/arm64/kvm/vgic/vgic-v3.c +11 -14
@@ -350,26 +350,23 @@ retry:* The deactivation of the doorbell interrupt will trigger the * unmapping of the associated vPE. */ -static void unmap_all_vpes (struct vgic_dist *dist) +static void unmap_all_vpes (struct kvm *kvm) { -struct irq_desc *desc; +struct vgic_dist *dist = &kvm->arch.vgic;int i; -for (i =0 ; i < dist->its_vm.nr_vpes; i++) { - desc =irq_to_desc (dist->its_vm.vpes[i]->irq); -irq_domain_deactivate_irq (irq_desc_get_irq_data (desc)); - } +for (i =0 ; i < dist->its_vm.nr_vpes; i++) +free_irq (dist->its_vm.vpes[i]->irq,kvm_get_vcpu (kvm, i)); } -static void map_all_vpes (struct vgic_dist *dist) +static void map_all_vpes (struct kvm *kvm) { -struct irq_desc *desc; +struct vgic_dist *dist = &kvm->arch.vgic;int i; -for (i =0 ; i < dist->its_vm.nr_vpes; i++) { - desc =irq_to_desc (dist->its_vm.vpes[i]->irq); -irq_domain_activate_irq (irq_desc_get_irq_data (desc), false); - } +for (i =0 ; i < dist->its_vm.nr_vpes; i++) +WARN_ON (vgic_v4_request_vpe_irq (kvm_get_vcpu (kvm, i), + dist->its_vm.vpes[i]->irq)); }/**
@@ -394,7 +391,7 @@ int vgic_v3_save_pending_tables(struct k* and enabling of the doorbells have already been done. */ if (kvm_vgic_global_state.has_gicv4_1) { -unmap_all_vpes (dist); +unmap_all_vpes (kvm); vlpi_avail = true; }
@@ -444,7 +441,7 @@ int vgic_v3_save_pending_tables(struct k out:if (vlpi_avail) -map_all_vpes (dist); +map_all_vpes (kvm);return ret; }
arch/arm64/kvm/vgic/vgic-v4.c +6 -2
@@ -222,6 +222,11 @@ void vgic_v4_get_vlpi_state(struct vgic_ *val = !!(*ptr & mask); } +int vgic_v4_request_vpe_irq (struct kvm_vcpu *vcpu,int irq) +{ +return request_irq (irq, vgic_v4_doorbell_handler,0 ,"vcpu" , vcpu); +} +/** * vgic_v4_init - Initialize the GICv4 data structures * @kvm: Pointer to the VM being initialized
@@ -283,8 +288,7 @@ int vgic_v4_init(struct kvm *kvm) irq_flags &= ~IRQ_NOAUTOEN ;irq_set_status_flags (irq, irq_flags); - ret =request_irq (irq, vgic_v4_doorbell_handler, -0 ,"vcpu" , vcpu); + ret =vgic_v4_request_vpe_irq (vcpu, irq);if (ret) {kvm_err ("failed to allocate vcpu IRQ%d\n" , irq);/*
arch/arm64/kvm/vgic/vgic.h +1 -0
@@ -331,5 +331,6 @@ int vgic_v4_init(struct kvm *kvm);void vgic_v4_teardown (struct kvm *kvm);void vgic_v4_configure_vsgis (struct kvm *kvm);void vgic_v4_get_vlpi_state (struct vgic_irq *irq,bool *val); +int vgic_v4_request_vpe_irq (struct kvm_vcpu *vcpu,int irq);#endif
Greg Kroah-Hartman
maintainerPATCH 225/313 scsi: ufs: core: Fix devfreq deadlocks
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit ba81043753fffbc2ad6e0c5ff2659f12ac2f46b4 upstream.
There is a lock inversion and rwsem read-lock recursion in the devfreq target callback which can lead to deadlocks.
Specifically, ufshcd_devfreq_scale() already holds a clk_scaling_lock read lock when toggling the write booster, which involves taking the dev_cmd mutex before taking another clk_scaling_lock read lock.
This can lead to a deadlock if another thread:
1) tries to acquire the dev_cmd and clk_scaling locks in the correct order, or
2) takes a clk_scaling write lock before the attempt to take the clk_scaling read lock a second time.
Fix this by dropping the clk_scaling_lock before toggling the write booster as was done before commit 0e9d4ca43ba8 ("scsi: ufs: Protect some contexts from unexpected clock scaling").
While the devfreq callbacks are already serialised, add a second serialising mutex to handle the unlikely case where a callback triggered through the devfreq sysfs interface is racing with a request to disable clock scaling through the UFS controller 'clkscale_enable' sysfs attribute. This could otherwise lead to the write booster being left disabled after having disabled clock scaling.
Also take the new mutex in ufshcd_clk_scaling_allow() to make sure that any pending write booster update has completed on return.
Note that this currently only affects Qualcomm platforms since commit 87bd05016a64 ("scsi: ufs: core: Allow host driver to disable wb toggling during clock scaling").
The lock inversion (i.e. 1 above) was reported by lockdep as:
======================================================
WARNING: possible circular locking dependency detected 6.1.0-next-20221216 #211 Not tainted
------------------------------------------------------
kworker/u16:2/71 is trying to acquire lock:
ffff076280ba98a0 (&hba->dev_cmd.lock){+.+.}-{3:3}, at: ufshcd_query_flag+0x50/0x1c0
but task is already holding lock:
ffff076280ba9cf0 (&hba->clk_scaling_lock){++++}-{3:3}, at: ufshcd_devfreq_scale+0x2b8/0x380
which lock already depends on the new lock.
[ +0.011606]
the existing dependency chain (in reverse order) is:
-> #1 (&hba->clk_scaling_lock){++++}-{3:3}:
lock_acquire+0x68/0x90
down_read+0x58/0x80
ufshcd_exec_dev_cmd+0x70/0x2c0
ufshcd_verify_dev_init+0x68/0x170
ufshcd_probe_hba+0x398/0x1180
ufshcd_async_scan+0x30/0x320
async_run_entry_fn+0x34/0x150
process_one_work+0x288/0x6c0
worker_thread+0x74/0x450
kthread+0x118/0x120
ret_from_fork+0x10/0x20-> #0 (&hba->dev_cmd.lock){+.+.}-{3:3}:
__lock_acquire+0x12a0/0x2240
lock_acquire.part.0+0xcc/0x220
lock_acquire+0x68/0x90
__mutex_lock+0x98/0x430
mutex_lock_nested+0x2c/0x40
ufshcd_query_flag+0x50/0x1c0
ufshcd_query_flag_retry+0x64/0x100
ufshcd_wb_toggle+0x5c/0x120
ufshcd_devfreq_scale+0x2c4/0x380
ufshcd_devfreq_target+0xf4/0x230
devfreq_set_target+0x84/0x2f0
devfreq_update_target+0xc4/0xf0
devfreq_monitor+0x38/0x1f0
process_one_work+0x288/0x6c0
worker_thread+0x74/0x450
kthread+0x118/0x120
ret_from_fork+0x10/0x20other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&hba->clk_scaling_lock);
lock(&hba->dev_cmd.lock);
lock(&hba->clk_scaling_lock);
lock(&hba->dev_cmd.lock);*** DEADLOCK ***
--- drivers/ufs/core/ufshcd.c | 29 +++++++++++++++-------------- include/ufs/ufshcd.h | 2 ++ 2 files changed, 17 insertions(+), 14 deletions(-)
drivers/ufs/core/ufshcd.c +15 -14
@@ -1231,12 +1231,14 @@ static int ufshcd_clock_scaling_prepare(* clock scaling is in progress */ ufshcd_scsi_block_requests (hba); +mutex_lock (&hba->wb_mutex);down_write (&hba->clk_scaling_lock);if (!hba->clk_scaling.is_allowed ||ufshcd_wait_for_doorbell_clr (hba,DOORBELL_CLR_TOUT_US )) { ret = -EBUSY ;up_write (&hba->clk_scaling_lock); +mutex_unlock (&hba->wb_mutex);ufshcd_scsi_unblock_requests (hba); goto out; }
@@ -1248,12 +1250,16 @@ out:return ret; } -static void ufshcd_clock_scaling_unprepare (struct ufs_hba *hba,bool writelock) +static void ufshcd_clock_scaling_unprepare (struct ufs_hba *hba,int err,bool scale_up) { -if (writelock) -up_write (&hba->clk_scaling_lock); -else -up_read (&hba->clk_scaling_lock); +up_write (&hba->clk_scaling_lock); + +/* Enable Write Booster if we have scaled up else disable it */ +if (ufshcd_enable_wb_if_scaling_up (hba) && !err) +ufshcd_wb_toggle (hba, scale_up); + +mutex_unlock (&hba->wb_mutex); +ufshcd_scsi_unblock_requests (hba);ufshcd_release (hba); }
@@ -1270,7 +1276,6 @@ static void ufshcd_clock_scaling_unprepastatic int ufshcd_devfreq_scale (struct ufs_hba *hba,bool scale_up) {int ret =0 ; -bool is_writelock = true; ret =ufshcd_clock_scaling_prepare (hba);if (ret)
@@ -1299,15 +1304,8 @@ static int ufshcd_devfreq_scale(struct u } } -/* Enable Write Booster if we have scaled up else disable it */ -if (ufshcd_enable_wb_if_scaling_up (hba)) { -downgrade_write (&hba->clk_scaling_lock); - is_writelock = false; -ufshcd_wb_toggle (hba, scale_up); - } - out_unprepare: -ufshcd_clock_scaling_unprepare (hba, is_writelock); +ufshcd_clock_scaling_unprepare (hba, ret, scale_up);return ret; }
@@ -6104,9 +6102,11 @@ static void ufshcd_force_error_recovery(static void ufshcd_clk_scaling_allow (struct ufs_hba *hba,bool allow) { +mutex_lock (&hba->wb_mutex);down_write (&hba->clk_scaling_lock); hba->clk_scaling.is_allowed = allow;up_write (&hba->clk_scaling_lock); +mutex_unlock (&hba->wb_mutex); }static void ufshcd_clk_scaling_suspend (struct ufs_hba *hba,bool suspend)
@@ -9773,6 +9773,7 @@ int ufshcd_init(struct ufs_hba *hba, voi/* Initialize mutex for exception event control */ mutex_init (&hba->ee_ctrl_mutex); +mutex_init (&hba->wb_mutex);init_rwsem (&hba->clk_scaling_lock);ufshcd_init_clk_gating (hba);
include/ufs/ufshcd.h +2 -0
@@ -806,6 +806,7 @@ struct ufs_hba_monitor {* @urgent_bkops_lvl: keeps track of urgent bkops level for device * @is_urgent_bkops_lvl_checked: keeps track if the urgent bkops level for * device is known or not. +* @wb_mutex: used to serialize devfreq and sysfs write booster toggling * @clk_scaling_lock: used to serialize device commands and clock scaling * @desc_size: descriptor sizes reported by device * @scsi_block_reqs_cnt: reference counting for scsi block requests
@@ -948,6 +949,7 @@ struct ufs_hba {enum bkops_status urgent_bkops_lvl;bool is_urgent_bkops_lvl_checked; +struct mutex wb_mutex;struct rw_semaphore clk_scaling_lock;unsigned char desc_size[QUERY_DESC_IDN_MAX ];atomic_t scsi_block_reqs_cnt;
Greg Kroah-Hartman
maintainerPATCH 226/313 riscv: fix -Wundef warning for CONFIG_RISCV_BOOT_SPINWAIT
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit 5b89c6f9b2df2b7cf6da8e0b2b87c8995b378cad upstream.
Since commit 80b6093b55e3 ("kbuild: add -Wundef to KBUILD_CPPFLAGS for W=1 builds"), building with W=1 detects misuse of #if.
$ make W=1 ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- arch/riscv/kernel/
[snip]
AS arch/riscv/kernel/head.o
arch/riscv/kernel/head.S:329:5: warning: "CONFIG_RISCV_BOOT_SPINWAIT" is not defined, evaluates to 0 [-Wundef]
329 | #if CONFIG_RISCV_BOOT_SPINWAIT
| ^~~~~~~~~~~~~~~~~~~~~~~~~~CONFIG_RISCV_BOOT_SPINWAIT is a bool option. #ifdef should be used.
--- arch/riscv/kernel/head.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/head.S +1 -1
@@ -326,7 +326,7 @@ clear_bss_done: call soc_early_init tail start_kernel -#if CONFIG_RISCV_BOOT_SPINWAIT +#ifdef CONFIG_RISCV_BOOT_SPINWAIT .Lsecondary_start: /* Set trap vector to spin forever to help debug */ la a3, .Lsecondary_park
Greg Kroah-Hartman
maintainerPATCH 227/313 thermal: intel: int340x: Protect trip temperature from concurrent updates
In reply to Greg Kroah-HartmanFrom: Srinivas Pandruvada <[email protected]>
commit 6757a7abe47bcb12cb2d45661067e182424b0ee3 upstream.
Trip temperatures are read using ACPI methods and stored in the memory during zone initializtion and when the firmware sends a notification for change. This trip temperature is returned when the thermal core calls via callback get_trip_temp().
But it is possible that while updating the memory copy of the trips when the firmware sends a notification for change, thermal core is reading the trip temperature via the callback get_trip_temp(). This may return invalid trip temperature.
To address this add a mutex to protect the invalid temperature reads in the callback get_trip_temp() and int340x_thermal_read_trips().
--- drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 18 +++++++++-- drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h | 1 2 files changed, 16 insertions(+), 3 deletions(-)
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +15 -3
@@ -44,11 +44,13 @@ static int int340x_thermal_get_trip_temp int trip, int *temp) { struct int34x_thermal_zone *d = zone->devdata; -int i; +int i, ret =0 ;if (d->override_ops && d->override_ops->get_trip_temp)return d->override_ops->get_trip_temp (zone, trip, temp); +mutex_lock (&d->trip_mutex); +if (trip < d->aux_trip_nr) *temp = d->aux_trips[trip];else if (trip == d->crt_trip_id)
@@ -66,10 +68,12 @@ static int int340x_thermal_get_trip_temp } }if (i ==INT340X_THERMAL_MAX_ACT_TRIP_COUNT ) -return -EINVAL ; + ret = -EINVAL ; } -return 0 ; +mutex_unlock (&d->trip_mutex); + +return ret; } static int int340x_thermal_get_trip_type(struct thermal_zone_device *zone,
@@ -180,6 +184,8 @@ int int340x_thermal_read_trips(struct inint trip_cnt = int34x_zone->aux_trip_nr;int i; +mutex_lock (&int34x_zone->trip_mutex); + int34x_zone->crt_trip_id =-1 ;if (!int340x_thermal_get_trip_config (int34x_zone->adev->handle,"_CRT" , &int34x_zone->crt_temp))
@@ -207,6 +213,8 @@ int int340x_thermal_read_trips(struct in int34x_zone->act_trips[i].valid = true; } +mutex_unlock (&int34x_zone->trip_mutex); +return trip_cnt; }EXPORT_SYMBOL_GPL (int340x_thermal_read_trips);
@@ -230,6 +238,8 @@ struct int34x_thermal_zone *int340x_therif (!int34x_thermal_zone)return ERR_PTR (-ENOMEM ); +mutex_init (&int34x_thermal_zone->trip_mutex); + int34x_thermal_zone->adev = adev; int34x_thermal_zone->override_ops = override_ops;
@@ -281,6 +291,7 @@ err_thermal_zone:acpi_lpat_free_conversion_table (int34x_thermal_zone->lpat_table);kfree (int34x_thermal_zone->aux_trips); err_trip_alloc: +mutex_destroy (&int34x_thermal_zone->trip_mutex);kfree (int34x_thermal_zone);return ERR_PTR (ret); }
@@ -292,6 +303,7 @@ void int340x_thermal_zone_remove(structthermal_zone_device_unregister (int34x_thermal_zone->zone);acpi_lpat_free_conversion_table (int34x_thermal_zone->lpat_table);kfree (int34x_thermal_zone->aux_trips); +mutex_destroy (&int34x_thermal_zone->trip_mutex);kfree (int34x_thermal_zone); }EXPORT_SYMBOL_GPL (int340x_thermal_zone_remove);
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h +1 -0
@@ -32,6 +32,7 @@ struct int34x_thermal_zone {struct thermal_zone_device_ops *override_ops;void *priv_data;struct acpi_lpat_conversion_table *lpat_table; +struct mutex trip_mutex; }; struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *,
Greg Kroah-Hartman
maintainerPATCH 228/313 regulator: dt-bindings: samsung,s2mps14: add lost samsung,ext-control-gpios
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit 4bb3d82a1820c1b609ede8eb2332f3cb038c5840 upstream.
The samsung,ext-control-gpios property was lost during conversion to DT schema:
exynos3250-artik5-eval.dtb: pmic@66: regulators:LDO11: Unevaluated properties are not allowed ('samsung,ext-control-gpios' was unexpected)
--- Documentation/devicetree/bindings/regulator/samsung,s2mps14.yaml | 21 +++++++++- 1 file changed, 19 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/regulator/samsung,s2mps14.yaml +19 -2
@@ -19,8 +19,8 @@ description: | additional information and example. patternProperties: - # 25 LDOs - "^LDO([1-9]|[1][0-9]|2[0-5])$": + # 25 LDOs, without LDO10-12 + "^LDO([1-9]|1[3-9]|2[0-5])$": type: object $ref: regulator.yaml# unevaluatedProperties: false
@@ -29,6 +29,23 @@ patternProperties: required: - regulator-name + + "^LDO(1[0-2])$": + type: object + $ref: regulator.yaml# + unevaluatedProperties: false + description: + Properties for single LDO regulator. + + properties: + samsung,ext-control-gpios: + maxItems: 1 + description: + LDO10, LDO11 and LDO12 can be configured to external control over + GPIO. + + required: + - regulator-name # 5 bucks "^BUCK[1-5]$":
Greg Kroah-Hartman
maintainerPATCH 229/313 ipv6: fix reachability confirmation with proxy_ndp
In reply to Greg Kroah-HartmanFrom: Gergely Risko <[email protected]>
commit 9f535c870e493841ac7be390610ff2edec755762 upstream.
When proxying IPv6 NDP requests, the adverts to the initial multicast solicits are correct and working. On the other hand, when later a reachability confirmation is requested (on unicast), no reply is sent.
This causes the neighbor entry expiring on the sending node, which is mostly a non-issue, as a new multicast request is sent. There are routers, where the multicast requests are intentionally delayed, and in these environments the current implementation causes periodic packet loss for the proxied endpoints.
The root cause is the erroneous decrease of the hop limit, as this is checked in ndisc.c and no answer is generated when it's 254 instead of the correct 255.
--- net/ipv6/ip6_output.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
net/ipv6/ip6_output.c +14 -1
@@ -547,7 +547,20 @@ int ip6_forward(struct sk_buff *skb) pneigh_lookup(&nd_tbl, net, &hdr->daddr, skb->dev, 0)) {int proxied =ip6_forward_proxy_check (skb);if (proxied >0 ) { - hdr->hop_limit--; +/* It's tempting to decrease the hop limit +* here by 1, as we do at the end of the +* function too. +* +* But that would be incorrect, as proxying is +* not forwarding. The ip6_input function +* will handle this packet locally, and it +* depends on the hop limit being unchanged. +* +* One example is the NDP hop limit, that +* always has to stay 255, but other would be +* similar checks around RA packets, where the +* user can even change the desired limit. +*/ return ip6_input (skb); }else if (proxied <0 ) {__IP6_INC_STATS (net, idev,IPSTATS_MIB_INDISCARDS );
Greg Kroah-Hartman
maintainerPATCH 230/313 ARM: 9280/1: mm: fix warning on phys_addr_t to void pointer assignment
In reply to Greg Kroah-HartmanFrom: Giulio Benetti <[email protected]>
commit a4e03921c1bb118e6718e0a3b0322a2c13ed172b upstream.
zero_page is a void* pointer but memblock_alloc() returns phys_addr_t type so this generates a warning while using clang and with -Wint-error enabled that becomes and error. So let's cast the return of memblock_alloc() to (void *).
--- arch/arm/mm/nommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mm/nommu.c +1 -1
@@ -161,7 +161,7 @@ void __init paging_init(const struct macmpu_setup ();/* allocate the zero page. */ - zero_page =memblock_alloc (PAGE_SIZE ,PAGE_SIZE ); + zero_page = (void *)memblock_alloc (PAGE_SIZE ,PAGE_SIZE );if (!zero_page)panic ("%s: Failed to allocate %lu bytes align=0x%lx\n" , __func__,PAGE_SIZE ,PAGE_SIZE );
Greg Kroah-Hartman
maintainerPATCH 231/313 EDAC/device: Respect any driver-supplied workqueue polling value
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
commit cec669ff716cc83505c77b242aecf6f7baad869d upstream.
The EDAC drivers may optionally pass the poll_msec value. Use that value if available, else fall back to 1000ms.
[ bp: Touchups. ]
--- drivers/edac/edac_device.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/edac/edac_device.c +7 -8
@@ -34,6 +34,9 @@static DEFINE_MUTEX (device_ctls_mutex);static LIST_HEAD (edac_device_list); +/* Default workqueue processing interval on this instance, in msecs */ +#define DEFAULT_POLL_INTERVAL 1000 +#ifdef CONFIG_EDAC_DEBUG static void edac_device_dump_device (struct edac_device_ctl_info *edac_dev) {
@@ -336,7 +339,7 @@ static void edac_device_workq_function(s* whole one second to save timers firing all over the period * between integral seconds */ -if (edac_dev->poll_msec ==1000 ) +if (edac_dev->poll_msec ==DEFAULT_POLL_INTERVAL )edac_queue_work (&edac_dev->work,round_jiffies_relative (edac_dev->delay));else edac_queue_work (&edac_dev->work, edac_dev->delay);
@@ -366,7 +369,7 @@ static void edac_device_workq_setup(stru* timers firing on sub-second basis, while they are happy * to fire together on the 1 second exactly */ -if (edac_dev->poll_msec ==1000 ) +if (edac_dev->poll_msec ==DEFAULT_POLL_INTERVAL )edac_queue_work (&edac_dev->work,round_jiffies_relative (edac_dev->delay));else edac_queue_work (&edac_dev->work, edac_dev->delay);
@@ -400,7 +403,7 @@ void edac_device_reset_delay_period(stru edac_dev->delay =msecs_to_jiffies (msec);/* See comment in edac_device_workq_setup() above */ -if (edac_dev->poll_msec ==1000 ) +if (edac_dev->poll_msec ==DEFAULT_POLL_INTERVAL )edac_mod_work (&edac_dev->work,round_jiffies_relative (edac_dev->delay));else edac_mod_work (&edac_dev->work, edac_dev->delay);
@@ -442,11 +445,7 @@ int edac_device_add_device(struct edac_d/* This instance is NOW RUNNING */ edac_dev->op_state =OP_RUNNING_POLL ; -/* -* enable workq processing on this instance, -* default = 1000 msec -*/ -edac_device_workq_setup (edac_dev,1000 ); +edac_device_workq_setup (edac_dev, edac_dev->poll_msec ?:DEFAULT_POLL_INTERVAL ); }else { edac_dev->op_state =OP_RUNNING_INTERRUPT ; }
Greg Kroah-Hartman
maintainerPATCH 232/313 EDAC/qcom: Do not pass llcc_driv_data as edac_device_ctl_infos pvt_info
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
commit 977c6ba624f24ae20cf0faee871257a39348d4a9 upstream.
The memory for llcc_driv_data is allocated by the LLCC driver. But when it is passed as the private driver info to the EDAC core, it will get freed during the qcom_edac driver release. So when the qcom_edac driver gets probed again, it will try to use the freed data leading to the use-after-free bug.
Hence, do not pass llcc_driv_data as pvt_info but rather reference it using the platform_data pointer in the qcom_edac driver.
--- drivers/edac/qcom_edac.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/edac/qcom_edac.c +2 -3
@@ -252,7 +252,7 @@ clear:static int dump_syn_reg (struct edac_device_ctl_info *edev_ctl,int err_type,u32 bank) { -struct llcc_drv_data *drv = edev_ctl->pvt_info; +struct llcc_drv_data *drv = edev_ctl->dev->platform_data;int ret; ret =dump_syn_reg_values (drv, bank, err_type);
@@ -289,7 +289,7 @@ static irqreturn_t llcc_ecc_irq_handler(int irq, void *edev_ctl) { struct edac_device_ctl_info *edac_dev_ctl = edev_ctl; -struct llcc_drv_data *drv = edac_dev_ctl->pvt_info; +struct llcc_drv_data *drv = edac_dev_ctl->dev->platform_data;irqreturn_t irq_rc =IRQ_NONE ;u32 drp_error, trp_error, i;int ret;
@@ -358,7 +358,6 @@ static int qcom_llcc_edac_probe(struct p edev_ctl->dev_name =dev_name (dev); edev_ctl->ctl_name ="llcc" ; edev_ctl->panic_on_ue =LLCC_ERP_PANIC_ON_UE ; - edev_ctl->pvt_info = llcc_driv_data; rc =edac_device_add_device (edev_ctl);if (rc)
Greg Kroah-Hartman
maintainerPATCH 233/313 platform/x86: thinkpad_acpi: Fix profile modes on Intel platforms
In reply to Greg Kroah-HartmanFrom: Mark Pearson <[email protected]>
commit 1bc5d819f0b9784043ea08570e1b21107aa35739 upstream.
My last commit to fix profile mode displays on AMD platforms caused an issue on Intel platforms - sorry!
In it I was reading the current functional mode (MMC, PSC, AMT) from the BIOS but didn't account for the fact that on some of our Intel platforms I use a different API which returns just the profile and not the functional mode.
This commit fixes it so that on Intel platforms it knows the functional mode is always MMC.
I also fixed a potential problem that a platform may try to set the mode for both MMC and PSC - which was incorrect.
Tested on X1 Carbon 9 (Intel) and Z13 (AMD).
--- drivers/platform/x86/thinkpad_acpi.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +6 -5
@@ -10500,8 +10500,7 @@ static int dytc_profile_set(struct platfif (err) goto unlock; } - } -if (dytc_capabilities &BIT (DYTC_FC_PSC )) { + }else if (dytc_capabilities &BIT (DYTC_FC_PSC )) { err =dytc_command (DYTC_SET_COMMAND (DYTC_FUNCTION_PSC , perfmode,1 ), &output);if (err) goto unlock;
@@ -10529,14 +10528,16 @@ static void dytc_profile_refresh(void) err =dytc_command (DYTC_CMD_MMC_GET , &output); else err =dytc_cql_command (DYTC_CMD_GET , &output); - }else if (dytc_capabilities &BIT (DYTC_FC_PSC )) + funcmode =DYTC_FUNCTION_MMC ; + }else if (dytc_capabilities &BIT (DYTC_FC_PSC )) { err =dytc_command (DYTC_CMD_GET , &output); - +/* Check if we are PSC mode, or have AMT enabled */ + funcmode = (output >>DYTC_GET_FUNCTION_BIT ) &0xF ; + }mutex_unlock (&dytc_mutex);if (err)return ; - funcmode = (output >>DYTC_GET_FUNCTION_BIT ) &0xF ; perfmode = (output >>DYTC_GET_MODE_BIT ) &0xF ;convert_dytc_to_profile (funcmode, perfmode, &profile);if (profile != dytc_current_profile) {
Greg Kroah-Hartman
maintainerPATCH 234/313 drm/display/dp_mst: Correct the kref of port.
In reply to Greg Kroah-HartmanFrom: Wayne Lin <[email protected]>
commit d8bf2df715bb8ac964f91fe8bf67c37c5d916463 upstream.
[why & how]
We still need to refer to port while removing payload at commit_tail. we should keep the kref till then to release.
--- drivers/gpu/drm/display/drm_dp_mst_topology.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/display/drm_dp_mst_topology.c +3 -1
@@ -3372,6 +3372,9 @@ void drm_dp_remove_payload(struct drm_dp_mst_topology_mgr *mgr, mgr->payload_count--; mgr->next_start_slot -= payload->time_slots; + +if (payload->delete) +drm_dp_mst_put_port_malloc (payload->port); }EXPORT_SYMBOL (drm_dp_remove_payload);
@@ -4327,7 +4330,6 @@ int drm_dp_atomic_release_time_slots(struct drm_atomic_state *state,drm_dbg_atomic (mgr->dev,"[MST PORT:%p] TU %d -> 0\n" , port, payload->time_slots);if (!payload->delete) { -drm_dp_mst_put_port_malloc (port); payload->pbn =0 ; payload->delete = true; topology_state->payload_mask &= ~BIT (payload->vcpi -1 );
Signature · 1 line
2.39.1
Greg Kroah-Hartman
maintainerPATCH 235/313 drm/amd/pm: add missing AllowIHInterrupt message mapping for SMU13.0.0
In reply to Greg Kroah-HartmanFrom: Evan Quan <[email protected]>
commit 15b207d0abdcbb2271774aa99d9a290789159e75 upstream.
Add SMU13.0.0 AllowIHInterrupt message mapping.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +1 -0
@@ -145,6 +145,7 @@ static struct cmn2asic_msg_mapping smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] =MSG_MAP (SetBadMemoryPagesRetiredFlagsPerChannel, PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel,0 ),MSG_MAP (AllowGpo, PPSMC_MSG_SetGpoAllow,0 ), + MSG_MAP(AllowIHHostInterrupt, PPSMC_MSG_AllowIHHostInterrupt, 0), }; static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] = {
Signature · 1 line
2.39.1
Greg Kroah-Hartman
maintainerPATCH 236/313 drm/amdgpu: remove unconditional trap enable on add gfx11 queues
In reply to Greg Kroah-HartmanFrom: Jonathan Kim <[email protected]>
commit 2de3769830346e68b3de0f4abc0d8e2625ad9dac upstream.
Rebase of driver has incorrect unconditional trap enablement for GFX11 when adding mes queues.
--- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +0 -1
@@ -192,7 +192,6 @@ static int mes_v11_0_add_hw_queue(struct mes_add_queue_pkt.trap_handler_addr = input->tba_addr; mes_add_queue_pkt.tma_addr = input->tma_addr; mes_add_queue_pkt.is_kfd_process = input->is_kfd_process; - mes_add_queue_pkt.trap_en =1 ;/* For KFD, gds_size is re-used for queue size (needed in MES for AQL queues) */ mes_add_queue_pkt.is_aql_queue = input->is_aql_queue;
Greg Kroah-Hartman
maintainerPATCH 237/313 drm/amdgpu/display/mst: Fix mst_state->pbn_div and slot count assignments
In reply to Greg Kroah-HartmanFrom: Lyude Paul <[email protected]>
commit 1119e1f9636b76aef14068c7fd0b4d55132b86b8 upstream.
Looks like I made a pretty big mistake here without noticing: it seems when I moved the assignments of mst_state->pbn_div I completely missed the fact that the reason for us calling drm_dp_mst_update_slots() earlier was to account for the fact that we need to call this function using info from the root MST connector, instead of just trying to do this from each MST encoder's atomic check function. Otherwise, we end up filling out all of DC's link information with zeroes.
So, let's restore that and hopefully fix this DSC regression.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 24 ++++++++++++ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 5 -- 2 files changed, 24 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +24 -0
@@ -9393,6 +9393,8 @@ static int amdgpu_dm_atomic_check(structstruct drm_connector_state *old_con_state, *new_con_state;struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state, *new_crtc_state; +struct drm_dp_mst_topology_mgr *mgr; +struct drm_dp_mst_topology_state *mst_state;struct drm_plane *plane;struct drm_plane_state *old_plane_state, *new_plane_state;enum dc_status status;
@@ -9648,6 +9650,28 @@ static int amdgpu_dm_atomic_check(struct lock_and_validation_needed = true; } +#if defined(CONFIG_DRM_AMD_DC_DCN ) +/* set the slot info for each mst_state based on the link encoding format */ +for_each_new_mst_mgr_in_state (state, mgr, mst_state, i) { +struct amdgpu_dm_connector *aconnector; +struct drm_connector *connector; +struct drm_connector_list_iter iter; +u8 link_coding_cap; + +drm_connector_list_iter_begin (dev, &iter); +drm_for_each_connector_iter (connector, &iter) { +if (connector->index == mst_state->mgr->conn_base_id) { + aconnector =to_amdgpu_dm_connector (connector); + link_coding_cap =dc_link_dp_mst_decide_link_encoding_format (aconnector->dc_link); +drm_dp_mst_update_slots (mst_state, link_coding_cap); + +break ; + } + } +drm_connector_list_iter_end (&iter); + } +#endif +/** * Streams and planes are reset when there are changes that affect * bandwidth. Anything that affects bandwidth needs to go through
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +0 -5
@@ -896,11 +896,6 @@ static int compute_mst_dsc_configs_for_lif (IS_ERR (mst_state))return PTR_ERR (mst_state); - mst_state->pbn_div =dm_mst_get_pbn_divider (dc_link); -#if defined(CONFIG_DRM_AMD_DC_DCN ) -drm_dp_mst_update_slots (mst_state,dc_link_dp_mst_decide_link_encoding_format (dc_link)); -#endif -/* Set up params */ for (i =0 ; i < dc_state->stream_count; i++) {struct dc_dsc_policy dsc_policy = {0 };
Greg Kroah-Hartman
maintainerPATCH 238/313 drm/amdgpu/display/mst: limit payload to be updated one by one
In reply to Greg Kroah-HartmanFrom: Wayne Lin <[email protected]>
commit cb1e0b015f56b8f3c7f5ce33ff4b782ee5674512 upstream.
[Why]
amdgpu expects to update payload table for one stream one time by calling dm_helpers_dp_mst_write_payload_allocation_table(). Currently, it get modified to try to update HW payload table at once by referring mst_state.
[How]
This is just a quick workaround. Should find way to remove the temporary struct dc_dp_mst_stream_allocation_table later if set struct link_mst_stream_allocatio directly is possible.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 51 ++++++++++---- 1 file changed, 39 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +39 -12
@@ -120,23 +120,50 @@ enum dc_edid_status dm_helpers_parse_edi }static void -fill_dc_mst_payload_table_from_drm (struct drm_dp_mst_topology_state *mst_state, -struct amdgpu_dm_connector *aconnector, +fill_dc_mst_payload_table_from_drm (struct dc_link *link, +bool enable, +struct drm_dp_mst_atomic_payload *target_payload,struct dc_dp_mst_stream_allocation_table *table) {struct dc_dp_mst_stream_allocation_table new_table = {0 };struct dc_dp_mst_stream_allocation *sa; -struct drm_dp_mst_atomic_payload *payload; +struct link_mst_stream_allocation_table copy_of_link_table = + link->mst_stream_alloc_table; + +int i; +int current_hw_table_stream_cnt = copy_of_link_table.stream_count; +struct link_mst_stream_allocation *dc_alloc; + +/* TODO: refactor to set link->mst_stream_alloc_table directly if possible.*/ +if (enable) { + dc_alloc = + ©_of_link_table.stream_allocations[current_hw_table_stream_cnt]; + dc_alloc->vcp_id = target_payload->vcpi; + dc_alloc->slot_count = target_payload->time_slots; + }else { +for (i =0 ; i < copy_of_link_table.stream_count; i++) { + dc_alloc = + ©_of_link_table.stream_allocations[i]; + +if (dc_alloc->vcp_id == target_payload->vcpi) { + dc_alloc->vcp_id =0 ; + dc_alloc->slot_count =0 ; +break ; + } + } +ASSERT (i != copy_of_link_table.stream_count); + }/* Fill payload info*/ -list_for_each_entry (payload, &mst_state->payloads, next) { -if (payload->delete) -continue ; - - sa = &new_table.stream_allocations[new_table.stream_count]; - sa->slot_count = payload->time_slots; - sa->vcp_id = payload->vcpi; - new_table.stream_count++; +for (i =0 ; i <MAX_CONTROLLER_NUM ; i++) { + dc_alloc = + ©_of_link_table.stream_allocations[i]; +if (dc_alloc->vcp_id >0 && dc_alloc->slot_count >0 ) { + sa = &new_table.stream_allocations[new_table.stream_count]; + sa->slot_count = dc_alloc->slot_count; + sa->vcp_id = dc_alloc->vcp_id; + new_table.stream_count++; + } }/* Overwrite the old table */
@@ -185,7 +212,7 @@ bool dm_helpers_dp_mst_write_payload_all* AUX message. The sequence is slot 1-63 allocated sequence for each * stream. AMD ASIC stream slot allocation should follow the same * sequence. copy DRM MST allocation to dc */ -fill_dc_mst_payload_table_from_drm (mst_state, aconnector, proposed_table); +fill_dc_mst_payload_table_from_drm (stream->link, enable, payload, proposed_table);return true; }
Greg Kroah-Hartman
maintainerPATCH 239/313 drm/amdgpu/display/mst: update mst_mgr relevant variable when long HPD
In reply to Greg Kroah-HartmanFrom: Wayne Lin <[email protected]>
commit f85c5e25fd28fe0bf6d6d0563cf83758a4e05c8f upstream.
[Why & How]
Now the vc_start_slot is controlled at drm side. When we service a long HPD, we still need to run dm_helpers_dp_mst_write_payload_allocation_table() to update drm mst_mgr's relevant variable. Otherwise, on the next plug-in, payload will get assigned with a wrong start slot.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +12 -2
@@ -3995,10 +3995,13 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx)struct fixed31_32 avg_time_slots_per_mtp =dc_fixpt_from_int (0 );int i;bool mst_mode = (link->type == dc_connection_mst_branch); +/* adjust for drm changes*/ +bool update_drm_mst_state = true;const struct link_hwss *link_hwss =get_link_hwss (link, &pipe_ctx->link_res);const struct dc_link_settings empty_link_settings = {0 };DC_LOGGER_INIT (link->ctx->logger); +/* deallocate_mst_payload is called before disable link. When mode or * disable/enable monitor, new stream is created which is not in link * stream[] yet. For this, payload is not allocated yet, so de-alloc
@@ -4014,7 +4017,7 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx) &empty_link_settings, avg_time_slots_per_mtp); -if (mst_mode) { +if (mst_mode || update_drm_mst_state) {/* when link is in mst mode, reply on mst manager to remove * payload */
@@ -4077,11 +4080,18 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx) stream->ctx, stream); +if (!update_drm_mst_state) +dm_helpers_dp_mst_send_payload_allocation ( + stream->ctx, + stream, + false); + } + +if (update_drm_mst_state)dm_helpers_dp_mst_send_payload_allocation ( stream->ctx, stream, false); - }return DC_OK ; }
Signature · 1 line
2.39.1
Greg Kroah-Hartman
maintainerPATCH 240/313 io_uring: inline io_req_task_work_add()
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
[ Upstream commit e52d2e583e4ad1d5d0b804d79c2b8752eb0e5ceb ]
__io_req_task_work_add() is huge but marked inline, that makes compilers to generate lots of garbage. Inline the wrapper caller io_req_task_work_add() instead.
before and after:
text data bss dec hex filename
47347 16248 8 63603 f873 io_uring/io_uring.o
text data bss dec hex filename
45303 16248 8 61559 f077 io_uring/io_uring.o
Stable-dep-of: ef5c600adb1d ("io_uring: always prep_async for drain requests")
--- io_uring/io_uring.c | 7 +------ io_uring/io_uring.h | 7 ++++++- 2 files changed, 7 insertions(+), 7 deletions(-)
io_uring/io_uring.c +1 -6
@@ -1133,7 +1133,7 @@ static void io_req_local_work_add(struct io_kiocb *req)percpu_ref_put (&ctx->refs); } -static inline void __io_req_task_work_add (struct io_kiocb *req,bool allow_local) +void __io_req_task_work_add (struct io_kiocb *req,bool allow_local) {struct io_uring_task *tctx = req->task->io_uring;struct io_ring_ctx *ctx = req->ctx;
@@ -1165,11 +1165,6 @@ static inline void __io_req_task_work_add(struct io_kiocb *req, bool allow_local } } -void io_req_task_work_add (struct io_kiocb *req) -{ -__io_req_task_work_add (req, true); -} -static void __cold io_move_task_work_from_local (struct io_ring_ctx *ctx) {struct llist_node *node;
io_uring/io_uring.h +6 -1
@@ -51,9 +51,9 @@ static inline bool io_req_ffs_set(struct io_kiocb *req)return req->flags &REQ_F_FIXED_FILE ; } +void __io_req_task_work_add (struct io_kiocb *req,bool allow_local);bool io_is_uring_fops (struct file *file);bool io_alloc_async_data (struct io_kiocb *req); -void io_req_task_work_add (struct io_kiocb *req);void io_req_tw_post_queue (struct io_kiocb *req,s32 res,u32 cflags);void io_req_task_queue (struct io_kiocb *req);void io_queue_iowq (struct io_kiocb *req,bool *dont_use);
@@ -83,6 +83,11 @@ bool __io_alloc_req_refill(struct io_ring_ctx *ctx);bool io_match_task_safe (struct io_kiocb *head,struct task_struct *task,bool cancel_all); +static inline void io_req_task_work_add (struct io_kiocb *req) +{ +__io_req_task_work_add (req, true); +} +#define io_for_each_link (pos, head) \ for (pos = (head); pos; pos = pos->link)
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 241/313 io_uring: inline __io_req_complete_post()
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
[ Upstream commit f9d567c75ec216447f36da6e855500023504fa04 ]
There is only one user of __io_req_complete_post(), inline it.
Stable-dep-of: ef5c600adb1d ("io_uring: always prep_async for drain requests")
--- io_uring/io_uring.c | 11 +++-------- io_uring/io_uring.h | 1 - 2 files changed, 3 insertions(+), 9 deletions(-)
io_uring/io_uring.c +3 -8
@@ -854,19 +854,14 @@ static void __io_req_complete_put(struct io_kiocb *req) } } -void __io_req_complete_post (struct io_kiocb *req) -{ -if (!(req->flags &REQ_F_CQE_SKIP )) -__io_fill_cqe_req (req->ctx, req); -__io_req_complete_put (req); -} -void io_req_complete_post (struct io_kiocb *req) {struct io_ring_ctx *ctx = req->ctx;io_cq_lock (ctx); -__io_req_complete_post (req); +if (!(req->flags &REQ_F_CQE_SKIP )) +__io_fill_cqe_req (ctx, req); +__io_req_complete_put (req);io_cq_unlock_post (ctx); }
io_uring/io_uring.h +0 -1
@@ -33,7 +33,6 @@ int io_run_local_work(struct io_ring_ctx *ctx);void io_req_complete_failed (struct io_kiocb *req,s32 res);void __io_req_complete (struct io_kiocb *req,unsigned issue_flags);void io_req_complete_post (struct io_kiocb *req); -void __io_req_complete_post (struct io_kiocb *req);bool io_post_aux_cqe (struct io_ring_ctx *ctx,u64 user_data,s32 res,u32 cflags,bool allow_overflow); bool io_fill_cqe_aux(struct io_ring_ctx *ctx, u64 user_data, s32 res, u32 cflags,
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 242/313 io_uring: hold locks for io_req_complete_failed
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
[ Upstream commit e276ae344a770f91912a81c6a338d92efd319be2 ]
A preparation patch, make sure we always hold uring_lock around io_req_complete_failed(). The only place deviating from the rule is io_cancel_defer_files(), queue a tw instead.
Stable-dep-of: ef5c600adb1d ("io_uring: always prep_async for drain requests")
--- io_uring/io_uring.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
io_uring/io_uring.c +5 -1
@@ -871,9 +871,12 @@ inline void __io_req_complete(struct io_kiocb *req, unsigned issue_flags) }void io_req_complete_failed (struct io_kiocb *req,s32 res) + __must_hold(&ctx->uring_lock) {const struct io_op_def *def = &io_op_defs[req->opcode]; +lockdep_assert_held (&req->ctx->uring_lock); +req_set_fail (req);io_req_set_res (req, res,io_put_kbuf (req,IO_URING_F_UNLOCKED ));if (def->fail)
@@ -1631,6 +1634,7 @@ static u32 io_get_sequence(struct io_kiocb *req) }static __cold void io_drain_req (struct io_kiocb *req) + __must_hold(&ctx->uring_lock) {struct io_ring_ctx *ctx = req->ctx;struct io_defer_entry *de;
@@ -2867,7 +2871,7 @@ static __cold bool io_cancel_defer_files(struct io_ring_ctx *ctx,while (!list_empty (&list)) { de = list_first_entry(&list, struct io_defer_entry, list);list_del_init (&de->list); -io_req_complete_failed (de->req, -ECANCELED ); +io_req_task_queue_fail (de->req, -ECANCELED );kfree (de); }return true;
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 243/313 io_uring: use io_req_task_complete() in timeout
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
[ Upstream commit 624fd779fd869bdcb2c0ccca0f09456eed71ed52 ]
Use a more generic io_req_task_complete() in timeout completion task_work instead of io_req_complete_post().
Stable-dep-of: ef5c600adb1d ("io_uring: always prep_async for drain requests")
--- io_uring/timeout.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
io_uring/timeout.c +2 -2
@@ -284,11 +284,11 @@ static void io_req_task_link_timeout(struct io_kiocb *req, bool *locked) ret =io_try_cancel (req->task->io_uring, &cd, issue_flags); }io_req_set_res (req, ret ?: -ETIME ,0 ); -io_req_complete_post (req); +io_req_task_complete (req, locked);io_put_req (prev); }else {io_req_set_res (req, -ETIME ,0 ); -io_req_complete_post (req); +io_req_task_complete (req, locked); } }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 244/313 io_uring: remove io_req_tw_post_queue
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
[ Upstream commit 833b5dfffc26c81835ce38e2a5df9ac5fa142735 ]
Remove io_req_tw_post() and io_req_tw_post_queue(), we can use io_req_task_complete() instead.
Stable-dep-of: ef5c600adb1d ("io_uring: always prep_async for drain requests")
--- io_uring/io_uring.c | 12 ------------ io_uring/io_uring.h | 8 +++++++- io_uring/timeout.c | 6 +++--- 3 files changed, 10 insertions(+), 16 deletions(-)
io_uring/io_uring.c +0 -12
@@ -1236,18 +1236,6 @@ int io_run_local_work(struct io_ring_ctx *ctx)return ret; } -static void io_req_tw_post (struct io_kiocb *req,bool *locked) -{ -io_req_complete_post (req); -} - -void io_req_tw_post_queue (struct io_kiocb *req,s32 res,u32 cflags) -{ -io_req_set_res (req, res, cflags); - req->io_task_work.func = io_req_tw_post; -io_req_task_work_add (req); -} -static void io_req_task_cancel (struct io_kiocb *req,bool *locked) {/* not needed for normal modes, but SQPOLL depends on it */
io_uring/io_uring.h +7 -1
@@ -53,7 +53,6 @@ static inline bool io_req_ffs_set(struct io_kiocb *req)void __io_req_task_work_add (struct io_kiocb *req,bool allow_local);bool io_is_uring_fops (struct file *file);bool io_alloc_async_data (struct io_kiocb *req); -void io_req_tw_post_queue (struct io_kiocb *req,s32 res,u32 cflags);void io_req_task_queue (struct io_kiocb *req);void io_queue_iowq (struct io_kiocb *req,bool *dont_use);void io_req_task_complete (struct io_kiocb *req,bool *locked);
@@ -380,4 +379,11 @@ static inline bool io_allowed_run_tw(struct io_ring_ctx *ctx) ctx->submitter_task == current); } +static inline void io_req_queue_tw_complete (struct io_kiocb *req,s32 res) +{ +io_req_set_res (req, res,0 ); + req->io_task_work.func = io_req_task_complete; +io_req_task_work_add (req); +} +#endif
io_uring/timeout.c +3 -3
@@ -63,7 +63,7 @@ static bool io_kill_timeout(struct io_kiocb *req, int status)atomic_set (&req->ctx->cq_timeouts,atomic_read (&req->ctx->cq_timeouts) +1 );list_del_init (&timeout->list); -io_req_tw_post_queue (req, status,0 ); +io_req_queue_tw_complete (req, status);return true; }return false;
@@ -161,7 +161,7 @@ void io_disarm_next(struct io_kiocb *req) req->flags &= ~REQ_F_ARM_LTIMEOUT ;if (link && link->opcode ==IORING_OP_LINK_TIMEOUT ) {io_remove_next_linked (req); -io_req_tw_post_queue (link, -ECANCELED ,0 ); +io_req_queue_tw_complete (link, -ECANCELED ); } }else if (req->flags &REQ_F_LINK_TIMEOUT ) {struct io_ring_ctx *ctx = req->ctx;
@@ -170,7 +170,7 @@ void io_disarm_next(struct io_kiocb *req) link =io_disarm_linked_timeout (req);spin_unlock_irq (&ctx->timeout_lock);if (link) -io_req_tw_post_queue (link, -ECANCELED ,0 ); +io_req_queue_tw_complete (link, -ECANCELED ); }if (unlikely ((req->flags &REQ_F_FAIL ) && !(req->flags &REQ_F_HARDLINK )))
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 245/313 io_uring: inline __io_req_complete_put()
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
[ Upstream commit fa18fa2272c7469e470dcb7bf838ea50a25494ca ]
Inline __io_req_complete_put() into io_req_complete_post(), there are no other users.
Stable-dep-of: ef5c600adb1d ("io_uring: always prep_async for drain requests")
--- io_uring/io_uring.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)
io_uring/io_uring.c +7 -13
@@ -823,15 +823,19 @@ bool io_post_aux_cqe(struct io_ring_ctx *ctx,return filled; } -static void __io_req_complete_put (struct io_kiocb *req) +void io_req_complete_post (struct io_kiocb *req) { +struct io_ring_ctx *ctx = req->ctx; + +io_cq_lock (ctx); +if (!(req->flags &REQ_F_CQE_SKIP )) +__io_fill_cqe_req (ctx, req); +/* * If we're the last reference to this request, add to our locked * free_list cache. */ if (req_ref_put_and_test (req)) { -struct io_ring_ctx *ctx = req->ctx; -if (req->flags &IO_REQ_LINK_FLAGS ) {if (req->flags &IO_DISARM_MASK )io_disarm_next (req);
@@ -852,16 +856,6 @@ static void __io_req_complete_put(struct io_kiocb *req)wq_list_add_head (&req->comp_list, &ctx->locked_free_list); ctx->locked_free_nr++; } -} - -void io_req_complete_post (struct io_kiocb *req) -{ -struct io_ring_ctx *ctx = req->ctx; - -io_cq_lock (ctx); -if (!(req->flags &REQ_F_CQE_SKIP )) -__io_fill_cqe_req (ctx, req); -__io_req_complete_put (req);io_cq_unlock_post (ctx); }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 246/313 net: mana: Fix IRQ name - add PCI and queue number
In reply to Greg Kroah-HartmanFrom: Haiyang Zhang <[email protected]>
[ Upstream commit 20e3028c39a5bf882e91e717da96d14f1acec40e ]
The PCI and queue number info is missing in IRQ names.
Add PCI and queue number to IRQ names, to allow CPU affinity tuning scripts to work.
--- drivers/net/ethernet/microsoft/mana/gdma.h | 3 +++ drivers/net/ethernet/microsoft/mana/gdma_main.c | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/net/ethernet/microsoft/mana/gdma.h +3 -0
@@ -324,9 +324,12 @@ struct gdma_queue_spec { }; }; +#define MANA_IRQ_NAME_SZ 32 +struct gdma_irq_context {void (*handler)(void *arg);void *arg; +char name[MANA_IRQ_NAME_SZ ]; };struct gdma_context {
drivers/net/ethernet/microsoft/mana/gdma_main.c +8 -1
@@ -1233,13 +1233,20 @@ static int mana_gd_setup_irqs(struct pci_dev *pdev) gic->handler =NULL ; gic->arg =NULL ; +if (!i) +snprintf (gic->name,MANA_IRQ_NAME_SZ ,"mana_hwc@pci:%s" , +pci_name (pdev)); +else +snprintf (gic->name,MANA_IRQ_NAME_SZ ,"mana_q%d@pci:%s" , + i -1 ,pci_name (pdev)); + irq =pci_irq_vector (pdev, i);if (irq <0 ) { err = irq; goto free_irq; } - err =request_irq (irq, mana_gd_intr,0 ,"mana_intr" , gic); + err =request_irq (irq, mana_gd_intr,0 , gic->name, gic);if (err) goto free_irq; }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 247/313 io_uring: always prep_async for drain requests
In reply to Greg Kroah-HartmanFrom: Dylan Yudaken <[email protected]>
[ Upstream commit ef5c600adb1d985513d2b612cc90403a148ff287 ]
Drain requests all go through io_drain_req, which has a quick exit in case there is nothing pending (ie the drain is not useful). In that case it can run the issue the request immediately.
However for safety it queues it through task work.
The problem is that in this case the request is run asynchronously, but the async work has not been prepared through io_req_prep_async.
This has not been a problem up to now, as the task work always would run before returning to userspace, and so the user would not have a chance to race with it.
However - with IORING_SETUP_DEFER_TASKRUN - this is no longer the case and the work might be defered, giving userspace a chance to change data being referred to in the request.
Instead _always_ prep_async for drain requests, which is simpler anyway and removes this issue.
--- io_uring/io_uring.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
io_uring/io_uring.c +8 -10
@@ -1634,17 +1634,12 @@ static __cold void io_drain_req(struct io_kiocb *req) }spin_unlock (&ctx->completion_lock); - ret =io_req_prep_async (req); -if (ret) { -fail: -io_req_complete_failed (req, ret); -return ; - }io_prep_async_link (req); de =kmalloc (sizeof (*de),GFP_KERNEL );if (!de) { ret = -ENOMEM ; - goto fail; +io_req_complete_failed (req, ret); +return ; }spin_lock (&ctx->completion_lock);
@@ -1918,13 +1913,16 @@ static void io_queue_sqe_fallback(struct io_kiocb *req) req->flags &= ~REQ_F_HARDLINK ; req->flags |=REQ_F_LINK ;io_req_complete_failed (req, req->cqe.res); - }else if (unlikely (req->ctx->drain_active)) { -io_drain_req (req); }else {int ret =io_req_prep_async (req); -if (unlikely (ret)) +if (unlikely (ret)) {io_req_complete_failed (req, ret); +return ; + } + +if (unlikely (req->ctx->drain_active)) +io_drain_req (req);else io_queue_iowq (req,NULL ); }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 248/313 i2c: designware: use casting of u64 in clock multiplication to avoid overflow
In reply to Greg Kroah-HartmanFrom: Lareine Khawaly <[email protected]>
[ Upstream commit c8c37bc514514999e62a17e95160ed9ebf75ca8d ]
In functions i2c_dw_scl_lcnt() and i2c_dw_scl_hcnt() may have overflow by depending on the values of the given parameters including the ic_clk. For example in our use case where ic_clk is larger than one million, multiplication of ic_clk * 4700 will result in 32 bit overflow.
Add cast of u64 to the calculation to avoid multiplication overflow, and use the corresponding define for divide.
--- drivers/i2c/busses/i2c-designware-common.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-designware-common.c +6 -3
@@ -351,7 +351,8 @@ u32 i2c_dw_scl_hcnt(u32 ic_clk, u32 tSYMBOL, u32 tf, int cond, int offset)* * If your hardware is free from tHD;STA issue, try this one. */ -return DIV_ROUND_CLOSEST (ic_clk * tSYMBOL,MICRO ) -8 + offset; +return DIV_ROUND_CLOSEST_ULL ((u64 )ic_clk * tSYMBOL,MICRO ) - +8 + offset; else/* * Conditional expression:
@@ -367,7 +368,8 @@ u32 i2c_dw_scl_hcnt(u32 ic_clk, u32 tSYMBOL, u32 tf, int cond, int offset)* The reason why we need to take into account "tf" here, * is the same as described in i2c_dw_scl_lcnt(). */ -return DIV_ROUND_CLOSEST (ic_clk * (tSYMBOL + tf),MICRO ) -3 + offset; +return DIV_ROUND_CLOSEST_ULL ((u64 )ic_clk * (tSYMBOL + tf),MICRO ) - +3 + offset; }u32 i2c_dw_scl_lcnt (u32 ic_clk,u32 tLOW,u32 tf,int offset)
@@ -383,7 +385,8 @@ u32 i2c_dw_scl_lcnt(u32 ic_clk, u32 tLOW, u32 tf, int offset)* account the fall time of SCL signal (tf). Default tf value * should be 0.3 us, for safety. */ -return DIV_ROUND_CLOSEST (ic_clk * (tLOW + tf),MICRO ) -1 + offset; +return DIV_ROUND_CLOSEST_ULL ((u64 )ic_clk * (tLOW + tf),MICRO ) - +1 + offset; }int i2c_dw_set_sda_hold (struct dw_i2c_dev *dev)
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 249/313 i2c: designware: Fix unbalanced suspended flag
In reply to Greg Kroah-HartmanFrom: Richard Fitzgerald <[email protected]>
[ Upstream commit 75507a319876aba88932e2c7dab58b6c22d89f6b ]
Ensure that i2c_mark_adapter_suspended() is always balanced by a call to i2c_mark_adapter_resumed().
dw_i2c_plat_resume() must always be called, so that i2c_mark_adapter_resumed() is called. This is not compatible with DPM_FLAG_MAY_SKIP_RESUME, so remove the flag.
Since the controller is always resumed on system resume the dw_i2c_plat_complete() callback is redundant and has been removed.
The unbalanced suspended flag was introduced by commit c57813b8b288 ("i2c: designware: Lock the adapter while setting the suspended flag")
Before that commit, the system and runtime PM used the same functions. The DPM_FLAG_MAY_SKIP_RESUME was used to skip the system resume if the driver had been in runtime-suspend. If system resume was skipped, the suspended flag would be cleared by the next runtime resume. The check of the suspended flag was _after_ the call to pm_runtime_get_sync() in i2c_dw_xfer(). So either a system resume or a runtime resume would clear the flag before it was checked.
Having introduced the unbalanced suspended flag with that commit, a further commit 80704a84a9f8
("i2c: designware: Use the i2c_mark_adapter_suspended/resumed() helpers")
changed from using a local suspended flag to using the i2c_mark_adapter_suspended/resumed() functions. These use a flag that is checked by I2C core code before issuing the transfer to the bus driver, so there was no opportunity for the bus driver to runtime resume itself before the flag check.
--- drivers/i2c/busses/i2c-designware-platdrv.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-)
drivers/i2c/busses/i2c-designware-platdrv.c +2 -18
@@ -351,13 +351,11 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)if (dev->flags &ACCESS_NO_IRQ_SUSPEND ) {dev_pm_set_driver_flags (&pdev->dev, -DPM_FLAG_SMART_PREPARE | -DPM_FLAG_MAY_SKIP_RESUME ); +DPM_FLAG_SMART_PREPARE ); }else {dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_SMART_PREPARE | -DPM_FLAG_SMART_SUSPEND | -DPM_FLAG_MAY_SKIP_RESUME ); +DPM_FLAG_SMART_SUSPEND ); }device_enable_async_suspend (&pdev->dev);
@@ -419,21 +417,8 @@ static int dw_i2c_plat_prepare(struct device *dev)*/ return !has_acpi_companion(dev); } - -static void dw_i2c_plat_complete (struct device *dev) -{ -/* -* The device can only be in runtime suspend at this point if it has not -* been resumed throughout the ending system suspend/resume cycle, so if -* the platform firmware might mess up with it, request the runtime PM -* framework to resume it. -*/ -if (pm_runtime_suspended (dev) &&pm_resume_via_firmware ()) -pm_request_resume (dev); -}#else #define dw_i2c_plat_prepare NULL -#define dw_i2c_plat_complete NULL#endif #ifdef CONFIG_PM
@@ -483,7 +468,6 @@ static int __maybe_unused dw_i2c_plat_resume(struct device *dev)static const struct dev_pm_ops dw_i2c_dev_pm_ops = { .prepare = dw_i2c_plat_prepare, - .complete = dw_i2c_plat_complete, SET_LATE_SYSTEM_SLEEP_PM_OPS(dw_i2c_plat_suspend, dw_i2c_plat_resume)SET_RUNTIME_PM_OPS (dw_i2c_plat_runtime_suspend, dw_i2c_plat_runtime_resume,NULL ) };
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 250/313 drm/drm_vma_manager: Add drm_vma_node_allow_once()
In reply to Greg Kroah-HartmanFrom: Nirmoy Das <[email protected]>
[ Upstream commit 899d3a3c19ac0e5da013ce34833dccb97d19b5e4 ]
Currently there is no easy way for a drm driver to safely check and allow drm_vma_offset_node for a drm file just once. Allow drm drivers to call non-refcounted version of drm_vma_node_allow() so that a driver doesn't need to keep track of each drm_vma_node_allow() to call subsequent drm_vma_node_revoke() to prevent memory leak.
--- drivers/gpu/drm/drm_vma_manager.c | 76 ++++++++++++++++++++++--------- include/drm/drm_vma_manager.h | 1 + 2 files changed, 55 insertions(+), 22 deletions(-)
drivers/gpu/drm/drm_vma_manager.c +54 -22
@@ -240,27 +240,8 @@ void drm_vma_offset_remove(struct drm_vma_offset_manager *mgr, }EXPORT_SYMBOL (drm_vma_offset_remove); -/** -* drm_vma_node_allow - Add open-file to list of allowed users -* @node: Node to modify -* @tag: Tag of file to remove -* -* Add @tag to the list of allowed open-files for this node. If @tag is -* already on this list, the ref-count is incremented. -* -* The list of allowed-users is preserved across drm_vma_offset_add() and -* drm_vma_offset_remove() calls. You may even call it if the node is currently -* not added to any offset-manager. -* -* You must remove all open-files the same number of times as you added them -* before destroying the node. Otherwise, you will leak memory. -* -* This is locked against concurrent access internally. -* -* RETURNS: -* 0 on success, negative error code on internal failure (out-of-mem) -*/ -int drm_vma_node_allow (struct drm_vma_offset_node *node,struct drm_file *tag) +static int vma_node_allow (struct drm_vma_offset_node *node, +struct drm_file *tag,bool ref_counted) {struct rb_node **iter;struct rb_node *parent =NULL ;
@@ -282,7 +263,8 @@ int drm_vma_node_allow(struct drm_vma_offset_node *node, struct drm_file *tag) entry = rb_entry(*iter, struct drm_vma_offset_file, vm_rb);if (tag == entry->vm_tag) { - entry->vm_count++; +if (ref_counted) + entry->vm_count++; goto unlock; }else if (tag > entry->vm_tag) { iter = &(*iter)->rb_right;
@@ -307,8 +289,58 @@ int drm_vma_node_allow(struct drm_vma_offset_node *node, struct drm_file *tag)kfree (new);return ret; } + +/** +* drm_vma_node_allow - Add open-file to list of allowed users +* @node: Node to modify +* @tag: Tag of file to remove +* +* Add @tag to the list of allowed open-files for this node. If @tag is +* already on this list, the ref-count is incremented. +* +* The list of allowed-users is preserved across drm_vma_offset_add() and +* drm_vma_offset_remove() calls. You may even call it if the node is currently +* not added to any offset-manager. +* +* You must remove all open-files the same number of times as you added them +* before destroying the node. Otherwise, you will leak memory. +* +* This is locked against concurrent access internally. +* +* RETURNS: +* 0 on success, negative error code on internal failure (out-of-mem) +*/ +int drm_vma_node_allow (struct drm_vma_offset_node *node,struct drm_file *tag) +{ +return vma_node_allow (node, tag, true); +}EXPORT_SYMBOL (drm_vma_node_allow); +/** +* drm_vma_node_allow_once - Add open-file to list of allowed users +* @node: Node to modify +* @tag: Tag of file to remove +* +* Add @tag to the list of allowed open-files for this node. +* +* The list of allowed-users is preserved across drm_vma_offset_add() and +* drm_vma_offset_remove() calls. You may even call it if the node is currently +* not added to any offset-manager. +* +* This is not ref-counted unlike drm_vma_node_allow() hence drm_vma_node_revoke() +* should only be called once after this. +* +* This is locked against concurrent access internally. +* +* RETURNS: +* 0 on success, negative error code on internal failure (out-of-mem) +*/ +int drm_vma_node_allow_once (struct drm_vma_offset_node *node,struct drm_file *tag) +{ +return vma_node_allow (node, tag, false); +} +EXPORT_SYMBOL (drm_vma_node_allow_once); +/** * drm_vma_node_revoke - Remove open-file from list of allowed users * @node: Node to modify
include/drm/drm_vma_manager.h +1 -0
@@ -74,6 +74,7 @@ void drm_vma_offset_remove(struct drm_vma_offset_manager *mgr, struct drm_vma_offset_node *node);int drm_vma_node_allow (struct drm_vma_offset_node *node,struct drm_file *tag); +int drm_vma_node_allow_once (struct drm_vma_offset_node *node,struct drm_file *tag);void drm_vma_node_revoke (struct drm_vma_offset_node *node,struct drm_file *tag); bool drm_vma_node_is_allowed(struct drm_vma_offset_node *node,
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 251/313 drm/i915: Fix a memory leak with reused mmap_offset
In reply to Greg Kroah-HartmanFrom: Nirmoy Das <[email protected]>
[ Upstream commit 0220e4fe178c3390eb0291cdb34912d66972db8a ]
drm_vma_node_allow() and drm_vma_node_revoke() should be called in balanced pairs. We call drm_vma_node_allow() once per-file everytime a user calls mmap_offset, but only call drm_vma_node_revoke once per-file on each mmap_offset. As the mmap_offset is reused by the client, the per-file vm_count may remain non-zero and the rbtree leaked.
Call drm_vma_node_allow_once() instead to prevent that memory leak.
--- drivers/gpu/drm/i915/gem/i915_gem_mman.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_mman.c +1 -1
@@ -697,7 +697,7 @@ mmap_offset_attach(struct drm_i915_gem_object *obj,GEM_BUG_ON (lookup_mmo (obj, mmap_type) != mmo); out:if (file) -drm_vma_node_allow (&mmo->vma_node, file); +drm_vma_node_allow_once (&mmo->vma_node, file);return mmo; err:
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 252/313 iavf: fix temporary deadlock and failure to set MAC address
In reply to Greg Kroah-HartmanFrom: Michal Schmidt <[email protected]>
[ Upstream commit 4411a608f7c8df000cb1a9f7881982dd8e10839a ]
We are seeing an issue where setting the MAC address on iavf fails with EAGAIN after the 2.5s timeout expires in iavf_set_mac().
There is the following deadlock scenario:
iavf_set_mac(), holding rtnl_lock, waits on:
iavf_watchdog_task (within iavf_wq) to send a message to the PF,
and
iavf_adminq_task (within iavf_wq) to receive a response from the PF.
In this adapter state (>=__IAVF_DOWN), these tasks do not need to take rtnl_lock, but iavf_wq is a global single-threaded workqueue, so they may get stuck waiting for another adapter's iavf_watchdog_task to run iavf_init_config_adapter(), which does take rtnl_lock.
The deadlock resolves itself by the timeout in iavf_set_mac(), which results in EAGAIN returned to userspace.
Let's break the deadlock loop by changing iavf_wq into a per-adapter workqueue, so that one adapter's tasks are not blocked by another's.
--- drivers/net/ethernet/intel/iavf/iavf.h | 2 +- .../net/ethernet/intel/iavf/iavf_ethtool.c | 10 +-- drivers/net/ethernet/intel/iavf/iavf_main.c | 86 +++++++++---------- .../net/ethernet/intel/iavf/iavf_virtchnl.c | 2 +- 4 files changed, 49 insertions(+), 51 deletions(-)
drivers/net/ethernet/intel/iavf/iavf.h +1 -1
@@ -249,6 +249,7 @@ struct iavf_cloud_filter {/* board specific private data structure */ struct iavf_adapter { +struct workqueue_struct *wq;struct work_struct reset_task;struct work_struct adminq_task;struct delayed_work client_task;
@@ -459,7 +460,6 @@ struct iavf_device {/* needed by iavf_ethtool.c */ extern char iavf_driver_name[]; -extern struct workqueue_struct *iavf_wq;static inline const char *iavf_state_str (enum iavf_state_t state) {
drivers/net/ethernet/intel/iavf/iavf_ethtool.c +5 -5
@@ -532,7 +532,7 @@ static int iavf_set_priv_flags(struct net_device *netdev, u32 flags)if (changed_flags &IAVF_FLAG_LEGACY_RX ) {if (netif_running (netdev)) { adapter->flags |=IAVF_FLAG_RESET_NEEDED ; -queue_work (iavf_wq, &adapter->reset_task); +queue_work (adapter->wq, &adapter->reset_task); } }
@@ -672,7 +672,7 @@ static int iavf_set_ringparam(struct net_device *netdev,if (netif_running (netdev)) { adapter->flags |=IAVF_FLAG_RESET_NEEDED ; -queue_work (iavf_wq, &adapter->reset_task); +queue_work (adapter->wq, &adapter->reset_task); }return 0 ;
@@ -1433,7 +1433,7 @@ static int iavf_add_fdir_ethtool(struct iavf_adapter *adapter, struct ethtool_rx adapter->aq_required |=IAVF_FLAG_AQ_ADD_FDIR_FILTER ;spin_unlock_bh (&adapter->fdir_fltr_lock); -mod_delayed_work (iavf_wq, &adapter->watchdog_task,0 ); +mod_delayed_work (adapter->wq, &adapter->watchdog_task,0 ); ret:if (err && fltr)
@@ -1474,7 +1474,7 @@ static int iavf_del_fdir_ethtool(struct iavf_adapter *adapter, struct ethtool_rxspin_unlock_bh (&adapter->fdir_fltr_lock);if (fltr && fltr->state ==IAVF_FDIR_FLTR_DEL_REQUEST ) -mod_delayed_work (iavf_wq, &adapter->watchdog_task,0 ); +mod_delayed_work (adapter->wq, &adapter->watchdog_task,0 );return err; }
@@ -1658,7 +1658,7 @@ iavf_set_adv_rss_hash_opt(struct iavf_adapter *adapter,spin_unlock_bh (&adapter->adv_rss_lock);if (!err) -mod_delayed_work (iavf_wq, &adapter->watchdog_task,0 ); +mod_delayed_work (adapter->wq, &adapter->watchdog_task,0 );mutex_unlock (&adapter->crit_lock);
drivers/net/ethernet/intel/iavf/iavf_main.c +42 -44
275 lines not on this page · raw message
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +1 -1
@@ -1952,7 +1952,7 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,if (!(adapter->flags &IAVF_FLAG_RESET_PENDING )) { adapter->flags |=IAVF_FLAG_RESET_PENDING ;dev_info (&adapter->pdev->dev,"Scheduling reset task\n" ); -queue_work (iavf_wq, &adapter->reset_task); +queue_work (adapter->wq, &adapter->reset_task); }break ;default :
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 253/313 iavf: schedule watchdog immediately when changing primary MAC
In reply to Greg Kroah-HartmanFrom: Stefan Assmann <[email protected]>
[ Upstream commit e2b53ea5a7c1fb484277ad12cd075f502cf03b04 ]
iavf_replace_primary_mac() utilizes queue_work() to schedule the watchdog task but that only ensures that the watchdog task is queued to run. To make sure the watchdog is executed asap use mod_delayed_work().
Without this patch it may take up to 2s until the watchdog task gets executed, which may cause long delays when setting the MAC address.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
@@ -1033,7 +1033,7 @@ int iavf_replace_primary_mac(struct iavf_adapter *adapter,/* schedule the watchdog task to immediately process the request */ if (f) { -queue_work (adapter->wq, &adapter->watchdog_task.work); +mod_delayed_work (adapter->wq, &adapter->watchdog_task,0 );return 0 ; }return -ENOMEM ;
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 254/313 netlink: prevent potential spectre v1 gadgets
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit f0950402e8c76e7dcb08563f1b4e8000fbc62455 ]
Most netlink attributes are parsed and validated from __nla_validate_parse() or validate_nla()
u16 type = nla_type(nla);
if (type == 0 || type > maxtype) {
/* error or continue */
}@type is then used as an array index and can be used as a Spectre v1 gadget.
array_index_nospec() can be used to prevent leaking content of kernel memory to malicious users.
This should take care of vast majority of netlink uses, but an audit is needed to take care of others where validation is not yet centralized in core netlink functions.
--- lib/nlattr.c | 3 +++ 1 file changed, 3 insertions(+)
lib/nlattr.c +3 -0
@@ -10,6 +10,7 @@#include <linux/kernel.h> #include <linux/errno.h> #include <linux/jiffies.h> +#include <linux/nospec.h> #include <linux/skbuff.h> #include <linux/string.h> #include <linux/types.h>
@@ -381,6 +382,7 @@ static int validate_nla(const struct nlattr *nla, int maxtype,if (type <=0 || type > maxtype)return 0 ; + type =array_index_nospec (type, maxtype +1 ); pt = &policy[type];BUG_ON (pt->type >NLA_TYPE_MAX );
@@ -596,6 +598,7 @@ static int __nla_validate_parse(const struct nlattr *head, int len, int maxtype, }continue ; } + type =array_index_nospec (type, maxtype +1 );if (policy) {int err =validate_nla (nla, maxtype, policy, validate, extack, depth);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 255/313 net: fix UaF in netns ops registration error path
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit 71ab9c3e2253619136c31c89dbb2c69305cc89b1 ]
If net_assign_generic() fails, the current error path in ops_init() tries to clear the gen pointer slot. Anyway, in such error path, the gen pointer itself has not been modified yet, and the existing and accessed one is smaller than the accessed index, causing an out-of-bounds error:
BUG: KASAN: slab-out-of-bounds in ops_init+0x2de/0x320
Write of size 8 at addr ffff888109124978 by task modprobe/1018
CPU: 2 PID: 1018 Comm: modprobe Not tainted 6.2.0-rc2.mptcp_ae5ac65fbed5+ #1641
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.1-2.fc37 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0x6a/0x9f
print_address_description.constprop.0+0x86/0x2b5
print_report+0x11b/0x1fb
kasan_report+0x87/0xc0
ops_init+0x2de/0x320
register_pernet_operations+0x2e4/0x750
register_pernet_subsys+0x24/0x40
tcf_register_action+0x9f/0x560
do_one_initcall+0xf9/0x570
do_init_module+0x190/0x650
load_module+0x1fa5/0x23c0
__do_sys_finit_module+0x10d/0x1b0
do_syscall_64+0x58/0x80
entry_SYSCALL_64_after_hwframe+0x72/0xdc
RIP: 0033:0x7f42518f778d
Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48
89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff
ff 73 01 c3 48 8b 0d cb 56 2c 00 f7 d8 64 89 01 48
RSP: 002b:00007fff96869688 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
RAX: ffffffffffffffda RBX: 00005568ef7f7c90 RCX: 00007f42518f778d
RDX: 0000000000000000 RSI: 00005568ef41d796 RDI: 0000000000000003
RBP: 00005568ef41d796 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000
R13: 00005568ef7f7d30 R14: 0000000000040000 R15: 0000000000000000
</TASK>This change addresses the issue by skipping the gen pointer de-reference in the mentioned error-path.
Found by code inspection and verified with explicit error injection on a kasan-enabled kernel.
--- net/core/net_namespace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/net_namespace.c +1 -1
@@ -137,12 +137,12 @@ static int ops_init(const struct pernet_operations *ops, struct net *net)return 0 ;if (ops->id && ops->size) { -cleanup: ng =rcu_dereference_protected (net->gen,lockdep_is_held (&pernet_ops_rwsem)); ng->ptr[*ops->id] =NULL ; } +cleanup:kfree (data); out:
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 256/313 net: fec: Use page_pool_put_full_page when freeing rx buffers
In reply to Greg Kroah-HartmanFrom: Wei Fang <[email protected]>
[ Upstream commit e38553bdc377e3e7a6caa9dd9770d8b644d8dac3 ]
The page_pool_release_page was used when freeing rx buffers, and this function just unmaps the page (if mapped) and does not recycle the page. So after hundreds of down/up the eth0, the system will out of memory. For more details, please refer to the following reproduce steps and bug logs. To solve this issue and refer to the doc of page pool, the page_pool_put_full_page should be used to replace page_pool_release_page. Because this API will try to recycle the page if the page refcnt equal to
1. After testing 20000 times, the issue can not be reproduced anymore (about testing 391 times the issue will occur on i.MX8MN-EVK before).
Reproduce steps:
Create the test script and run the script. The script content is as follows:
LOOPS=20000
i=1
while [ $i -le $LOOPS ]
do
echo "TINFO:ENET $curface up and down test $i times" org_macaddr=$(cat /sys/class/net/eth0/address) ifconfig eth0 down
ifconfig eth0 hw ether $org_macaddr up
i=$(expr $i + 1)
done
sleep 5
if cat /sys/class/net/eth0/operstate | grep 'up';then
echo "TEST PASS"
else
echo "TEST FAIL"
fi
Bug detail logs:
TINFO:ENET up and down test 391 times
[ 850.471205] Qualcomm Atheros AR8031/AR8033 30be0000.ethernet-1:00: attached PHY driver (mii_bus:phy_addr=30be0000.ethernet-1:00, irq=POLL) [ 853.535318] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready [ 853.541694] fec 30be0000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx [ 870.590531] page_pool_release_retry() stalled pool shutdown 199 inflight 60 sec [ 931.006557] page_pool_release_retry() stalled pool shutdown 199 inflight 120 sec TINFO:ENET up and down test 392 times [ 991.426544] page_pool_release_retry() stalled pool shutdown 192 inflight 181 sec [ 1051.838531] page_pool_release_retry() stalled pool shutdown 170 inflight 241 sec [ 1093.751217] Qualcomm Atheros AR8031/AR8033 30be0000.ethernet-1:00: attached PHY driver (mii_bus:phy_addr=30be0000.ethernet-1:00, irq=POLL) [ 1096.446520] page_pool_release_retry() stalled pool shutdown 308 inflight 60 sec [ 1096.831245] fec 30be0000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx [ 1096.839092] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready [ 1112.254526] page_pool_release_retry() stalled pool shutdown 103 inflight 302 sec [ 1156.862533] page_pool_release_retry() stalled pool shutdown 308 inflight 120 sec [ 1172.674516] page_pool_release_retry() stalled pool shutdown 103 inflight 362 sec [ 1217.278532] page_pool_release_retry() stalled pool shutdown 308 inflight 181 sec TINFO:ENET up and down test 393 times [ 1233.086535] page_pool_release_retry() stalled pool shutdown 103 inflight 422 sec [ 1277.698513] page_pool_release_retry() stalled pool shutdown 308 inflight 241 sec [ 1293.502525] page_pool_release_retry() stalled pool shutdown 86 inflight 483 sec [ 1338.110518] page_pool_release_retry() stalled pool shutdown 308 inflight 302 sec [ 1353.918540] page_pool_release_retry() stalled pool shutdown 32 inflight 543 sec [ 1361.179205] Qualcomm Atheros AR8031/AR8033 30be0000.ethernet-1:00: attached PHY driver (mii_bus:phy_addr=30be0000.ethernet-1:00, irq=POLL) [ 1364.255298] fec 30be0000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx [ 1364.263189] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready [ 1371.998532] page_pool_release_retry() stalled pool shutdown 310 inflight 60 sec [ 1398.530542] page_pool_release_retry() stalled pool shutdown 308 inflight 362 sec [ 1414.334539] page_pool_release_retry() stalled pool shutdown 16 inflight 604 sec [ 1432.414520] page_pool_release_retry() stalled pool shutdown 310 inflight 120 sec [ 1458.942523] page_pool_release_retry() stalled pool shutdown 308 inflight 422 sec [ 1474.750521] page_pool_release_retry() stalled pool shutdown 16 inflight 664 sec TINFO:ENET up and down test 394 times [ 1492.830522] page_pool_release_retry() stalled pool shutdown 310 inflight 181 sec [ 1519.358519] page_pool_release_retry() stalled pool shutdown 308 inflight 483 sec [ 1535.166545] page_pool_release_retry() stalled pool shutdown 2 inflight 724 sec [ 1537.090278] eth_test2.sh invoked oom-killer: gfp_mask=0x400dc0(GFP_KERNEL_ACCOUNT|__GFP_ZERO), order=0, oom_score_adj=0 [ 1537.101192] CPU: 3 PID: 2379 Comm: eth_test2.sh Tainted: G C 6.1.1+g56321e101aca #1 [ 1537.110249] Hardware name: NXP i.MX8MNano EVK board (DT) [ 1537.115561] Call trace: [ 1537.118005] dump_backtrace.part.0+0xe0/0xf0 [ 1537.122289] show_stack+0x18/0x40 [ 1537.125608] dump_stack_lvl+0x64/0x80 [ 1537.129276] dump_stack+0x18/0x34 [ 1537.132592] dump_header+0x44/0x208 [ 1537.136083] oom_kill_process+0x2b4/0x2c0 [ 1537.140097] out_of_memory+0xe4/0x594 [ 1537.143766] __alloc_pages+0xb68/0xd00 [ 1537.147521] alloc_pages+0xac/0x160 [ 1537.151013] __get_free_pages+0x14/0x40 [ 1537.154851] pgd_alloc+0x1c/0x30 [ 1537.158082] mm_init+0xf8/0x1d0 [ 1537.161228] mm_alloc+0x48/0x60 [ 1537.164368] alloc_bprm+0x7c/0x240 [ 1537.167777] do_execveat_common.isra.0+0x70/0x240 [ 1537.172486] __arm64_sys_execve+0x40/0x54 [ 1537.176502] invoke_syscall+0x48/0x114 [ 1537.180255] el0_svc_common.constprop.0+0xcc/0xec [ 1537.184964] do_el0_svc+0x2c/0xd0 [ 1537.188280] el0_svc+0x2c/0x84 [ 1537.191340] el0t_64_sync_handler+0xf4/0x120 [ 1537.195613] el0t_64_sync+0x18c/0x190 [ 1537.199334] Mem-Info: [ 1537.201620] active_anon:342 inactive_anon:10343 isolated_anon:0 [ 1537.201620] active_file:54 inactive_file:112 isolated_file:0 [ 1537.201620] unevictable:0 dirty:0 writeback:0 [ 1537.201620] slab_reclaimable:2620 slab_unreclaimable:7076 [ 1537.201620] mapped:1489 shmem:2473 pagetables:466 [ 1537.201620] sec_pagetables:0 bounce:0 [ 1537.201620] kernel_misc_reclaimable:0 [ 1537.201620] free:136672 free_pcp:96 free_cma:129241 [ 1537.240419] Node 0 active_anon:1368kB inactive_anon:41372kB active_file:216kB inactive_file:5052kB unevictable:0kB isolated(anon):0kB isolated(file):0kB s [ 1537.271422] Node 0 DMA free:541636kB boost:0kB min:30000kB low:37500kB high:45000kB reserved_highatomic:0KB active_anon:1368kB inactive_anon:41372kB actiB [ 1537.300219] lowmem_reserve[]: 0 0 0 0 [ 1537.303929] Node 0 DMA: 1015*4kB (UMEC) 743*8kB (UMEC) 417*16kB (UMEC) 235*32kB (UMEC) 116*64kB (UMEC) 25*128kB (UMEC) 4*256kB (UC) 2*512kB (UC) 0*1024kBB [ 1537.323938] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB [ 1537.332708] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=32768kB [ 1537.341292] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB [ 1537.349776] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=64kB [ 1537.358087] 2939 total pagecache pages [ 1537.361876] 0 pages in swap cache [ 1537.365229] Free swap = 0kB [ 1537.368147] Total swap = 0kB [ 1537.371065] 516096 pages RAM [ 1537.373959] 0 pages HighMem/MovableOnly [ 1537.377834] 17302 pages reserved [ 1537.381103] 163840 pages cma reserved [ 1537.384809] 0 pages hwpoisoned [ 1537.387902] Tasks state (memory values in pages): [ 1537.392652] [ pid ] uid tgid total_vm rss pgtables_bytes swapents oom_score_adj name [ 1537.401356] [ 201] 993 201 1130 72 45056 0 0 rpcbind [ 1537.409772] [ 202] 0 202 4529 1640 77824 0 -250 systemd-journal [ 1537.418861] [ 222] 0 222 4691 801 69632 0 -1000 systemd-udevd [ 1537.427787] [ 248] 994 248 20914 130 65536 0 0 systemd-timesyn [ 1537.436884] [ 497] 0 497 620 31 49152 0 0 atd [ 1537.444938] [ 500] 0 500 854 77 53248 0 0 crond [ 1537.453165] [ 503] 997 503 1470 160 49152 0 -900 dbus-daemon [ 1537.461908] [ 505] 0 505 633 24 40960 0 0 firmwared [ 1537.470491] [ 513] 0 513 2507 180 61440 0 0 ofonod [ 1537.478800] [ 514] 990 514 69640 137 81920 0 0 parsec [ 1537.487120] [ 533] 0 533 599 39 40960 0 0 syslogd [ 1537.495518] [ 534] 0 534 4546 148 65536 0 0 systemd-logind [ 1537.504560] [ 535] 0 535 690 24 45056 0 0 tee-supplicant [ 1537.513564] [ 540] 996 540 2769 168 61440 0 0 systemd-network [ 1537.522680] [ 566] 0 566 3878 228 77824 0 0 connmand [ 1537.531168] [ 645] 998 645 1538 133 57344 0 0 avahi-daemon [ 1537.540004] [ 646] 998 646 1461 64 57344 0 0 avahi-daemon [ 1537.548846] [ 648] 992 648 781 41 45056 0 0 rpc.statd [ 1537.557415] [ 650] 64371 650 590 23 45056 0 0 ninfod [ 1537.565754] [ 653] 61563 653 555 24 45056 0 0 rdisc [ 1537.573971] [ 655] 0 655 374569 2999 290816 0 -999 containerd [ 1537.582621] [ 658] 0 658 1311 20 49152 0 0 agetty [ 1537.590922] [ 663] 0 663 1529 97 49152 0 0 login [ 1537.599138] [ 666] 0 666 3430 202 69632 0 0 wpa_supplicant [ 1537.608147] [ 667] 0 667 2344 96 61440 0 0 systemd-userdbd [ 1537.617240] [ 677] 0 677 2964 314 65536 0 100 systemd [ 1537.625651] [ 679] 0 679 3720 646 73728 0 100 (sd-pam) [ 1537.634138] [ 687] 0 687 1289 403 45056 0 0 sh [ 1537.642108] [ 789] 0 789 970 93 45056 0 0 eth_test2.sh [ 1537.650955] [ 2355] 0 2355 2346 94 61440 0 0 systemd-userwor [ 1537.660046] [ 2356] 0 2356 2346 94 61440 0 0 systemd-userwor [ 1537.669137] [ 2358] 0 2358 2346 95 57344 0 0 systemd-userwor [ 1537.678258] [ 2379] 0 2379 970 93 45056 0 0 eth_test2.sh [ 1537.687098] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-0.slice/[email protected],tas0 [ 1537.703009] Out of memory: Killed process 679 ((sd-pam)) total-vm:14880kB, anon-rss:2584kB, file-rss:0kB, shmem-rss:0kB, UID:0 pgtables:72kB oom_score_ad0 [ 1553.246526] page_pool_release_retry() stalled pool shutdown 310 inflight 241 sec
--- drivers/net/ethernet/freescale/fec_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/fec_main.c +1 -1
@@ -3089,7 +3089,7 @@ static void fec_enet_free_buffers(struct net_device *ndev)for (q =0 ; q < fep->num_rx_queues; q++) { rxq = fep->rx_queue[q];for (i =0 ; i < rxq->bd.ring_size; i++) -page_pool_release_page (rxq->page_pool, rxq->rx_skb_info[i].page); +page_pool_put_full_page (rxq->page_pool, rxq->rx_skb_info[i].page, false);if (xdp_rxq_info_is_reg (&rxq->xdp_rxq))xdp_rxq_info_unreg (&rxq->xdp_rxq);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 257/313 nvme: simplify transport specific device attribute handling
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 86adbf0cdb9ec6533234696c3e243184d4d0d040 ]
Allow the transport driver to override the attribute groups for the control device, so that the PCIe driver doesn't manually have to add a group after device creation and keep track of it.
Tested-by Gerd Bayer <[email protected]>
Stable-dep-of: 98e3528012cd ("nvme-fc: fix initialization order")
--- drivers/nvme/host/core.c | 8 ++++++-- drivers/nvme/host/nvme.h | 2 ++ drivers/nvme/host/pci.c | 23 ++++++++--------------- 3 files changed, 16 insertions(+), 17 deletions(-)
drivers/nvme/host/core.c +6 -2
@@ -3903,10 +3903,11 @@ static umode_t nvme_dev_attrs_are_visible(struct kobject *kobj,return a->mode; } -static const struct attribute_group nvme_dev_attrs_group = { +const struct attribute_group nvme_dev_attrs_group = { .attrs = nvme_dev_attrs, .is_visible = nvme_dev_attrs_are_visible, }; +EXPORT_SYMBOL_GPL (nvme_dev_attrs_group);static const struct attribute_group *nvme_dev_attr_groups[] = { &nvme_dev_attrs_group,
@@ -5080,7 +5081,10 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev, ctrl->instance); ctrl->device->class = nvme_class; ctrl->device->parent = ctrl->dev; - ctrl->device->groups = nvme_dev_attr_groups; +if (ops->dev_attr_groups) + ctrl->device->groups = ops->dev_attr_groups; +else + ctrl->device->groups = nvme_dev_attr_groups; ctrl->device->release = nvme_free_ctrl;dev_set_drvdata (ctrl->device, ctrl); ret =dev_set_name (ctrl->device,"nvme%d" , ctrl->instance);
drivers/nvme/host/nvme.h +2 -0
@@ -508,6 +508,7 @@ struct nvme_ctrl_ops {unsigned int flags;#define NVME_F_FABRICS (1 << 0)#define NVME_F_METADATA_SUPPORTED (1 << 1) +const struct attribute_group **dev_attr_groups;int (*reg_read32)(struct nvme_ctrl *ctrl,u32 off,u32 *val);int (*reg_write32)(struct nvme_ctrl *ctrl,u32 off,u32 val);int (*reg_read64)(struct nvme_ctrl *ctrl,u32 off,u64 *val);
@@ -857,6 +858,7 @@ int nvme_dev_uring_cmd(struct io_uring_cmd *ioucmd, unsigned int issue_flags);extern const struct attribute_group *nvme_ns_id_attr_groups[];extern const struct pr_ops nvme_pr_ops;extern const struct block_device_operations nvme_ns_head_ops; +extern const struct attribute_group nvme_dev_attrs_group;struct nvme_ns *nvme_find_path (struct nvme_ns_head *head);#ifdef CONFIG_NVME_MULTIPATH
drivers/nvme/host/pci.c +8 -15
@@ -158,8 +158,6 @@ struct nvme_dev {unsigned int nr_allocated_queues;unsigned int nr_write_queues;unsigned int nr_poll_queues; - -bool attrs_added; };static int io_queue_depth_set (const char *val,const struct kernel_param *kp)
@@ -2241,11 +2239,17 @@ static struct attribute *nvme_pci_attrs[] = { NULL, }; -static const struct attribute_group nvme_pci_attr_group = { +static const struct attribute_group nvme_pci_dev_attrs_group = { .attrs = nvme_pci_attrs, .is_visible = nvme_pci_attrs_are_visible, }; +static const struct attribute_group *nvme_pci_dev_attr_groups[] = { + &nvme_dev_attrs_group, + &nvme_pci_dev_attrs_group, +NULL , +}; +/* * nirqs is the number of interrupts available for write and read * queues. The core already reserved an interrupt for the admin queue.
@@ -2935,10 +2939,6 @@ static void nvme_reset_work(struct work_struct *work) goto out; } -if (!dev->attrs_added && !sysfs_create_group (&dev->ctrl.device->kobj, - &nvme_pci_attr_group)) - dev->attrs_added = true; -nvme_start_ctrl (&dev->ctrl);return ;
@@ -3011,6 +3011,7 @@ static const struct nvme_ctrl_ops nvme_pci_ctrl_ops = { .name = "pcie", .module = THIS_MODULE, .flags = NVME_F_METADATA_SUPPORTED, + .dev_attr_groups = nvme_pci_dev_attr_groups, .reg_read32 = nvme_pci_reg_read32, .reg_write32 = nvme_pci_reg_write32, .reg_read64 = nvme_pci_reg_read64,
@@ -3209,13 +3210,6 @@ static void nvme_shutdown(struct pci_dev *pdev)nvme_disable_prepare_reset (dev, true); } -static void nvme_remove_attrs (struct nvme_dev *dev) -{ -if (dev->attrs_added) -sysfs_remove_group (&dev->ctrl.device->kobj, - &nvme_pci_attr_group); -} -/* * The driver's remove may be called on a device in a partially initialized * state. This function must not have any dependencies on the device state in
@@ -3237,7 +3231,6 @@ static void nvme_remove(struct pci_dev *pdev)nvme_stop_ctrl (&dev->ctrl);nvme_remove_namespaces (&dev->ctrl);nvme_dev_disable (dev, true); -nvme_remove_attrs (dev);nvme_free_host_mem (dev);nvme_dev_remove_admin (dev);nvme_free_queues (dev,0 );
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 258/313 nvme: consolidate setting the tagset flags
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit db45e1a5ddccc034eb60d62fc5352022d7963ae2 ]
All nvme transports should be using the same flags for their tagsets, with the exception for the blocking flag that should only be set for transports that can block in ->queue_rq.
Add a NVME_F_BLOCKING flag to nvme_ctrl_ops to control the blocking behavior and lift setting the flags into nvme_alloc_{admin,io}_tag_set.
Stable-dep-of: 98e3528012cd ("nvme-fc: fix initialization order")
--- drivers/nvme/host/core.c | 15 +++++++++------ drivers/nvme/host/fc.c | 4 ++-- drivers/nvme/host/nvme.h | 9 +++++---- drivers/nvme/host/rdma.c | 3 +-- drivers/nvme/host/tcp.c | 5 ++--- drivers/nvme/target/loop.c | 4 ++-- 6 files changed, 21 insertions(+), 19 deletions(-)
drivers/nvme/host/core.c +9 -6
@@ -4840,8 +4840,7 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,EXPORT_SYMBOL_GPL (nvme_complete_async_event);int nvme_alloc_admin_tag_set (struct nvme_ctrl *ctrl,struct blk_mq_tag_set *set, -const struct blk_mq_ops *ops,unsigned int flags, -unsigned int cmd_size) +const struct blk_mq_ops *ops,unsigned int cmd_size) {int ret;
@@ -4851,7 +4850,9 @@ int nvme_alloc_admin_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,if (ctrl->ops->flags &NVME_F_FABRICS ) set->reserved_tags =NVMF_RESERVED_TAGS ; set->numa_node = ctrl->numa_node; - set->flags = flags; + set->flags =BLK_MQ_F_NO_SCHED ; +if (ctrl->ops->flags &NVME_F_BLOCKING ) + set->flags |=BLK_MQ_F_BLOCKING ; set->cmd_size = cmd_size; set->driver_data = ctrl; set->nr_hw_queues =1 ;
@@ -4895,8 +4896,8 @@ void nvme_remove_admin_tag_set(struct nvme_ctrl *ctrl)EXPORT_SYMBOL_GPL (nvme_remove_admin_tag_set);int nvme_alloc_io_tag_set (struct nvme_ctrl *ctrl,struct blk_mq_tag_set *set, -const struct blk_mq_ops *ops,unsigned int flags, -unsigned int nr_maps,unsigned int cmd_size) +const struct blk_mq_ops *ops,unsigned int nr_maps, +unsigned int cmd_size) {int ret;
@@ -4905,7 +4906,9 @@ int nvme_alloc_io_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set, set->queue_depth = ctrl->sqsize +1 ; set->reserved_tags =NVMF_RESERVED_TAGS ; set->numa_node = ctrl->numa_node; - set->flags = flags; + set->flags =BLK_MQ_F_SHOULD_MERGE ; +if (ctrl->ops->flags &NVME_F_BLOCKING ) + set->flags |=BLK_MQ_F_BLOCKING ; set->cmd_size = cmd_size, set->driver_data = ctrl; set->nr_hw_queues = ctrl->queue_count -1 ;
drivers/nvme/host/fc.c +2 -2
@@ -2903,7 +2903,7 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl)nvme_fc_init_io_queues (ctrl); ret =nvme_alloc_io_tag_set (&ctrl->ctrl, &ctrl->tag_set, - &nvme_fc_mq_ops,BLK_MQ_F_SHOULD_MERGE ,1 , + &nvme_fc_mq_ops,1 ,struct_size ((struct nvme_fcp_op_w_sgl *)NULL , priv, ctrl->lport->ops->fcprqst_priv_sz));if (ret)
@@ -3509,7 +3509,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,nvme_fc_init_queue (ctrl,0 ); ret =nvme_alloc_admin_tag_set (&ctrl->ctrl, &ctrl->admin_tag_set, - &nvme_fc_admin_mq_ops,BLK_MQ_F_NO_SCHED , + &nvme_fc_admin_mq_ops,struct_size ((struct nvme_fcp_op_w_sgl *)NULL , priv, ctrl->lport->ops->fcprqst_priv_sz));if (ret)
drivers/nvme/host/nvme.h +5 -4
@@ -508,6 +508,8 @@ struct nvme_ctrl_ops {unsigned int flags;#define NVME_F_FABRICS (1 << 0)#define NVME_F_METADATA_SUPPORTED (1 << 1) +#define NVME_F_BLOCKING (1 << 2) +const struct attribute_group **dev_attr_groups;int (*reg_read32)(struct nvme_ctrl *ctrl,u32 off,u32 *val);int (*reg_write32)(struct nvme_ctrl *ctrl,u32 off,u32 val);
@@ -739,12 +741,11 @@ void nvme_start_ctrl(struct nvme_ctrl *ctrl);void nvme_stop_ctrl (struct nvme_ctrl *ctrl);int nvme_init_ctrl_finish (struct nvme_ctrl *ctrl);int nvme_alloc_admin_tag_set (struct nvme_ctrl *ctrl,struct blk_mq_tag_set *set, -const struct blk_mq_ops *ops,unsigned int flags, -unsigned int cmd_size); +const struct blk_mq_ops *ops,unsigned int cmd_size);void nvme_remove_admin_tag_set (struct nvme_ctrl *ctrl);int nvme_alloc_io_tag_set (struct nvme_ctrl *ctrl,struct blk_mq_tag_set *set, -const struct blk_mq_ops *ops,unsigned int flags, -unsigned int nr_maps,unsigned int cmd_size); +const struct blk_mq_ops *ops,unsigned int nr_maps, +unsigned int cmd_size);void nvme_remove_io_tag_set (struct nvme_ctrl *ctrl);void nvme_remove_namespaces (struct nvme_ctrl *ctrl);
drivers/nvme/host/rdma.c +1 -2
@@ -798,7 +798,7 @@ static int nvme_rdma_alloc_tag_set(struct nvme_ctrl *ctrl)NVME_RDMA_METADATA_SGL_SIZE ;return nvme_alloc_io_tag_set (ctrl, &to_rdma_ctrl (ctrl)->tag_set, - &nvme_rdma_mq_ops,BLK_MQ_F_SHOULD_MERGE , + &nvme_rdma_mq_ops, ctrl->opts->nr_poll_queues ?HCTX_MAX_TYPES :2 , cmd_size); }
@@ -848,7 +848,6 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl,if (new) { error =nvme_alloc_admin_tag_set (&ctrl->ctrl, &ctrl->admin_tag_set, &nvme_rdma_admin_mq_ops, -BLK_MQ_F_NO_SCHED ,sizeof (struct nvme_rdma_request ) +NVME_RDMA_DATA_SGL_SIZE );if (error)
drivers/nvme/host/tcp.c +2 -3
@@ -1867,7 +1867,6 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new)if (new) { ret =nvme_alloc_io_tag_set (ctrl, &to_tcp_ctrl (ctrl)->tag_set, &nvme_tcp_mq_ops, -BLK_MQ_F_SHOULD_MERGE |BLK_MQ_F_BLOCKING , ctrl->opts->nr_poll_queues ?HCTX_MAX_TYPES :2 ,sizeof (struct nvme_tcp_request ));if (ret)
@@ -1943,7 +1942,7 @@ static int nvme_tcp_configure_admin_queue(struct nvme_ctrl *ctrl, bool new)if (new) { error =nvme_alloc_admin_tag_set (ctrl, &to_tcp_ctrl (ctrl)->admin_tag_set, - &nvme_tcp_admin_mq_ops,BLK_MQ_F_BLOCKING , + &nvme_tcp_admin_mq_ops,sizeof (struct nvme_tcp_request ));if (error) goto out_free_queue;
@@ -2524,7 +2523,7 @@ static const struct blk_mq_ops nvme_tcp_admin_mq_ops = {static const struct nvme_ctrl_ops nvme_tcp_ctrl_ops = { .name ="tcp" , .module =THIS_MODULE , - .flags =NVME_F_FABRICS , + .flags =NVME_F_FABRICS |NVME_F_BLOCKING , .reg_read32 = nvmf_reg_read32, .reg_read64 = nvmf_reg_read64, .reg_write32 = nvmf_reg_write32,
drivers/nvme/target/loop.c +2 -2
@@ -353,7 +353,7 @@ static int nvme_loop_configure_admin_queue(struct nvme_loop_ctrl *ctrl) ctrl->ctrl.queue_count =1 ; error =nvme_alloc_admin_tag_set (&ctrl->ctrl, &ctrl->admin_tag_set, - &nvme_loop_admin_mq_ops,BLK_MQ_F_NO_SCHED , + &nvme_loop_admin_mq_ops,sizeof (struct nvme_loop_iod ) +NVME_INLINE_SG_CNT *sizeof (struct scatterlist ));if (error)
@@ -494,7 +494,7 @@ static int nvme_loop_create_io_queues(struct nvme_loop_ctrl *ctrl)return ret; ret =nvme_alloc_io_tag_set (&ctrl->ctrl, &ctrl->tag_set, - &nvme_loop_mq_ops,BLK_MQ_F_SHOULD_MERGE ,1 , + &nvme_loop_mq_ops,1 ,sizeof (struct nvme_loop_iod ) +NVME_INLINE_SG_CNT *sizeof (struct scatterlist ));if (ret)
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 259/313 nvme-fc: fix initialization order
In reply to Greg Kroah-HartmanFrom: Ross Lagerwall <[email protected]>
[ Upstream commit 98e3528012cd571c48bbae7c7c0f868823254b6c ]
ctrl->ops is used by nvme_alloc_admin_tag_set() but set by nvme_init_ctrl() so reorder the calls to avoid a NULL pointer dereference.
--- drivers/nvme/host/fc.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/nvme/host/fc.c +8 -10
@@ -3508,13 +3508,6 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,nvme_fc_init_queue (ctrl,0 ); - ret =nvme_alloc_admin_tag_set (&ctrl->ctrl, &ctrl->admin_tag_set, - &nvme_fc_admin_mq_ops, -struct_size ((struct nvme_fcp_op_w_sgl *)NULL , priv, - ctrl->lport->ops->fcprqst_priv_sz)); -if (ret) - goto out_free_queues; -/* * Would have been nice to init io queues tag set as well. * However, we require interaction from the controller
@@ -3524,10 +3517,17 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, ret =nvme_init_ctrl (&ctrl->ctrl, dev, &nvme_fc_ctrl_ops,0 );if (ret) - goto out_cleanup_tagset; + goto out_free_queues;/* at this point, teardown path changes to ref counting on nvme ctrl */ + ret =nvme_alloc_admin_tag_set (&ctrl->ctrl, &ctrl->admin_tag_set, + &nvme_fc_admin_mq_ops, +struct_size ((struct nvme_fcp_op_w_sgl *)NULL , priv, + ctrl->lport->ops->fcprqst_priv_sz)); +if (ret) + goto fail_ctrl; +spin_lock_irqsave (&rport->lock, flags);list_add_tail (&ctrl->ctrl_list, &rport->ctrl_list);spin_unlock_irqrestore (&rport->lock, flags);
@@ -3579,8 +3579,6 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,return ERR_PTR (-EIO ); -out_cleanup_tagset: -nvme_remove_admin_tag_set (&ctrl->ctrl); out_free_queues:kfree (ctrl->queues); out_free_ida:
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 260/313 drm/i915/selftest: fix intel_selftest_modify_policy argument types
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 2255bbcdc39d5b0311968f86614ae4f25fdd465d ]
The definition of intel_selftest_modify_policy() does not match the declaration, as gcc-13 points out:
drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c:29:5: error: conflicting types for 'intel_selftest_modify_policy' due to enum/integer mismatch; have 'int(struct intel_engine_cs *, struct intel_selftest_saved_policy *, u32)' {aka 'int(struct intel_engine_cs *, struct intel_selftest_saved_policy *, unsigned int)'} [-Werror=enum-int-mismatch]
29 | int intel_selftest_modify_policy(struct intel_engine_cs *engine,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c:11:
drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.h:28:5: note: previous declaration of 'intel_selftest_modify_policy' with type 'int(struct intel_engine_cs *, struct intel_selftest_saved_policy *, enum selftest_scheduler_modify)'
28 | int intel_selftest_modify_policy(struct intel_engine_cs *engine,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~Change the type in the definition to match.
--- drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c +1 -2
@@ -28,8 +28,7 @@ struct intel_engine_cs *intel_selftest_find_any_engine(struct intel_gt *gt)int intel_selftest_modify_policy (struct intel_engine_cs *engine,struct intel_selftest_saved_policy *saved, -u32 modify_type) - +enum selftest_scheduler_modify modify_type) {int err;
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 261/313 ACPI: video: Add backlight=native DMI quirk for HP Pavilion g6-1d80nr
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit d77596d432cc4142520af32b5388d512e52e0edb ]
The HP Pavilion g6-1d80nr predates Windows 8, so it defaults to using acpi_video# for backlight control, but this is non functional on this model.
Add a DMI quirk to use the native backlight interface which does work properly.
Stable-dep-of: 9dcb34234b82 ("ACPI: video: Add backlight=native DMI quirk for HP EliteBook 8460p")
--- drivers/acpi/video_detect.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/acpi/video_detect.c +9 -0
@@ -608,6 +608,15 @@ static const struct dmi_system_id video_detect_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "UX303UB"), }, }, + { + .callback = video_detect_force_native, +/* HP Pavilion g6-1d80nr / B4U19UA */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Hewlett-Packard" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"HP Pavilion g6 Notebook PC" ), + DMI_MATCH(DMI_PRODUCT_SKU, "B4U19UA"), + }, + }, { .callback = video_detect_force_native,/* Samsung N150P */
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 262/313 ACPI: video: Add backlight=native DMI quirk for HP EliteBook 8460p
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 9dcb34234b8235144c96103266317da33321077e ]
The HP EliteBook 8460p predates Windows 8, so it defaults to using acpi_video# for backlight control.
Starting with the 6.1.y kernels the native radeon_bl0 backlight is hidden in this case instead of relying on userspace preferring acpi_video# over native backlight devices.
It turns out that for the acpi_video# interface to work on the HP EliteBook 8460p, the brightness needs to be set at least once through the native interface, which now no longer is done breaking backlight control.
The native interface however always works without problems, so add a quirk to use native backlight on the EliteBook 8460p to fix this.
--- drivers/acpi/video_detect.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/acpi/video_detect.c +8 -0
@@ -608,6 +608,14 @@ static const struct dmi_system_id video_detect_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "UX303UB"), }, }, + { + .callback = video_detect_force_native, +/* HP EliteBook 8460p */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Hewlett-Packard" ), + DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 8460p"), + }, + }, { .callback = video_detect_force_native,/* HP Pavilion g6-1d80nr / B4U19UA */
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 263/313 ACPI: video: Add backlight=native DMI quirk for Asus U46E
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit e6b3086fddc0065a5ffb947d4d29dd0e6efc327b ]
The Asus U46E backlight tables have a set of interesting problems:
1. Its ACPI tables do make _OSI ("Windows 2012") checks, so acpi_osi_is_win8() should return true.
But the tables have 2 sets of _OSI calls, one from the usual global _INI method setting a global OSYS variable and a second set of _OSI calls from a MSOS method and the MSOS method is the only one calling _OSI ("Windows 2012").
The MSOS method only gets called in the following cases:
1. From some Asus specific WMI methods
2. From _DOD, which only runs after acpi_video_get_backlight_type() has already been called by the i915 driver
3. From other ACPI video bus methods which never run (see below)
4. From some EC query callbacks
So when i915 calls acpi_video_get_backlight_type() MSOS has never run and acpi_osi_is_win8() returns false, so acpi_video_get_backlight_type() returns acpi_video as the desired backlight type, which causes the intel_backlight device to not register.
2. _DOD effectively does this:
Return (Package (0x01)
{
0x0400
}) causing acpi_video_device_in_dod() to return false, which causes the acpi_video backlight device to not register.
Leaving the user with no backlight device at all. Note that before 6.1.y the i915 driver would register the intel_backlight device unconditionally and since that then was the only backlight device userspace would use that.
Add a backlight=native DMI quirk for this special laptop to restore the old (and working) behavior of the intel_backlight device registering.
--- drivers/acpi/video_detect.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/acpi/video_detect.c +8 -0
@@ -600,6 +600,14 @@ static const struct dmi_system_id video_detect_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "GA503"), }, }, + { + .callback = video_detect_force_native, +/* Asus U46E */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"ASUSTeK Computer Inc." ), + DMI_MATCH(DMI_PRODUCT_NAME, "U46E"), + }, + }, { .callback = video_detect_force_native,/* Asus UX303UB */
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 264/313 netfilter: nft_set_rbtree: Switch to node list walk for overlap detection
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit c9e6978e2725a7d4b6cd23b2facd3f11422c0643 ]
...instead of a tree descent, which became overly complicated in an attempt to cover cases where expired or inactive elements would affect comparisons with the new element being inserted.
Further, it turned out that it's probably impossible to cover all those cases, as inactive nodes might entirely hide subtrees consisting of a complete interval plus a node that makes the current insertion not overlap.
To speed up the overlap check, descent the tree to find a greater element that is closer to the key value to insert. Then walk down the node list for overlap detection. Starting the overlap check from rb_first() unconditionally is slow, it takes 10 times longer due to the full linear traversal of the list.
Moreover, perform garbage collection of expired elements when walking down the node list to avoid bogus overlap reports.
For the insertion operation itself, this essentially reverts back to the implementation before commit 7c84d41416d8 ("netfilter: nft_set_rbtree:
Detect partial overlaps on insertion"), except that cases of complete overlap are already handled in the overlap detection phase itself, which slightly simplifies the loop to find the insertion point.
Based on initial patch from Stefano Brivio, including text from the original patch description too.
--- net/netfilter/nft_set_rbtree.c | 316 ++++++++++++++++++++------------- 1 file changed, 189 insertions(+), 127 deletions(-)
net/netfilter/nft_set_rbtree.c +189 -127
@@ -38,10 +38,12 @@ static bool nft_rbtree_interval_start(const struct nft_rbtree_elem *rbe)return !nft_rbtree_interval_end (rbe); } -static bool nft_rbtree_equal (const struct nft_set *set,const void *this, -const struct nft_rbtree_elem *interval) +static int nft_rbtree_cmp (const struct nft_set *set, +const struct nft_rbtree_elem *e1, +const struct nft_rbtree_elem *e2) { -return memcmp (this,nft_set_ext_key (&interval->ext), set->klen) ==0 ; +return memcmp (nft_set_ext_key (&e1->ext),nft_set_ext_key (&e2->ext), + set->klen); } static bool __nft_rbtree_lookup(const struct net *net, const struct nft_set *set,
@@ -52,7 +54,6 @@ static bool __nft_rbtree_lookup(const struct net *net, const struct nft_set *setconst struct nft_rbtree_elem *rbe, *interval =NULL ;u8 genmask =nft_genmask_cur (net);const struct rb_node *parent; -const void *this;int d; parent =rcu_dereference_raw (priv->root.rb_node);
@@ -62,12 +63,11 @@ static bool __nft_rbtree_lookup(const struct net *net, const struct nft_set *set rbe = rb_entry(parent, struct nft_rbtree_elem, node); - this =nft_set_ext_key (&rbe->ext); - d =memcmp (this, key, set->klen); + d =memcmp (nft_set_ext_key (&rbe->ext), key, set->klen);if (d <0 ) { parent =rcu_dereference_raw (parent->rb_left);if (interval && -nft_rbtree_equal (set, this, interval) && + !nft_rbtree_cmp (set, rbe, interval) &&nft_rbtree_interval_end (rbe) &&nft_rbtree_interval_start (interval))continue ;
@@ -215,154 +215,216 @@ static void *nft_rbtree_get(const struct net *net, const struct nft_set *set,return rbe; } +static int nft_rbtree_gc_elem (const struct nft_set *__set, +struct nft_rbtree *priv, +struct nft_rbtree_elem *rbe) +{ +struct nft_set *set = (struct nft_set *)__set; +struct rb_node *prev =rb_prev (&rbe->node); +struct nft_rbtree_elem *rbe_prev; +struct nft_set_gc_batch *gcb; + + gcb =nft_set_gc_batch_check (set,NULL ,GFP_ATOMIC ); +if (!gcb) +return -ENOMEM ; + +/* search for expired end interval coming before this element. */ +do { + rbe_prev = rb_entry(prev, struct nft_rbtree_elem, node); +if (nft_rbtree_interval_end (rbe_prev)) +break ; + + prev =rb_prev (prev); + }while (prev !=NULL ); + +rb_erase (&rbe_prev->node, &priv->root); +rb_erase (&rbe->node, &priv->root); +atomic_sub (2 , &set->nelems); + +nft_set_gc_batch_add (gcb, rbe); +nft_set_gc_batch_complete (gcb); + +return 0 ; +} + +static bool nft_rbtree_update_first (const struct nft_set *set, +struct nft_rbtree_elem *rbe, +struct rb_node *first) +{ +struct nft_rbtree_elem *first_elem; + + first_elem = rb_entry(first, struct nft_rbtree_elem, node); +/* this element is closest to where the new element is to be inserted: +* update the first element for the node list path. +*/ +if (nft_rbtree_cmp (set, rbe, first_elem) <0 ) +return true; + +return false; +} +static int __nft_rbtree_insert (const struct net *net,const struct nft_set *set,struct nft_rbtree_elem *new,struct nft_set_ext **ext) { -bool overlap = false, dup_end_left = false, dup_end_right = false; +struct nft_rbtree_elem *rbe, *rbe_le =NULL , *rbe_ge =NULL ; +struct rb_node *node, *parent, **p, *first =NULL ;struct nft_rbtree *priv =nft_set_priv (set);u8 genmask =nft_genmask_next (net); -struct nft_rbtree_elem *rbe; -struct rb_node *parent, **p; -int d; +int d, err; -/* Detect overlaps as we descend the tree. Set the flag in these cases: -* -* a1. _ _ __>| ?_ _ __| (insert end before existing end) -* a2. _ _ ___| ?_ _ _>| (insert end after existing end) -* a3. _ _ ___? >|_ _ __| (insert start before existing end) -* -* and clear it later on, as we eventually reach the points indicated by -* '?' above, in the cases described below. We'll always meet these -* later, locally, due to tree ordering, and overlaps for the intervals -* that are the closest together are always evaluated last. -* -* b1. _ _ __>| !_ _ __| (insert end before existing start) -* b2. _ _ ___| !_ _ _>| (insert end after existing start) -* b3. _ _ ___! >|_ _ __| (insert start after existing end, as a leaf) -* '--' no nodes falling in this range -* b4. >|_ _ ! (insert start before existing start) -* -* Case a3. resolves to b3.: -* - if the inserted start element is the leftmost, because the '0' -* element in the tree serves as end element -* - otherwise, if an existing end is found immediately to the left. If -* there are existing nodes in between, we need to further descend the -* tree before we can conclude the new start isn't causing an overlap -* -* or to b4., which, preceded by a3., means we already traversed one or -* more existing intervals entirely, from the right. -* -* For a new, rightmost pair of elements, we'll hit cases b3. and b2., -* in that order. -* -* The flag is also cleared in two special cases: -* -* b5. |__ _ _!|<_ _ _ (insert start right before existing end) -* b6. |__ _ >|!__ _ _ (insert end right after existing start) -* -* which always happen as last step and imply that no further -* overlapping is possible. -* -* Another special case comes from the fact that start elements matching -* an already existing start element are allowed: insertion is not -* performed but we return -EEXIST in that case, and the error will be -* cleared by the caller if NLM_F_EXCL is not present in the request. -* This way, request for insertion of an exact overlap isn't reported as -* error to userspace if not desired. -* -* However, if the existing start matches a pre-existing start, but the -* end element doesn't match the corresponding pre-existing end element, -* we need to report a partial overlap. This is a local condition that -* can be noticed without need for a tracking flag, by checking for a -* local duplicated end for a corresponding start, from left and right, -* separately. +/* Descend the tree to search for an existing element greater than the +* key value to insert that is greater than the new element. This is the +* first element to walk the ordered elements to find possible overlap. */ - parent =NULL ; p = &priv->root.rb_node;while (*p !=NULL ) { parent = *p; rbe = rb_entry(parent, struct nft_rbtree_elem, node); - d =memcmp (nft_set_ext_key (&rbe->ext), -nft_set_ext_key (&new->ext), - set->klen); + d =nft_rbtree_cmp (set, rbe, new); +if (d <0 ) { p = &parent->rb_left; - -if (nft_rbtree_interval_start (new)) { -if (nft_rbtree_interval_end (rbe) && -nft_set_elem_active (&rbe->ext, genmask) && - !nft_set_elem_expired (&rbe->ext) && !*p) - overlap = false; - }else { -if (dup_end_left && !*p) -return -ENOTEMPTY ; - - overlap =nft_rbtree_interval_end (rbe) && -nft_set_elem_active (&rbe->ext, - genmask) && - !nft_set_elem_expired (&rbe->ext); - -if (overlap) { - dup_end_right = true; -continue ; - } - } }else if (d >0 ) { - p = &parent->rb_right; +if (!first || +nft_rbtree_update_first (set, rbe, first)) + first = &rbe->node; -if (nft_rbtree_interval_end (new)) { -if (dup_end_right && !*p) -return -ENOTEMPTY ; - - overlap =nft_rbtree_interval_end (rbe) && -nft_set_elem_active (&rbe->ext, - genmask) && - !nft_set_elem_expired (&rbe->ext); - -if (overlap) { - dup_end_left = true; -continue ; - } - }else if (nft_set_elem_active (&rbe->ext, genmask) && - !nft_set_elem_expired (&rbe->ext)) { - overlap =nft_rbtree_interval_end (rbe); - } + p = &parent->rb_right; }else { -if (nft_rbtree_interval_end (rbe) && -nft_rbtree_interval_start (new)) { +if (nft_rbtree_interval_end (rbe)) p = &parent->rb_left; - -if (nft_set_elem_active (&rbe->ext, genmask) && - !nft_set_elem_expired (&rbe->ext)) - overlap = false; - }else if (nft_rbtree_interval_start (rbe) && -nft_rbtree_interval_end (new)) { +else p = &parent->rb_right; + } + } + +if (!first) + first =rb_first (&priv->root); + +/* Detect overlap by going through the list of valid tree nodes. +* Values stored in the tree are in reversed order, starting from +* highest to lowest value. +*/ +for (node = first; node !=NULL ; node =rb_next (node)) { + rbe = rb_entry(node, struct nft_rbtree_elem, node); + +if (!nft_set_elem_active (&rbe->ext, genmask)) +continue ; -if (nft_set_elem_active (&rbe->ext, genmask) && - !nft_set_elem_expired (&rbe->ext)) - overlap = false; - }else if (nft_set_elem_active (&rbe->ext, genmask) && - !nft_set_elem_expired (&rbe->ext)) { - *ext = &rbe->ext; -return -EEXIST ; - }else { - overlap = false; -if (nft_rbtree_interval_end (rbe)) - p = &parent->rb_left; -else - p = &parent->rb_right; +/* perform garbage collection to avoid bogus overlap reports. */ +if (nft_set_elem_expired (&rbe->ext)) { + err =nft_rbtree_gc_elem (set, priv, rbe); +if (err <0 ) +return err; + +continue ; + } + + d =nft_rbtree_cmp (set, rbe, new); +if (d ==0 ) { +/* Matching end element: no need to look for an +* overlapping greater or equal element. +*/ +if (nft_rbtree_interval_end (rbe)) { + rbe_le = rbe; +break ; + } + +/* first element that is greater or equal to key value. */ +if (!rbe_ge) { + rbe_ge = rbe; +continue ; + } + +/* this is a closer more or equal element, update it. */ +if (nft_rbtree_cmp (set, rbe_ge, new) !=0 ) { + rbe_ge = rbe; +continue ; } + +/* element is equal to key value, make sure flags are +* the same, an existing more or equal start element +* must not be replaced by more or equal end element. +*/ +if ((nft_rbtree_interval_start (new) && +nft_rbtree_interval_start (rbe_ge)) || + (nft_rbtree_interval_end (new) && +nft_rbtree_interval_end (rbe_ge))) { + rbe_ge = rbe; +continue ; + } + }else if (d >0 ) { +/* annotate element greater than the new element. */ + rbe_ge = rbe; +continue ; + }else if (d <0 ) { +/* annotate element less than the new element. */ + rbe_le = rbe; +break ; } + } - dup_end_left = dup_end_right = false; +/* - new start element matching existing start element: full overlap +* reported as -EEXIST, cleared by caller if NLM_F_EXCL is not given. +*/ +if (rbe_ge && !nft_rbtree_cmp (set, new, rbe_ge) && +nft_rbtree_interval_start (rbe_ge) ==nft_rbtree_interval_start (new)) { + *ext = &rbe_ge->ext; +return -EEXIST ; + } + +/* - new end element matching existing end element: full overlap +* reported as -EEXIST, cleared by caller if NLM_F_EXCL is not given. +*/ +if (rbe_le && !nft_rbtree_cmp (set, new, rbe_le) && +nft_rbtree_interval_end (rbe_le) ==nft_rbtree_interval_end (new)) { + *ext = &rbe_le->ext; +return -EEXIST ; } -if (overlap) +/* - new start element with existing closest, less or equal key value +* being a start element: partial overlap, reported as -ENOTEMPTY. +* Anonymous sets allow for two consecutive start element since they +* are constant, skip them to avoid bogus overlap reports. +*/ +if (!nft_set_is_anonymous (set) && rbe_le && +nft_rbtree_interval_start (rbe_le) &&nft_rbtree_interval_start (new)) +return -ENOTEMPTY ; + +/* - new end element with existing closest, less or equal key value +* being a end element: partial overlap, reported as -ENOTEMPTY. +*/ +if (rbe_le && +nft_rbtree_interval_end (rbe_le) &&nft_rbtree_interval_end (new))return -ENOTEMPTY ; +/* - new end element with existing closest, greater or equal key value +* being an end element: partial overlap, reported as -ENOTEMPTY +*/ +if (rbe_ge && +nft_rbtree_interval_end (rbe_ge) &&nft_rbtree_interval_end (new)) +return -ENOTEMPTY ; + +/* Accepted element: pick insertion point depending on key value */ + parent =NULL ; + p = &priv->root.rb_node; +while (*p !=NULL ) { + parent = *p; + rbe = rb_entry(parent, struct nft_rbtree_elem, node); + d =nft_rbtree_cmp (set, rbe, new); + +if (d <0 ) + p = &parent->rb_left; +else if (d >0 ) + p = &parent->rb_right; +else if (nft_rbtree_interval_end (rbe)) + p = &parent->rb_left; +else + p = &parent->rb_right; + } +rb_link_node_rcu (&new->node, parent, p);rb_insert_color (&new->node, &priv->root);return 0 ;
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 265/313 netfilter: nft_set_rbtree: skip elements in transaction from garbage collection
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 5d235d6ce75c12a7fdee375eb211e4116f7ab01b ]
Skip interference with an ongoing transaction, do not perform garbage collection on inactive elements. Reset annotated previous end interval if the expired element is marked as busy (control plane removed the element right before expiration).
--- net/netfilter/nft_set_rbtree.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
net/netfilter/nft_set_rbtree.c +15 -1
@@ -563,23 +563,37 @@ static void nft_rbtree_gc(struct work_struct *work)struct nft_rbtree *priv;struct rb_node *node;struct nft_set *set; +struct net *net; +u8 genmask; priv = container_of(work, struct nft_rbtree, gc_work.work); set =nft_set_container_of (priv); + net =read_pnet (&set->net); + genmask =nft_genmask_cur (net);write_lock_bh (&priv->lock);write_seqcount_begin (&priv->count);for (node =rb_first (&priv->root); node !=NULL ; node =rb_next (node)) { rbe = rb_entry(node, struct nft_rbtree_elem, node); +if (!nft_set_elem_active (&rbe->ext, genmask)) +continue ; + +/* elements are reversed in the rbtree for historical reasons, +* from highest to lowest value, that is why end element is +* always visited before the start element. +*/ if (nft_rbtree_interval_end (rbe)) { rbe_end = rbe;continue ; }if (!nft_set_elem_expired (&rbe->ext))continue ; -if (nft_set_elem_mark_busy (&rbe->ext)) + +if (nft_set_elem_mark_busy (&rbe->ext)) { + rbe_end =NULL ;continue ; + }if (rbe_prev) {rb_erase (&rbe_prev->node, &priv->root);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 266/313 netlink: annotate data races around nlk->portid
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit c1bb9484e3b05166880da8574504156ccbd0549e ]
syzbot reminds us netlink_getname() runs locklessly [1]
This first patch annotates the race against nlk->portid.
Following patches take care of the remaining races.
[1]
BUG: KCSAN: data-race in netlink_getname / netlink_insert
write to 0xffff88814176d310 of 4 bytes by task 2315 on cpu 1:
netlink_insert+0xf1/0x9a0 net/netlink/af_netlink.c:583 netlink_autobind+0xae/0x180 net/netlink/af_netlink.c:856 netlink_sendmsg+0x444/0x760 net/netlink/af_netlink.c:1895 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg net/socket.c:734 [inline] ____sys_sendmsg+0x38f/0x500 net/socket.c:2476 ___sys_sendmsg net/socket.c:2530 [inline] __sys_sendmsg+0x19a/0x230 net/socket.c:2559 __do_sys_sendmsg net/socket.c:2568 [inline] __se_sys_sendmsg net/socket.c:2566 [inline] __x64_sys_sendmsg+0x42/0x50 net/socket.c:2566 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
read to 0xffff88814176d310 of 4 bytes by task 2316 on cpu 0:
netlink_getname+0xcd/0x1a0 net/netlink/af_netlink.c:1144 __sys_getsockname+0x11d/0x1b0 net/socket.c:2026 __do_sys_getsockname net/socket.c:2041 [inline] __se_sys_getsockname net/socket.c:2038 [inline] __x64_sys_getsockname+0x3e/0x50 net/socket.c:2038 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
value changed: 0x00000000 -> 0xc9a49780
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 2316 Comm: syz-executor.2 Not tainted 6.2.0-rc3-syzkaller-00030-ge8f60cd7db24-dirty #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
--- net/netlink/af_netlink.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/netlink/af_netlink.c +5 -2
@@ -580,7 +580,9 @@ static int netlink_insert(struct sock *sk, u32 portid)if (nlk_sk (sk)->bound) goto err; -nlk_sk (sk)->portid = portid; +/* portid can be read locklessly from netlink_getname(). */ +WRITE_ONCE (nlk_sk (sk)->portid, portid); +sock_hold (sk); err =__netlink_insert (table, sk);
@@ -1130,7 +1132,8 @@ static int netlink_getname(struct socket *sock, struct sockaddr *addr, nladdr->nl_pid = nlk->dst_portid; nladdr->nl_groups =netlink_group_mask (nlk->dst_group); }else { - nladdr->nl_pid = nlk->portid; +/* Paired with WRITE_ONCE() in netlink_insert() */ + nladdr->nl_pid =READ_ONCE (nlk->portid);netlink_lock_table (); nladdr->nl_groups = nlk->groups ? nlk->groups[0 ] :0 ;netlink_unlock_table ();
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 267/313 netlink: annotate data races around dst_portid and dst_group
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 004db64d185a5f23dfb891d7701e23713b2420ee ]
netlink_getname(), netlink_sendmsg() and netlink_getsockbyportid() can read nlk->dst_portid and nlk->dst_group while another thread is changing them.
--- net/netlink/af_netlink.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
net/netlink/af_netlink.c +14 -9
@@ -1088,8 +1088,9 @@ static int netlink_connect(struct socket *sock, struct sockaddr *addr,if (addr->sa_family ==AF_UNSPEC ) { sk->sk_state =NETLINK_UNCONNECTED ; - nlk->dst_portid =0 ; - nlk->dst_group =0 ; +/* dst_portid and dst_group can be read locklessly */ +WRITE_ONCE (nlk->dst_portid,0 ); +WRITE_ONCE (nlk->dst_group,0 );return 0 ; }if (addr->sa_family !=AF_NETLINK )
@@ -1111,8 +1112,9 @@ static int netlink_connect(struct socket *sock, struct sockaddr *addr,if (err ==0 ) { sk->sk_state =NETLINK_CONNECTED ; - nlk->dst_portid = nladdr->nl_pid; - nlk->dst_group =ffs (nladdr->nl_groups); +/* dst_portid and dst_group can be read locklessly */ +WRITE_ONCE (nlk->dst_portid, nladdr->nl_pid); +WRITE_ONCE (nlk->dst_group,ffs (nladdr->nl_groups)); }return err;
@@ -1129,8 +1131,9 @@ static int netlink_getname(struct socket *sock, struct sockaddr *addr, nladdr->nl_pad =0 ;if (peer) { - nladdr->nl_pid = nlk->dst_portid; - nladdr->nl_groups =netlink_group_mask (nlk->dst_group); +/* Paired with WRITE_ONCE() in netlink_connect() */ + nladdr->nl_pid =READ_ONCE (nlk->dst_portid); + nladdr->nl_groups =netlink_group_mask (READ_ONCE (nlk->dst_group)); }else {/* Paired with WRITE_ONCE() in netlink_insert() */ nladdr->nl_pid =READ_ONCE (nlk->portid);
@@ -1160,8 +1163,9 @@ static struct sock *netlink_getsockbyportid(struct sock *ssk, u32 portid)/* Don't bother queuing skb if kernel socket has no input function */ nlk =nlk_sk (sock); +/* dst_portid can be changed in netlink_connect() */ if (sock->sk_state ==NETLINK_CONNECTED && - nlk->dst_portid !=nlk_sk (ssk)->portid) { +READ_ONCE (nlk->dst_portid) !=nlk_sk (ssk)->portid) {sock_put (sock);return ERR_PTR (-ECONNREFUSED ); }
@@ -1878,8 +1882,9 @@ static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) goto out; netlink_skb_flags |=NETLINK_SKB_DST ; }else { - dst_portid = nlk->dst_portid; - dst_group = nlk->dst_group; +/* Paired with WRITE_ONCE() in netlink_connect() */ + dst_portid =READ_ONCE (nlk->dst_portid); + dst_group =READ_ONCE (nlk->dst_group); }/* Paired with WRITE_ONCE() in netlink_insert() */
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 268/313 netlink: annotate data races around sk_state
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 9b663b5cbb15b494ef132a3c937641c90646eb73 ]
netlink_getsockbyportid() reads sk_state while a concurrent netlink_connect() can change its value.
--- net/netlink/af_netlink.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/netlink/af_netlink.c +6 -4
@@ -1087,7 +1087,8 @@ static int netlink_connect(struct socket *sock, struct sockaddr *addr,return -EINVAL ;if (addr->sa_family ==AF_UNSPEC ) { - sk->sk_state =NETLINK_UNCONNECTED ; +/* paired with READ_ONCE() in netlink_getsockbyportid() */ +WRITE_ONCE (sk->sk_state,NETLINK_UNCONNECTED );/* dst_portid and dst_group can be read locklessly */ WRITE_ONCE (nlk->dst_portid,0 );WRITE_ONCE (nlk->dst_group,0 );
@@ -1111,7 +1112,8 @@ static int netlink_connect(struct socket *sock, struct sockaddr *addr, err =netlink_autobind (sock);if (err ==0 ) { - sk->sk_state =NETLINK_CONNECTED ; +/* paired with READ_ONCE() in netlink_getsockbyportid() */ +WRITE_ONCE (sk->sk_state,NETLINK_CONNECTED );/* dst_portid and dst_group can be read locklessly */ WRITE_ONCE (nlk->dst_portid, nladdr->nl_pid);WRITE_ONCE (nlk->dst_group,ffs (nladdr->nl_groups));
@@ -1163,8 +1165,8 @@ static struct sock *netlink_getsockbyportid(struct sock *ssk, u32 portid)/* Don't bother queuing skb if kernel socket has no input function */ nlk =nlk_sk (sock); -/* dst_portid can be changed in netlink_connect() */ -if (sock->sk_state ==NETLINK_CONNECTED && +/* dst_portid and sk_state can be changed in netlink_connect() */ +if (READ_ONCE (sock->sk_state) ==NETLINK_CONNECTED &&READ_ONCE (nlk->dst_portid) !=nlk_sk (ssk)->portid) {sock_put (sock);return ERR_PTR (-ECONNREFUSED );
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 269/313 ipv4: prevent potential spectre v1 gadget in ip_metrics_convert()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 1d1d63b612801b3f0a39b7d4467cad0abd60e5c8 ]
if (!type)
continue; if (type > RTAX_MAX) return -EINVAL; ... metrics[type - 1] = val;
@type being used as an array index, we need to prevent cpu speculation or risk leaking kernel memory content.
--- net/ipv4/metrics.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv4/metrics.c +2 -0
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only #include <linux/netlink.h> +#include <linux/nospec.h> #include <linux/rtnetlink.h> #include <linux/types.h> #include <net/ip.h>
@@ -28,6 +29,7 @@ static int ip_metrics_convert(struct net *net, struct nlattr *fc_mx,return -EINVAL ; } + type =array_index_nospec (type,RTAX_MAX +1 );if (type ==RTAX_CC_ALGO ) {char tmp[TCP_CA_NAME_MAX ];
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 270/313 ipv4: prevent potential spectre v1 gadget in fib_metrics_match()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 5e9398a26a92fc402d82ce1f97cc67d832527da0 ]
if (!type)
continue;
if (type > RTAX_MAX)
return false;
...
fi_val = fi->fib_metrics->metrics[type - 1];@type being used as an array index, we need to prevent cpu speculation or risk leaking kernel memory content.
--- net/ipv4/fib_semantics.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv4/fib_semantics.c +2 -0
@@ -30,6 +30,7 @@#include <linux/slab.h> #include <linux/netlink.h> #include <linux/hash.h> +#include <linux/nospec.h> #include <net/arp.h> #include <net/inet_dscp.h>
@@ -1022,6 +1023,7 @@ bool fib_metrics_match(struct fib_config *cfg, struct fib_info *fi)if (type >RTAX_MAX )return false; + type =array_index_nospec (type,RTAX_MAX +1 );if (type ==RTAX_CC_ALGO ) {char tmp[TCP_CA_NAME_MAX ];bool ecn_ca = false;
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 271/313 net: dsa: microchip: fix probe of I2C-connected KSZ8563
In reply to Greg Kroah-HartmanFrom: Ahmad Fatoum <[email protected]>
[ Upstream commit 360fdc999d92db4a4adbba0db8641396dc9f1b13 ]
Starting with commit eee16b147121 ("net: dsa: microchip: perform the compatibility check for dev probed"), the KSZ switch driver now bails out if it thinks the DT compatible doesn't match the actual chip ID read back from the hardware:
ksz9477-switch 1-005f: Device tree specifies chip KSZ9893 but found KSZ8563, please fix it!
For the KSZ8563, which used ksz_switch_chips[KSZ9893], this was fine at first, because it indeed shares the same chip id as the KSZ9893.
Commit b44908095612 ("net: dsa: microchip: add separate struct ksz_chip_data for KSZ8563 chip") started differentiating KSZ9893 compatible chips by consulting the 0x1F register. The resulting breakage was fixed for the SPI driver in the same commit by introducing the appropriate ksz_switch_chips[KSZ8563], but not for the I2C driver.
Fix this for I2C-connected KSZ8563 now to get it probing again.
--- drivers/net/dsa/microchip/ksz9477_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/microchip/ksz9477_i2c.c +1 -1
@@ -105,7 +105,7 @@ static const struct of_device_id ksz9477_dt_ids[] = { }, { .compatible = "microchip,ksz8563", - .data = &ksz_switch_chips[KSZ9893] + .data = &ksz_switch_chips[KSZ8563] }, { .compatible = "microchip,ksz9567",
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 272/313 net: ethernet: adi: adin1110: Fix multicast offloading
In reply to Greg Kroah-HartmanFrom: Alexandru Tachici <[email protected]>
[ Upstream commit 8a4f6d023221c4b052ddfa1db48b27871bad6e96 ]
Driver marked broadcast/multicast frames as offloaded incorrectly. Mark them as offloaded only when HW offloading has been enabled. This should happen only for ADIN2111 when both ports are bridged by the software.
--- drivers/net/ethernet/adi/adin1110.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/adi/adin1110.c +1 -1
@@ -356,7 +356,7 @@ static int adin1110_read_fifo(struct adin1110_port_priv *port_priv)if ((port_priv->flags &IFF_ALLMULTI && rxb->pkt_type ==PACKET_MULTICAST ) || (port_priv->flags &IFF_BROADCAST && rxb->pkt_type ==PACKET_BROADCAST )) - rxb->offload_fwd_mark =1 ; + rxb->offload_fwd_mark = port_priv->priv->forwarding;netif_rx (rxb);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 273/313 netfilter: conntrack: fix vtag checks for ABORT/SHUTDOWN_COMPLETE
In reply to Greg Kroah-HartmanFrom: Sriram Yagnaraman <[email protected]>
[ Upstream commit a9993591fa94246b16b444eea55d84c54608282a ]
RFC 9260, Sec 8.5.1 states that for ABORT/SHUTDOWN_COMPLETE, the chunk MUST be accepted if the vtag of the packet matches its own tag and the T bit is not set OR if it is set to its peer's vtag and the T bit is set in chunk flags. Otherwise the packet MUST be silently dropped.
Update vtag verification for ABORT/SHUTDOWN_COMPLETE based on the above description.
--- net/netfilter/nf_conntrack_proto_sctp.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
net/netfilter/nf_conntrack_proto_sctp.c +16 -9
@@ -412,22 +412,29 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, for_each_sctp_chunk (skb, sch, _sch, offset, dataoff, count) {/* Special cases of Verification tag check (Sec 8.5.1) */ if (sch->type ==SCTP_CID_INIT ) { -/* Sec 8.5.1 (A) */ +/* (A) vtag MUST be zero */ if (sh->vtag !=0 ) goto out_unlock; }else if (sch->type ==SCTP_CID_ABORT ) { -/* Sec 8.5.1 (B) */ -if (sh->vtag != ct->proto.sctp.vtag[dir] && - sh->vtag != ct->proto.sctp.vtag[!dir]) +/* (B) vtag MUST match own vtag if T flag is unset OR +* MUST match peer's vtag if T flag is set +*/ +if ((!(sch->flags &SCTP_CHUNK_FLAG_T ) && + sh->vtag != ct->proto.sctp.vtag[dir]) || + ((sch->flags &SCTP_CHUNK_FLAG_T ) && + sh->vtag != ct->proto.sctp.vtag[!dir])) goto out_unlock; }else if (sch->type ==SCTP_CID_SHUTDOWN_COMPLETE ) { -/* Sec 8.5.1 (C) */ -if (sh->vtag != ct->proto.sctp.vtag[dir] && - sh->vtag != ct->proto.sctp.vtag[!dir] && - sch->flags &SCTP_CHUNK_FLAG_T ) +/* (C) vtag MUST match own vtag if T flag is unset OR +* MUST match peer's vtag if T flag is set +*/ +if ((!(sch->flags &SCTP_CHUNK_FLAG_T ) && + sh->vtag != ct->proto.sctp.vtag[dir]) || + ((sch->flags &SCTP_CHUNK_FLAG_T ) && + sh->vtag != ct->proto.sctp.vtag[!dir])) goto out_unlock; }else if (sch->type ==SCTP_CID_COOKIE_ECHO ) { -/* Sec 8.5.1 (D) */ +/* (D) vtag must be same as init_vtag as found in INIT_ACK */ if (sh->vtag != ct->proto.sctp.vtag[dir]) goto out_unlock; }else if (sch->type ==SCTP_CID_HEARTBEAT ) {
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 274/313 netfilter: conntrack: fix bug in for_each_sctp_chunk
In reply to Greg Kroah-HartmanFrom: Sriram Yagnaraman <[email protected]>
[ Upstream commit 98ee0077452527f971567db01386de3c3d97ce13 ]
skb_header_pointer() will return NULL if offset + sizeof(_sch) exceeds skb->len, so this offset < skb->len test is redundant.
if sch->length == 0, this will end up in an infinite loop, add a check for sch->length > 0
--- net/netfilter/nf_conntrack_proto_sctp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_proto_sctp.c +2 -2
@@ -155,8 +155,8 @@ static void sctp_print_conntrack(struct seq_file *s, struct nf_conn *ct)#define for_each_sctp_chunk (skb, sch, _sch, offset, dataoff, count) \ for ((offset) = (dataoff) + sizeof(struct sctphdr), (count) = 0; \ - (offset) < (skb)->len && \ - ((sch) = skb_header_pointer((skb), (offset), sizeof(_sch), &(_sch))); \ + ((sch) = skb_header_pointer((skb), (offset), sizeof(_sch), &(_sch))) && \ + (sch)->length; \ (offset) += (ntohs((sch)->length) + 3) & ~3, (count)++)/* Some validity checks to make sure the chunks are fine */
Signature · 1 line
2.39.0
Re: [PATCH 6.1 274/313] netfilter: conntrack: fix bug in for_each_sctp_chunk
Hi,
Quoted 9 lines · Greg Kroah-Hartman
From: Sriram Yagnaraman <[email protected]>
[ Upstream commit
98ee0077452527f971567db01386de3c3d97ce13]
skb_header_pointer()will return NULL if offset +sizeof(_sch)exceedsskb->len, so this offset <skb->lentest is redundant.if
sch->length== 0, this will end up in an infinite loop, add a check forsch->length> 0
Please, keep back this patch. for_each_sctp_chunk() is fine because do_basic_checks() already make sure what sch->length is sane.
A revert is scheduled for the net.git tree, the revert should show up in the next 6.2-rc release.
Sorry for the inconvenience.
Quoted 29 lines
Fixes 9fb9cbb1082d ("[NETFILTER]: Add nf_conntrack subsystem.")Suggested-by Florian Westphal <[email protected]>Signed-off-by Sriram Yagnaraman <[email protected]>Signed-off-by Pablo Neira Ayuso <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- net/netfilter/nf_conntrack_proto_sctp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)net/netfilter/nf_conntrack_proto_sctp.c +2
-2@@ -155,8 +155,8 @@ static void sctp_print_conntrack(struct seq_file *s, struct nf_conn *ct)#define for_each_sctp_chunk (skb, sch, _sch, offset, dataoff, count) \ for ((offset) = (dataoff) + sizeof(struct sctphdr), (count) = 0; \ - (offset) < (skb)->len && \ - ((sch) = skb_header_pointer((skb), (offset), sizeof(_sch), &(_sch))); \ + ((sch) = skb_header_pointer((skb), (offset), sizeof(_sch), &(_sch))) && \ + (sch)->length; \ (offset) += (ntohs((sch)->length) + 3) & ~3, (count)++)/* Some validity checks to make sure the chunks are fine */ Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 275/313 netrom: Fix use-after-free of a listening socket.
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 409db27e3a2eb5e8ef7226ca33be33361b3ed1c9 ]
syzbot reported a use-after-free in do_accept(), precisely nr_accept() as sk_prot_alloc() allocated the memory and sock_put() frees it. [0]
The issue could happen if the heartbeat timer is fired and nr_heartbeat_expiry() calls nr_destroy_socket(), where a socket has SOCK_DESTROY or a listening socket has SOCK_DEAD.
In this case, the first condition cannot be true. SOCK_DESTROY is flagged in nr_release() only when the file descriptor is close()d, but accept() is being called for the listening socket, so the second condition must be true.
Usually, the AF_NETROM listener neither starts timers nor sets SOCK_DEAD. However, the condition is met if connect() fails before listen(). connect() starts the t1 timer and heartbeat timer, and t1timer calls nr_disconnect() when timeout happens. Then, SOCK_DEAD is set, and if we call listen(), the heartbeat timer calls nr_destroy_socket().
nr_connect
nr_establish_data_link(sk)
nr_start_t1timer(sk)
nr_start_heartbeat(sk)
nr_t1timer_expiry
nr_disconnect(sk, ETIMEDOUT)
nr_sk(sk)->state = NR_STATE_0
sk->sk_state = TCP_CLOSE
sock_set_flag(sk, SOCK_DEAD)
nr_listen
if (sk->sk_state != TCP_LISTEN)
sk->sk_state = TCP_LISTEN
nr_heartbeat_expiry
switch (nr->state)
case NR_STATE_0
if (sk->sk_state == TCP_LISTEN &&
sock_flag(sk, SOCK_DEAD))
nr_destroy_socket(sk)This path seems expected, and nr_destroy_socket() is called to clean up resources. Initially, there was sock_hold() before nr_destroy_socket() so that the socket would not be freed, but the commit 517a16b1a88b ("netrom: Decrease sock refcount when sock timers expire") accidentally removed it.
To fix use-after-free, let's add sock_hold().
[0]:
BUG: KASAN: use-after-free in do_accept+0x483/0x510 net/socket.c:1848 Read of size 8 at addr ffff88807978d398 by task syz-executor.3/5315 CPU: 0 PID: 5315 Comm: syz-executor.3 Not tainted 6.2.0-rc3-syzkaller-00165-gd9fc1511728c #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:306 [inline] print_report+0x15e/0x461 mm/kasan/report.c:417 kasan_report+0xbf/0x1f0 mm/kasan/report.c:517 do_accept+0x483/0x510 net/socket.c:1848 __sys_accept4_file net/socket.c:1897 [inline] __sys_accept4+0x9a/0x120 net/socket.c:1927 __do_sys_accept net/socket.c:1944 [inline] __se_sys_accept net/socket.c:1941 [inline] __x64_sys_accept+0x75/0xb0 net/socket.c:1941 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fa436a8c0c9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fa437784168 EFLAGS: 00000246 ORIG_RAX: 000000000000002b RAX: ffffffffffffffda RBX: 00007fa436bac050 RCX: 00007fa436a8c0c9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000005 RBP: 00007fa436ae7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffebc6700df R14: 00007fa437784300 R15: 0000000000022000 </TASK> Allocated by task 5294: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:371 [inline] ____kasan_kmalloc mm/kasan/common.c:330 [inline] __kasan_kmalloc+0xa3/0xb0 mm/kasan/common.c:380 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slab_common.c:968 [inline] __kmalloc+0x5a/0xd0 mm/slab_common.c:981 kmalloc include/linux/slab.h:584 [inline] sk_prot_alloc+0x140/0x290 net/core/sock.c:2038 sk_alloc+0x3a/0x7a0 net/core/sock.c:2091 nr_create+0xb6/0x5f0 net/netrom/af_netrom.c:433 __sock_create+0x359/0x790 net/socket.c:1515 sock_create net/socket.c:1566 [inline] __sys_socket_create net/socket.c:1603 [inline] __sys_socket_create net/socket.c:1588 [inline] __sys_socket+0x133/0x250 net/socket.c:1636 __do_sys_socket net/socket.c:1649 [inline] __se_sys_socket net/socket.c:1647 [inline] __x64_sys_socket+0x73/0xb0 net/socket.c:1647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 14: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:518 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x13b/0x1a0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:177 [inline] __cache_free mm/slab.c:3394 [inline] __do_kmem_cache_free mm/slab.c:3580 [inline] __kmem_cache_free+0xcd/0x3b0 mm/slab.c:3587 sk_prot_free net/core/sock.c:2074 [inline] __sk_destruct+0x5df/0x750 net/core/sock.c:2166 sk_destruct net/core/sock.c:2181 [inline] __sk_free+0x175/0x460 net/core/sock.c:2192 sk_free+0x7c/0xa0 net/core/sock.c:2203 sock_put include/net/sock.h:1991 [inline] nr_heartbeat_expiry+0x1d7/0x460 net/netrom/nr_timer.c:148 call_timer_fn+0x1da/0x7c0 kernel/time/timer.c:1700 expire_timers+0x2c6/0x5c0 kernel/time/timer.c:1751 __run_timers kernel/time/timer.c:2022 [inline] __run_timers kernel/time/timer.c:1995 [inline] run_timer_softirq+0x326/0x910 kernel/time/timer.c:2035 __do_softirq+0x1fb/0xadc kernel/softirq.c:571
--- net/netrom/nr_timer.c | 1 + 1 file changed, 1 insertion(+)
net/netrom/nr_timer.c +1 -0
@@ -121,6 +121,7 @@ static void nr_heartbeat_expiry(struct timer_list *t)is accepted() it isn't 'dead' so doesn't get removed. */ if (sock_flag (sk,SOCK_DESTROY ) || (sk->sk_state ==TCP_LISTEN &&sock_flag (sk,SOCK_DEAD ))) { +sock_hold (sk);bh_unlock_sock (sk);nr_destroy_socket (sk); goto out;
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 276/313 platform/x86: asus-wmi: Fix kbd_dock_devid tablet-switch reporting
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit fdcc0602d64f22185f61c70747214b630049cc33 ]
Commit 1ea0d3b46798 ("platform/x86: asus-wmi: Simplify tablet-mode-switch handling") unified the asus-wmi tablet-switch handling, but it did not take into account that the value returned for the kbd_dock_devid WMI method is inverted where as the other ones are not inverted.
This causes asus-wmi to report an inverted tablet-switch state for devices which use the kbd_dock_devid, which causes libinput to ignore touchpad events while the affected T10x model 2-in-1s are docked.
Add inverting of the return value in the kbd_dock_devid case to fix this.
--- drivers/platform/x86/asus-wmi.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/platform/x86/asus-wmi.c +12 -5
@@ -225,6 +225,7 @@ struct asus_wmi {int tablet_switch_event_code;u32 tablet_switch_dev_id; +bool tablet_switch_inverted;enum fan_type fan_type;enum fan_type gpu_fan_type;
@@ -493,6 +494,13 @@ static bool asus_wmi_dev_is_present(struct asus_wmi *asus, u32 dev_id) }/* Input **********************************************************************/ +static void asus_wmi_tablet_sw_report (struct asus_wmi *asus,bool value) +{ +input_report_switch (asus->inputdev,SW_TABLET_MODE , + asus->tablet_switch_inverted ? !value : value); +input_sync (asus->inputdev); +} +static void asus_wmi_tablet_sw_init (struct asus_wmi *asus,u32 dev_id,int event_code) {struct device *dev = &asus->platform_device->dev;
@@ -501,7 +509,7 @@ static void asus_wmi_tablet_sw_init(struct asus_wmi *asus, u32 dev_id, int event result =asus_wmi_get_devstate_simple (asus, dev_id);if (result >=0 ) {input_set_capability (asus->inputdev,EV_SW ,SW_TABLET_MODE ); -input_report_switch (asus->inputdev,SW_TABLET_MODE , result); +asus_wmi_tablet_sw_report (asus, result); asus->tablet_switch_dev_id = dev_id; asus->tablet_switch_event_code = event_code; }else if (result == -ENODEV ) {
@@ -534,6 +542,7 @@ static int asus_wmi_input_init(struct asus_wmi *asus)case asus_wmi_no_tablet_switch:break ;case asus_wmi_kbd_dock_devid: + asus->tablet_switch_inverted = true;asus_wmi_tablet_sw_init (asus,ASUS_WMI_DEVID_KBD_DOCK ,NOTIFY_KBD_DOCK_CHANGE );break ;case asus_wmi_lid_flip_devid:
@@ -573,10 +582,8 @@ static void asus_wmi_tablet_mode_get_state(struct asus_wmi *asus)return ; result =asus_wmi_get_devstate_simple (asus, asus->tablet_switch_dev_id); -if (result >=0 ) { -input_report_switch (asus->inputdev,SW_TABLET_MODE , result); -input_sync (asus->inputdev); - } +if (result >=0 ) +asus_wmi_tablet_sw_report (asus, result); }/* dGPU ********************************************************************/
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 277/313 platform/x86: apple-gmux: Move port defines to apple-gmux.h
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 39f5a81f7ad80eb3fbcbfd817c6552db9de5504d ]
This is a preparation patch for adding a new static inline apple_gmux_detect() helper which actually checks a supported gmux is present, rather then only checking an ACPI device with the HID is there as apple_gmux_present() does.
--- drivers/platform/x86/apple-gmux.c | 23 ----------------------- include/linux/apple-gmux.h | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 23 deletions(-)
drivers/platform/x86/apple-gmux.c +0 -23
@@ -64,29 +64,6 @@ struct apple_gmux_data {static struct apple_gmux_data *apple_gmux_data; -/* -* gmux port offsets. Many of these are not yet used, but may be in the -* future, and it's useful to have them documented here anyhow. -*/ -#define GMUX_PORT_VERSION_MAJOR 0x04 -#define GMUX_PORT_VERSION_MINOR 0x05 -#define GMUX_PORT_VERSION_RELEASE 0x06 -#define GMUX_PORT_SWITCH_DISPLAY 0x10 -#define GMUX_PORT_SWITCH_GET_DISPLAY 0x11 -#define GMUX_PORT_INTERRUPT_ENABLE 0x14 -#define GMUX_PORT_INTERRUPT_STATUS 0x16 -#define GMUX_PORT_SWITCH_DDC 0x28 -#define GMUX_PORT_SWITCH_EXTERNAL 0x40 -#define GMUX_PORT_SWITCH_GET_EXTERNAL 0x41 -#define GMUX_PORT_DISCRETE_POWER 0x50 -#define GMUX_PORT_MAX_BRIGHTNESS 0x70 -#define GMUX_PORT_BRIGHTNESS 0x74 -#define GMUX_PORT_VALUE 0xc2 -#define GMUX_PORT_READ 0xd0 -#define GMUX_PORT_WRITE 0xd4 - -#define GMUX_MIN_IO_LEN (GMUX_PORT_BRIGHTNESS + 4) -#define GMUX_INTERRUPT_ENABLE 0xff#define GMUX_INTERRUPT_DISABLE 0x00
include/linux/apple-gmux.h +23 -0
@@ -11,6 +11,29 @@#define GMUX_ACPI_HID "APP000B" +/* +* gmux port offsets. Many of these are not yet used, but may be in the +* future, and it's useful to have them documented here anyhow. +*/ +#define GMUX_PORT_VERSION_MAJOR 0x04 +#define GMUX_PORT_VERSION_MINOR 0x05 +#define GMUX_PORT_VERSION_RELEASE 0x06 +#define GMUX_PORT_SWITCH_DISPLAY 0x10 +#define GMUX_PORT_SWITCH_GET_DISPLAY 0x11 +#define GMUX_PORT_INTERRUPT_ENABLE 0x14 +#define GMUX_PORT_INTERRUPT_STATUS 0x16 +#define GMUX_PORT_SWITCH_DDC 0x28 +#define GMUX_PORT_SWITCH_EXTERNAL 0x40 +#define GMUX_PORT_SWITCH_GET_EXTERNAL 0x41 +#define GMUX_PORT_DISCRETE_POWER 0x50 +#define GMUX_PORT_MAX_BRIGHTNESS 0x70 +#define GMUX_PORT_BRIGHTNESS 0x74 +#define GMUX_PORT_VALUE 0xc2 +#define GMUX_PORT_READ 0xd0 +#define GMUX_PORT_WRITE 0xd4 + +#define GMUX_MIN_IO_LEN (GMUX_PORT_BRIGHTNESS + 4) +#if IS_ENABLED (CONFIG_APPLE_GMUX )/**
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 278/313 platform/x86: apple-gmux: Add apple_gmux_detect() helper
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit d143908f80f3e5d164ac3342f73d6b9f536e8b4d ]
Add a new (static inline) apple_gmux_detect() helper to apple-gmux.h which can be used for gmux detection instead of apple_gmux_present().
The latter is not really reliable since an ACPI device with a HID of APP000B is present on some devices without a gmux at all, as well as on devices with a newer (unsupported) MMIO based gmux model.
This causes apple_gmux_present() to return false-positives on a number of different Apple laptop models.
This new helper uses the same probing as the actual apple-gmux driver, so that it does not return false positives.
To avoid code duplication the gmux_probe() function of the actual driver is also moved over to using the new apple_gmux_detect() helper.
This avoids false positives (vs _HID + IO region detection) on:
MacBookPro5,4
https://pastebin.com/8Xjq7RhS
MacBookPro8,1
https://linux-hardware.org/?probe=e513cfbadb&log=dmesg
MacBookPro9,2
https://bugzilla.kernel.org/attachment.cgi?id=278961
MacBookPro10,2
https://lkml.org/lkml/2014/9/22/657
MacBookPro11,2
https://forums.fedora-fr.org/viewtopic.php?id=70142
MacBookPro11,4
https://raw.githubusercontent.com/im-0/investigate-card-reader-suspend-problem-on-mbp11.4/master/test-16/dmesg
--- drivers/platform/x86/apple-gmux.c | 70 +++++++------------------ include/linux/apple-gmux.h | 86 ++++++++++++++++++++++++++++++- 2 files changed, 102 insertions(+), 54 deletions(-)
drivers/platform/x86/apple-gmux.c +18 -52
@@ -226,23 +226,6 @@ static void gmux_write32(struct apple_gmux_data *gmux_data, int port,gmux_pio_write32 (gmux_data, port, val); } -static bool gmux_is_indexed (struct apple_gmux_data *gmux_data) -{ -u16 val; - -outb (0xaa , gmux_data->iostart +0xcc ); -outb (0x55 , gmux_data->iostart +0xcd ); -outb (0x00 , gmux_data->iostart +0xce ); - - val =inb (gmux_data->iostart +0xcc ) | - (inb (gmux_data->iostart +0xcd ) <<8 ); - -if (val ==0x55aa ) -return true; - -return false; -} -/** * DOC: Backlight control *
@@ -582,60 +565,43 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)int ret = -ENXIO ;acpi_status status;unsigned long long gpe; +bool indexed = false; +u32 version;if (apple_gmux_data)return -EBUSY ; +if (!apple_gmux_detect (pnp, &indexed)) { +pr_info ("gmux device not present\n" ); +return -ENODEV ; + } + gmux_data =kzalloc (sizeof (*gmux_data),GFP_KERNEL );if (!gmux_data)return -ENOMEM ;pnp_set_drvdata (pnp, gmux_data); res =pnp_get_resource (pnp,IORESOURCE_IO ,0 ); -if (!res) { -pr_err ("Failed to find gmux I/O resource\n" ); - goto err_free; - } - gmux_data->iostart = res->start; gmux_data->iolen =resource_size (res); -if (gmux_data->iolen <GMUX_MIN_IO_LEN ) { -pr_err ("gmux I/O region too small (%lu < %u)\n" , - gmux_data->iolen,GMUX_MIN_IO_LEN ); - goto err_free; - } -if (!request_region (gmux_data->iostart, gmux_data->iolen,"Apple gmux" )) {pr_err ("gmux I/O already in use\n" ); goto err_free; } -/* -* Invalid version information may indicate either that the gmux -* device isn't present or that it's a new one that uses indexed -* io -*/ - - ver_major =gmux_read8 (gmux_data,GMUX_PORT_VERSION_MAJOR ); - ver_minor =gmux_read8 (gmux_data,GMUX_PORT_VERSION_MINOR ); - ver_release =gmux_read8 (gmux_data,GMUX_PORT_VERSION_RELEASE ); -if (ver_major ==0xff && ver_minor ==0xff && ver_release ==0xff ) { -if (gmux_is_indexed (gmux_data)) { -u32 version; -mutex_init (&gmux_data->index_lock); - gmux_data->indexed = true; - version =gmux_read32 (gmux_data, -GMUX_PORT_VERSION_MAJOR ); - ver_major = (version >>24 ) &0xff ; - ver_minor = (version >>16 ) &0xff ; - ver_release = (version >>8 ) &0xff ; - }else { -pr_info ("gmux device not present\n" ); - ret = -ENODEV ; - goto err_release; - } +if (indexed) { +mutex_init (&gmux_data->index_lock); + gmux_data->indexed = true; + version =gmux_read32 (gmux_data,GMUX_PORT_VERSION_MAJOR ); + ver_major = (version >>24 ) &0xff ; + ver_minor = (version >>16 ) &0xff ; + ver_release = (version >>8 ) &0xff ; + }else { + ver_major =gmux_read8 (gmux_data,GMUX_PORT_VERSION_MAJOR ); + ver_minor =gmux_read8 (gmux_data,GMUX_PORT_VERSION_MINOR ); + ver_release =gmux_read8 (gmux_data,GMUX_PORT_VERSION_RELEASE ); }pr_info ("Found gmux version %d.%d.%d [%s]\n" , ver_major, ver_minor, ver_release, (gmux_data->indexed ?"indexed" :"classic" ));
include/linux/apple-gmux.h +84 -2
110 lines not on this page · raw message
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 279/313 ACPI: video: Fix apple gmux detection
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit b0935f110cff5d70da05c5cb1670bee0b07b631c ]
Some apple laptop models have an ACPI device with a HID of APP000B and that device has an IO resource (so it does not describe the new unsupported MMIO based gmux type), but there actually is no gmux in the laptop at all.
The gmux_probe() function of the actual apple-gmux driver has code to detect this, this code has been factored out into a new apple_gmux_detect() helper in apple-gmux.h.
Use this new function to fix acpi_video_get_backlight_type() wrongly returning apple_gmux as type on the following laptops:
MacBookPro5,4
https://pastebin.com/8Xjq7RhS
MacBookPro8,1
https://linux-hardware.org/?probe=e513cfbadb&log=dmesg
MacBookPro9,2
https://bugzilla.kernel.org/attachment.cgi?id=278961
MacBookPro10,2
https://lkml.org/lkml/2014/9/22/657
MacBookPro11,2
https://forums.fedora-fr.org/viewtopic.php?id=70142
MacBookPro11,4
https://raw.githubusercontent.com/im-0/investigate-card-reader-suspend-problem-on-mbp11.4/mast
--- drivers/acpi/video_detect.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-)
drivers/acpi/video_detect.c +3 -21
@@ -110,26 +110,6 @@ static bool nvidia_wmi_ec_supported(void) }#endif -static bool apple_gmux_backlight_present (void ) -{ -struct acpi_device *adev; -struct device *dev; - - adev =acpi_dev_get_first_match_dev (GMUX_ACPI_HID ,NULL ,-1 ); -if (!adev) -return false; - - dev =acpi_get_first_physical_node (adev); -if (!dev) -return false; - -/* -* drivers/platform/x86/apple-gmux.c only supports old style -* Apple GMUX with an IO-resource. -*/ -return pnp_get_resource (to_pnp_dev (dev),IORESOURCE_IO ,0 ) !=NULL ; -} -/* Force to use vendor driver when the ACPI device is known to be * buggy */ static int video_detect_force_vendor (const struct dmi_system_id *d)
@@ -781,6 +761,7 @@ static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native) {static DEFINE_MUTEX (init_mutex);static bool nvidia_wmi_ec_present; +static bool apple_gmux_present;static bool native_available;static bool init_done;static long video_caps;
@@ -794,6 +775,7 @@ static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native)ACPI_UINT32_MAX , find_video,NULL , &video_caps, NULL); nvidia_wmi_ec_present =nvidia_wmi_ec_supported (); + apple_gmux_present =apple_gmux_detect (NULL ,NULL ); init_done = true; }if (native)
@@ -815,7 +797,7 @@ static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native)if (nvidia_wmi_ec_present)return acpi_backlight_nvidia_wmi_ec; -if (apple_gmux_backlight_present ()) +if (apple_gmux_present)return acpi_backlight_apple_gmux;/* Use ACPI video if available, except when native should be preferred. */
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 280/313 tracing/osnoise: Use built-in RCU list checking
In reply to Greg Kroah-HartmanFrom: Chuang Wang <[email protected]>
[ Upstream commit 685b64e4d6da4be8b4595654a57db663b3d1dfc2 ]
list_for_each_entry_rcu() has built-in RCU and lock checking.
Pass cond argument to list_for_each_entry_rcu() to silence false lockdep warning when CONFIG_PROVE_RCU_LIST is enabled.
Execute as follow:
[tracing]# echo osnoise > current_tracer
[tracing]# echo 1 > tracing_on
[tracing]# echo 0 > tracing_on
The trace_types_lock is held when osnoise_tracer_stop() or timerlat_tracer_stop() are called in the non-RCU read side section. So, pass lockdep_is_held(&trace_types_lock) to silence false lockdep warning.
--- kernel/trace/trace_osnoise.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
kernel/trace/trace_osnoise.c +2 -3
@@ -125,9 +125,8 @@ static void osnoise_unregister_instance(struct trace_array *tr)* register/unregister serialization is provided by trace's * trace_types_lock. */ -lockdep_assert_held (&trace_types_lock); - -list_for_each_entry_rcu (inst, &osnoise_instances, list) { +list_for_each_entry_rcu (inst, &osnoise_instances, list, +lockdep_is_held (&trace_types_lock)) {if (inst->tr == tr) {list_del_rcu (&inst->list); found =1 ;
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 281/313 net/sched: sch_taprio: do not schedule in taprio_reset()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit ea4fdbaa2f7798cb25adbe4fd52ffc6356f097bb ]
As reported by syzbot and hinted by Vinicius, I should not have added a qdisc_synchronize() call in taprio_reset()
taprio_reset() can be called with qdisc spinlock held (and BH disabled) as shown in included syzbot report [1].
Only taprio_destroy() needed this synchronization, as explained in the blamed commit changelog.
[1]
BUG: scheduling while atomic: syz-executor150/5091/0x00000202 2 locks held by syz-executor150/5091: Modules linked in: Preemption disabled at: [<0000000000000000>] 0x0 Kernel panic - not syncing: scheduling while atomic: panic_on_warn set ... CPU: 1 PID: 5091 Comm: syz-executor150 Not tainted 6.2.0-rc3-syzkaller-00219-g010a74f52203 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 panic+0x2cc/0x626 kernel/panic.c:318 check_panic_on_warn.cold+0x19/0x35 kernel/panic.c:238 __schedule_bug.cold+0xd5/0xfe kernel/sched/core.c:5836 schedule_debug kernel/sched/core.c:5865 [inline] __schedule+0x34e4/0x5450 kernel/sched/core.c:6500 schedule+0xde/0x1b0 kernel/sched/core.c:6682 schedule_timeout+0x14e/0x2a0 kernel/time/timer.c:2167 schedule_timeout_uninterruptible kernel/time/timer.c:2201 [inline] msleep+0xb6/0x100 kernel/time/timer.c:2322 qdisc_synchronize include/net/sch_generic.h:1295 [inline] taprio_reset+0x93/0x270 net/sched/sch_taprio.c:1703 qdisc_reset+0x10c/0x770 net/sched/sch_generic.c:1022 dev_reset_queue+0x92/0x130 net/sched/sch_generic.c:1285 netdev_for_each_tx_queue include/linux/netdevice.h:2464 [inline] dev_deactivate_many+0x36d/0x9f0 net/sched/sch_generic.c:1351 dev_deactivate+0xed/0x1b0 net/sched/sch_generic.c:1374 qdisc_graft+0xe4a/0x1380 net/sched/sch_api.c:1080 tc_modify_qdisc+0xb6b/0x19a0 net/sched/sch_api.c:1689 rtnetlink_rcv_msg+0x43e/0xca0 net/core/rtnetlink.c:6141 netlink_rcv_skb+0x165/0x440 net/netlink/af_netlink.c:2564 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline] netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1356 netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1932 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xd3/0x120 net/socket.c:734 ____sys_sendmsg+0x712/0x8c0 net/socket.c:2476 ___sys_sendmsg+0x110/0x1b0 net/socket.c:2530 __sys_sendmsg+0xf7/0x1c0 net/socket.c:2559 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
--- net/sched/sch_taprio.c | 1 - 1 file changed, 1 deletion(-)
net/sched/sch_taprio.c +0 -1
@@ -1700,7 +1700,6 @@ static void taprio_reset(struct Qdisc *sch)int i;hrtimer_cancel (&q->advance_timer); -qdisc_synchronize (sch);if (q->qdiscs) {for (i =0 ; i < dev->num_tx_queues; i++)
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 282/313 sctp: fail if no bound addresses can be used for a given scope
In reply to Greg Kroah-HartmanFrom: Marcelo Ricardo Leitner <[email protected]>
[ Upstream commit 458e279f861d3f61796894cd158b780765a1569f ]
Currently, if you bind the socket to something like:
servaddr.sin6_family = AF_INET6;
servaddr.sin6_port = htons(0);
servaddr.sin6_scope_id = 0;
inet_pton(AF_INET6, "::1", &servaddr.sin6_addr);And then request a connect to:
connaddr.sin6_family = AF_INET6;
connaddr.sin6_port = htons(20000);
connaddr.sin6_scope_id = if_nametoindex("lo");
inet_pton(AF_INET6, "fe88::1", &connaddr.sin6_addr);What the stack does is:
- bind the socket
- create a new asoc
- to handle the connect
- copy the addresses that can be used for the given scope
- try to connect
But the copy returns 0 addresses, and the effect is that it ends up trying to connect as if the socket wasn't bound, which is not the desired behavior. This unexpected behavior also allows KASLR leaks through SCTP diag interface.
The fix here then is, if when trying to copy the addresses that can be used for the scope used in connect() it returns 0 addresses, bail out. This is what TCP does with a similar reproducer.
--- net/sctp/bind_addr.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/sctp/bind_addr.c +6 -0
@@ -73,6 +73,12 @@ int sctp_bind_addr_copy(struct net *net, struct sctp_bind_addr *dest, } } +/* If somehow no addresses were found that can be used with this +* scope, it's an error. +*/ +if (list_empty (&dest->address_list)) + error = -ENETUNREACH ; + out:if (error)sctp_bind_addr_clean (dest);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 283/313 riscv/kprobe: Fix instruction simulation of JALR
In reply to Greg Kroah-HartmanFrom: Liao Chang <[email protected]>
[ Upstream commit ca0254998be4d74cf6add70ccfab0d2dbd362a10 ]
Set kprobe at 'jalr 1140(ra)' of vfs_write results in the following crash:
[ 32.092235] Unable to handle kernel access to user memory without uaccess routines at virtual address 00aaaaaad77b1170 [ 32.093115] Oops [#1] [ 32.093251] Modules linked in: [ 32.093626] CPU: 0 PID: 135 Comm: ftracetest Not tainted 6.2.0-rc2-00013-gb0aa5e5df0cb-dirty #16 [ 32.093985] Hardware name: riscv-virtio,qemu (DT) [ 32.094280] epc : ksys_read+0x88/0xd6 [ 32.094855] ra : ksys_read+0xc0/0xd6 [ 32.095016] epc : ffffffff801cda80 ra : ffffffff801cdab8 sp : ff20000000d7bdc0 [ 32.095227] gp : ffffffff80f14000 tp : ff60000080f9cb40 t0 : ffffffff80f13e80 [ 32.095500] t1 : ffffffff8000c29c t2 : ffffffff800dbc54 s0 : ff20000000d7be60 [ 32.095716] s1 : 0000000000000000 a0 : ffffffff805a64ae a1 : ffffffff80a83708 [ 32.095921] a2 : ffffffff80f160a0 a3 : 0000000000000000 a4 : f229b0afdb165300 [ 32.096171] a5 : f229b0afdb165300 a6 : ffffffff80eeebd0 a7 : 00000000000003ff [ 32.096411] s2 : ff6000007ff76800 s3 : fffffffffffffff7 s4 : 00aaaaaad77b1170 [ 32.096638] s5 : ffffffff80f160a0 s6 : ff6000007ff76800 s7 : 0000000000000030 [ 32.096865] s8 : 00ffffffc3d97be0 s9 : 0000000000000007 s10: 00aaaaaad77c9410 [ 32.097092] s11: 0000000000000000 t3 : ffffffff80f13e48 t4 : ffffffff8000c29c [ 32.097317] t5 : ffffffff8000c29c t6 : ffffffff800dbc54 [ 32.097505] status: 0000000200000120 badaddr: 00aaaaaad77b1170 cause: 000000000000000d [ 32.098011] [<ffffffff801cdb72>] ksys_write+0x6c/0xd6 [ 32.098222] [<ffffffff801cdc06>] sys_write+0x2a/0x38 [ 32.098405] [<ffffffff80003c76>] ret_from_syscall+0x0/0x2
Since the rs1 and rd might be the same one, such as 'jalr 1140(ra)', hence it requires obtaining the target address from rs1 followed by updating rd.
--- arch/riscv/kernel/probes/simulate-insn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/probes/simulate-insn.c +2 -2
@@ -71,11 +71,11 @@ bool __kprobes simulate_jalr(u32 opcode, unsigned long addr, struct pt_regs *regu32 rd_index = (opcode >>7 ) &0x1f ;u32 rs1_index = (opcode >>15 ) &0x1f ; - ret =rv_insn_reg_set_val (regs, rd_index, addr +4 ); + ret =rv_insn_reg_get_val (regs, rs1_index, &base_addr);if (!ret)return ret; - ret =rv_insn_reg_get_val (regs, rs1_index, &base_addr); + ret =rv_insn_reg_set_val (regs, rd_index, addr +4 );if (!ret)return ret;
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 284/313 nvme: fix passthrough csi check
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
[ Upstream commit 85eee6341abb81ac6a35062ffd5c3029eb53be6b ]
The namespace head saves the Command Set Indicator enum, so use that instead of the Command Set Selected. The two values are not the same.
--- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
@@ -1088,7 +1088,7 @@ u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u8 opcode)if (ns) {if (ns->head->effects) effects =le32_to_cpu (ns->head->effects->iocs[opcode]); -if (ns->head->ids.csi ==NVME_CAP_CSS_NVM ) +if (ns->head->ids.csi ==NVME_CSI_NVM ) effects |=nvme_known_nvm_effects (opcode);if (effects & ~(NVME_CMD_EFFECTS_CSUPP |NVME_CMD_EFFECTS_LBCC )) dev_warn_once(ctrl->device,
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 285/313 gpio: mxc: Unlock on error path in mxc_flip_edge()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 37870358616ca7fdb1e90ad1cdd791655ec54414 ]
We recently added locking to this function but one error path was over looked. Drop the lock before returning.
--- drivers/gpio/gpio-mxc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpio-mxc.c +2 -1
@@ -236,10 +236,11 @@ static void mxc_flip_edge(struct mxc_gpio_port *port, u32 gpio) }else {pr_err ("mxc: invalid configuration for GPIO %d: %x\n" , gpio, edge); -return ; + goto unlock; }writel (val | (edge << (bit <<1 )), reg); +unlock:raw_spin_unlock_irqrestore (&port->gc.bgpio_lock, flags); }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 286/313 gpio: ep93xx: Fix port F hwirq numbers in handler
In reply to Greg Kroah-HartmanFrom: Nikita Shubin <[email protected]>
[ Upstream commit 0f04cdbdb210000a97c773b28b598fa8ac3aafa4 ]
Fix wrong translation of irq numbers in port F handler, as ep93xx hwirqs increased by 1, we should simply decrease them by 1 in translation.
--- drivers/gpio/gpio-ep93xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-ep93xx.c +1 -1
@@ -148,7 +148,7 @@ static void ep93xx_gpio_f_irq_handler(struct irq_desc *desc)*/ struct irq_chip *irqchip =irq_desc_get_chip (desc);unsigned int irq =irq_desc_get_irq (desc); -int port_f_idx = ((irq +1 ) &7 ) ^4 ;/* {19..22,47..50} -> {0..7} */ +int port_f_idx = (irq &7 ) ^4 ;/* {20..23,48..51} -> {0..7} */ int gpio_irq =EP93XX_GPIO_F_IRQ_BASE + port_f_idx;chained_irq_enter (irqchip, desc);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 287/313 net: ravb: Fix lack of register setting after system resumed for Gen3
In reply to Greg Kroah-HartmanFrom: Yoshihiro Shimoda <[email protected]>
[ Upstream commit c2b6cdee1d13ffbb24baca3c9b8a572d6b541e4e ]
After system entered Suspend to RAM, registers setting of this hardware is reset because the SoC will be turned off. On R-Car Gen3 (info->ccc_gac), ravb_ptp_init() is called in ravb_probe() only. So, after system resumed, it lacks of the initial settings for ptp. So, add ravb_ptp_{init,stop}() into ravb_{resume,suspend}().
--- drivers/net/ethernet/renesas/ravb_main.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/renesas/ravb_main.c +6 -0
@@ -2973,6 +2973,9 @@ static int __maybe_unused ravb_suspend(struct device *dev)else ret =ravb_close (ndev); +if (priv->info->ccc_gac) +ravb_ptp_stop (ndev); +return ret; }
@@ -3011,6 +3014,9 @@ static int __maybe_unused ravb_resume(struct device *dev)/* Restore descriptor base address table */ ravb_write (ndev, priv->desc_bat_dma,DBAT ); +if (priv->info->ccc_gac) +ravb_ptp_init (ndev, priv->pdev); +if (netif_running (ndev)) {if (priv->wol_enabled) { ret =ravb_wol_restore (ndev);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 288/313 net: ravb: Fix possible hang if RIS2_QFF1 happen
In reply to Greg Kroah-HartmanFrom: Yoshihiro Shimoda <[email protected]>
[ Upstream commit f3c07758c9007a6bfff5290d9e19d3c41930c897 ]
Since this driver enables the interrupt by RIC2_QFE1, this driver should clear the interrupt flag if it happens. Otherwise, the interrupt causes to hang the system.
Note that this also fix a minor coding style (a comment indentation) around the fixed code.
--- drivers/net/ethernet/renesas/ravb_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/renesas/ravb_main.c +2 -2
@@ -1101,14 +1101,14 @@ static void ravb_error_interrupt(struct net_device *ndev)ravb_write (ndev, ~(EIS_QFS |EIS_RESERVED ),EIS );if (eis &EIS_QFS ) { ris2 =ravb_read (ndev,RIS2 ); -ravb_write (ndev, ~(RIS2_QFF0 |RIS2_RFFF |RIS2_RESERVED ), +ravb_write (ndev, ~(RIS2_QFF0 |RIS2_QFF1 |RIS2_RFFF |RIS2_RESERVED ),RIS2 );/* Receive Descriptor Empty int */ if (ris2 &RIS2_QFF0 ) priv->stats[RAVB_BE ].rx_over_errors++; -/* Receive Descriptor Empty int */ +/* Receive Descriptor Empty int */ if (ris2 &RIS2_QFF1 ) priv->stats[RAVB_NC ].rx_over_errors++;
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 289/313 net: mctp: add an explicit reference from a mctp_sk_key to sock
In reply to Greg Kroah-HartmanFrom: Jeremy Kerr <[email protected]>
[ Upstream commit de8a6b15d9654c3e4f672d76da9d9df8ee06331d ]
Currently, we correlate the mctp_sk_key lifetime to the sock lifetime through the sock hash/unhash operations, but this is pretty tenuous, and there are cases where we may have a temporary reference to an unhashed sk.
This change makes the reference more explicit, by adding a hold on the sock when it's associated with a mctp_sk_key, released on final key unref.
--- net/mctp/route.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
net/mctp/route.c +8 -6
@@ -147,6 +147,7 @@ static struct mctp_sk_key *mctp_key_alloc(struct mctp_sock *msk, key->valid = true;spin_lock_init (&key->lock);refcount_set (&key->refs,1 ); +sock_hold (key->sk);return key; }
@@ -165,6 +166,7 @@ void mctp_key_unref(struct mctp_sk_key *key)mctp_dev_release_key (key->dev, key);spin_unlock_irqrestore (&key->lock, flags); +sock_put (key->sk);kfree (key); }
@@ -419,14 +421,14 @@ static int mctp_route_input(struct mctp_route *route, struct sk_buff *skb)* this function. */ rc =mctp_key_add (key, msk); -if (rc) { -kfree (key); - }else { +if (!rc)trace_mctp_key_acquire (key); -/* we don't need to release key->lock on exit */ -mctp_key_unref (key); - } +/* we don't need to release key->lock on exit, so +* clean up here and suppress the unlock via +* setting to NULL +*/ +mctp_key_unref (key); key =NULL ; }else {
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 290/313 net: mctp: move expiry timer delete to unhash
In reply to Greg Kroah-HartmanFrom: Jeremy Kerr <[email protected]>
[ Upstream commit 5f41ae6fca9d40ab3cb9b0507931ef7a9b3ea50b ]
Currently, we delete the key expiry timer (in sk->close) before unhashing the sk. This means that another thread may find the sk through its presence on the key list, and re-queue the timer.
This change moves the timer deletion to the unhash, after we have made the key no longer observable, so the timer cannot be re-queued.
--- net/mctp/af_mctp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/mctp/af_mctp.c +6 -3
@@ -544,9 +544,6 @@ static int mctp_sk_init(struct sock *sk)static void mctp_sk_close (struct sock *sk,long timeout) { - struct mctp_sock *msk = container_of(sk, struct mctp_sock, sk); - -del_timer_sync (&msk->key_expiry);sk_common_release (sk); }
@@ -581,6 +578,12 @@ static void mctp_sk_unhash(struct sock *sk)__mctp_key_remove (key, net, fl2,MCTP_TRACE_KEY_CLOSED ); }spin_unlock_irqrestore (&net->mctp.keys_lock, flags); + +/* Since there are no more tag allocations (we have removed all of the +* keys), stop any pending expiry events. the timer cannot be re-queued +* as the sk is no longer observable +*/ +del_timer_sync (&msk->key_expiry); }static struct proto mctp_proto = {
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 291/313 net: mctp: hold key reference when looking up a general key
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit 6e54ea37e344f145665c2dc3cc534b92529e8de5 ]
Currently, we have a race where we look up a sock through a "general" (ie, not directly associated with the (src,dest,tag) tuple) key, then drop the key reference while still holding the key's sock.
This change expands the key reference until we've finished using the sock, and hence the sock reference too.
Commit message changes from Jeremy Kerr <[email protected]>.
--- net/mctp/route.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
net/mctp/route.c +7 -7
@@ -317,8 +317,8 @@ static int mctp_frag_queue(struct mctp_sk_key *key, struct sk_buff *skb)static int mctp_route_input (struct mctp_route *route,struct sk_buff *skb) { +struct mctp_sk_key *key, *any_key =NULL ;struct net *net =dev_net (skb->dev); -struct mctp_sk_key *key;struct mctp_sock *msk;struct mctp_hdr *mh;unsigned long f;
@@ -363,13 +363,11 @@ static int mctp_route_input(struct mctp_route *route, struct sk_buff *skb)* key for reassembly - we'll create a more specific * one for future packets if required (ie, !EOM). */ - key =mctp_lookup_key (net, skb,MCTP_ADDR_ANY , &f); -if (key) { - msk =container_of (key->sk, + any_key =mctp_lookup_key (net, skb,MCTP_ADDR_ANY , &f); +if (any_key) { + msk =container_of (any_key->sk, struct mctp_sock, sk); -spin_unlock_irqrestore (&key->lock, f); -mctp_key_unref (key); - key =NULL ; +spin_unlock_irqrestore (&any_key->lock, f); } }
@@ -475,6 +473,8 @@ static int mctp_route_input(struct mctp_route *route, struct sk_buff *skb)spin_unlock_irqrestore (&key->lock, f);mctp_key_unref (key); } +if (any_key) +mctp_key_unref (any_key); out:if (rc)kfree_skb (skb);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 292/313 net: mctp: mark socks as dead on unhash, prevent re-add
In reply to Greg Kroah-HartmanFrom: Jeremy Kerr <[email protected]>
[ Upstream commit b98e1a04e27fddfdc808bf46fe78eca30db89ab3 ]
Once a socket has been unhashed, we want to prevent it from being re-used in a sk_key entry as part of a routing operation.
This change marks the sk as SOCK_DEAD on unhash, which prevents addition into the net's key list.
We need to do this during the key add path, rather than key lookup, as we release the net keys_lock between those operations.
--- net/mctp/af_mctp.c | 1 + net/mctp/route.c | 6 ++++++ 2 files changed, 7 insertions(+)
net/mctp/af_mctp.c +1 -0
@@ -577,6 +577,7 @@ static void mctp_sk_unhash(struct sock *sk)spin_lock_irqsave (&key->lock, fl2);__mctp_key_remove (key, net, fl2,MCTP_TRACE_KEY_CLOSED ); } +sock_set_flag (sk,SOCK_DEAD );spin_unlock_irqrestore (&net->mctp.keys_lock, flags);/* Since there are no more tag allocations (we have removed all of the
net/mctp/route.c +6 -0
@@ -179,6 +179,11 @@ static int mctp_key_add(struct mctp_sk_key *key, struct mctp_sock *msk)spin_lock_irqsave (&net->mctp.keys_lock, flags); +if (sock_flag (&msk->sk,SOCK_DEAD )) { + rc = -EINVAL ; + goto out_unlock; + } +hlist_for_each_entry (tmp, &net->mctp.keys, hlist) {if (mctp_key_match (tmp, key->local_addr, key->peer_addr, key->tag)) {
@@ -200,6 +205,7 @@ static int mctp_key_add(struct mctp_sk_key *key, struct mctp_sock *msk)hlist_add_head (&key->sklist, &msk->keys); } +out_unlock:spin_unlock_irqrestore (&net->mctp.keys_lock, flags);return rc;
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 293/313 thermal: intel: int340x: Add locking to int340x_thermal_get_trip_type()
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit acd7e9ee57c880b99671dd99680cb707b7b5b0ee ]
In order to prevent int340x_thermal_get_trip_type() from possibly racing with int340x_thermal_read_trips() invoked by int3403_notify() add locking to it in analogy with int340x_thermal_get_trip_temp().
--- .../intel/int340x_thermal/int340x_thermal_zone.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +7 -3
@@ -81,11 +81,13 @@ static int int340x_thermal_get_trip_type(struct thermal_zone_device *zone, enum thermal_trip_type *type) {struct int34x_thermal_zone *d = zone->devdata; -int i; +int i, ret =0 ;if (d->override_ops && d->override_ops->get_trip_type)return d->override_ops->get_trip_type (zone, trip, type); +mutex_lock (&d->trip_mutex); +if (trip < d->aux_trip_nr) *type =THERMAL_TRIP_PASSIVE ;else if (trip == d->crt_trip_id)
@@ -103,10 +105,12 @@ static int int340x_thermal_get_trip_type(struct thermal_zone_device *zone, } }if (i ==INT340X_THERMAL_MAX_ACT_TRIP_COUNT ) -return -EINVAL ; + ret = -EINVAL ; } -return 0 ; +mutex_unlock (&d->trip_mutex); + +return ret; } static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone,
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 294/313 riscv: Move call to init_cpu_topology() to later initialization stage
In reply to Greg Kroah-HartmanFrom: Ley Foon Tan <[email protected]>
[ Upstream commit c1d6105869464635d8a2bcf87a43c05f4c0cfca4 ]
If "capacity-dmips-mhz" is present in a CPU DT node, topology_parse_cpu_capacity() will fail to allocate memory. arm64, with which this code path is shared, does not call topology_parse_cpu_capacity() until later in boot where memory allocation is available. While "capacity-dmips-mhz" is not yet a valid property on RISC-V, invalid properties should be ignored rather than cause issues. Move init_cpu_topology(), which calls topology_parse_cpu_capacity(), to a later initialization stage, to match arm64.
As a side effect of this change, RISC-V is "protected" from changes to core topology code that would work on arm64 where memory allocation is safe but on RISC-V isn't.
--- arch/riscv/kernel/smpboot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/riscv/kernel/smpboot.c +2 -1
@@ -39,7 +39,6 @@ static DECLARE_COMPLETION(cpu_running);void __init smp_prepare_boot_cpu (void ) { -init_cpu_topology (); }void __init smp_prepare_cpus (unsigned int max_cpus)
@@ -48,6 +47,8 @@ void __init smp_prepare_cpus(unsigned int max_cpus)int ret;unsigned int curr_cpuid; +init_cpu_topology (); + curr_cpuid =smp_processor_id ();store_cpu_topology (curr_cpuid);numa_store_cpu_info (curr_cpuid);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 295/313 net/tg3: resolve deadlock in tg3_reset_task() during EEH
In reply to Greg Kroah-HartmanFrom: David Christensen <[email protected]>
[ Upstream commit 6c4ca03bd890566d873e3593b32d034bf2f5a087 ]
During EEH error injection testing, a deadlock was encountered in the tg3 driver when tg3_io_error_detected() was attempting to cancel outstanding reset tasks:
crash> foreach UN bt
...
PID: 159 TASK: c0000000067c6000 CPU: 8 COMMAND: "eehd"
...
#5 [c00000000681f990] __cancel_work_timer at c00000000019fd18 #6 [c00000000681fa30] tg3_io_error_detected at c00800000295f098 [tg3] #7 [c00000000681faf0] eeh_report_error at c00000000004e25c
...
PID: 290 TASK: c000000036e5f800 CPU: 6 COMMAND: "kworker/6:1"
...
#4 [c00000003721fbc0] rtnl_lock at c000000000c940d8 #5 [c00000003721fbe0] tg3_reset_task at c008000002969358 [tg3] #6 [c00000003721fc60] process_one_work at c00000000019e5c4
...
PID: 296 TASK: c000000037a65800 CPU: 21 COMMAND: "kworker/21:1"
...
#4 [c000000037247bc0] rtnl_lock at c000000000c940d8 #5 [c000000037247be0] tg3_reset_task at c008000002969358 [tg3] #6 [c000000037247c60] process_one_work at c00000000019e5c4
...
PID: 655 TASK: c000000036f49000 CPU: 16 COMMAND: "kworker/16:2"
...:1
#4 [c0000000373ebbc0] rtnl_lock at c000000000c940d8 #5 [c0000000373ebbe0] tg3_reset_task at c008000002969358 [tg3] #6 [c0000000373ebc60] process_one_work at c00000000019e5c4
...
Code inspection shows that both tg3_io_error_detected() and tg3_reset_task() attempt to acquire the RTNL lock at the beginning of their code blocks. If tg3_reset_task() should happen to execute between the times when tg3_io_error_deteced() acquires the RTNL lock and tg3_reset_task_cancel() is called, a deadlock will occur.
Moving tg3_reset_task_cancel() call earlier within the code block, prior to acquiring RTNL, prevents this from happening, but also exposes another deadlock issue where tg3_reset_task() may execute AFTER tg3_io_error_detected() has executed:
crash> foreach UN bt
PID: 159 TASK: c0000000067d2000 CPU: 9 COMMAND: "eehd"
...
#4 [c000000006867a60] rtnl_lock at c000000000c940d8
#5 [c000000006867a80] tg3_io_slot_reset at c0080000026c2ea8 [tg3] #6 [c000000006867b00] eeh_report_reset at c00000000004de88
...
PID: 363 TASK: c000000037564000 CPU: 6 COMMAND: "kworker/6:1"
...
#3 [c000000036c1bb70] msleep at c000000000259e6c
#4 [c000000036c1bba0] napi_disable at c000000000c6b848 #5 [c000000036c1bbe0] tg3_reset_task at c0080000026d942c [tg3] #6 [c000000036c1bc60] process_one_work at c00000000019e5c4
...
This issue can be avoided by aborting tg3_reset_task() if EEH error recovery is already in progress.
--- drivers/net/ethernet/broadcom/tg3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +4 -4
@@ -11174,7 +11174,7 @@ static void tg3_reset_task(struct work_struct *work)rtnl_lock ();tg3_full_lock (tp,0 ); -if (!netif_running (tp->dev)) { +if (tp->pcierr_recovery || !netif_running (tp->dev)) {tg3_flag_clear (tp,RESET_TASK_PENDING );tg3_full_unlock (tp);rtnl_unlock ();
@@ -18109,6 +18109,9 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev,netdev_info (netdev,"PCI I/O error detected\n" ); +/* Want to make sure that the reset task doesn't run */ +tg3_reset_task_cancel (tp); +rtnl_lock ();/* Could be second call or maybe we don't have netdev yet */
@@ -18125,9 +18128,6 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev,tg3_timer_stop (tp); -/* Want to make sure that the reset task doesn't run */ -tg3_reset_task_cancel (tp); -netif_device_detach (netdev);/* Clean up software state, even if MMIO is blocked */
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 296/313 tsnep: Fix TX queue stop/wake for multiple queues
In reply to Greg Kroah-HartmanFrom: Gerhard Engleder <[email protected]>
[ Upstream commit 3d53aaef4332245044b2f3688ac0ea10436c719c ]
netif_stop_queue() and netif_wake_queue() act on TX queue 0. This is ok as long as only a single TX queue is supported. But support for multiple TX queues was introduced with 762031375d5c and I missed to adapt stop and wake of TX queues.
Use netif_stop_subqueue() and netif_tx_wake_queue() to act on specific TX queue.
--- drivers/net/ethernet/engleder/tsnep_main.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/net/ethernet/engleder/tsnep_main.c +9 -6
@@ -419,7 +419,7 @@ static netdev_tx_t tsnep_xmit_frame_ring(struct sk_buff *skb,/* ring full, shall not happen because queue is stopped if full * below */ -netif_stop_queue (tx->adapter->netdev); +netif_stop_subqueue (tx->adapter->netdev, tx->queue_index);spin_unlock_irqrestore (&tx->lock, flags);
@@ -462,7 +462,7 @@ static netdev_tx_t tsnep_xmit_frame_ring(struct sk_buff *skb,if (tsnep_tx_desc_available (tx) < (MAX_SKB_FRAGS +1 )) {/* ring can get full with next frame */ -netif_stop_queue (tx->adapter->netdev); +netif_stop_subqueue (tx->adapter->netdev, tx->queue_index); }spin_unlock_irqrestore (&tx->lock, flags);
@@ -472,11 +472,14 @@ static netdev_tx_t tsnep_xmit_frame_ring(struct sk_buff *skb,static bool tsnep_tx_poll (struct tsnep_tx *tx,int napi_budget) { +struct tsnep_tx_entry *entry; +struct netdev_queue *nq;unsigned long flags;int budget =128 ; -struct tsnep_tx_entry *entry; -int count;int length; +int count; + + nq =netdev_get_tx_queue (tx->adapter->netdev, tx->queue_index);spin_lock_irqsave (&tx->lock, flags);
@@ -533,8 +536,8 @@ static bool tsnep_tx_poll(struct tsnep_tx *tx, int napi_budget) }while (likely (budget));if ((tsnep_tx_desc_available (tx) >= ((MAX_SKB_FRAGS +1 ) *2 )) && -netif_queue_stopped (tx->adapter->netdev)) { -netif_wake_queue (tx->adapter->netdev); +netif_tx_queue_stopped (nq)) { +netif_tx_wake_queue (nq); }spin_unlock_irqrestore (&tx->lock, flags);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 297/313 net: mdio-mux-meson-g12a: force internal PHY off on mux switch
In reply to Greg Kroah-HartmanFrom: Jerome Brunet <[email protected]>
[ Upstream commit 7083df59abbc2b7500db312cac706493be0273ff ]
Force the internal PHY off then on when switching to the internal path. This fixes problems where the PHY ID is not properly set.
--- drivers/net/mdio/mdio-mux-meson-g12a.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/net/mdio/mdio-mux-meson-g12a.c +16 -7
@@ -4,6 +4,7 @@*/ #include <linux/bitfield.h> +#include <linux/delay.h> #include <linux/clk.h> #include <linux/clk-provider.h> #include <linux/device.h>
@@ -150,6 +151,7 @@ static const struct clk_ops g12a_ephy_pll_ops = {static int g12a_enable_internal_mdio (struct g12a_mdio_mux *priv) { +u32 value;int ret;/* Enable the phy clock */
@@ -163,18 +165,25 @@ static int g12a_enable_internal_mdio(struct g12a_mdio_mux *priv)/* Initialize ephy control */ writel (EPHY_G12A_ID , priv->regs +ETH_PHY_CNTL0 ); -writel (FIELD_PREP (PHY_CNTL1_ST_MODE ,3 ) | -FIELD_PREP (PHY_CNTL1_ST_PHYADD ,EPHY_DFLT_ADD ) | -FIELD_PREP (PHY_CNTL1_MII_MODE ,EPHY_MODE_RMII ) | -PHY_CNTL1_CLK_EN | -PHY_CNTL1_CLKFREQ | -PHY_CNTL1_PHY_ENB , - priv->regs +ETH_PHY_CNTL1 ); + +/* Make sure we get a 0 -> 1 transition on the enable bit */ + value =FIELD_PREP (PHY_CNTL1_ST_MODE ,3 ) | +FIELD_PREP (PHY_CNTL1_ST_PHYADD ,EPHY_DFLT_ADD ) | +FIELD_PREP (PHY_CNTL1_MII_MODE ,EPHY_MODE_RMII ) | +PHY_CNTL1_CLK_EN | +PHY_CNTL1_CLKFREQ ; +writel (value, priv->regs +ETH_PHY_CNTL1 );writel (PHY_CNTL2_USE_INTERNAL |PHY_CNTL2_SMI_SRC_MAC |PHY_CNTL2_RX_CLK_EPHY , priv->regs +ETH_PHY_CNTL2 ); + value |=PHY_CNTL1_PHY_ENB ; +writel (value, priv->regs +ETH_PHY_CNTL1 ); + +/* The phy needs a bit of time to power up */ +mdelay (10 ); +return 0 ; }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 298/313 Partially revert "perf/arm-cmn: Optimise DTC counter accesses"
In reply to Greg Kroah-HartmanFrom: Robin Murphy <[email protected]>
[ Upstream commit a428eb4b99ab80454f06ad256b25e930fe8a4954 ]
It turns out the optimisation implemented by commit 4f2c3872dde5 is totally broken, since all the places that consume hw->dtcs_used for events other than cycle count are still not expecting it to be sparsely populated, and fail to read all the relevant DTC counters correctly if so.
If implemented correctly, the optimisation potentially saves up to 3 register reads per event update, which is reasonably significant for events targeting a single node, but still not worth a massive amount of additional code complexity overall. Getting it right within the current design looks a fair bit more involved than it was ever intended to be, so let's just make a functional revert which restores the old behaviour while still backporting easily.
--- drivers/perf/arm-cmn.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/perf/arm-cmn.c +6 -1
@@ -1576,7 +1576,6 @@ static int arm_cmn_event_init(struct perf_event *event) hw->dn++;continue ; } - hw->dtcs_used |=arm_cmn_node_to_xp (cmn, dn)->dtc; hw->num_dns++;if (bynodeid)break ;
@@ -1589,6 +1588,12 @@ static int arm_cmn_event_init(struct perf_event *event) nodeid, nid.x, nid.y, nid.port, nid.dev, type);return -EINVAL ; } +/* +* Keep assuming non-cycles events count in all DTC domains; turns out +* it's hard to make a worthwhile optimisation around this, short of +* going all-in with domain-local counter allocation as well. +*/ + hw->dtcs_used = (1U << cmn->num_dtcs) -1 ;return arm_cmn_validate_group (cmn, event); }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 299/313 block: ublk: move ublk_chr_class destroying after devices are removed
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
[ Upstream commit 8e4ff684762b6503db45e8906e258faee080c336 ]
The 'ublk_chr_class' is needed when deleting ublk char devices in ublk_exit(), so move it after devices(idle) are removed.
Fixes the following warning reported by Harris, James R:
[ 859.178950] sysfs group 'power' not found for kobject 'ublkc0' [ 859.178962] WARNING: CPU: 3 PID: 1109 at fs/sysfs/group.c:278 sysfs_remove_group+0x9c/0xb0
--- drivers/block/ublk_drv.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/block/ublk_drv.c +3 -4
@@ -2092,13 +2092,12 @@ static void __exit ublk_exit(void)struct ublk_device *ub;int id; -class_destroy (ublk_chr_class); - -misc_deregister (&ublk_misc); -idr_for_each_entry (&ublk_index_idr, ub, id)ublk_remove (ub); +class_destroy (ublk_chr_class); +misc_deregister (&ublk_misc); +idr_destroy (&ublk_index_idr);unregister_chrdev_region (ublk_chr_devt,UBLK_MINORS ); }
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 300/313 treewide: fix up files incorrectly marked executable
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
[ Upstream commit 262b42e02d1e0b5ad1b33e9b9842e178c16231de ]
I'm not exactly clear on what strange workflow causes people to do it, but clearly occasionally some files end up being committed as executable even though they clearly aren't.
This is a reprise of commit 90fda63fa115 ("treewide: fix up files incorrectly marked executable"), just with a different set of files (but with the same trivial shell scripting).
So apparently we need to re-do this every five years or so, and Joe needs to just keep reminding me to do so ;)
--- drivers/gpu/drm/vmwgfx/vmwgfx_msg_arm64.h | 0 sound/soc/codecs/es8326.c | 0 sound/soc/codecs/es8326.h | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 drivers/gpu/drm/vmwgfx/vmwgfx_msg_arm64.h mode change 100755 => 100644 sound/soc/codecs/es8326.c mode change 100755 => 100644 sound/soc/codecs/es8326.h
drivers/gpu/drm/vmwgfx/vmwgfx_msg_arm64.h +0 -0
sound/soc/codecs/es8326.c +0 -0
sound/soc/codecs/es8326.h +0 -0
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 301/313 tools: gpio: fix -c option of gpio-event-mon
In reply to Greg Kroah-HartmanFrom: Ivo Borisov Shopov <[email protected]>
[ Upstream commit 677d85e1a1ee69fa05ccea83847309484be3781c ]
Following line should listen for a rising edge and exit after the first one since '-c 1' is provided.
# gpio-event-mon -n gpiochip1 -o 0 -r -c 1
It works with kernel 4.19 but it doesn't work with 5.10. In 5.10 the above command doesn't exit after the first rising edge it keep listening for an event forever. The '-c 1' is not taken into an account. The problem is in commit 62757c32d5db ("tools: gpio: add multi-line monitoring to gpio-event-mon").
Before this commit the iterator 'i' in monitor_device() is used for counting of the events (loops). In the case of the above command (-c 1) we should start from 0 and increment 'i' only ones and hit the 'break' statement and exit the process. But after the above commit counting doesn't start from 0, it start from 1 when we listen on one line. It is because 'i' is used from one more purpose, counting of lines (num_lines) and it isn't restore to 0 after following code
for (i = 0; i < num_lines; i++)
gpiotools_set_bit(&values.mask, i);Restore the initial value of the iterator to 0 in order to allow counting of loops to work for any cases.
--- tools/gpio/gpio-event-mon.c | 1 + 1 file changed, 1 insertion(+)
tools/gpio/gpio-event-mon.c +1 -0
@@ -86,6 +86,7 @@ int monitor_device(const char *device_name, gpiotools_test_bit(values.bits, i)); } + i =0 ;while (1 ) {struct gpio_v2_line_event event;
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 302/313 Fix up more non-executable files marked executable
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
[ Upstream commit c96618275234ad03d44eafe9f8844305bb44fda4 ]
Joe found another DT file that shouldn't be executable, and that frustrated me enough that I went hunting with this script:
git ls-files -s |
grep '^100755' |
cut -f2 |
xargs grep -L '^#!'and that found another file that shouldn't have been marked executable either, despite being in the scripts directory.
Maybe these two are the last ones at least for now. But I'm sure we'll be back in a few years, fixing things up again.
--- Documentation/devicetree/bindings/sound/everest,es8326.yaml | 0 scripts/atomic/atomics.tbl | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 Documentation/devicetree/bindings/sound/everest,es8326.yaml mode change 100755 => 100644 scripts/atomic/atomics.tbl
Documentation/devicetree/bindings/sound/everest,es8326.yaml +0 -0
scripts/atomic/atomics.tbl +0 -0
Signature · 1 line
2.39.0