From 0243550cfd4198d31ea5190d6b4da69ee674f79d Mon Sep 17 00:00:00 2001 From: Kernel Build Daemon Date: Jan 25 2023 06:50:08 +0000 Subject: Merge branch 'SLE15-SP5' into SLE15-SP5-AZURE --- diff --git a/blacklist.conf b/blacklist.conf index 55ac359..e928413 100644 --- a/blacklist.conf +++ b/blacklist.conf @@ -466,5 +466,5 @@ e92ab4eda516a5bfd96c087282ebe9521deba4f4 # requires commits/kABIs not present b57b08e6f431348363adffa5b6643fe3ec9dc7fe # misattributed. Introduced in e81e7f9a0eb9536d5976acf5d95290338032a198 c033a38a81bc539d6c0db8c5387e0b14d819a0cf # misattributed. Introduced in 8c89f7b3d3f2880c57b0bc96c72ccd98fe354399 66ca1a7b2d5503f561b751abdd6ec6fa96343eb6 # support for this chip has not been added to SP4 -10cb21f4ff3f9cb36d1e1c39bf80426f02f4986a # prerequisites break kABI 2f3f53d62307262f0086804ea7cea99b0e085450 # unnecessary docs update +803abfd8dda540b94ea3c754a70cba69d3825995 # not applicable diff --git a/patches.suse/0001-drm-amdgpu-don-t-use-BACO-for-reset-in-S3.patch b/patches.suse/0001-drm-amdgpu-don-t-use-BACO-for-reset-in-S3.patch new file mode 100644 index 0000000..1eff43c --- /dev/null +++ b/patches.suse/0001-drm-amdgpu-don-t-use-BACO-for-reset-in-S3.patch @@ -0,0 +1,45 @@ +From 34452ac3038a7dea7e5407c0f06f762412e679f3 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Fri, 25 Mar 2022 11:53:39 -0400 +Subject: drm/amdgpu: don't use BACO for reset in S3 +Git-commit: 34452ac3038a7dea7e5407c0f06f762412e679f3 +Patch-mainline: v5.19-rc1 +References: git-fixes + +Seems to cause a reboots or hangs on some systems. + +Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1924 +Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1953 +Fixes: daf8de0874ab5b ("drm/amdgpu: always reset the asic in suspend (v2)") +Reviewed-by: Lijo Lazar +Signed-off-by: Alex Deucher +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c +index c73fb73e9628..5504d81c77b7 100644 +--- a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c ++++ b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c +@@ -173,6 +173,17 @@ bool amdgpu_dpm_is_baco_supported(struct amdgpu_device *adev) + + if (!pp_funcs || !pp_funcs->get_asic_baco_capability) + return false; ++ /* Don't use baco for reset in S3. ++ * This is a workaround for some platforms ++ * where entering BACO during suspend ++ * seems to cause reboots or hangs. ++ * This might be related to the fact that BACO controls ++ * power to the whole GPU including devices like audio and USB. ++ * Powering down/up everything may adversely affect these other ++ * devices. Needs more investigation. ++ */ ++ if (adev->in_s3) ++ return false; + + mutex_lock(&adev->pm.mutex); + +-- +2.39.0 + diff --git a/patches.suse/0496-drm-amd-display-DIG-mapping-change-is-causing-a-bloc.patch b/patches.suse/0496-drm-amd-display-DIG-mapping-change-is-causing-a-bloc.patch index 37f57ca..b6eab4a 100644 --- a/patches.suse/0496-drm-amd-display-DIG-mapping-change-is-causing-a-bloc.patch +++ b/patches.suse/0496-drm-amd-display-DIG-mapping-change-is-causing-a-bloc.patch @@ -3,6 +3,7 @@ From: "Liu, Zhan" Date: Fri, 10 Sep 2021 14:50:08 -0400 Subject: drm/amd/display: DIG mapping change is causing a blocker Git-commit: 05408f24ecc47df5fbf69ae563237ec47d43a32f +Alt-commit: 1039188806d4cfdf9c412bb4ddb51b4d8cd15478 Patch-mainline: v5.16-rc1 References: jsc#PED-1166 jsc#PED-1168 jsc#PED-1170 jsc#PED-1218 jsc#PED-1220 jsc#PED-1222 jsc#PED-1223 jsc#PED-1225 diff --git a/patches.suse/1626-drm-i915-Set-correct-domains-values-at-_i915_vma_mov.patch b/patches.suse/1626-drm-i915-Set-correct-domains-values-at-_i915_vma_mov.patch index 627f11f..01eca27 100644 --- a/patches.suse/1626-drm-i915-Set-correct-domains-values-at-_i915_vma_mov.patch +++ b/patches.suse/1626-drm-i915-Set-correct-domains-values-at-_i915_vma_mov.patch @@ -5,6 +5,7 @@ Subject: drm/i915: Set correct domains values at _i915_vma_move_to_active Git-commit: 08b812985996924c0ccf79d54a31fc9757c0a6ca Patch-mainline: v6.0-rc6 References: jsc#PED-1166 jsc#PED-1168 jsc#PED-1170 jsc#PED-1218 jsc#PED-1220 jsc#PED-1222 jsc#PED-1223 jsc#PED-1225 jsc#PED-2849 +Alt-commit: 04f7eb3d4582a0a4da67c86e55fda7de2df86d91 Fix regression introduced by commit: "drm/i915: Individualize fences before adding to dma_resv obj" diff --git a/patches.suse/1845-drm-bridge-fsl-ldb-Drop-DE-signal-polarity-inversion.patch b/patches.suse/1845-drm-bridge-fsl-ldb-Drop-DE-signal-polarity-inversion.patch index 2ac228e..bedf7c6 100644 --- a/patches.suse/1845-drm-bridge-fsl-ldb-Drop-DE-signal-polarity-inversion.patch +++ b/patches.suse/1845-drm-bridge-fsl-ldb-Drop-DE-signal-polarity-inversion.patch @@ -3,6 +3,7 @@ From: Liu Ying Date: Fri, 1 Jul 2022 14:56:34 +0800 Subject: drm/bridge: fsl-ldb: Drop DE signal polarity inversion Git-commit: 1dbc790b4d416dacb124a6acd05f88a0bcf3be39 +Alt-commit: 47a4fb46797016228198e63a7aa679841f80889c Patch-mainline: v5.19-rc7 References: jsc#PED-1166 jsc#PED-1168 jsc#PED-1170 jsc#PED-1218 jsc#PED-1220 jsc#PED-1222 jsc#PED-1223 jsc#PED-1225 diff --git a/patches.suse/Revert-drm-amd-display-Enable-Freesync-Video-Mode-by.patch b/patches.suse/Revert-drm-amd-display-Enable-Freesync-Video-Mode-by.patch new file mode 100644 index 0000000..228520b --- /dev/null +++ b/patches.suse/Revert-drm-amd-display-Enable-Freesync-Video-Mode-by.patch @@ -0,0 +1,138 @@ +From 6fe6ece398f7431784847e922a2c8c385dc58a35 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michel=20D=C3=A4nzer?= +Date: Wed, 21 Dec 2022 16:24:13 +0100 +Subject: Revert "drm/amd/display: Enable Freesync Video Mode by default" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Git-commit: 6fe6ece398f7431784847e922a2c8c385dc58a35 +Patch-mainline: v6.2-rc3 +References: git-fixes + +This reverts commit de05abe6b9d0fe08f65d744f7f75a4cba4df27ad. + +The bug referenced below was bisected to this commit. There has been no +activity toward fixing it in 3 months, so let's revert for now. + +Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2162 +Signed-off-by: Michel Dänzer +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 27 +++++++++++++++++++ + .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 12 +++++---- + 3 files changed, 35 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h +index 6b74df446694..e3e2e6e3b485 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h +@@ -195,6 +195,7 @@ extern int amdgpu_emu_mode; + extern uint amdgpu_smu_memory_pool_size; + extern int amdgpu_smu_pptable_id; + extern uint amdgpu_dc_feature_mask; ++extern uint amdgpu_freesync_vid_mode; + extern uint amdgpu_dc_debug_mask; + extern uint amdgpu_dc_visual_confirm; + extern uint amdgpu_dm_abm_level; +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +index b4f2d61ea0d5..1353ffd08988 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +@@ -181,6 +181,7 @@ int amdgpu_mes_kiq; + int amdgpu_noretry = -1; + int amdgpu_force_asic_type = -1; + int amdgpu_tmz = -1; /* auto */ ++uint amdgpu_freesync_vid_mode; + int amdgpu_reset_method = -1; /* auto */ + int amdgpu_num_kcq = -1; + int amdgpu_smartshift_bias; +@@ -879,6 +880,32 @@ module_param_named(backlight, amdgpu_backlight, bint, 0444); + MODULE_PARM_DESC(tmz, "Enable TMZ feature (-1 = auto (default), 0 = off, 1 = on)"); + module_param_named(tmz, amdgpu_tmz, int, 0444); + ++/** ++ * DOC: freesync_video (uint) ++ * Enable the optimization to adjust front porch timing to achieve seamless ++ * mode change experience when setting a freesync supported mode for which full ++ * modeset is not needed. ++ * ++ * The Display Core will add a set of modes derived from the base FreeSync ++ * video mode into the corresponding connector's mode list based on commonly ++ * used refresh rates and VRR range of the connected display, when users enable ++ * this feature. From the userspace perspective, they can see a seamless mode ++ * change experience when the change between different refresh rates under the ++ * same resolution. Additionally, userspace applications such as Video playback ++ * can read this modeset list and change the refresh rate based on the video ++ * frame rate. Finally, the userspace can also derive an appropriate mode for a ++ * particular refresh rate based on the FreeSync Mode and add it to the ++ * connector's mode list. ++ * ++ * Note: This is an experimental feature. ++ * ++ * The default value: 0 (off). ++ */ ++MODULE_PARM_DESC( ++ freesync_video, ++ "Enable freesync modesetting optimization feature (0 = off (default), 1 = on)"); ++module_param_named(freesync_video, amdgpu_freesync_vid_mode, uint, 0444); ++ + /** + * DOC: reset_method (int) + * GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco) +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +index 86bc23a67d97..1b7f20a9d4ae 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -5835,7 +5835,8 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, + */ + DRM_DEBUG_DRIVER("No preferred mode found\n"); + } else { +- recalculate_timing = is_freesync_video_mode(&mode, aconnector); ++ recalculate_timing = amdgpu_freesync_vid_mode && ++ is_freesync_video_mode(&mode, aconnector); + if (recalculate_timing) { + freesync_mode = get_highest_refresh_rate_mode(aconnector, false); + drm_mode_copy(&saved_mode, &mode); +@@ -6986,7 +6987,7 @@ static void amdgpu_dm_connector_add_freesync_modes(struct drm_connector *connect + struct amdgpu_dm_connector *amdgpu_dm_connector = + to_amdgpu_dm_connector(connector); + +- if (!edid) ++ if (!(amdgpu_freesync_vid_mode && edid)) + return; + + if (amdgpu_dm_connector->max_vfreq - amdgpu_dm_connector->min_vfreq > 10) +@@ -8850,7 +8851,8 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, + * TODO: Refactor this function to allow this check to work + * in all conditions. + */ +- if (dm_new_crtc_state->stream && ++ if (amdgpu_freesync_vid_mode && ++ dm_new_crtc_state->stream && + is_timing_unchanged_for_freesync(new_crtc_state, old_crtc_state)) + goto skip_modeset; + +@@ -8885,7 +8887,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, + if (!dm_old_crtc_state->stream) + goto skip_modeset; + +- if (dm_new_crtc_state->stream && ++ if (amdgpu_freesync_vid_mode && dm_new_crtc_state->stream && + is_timing_unchanged_for_freesync(new_crtc_state, + old_crtc_state)) { + new_crtc_state->mode_changed = false; +@@ -8897,7 +8899,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, + set_freesync_fixed_config(dm_new_crtc_state); + + goto skip_modeset; +- } else if (aconnector && ++ } else if (amdgpu_freesync_vid_mode && aconnector && + is_freesync_video_mode(&new_crtc_state->mode, + aconnector)) { + struct drm_display_mode *high_mode; +-- +2.39.0 + diff --git a/patches.suse/drm-amd-display-Fix-DPIA-outbox-timeout-after-S3-S4-.patch b/patches.suse/drm-amd-display-Fix-DPIA-outbox-timeout-after-S3-S4-.patch index e34e740..c5e2a41 100644 --- a/patches.suse/drm-amd-display-Fix-DPIA-outbox-timeout-after-S3-S4-.patch +++ b/patches.suse/drm-amd-display-Fix-DPIA-outbox-timeout-after-S3-S4-.patch @@ -5,6 +5,7 @@ Subject: drm/amd/display: Fix DPIA outbox timeout after S3/S4/reset Git-commit: af6902ec415655236adea91826bd96ed0ab16f42 Patch-mainline: v5.16-rc5 References: jsc#PED-1166 jsc#PED-1168 jsc#PED-1170 jsc#PED-1218 jsc#PED-1220 jsc#PED-1222 jsc#PED-1223 jsc#PED-1225 +Alt-commit: be1ac692c08971486d68a88f39fc4e2cecb80a8e [Why] The HW interrupt gets disabled after S3/S4/reset so we don't receive diff --git a/patches.suse/drm-amd-display-delete-the-duplicate-.set_odm_bypass.patch b/patches.suse/drm-amd-display-delete-the-duplicate-.set_odm_bypass.patch new file mode 100644 index 0000000..e160a19 --- /dev/null +++ b/patches.suse/drm-amd-display-delete-the-duplicate-.set_odm_bypass.patch @@ -0,0 +1,36 @@ +From fe6d2ca6f3f806f2f03e961d80cdbf27073868c8 Mon Sep 17 00:00:00 2001 +From: Liu Jian +Date: Wed, 9 Nov 2022 17:31:22 +0800 +Subject: drm/amd/display: delete the duplicate .set_odm_bypass initialization + in dcn314_tg_funcs +Git-commit: fe6d2ca6f3f806f2f03e961d80cdbf27073868c8 +Patch-mainline: v6.2-rc1 +References: git-fixes + +Fix below sparse warning: +drivers/gpu/drm/amd/amdgpu/../display/dc/dcn314/dcn314_optc.c:244:18: warning: Initializer entry defined twice +drivers/gpu/drm/amd/amdgpu/../display/dc/dcn314/dcn314_optc.c:257:18: also defined here + +Fixes: 5ade1b951dec ("drm/amd/display: Add OTG/ODM functions") +Signed-off-by: Liu Jian +Signed-off-by: Alex Deucher +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/amd/display/dc/dcn314/dcn314_optc.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_optc.c b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_optc.c +index 47eb162f1a75..58d38de6a0f8 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_optc.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_optc.c +@@ -241,7 +241,6 @@ static struct timing_generator_funcs dcn314_tg_funcs = { + .set_dsc_config = optc3_set_dsc_config, + .get_dsc_status = optc2_get_dsc_status, + .set_dwb_source = NULL, +- .set_odm_bypass = optc3_set_odm_bypass, + .set_odm_combine = optc314_set_odm_combine, + .get_optc_source = optc2_get_optc_source, + .set_out_mux = optc3_set_out_mux, +-- +2.39.0 + diff --git a/patches.suse/drm-amd-pm-avoid-large-variable-on-kernel-stack.patch b/patches.suse/drm-amd-pm-avoid-large-variable-on-kernel-stack.patch new file mode 100644 index 0000000..646da2f --- /dev/null +++ b/patches.suse/drm-amd-pm-avoid-large-variable-on-kernel-stack.patch @@ -0,0 +1,89 @@ +From d118b18fb1da02b41df2da78cb2794b3638d89cd Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Thu, 15 Dec 2022 17:36:31 +0100 +Subject: drm/amd/pm: avoid large variable on kernel stack +Git-commit: d118b18fb1da02b41df2da78cb2794b3638d89cd +Patch-mainline: v6.2-rc1 +References: git-fixes + +The activity_monitor_external[] array is too big to fit on the +kernel stack, resulting in this warning with clang: + +drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_7_ppt.c:1438:12: error: stack frame size (1040) exceeds limit (1024) in 'smu_v13_0_7_get_power_profile_mode' [-Werror,-Wframe-larger-than] + +Use dynamic allocation instead. It should also be possible to +have single element here instead of the array, but this seems +easier. + +v2: fix up argument to sizeof() (Alex) + +Fixes: 334682ae8151 ("drm/amd/pm: enable workload type change on smu_v13_0_7") +Signed-off-by: Arnd Bergmann +Signed-off-by: Alex Deucher +Acked-by: Patrik Jakobsson +--- + .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 21 ++++++++++++++----- + 1 file changed, 16 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +index ab1c004606be..07e3dc18c8b8 100644 +--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c ++++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +@@ -1440,7 +1440,7 @@ static int smu_v13_0_7_get_power_limit(struct smu_context *smu, + + static int smu_v13_0_7_get_power_profile_mode(struct smu_context *smu, char *buf) + { +- DpmActivityMonitorCoeffIntExternal_t activity_monitor_external[PP_SMC_POWER_PROFILE_COUNT]; ++ DpmActivityMonitorCoeffIntExternal_t *activity_monitor_external; + uint32_t i, j, size = 0; + int16_t workload_type = 0; + int result = 0; +@@ -1448,6 +1448,12 @@ static int smu_v13_0_7_get_power_profile_mode(struct smu_context *smu, char *buf + if (!buf) + return -EINVAL; + ++ activity_monitor_external = kcalloc(PP_SMC_POWER_PROFILE_COUNT, ++ sizeof(*activity_monitor_external), ++ GFP_KERNEL); ++ if (!activity_monitor_external) ++ return -ENOMEM; ++ + size += sysfs_emit_at(buf, size, " "); + for (i = 0; i <= PP_SMC_POWER_PROFILE_WINDOW3D; i++) + size += sysfs_emit_at(buf, size, "%-14s%s", amdgpu_pp_profile_name[i], +@@ -1460,15 +1466,17 @@ static int smu_v13_0_7_get_power_profile_mode(struct smu_context *smu, char *buf + workload_type = smu_cmn_to_asic_specific_index(smu, + CMN2ASIC_MAPPING_WORKLOAD, + i); +- if (workload_type < 0) +- return -EINVAL; ++ if (workload_type < 0) { ++ result = -EINVAL; ++ goto out; ++ } + + result = smu_cmn_update_table(smu, + SMU_TABLE_ACTIVITY_MONITOR_COEFF, workload_type, + (void *)(&activity_monitor_external[i]), false); + if (result) { + dev_err(smu->adev->dev, "[%s] Failed to get activity monitor!", __func__); +- return result; ++ goto out; + } + } + +@@ -1496,7 +1504,10 @@ do { \ + PRINT_DPM_MONITOR(Fclk_BoosterFreq); + #undef PRINT_DPM_MONITOR + +- return size; ++ result = size; ++out: ++ kfree(activity_monitor_external); ++ return result; + } + + static int smu_v13_0_7_set_power_profile_mode(struct smu_context *smu, long *input, uint32_t size) +-- +2.39.0 + diff --git a/patches.suse/drm-amdgpu-Revert-drm-amdgpu-getting-fan-speed-pwm-f.patch b/patches.suse/drm-amdgpu-Revert-drm-amdgpu-getting-fan-speed-pwm-f.patch new file mode 100644 index 0000000..0d9987b --- /dev/null +++ b/patches.suse/drm-amdgpu-Revert-drm-amdgpu-getting-fan-speed-pwm-f.patch @@ -0,0 +1,65 @@ +From e5b781c56d46c44c52caa915f1b65064f2f7c1ba Mon Sep 17 00:00:00 2001 +From: Asher Song +Date: Fri, 14 Oct 2022 11:36:33 +0800 +Subject: drm/amdgpu: Revert "drm/amdgpu: getting fan speed pwm for vega10 + properly" +Git-commit: e5b781c56d46c44c52caa915f1b65064f2f7c1ba +Patch-mainline: v6.2-rc1 +References: git-fixes + +This reverts commit 16fb4dca95daa9d8e037201166a58de8284f4268. + +Unfortunately, that commit causes fan monitors can't be read and written +properly. + +Fixes: 16fb4dca95daa9 ("drm/amdgpu: getting fan speed pwm for vega10 properly") +Signed-off-by: Asher Song +Reviewed-by: Guchun Chen +Signed-off-by: Alex Deucher +Acked-by: Patrik Jakobsson +--- + .../amd/pm/powerplay/hwmgr/vega10_thermal.c | 25 ++++++++++--------- + 1 file changed, 13 insertions(+), 12 deletions(-) + +diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c +index 190af79f3236..dad3e3741a4e 100644 +--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c ++++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_thermal.c +@@ -67,21 +67,22 @@ int vega10_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr, + int vega10_fan_ctrl_get_fan_speed_pwm(struct pp_hwmgr *hwmgr, + uint32_t *speed) + { +- struct amdgpu_device *adev = hwmgr->adev; +- uint32_t duty100, duty; +- uint64_t tmp64; ++ uint32_t current_rpm; ++ uint32_t percent = 0; + +- duty100 = REG_GET_FIELD(RREG32_SOC15(THM, 0, mmCG_FDO_CTRL1), +- CG_FDO_CTRL1, FMAX_DUTY100); +- duty = REG_GET_FIELD(RREG32_SOC15(THM, 0, mmCG_THERMAL_STATUS), +- CG_THERMAL_STATUS, FDO_PWM_DUTY); ++ if (hwmgr->thermal_controller.fanInfo.bNoFan) ++ return 0; + +- if (!duty100) +- return -EINVAL; ++ if (vega10_get_current_rpm(hwmgr, ¤t_rpm)) ++ return -1; ++ ++ if (hwmgr->thermal_controller. ++ advanceFanControlParameters.usMaxFanRPM != 0) ++ percent = current_rpm * 255 / ++ hwmgr->thermal_controller. ++ advanceFanControlParameters.usMaxFanRPM; + +- tmp64 = (uint64_t)duty * 255; +- do_div(tmp64, duty100); +- *speed = MIN((uint32_t)tmp64, 255); ++ *speed = MIN(percent, 255); + + return 0; + } +-- +2.39.0 + diff --git a/patches.suse/drm-amdkfd-Fix-kernel-warning-during-topology-setup.patch b/patches.suse/drm-amdkfd-Fix-kernel-warning-during-topology-setup.patch new file mode 100644 index 0000000..1caf01f --- /dev/null +++ b/patches.suse/drm-amdkfd-Fix-kernel-warning-during-topology-setup.patch @@ -0,0 +1,71 @@ +From cf97eb7e47d4671084c7e114c5d88a3d0540ecbd Mon Sep 17 00:00:00 2001 +From: Mukul Joshi +Date: Tue, 20 Dec 2022 17:11:24 -0500 +Subject: drm/amdkfd: Fix kernel warning during topology setup +Git-commit: cf97eb7e47d4671084c7e114c5d88a3d0540ecbd +Patch-mainline: v6.2-rc3 +References: git-fixes + +This patch fixes the following kernel warning seen during +driver load by correctly initializing the p2plink attr before +creating the sysfs file: + +[ +0.002865] ------------[ cut here ]------------ +[ +0.002327] kobject: '(null)' (0000000056260cfb): is not initialized, yet kobject_put() is being called. +[ +0.004780] WARNING: CPU: 32 PID: 1006 at lib/kobject.c:718 kobject_put+0xaa/0x1c0 +[ +0.001361] Call Trace: +[ +0.001234] +[ +0.001067] kfd_remove_sysfs_node_entry+0x24a/0x2d0 [amdgpu] +[ +0.003147] kfd_topology_update_sysfs+0x3d/0x750 [amdgpu] +[ +0.002890] kfd_topology_add_device+0xbd7/0xc70 [amdgpu] +[ +0.002844] ? lock_release+0x13c/0x2e0 +[ +0.001936] ? smu_cmn_send_smc_msg_with_param+0x1e8/0x2d0 [amdgpu] +[ +0.003313] ? amdgpu_dpm_get_mclk+0x54/0x60 [amdgpu] +[ +0.002703] kgd2kfd_device_init.cold+0x39f/0x4ed [amdgpu] +[ +0.002930] amdgpu_amdkfd_device_init+0x13d/0x1f0 [amdgpu] +[ +0.002944] amdgpu_device_init.cold+0x1464/0x17b4 [amdgpu] +[ +0.002970] ? pci_bus_read_config_word+0x43/0x80 +[ +0.002380] amdgpu_driver_load_kms+0x15/0x100 [amdgpu] +[ +0.002744] amdgpu_pci_probe+0x147/0x370 [amdgpu] +[ +0.002522] local_pci_probe+0x40/0x80 +[ +0.001896] work_for_cpu_fn+0x10/0x20 +[ +0.001892] process_one_work+0x26e/0x5a0 +[ +0.002029] worker_thread+0x1fd/0x3e0 +[ +0.001890] ? process_one_work+0x5a0/0x5a0 +[ +0.002115] kthread+0xea/0x110 +[ +0.001618] ? kthread_complete_and_exit+0x20/0x20 +[ +0.002422] ret_from_fork+0x1f/0x30 +[ +0.001808] +[ +0.001103] irq event stamp: 59837 +[ +0.001718] hardirqs last enabled at (59849): [] __up_console_sem+0x52/0x60 +[ +0.004414] hardirqs last disabled at (59860): [] __up_console_sem+0x37/0x60 +[ +0.004414] softirqs last enabled at (59654): [] irq_exit_rcu+0xd7/0x130 +[ +0.004205] softirqs last disabled at (59649): [] irq_exit_rcu+0xd7/0x130 +[ +0.004203] ---[ end trace 0000000000000000 ]--- + +Fixes: 0f28cca87e9a ("drm/amdkfd: Extend KFD device topology to surface peer-to-peer links") +Signed-off-by: Mukul Joshi +Reviewed-by: Felix Kuehling +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c +index bceb1a5b2518..3fdaba56be6f 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c +@@ -801,7 +801,7 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev, + + p2plink->attr.name = "properties"; + p2plink->attr.mode = KFD_SYSFS_FILE_MODE; +- sysfs_attr_init(&iolink->attr); ++ sysfs_attr_init(&p2plink->attr); + ret = sysfs_create_file(p2plink->kobj, &p2plink->attr); + if (ret < 0) + return ret; +-- +2.39.0 + diff --git a/patches.suse/drm-atomic-helper-Don-t-allocate-new-plane-state-in-.patch b/patches.suse/drm-atomic-helper-Don-t-allocate-new-plane-state-in-.patch new file mode 100644 index 0000000..99599a5 --- /dev/null +++ b/patches.suse/drm-atomic-helper-Don-t-allocate-new-plane-state-in-.patch @@ -0,0 +1,77 @@ +From dbbf933d365da1a76a540211bee3d57bde520194 Mon Sep 17 00:00:00 2001 +From: Thomas Zimmermann +Date: Fri, 7 Oct 2022 14:43:37 +0200 +Subject: drm/atomic-helper: Don't allocate new plane state in CRTC check +Git-commit: dbbf933d365da1a76a540211bee3d57bde520194 +Patch-mainline: v6.2-rc1 +References: git-fixes + +In drm_atomic_helper_check_crtc_state(), do not add a new plane state +to the global state if it does not exist already. Adding a new plane +state will result in overhead for the plane during the atomic-commit +step. + +For the test in drm_atomic_helper_check_crtc_state() to succeed, it +is important that the CRTC has an enabled primary plane after the +commit. Simply testing the CRTC state's plane_mask for a primary plane +is sufficient. + +Note that the helper still only tests for an attached primary plane. +Drivers have to ensure that the plane contains valid pixel information. + +v5: + * fix commit description (Javier) +v3: + * test for a primary plane in plane_mask (Ville) +v2: + * remove unnecessary test for plane->crtc (Ville) + * inline drm_atomic_get_next_plane_state() (Ville) + * acquire plane lock before accessing plane->state (Ville) + +Signed-off-by: Thomas Zimmermann +Reviewed-by: Javier Martinez Canillas +Fixes: d6b9af1097fe ("drm/atomic-helper: Add helper drm_atomic_helper_check_crtc_state()") +Cc: Thomas Zimmermann +Cc: Jocelyn Falempe +Cc: Maarten Lankhorst +Cc: Maxime Ripard +Cc: David Airlie +Cc: Daniel Vetter +Cc: dri-devel@lists.freedesktop.org +Link: https://patchwork.freedesktop.org/patch/msgid/20221007124338.24152-2-tzimmermann@suse.de +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/drm_atomic_helper.c | 10 +--------- + 1 file changed, 1 insertion(+), 9 deletions(-) + +diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c +index 98cc3137c062..02b4a7dc92f5 100644 +--- a/drivers/gpu/drm/drm_atomic_helper.c ++++ b/drivers/gpu/drm/drm_atomic_helper.c +@@ -945,7 +945,6 @@ int drm_atomic_helper_check_crtc_state(struct drm_crtc_state *crtc_state, + bool can_disable_primary_planes) + { + struct drm_device *dev = crtc_state->crtc->dev; +- struct drm_atomic_state *state = crtc_state->state; + + if (!crtc_state->enable) + return 0; +@@ -956,14 +955,7 @@ int drm_atomic_helper_check_crtc_state(struct drm_crtc_state *crtc_state, + struct drm_plane *plane; + + drm_for_each_plane_mask(plane, dev, crtc_state->plane_mask) { +- struct drm_plane_state *plane_state; +- +- if (plane->type != DRM_PLANE_TYPE_PRIMARY) +- continue; +- plane_state = drm_atomic_get_plane_state(state, plane); +- if (IS_ERR(plane_state)) +- return PTR_ERR(plane_state); +- if (plane_state->fb && plane_state->crtc) { ++ if (plane->type == DRM_PLANE_TYPE_PRIMARY) { + has_primary_plane = true; + break; + } +-- +2.39.0 + diff --git a/patches.suse/drm-bridge-it6505-Adapt-runtime-power-management-fra.patch b/patches.suse/drm-bridge-it6505-Adapt-runtime-power-management-fra.patch new file mode 100644 index 0000000..8c3d179 --- /dev/null +++ b/patches.suse/drm-bridge-it6505-Adapt-runtime-power-management-fra.patch @@ -0,0 +1,109 @@ +From 10517777d302d2e09bee3bf272dd28c0b0c8f3d0 Mon Sep 17 00:00:00 2001 +From: Pin-yen Lin +Date: Tue, 4 Oct 2022 12:49:42 +0800 +Subject: drm/bridge: it6505: Adapt runtime power management framework +Git-commit: 10517777d302d2e09bee3bf272dd28c0b0c8f3d0 +Patch-mainline: v6.2-rc1 +References: git-fixes + +Use pm_runtime_(get|put)_sync to control the bridge power, and add +SET_SYSTEM_SLEEP_PM_OPS with pm_runtime_force_(suspend|resume) to it6505 +driver. Without SET_SYSTEM_SLEEP_PM_OPS, the bridge will be powered on +unnecessarily when no external display is connected. + +Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") +Signed-off-by: Pin-yen Lin +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Robert Foss +Link: https://patchwork.freedesktop.org/patch/msgid/20221004044943.2407781-2-treapking@chromium.org +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/bridge/ite-it6505.c | 34 ++++++++++++++++++++--------- + 1 file changed, 24 insertions(+), 10 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c +index 2767b70fa2cb..ae1105334ca5 100644 +--- a/drivers/gpu/drm/bridge/ite-it6505.c ++++ b/drivers/gpu/drm/bridge/ite-it6505.c +@@ -421,6 +421,7 @@ struct it6505 { + struct notifier_block event_nb; + struct extcon_dev *extcon; + struct work_struct extcon_wq; ++ int extcon_state; + enum drm_connector_status connector_status; + enum link_train_status link_state; + struct work_struct link_works; +@@ -2685,31 +2686,41 @@ static void it6505_extcon_work(struct work_struct *work) + { + struct it6505 *it6505 = container_of(work, struct it6505, extcon_wq); + struct device *dev = &it6505->client->dev; +- int state = extcon_get_state(it6505->extcon, EXTCON_DISP_DP); +- unsigned int pwroffretry = 0; ++ int state, ret; + + if (it6505->enable_drv_hold) + return; + + mutex_lock(&it6505->extcon_lock); + ++ state = extcon_get_state(it6505->extcon, EXTCON_DISP_DP); + DRM_DEV_DEBUG_DRIVER(dev, "EXTCON_DISP_DP = 0x%02x", state); +- if (state > 0) { ++ ++ if (state == it6505->extcon_state || unlikely(state < 0)) ++ goto unlock; ++ it6505->extcon_state = state; ++ if (state) { + DRM_DEV_DEBUG_DRIVER(dev, "start to power on"); + msleep(100); +- it6505_poweron(it6505); ++ ret = pm_runtime_get_sync(dev); ++ ++ /* ++ * On system resume, extcon_work can be triggered before ++ * pm_runtime_force_resume re-enables runtime power management. ++ * Handling the error here to make sure the bridge is powered on. ++ */ ++ if (ret) ++ it6505_poweron(it6505); + } else { + DRM_DEV_DEBUG_DRIVER(dev, "start to power off"); +- while (it6505_poweroff(it6505) && pwroffretry++ < 5) { +- DRM_DEV_DEBUG_DRIVER(dev, "power off fail %d times", +- pwroffretry); +- } ++ pm_runtime_put_sync(dev); + + drm_helper_hpd_irq_event(it6505->bridge.dev); + memset(it6505->dpcd, 0, sizeof(it6505->dpcd)); + DRM_DEV_DEBUG_DRIVER(dev, "power off it6505 success!"); + } + ++unlock: + mutex_unlock(&it6505->extcon_lock); + } + +@@ -3032,8 +3043,10 @@ static __maybe_unused int it6505_bridge_suspend(struct device *dev) + return it6505_poweroff(it6505); + } + +-static SIMPLE_DEV_PM_OPS(it6505_bridge_pm_ops, it6505_bridge_suspend, +- it6505_bridge_resume); ++static const struct dev_pm_ops it6505_bridge_pm_ops = { ++ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) ++ SET_RUNTIME_PM_OPS(it6505_bridge_suspend, it6505_bridge_resume, NULL) ++}; + + static int it6505_init_pdata(struct it6505 *it6505) + { +@@ -3315,6 +3328,7 @@ static int it6505_i2c_probe(struct i2c_client *client, + + DRM_DEV_DEBUG_DRIVER(dev, "it6505 device name: %s", dev_name(dev)); + debugfs_init(it6505); ++ pm_runtime_enable(dev); + + it6505->bridge.funcs = &it6505_bridge_funcs; + it6505->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; +-- +2.39.0 + diff --git a/patches.suse/drm-bridge-it6505-Add-pre_enable-post_disable-callba.patch b/patches.suse/drm-bridge-it6505-Add-pre_enable-post_disable-callba.patch new file mode 100644 index 0000000..40c1ea8 --- /dev/null +++ b/patches.suse/drm-bridge-it6505-Add-pre_enable-post_disable-callba.patch @@ -0,0 +1,68 @@ +From 439adf72726462a0245822d1434f908d451a46ad Mon Sep 17 00:00:00 2001 +From: Pin-yen Lin +Date: Tue, 4 Oct 2022 12:49:43 +0800 +Subject: drm/bridge: it6505: Add pre_enable/post_disable callback +Git-commit: 439adf72726462a0245822d1434f908d451a46ad +Patch-mainline: v6.2-rc1 +References: git-fixes + +Add atomic_pre_enable and atomic_post_disable callback to make sure the +bridge is not powered off until atomic_post_disable is called. This +prevents a power leakage when it6505 is powered off, but the upstream +DRM bridge is still sending display signals. + +Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") +Signed-off-by: Pin-yen Lin +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Robert Foss +Link: https://patchwork.freedesktop.org/patch/msgid/20221004044943.2407781-3-treapking@chromium.org +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/bridge/ite-it6505.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c +index ae1105334ca5..a4302492cf8d 100644 +--- a/drivers/gpu/drm/bridge/ite-it6505.c ++++ b/drivers/gpu/drm/bridge/ite-it6505.c +@@ -2991,6 +2991,28 @@ static void it6505_bridge_atomic_disable(struct drm_bridge *bridge, + } + } + ++static void it6505_bridge_atomic_pre_enable(struct drm_bridge *bridge, ++ struct drm_bridge_state *old_state) ++{ ++ struct it6505 *it6505 = bridge_to_it6505(bridge); ++ struct device *dev = &it6505->client->dev; ++ ++ DRM_DEV_DEBUG_DRIVER(dev, "start"); ++ ++ pm_runtime_get_sync(dev); ++} ++ ++static void it6505_bridge_atomic_post_disable(struct drm_bridge *bridge, ++ struct drm_bridge_state *old_state) ++{ ++ struct it6505 *it6505 = bridge_to_it6505(bridge); ++ struct device *dev = &it6505->client->dev; ++ ++ DRM_DEV_DEBUG_DRIVER(dev, "start"); ++ ++ pm_runtime_put_sync(dev); ++} ++ + static enum drm_connector_status + it6505_bridge_detect(struct drm_bridge *bridge) + { +@@ -3025,6 +3047,8 @@ static const struct drm_bridge_funcs it6505_bridge_funcs = { + .mode_valid = it6505_bridge_mode_valid, + .atomic_enable = it6505_bridge_atomic_enable, + .atomic_disable = it6505_bridge_atomic_disable, ++ .atomic_pre_enable = it6505_bridge_atomic_pre_enable, ++ .atomic_post_disable = it6505_bridge_atomic_post_disable, + .detect = it6505_bridge_detect, + .get_edid = it6505_bridge_get_edid, + }; +-- +2.39.0 + diff --git a/patches.suse/drm-bridge-it6505-Fix-the-order-of-DP_SET_POWER-comm.patch b/patches.suse/drm-bridge-it6505-Fix-the-order-of-DP_SET_POWER-comm.patch new file mode 100644 index 0000000..15d9572 --- /dev/null +++ b/patches.suse/drm-bridge-it6505-Fix-the-order-of-DP_SET_POWER-comm.patch @@ -0,0 +1,60 @@ +From 7c1dceaffd99247bf443606730515b54d6285969 Mon Sep 17 00:00:00 2001 +From: Pin-yen Lin +Date: Tue, 30 Aug 2022 12:57:56 +0800 +Subject: drm/bridge: it6505: Fix the order of DP_SET_POWER commands +Git-commit: 7c1dceaffd99247bf443606730515b54d6285969 +Patch-mainline: v6.1-rc1 +References: git-fixes + +Send DP_SET_POWER_D3 command to the downstream before stopping DP, so the +suspend process will not be interrupted by the HPD interrupt. Also modify +the order in .atomic_enable callback to make the callbacks symmetric. + +Fixes: 46ca7da7f1e8 ("drm/bridge: it6505: Send DPCD SET_POWER to downstream") +Signed-off-by: Pin-yen Lin +Reviewed-by: Robert Foss +Signed-off-by: Robert Foss +Link: https://patchwork.freedesktop.org/patch/msgid/20220830045756.1655954-1-treapking@chromium.org +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/bridge/ite-it6505.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c +index f9251ec49bf0..2bb957cffd94 100644 +--- a/drivers/gpu/drm/bridge/ite-it6505.c ++++ b/drivers/gpu/drm/bridge/ite-it6505.c +@@ -2951,9 +2951,6 @@ static void it6505_bridge_atomic_enable(struct drm_bridge *bridge, + if (ret) + dev_err(dev, "Failed to setup AVI infoframe: %d", ret); + +- it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link, +- DP_SET_POWER_D0); +- + it6505_update_video_parameter(it6505, mode); + + ret = it6505_send_video_infoframe(it6505, &frame); +@@ -2963,6 +2960,9 @@ static void it6505_bridge_atomic_enable(struct drm_bridge *bridge, + + it6505_int_mask_enable(it6505); + it6505_video_reset(it6505); ++ ++ it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link, ++ DP_SET_POWER_D0); + } + + static void it6505_bridge_atomic_disable(struct drm_bridge *bridge, +@@ -2974,9 +2974,9 @@ static void it6505_bridge_atomic_disable(struct drm_bridge *bridge, + DRM_DEV_DEBUG_DRIVER(dev, "start"); + + if (it6505->powered) { +- it6505_video_disable(it6505); + it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link, + DP_SET_POWER_D3); ++ it6505_video_disable(it6505); + } + } + +-- +2.39.0 + diff --git a/patches.suse/drm-bridge-it6505-Initialize-AUX-channel-in-it6505_i.patch b/patches.suse/drm-bridge-it6505-Initialize-AUX-channel-in-it6505_i.patch new file mode 100644 index 0000000..2769072 --- /dev/null +++ b/patches.suse/drm-bridge-it6505-Initialize-AUX-channel-in-it6505_i.patch @@ -0,0 +1,53 @@ +From e577d4b13064c337b83fe7edecb3f34e87144821 Mon Sep 17 00:00:00 2001 +From: Pin-yen Lin +Date: Thu, 13 Oct 2022 19:04:08 +0800 +Subject: drm/bridge: it6505: Initialize AUX channel in it6505_i2c_probe +Git-commit: e577d4b13064c337b83fe7edecb3f34e87144821 +Patch-mainline: v6.2-rc1 +References: git-fixes + +During device boot, the HPD interrupt could be triggered before the DRM +subsystem registers it6505 as a DRM bridge. In such cases, the driver +tries to access AUX channel and causes NULL pointer dereference. +Initializing the AUX channel earlier to prevent such error. + +Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") +Signed-off-by: Pin-yen Lin +Reviewed-by: Robert Foss +Signed-off-by: Robert Foss +Link: https://patchwork.freedesktop.org/patch/msgid/20221013110411.1674359-2-treapking@chromium.org +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/bridge/ite-it6505.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c +index 1fd09911fe8c..24460beb5905 100644 +--- a/drivers/gpu/drm/bridge/ite-it6505.c ++++ b/drivers/gpu/drm/bridge/ite-it6505.c +@@ -2871,10 +2871,7 @@ static int it6505_bridge_attach(struct drm_bridge *bridge, + } + + /* Register aux channel */ +- it6505->aux.name = "DP-AUX"; +- it6505->aux.dev = dev; + it6505->aux.drm_dev = bridge->dev; +- it6505->aux.transfer = it6505_aux_transfer; + + ret = drm_dp_aux_register(&it6505->aux); + +@@ -3354,6 +3351,11 @@ static int it6505_i2c_probe(struct i2c_client *client, + debugfs_init(it6505); + pm_runtime_enable(dev); + ++ it6505->aux.name = "DP-AUX"; ++ it6505->aux.dev = dev; ++ it6505->aux.transfer = it6505_aux_transfer; ++ drm_dp_aux_init(&it6505->aux); ++ + it6505->bridge.funcs = &it6505_bridge_funcs; + it6505->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; + it6505->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID | +-- +2.39.0 + diff --git a/patches.suse/drm-bridge-it6505-Power-on-downstream-device-in-.ato.patch b/patches.suse/drm-bridge-it6505-Power-on-downstream-device-in-.ato.patch new file mode 100644 index 0000000..bead446 --- /dev/null +++ b/patches.suse/drm-bridge-it6505-Power-on-downstream-device-in-.ato.patch @@ -0,0 +1,41 @@ +From fbc1fdaa8338ec4ebd862d918a0ce3e12033e8a3 Mon Sep 17 00:00:00 2001 +From: Pin-Yen Lin +Date: Thu, 14 Jul 2022 17:39:20 +0800 +Subject: drm/bridge: it6505: Power on downstream device in .atomic_enable +Git-commit: fbc1fdaa8338ec4ebd862d918a0ce3e12033e8a3 +Patch-mainline: v6.1-rc1 +References: git-fixes + +Send DPCD DP_SET_POWER_D0 command to the monitor in .atomic_enable +callback. Without this command, some monitors won't show up again after +changing the resolution. + +Fixes: 46ca7da7f1e8 ("drm/bridge: it6505: Send DPCD SET_POWER to downstream") + +Signed-off-by: Pin-Yen Lin +Reviewed-by: Allen Chen +Fixes: 46ca7da7f1e8 ("drm/bridge: it6505: Send DPCD SET_POWER to downstream") +Signed-off-by: Robert Foss +Link: https://patchwork.freedesktop.org/patch/msgid/20220714173715.v2.1.I85af54e9ceda74ec69f661852825845f983fc343@changeid +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/bridge/ite-it6505.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c +index 4b673c4792d7..e5626035f311 100644 +--- a/drivers/gpu/drm/bridge/ite-it6505.c ++++ b/drivers/gpu/drm/bridge/ite-it6505.c +@@ -2945,6 +2945,9 @@ static void it6505_bridge_atomic_enable(struct drm_bridge *bridge, + if (ret) + dev_err(dev, "Failed to setup AVI infoframe: %d", ret); + ++ it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link, ++ DP_SET_POWER_D0); ++ + it6505_update_video_parameter(it6505, mode); + + ret = it6505_send_video_infoframe(it6505, &frame); +-- +2.39.0 + diff --git a/patches.suse/drm-bridge-it6505-use-drm_debug_enabled-in-it6505_de.patch b/patches.suse/drm-bridge-it6505-use-drm_debug_enabled-in-it6505_de.patch new file mode 100644 index 0000000..4feef27 --- /dev/null +++ b/patches.suse/drm-bridge-it6505-use-drm_debug_enabled-in-it6505_de.patch @@ -0,0 +1,39 @@ +From e3d8d54cd6c5b29f3437f1f00b393267b84d650e Mon Sep 17 00:00:00 2001 +From: Hamza Mahfooz +Date: Sat, 10 Sep 2022 18:48:16 -0400 +Subject: drm/bridge: it6505: use drm_debug_enabled() in it6505_debug_print() +Git-commit: e3d8d54cd6c5b29f3437f1f00b393267b84d650e +Patch-mainline: v6.1-rc1 +References: git-fixes + +As made mention of in commit 9f0ac028410f ("drm/print: rename drm_debug +to __drm_debug to discourage use"), we shouldn't explicitly refer to +__drm_debug in this context. So, use drm_debug_enabled() instead. + +Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") +Signed-off-by: Hamza Mahfooz +Reviewed-by: Jani Nikula +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Robert Foss +Link: https://patchwork.freedesktop.org/patch/msgid/20220910224816.15058-1-someguy@effective-light.com +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/bridge/ite-it6505.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c +index 2bb957cffd94..2767b70fa2cb 100644 +--- a/drivers/gpu/drm/bridge/ite-it6505.c ++++ b/drivers/gpu/drm/bridge/ite-it6505.c +@@ -563,7 +563,7 @@ static void it6505_debug_print(struct it6505 *it6505, unsigned int reg, + struct device *dev = &it6505->client->dev; + int val; + +- if (likely(!(__drm_debug & DRM_UT_DRIVER))) ++ if (!drm_debug_enabled(DRM_UT_DRIVER)) + return; + + val = it6505_read(it6505, reg); +-- +2.39.0 + diff --git a/patches.suse/drm-bridge-ps8640-Add-back-the-50-ms-mystery-delay-a.patch b/patches.suse/drm-bridge-ps8640-Add-back-the-50-ms-mystery-delay-a.patch new file mode 100644 index 0000000..c3b26cd --- /dev/null +++ b/patches.suse/drm-bridge-ps8640-Add-back-the-50-ms-mystery-delay-a.patch @@ -0,0 +1,109 @@ +From cb8e30ddb7e345867f6f2da8a08291d7d9e037db Mon Sep 17 00:00:00 2001 +From: Douglas Anderson +Date: Mon, 17 Oct 2022 12:18:51 -0700 +Subject: drm/bridge: ps8640: Add back the 50 ms mystery delay after HPD +Git-commit: cb8e30ddb7e345867f6f2da8a08291d7d9e037db +Patch-mainline: v6.1-rc3 +References: git-fixes + +Back in commit 826cff3f7ebb ("drm/bridge: parade-ps8640: Enable +runtime power management") we removed a mysterious 50 ms delay because +"Parade's support [couldn't] explain what the delay [was] for". + +While I'm always a fan of removing mysterious delays, I suspect that +we need this mysterious delay to avoid some problems. + +Specifically, what I found recently is that on sc7180-trogdor-homestar +sometimes the AUX backlight wasn't initializing properly. Some +debugging showed that the drm_dp_dpcd_read() function that the AUX +backlight driver was calling was returning bogus data about 1% of the +time when I booted up. This confused +drm_panel_dp_aux_backlight(). From continued debugging: +- If I retried the read then the read worked just fine. +- If I added a loop to perform the same read that + drm_panel_dp_aux_backlight() was doing 30 times at bootup I could + see that some percentage of the time the first read would give bogus + data but all 29 additional reads would always be fine. +- If I added a large delay _after_ powering on the panel but before + powering on PS8640 I could still reproduce the problem. +- If I added a delay after PS8640 powered on then I couldn't reproduce + the problem. +- I couldn't reproduce the problem on a board with the same panel but + the ti-sn65dsi86 bridge chip. + +To me, the above indicated that there was a problem with PS8640 and +not the panel. + +I don't really have any insight into what's going on in the MCU, but +my best guess is that when the MCU itself sees the HPD go high that it +does some AUX transfers itself and this is confusing things. + +Let's go back and add back in the mysterious 50 ms delay. We only want +to do this the first time we see HPD go high after booting the MCU, +not every time we double-check HPD. + +With this, the backlight initializes reliably on homestar. + +Fixes: 826cff3f7ebb ("drm/bridge: parade-ps8640: Enable runtime power management") +Reviewed-by: Stephen Boyd +Signed-off-by: Douglas Anderson +Link: https://patchwork.freedesktop.org/patch/msgid/20221017121813.1.I59700c745fbc31559a5d5c8e2a960279c751dbd5@changeid +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/bridge/parade-ps8640.c | 25 +++++++++++++++++++++++-- + 1 file changed, 23 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/bridge/parade-ps8640.c ++++ b/drivers/gpu/drm/bridge/parade-ps8640.c +@@ -105,6 +105,7 @@ + struct gpio_desc *gpio_powerdown; + struct device_link *link; + bool pre_enabled; ++ bool need_post_hpd_delay; + }; + + static const struct regmap_config ps8640_regmap_config[] = { +@@ -173,14 +174,31 @@ + { + struct regmap *map = ps_bridge->regmap[PAGE2_TOP_CNTL]; + int status; ++ int ret; + + /* + * Apparently something about the firmware in the chip signals that + * HPD goes high by reporting GPIO9 as high (even though HPD isn't + * actually connected to GPIO9). + */ +- return regmap_read_poll_timeout(map, PAGE2_GPIO_H, status, +- status & PS_GPIO9, wait_us / 10, wait_us); ++ ret = regmap_read_poll_timeout(map, PAGE2_GPIO_H, status, ++ status & PS_GPIO9, wait_us / 10, wait_us); ++ ++ /* ++ * The first time we see HPD go high after a reset we delay an extra ++ * 50 ms. The best guess is that the MCU is doing "stuff" during this ++ * time (maybe talking to the panel) and we don't want to interrupt it. ++ * ++ * No locking is done around "need_post_hpd_delay". If we're here we ++ * know we're holding a PM Runtime reference and the only other place ++ * that touches this is PM Runtime resume. ++ */ ++ if (!ret && ps_bridge->need_post_hpd_delay) { ++ ps_bridge->need_post_hpd_delay = false; ++ msleep(50); ++ } ++ ++ return ret; + } + + static int ps8640_wait_hpd_asserted(struct drm_dp_aux *aux, unsigned long wait_us) +@@ -376,6 +394,9 @@ + usleep_range(2000, 2500); + gpiod_set_value(ps_bridge->gpio_reset, 0); + ++ /* We just reset things, so we need a delay after the first HPD */ ++ ps_bridge->need_post_hpd_delay = true; ++ + /* + * Mystery 200 ms delay for the "MCU to be ready". It's unclear if + * this is truly necessary since the MCU will already signal that diff --git a/patches.suse/drm-bridge-tc358767-Add-of_node_put-when-breaking-ou.patch b/patches.suse/drm-bridge-tc358767-Add-of_node_put-when-breaking-ou.patch new file mode 100644 index 0000000..86584cf --- /dev/null +++ b/patches.suse/drm-bridge-tc358767-Add-of_node_put-when-breaking-ou.patch @@ -0,0 +1,42 @@ +From 14e7157afb055248ed34901fcd6fbf54201cfea1 Mon Sep 17 00:00:00 2001 +From: Liang He +Date: Tue, 19 Jul 2022 14:54:47 +0800 +Subject: drm/bridge: tc358767: Add of_node_put() when breaking out of loop +Git-commit: 14e7157afb055248ed34901fcd6fbf54201cfea1 +Patch-mainline: v6.1-rc1 +References: git-fixes + +In tc_probe_bridge_endpoint(), we should call of_node_put() when +breaking out of the for_each_endpoint_of_node() which will automatically +increase and decrease the refcount. + +Fixes: 71f7d9c03118 ("drm/bridge: tc358767: Detect bridge mode from connected endpoints in DT") +Signed-off-by: Liang He +Reviewed-by: Robert Foss +Signed-off-by: Robert Foss +Link: https://patchwork.freedesktop.org/patch/msgid/20220719065447.1080817-2-windhl@126.com +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/bridge/tc358767.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c +index 02bd757a8987..1dc107f13645 100644 +--- a/drivers/gpu/drm/bridge/tc358767.c ++++ b/drivers/gpu/drm/bridge/tc358767.c +@@ -2010,9 +2010,10 @@ static int tc_probe_bridge_endpoint(struct tc_data *tc) + + for_each_endpoint_of_node(dev->of_node, node) { + of_graph_parse_endpoint(node, &endpoint); +- if (endpoint.port > 2) ++ if (endpoint.port > 2) { ++ of_node_put(node); + return -EINVAL; +- ++ } + mode |= BIT(endpoint.port); + } + +-- +2.39.0 + diff --git a/patches.suse/drm-fix-drm_mipi_dbi-build-errors.patch b/patches.suse/drm-fix-drm_mipi_dbi-build-errors.patch new file mode 100644 index 0000000..ae3f27a --- /dev/null +++ b/patches.suse/drm-fix-drm_mipi_dbi-build-errors.patch @@ -0,0 +1,64 @@ +From eb7de496451bd969e203f02f66585131228ba4ae Mon Sep 17 00:00:00 2001 +From: Randy Dunlap +Date: Mon, 22 Aug 2022 17:42:43 -0700 +Subject: drm: fix drm_mipi_dbi build errors +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Git-commit: eb7de496451bd969e203f02f66585131228ba4ae +Patch-mainline: v6.1-rc1 +References: git-fixes + +drm_mipi_dbi needs lots of DRM_KMS_HELPER support, so select +that Kconfig symbol like it is done is most other uses, and +the way that it was before MIPS_DBI was moved from tinydrm +to its core location. + +Fixes these build errors: + +ld: drivers/gpu/drm/drm_mipi_dbi.o: in function `mipi_dbi_buf_copy': +drivers/gpu/drm/drm_mipi_dbi.c:205: undefined reference to `drm_gem_fb_get_obj' +ld: drivers/gpu/drm/drm_mipi_dbi.c:211: undefined reference to `drm_gem_fb_begin_cpu_access' +ld: drivers/gpu/drm/drm_mipi_dbi.c:215: undefined reference to `drm_gem_fb_vmap' +ld: drivers/gpu/drm/drm_mipi_dbi.c:222: undefined reference to `drm_fb_swab' +ld: drivers/gpu/drm/drm_mipi_dbi.c:224: undefined reference to `drm_fb_memcpy' +ld: drivers/gpu/drm/drm_mipi_dbi.c:227: undefined reference to `drm_fb_xrgb8888_to_rgb565' +ld: drivers/gpu/drm/drm_mipi_dbi.c:235: undefined reference to `drm_gem_fb_vunmap' +ld: drivers/gpu/drm/drm_mipi_dbi.c:237: undefined reference to `drm_gem_fb_end_cpu_access' +ld: drivers/gpu/drm/drm_mipi_dbi.o: in function `mipi_dbi_dev_init_with_formats': +ld: drivers/gpu/drm/drm_mipi_dbi.o:/X64/../drivers/gpu/drm/drm_mipi_dbi.c:469: undefined reference to `drm_gem_fb_create_with_dirty' + +Fixes: 174102f4de23 ("drm/tinydrm: Move mipi-dbi") +Signed-off-by: Randy Dunlap +Reported-by: kernel test robot +Cc: Dillon Min +Cc: Linus Walleij +Cc: Sam Ravnborg +Cc: Noralf Trønnes +Cc: Thomas Zimmermann +Cc: Thierry Reding +Cc: dri-devel@lists.freedesktop.org +Cc: David Airlie +Cc: Daniel Vetter +Signed-off-by: Linus Walleij +Link: https://patchwork.freedesktop.org/patch/msgid/20220823004243.11596-1-rdunlap@infradead.org +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig +index 0b2ad7212ee6..2f52e8941074 100644 +--- a/drivers/gpu/drm/Kconfig ++++ b/drivers/gpu/drm/Kconfig +@@ -31,6 +31,7 @@ menuconfig DRM + config DRM_MIPI_DBI + tristate + depends on DRM ++ select DRM_KMS_HELPER + + config DRM_MIPI_DSI + bool +-- +2.39.0 + diff --git a/patches.suse/drm-format-helper-Fix-test-on-big-endian-architectur.patch b/patches.suse/drm-format-helper-Fix-test-on-big-endian-architectur.patch new file mode 100644 index 0000000..593f946 --- /dev/null +++ b/patches.suse/drm-format-helper-Fix-test-on-big-endian-architectur.patch @@ -0,0 +1,81 @@ +From 18c8485236a5e3f491b670c018ae391c9cb84dfa Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= +Date: Wed, 27 Jul 2022 01:09:13 +0200 +Subject: drm/format-helper: Fix test on big endian architectures +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Git-commit: 18c8485236a5e3f491b670c018ae391c9cb84dfa +Patch-mainline: v6.1-rc1 +References: git-fixes + +The tests fail on big endian architectures, like PowerPC: + + $ ./tools/testing/kunit/kunit.py run \ + --kunitconfig=drivers/gpu/drm/tests \ + --arch=powerpc --cross_compile=powerpc64-linux-gnu- + +Transform the XRGB8888 buffer from little endian to the CPU endian +before calling the conversion function to avoid this error. + +Fixes: 8f456104915f ("drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb332()") +Reported-by: David Gow +Reviewed-by: David Gow +Signed-off-by: José Expósito +Link: https://patchwork.freedesktop.org/patch/msgid/20220726230916.390575-2-jose.exposito89@gmail.com +Acked-by: Patrik Jakobsson +--- + .../gpu/drm/tests/drm_format_helper_test.c | 23 +++++++++++++++++-- + 1 file changed, 21 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/tests/drm_format_helper_test.c b/drivers/gpu/drm/tests/drm_format_helper_test.c +index 98583bf56044..eefaba3aaea2 100644 +--- a/drivers/gpu/drm/tests/drm_format_helper_test.c ++++ b/drivers/gpu/drm/tests/drm_format_helper_test.c +@@ -111,6 +111,21 @@ static size_t conversion_buf_size(u32 dst_format, unsigned int dst_pitch, + return dst_pitch * drm_rect_height(clip); + } + ++static u32 *le32buf_to_cpu(struct kunit *test, const u32 *buf, size_t buf_size) ++{ ++ u32 *dst = NULL; ++ int n; ++ ++ dst = kunit_kzalloc(test, sizeof(*dst) * buf_size, GFP_KERNEL); ++ if (!dst) ++ return NULL; ++ ++ for (n = 0; n < buf_size; n++) ++ dst[n] = le32_to_cpu((__force __le32)buf[n]); ++ ++ return dst; ++} ++ + static void xrgb8888_to_rgb332_case_desc(struct xrgb8888_to_rgb332_case *t, + char *desc) + { +@@ -125,6 +140,7 @@ static void xrgb8888_to_rgb332_test(struct kunit *test) + const struct xrgb8888_to_rgb332_case *params = test->param_value; + size_t dst_size; + __u8 *dst = NULL; ++ __u32 *src = NULL; + + struct drm_framebuffer fb = { + .format = drm_format_info(DRM_FORMAT_XRGB8888), +@@ -138,8 +154,11 @@ static void xrgb8888_to_rgb332_test(struct kunit *test) + dst = kunit_kzalloc(test, dst_size, GFP_KERNEL); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dst); + +- drm_fb_xrgb8888_to_rgb332(dst, params->dst_pitch, params->xrgb8888, +- &fb, ¶ms->clip); ++ src = le32buf_to_cpu(test, params->xrgb8888, TEST_BUF_SIZE); ++ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, src); ++ ++ drm_fb_xrgb8888_to_rgb332(dst, params->dst_pitch, src, &fb, ++ ¶ms->clip); + KUNIT_EXPECT_EQ(test, memcmp(dst, params->expected, dst_size), 0); + } + +-- +2.39.0 + diff --git a/patches.suse/drm-i915-Do-not-set-cache_dirty-for-DGFX.patch b/patches.suse/drm-i915-Do-not-set-cache_dirty-for-DGFX.patch new file mode 100644 index 0000000..1f989d5 --- /dev/null +++ b/patches.suse/drm-i915-Do-not-set-cache_dirty-for-DGFX.patch @@ -0,0 +1,69 @@ +From 19b168136395150a4a6e011f944eb30d3d85094b Mon Sep 17 00:00:00 2001 +From: Niranjana Vishwanathapura +Date: Tue, 1 Nov 2022 22:14:16 -0700 +Subject: drm/i915: Do not set cache_dirty for DGFX +Git-commit: 19b168136395150a4a6e011f944eb30d3d85094b +Patch-mainline: v6.1-rc5 +References: git-fixes +Alt-commit: 0aeec60c76ca2631696b4228f3fc99fe3a80013d + +Currently on DG1, which does not have LLC, we hit the below +warning while rebinding an userptr invalidated object. + +WARNING: CPU: 4 PID: 13008 at drivers/gpu/drm/i915/gem/i915_gem_pages.c:34 __i915_gem_object_set_pages+0x296/0x2d0 [i915] +... +RIP: 0010:__i915_gem_object_set_pages+0x296/0x2d0 [i915] +... +Call Trace: + + i915_gem_userptr_get_pages+0x175/0x1a0 [i915] + ____i915_gem_object_get_pages+0x32/0xb0 [i915] + i915_gem_object_userptr_submit_init+0x286/0x470 [i915] + eb_lookup_vmas+0x2ff/0xcf0 [i915] + ? __intel_wakeref_get_first+0x55/0xb0 [i915] + i915_gem_do_execbuffer+0x785/0x21d0 [i915] + i915_gem_execbuffer2_ioctl+0xe7/0x3d0 [i915] + +We shouldn't be setting the obj->cache_dirty for DGFX, +fix it. + +Fixes: d70af57944a1 ("drm/i915/shmem: ensure flush during swap-in on non-LLC") +Suggested-by: Matthew Auld +Reported-by: Niranjana Vishwanathapura +Signed-off-by: Niranjana Vishwanathapura +Acked-by: Nirmoy Das +Reviewed-by: Matthew Auld +Reviewed-by: Andi Shyti +Signed-off-by: Andi Shyti +Link: https://patchwork.freedesktop.org/patch/msgid/20221102051416.27327-1-niranjana.vishwanathapura@intel.com +(cherry picked from commit 0aeec60c76ca2631696b4228f3fc99fe3a80013d) +Signed-off-by: Tvrtko Ursulin +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c +index 11125c32dd35..2f7804492cd5 100644 +--- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c +@@ -369,14 +369,14 @@ __i915_gem_object_release_shmem(struct drm_i915_gem_object *obj, + + __start_cpu_write(obj); + /* +- * On non-LLC platforms, force the flush-on-acquire if this is ever ++ * On non-LLC igfx platforms, force the flush-on-acquire if this is ever + * swapped-in. Our async flush path is not trust worthy enough yet(and + * happens in the wrong order), and with some tricks it's conceivable + * for userspace to change the cache-level to I915_CACHE_NONE after the + * pages are swapped-in, and since execbuf binds the object before doing + * the async flush, we have a race window. + */ +- if (!HAS_LLC(i915)) ++ if (!HAS_LLC(i915) && !IS_DGFX(i915)) + obj->cache_dirty = true; + } + +-- +2.39.0 + diff --git a/patches.suse/drm-i915-Extend-Wa_1607297627-to-Alderlake-P.patch b/patches.suse/drm-i915-Extend-Wa_1607297627-to-Alderlake-P.patch new file mode 100644 index 0000000..7ea459a --- /dev/null +++ b/patches.suse/drm-i915-Extend-Wa_1607297627-to-Alderlake-P.patch @@ -0,0 +1,55 @@ +From 1a3abd12a394f5c66943fee75cef533069e831fb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= +Date: Mon, 17 Oct 2022 06:24:32 -0700 +Subject: drm/i915: Extend Wa_1607297627 to Alderlake-P +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Alt-commit: 847eec69f01a28ca44f5ac7e1d71d3a60263d680 +Git-commit: 1a3abd12a394f5c66943fee75cef533069e831fb +Patch-mainline: v6.1-rc3 +References: git-fixes + +Workaround 1607297627 was missed for Alderlake-P, so here extending it +to it and adding the fixes tag so this WA is backported to all +stable kernels. + +v2: +- fixed subject +- added Fixes tag + +BSpec: 54369 +Cc: # v5.17+ +Fixes: dfb924e33927 ("drm/i915/adlp: Remove require_force_probe protection") +Reviewed-by: Lucas De Marchi +Cc: Tvrtko Ursulin +Signed-off-by: José Roberto de Souza +Link: https://patchwork.freedesktop.org/patch/msgid/20221017132432.112850-1-jose.souza@intel.com +(cherry picked from commit 847eec69f01a28ca44f5ac7e1d71d3a60263d680) +Signed-off-by: Tvrtko Ursulin +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/i915/gt/intel_workarounds.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c b/drivers/gpu/drm/i915/gt/intel_workarounds.c +index 6d2003d598e6..a821e3d405db 100644 +--- a/drivers/gpu/drm/i915/gt/intel_workarounds.c ++++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c +@@ -2293,11 +2293,11 @@ rcs_engine_wa_init(struct intel_engine_cs *engine, struct i915_wa_list *wal) + } + + if (IS_DG1_GRAPHICS_STEP(i915, STEP_A0, STEP_B0) || +- IS_ROCKETLAKE(i915) || IS_TIGERLAKE(i915)) { ++ IS_ROCKETLAKE(i915) || IS_TIGERLAKE(i915) || IS_ALDERLAKE_P(i915)) { + /* + * Wa_1607030317:tgl + * Wa_1607186500:tgl +- * Wa_1607297627:tgl,rkl,dg1[a0] ++ * Wa_1607297627:tgl,rkl,dg1[a0],adlp + * + * On TGL and RKL there are multiple entries for this WA in the + * BSpec; some indicate this is an A0-only WA, others indicate +-- +2.39.0 + diff --git a/patches.suse/drm-i915-Fix-compute-pre-emption-w-a-to-apply-to-com.patch b/patches.suse/drm-i915-Fix-compute-pre-emption-w-a-to-apply-to-com.patch new file mode 100644 index 0000000..32c60bd --- /dev/null +++ b/patches.suse/drm-i915-Fix-compute-pre-emption-w-a-to-apply-to-com.patch @@ -0,0 +1,88 @@ +From c3bd49cd9a1043b963331e7fd874b380bed3f2bd Mon Sep 17 00:00:00 2001 +From: John Harrison +Date: Thu, 6 Oct 2022 14:38:11 -0700 +Subject: drm/i915: Fix compute pre-emption w/a to apply to compute engines +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Git-commit: c3bd49cd9a1043b963331e7fd874b380bed3f2bd +Patch-mainline: v6.2-rc1 +References: git-fixes + +An earlier patch added support for compute engines. However, it missed +enabling the anti-pre-emption w/a for the new engine class. So move +the 'compute capable' flag earlier and use it for the pre-emption w/a +test. + +Fixes: c674c5b9342e ("drm/i915/xehp: CCS should use RCS setup functions") +Cc: Tvrtko Ursulin +Cc: Daniele Ceraolo Spurio +Cc: Aravind Iddamsetty +Cc: Matt Roper +Cc: Tvrtko Ursulin +Cc: Daniel Vetter +Cc: Maarten Lankhorst +Cc: Lucas De Marchi +Cc: John Harrison +Cc: Jason Ekstrand +Cc: "Michał Winiarski" +Cc: Matthew Brost +Cc: Chris Wilson +Cc: Tejas Upadhyay +Cc: Umesh Nerlige Ramappa +Cc: "Thomas Hellström" +Cc: Stuart Summers +Cc: Matthew Auld +Cc: Jani Nikula +Cc: Ramalingam C +Cc: Akeem G Abodunrin +Signed-off-by: John Harrison +Reviewed-by: Matt Roper +Link: https://patchwork.freedesktop.org/patch/msgid/20221006213813.1563435-3-John.C.Harrison@Intel.com +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/i915/gt/intel_engine_cs.c | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +--- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c ++++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c +@@ -486,6 +486,17 @@ + engine->logical_mask = BIT(logical_instance); + __sprint_engine_name(engine); + ++ if ((engine->class == COMPUTE_CLASS && !RCS_MASK(engine->gt) && ++ __ffs(CCS_MASK(engine->gt)) == engine->instance) || ++ engine->class == RENDER_CLASS) ++ engine->flags |= I915_ENGINE_FIRST_RENDER_COMPUTE; ++ ++ /* features common between engines sharing EUs */ ++ if (engine->class == RENDER_CLASS || engine->class == COMPUTE_CLASS) { ++ engine->flags |= I915_ENGINE_HAS_RCS_REG_STATE; ++ engine->flags |= I915_ENGINE_HAS_EU_PRIORITY; ++ } ++ + engine->props.heartbeat_interval_ms = + CONFIG_DRM_I915_HEARTBEAT_INTERVAL; + engine->props.max_busywait_duration_ns = +@@ -498,20 +509,9 @@ + CONFIG_DRM_I915_TIMESLICE_DURATION; + + /* Override to uninterruptible for OpenCL workloads. */ +- if (GRAPHICS_VER(i915) == 12 && engine->class == RENDER_CLASS) ++ if (GRAPHICS_VER(i915) == 12 && (engine->flags & I915_ENGINE_HAS_RCS_REG_STATE)) + engine->props.preempt_timeout_ms = 0; + +- if ((engine->class == COMPUTE_CLASS && !RCS_MASK(engine->gt) && +- __ffs(CCS_MASK(engine->gt)) == engine->instance) || +- engine->class == RENDER_CLASS) +- engine->flags |= I915_ENGINE_FIRST_RENDER_COMPUTE; +- +- /* features common between engines sharing EUs */ +- if (engine->class == RENDER_CLASS || engine->class == COMPUTE_CLASS) { +- engine->flags |= I915_ENGINE_HAS_RCS_REG_STATE; +- engine->flags |= I915_ENGINE_HAS_EU_PRIORITY; +- } +- + engine->defaults = engine->props; /* never to change again */ + + engine->context_size = intel_engine_context_size(gt, engine->class); diff --git a/patches.suse/drm-i915-Fix-display-problems-after-resume.patch b/patches.suse/drm-i915-Fix-display-problems-after-resume.patch new file mode 100644 index 0000000..9c73965 --- /dev/null +++ b/patches.suse/drm-i915-Fix-display-problems-after-resume.patch @@ -0,0 +1,62 @@ +From 6c482c62a635aa4f534d2439fbf8afa37452b986 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= +Date: Wed, 5 Oct 2022 14:11:59 +0200 +Subject: drm/i915: Fix display problems after resume +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Alt-commit: bc2472538c0d1cce334ffc9e97df0614cd2b1469 +Git-commit: 6c482c62a635aa4f534d2439fbf8afa37452b986 +Patch-mainline: v6.1-rc1 +References: git-fixes + +Commit 39a2bd34c933 ("drm/i915: Use the vma resource as argument for gtt +binding / unbinding") introduced a regression that due to the vma resource +tracking of the binding state, dpt ptes were not correctly repopulated. +Fix this by clearing the vma resource state before repopulating. +The state will subsequently be restored by the bind_vma operation. + +Fixes: 39a2bd34c933 ("drm/i915: Use the vma resource as argument for gtt binding / unbinding") +Signed-off-by: Thomas Hellström +Link: https://patchwork.freedesktop.org/patch/msgid/20220912121957.31310-1-thomas.hellstrom@linux.intel.com +Cc: Matthew Auld +Cc: intel-gfx@lists.freedesktop.org +Cc: # v5.18+ +Reported-and-tested-by: Kevin Boulain +Tested-by: David de Sousa +Reviewed-by: Matthew Auld +Reviewed-by: Andrzej Hajda +Signed-off-by: Matthew Auld +Link: https://patchwork.freedesktop.org/patch/msgid/20221005121159.340245-1-thomas.hellstrom@linux.intel.com +(cherry picked from commit bc2472538c0d1cce334ffc9e97df0614cd2b1469) +Signed-off-by: Tvrtko Ursulin +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/i915/gt/intel_ggtt.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt.c b/drivers/gpu/drm/i915/gt/intel_ggtt.c +index 30cf5c3369d9..2049a00417af 100644 +--- a/drivers/gpu/drm/i915/gt/intel_ggtt.c ++++ b/drivers/gpu/drm/i915/gt/intel_ggtt.c +@@ -1275,10 +1275,16 @@ bool i915_ggtt_resume_vm(struct i915_address_space *vm) + atomic_read(&vma->flags) & I915_VMA_BIND_MASK; + + GEM_BUG_ON(!was_bound); +- if (!retained_ptes) ++ if (!retained_ptes) { ++ /* ++ * Clear the bound flags of the vma resource to allow ++ * ptes to be repopulated. ++ */ ++ vma->resource->bound_flags = 0; + vma->ops->bind_vma(vm, NULL, vma->resource, + obj ? obj->cache_level : 0, + was_bound); ++ } + if (obj) { /* only used during resume => exclusive access */ + write_domain_objs |= fetch_and_zero(&obj->write_domain); + obj->read_domains |= I915_GEM_DOMAIN_GTT; +-- +2.39.0 + diff --git a/patches.suse/drm-i915-Fix-warn-in-intel_display_power_-_domain-fu.patch b/patches.suse/drm-i915-Fix-warn-in-intel_display_power_-_domain-fu.patch new file mode 100644 index 0000000..74c6b9e --- /dev/null +++ b/patches.suse/drm-i915-Fix-warn-in-intel_display_power_-_domain-fu.patch @@ -0,0 +1,71 @@ +From ebbaa4392e36521fb893973d8a0fcb32f3b6d5eb Mon Sep 17 00:00:00 2001 +From: Imre Deak +Date: Mon, 14 Nov 2022 14:22:43 +0200 +Subject: drm/i915: Fix warn in intel_display_power_*_domain() functions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Alt-commit: 10b85f0e1d922210ae857afed6d012ec32c4b6cb +Git-commit: ebbaa4392e36521fb893973d8a0fcb32f3b6d5eb +Patch-mainline: v6.1-rc7 +References: git-fixes + +The intel_display_power_*_domain() functions should always warn if a +default domain is returned as a fallback, fix this up. Spotted by Ville. + +Fixes: 979e1b32e0e2 ("drm/i915: Sanitize the port -> DDI/AUX power domain mapping for each platform") +Cc: Ville Syrjälä +Cc: Jouni Högander +Signed-off-by: Imre Deak +Reviewed-by: Ville Syrjälä +Link: https://patchwork.freedesktop.org/patch/msgid/20221114122251.21327-2-imre.deak@intel.com +(cherry picked from commit 10b85f0e1d922210ae857afed6d012ec32c4b6cb) +Signed-off-by: Tvrtko Ursulin +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/i915/display/intel_display_power.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c +index 1e608b9e5055..1a63da28f330 100644 +--- a/drivers/gpu/drm/i915/display/intel_display_power.c ++++ b/drivers/gpu/drm/i915/display/intel_display_power.c +@@ -2434,7 +2434,7 @@ intel_display_power_ddi_io_domain(struct drm_i915_private *i915, enum port port) + { + const struct intel_ddi_port_domains *domains = intel_port_domains_for_port(i915, port); + +- if (drm_WARN_ON(&i915->drm, !domains) || domains->ddi_io == POWER_DOMAIN_INVALID) ++ if (drm_WARN_ON(&i915->drm, !domains || domains->ddi_io == POWER_DOMAIN_INVALID)) + return POWER_DOMAIN_PORT_DDI_IO_A; + + return domains->ddi_io + (int)(port - domains->port_start); +@@ -2445,7 +2445,7 @@ intel_display_power_ddi_lanes_domain(struct drm_i915_private *i915, enum port po + { + const struct intel_ddi_port_domains *domains = intel_port_domains_for_port(i915, port); + +- if (drm_WARN_ON(&i915->drm, !domains) || domains->ddi_lanes == POWER_DOMAIN_INVALID) ++ if (drm_WARN_ON(&i915->drm, !domains || domains->ddi_lanes == POWER_DOMAIN_INVALID)) + return POWER_DOMAIN_PORT_DDI_LANES_A; + + return domains->ddi_lanes + (int)(port - domains->port_start); +@@ -2471,7 +2471,7 @@ intel_display_power_legacy_aux_domain(struct drm_i915_private *i915, enum aux_ch + { + const struct intel_ddi_port_domains *domains = intel_port_domains_for_aux_ch(i915, aux_ch); + +- if (drm_WARN_ON(&i915->drm, !domains) || domains->aux_legacy_usbc == POWER_DOMAIN_INVALID) ++ if (drm_WARN_ON(&i915->drm, !domains || domains->aux_legacy_usbc == POWER_DOMAIN_INVALID)) + return POWER_DOMAIN_AUX_A; + + return domains->aux_legacy_usbc + (int)(aux_ch - domains->aux_ch_start); +@@ -2482,7 +2482,7 @@ intel_display_power_tbt_aux_domain(struct drm_i915_private *i915, enum aux_ch au + { + const struct intel_ddi_port_domains *domains = intel_port_domains_for_aux_ch(i915, aux_ch); + +- if (drm_WARN_ON(&i915->drm, !domains) || domains->aux_tbt == POWER_DOMAIN_INVALID) ++ if (drm_WARN_ON(&i915->drm, !domains || domains->aux_tbt == POWER_DOMAIN_INVALID)) + return POWER_DOMAIN_AUX_TBT1; + + return domains->aux_tbt + (int)(aux_ch - domains->aux_ch_start); +-- +2.39.0 + diff --git a/patches.suse/drm-i915-Fix-watermark-calculations-for-DG2-CCS-CC-m.patch b/patches.suse/drm-i915-Fix-watermark-calculations-for-DG2-CCS-CC-m.patch index 43d5d8c..c440b32 100644 --- a/patches.suse/drm-i915-Fix-watermark-calculations-for-DG2-CCS-CC-m.patch +++ b/patches.suse/drm-i915-Fix-watermark-calculations-for-DG2-CCS-CC-m.patch @@ -5,6 +5,7 @@ Subject: drm/i915: Fix watermark calculations for DG2 CCS+CC modifier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit +Alt-commit: b2e3a1af8cce4117de06ff1a4eab0749753ede27 Git-commit: 334810f82024815283a6e7febd3d2de1fed6c232 Patch-mainline: v6.2-rc1 References: jsc#PED-1218 diff --git a/patches.suse/drm-i915-Fix-watermark-calculations-for-DG2-CCS-modi.patch b/patches.suse/drm-i915-Fix-watermark-calculations-for-DG2-CCS-modi.patch index b2664ff..f7a7e8b 100644 --- a/patches.suse/drm-i915-Fix-watermark-calculations-for-DG2-CCS-modi.patch +++ b/patches.suse/drm-i915-Fix-watermark-calculations-for-DG2-CCS-modi.patch @@ -5,6 +5,7 @@ Subject: drm/i915: Fix watermark calculations for DG2 CCS modifiers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit +Alt-commit: ccfa6d35f9233702c924316cdf40c05b6ce88113 Git-commit: f25d9f81a8e09ace4f04106995550bae1f522143 Patch-mainline: v6.2-rc1 References: jsc#PED-1218 diff --git a/patches.suse/drm-i915-Reserve-enough-fence-slot-for-i915_vma_unbi.patch b/patches.suse/drm-i915-Reserve-enough-fence-slot-for-i915_vma_unbi.patch new file mode 100644 index 0000000..abb814c --- /dev/null +++ b/patches.suse/drm-i915-Reserve-enough-fence-slot-for-i915_vma_unbi.patch @@ -0,0 +1,55 @@ +From 476fdcdaaae7b06c780cdfc234c704107f16c529 Mon Sep 17 00:00:00 2001 +From: Nirmoy Das +Date: Fri, 23 Dec 2022 10:20:11 +0100 +Subject: drm/i915: Reserve enough fence slot for i915_vma_unbind_async +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Git-commit: 476fdcdaaae7b06c780cdfc234c704107f16c529 +Patch-mainline: v6.2-rc4 +References: git-fixes + +A nested dma_resv_reserve_fences(1) will not reserve slot from the +2nd call onwards and folowing dma_resv_add_fence() might hit the +"BUG_ON(fobj->num_fences >= fobj->max_fences)" check. + +I915 hit above nested dma_resv case in ttm_bo_handle_move_mem() with +async unbind: + +dma_resv_reserve_fences() from --> ttm_bo_handle_move_mem() + dma_resv_reserve_fences() from --> i915_vma_unbind_async() + dma_resv_add_fence() from --> i915_vma_unbind_async() +dma_resv_add_fence() from -->ttm_bo_move_accel_cleanup() + +Resolve this by adding an extra fence in i915_vma_unbind_async(). + +Suggested-by: Thomas Hellström +Fixes: 2f6b90da9192 ("drm/i915: Use vma resources for async unbinding") +Cc: # v5.18+ +Signed-off-by: Nirmoy Das +Reviewed-by: Matthew Auld +Signed-off-by: Matthew Auld +Link: https://patchwork.freedesktop.org/patch/msgid/20221223092011.11657-1-nirmoy.das@intel.com +(cherry picked from commit 4f0755c2faf7388616109717facc5bbde6850e60) +Signed-off-by: Rodrigo Vivi +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/i915/i915_vma.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c +index 3a33be5401ed..135390d975b6 100644 +--- a/drivers/gpu/drm/i915/i915_vma.c ++++ b/drivers/gpu/drm/i915/i915_vma.c +@@ -2116,7 +2116,7 @@ int i915_vma_unbind_async(struct i915_vma *vma, bool trylock_vm) + if (!obj->mm.rsgt) + return -EBUSY; + +- err = dma_resv_reserve_fences(obj->base.resv, 1); ++ err = dma_resv_reserve_fences(obj->base.resv, 2); + if (err) + return -EBUSY; + +-- +2.39.0 + diff --git a/patches.suse/drm-i915-bios-fix-a-memory-leak-in-generate_lfp_data.patch b/patches.suse/drm-i915-bios-fix-a-memory-leak-in-generate_lfp_data.patch new file mode 100644 index 0000000..a8294e4 --- /dev/null +++ b/patches.suse/drm-i915-bios-fix-a-memory-leak-in-generate_lfp_data.patch @@ -0,0 +1,42 @@ +From 1382901f75a5a7dc8eac05059fd0c7816def4eae Mon Sep 17 00:00:00 2001 +From: Xia Fukun +Date: Fri, 25 Nov 2022 14:34:28 +0800 +Subject: drm/i915/bios: fix a memory leak in generate_lfp_data_ptrs +Git-commit: 1382901f75a5a7dc8eac05059fd0c7816def4eae +Patch-mainline: v6.2-rc1 +References: git-fixes + +When (size != 0 || ptrs->lvds_ entries != 3), the program tries to +free() the ptrs. However, the ptrs is not created by calling kzmalloc(), +but is obtained by pointer offset operation. +This may lead to memory leaks or undefined behavior. + +Fix this by replacing the arguments of kfree() with ptrs_block. + +Fixes: a87d0a847607 ("drm/i915/bios: Generate LFP data table pointers if the VBT lacks them") +Signed-off-by: Xia Fukun +Signed-off-by: Jani Nikula +Link: https://patchwork.freedesktop.org/patch/msgid/20221125063428.69486-1-xiafukun@huawei.com +(cherry picked from commit 7674cd0b7d28b952151c3df26bbfa7e07eb2b4ec) +Signed-off-by: Rodrigo Vivi +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/i915/display/intel_bios.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c +index c2987f2c2b2e..572a4e3769f3 100644 +--- a/drivers/gpu/drm/i915/display/intel_bios.c ++++ b/drivers/gpu/drm/i915/display/intel_bios.c +@@ -414,7 +414,7 @@ static void *generate_lfp_data_ptrs(struct drm_i915_private *i915, + ptrs->lvds_entries++; + + if (size != 0 || ptrs->lvds_entries != 3) { +- kfree(ptrs); ++ kfree(ptrs_block); + return NULL; + } + +-- +2.39.0 + diff --git a/patches.suse/drm-i915-display-consider-DG2_RC_CCS_CC-when-migrati.patch b/patches.suse/drm-i915-display-consider-DG2_RC_CCS_CC-when-migrati.patch index 2cef07d..795594d 100644 --- a/patches.suse/drm-i915-display-consider-DG2_RC_CCS_CC-when-migrati.patch +++ b/patches.suse/drm-i915-display-consider-DG2_RC_CCS_CC-when-migrati.patch @@ -5,6 +5,7 @@ Subject: drm/i915/display: consider DG2_RC_CCS_CC when migrating buffers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit +Alt-commit: ea19684afb545605bbcb690c49a91ce2c8e596dd Git-commit: e3afc690188be8e4385d13d1b0e7f0ba01caea40 Patch-mainline: v6.2-rc1 References: jsc#PED-1218 diff --git a/patches.suse/drm-i915-guc-Fix-revocation-of-non-persistent-contex.patch b/patches.suse/drm-i915-guc-Fix-revocation-of-non-persistent-contex.patch new file mode 100644 index 0000000..8429f1e --- /dev/null +++ b/patches.suse/drm-i915-guc-Fix-revocation-of-non-persistent-contex.patch @@ -0,0 +1,180 @@ +From 7023472834a39341460dae5c9b506c76c5940cad Mon Sep 17 00:00:00 2001 +From: Tvrtko Ursulin +Date: Mon, 3 Oct 2022 13:16:30 +0100 +Subject: drm/i915/guc: Fix revocation of non-persistent contexts +Git-commit: 7023472834a39341460dae5c9b506c76c5940cad +Patch-mainline: v6.1-rc1 +References: git-fixes +Alt-commit: 0add082cebac8555ee3972ba768ae5c01db7a498 + +Patch which added graceful exit for non-persistent contexts missed the +fact it is not enough to set the exiting flag on a context and let the +backend handle it from there. + +GuC backend cannot handle it because it runs independently in the +firmware and driver might not see the requests ever again. Patch also +missed the fact some usages of intel_context_is_banned in the GuC backend +needed replacing with newly introduced intel_context_is_schedulable. + +Fix the first issue by calling into backend revoke when we know this is +the last chance to do it. Fix the second issue by replacing +intel_context_is_banned with intel_context_is_schedulable, which should +always be safe since latter is a superset of the former. + +v2: + * Just call ce->ops->revoke unconditionally. (Andrzej) + +Signed-off-by: Tvrtko Ursulin +Fixes: 45c64ecf97ee ("drm/i915: Improve user experience and driver robustness under SIGINT or similar") +Cc: Andrzej Hajda +Cc: John Harrison +Cc: Daniele Ceraolo Spurio +Cc: # v6.0+ +Reviewed-by: Andrzej Hajda +Acked-by: Daniele Ceraolo Spurio +Link: https://patchwork.freedesktop.org/patch/msgid/20221003121630.694249-1-tvrtko.ursulin@linux.intel.com +(cherry picked from commit 0add082cebac8555ee3972ba768ae5c01db7a498) +Signed-off-by: Tvrtko Ursulin +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/i915/gem/i915_gem_context.c | 8 +----- + drivers/gpu/drm/i915/gt/intel_context.c | 5 ++-- + drivers/gpu/drm/i915/gt/intel_context.h | 3 +-- + .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 26 +++++++++---------- + 4 files changed, 17 insertions(+), 25 deletions(-) + +diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c +index dabdfe09f5e5..e7148a994b3a 100644 +--- a/drivers/gpu/drm/i915/gem/i915_gem_context.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c +@@ -1383,14 +1383,8 @@ kill_engines(struct i915_gem_engines *engines, bool exit, bool persistent) + */ + for_each_gem_engine(ce, engines, it) { + struct intel_engine_cs *engine; +- bool skip = false; + +- if (exit) +- skip = intel_context_set_exiting(ce); +- else if (!persistent) +- skip = intel_context_exit_nonpersistent(ce, NULL); +- +- if (skip) ++ if ((exit || !persistent) && intel_context_revoke(ce)) + continue; /* Already marked. */ + + /* +diff --git a/drivers/gpu/drm/i915/gt/intel_context.c b/drivers/gpu/drm/i915/gt/intel_context.c +index 654a092ed3d6..e94365b08f1e 100644 +--- a/drivers/gpu/drm/i915/gt/intel_context.c ++++ b/drivers/gpu/drm/i915/gt/intel_context.c +@@ -614,13 +614,12 @@ bool intel_context_ban(struct intel_context *ce, struct i915_request *rq) + return ret; + } + +-bool intel_context_exit_nonpersistent(struct intel_context *ce, +- struct i915_request *rq) ++bool intel_context_revoke(struct intel_context *ce) + { + bool ret = intel_context_set_exiting(ce); + + if (ce->ops->revoke) +- ce->ops->revoke(ce, rq, ce->engine->props.preempt_timeout_ms); ++ ce->ops->revoke(ce, NULL, ce->engine->props.preempt_timeout_ms); + + return ret; + } +diff --git a/drivers/gpu/drm/i915/gt/intel_context.h b/drivers/gpu/drm/i915/gt/intel_context.h +index 8e2d70630c49..be09fb2e883a 100644 +--- a/drivers/gpu/drm/i915/gt/intel_context.h ++++ b/drivers/gpu/drm/i915/gt/intel_context.h +@@ -329,8 +329,7 @@ static inline bool intel_context_set_exiting(struct intel_context *ce) + return test_and_set_bit(CONTEXT_EXITING, &ce->flags); + } + +-bool intel_context_exit_nonpersistent(struct intel_context *ce, +- struct i915_request *rq); ++bool intel_context_revoke(struct intel_context *ce); + + static inline bool + intel_context_force_single_submission(const struct intel_context *ce) +diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +index 22ba66e48a9b..1db59eeb34db 100644 +--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c ++++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +@@ -684,7 +684,7 @@ static int __guc_add_request(struct intel_guc *guc, struct i915_request *rq) + * Corner case where requests were sitting in the priority list or a + * request resubmitted after the context was banned. + */ +- if (unlikely(intel_context_is_banned(ce))) { ++ if (unlikely(!intel_context_is_schedulable(ce))) { + i915_request_put(i915_request_mark_eio(rq)); + intel_engine_signal_breadcrumbs(ce->engine); + return 0; +@@ -870,15 +870,15 @@ static int guc_wq_item_append(struct intel_guc *guc, + struct i915_request *rq) + { + struct intel_context *ce = request_to_scheduling_context(rq); +- int ret = 0; ++ int ret; + +- if (likely(!intel_context_is_banned(ce))) { +- ret = __guc_wq_item_append(rq); ++ if (unlikely(!intel_context_is_schedulable(ce))) ++ return 0; + +- if (unlikely(ret == -EBUSY)) { +- guc->stalled_request = rq; +- guc->submission_stall_reason = STALL_MOVE_LRC_TAIL; +- } ++ ret = __guc_wq_item_append(rq); ++ if (unlikely(ret == -EBUSY)) { ++ guc->stalled_request = rq; ++ guc->submission_stall_reason = STALL_MOVE_LRC_TAIL; + } + + return ret; +@@ -897,7 +897,7 @@ static bool multi_lrc_submit(struct i915_request *rq) + * submitting all the requests generated in parallel. + */ + return test_bit(I915_FENCE_FLAG_SUBMIT_PARALLEL, &rq->fence.flags) || +- intel_context_is_banned(ce); ++ !intel_context_is_schedulable(ce); + } + + static int guc_dequeue_one_context(struct intel_guc *guc) +@@ -966,7 +966,7 @@ static int guc_dequeue_one_context(struct intel_guc *guc) + struct intel_context *ce = request_to_scheduling_context(last); + + if (unlikely(!ctx_id_mapped(guc, ce->guc_id.id) && +- !intel_context_is_banned(ce))) { ++ intel_context_is_schedulable(ce))) { + ret = try_context_registration(ce, false); + if (unlikely(ret == -EPIPE)) { + goto deadlk; +@@ -1576,7 +1576,7 @@ static void guc_reset_state(struct intel_context *ce, u32 head, bool scrub) + { + struct intel_engine_cs *engine = __context_to_physical_engine(ce); + +- if (intel_context_is_banned(ce)) ++ if (!intel_context_is_schedulable(ce)) + return; + + GEM_BUG_ON(!intel_context_is_pinned(ce)); +@@ -4424,12 +4424,12 @@ static void guc_handle_context_reset(struct intel_guc *guc, + { + trace_intel_context_reset(ce); + +- if (likely(!intel_context_is_banned(ce))) { ++ if (likely(intel_context_is_schedulable(ce))) { + capture_error_state(guc, ce); + guc_context_replay(ce); + } else { + drm_info(&guc_to_gt(guc)->i915->drm, +- "Ignoring context reset notification of banned context 0x%04X on %s", ++ "Ignoring context reset notification of exiting context 0x%04X on %s", + ce->guc_id.id, ce->engine->name); + } + } +-- +2.39.0 + diff --git a/patches.suse/drm-i915-guc-make-default_lists-const-data.patch b/patches.suse/drm-i915-guc-make-default_lists-const-data.patch new file mode 100644 index 0000000..2cf4fe6 --- /dev/null +++ b/patches.suse/drm-i915-guc-make-default_lists-const-data.patch @@ -0,0 +1,40 @@ +From dfa5e6ef3ccefff9fa8a70d9f5fa6ef6244aa312 Mon Sep 17 00:00:00 2001 +From: Jani Nikula +Date: Tue, 22 Nov 2022 16:16:16 +0200 +Subject: drm/i915/guc: make default_lists const data +Git-commit: dfa5e6ef3ccefff9fa8a70d9f5fa6ef6244aa312 +Patch-mainline: v6.2-rc1 +References: git-fixes + +The default_lists array should be in rodata. + +Fixes: dce2bd542337 ("drm/i915/guc: Add Gen9 registers for GuC error state capture.") +Cc: Alan Previn +Cc: Umesh Nerlige Ramappa +Cc: Lucas De Marchi +Signed-off-by: Jani Nikula +Reviewed-by: Lucas De Marchi +Link: https://patchwork.freedesktop.org/patch/msgid/20221122141616.3469214-1-jani.nikula@intel.com +(cherry picked from commit 8b7f7a9b10b704ba7d73199ff0f01354e0bad7a5) +Signed-off-by: Rodrigo Vivi +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c +index 1d49a7ec0bd8..1c1b85073b4b 100644 +--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c ++++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c +@@ -170,7 +170,7 @@ static const struct __guc_mmio_reg_descr empty_regs_list[] = { + } + + /* List of lists */ +-static struct __guc_mmio_reg_descr_group default_lists[] = { ++static const struct __guc_mmio_reg_descr_group default_lists[] = { + MAKE_REGLIST(default_global_regs, PF, GLOBAL, 0), + MAKE_REGLIST(default_rc_class_regs, PF, ENGINE_CLASS, GUC_RENDER_CLASS), + MAKE_REGLIST(xe_lpd_rc_inst_regs, PF, ENGINE_INSTANCE, GUC_RENDER_CLASS), +-- +2.39.0 + diff --git a/patches.suse/drm-i915-gvt-Add-missing-vfio_unregister_group_dev-c.patch b/patches.suse/drm-i915-gvt-Add-missing-vfio_unregister_group_dev-c.patch new file mode 100644 index 0000000..d09d473 --- /dev/null +++ b/patches.suse/drm-i915-gvt-Add-missing-vfio_unregister_group_dev-c.patch @@ -0,0 +1,38 @@ +From f423fa1bc9fe1978e6b9f54927411b62cb43eb04 Mon Sep 17 00:00:00 2001 +From: Jason Gunthorpe +Date: Thu, 29 Sep 2022 14:48:35 -0300 +Subject: drm/i915/gvt: Add missing vfio_unregister_group_dev() call +Git-commit: f423fa1bc9fe1978e6b9f54927411b62cb43eb04 +Patch-mainline: v6.1-rc1 +References: git-fixes + +When converting to directly create the vfio_device the mdev driver has to +put a vfio_register_emulated_iommu_dev() in the probe() and a pairing +vfio_unregister_group_dev() in the remove. + +This was missed for gvt, add it. + +Cc: stable@vger.kernel.org +Fixes: 978cf586ac35 ("drm/i915/gvt: convert to use vfio_register_emulated_iommu_dev") +Reported-by: Alex Williamson +Signed-off-by: Jason Gunthorpe +Reviewed-by: Kevin Tian +Reviewed-by: Christoph Hellwig +Link: https://lore.kernel.org/r/0-v1-013609965fe8+9d-vfio_gvt_unregister_jgg@nvidia.com +Signed-off-by: Alex Williamson +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/i915/gvt/kvmgt.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/gpu/drm/i915/gvt/kvmgt.c ++++ b/drivers/gpu/drm/i915/gvt/kvmgt.c +@@ -1595,6 +1595,8 @@ + + if (WARN_ON_ONCE(vgpu->attached)) + return; ++ ++ vfio_unregister_group_dev(&vgpu->vfio_device); + intel_gvt_destroy_vgpu(vgpu); + } + diff --git a/patches.suse/drm-i915-gvt-Get-reference-to-KVM-iff-attachment-to-.patch b/patches.suse/drm-i915-gvt-Get-reference-to-KVM-iff-attachment-to-.patch new file mode 100644 index 0000000..e7216db --- /dev/null +++ b/patches.suse/drm-i915-gvt-Get-reference-to-KVM-iff-attachment-to-.patch @@ -0,0 +1,47 @@ +From 9ed1fdee9ee324f3505ff066287ee53143caaaa2 Mon Sep 17 00:00:00 2001 +From: Sean Christopherson +Date: Fri, 11 Nov 2022 00:22:24 +0000 +Subject: drm/i915/gvt: Get reference to KVM iff attachment to VM is successful +Git-commit: 9ed1fdee9ee324f3505ff066287ee53143caaaa2 +Patch-mainline: v6.1-rc7 +References: git-fixes + +Get a reference to KVM if and only if a vGPU is successfully attached to +the VM to avoid leaking a reference if there's no available vGPU. On +open_device() failure, vfio_device_open() doesn't invoke close_device(). + +Fixes: 421cfe6596f6 ("vfio: remove VFIO_GROUP_NOTIFY_SET_KVM") +Cc: stable@vger.kernel.org +Reviewed-by: Kevin Tian +Signed-off-by: Sean Christopherson +Signed-off-by: Zhenyu Wang +Link: http://patchwork.freedesktop.org/patch/msgid/20221111002225.2418386-2-seanjc@google.com +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/i915/gvt/kvmgt.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c +index 7a45e5360caf..e67d5267fde0 100644 +--- a/drivers/gpu/drm/i915/gvt/kvmgt.c ++++ b/drivers/gpu/drm/i915/gvt/kvmgt.c +@@ -664,8 +664,6 @@ static int intel_vgpu_open_device(struct vfio_device *vfio_dev) + return -ESRCH; + } + +- kvm_get_kvm(vgpu->vfio_device.kvm); +- + if (__kvmgt_vgpu_exist(vgpu)) + return -EEXIST; + +@@ -676,6 +674,7 @@ static int intel_vgpu_open_device(struct vfio_device *vfio_dev) + + vgpu->track_node.track_write = kvmgt_page_track_write; + vgpu->track_node.track_flush_slot = kvmgt_page_track_flush_slot; ++ kvm_get_kvm(vgpu->vfio_device.kvm); + kvm_page_track_register_notifier(vgpu->vfio_device.kvm, + &vgpu->track_node); + +-- +2.39.0 + diff --git a/patches.suse/drm-i915-improve-the-catch-all-evict-to-handle-lock-.patch b/patches.suse/drm-i915-improve-the-catch-all-evict-to-handle-lock-.patch new file mode 100644 index 0000000..b021fd5 --- /dev/null +++ b/patches.suse/drm-i915-improve-the-catch-all-evict-to-handle-lock-.patch @@ -0,0 +1,295 @@ +From 3f882f2d4f689627c1566c2c92087bc3ff734953 Mon Sep 17 00:00:00 2001 +From: Matthew Auld +Date: Fri, 16 Dec 2022 11:34:56 +0000 +Subject: drm/i915: improve the catch-all evict to handle lock contention +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Git-commit: 3f882f2d4f689627c1566c2c92087bc3ff734953 +Patch-mainline: v6.2-rc2 +References: git-fixes + +The catch-all evict can fail due to object lock contention, since it +only goes as far as trylocking the object, due to us already holding the +vm->mutex. Doing a full object lock here can deadlock, since the +vm->mutex is always our inner lock. Add another execbuf pass which drops +the vm->mutex and then tries to grab the object will the full lock, +before then retrying the eviction. This should be good enough for now to +fix the immediate regression with userspace seeing -ENOSPC from execbuf +due to contended object locks during GTT eviction. + +v2 (Mani) + - Also revamp the docs for the different passes. + +Testcase: igt@gem_ppgtt@shrink-vs-evict-* +Fixes: 7e00897be8bf ("drm/i915: Add object locking to i915_gem_evict_for_node and i915_gem_evict_something, v2.") +References: https://gitlab.freedesktop.org/drm/intel/-/issues/7627 +References: https://gitlab.freedesktop.org/drm/intel/-/issues/7570 +References: https://bugzilla.mozilla.org/show_bug.cgi?id=1779558 +Signed-off-by: Matthew Auld +Cc: Maarten Lankhorst +Cc: Thomas Hellström +Cc: Tvrtko Ursulin +Cc: Andrzej Hajda +Cc: Mani Milani +Cc: # v5.18+ +Reviewed-by: Mani Milani +Tested-by: Mani Milani +Link: https://patchwork.freedesktop.org/patch/msgid/20221216113456.414183-1-matthew.auld@intel.com +(cherry picked from commit 801fa7a81f6da533cc5442fc40e32c72b76cd42a) +Signed-off-by: Rodrigo Vivi +Acked-by: Patrik Jakobsson +--- + .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 59 +++++++++++++++---- + drivers/gpu/drm/i915/gem/i915_gem_mman.c | 2 +- + drivers/gpu/drm/i915/i915_gem_evict.c | 37 ++++++++---- + drivers/gpu/drm/i915/i915_gem_evict.h | 4 +- + drivers/gpu/drm/i915/i915_vma.c | 2 +- + .../gpu/drm/i915/selftests/i915_gem_evict.c | 4 +- + 6 files changed, 82 insertions(+), 26 deletions(-) + +diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +index da09767fda07..f266b68cf012 100644 +--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +@@ -730,32 +730,69 @@ static int eb_reserve(struct i915_execbuffer *eb) + bool unpinned; + + /* +- * Attempt to pin all of the buffers into the GTT. +- * This is done in 2 phases: ++ * We have one more buffers that we couldn't bind, which could be due to ++ * various reasons. To resolve this we have 4 passes, with every next ++ * level turning the screws tighter: + * +- * 1. Unbind all objects that do not match the GTT constraints for +- * the execbuffer (fenceable, mappable, alignment etc). +- * 2. Bind new objects. ++ * 0. Unbind all objects that do not match the GTT constraints for the ++ * execbuffer (fenceable, mappable, alignment etc). Bind all new ++ * objects. This avoids unnecessary unbinding of later objects in order ++ * to make room for the earlier objects *unless* we need to defragment. + * +- * This avoid unnecessary unbinding of later objects in order to make +- * room for the earlier objects *unless* we need to defragment. ++ * 1. Reorder the buffers, where objects with the most restrictive ++ * placement requirements go first (ignoring fixed location buffers for ++ * now). For example, objects needing the mappable aperture (the first ++ * 256M of GTT), should go first vs objects that can be placed just ++ * about anywhere. Repeat the previous pass. + * +- * Defragmenting is skipped if all objects are pinned at a fixed location. ++ * 2. Consider buffers that are pinned at a fixed location. Also try to ++ * evict the entire VM this time, leaving only objects that we were ++ * unable to lock. Try again to bind the buffers. (still using the new ++ * buffer order). ++ * ++ * 3. We likely have object lock contention for one or more stubborn ++ * objects in the VM, for which we need to evict to make forward ++ * progress (perhaps we are fighting the shrinker?). When evicting the ++ * VM this time around, anything that we can't lock we now track using ++ * the busy_bo, using the full lock (after dropping the vm->mutex to ++ * prevent deadlocks), instead of trylock. We then continue to evict the ++ * VM, this time with the stubborn object locked, which we can now ++ * hopefully unbind (if still bound in the VM). Repeat until the VM is ++ * evicted. Finally we should be able bind everything. + */ +- for (pass = 0; pass <= 2; pass++) { ++ for (pass = 0; pass <= 3; pass++) { + int pin_flags = PIN_USER | PIN_VALIDATE; + + if (pass == 0) + pin_flags |= PIN_NONBLOCK; + + if (pass >= 1) +- unpinned = eb_unbind(eb, pass == 2); ++ unpinned = eb_unbind(eb, pass >= 2); + + if (pass == 2) { + err = mutex_lock_interruptible(&eb->context->vm->mutex); + if (!err) { +- err = i915_gem_evict_vm(eb->context->vm, &eb->ww); ++ err = i915_gem_evict_vm(eb->context->vm, &eb->ww, NULL); ++ mutex_unlock(&eb->context->vm->mutex); ++ } ++ if (err) ++ return err; ++ } ++ ++ if (pass == 3) { ++retry: ++ err = mutex_lock_interruptible(&eb->context->vm->mutex); ++ if (!err) { ++ struct drm_i915_gem_object *busy_bo = NULL; ++ ++ err = i915_gem_evict_vm(eb->context->vm, &eb->ww, &busy_bo); + mutex_unlock(&eb->context->vm->mutex); ++ if (err && busy_bo) { ++ err = i915_gem_object_lock(busy_bo, &eb->ww); ++ i915_gem_object_put(busy_bo); ++ if (!err) ++ goto retry; ++ } + } + if (err) + return err; +diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c +index c29efdef8313..0ad44f3868de 100644 +--- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c +@@ -369,7 +369,7 @@ static vm_fault_t vm_fault_gtt(struct vm_fault *vmf) + if (vma == ERR_PTR(-ENOSPC)) { + ret = mutex_lock_interruptible(&ggtt->vm.mutex); + if (!ret) { +- ret = i915_gem_evict_vm(&ggtt->vm, &ww); ++ ret = i915_gem_evict_vm(&ggtt->vm, &ww, NULL); + mutex_unlock(&ggtt->vm.mutex); + } + if (ret) +diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c +index f025ee4fa526..a4b4d9b7d26c 100644 +--- a/drivers/gpu/drm/i915/i915_gem_evict.c ++++ b/drivers/gpu/drm/i915/i915_gem_evict.c +@@ -416,6 +416,11 @@ int i915_gem_evict_for_node(struct i915_address_space *vm, + * @vm: Address space to cleanse + * @ww: An optional struct i915_gem_ww_ctx. If not NULL, i915_gem_evict_vm + * will be able to evict vma's locked by the ww as well. ++ * @busy_bo: Optional pointer to struct drm_i915_gem_object. If not NULL, then ++ * in the event i915_gem_evict_vm() is unable to trylock an object for eviction, ++ * then @busy_bo will point to it. -EBUSY is also returned. The caller must drop ++ * the vm->mutex, before trying again to acquire the contended lock. The caller ++ * also owns a reference to the object. + * + * This function evicts all vmas from a vm. + * +@@ -425,7 +430,8 @@ int i915_gem_evict_for_node(struct i915_address_space *vm, + * To clarify: This is for freeing up virtual address space, not for freeing + * memory in e.g. the shrinker. + */ +-int i915_gem_evict_vm(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww) ++int i915_gem_evict_vm(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww, ++ struct drm_i915_gem_object **busy_bo) + { + int ret = 0; + +@@ -457,15 +463,22 @@ int i915_gem_evict_vm(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww) + * the resv is shared among multiple objects, we still + * need the object ref. + */ +- if (dying_vma(vma) || ++ if (!i915_gem_object_get_rcu(vma->obj) || + (ww && (dma_resv_locking_ctx(vma->obj->base.resv) == &ww->ctx))) { + __i915_vma_pin(vma); + list_add(&vma->evict_link, &locked_eviction_list); + continue; + } + +- if (!i915_gem_object_trylock(vma->obj, ww)) ++ if (!i915_gem_object_trylock(vma->obj, ww)) { ++ if (busy_bo) { ++ *busy_bo = vma->obj; /* holds ref */ ++ ret = -EBUSY; ++ break; ++ } ++ i915_gem_object_put(vma->obj); + continue; ++ } + + __i915_vma_pin(vma); + list_add(&vma->evict_link, &eviction_list); +@@ -473,25 +486,29 @@ int i915_gem_evict_vm(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww) + if (list_empty(&eviction_list) && list_empty(&locked_eviction_list)) + break; + +- ret = 0; + /* Unbind locked objects first, before unlocking the eviction_list */ + list_for_each_entry_safe(vma, vn, &locked_eviction_list, evict_link) { + __i915_vma_unpin(vma); + +- if (ret == 0) ++ if (ret == 0) { + ret = __i915_vma_unbind(vma); +- if (ret != -EINTR) /* "Get me out of here!" */ +- ret = 0; ++ if (ret != -EINTR) /* "Get me out of here!" */ ++ ret = 0; ++ } ++ if (!dying_vma(vma)) ++ i915_gem_object_put(vma->obj); + } + + list_for_each_entry_safe(vma, vn, &eviction_list, evict_link) { + __i915_vma_unpin(vma); +- if (ret == 0) ++ if (ret == 0) { + ret = __i915_vma_unbind(vma); +- if (ret != -EINTR) /* "Get me out of here!" */ +- ret = 0; ++ if (ret != -EINTR) /* "Get me out of here!" */ ++ ret = 0; ++ } + + i915_gem_object_unlock(vma->obj); ++ i915_gem_object_put(vma->obj); + } + } while (ret == 0); + +diff --git a/drivers/gpu/drm/i915/i915_gem_evict.h b/drivers/gpu/drm/i915/i915_gem_evict.h +index e593c530f9bd..bf0ee0e4fe60 100644 +--- a/drivers/gpu/drm/i915/i915_gem_evict.h ++++ b/drivers/gpu/drm/i915/i915_gem_evict.h +@@ -11,6 +11,7 @@ + struct drm_mm_node; + struct i915_address_space; + struct i915_gem_ww_ctx; ++struct drm_i915_gem_object; + + int __must_check i915_gem_evict_something(struct i915_address_space *vm, + struct i915_gem_ww_ctx *ww, +@@ -23,6 +24,7 @@ int __must_check i915_gem_evict_for_node(struct i915_address_space *vm, + struct drm_mm_node *node, + unsigned int flags); + int i915_gem_evict_vm(struct i915_address_space *vm, +- struct i915_gem_ww_ctx *ww); ++ struct i915_gem_ww_ctx *ww, ++ struct drm_i915_gem_object **busy_bo); + + #endif /* __I915_GEM_EVICT_H__ */ +diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c +index 703fee6b5f75..3a33be5401ed 100644 +--- a/drivers/gpu/drm/i915/i915_vma.c ++++ b/drivers/gpu/drm/i915/i915_vma.c +@@ -1566,7 +1566,7 @@ static int __i915_ggtt_pin(struct i915_vma *vma, struct i915_gem_ww_ctx *ww, + * locked objects when called from execbuf when pinning + * is removed. This would probably regress badly. + */ +- i915_gem_evict_vm(vm, NULL); ++ i915_gem_evict_vm(vm, NULL, NULL); + mutex_unlock(&vm->mutex); + } + } while (1); +diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c +index 8c6517d29b8e..37068542aafe 100644 +--- a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c ++++ b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c +@@ -344,7 +344,7 @@ static int igt_evict_vm(void *arg) + + /* Everything is pinned, nothing should happen */ + mutex_lock(&ggtt->vm.mutex); +- err = i915_gem_evict_vm(&ggtt->vm, NULL); ++ err = i915_gem_evict_vm(&ggtt->vm, NULL, NULL); + mutex_unlock(&ggtt->vm.mutex); + if (err) { + pr_err("i915_gem_evict_vm on a full GGTT returned err=%d]\n", +@@ -356,7 +356,7 @@ static int igt_evict_vm(void *arg) + + for_i915_gem_ww(&ww, err, false) { + mutex_lock(&ggtt->vm.mutex); +- err = i915_gem_evict_vm(&ggtt->vm, &ww); ++ err = i915_gem_evict_vm(&ggtt->vm, &ww, NULL); + mutex_unlock(&ggtt->vm.mutex); + } + +-- +2.39.0 + diff --git a/patches.suse/drm-i915-psr-Send-update-also-on-invalidate.patch b/patches.suse/drm-i915-psr-Send-update-also-on-invalidate.patch new file mode 100644 index 0000000..9028318 --- /dev/null +++ b/patches.suse/drm-i915-psr-Send-update-also-on-invalidate.patch @@ -0,0 +1,70 @@ +From 4ff4ebac3f1378f4ba6e11fe5ad4a4ac590bb8a4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jouni=20H=C3=B6gander?= +Date: Mon, 24 Oct 2022 08:46:49 +0300 +Subject: drm/i915/psr: Send update also on invalidate +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Alt-commit: d755f89220a2b49bc90b7b520bb6edeb4adb5f01 +Git-commit: 4ff4ebac3f1378f4ba6e11fe5ad4a4ac590bb8a4 +Patch-mainline: v6.1-rc5 +References: git-fixes + +Currently we are observing mouse cursor stuttering when using +xrandr --scaling=1.2x1.2. X scaling/transformation seems to be +doing fronbuffer rendering. When moving mouse cursor X seems to +perform several invalidates and only one DirtyFB. I.e. it seems +to be assuming updates are sent to panel while drawing is done. + +Earlier we were disabling PSR in frontbuffer invalidate call back +(when drawing in X started). PSR was re-enabled in frontbuffer +flush callback (dirtyfb ioctl). This was working fine with X +scaling/transformation. Now we are just enabling continuous full +frame (cff) in PSR invalidate callback. Enabling cff doesn't +trigger any updates. It just configures PSR to send full frame +when updates are sent. I.e. there are no updates on screen before +PSR flush callback is made. X seems to be doing several updates +in frontbuffer before doing dirtyfb ioctl. + +Fix this by sending single update on every invalidate callback. + +Cc: José Roberto de Souza +Cc: Ville Syrjälä +Cc: Mika Kahola + +Fixes: 805f04d42a6b ("drm/i915/display/psr: Use continuos full frame to handle frontbuffer invalidations") +Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6679 +Signed-off-by: Jouni Högander +Reported-by: Brian J. Tarricone +Tested-by: Brian J. Tarricone +Reviewed-by: Mika Kahola +Reviewed-by: José Roberto de Souza +Signed-off-by: José Roberto de Souza +Link: https://patchwork.freedesktop.org/patch/msgid/20221024054649.31299-1-jouni.hogander@intel.com +(cherry picked from commit d755f89220a2b49bc90b7b520bb6edeb4adb5f01) +Signed-off-by: Tvrtko Ursulin +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/i915/display/intel_psr.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c +index d4cce627d7a8..15c3e448aa0e 100644 +--- a/drivers/gpu/drm/i915/display/intel_psr.c ++++ b/drivers/gpu/drm/i915/display/intel_psr.c +@@ -2201,8 +2201,11 @@ static void _psr_invalidate_handle(struct intel_dp *intel_dp) + if (intel_dp->psr.psr2_sel_fetch_enabled) { + u32 val; + +- if (intel_dp->psr.psr2_sel_fetch_cff_enabled) ++ if (intel_dp->psr.psr2_sel_fetch_cff_enabled) { ++ /* Send one update otherwise lag is observed in screen */ ++ intel_de_write(dev_priv, CURSURFLIVE(intel_dp->psr.pipe), 0); + return; ++ } + + val = man_trk_ctl_enable_bit_get(dev_priv) | + man_trk_ctl_partial_frame_bit_get(dev_priv) | +-- +2.39.0 + diff --git a/patches.suse/drm-i915-selftests-Unwind-hugepages-to-drop-wakeref-.patch b/patches.suse/drm-i915-selftests-Unwind-hugepages-to-drop-wakeref-.patch new file mode 100644 index 0000000..6310b4b --- /dev/null +++ b/patches.suse/drm-i915-selftests-Unwind-hugepages-to-drop-wakeref-.patch @@ -0,0 +1,69 @@ +From 93eea624526fc7d070cdae463408665824075f54 Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Tue, 17 Jan 2023 13:32:34 +0100 +Subject: drm/i915/selftests: Unwind hugepages to drop wakeref on error +Git-commit: 93eea624526fc7d070cdae463408665824075f54 +Patch-mainline: v6.2-rc5 +References: git-fixes + +Make sure that upon error after we have acquired the wakeref we do +release it again. + +v2: add another missing "goto out_wf"(Andi). + +Fixes: 027c38b4121e ("drm/i915/selftests: Grab the runtime pm in shrink_thp") +Cc: Andi Shyti +Reviewed-by: Matthew Auld +Reviewed-by: Andrzej Hajda +Signed-off-by: Chris Wilson +Signed-off-by: Nirmoy Das +Reviewed-by: Andi Shyti +Reviewed-by: Nirmoy Das +Signed-off-by: Andi Shyti +Link: https://patchwork.freedesktop.org/patch/msgid/20230117123234.26487-1-nirmoy.das@intel.com +(cherry picked from commit 14ec40a88210151296fff3e981c1a7196ad9bf55) +Signed-off-by: Rodrigo Vivi +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/i915/gem/selftests/huge_pages.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c +index beaf27e09e8a..977dead10ab5 100644 +--- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c ++++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c +@@ -1847,7 +1847,7 @@ static int igt_shrink_thp(void *arg) + I915_SHRINK_ACTIVE); + i915_vma_unpin(vma); + if (err) +- goto out_put; ++ goto out_wf; + + /* + * Now that the pages are *unpinned* shrinking should invoke +@@ -1863,19 +1863,19 @@ static int igt_shrink_thp(void *arg) + pr_err("unexpected pages mismatch, should_swap=%s\n", + str_yes_no(should_swap)); + err = -EINVAL; +- goto out_put; ++ goto out_wf; + } + + if (should_swap == (obj->mm.page_sizes.sg || obj->mm.page_sizes.phys)) { + pr_err("unexpected residual page-size bits, should_swap=%s\n", + str_yes_no(should_swap)); + err = -EINVAL; +- goto out_put; ++ goto out_wf; + } + + err = i915_vma_pin(vma, 0, 0, flags); + if (err) +- goto out_put; ++ goto out_wf; + + while (n--) { + err = cpu_check(obj, n, 0xdeadbeaf); +-- +2.39.0 + diff --git a/patches.suse/drm-i915-ttm-consider-CCS-for-backup-objects.patch b/patches.suse/drm-i915-ttm-consider-CCS-for-backup-objects.patch new file mode 100644 index 0000000..d2d7a72 --- /dev/null +++ b/patches.suse/drm-i915-ttm-consider-CCS-for-backup-objects.patch @@ -0,0 +1,120 @@ +From ad0fca2dceeab8fdd8e1135f4b4ef2dc46c2ead9 Mon Sep 17 00:00:00 2001 +From: Matthew Auld +Date: Mon, 12 Dec 2022 17:19:58 +0000 +Subject: drm/i915/ttm: consider CCS for backup objects +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Git-commit: ad0fca2dceeab8fdd8e1135f4b4ef2dc46c2ead9 +Patch-mainline: v6.2-rc1 +References: git-fixes + +It seems we can have one or more framebuffers that are still pinned when +suspending lmem, in such a case we end up creating a shmem backup +object, instead of evicting the object directly, but this will skip +copying the CCS aux state, since we don't allocate the extra storage for +the CCS pages as part of the ttm_tt construction. Since we can already +deal with pinned objects just fine, it doesn't seem too nasty to just +extend to support dealing with the CCS aux state, if the object is a +pinned framebuffer. This fixes display corruption (like in gnome-shell) +seen on DG2 when returning from suspend. + +Fixes: da0595ae91da ("drm/i915/migrate: Evict and restore the flatccs capable lmem obj") +Signed-off-by: Matthew Auld +Cc: Ville Syrjälä +Cc: Nirmoy Das +Cc: Andrzej Hajda +Cc: Shuicheng Lin +Cc: # v5.19+ +Tested-by: Nirmoy Das +Reviewed-by: Nirmoy Das +Link: https://patchwork.freedesktop.org/patch/msgid/20221212171958.82593-2-matthew.auld@intel.com +(cherry picked from commit 95df9cc24bee8a09d39c62bcef4319b984814e18) +Signed-off-by: Rodrigo Vivi +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/i915/gem/i915_gem_object.c | 3 +++ + .../gpu/drm/i915/gem/i915_gem_object_types.h | 10 ++++++---- + drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c | 18 +++++++++++++++++- + 3 files changed, 26 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c +index 733696057761..1a0886b8aaa1 100644 +--- a/drivers/gpu/drm/i915/gem/i915_gem_object.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c +@@ -785,6 +785,9 @@ bool i915_gem_object_needs_ccs_pages(struct drm_i915_gem_object *obj) + if (!HAS_FLAT_CCS(to_i915(obj->base.dev))) + return false; + ++ if (obj->flags & I915_BO_ALLOC_CCS_AUX) ++ return true; ++ + for (i = 0; i < obj->mm.n_placements; i++) { + /* Compression is not allowed for the objects with smem placement */ + if (obj->mm.placements[i]->type == INTEL_MEMORY_SYSTEM) +diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object_types.h b/drivers/gpu/drm/i915/gem/i915_gem_object_types.h +index d0d6772e6f36..ab4c2f90a564 100644 +--- a/drivers/gpu/drm/i915/gem/i915_gem_object_types.h ++++ b/drivers/gpu/drm/i915/gem/i915_gem_object_types.h +@@ -327,16 +327,18 @@ struct drm_i915_gem_object { + * dealing with userspace objects the CPU fault handler is free to ignore this. + */ + #define I915_BO_ALLOC_GPU_ONLY BIT(6) ++#define I915_BO_ALLOC_CCS_AUX BIT(7) + #define I915_BO_ALLOC_FLAGS (I915_BO_ALLOC_CONTIGUOUS | \ + I915_BO_ALLOC_VOLATILE | \ + I915_BO_ALLOC_CPU_CLEAR | \ + I915_BO_ALLOC_USER | \ + I915_BO_ALLOC_PM_VOLATILE | \ + I915_BO_ALLOC_PM_EARLY | \ +- I915_BO_ALLOC_GPU_ONLY) +-#define I915_BO_READONLY BIT(7) +-#define I915_TILING_QUIRK_BIT 8 /* unknown swizzling; do not release! */ +-#define I915_BO_PROTECTED BIT(9) ++ I915_BO_ALLOC_GPU_ONLY | \ ++ I915_BO_ALLOC_CCS_AUX) ++#define I915_BO_READONLY BIT(8) ++#define I915_TILING_QUIRK_BIT 9 /* unknown swizzling; do not release! */ ++#define I915_BO_PROTECTED BIT(10) + /** + * @mem_flags - Mutable placement-related flags + * +diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c +index 07e49f22f2de..7e67742bc65e 100644 +--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c +@@ -50,6 +50,7 @@ static int i915_ttm_backup(struct i915_gem_apply_to_region *apply, + container_of(bo->bdev, typeof(*i915), bdev); + struct drm_i915_gem_object *backup; + struct ttm_operation_ctx ctx = {}; ++ unsigned int flags; + int err = 0; + + if (bo->resource->mem_type == I915_PL_SYSTEM || obj->ttm.backup) +@@ -65,7 +66,22 @@ static int i915_ttm_backup(struct i915_gem_apply_to_region *apply, + if (obj->flags & I915_BO_ALLOC_PM_VOLATILE) + return 0; + +- backup = i915_gem_object_create_shmem(i915, obj->base.size); ++ /* ++ * It seems that we might have some framebuffers still pinned at this ++ * stage, but for such objects we might also need to deal with the CCS ++ * aux state. Make sure we force the save/restore of the CCS state, ++ * otherwise we might observe display corruption, when returning from ++ * suspend. ++ */ ++ flags = 0; ++ if (i915_gem_object_needs_ccs_pages(obj)) { ++ WARN_ON_ONCE(!i915_gem_object_is_framebuffer(obj)); ++ WARN_ON_ONCE(!pm_apply->allow_gpu); ++ ++ flags = I915_BO_ALLOC_CCS_AUX; ++ } ++ backup = i915_gem_object_create_region(i915->mm.regions[INTEL_REGION_SMEM], ++ obj->base.size, 0, flags); + if (IS_ERR(backup)) + return PTR_ERR(backup); + +-- +2.39.0 + diff --git a/patches.suse/drm-imx-Kconfig-Remove-duplicated-select-DRM_KMS_HEL.patch b/patches.suse/drm-imx-Kconfig-Remove-duplicated-select-DRM_KMS_HEL.patch new file mode 100644 index 0000000..c4e6804 --- /dev/null +++ b/patches.suse/drm-imx-Kconfig-Remove-duplicated-select-DRM_KMS_HEL.patch @@ -0,0 +1,32 @@ +From ff52fe006fdeacee49745dabed26154db52a6343 Mon Sep 17 00:00:00 2001 +From: Liu Ying +Date: Sun, 9 Oct 2022 10:35:27 +0800 +Subject: drm/imx: Kconfig: Remove duplicated 'select DRM_KMS_HELPER' line +Git-commit: ff52fe006fdeacee49745dabed26154db52a6343 +Patch-mainline: v6.1-rc4 +References: git-fixes + +A duplicated line 'select DRM_KMS_HELPER' was introduced in Kconfig file +by commit 09717af7d13d ("drm: Remove CONFIG_DRM_KMS_CMA_HELPER option"), +so remove it. + +Fixes: 09717af7d13d ("drm: Remove CONFIG_DRM_KMS_CMA_HELPER option") +Signed-off-by: Liu Ying +Reviewed-by: Philipp Zabel +Signed-off-by: Philipp Zabel +Link: https://patchwork.freedesktop.org/patch/msgid/20221009023527.3669647-1-victor.liu@nxp.com +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/imx/Kconfig | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/gpu/drm/imx/Kconfig ++++ b/drivers/gpu/drm/imx/Kconfig +@@ -4,7 +4,6 @@ + select DRM_KMS_HELPER + select VIDEOMODE_HELPERS + select DRM_GEM_CMA_HELPER +- select DRM_KMS_HELPER + depends on DRM && (ARCH_MXC || ARCH_MULTIPLATFORM || COMPILE_TEST) + depends on IMX_IPUV3_CORE + help diff --git a/patches.suse/drm-lcdif-Clean-up-debug-prints-and-comments.patch b/patches.suse/drm-lcdif-Clean-up-debug-prints-and-comments.patch new file mode 100644 index 0000000..92d8678 --- /dev/null +++ b/patches.suse/drm-lcdif-Clean-up-debug-prints-and-comments.patch @@ -0,0 +1,49 @@ +From 71c627c0a87acb13080317c5bae1f1423bebd5ef Mon Sep 17 00:00:00 2001 +From: Marek Vasut +Date: Fri, 19 Aug 2022 16:08:51 +0200 +Subject: drm/lcdif: Clean up debug prints and comments +Git-commit: 71c627c0a87acb13080317c5bae1f1423bebd5ef +Patch-mainline: v6.1-rc1 +References: git-fixes + +Update debug print to report bridge timings over connector ones. +Drop missed comment commit from mxsfb. + +Acked-by: Sam Ravnborg +Reviewed-by: Liu Ying +Reported-by: Liu Ying +Tested-by: Martyn Welch +Fixes: 9db35bb349a0e ("drm: lcdif: Add support for i.MX8MP LCDIF variant") +Signed-off-by: Marek Vasut +Cc: Alexander Stein +Cc: Laurent Pinchart +Cc: Liu Ying +Cc: Lucas Stach +Cc: Marek Vasut +Cc: Martyn Welch +Cc: Peng Fan +Cc: Robby Cai +Cc: Sam Ravnborg +Cc: Stefan Agner +Link: https://patchwork.freedesktop.org/patch/msgid/20220819140852.255187-3-marex@denx.de +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/mxsfb/lcdif_kms.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c +index db7a90e5497c..b1092aab1423 100644 +--- a/drivers/gpu/drm/mxsfb/lcdif_kms.c ++++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c +@@ -203,7 +203,7 @@ static void lcdif_crtc_mode_set_nofb(struct lcdif_drm_private *lcdif, + DRM_DEV_DEBUG_DRIVER(drm->dev, "Pixel clock: %dkHz (actual: %dkHz)\n", + m->crtc_clock, + (int)(clk_get_rate(lcdif->clk) / 1000)); +- DRM_DEV_DEBUG_DRIVER(drm->dev, "Connector bus_flags: 0x%08X\n", ++ DRM_DEV_DEBUG_DRIVER(drm->dev, "Bridge bus_flags: 0x%08X\n", + bus_flags); + DRM_DEV_DEBUG_DRIVER(drm->dev, "Mode flags: 0x%08X\n", m->flags); + +-- +2.39.0 + diff --git a/patches.suse/drm-lcdif-Clean-up-headers.patch b/patches.suse/drm-lcdif-Clean-up-headers.patch new file mode 100644 index 0000000..8f5a079 --- /dev/null +++ b/patches.suse/drm-lcdif-Clean-up-headers.patch @@ -0,0 +1,79 @@ +From fcfd3e5fb2f052f6f466285107f449d462277a99 Mon Sep 17 00:00:00 2001 +From: Marek Vasut +Date: Fri, 19 Aug 2022 16:08:49 +0200 +Subject: drm/lcdif: Clean up headers +Git-commit: fcfd3e5fb2f052f6f466285107f449d462277a99 +Patch-mainline: v6.1-rc1 +References: git-fixes + +Drop unneeded headers, sort rest alphabetically, no functional change. + +Acked-by: Sam Ravnborg +Reviewed-by: Liu Ying +Reported-by: Liu Ying +Tested-by: Martyn Welch +Fixes: 9db35bb349a0e ("drm: lcdif: Add support for i.MX8MP LCDIF variant") +Signed-off-by: Marek Vasut +Cc: Alexander Stein +Cc: Laurent Pinchart +Cc: Liu Ying +Cc: Lucas Stach +Cc: Marek Vasut +Cc: Martyn Welch +Cc: Peng Fan +Cc: Robby Cai +Cc: Sam Ravnborg +Cc: Stefan Agner +Reviewed-by: Alexander Stein +Link: https://patchwork.freedesktop.org/patch/msgid/20220819140852.255187-1-marex@denx.de +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/mxsfb/lcdif_drv.c | 3 --- + drivers/gpu/drm/mxsfb/lcdif_drv.h | 1 + + drivers/gpu/drm/mxsfb/lcdif_kms.c | 2 +- + 3 files changed, 2 insertions(+), 4 deletions(-) + +--- a/drivers/gpu/drm/mxsfb/lcdif_drv.c ++++ b/drivers/gpu/drm/mxsfb/lcdif_drv.c +@@ -8,7 +8,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -16,10 +15,8 @@ + + #include + #include +-#include + #include + #include +-#include + #include + #include + #include +--- a/drivers/gpu/drm/mxsfb/lcdif_drv.h ++++ b/drivers/gpu/drm/mxsfb/lcdif_drv.h +@@ -8,6 +8,7 @@ + #ifndef __LCDIF_DRV_H__ + #define __LCDIF_DRV_H__ + ++#include + #include + #include + #include +--- a/drivers/gpu/drm/mxsfb/lcdif_kms.c ++++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c +@@ -17,9 +17,9 @@ + #include + #include + #include +-#include + #include + #include ++#include + #include + #include + #include diff --git a/patches.suse/drm-lcdif-Consistently-use-plain-timings.patch b/patches.suse/drm-lcdif-Consistently-use-plain-timings.patch new file mode 100644 index 0000000..f834579 --- /dev/null +++ b/patches.suse/drm-lcdif-Consistently-use-plain-timings.patch @@ -0,0 +1,61 @@ +From 5e6723ef3fda07b4d586965af3c7af2a957480a2 Mon Sep 17 00:00:00 2001 +From: Marek Vasut +Date: Fri, 19 Aug 2022 16:08:50 +0200 +Subject: drm/lcdif: Consistently use plain timings +Git-commit: 5e6723ef3fda07b4d586965af3c7af2a957480a2 +Patch-mainline: v6.1-rc1 +References: git-fixes + +Drop the crtc_ prefix from mode, consistently use the plain one. + +Acked-by: Sam Ravnborg +Reviewed-by: Liu Ying +Reported-by: Liu Ying +Tested-by: Martyn Welch +Fixes: 9db35bb349a0e ("drm: lcdif: Add support for i.MX8MP LCDIF variant") +Signed-off-by: Marek Vasut +Cc: Alexander Stein +Cc: Laurent Pinchart +Cc: Liu Ying +Cc: Lucas Stach +Cc: Marek Vasut +Cc: Martyn Welch +Cc: Peng Fan +Cc: Robby Cai +Cc: Sam Ravnborg +Cc: Stefan Agner +Link: https://patchwork.freedesktop.org/patch/msgid/20220819140852.255187-2-marex@denx.de +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/mxsfb/lcdif_kms.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c +index 750e7e7ea8e8..db7a90e5497c 100644 +--- a/drivers/gpu/drm/mxsfb/lcdif_kms.c ++++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c +@@ -122,8 +122,8 @@ static void lcdif_set_mode(struct lcdif_drm_private *lcdif, u32 bus_flags) + + writel(ctrl, lcdif->base + LCDC_V8_CTRL); + +- writel(DISP_SIZE_DELTA_Y(m->crtc_vdisplay) | +- DISP_SIZE_DELTA_X(m->crtc_hdisplay), ++ writel(DISP_SIZE_DELTA_Y(m->vdisplay) | ++ DISP_SIZE_DELTA_X(m->hdisplay), + lcdif->base + LCDC_V8_DISP_SIZE); + + writel(HSYN_PARA_BP_H(m->htotal - m->hsync_end) | +@@ -138,8 +138,8 @@ static void lcdif_set_mode(struct lcdif_drm_private *lcdif, u32 bus_flags) + VSYN_HSYN_WIDTH_PW_H(m->hsync_end - m->hsync_start), + lcdif->base + LCDC_V8_VSYN_HSYN_WIDTH); + +- writel(CTRLDESCL0_1_HEIGHT(m->crtc_vdisplay) | +- CTRLDESCL0_1_WIDTH(m->crtc_hdisplay), ++ writel(CTRLDESCL0_1_HEIGHT(m->vdisplay) | ++ CTRLDESCL0_1_WIDTH(m->hdisplay), + lcdif->base + LCDC_V8_CTRLDESCL0_1); + + writel(CTRLDESCL0_3_PITCH(lcdif->crtc.primary->state->fb->pitches[0]), +-- +2.39.0 + diff --git a/patches.suse/drm-lcdif-Set-and-enable-FIFO-Panic-threshold.patch b/patches.suse/drm-lcdif-Set-and-enable-FIFO-Panic-threshold.patch new file mode 100644 index 0000000..601dbe5 --- /dev/null +++ b/patches.suse/drm-lcdif-Set-and-enable-FIFO-Panic-threshold.patch @@ -0,0 +1,88 @@ +From e3cac8f7749f78dacdf19c00ed5862a1db52239f Mon Sep 17 00:00:00 2001 +From: Marek Vasut +Date: Tue, 1 Nov 2022 16:26:29 +0100 +Subject: drm: lcdif: Set and enable FIFO Panic threshold +Git-commit: e3cac8f7749f78dacdf19c00ed5862a1db52239f +Patch-mainline: v6.2-rc1 +References: git-fixes + +In case the LCDIFv3 is used to drive a 4k panel via i.MX8MP HDMI bridge, +the LCDIFv3 becomes susceptible to FIFO underflows, these lead to nasty +flicker of the image on the panel, or image being shifted by half frame +horizontally every second frame. The flicker can be easily triggered by +running 3D application on top of weston compositor, like neverball or +chromium. Surprisingly glmark2-es2-wayland or glmark2-es2-drm does not +trigger this effect so easily. + +Configure the FIFO Panic threshold register and enable the FIFO Panic +mode, which internally boosts the NoC interconnect priority for LCDIFv3 +transactions in case of possible underflow. This mitigates the flicker +effect on 4k panels as well. + +Fixes: 9db35bb349a0 ("drm: lcdif: Add support for i.MX8MP LCDIF variant") +Signed-off-by: Marek Vasut +Tested-by: Liu Ying # i.MX8mp EVK +Reviewed-by: Liu Ying +Link: https://patchwork.freedesktop.org/patch/msgid/20221101152629.21768-1-marex@denx.de +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/mxsfb/lcdif_kms.c | 16 ++++++++++++++++ + drivers/gpu/drm/mxsfb/lcdif_regs.h | 1 + + 2 files changed, 17 insertions(+) + +diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c +index f0ad6e2a9352..262bc43b1079 100644 +--- a/drivers/gpu/drm/mxsfb/lcdif_kms.c ++++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c +@@ -5,6 +5,7 @@ + * This code is based on drivers/gpu/drm/mxsfb/mxsfb* + */ + ++#include + #include + #include + #include +@@ -332,6 +333,18 @@ static void lcdif_enable_controller(struct lcdif_drm_private *lcdif) + { + u32 reg; + ++ /* Set FIFO Panic watermarks, low 1/3, high 2/3 . */ ++ writel(FIELD_PREP(PANIC0_THRES_LOW_MASK, 1 * PANIC0_THRES_MAX / 3) | ++ FIELD_PREP(PANIC0_THRES_HIGH_MASK, 2 * PANIC0_THRES_MAX / 3), ++ lcdif->base + LCDC_V8_PANIC0_THRES); ++ ++ /* ++ * Enable FIFO Panic, this does not generate interrupt, but ++ * boosts NoC priority based on FIFO Panic watermarks. ++ */ ++ writel(INT_ENABLE_D1_PLANE_PANIC_EN, ++ lcdif->base + LCDC_V8_INT_ENABLE_D1); ++ + reg = readl(lcdif->base + LCDC_V8_DISP_PARA); + reg |= DISP_PARA_DISP_ON; + writel(reg, lcdif->base + LCDC_V8_DISP_PARA); +@@ -359,6 +372,9 @@ static void lcdif_disable_controller(struct lcdif_drm_private *lcdif) + reg = readl(lcdif->base + LCDC_V8_DISP_PARA); + reg &= ~DISP_PARA_DISP_ON; + writel(reg, lcdif->base + LCDC_V8_DISP_PARA); ++ ++ /* Disable FIFO Panic NoC priority booster. */ ++ writel(0, lcdif->base + LCDC_V8_INT_ENABLE_D1); + } + + static void lcdif_reset_block(struct lcdif_drm_private *lcdif) +diff --git a/drivers/gpu/drm/mxsfb/lcdif_regs.h b/drivers/gpu/drm/mxsfb/lcdif_regs.h +index fb74eb5ccbf1..c55dfb236c1d 100644 +--- a/drivers/gpu/drm/mxsfb/lcdif_regs.h ++++ b/drivers/gpu/drm/mxsfb/lcdif_regs.h +@@ -255,6 +255,7 @@ + + #define PANIC0_THRES_LOW_MASK GENMASK(24, 16) + #define PANIC0_THRES_HIGH_MASK GENMASK(8, 0) ++#define PANIC0_THRES_MAX 511 + + #define LCDIF_MIN_XRES 120 + #define LCDIF_MIN_YRES 120 +-- +2.39.0 + diff --git a/patches.suse/drm-lcdif-Switch-to-limited-range-for-RGB-to-YUV-con.patch b/patches.suse/drm-lcdif-Switch-to-limited-range-for-RGB-to-YUV-con.patch new file mode 100644 index 0000000..ff44acd --- /dev/null +++ b/patches.suse/drm-lcdif-Switch-to-limited-range-for-RGB-to-YUV-con.patch @@ -0,0 +1,69 @@ +From ec39dee8b25229a646271815cc86a8fc865525cf Mon Sep 17 00:00:00 2001 +From: Laurent Pinchart +Date: Fri, 30 Sep 2022 11:39:54 +0300 +Subject: drm: lcdif: Switch to limited range for RGB to YUV conversion +Git-commit: ec39dee8b25229a646271815cc86a8fc865525cf +Patch-mainline: v6.2-rc1 +References: git-fixes + +Up to and including v1.3, HDMI supported limited quantization range only +for YCbCr. HDMI v1.4 introduced selectable quantization ranges, but this +feature isn't supported in the dw-hdmi driver that is used in +conjunction with the LCDIF in the i.MX8MP. The HDMI YCbCr output is thus +always advertised in the AVI infoframe as limited range. + +The LCDIF driver, on the other hand, configures the CSC to produce full +range YCbCr. This mismatch results in loss of details and incorrect +colours. Fix it by switching to limited range YCbCr. + +The coefficients are copied from drivers/media/platforms/nxp/imx-pxp.c +for coherency, as the hardware is most likely identical. + +Fixes: 9db35bb349a0 ("drm: lcdif: Add support for i.MX8MP LCDIF variant") +Signed-off-by: Laurent Pinchart +Reviewed-by: Marek Vasut +Reviewed-by: Kieran Bingham +Reviewed-by: Liu Ying +Signed-off-by: Marek Vasut +Link: https://patchwork.freedesktop.org/patch/msgid/20220930083955.31580-4-laurent.pinchart@ideasonboard.com +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/mxsfb/lcdif_kms.c | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c +index b1092aab1423..9f212e29059b 100644 +--- a/drivers/gpu/drm/mxsfb/lcdif_kms.c ++++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c +@@ -52,16 +52,22 @@ static void lcdif_set_formats(struct lcdif_drm_private *lcdif, + writel(DISP_PARA_LINE_PATTERN_UYVY_H, + lcdif->base + LCDC_V8_DISP_PARA); + +- /* CSC: BT.601 Full Range RGB to YCbCr coefficients. */ +- writel(CSC0_COEF0_A2(0x096) | CSC0_COEF0_A1(0x04c), ++ /* ++ * CSC: BT.601 Limited Range RGB to YCbCr coefficients. ++ * ++ * |Y | | 0.2568 0.5041 0.0979| |R| |16 | ++ * |Cb| = |-0.1482 -0.2910 0.4392| * |G| + |128| ++ * |Cr| | 0.4392 0.4392 -0.3678| |B| |128| ++ */ ++ writel(CSC0_COEF0_A2(0x081) | CSC0_COEF0_A1(0x041), + lcdif->base + LCDC_V8_CSC0_COEF0); +- writel(CSC0_COEF1_B1(0x7d5) | CSC0_COEF1_A3(0x01d), ++ writel(CSC0_COEF1_B1(0x7db) | CSC0_COEF1_A3(0x019), + lcdif->base + LCDC_V8_CSC0_COEF1); +- writel(CSC0_COEF2_B3(0x080) | CSC0_COEF2_B2(0x7ac), ++ writel(CSC0_COEF2_B3(0x070) | CSC0_COEF2_B2(0x7b6), + lcdif->base + LCDC_V8_CSC0_COEF2); +- writel(CSC0_COEF3_C2(0x795) | CSC0_COEF3_C1(0x080), ++ writel(CSC0_COEF3_C2(0x7a2) | CSC0_COEF3_C1(0x070), + lcdif->base + LCDC_V8_CSC0_COEF3); +- writel(CSC0_COEF4_D1(0x000) | CSC0_COEF4_C3(0x7ec), ++ writel(CSC0_COEF4_D1(0x010) | CSC0_COEF4_C3(0x7ee), + lcdif->base + LCDC_V8_CSC0_COEF4); + writel(CSC0_COEF5_D3(0x080) | CSC0_COEF5_D2(0x080), + lcdif->base + LCDC_V8_CSC0_COEF5); +-- +2.39.0 + diff --git a/patches.suse/drm-lcdif-change-burst-size-to-256B.patch b/patches.suse/drm-lcdif-change-burst-size-to-256B.patch new file mode 100644 index 0000000..77177df --- /dev/null +++ b/patches.suse/drm-lcdif-change-burst-size-to-256B.patch @@ -0,0 +1,66 @@ +From 2215cb3be5c28a1fd43036550c00c2371aeeba95 Mon Sep 17 00:00:00 2001 +From: Marco Felsch +Date: Tue, 1 Nov 2022 17:46:15 +0100 +Subject: drm: lcdif: change burst size to 256B +Git-commit: 2215cb3be5c28a1fd43036550c00c2371aeeba95 +Patch-mainline: v6.2-rc1 +References: git-fixes + +If a axi bus master with a higher priority do a lot of memory access +FIFO underruns can be inspected. Increase the burst size to 256B to +avoid such underruns and to improve the memory access efficiency. + +Fixes: 9db35bb349a0 ("drm: lcdif: Add support for i.MX8MP LCDIF variant") +Signed-off-by: Marco Felsch +Reviewed-by: Marek Vasut +Signed-off-by: Marek Vasut +Link: https://patchwork.freedesktop.org/patch/msgid/20221101164615.778299-1-m.felsch@pengutronix.de +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/mxsfb/lcdif_kms.c | 14 ++++++++++++-- + drivers/gpu/drm/mxsfb/lcdif_regs.h | 4 ++++ + 2 files changed, 16 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c +index 33ee40876994..f0ad6e2a9352 100644 +--- a/drivers/gpu/drm/mxsfb/lcdif_kms.c ++++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c +@@ -314,8 +314,18 @@ static void lcdif_set_mode(struct lcdif_drm_private *lcdif, u32 bus_flags) + CTRLDESCL0_1_WIDTH(m->hdisplay), + lcdif->base + LCDC_V8_CTRLDESCL0_1); + +- writel(CTRLDESCL0_3_PITCH(lcdif->crtc.primary->state->fb->pitches[0]), +- lcdif->base + LCDC_V8_CTRLDESCL0_3); ++ /* ++ * Undocumented P_SIZE and T_SIZE register but those written in the ++ * downstream kernel those registers control the AXI burst size. As of ++ * now there are two known values: ++ * 1 - 128Byte ++ * 2 - 256Byte ++ * Downstream set it to 256B burst size to improve the memory ++ * efficiency so set it here too. ++ */ ++ ctrl = CTRLDESCL0_3_P_SIZE(2) | CTRLDESCL0_3_T_SIZE(2) | ++ CTRLDESCL0_3_PITCH(lcdif->crtc.primary->state->fb->pitches[0]); ++ writel(ctrl, lcdif->base + LCDC_V8_CTRLDESCL0_3); + } + + static void lcdif_enable_controller(struct lcdif_drm_private *lcdif) +diff --git a/drivers/gpu/drm/mxsfb/lcdif_regs.h b/drivers/gpu/drm/mxsfb/lcdif_regs.h +index 2d3920b8371e..fb74eb5ccbf1 100644 +--- a/drivers/gpu/drm/mxsfb/lcdif_regs.h ++++ b/drivers/gpu/drm/mxsfb/lcdif_regs.h +@@ -190,6 +190,10 @@ + #define CTRLDESCL0_1_WIDTH(n) ((n) & 0xffff) + #define CTRLDESCL0_1_WIDTH_MASK GENMASK(15, 0) + ++#define CTRLDESCL0_3_P_SIZE(n) (((n) << 20) & CTRLDESCL0_3_P_SIZE_MASK) ++#define CTRLDESCL0_3_P_SIZE_MASK GENMASK(22, 20) ++#define CTRLDESCL0_3_T_SIZE(n) (((n) << 16) & CTRLDESCL0_3_T_SIZE_MASK) ++#define CTRLDESCL0_3_T_SIZE_MASK GENMASK(17, 16) + #define CTRLDESCL0_3_PITCH(n) ((n) & 0xffff) + #define CTRLDESCL0_3_PITCH_MASK GENMASK(15, 0) + +-- +2.39.0 + diff --git a/patches.suse/drm-lcdif-switch-to-devm_drm_of_get_bridge.patch b/patches.suse/drm-lcdif-switch-to-devm_drm_of_get_bridge.patch new file mode 100644 index 0000000..8340172 --- /dev/null +++ b/patches.suse/drm-lcdif-switch-to-devm_drm_of_get_bridge.patch @@ -0,0 +1,70 @@ +From 6e1853589ea627490f85435b9e81843129b08c10 Mon Sep 17 00:00:00 2001 +From: Marek Vasut +Date: Fri, 19 Aug 2022 16:08:52 +0200 +Subject: drm/lcdif: switch to devm_drm_of_get_bridge +Git-commit: 6e1853589ea627490f85435b9e81843129b08c10 +Patch-mainline: v6.1-rc1 +References: git-fixes + +The function "drm_of_find_panel_or_bridge" has been deprecated in +favor of "devm_drm_of_get_bridge". + +Switch to the new function and reduce boilerplate. + +Acked-by: Sam Ravnborg +Reviewed-by: Liu Ying +Reported-by: Liu Ying +Tested-by: Martyn Welch +Fixes: 9db35bb349a0e ("drm: lcdif: Add support for i.MX8MP LCDIF variant") +Signed-off-by: Marek Vasut +Cc: Alexander Stein +Cc: Laurent Pinchart +Cc: Liu Ying +Cc: Lucas Stach +Cc: Marek Vasut +Cc: Martyn Welch +Cc: Peng Fan +Cc: Robby Cai +Cc: Sam Ravnborg +Cc: Stefan Agner +Reviewed-by: Alexander Stein +Link: https://patchwork.freedesktop.org/patch/msgid/20220819140852.255187-4-marex@denx.de +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/mxsfb/lcdif_drv.c | 18 +++--------------- + 1 file changed, 3 insertions(+), 15 deletions(-) + +diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.c b/drivers/gpu/drm/mxsfb/lcdif_drv.c +index 4f16947212b6..075002ed6fb0 100644 +--- a/drivers/gpu/drm/mxsfb/lcdif_drv.c ++++ b/drivers/gpu/drm/mxsfb/lcdif_drv.c +@@ -42,23 +42,11 @@ static int lcdif_attach_bridge(struct lcdif_drm_private *lcdif) + { + struct drm_device *drm = lcdif->drm; + struct drm_bridge *bridge; +- struct drm_panel *panel; + int ret; + +- ret = drm_of_find_panel_or_bridge(drm->dev->of_node, 0, 0, &panel, +- &bridge); +- if (ret) +- return ret; +- +- if (panel) { +- bridge = devm_drm_panel_bridge_add_typed(drm->dev, panel, +- DRM_MODE_CONNECTOR_DPI); +- if (IS_ERR(bridge)) +- return PTR_ERR(bridge); +- } +- +- if (!bridge) +- return -ENODEV; ++ bridge = devm_drm_of_get_bridge(drm->dev, drm->dev->of_node, 0, 0); ++ if (IS_ERR(bridge)) ++ return PTR_ERR(bridge); + + ret = drm_bridge_attach(&lcdif->encoder, bridge, NULL, 0); + if (ret) +-- +2.39.0 + diff --git a/patches.suse/drm-msm-a6xx-Replace-kcalloc-with-kvzalloc.patch b/patches.suse/drm-msm-a6xx-Replace-kcalloc-with-kvzalloc.patch new file mode 100644 index 0000000..b91a909 --- /dev/null +++ b/patches.suse/drm-msm-a6xx-Replace-kcalloc-with-kvzalloc.patch @@ -0,0 +1,65 @@ +From ec8f1813bf8d0737898f99a8c1c69df0cde0d7dd Mon Sep 17 00:00:00 2001 +From: Akhil P Oommen +Date: Wed, 28 Sep 2022 12:48:59 +0530 +Subject: drm/msm/a6xx: Replace kcalloc() with kvzalloc() +Git-commit: ec8f1813bf8d0737898f99a8c1c69df0cde0d7dd +Patch-mainline: v6.1-rc3 +References: git-fixes + +In order to reduce chance of allocation failure while capturing a6xx +gpu state, use kvzalloc() instead of kcalloc() in state_kcalloc(). + +Indirectly, this patch helps to fix leaking memory allocated for +gmu_debug object. + +Fixes: b859f9b009b (drm/msm/gpu: Snapshot GMU debug buffer) +Signed-off-by: Akhil P Oommen +Patchwork: https://patchwork.freedesktop.org/patch/505074/ +Link: https://lore.kernel.org/r/20220928124830.1.I8ea24a8d586b4978823b848adde000f92f74d5c2@changeid +Signed-off-by: Rob Clark +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 12 +++--------- + 1 file changed, 3 insertions(+), 9 deletions(-) + +diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c +index 55f443328d8e..3c112a6cc8a2 100644 +--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c ++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c +@@ -91,7 +91,7 @@ struct a6xx_state_memobj { + static void *state_kcalloc(struct a6xx_gpu_state *a6xx_state, int nr, size_t objsize) + { + struct a6xx_state_memobj *obj = +- kzalloc((nr * objsize) + sizeof(*obj), GFP_KERNEL); ++ kvzalloc((nr * objsize) + sizeof(*obj), GFP_KERNEL); + + if (!obj) + return NULL; +@@ -819,7 +819,7 @@ static struct msm_gpu_state_bo *a6xx_snapshot_gmu_bo( + + snapshot->iova = bo->iova; + snapshot->size = bo->size; +- snapshot->data = kvzalloc(snapshot->size, GFP_KERNEL); ++ snapshot->data = state_kcalloc(a6xx_state, 1, snapshot->size); + if (!snapshot->data) + return NULL; + +@@ -1034,14 +1034,8 @@ static void a6xx_gpu_state_destroy(struct kref *kref) + struct a6xx_gpu_state *a6xx_state = container_of(state, + struct a6xx_gpu_state, base); + +- if (a6xx_state->gmu_log) +- kvfree(a6xx_state->gmu_log->data); +- +- if (a6xx_state->gmu_hfi) +- kvfree(a6xx_state->gmu_hfi->data); +- + list_for_each_entry_safe(obj, tmp, &a6xx_state->objs, node) +- kfree(obj); ++ kvfree(obj); + + adreno_gpu_state_destroy(state); + kfree(a6xx_state); +-- +2.39.0 + diff --git a/patches.suse/drm-msm-dp-add-atomic_check-to-bridge-ops.patch b/patches.suse/drm-msm-dp-add-atomic_check-to-bridge-ops.patch new file mode 100644 index 0000000..b256344 --- /dev/null +++ b/patches.suse/drm-msm-dp-add-atomic_check-to-bridge-ops.patch @@ -0,0 +1,202 @@ +From 3a661247967a6f3c99a95a8ba4c8073c5846ea4b Mon Sep 17 00:00:00 2001 +From: Kuogee Hsieh +Date: Wed, 28 Sep 2022 16:36:51 -0700 +Subject: drm/msm/dp: add atomic_check to bridge ops +Git-commit: 3a661247967a6f3c99a95a8ba4c8073c5846ea4b +Patch-mainline: v6.1-rc3 +References: git-fixes + +DRM commit_tails() will disable downstream crtc/encoder/bridge if +both disable crtc is required and crtc->active is set before pushing +a new frame downstream. + +There is a rare case that user space display manager issue an extra +screen update immediately followed by close DRM device while down +stream display interface is disabled. This extra screen update will +timeout due to the downstream interface is disabled but will cause +crtc->active be set. Hence the followed commit_tails() called by +drm_release() will pass the disable downstream crtc/encoder/bridge +conditions checking even downstream interface is disabled. +This cause the crash to happen at dp_bridge_disable() due to it trying +to access the main link register to push the idle pattern out while main +link clocks is disabled. + +This patch adds atomic_check to prevent the extra frame will not +be pushed down if display interface is down so that crtc->active +will not be set neither. This will fail the conditions checking +of disabling down stream crtc/encoder/bridge which prevent +drm_release() from calling dp_bridge_disable() so that crash +at dp_bridge_disable() prevented. + +There is no protection in the DRM framework to check if the display +pipeline has been already disabled before trying again. The only +check is the crtc_state->active but this is controlled by usermode +using UAPI. Hence if the usermode sets this and then crashes, the +driver needs to protect against double disable. + +SError Interrupt on CPU7, code 0x00000000be000411 -- SError +CPU: 7 PID: 3878 Comm: Xorg Not tainted 5.19.0-stb-cbq #19 +Hardware name: Google Lazor (rev3 - 8) (DT) +pstate: a04000c9 (NzCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--) +pc : __cmpxchg_case_acq_32+0x14/0x2c +lr : do_raw_spin_lock+0xa4/0xdc +sp : ffffffc01092b6a0 +x29: ffffffc01092b6a0 x28: 0000000000000028 x27: 0000000000000038 +x26: 0000000000000004 x25: ffffffd2973dce48 x24: 0000000000000000 +x23: 00000000ffffffff x22: 00000000ffffffff x21: ffffffd2978d0008 +x20: ffffffd2978d0008 x19: ffffff80ff759fc0 x18: 0000000000000000 +x17: 004800a501260460 x16: 0441043b04600438 x15: 04380000089807d0 +x14: 07b0089807800780 x13: 0000000000000000 x12: 0000000000000000 +x11: 0000000000000438 x10: 00000000000007d0 x9 : ffffffd2973e09e4 +x8 : ffffff8092d53300 x7 : ffffff808902e8b8 x6 : 0000000000000001 +x5 : ffffff808902e880 x4 : 0000000000000000 x3 : ffffff80ff759fc0 +x2 : 0000000000000001 x1 : 0000000000000000 x0 : ffffff80ff759fc0 +Kernel panic - not syncing: Asynchronous SError Interrupt +CPU: 7 PID: 3878 Comm: Xorg Not tainted 5.19.0-stb-cbq #19 +Hardware name: Google Lazor (rev3 - 8) (DT) +Call trace: + dump_backtrace.part.0+0xbc/0xe4 + show_stack+0x24/0x70 + dump_stack_lvl+0x68/0x84 + dump_stack+0x18/0x34 + panic+0x14c/0x32c + nmi_panic+0x58/0x7c + arm64_serror_panic+0x78/0x84 + do_serror+0x40/0x64 + el1h_64_error_handler+0x30/0x48 + el1h_64_error+0x68/0x6c + __cmpxchg_case_acq_32+0x14/0x2c + _raw_spin_lock_irqsave+0x38/0x4c + lock_timer_base+0x40/0x78 + __mod_timer+0xf4/0x25c + schedule_timeout+0xd4/0xfc + __wait_for_common+0xac/0x140 + wait_for_completion_timeout+0x2c/0x54 + dp_ctrl_push_idle+0x40/0x88 + dp_bridge_disable+0x24/0x30 + drm_atomic_bridge_chain_disable+0x90/0xbc + drm_atomic_helper_commit_modeset_disables+0x198/0x444 + msm_atomic_commit_tail+0x1d0/0x374 + commit_tail+0x80/0x108 + drm_atomic_helper_commit+0x118/0x11c + drm_atomic_commit+0xb4/0xe0 + drm_client_modeset_commit_atomic+0x184/0x224 + drm_client_modeset_commit_locked+0x58/0x160 + drm_client_modeset_commit+0x3c/0x64 + __drm_fb_helper_restore_fbdev_mode_unlocked+0x98/0xac + drm_fb_helper_set_par+0x74/0x80 + drm_fb_helper_hotplug_event+0xdc/0xe0 + __drm_fb_helper_restore_fbdev_mode_unlocked+0x7c/0xac + drm_fb_helper_restore_fbdev_mode_unlocked+0x20/0x2c + drm_fb_helper_lastclose+0x20/0x2c + drm_lastclose+0x44/0x6c + drm_release+0x88/0xd4 + __fput+0x104/0x220 + ____fput+0x1c/0x28 + task_work_run+0x8c/0x100 + do_exit+0x450/0x8d0 + do_group_exit+0x40/0xac + __wake_up_parent+0x0/0x38 + invoke_syscall+0x84/0x11c + el0_svc_common.constprop.0+0xb8/0xe4 + do_el0_svc+0x8c/0xb8 + el0_svc+0x2c/0x54 + el0t_64_sync_handler+0x120/0x1c0 + el0t_64_sync+0x190/0x194 +SMP: stopping secondary CPUs +Kernel Offset: 0x128e800000 from 0xffffffc008000000 +PHYS_OFFSET: 0x80000000 +CPU features: 0x800,00c2a015,19801c82 +Memory Limit: none + +Changes in v2: +-- add more commit text + +Changes in v3: +-- add comments into dp_bridge_atomic_check() + +Changes in v4: +-- rewording the comment into dp_bridge_atomic_check() + +Changes in v5: +-- removed quote x at end of commit text + +Changes in v6: +-- removed quote x at end of comment in dp_bridge_atomic_check() + +Fixes: 8a3b4c17f863 ("drm/msm/dp: employ bridge mechanism for display enable and disable") +Reported-by: Leonard Lausen +Suggested-by: Rob Clark +Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/17 +Signed-off-by: Kuogee Hsieh +Reviewed-by: Abhinav Kumar +Patchwork: https://patchwork.freedesktop.org/patch/505331/ +Link: https://lore.kernel.org/r/1664408211-25314-1-git-send-email-quic_khsieh@quicinc.com +Signed-off-by: Abhinav Kumar +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/msm/dp/dp_drm.c | 34 +++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) + +diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c +index 6df25f7662e7..6db82f9b03af 100644 +--- a/drivers/gpu/drm/msm/dp/dp_drm.c ++++ b/drivers/gpu/drm/msm/dp/dp_drm.c +@@ -31,6 +31,36 @@ static enum drm_connector_status dp_bridge_detect(struct drm_bridge *bridge) + connector_status_disconnected; + } + ++static int dp_bridge_atomic_check(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state) ++{ ++ struct msm_dp *dp; ++ ++ dp = to_dp_bridge(bridge)->dp_display; ++ ++ drm_dbg_dp(dp->drm_dev, "is_connected = %s\n", ++ (dp->is_connected) ? "true" : "false"); ++ ++ /* ++ * There is no protection in the DRM framework to check if the display ++ * pipeline has been already disabled before trying to disable it again. ++ * Hence if the sink is unplugged, the pipeline gets disabled, but the ++ * crtc->active is still true. Any attempt to set the mode or manually ++ * disable this encoder will result in the crash. ++ * ++ * TODO: add support for telling the DRM subsystem that the pipeline is ++ * disabled by the hardware and thus all access to it should be forbidden. ++ * After that this piece of code can be removed. ++ */ ++ if (bridge->ops & DRM_BRIDGE_OP_HPD) ++ return (dp->is_connected) ? 0 : -ENOTCONN; ++ ++ return 0; ++} ++ ++ + /** + * dp_bridge_get_modes - callback to add drm modes via drm_mode_probed_add() + * @bridge: Poiner to drm bridge +@@ -61,6 +91,9 @@ static int dp_bridge_get_modes(struct drm_bridge *bridge, struct drm_connector * + } + + static const struct drm_bridge_funcs dp_bridge_ops = { ++ .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, ++ .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, ++ .atomic_reset = drm_atomic_helper_bridge_reset, + .enable = dp_bridge_enable, + .disable = dp_bridge_disable, + .post_disable = dp_bridge_post_disable, +@@ -68,6 +101,7 @@ static const struct drm_bridge_funcs dp_bridge_ops = { + .mode_valid = dp_bridge_mode_valid, + .get_modes = dp_bridge_get_modes, + .detect = dp_bridge_detect, ++ .atomic_check = dp_bridge_atomic_check, + }; + + struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev, +-- +2.39.0 + diff --git a/patches.suse/drm-msm-dp-fix-aux-bus-EP-lifetime.patch b/patches.suse/drm-msm-dp-fix-aux-bus-EP-lifetime.patch new file mode 100644 index 0000000..def8a5d --- /dev/null +++ b/patches.suse/drm-msm-dp-fix-aux-bus-EP-lifetime.patch @@ -0,0 +1,73 @@ +From 2b57f726611e294dc4297dd48eb8c98ef1938e82 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Tue, 13 Sep 2022 10:53:16 +0200 +Subject: drm/msm/dp: fix aux-bus EP lifetime +Git-commit: 2b57f726611e294dc4297dd48eb8c98ef1938e82 +Patch-mainline: v6.1-rc3 +References: git-fixes + +Device-managed resources allocated post component bind must be tied to +the lifetime of the aggregate DRM device or they will not necessarily be +released when binding of the aggregate device is deferred. + +This can lead resource leaks or failure to bind the aggregate device +when binding is later retried and a second attempt to allocate the +resources is made. + +For the DP aux-bus, an attempt to populate the bus a second time will +simply fail ("DP AUX EP device already populated"). + +Fix this by tying the lifetime of the EP device to the DRM device rather +than DP controller platform device. + +Fixes: c3bf8e21b38a ("drm/msm/dp: Add eDP support via aux_bus") +Cc: stable@vger.kernel.org # 5.19 +Signed-off-by: Johan Hovold +Reviewed-by: Douglas Anderson +Tested-by: Kuogee Hsieh +Reviewed-by: Kuogee Hsieh +Patchwork: https://patchwork.freedesktop.org/patch/502672/ +Link: https://lore.kernel.org/r/20220913085320.8577-7-johan+linaro@kernel.org +Signed-off-by: Abhinav Kumar +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/msm/dp/dp_display.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c +index 352cc09f2069..42de690132cf 100644 +--- a/drivers/gpu/drm/msm/dp/dp_display.c ++++ b/drivers/gpu/drm/msm/dp/dp_display.c +@@ -1528,6 +1528,11 @@ void msm_dp_debugfs_init(struct msm_dp *dp_display, struct drm_minor *minor) + } + } + ++static void of_dp_aux_depopulate_bus_void(void *data) ++{ ++ of_dp_aux_depopulate_bus(data); ++} ++ + static int dp_display_get_next_bridge(struct msm_dp *dp) + { + int rc; +@@ -1552,10 +1557,16 @@ static int dp_display_get_next_bridge(struct msm_dp *dp) + * panel driver is probed asynchronously but is the best we + * can do without a bigger driver reorganization. + */ +- rc = devm_of_dp_aux_populate_ep_devices(dp_priv->aux); ++ rc = of_dp_aux_populate_bus(dp_priv->aux, NULL); + of_node_put(aux_bus); + if (rc) + goto error; ++ ++ rc = devm_add_action_or_reset(dp->drm_dev->dev, ++ of_dp_aux_depopulate_bus_void, ++ dp_priv->aux); ++ if (rc) ++ goto error; + } else if (dp->is_edp) { + DRM_ERROR("eDP aux_bus not found\n"); + return -ENODEV; +-- +2.39.0 + diff --git a/patches.suse/drm-msm-dp-fix-bridge-lifetime.patch b/patches.suse/drm-msm-dp-fix-bridge-lifetime.patch new file mode 100644 index 0000000..498ebbb --- /dev/null +++ b/patches.suse/drm-msm-dp-fix-bridge-lifetime.patch @@ -0,0 +1,97 @@ +From 16194958f888d63839042d1190f7001e5ddec47b Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Tue, 13 Sep 2022 10:53:17 +0200 +Subject: drm/msm/dp: fix bridge lifetime +Git-commit: 16194958f888d63839042d1190f7001e5ddec47b +Patch-mainline: v6.1-rc3 +References: git-fixes + +Device-managed resources allocated post component bind must be tied to +the lifetime of the aggregate DRM device or they will not necessarily be +released when binding of the aggregate device is deferred. + +This can lead resource leaks or failure to bind the aggregate device +when binding is later retried and a second attempt to allocate the +resources is made. + +For the DP bridges, previously allocated bridges will leak on probe +deferral. + +Fix this by amending the DP parser interface and tying the lifetime of +the bridge device to the DRM device rather than DP platform device. + +Fixes: c3bf8e21b38a ("drm/msm/dp: Add eDP support via aux_bus") +Cc: stable@vger.kernel.org # 5.19 +Reviewed-by: Dmitry Baryshkov +Signed-off-by: Johan Hovold +Tested-by: Kuogee Hsieh +Reviewed-by: Kuogee Hsieh +Patchwork: https://patchwork.freedesktop.org/patch/502667/ +Link: https://lore.kernel.org/r/20220913085320.8577-8-johan+linaro@kernel.org +Signed-off-by: Abhinav Kumar +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/msm/dp/dp_display.c | 2 +- + drivers/gpu/drm/msm/dp/dp_parser.c | 6 +++--- + drivers/gpu/drm/msm/dp/dp_parser.h | 5 +++-- + 3 files changed, 7 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c +index 42de690132cf..a49f6dbbe888 100644 +--- a/drivers/gpu/drm/msm/dp/dp_display.c ++++ b/drivers/gpu/drm/msm/dp/dp_display.c +@@ -1579,7 +1579,7 @@ static int dp_display_get_next_bridge(struct msm_dp *dp) + * For DisplayPort interfaces external bridges are optional, so + * silently ignore an error if one is not present (-ENODEV). + */ +- rc = dp_parser_find_next_bridge(dp_priv->parser); ++ rc = devm_dp_parser_find_next_bridge(dp->drm_dev->dev, dp_priv->parser); + if (!dp->is_edp && rc == -ENODEV) + return 0; + +diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c +index dd732215d55b..dcbe893d66d7 100644 +--- a/drivers/gpu/drm/msm/dp/dp_parser.c ++++ b/drivers/gpu/drm/msm/dp/dp_parser.c +@@ -240,12 +240,12 @@ static int dp_parser_clock(struct dp_parser *parser) + return 0; + } + +-int dp_parser_find_next_bridge(struct dp_parser *parser) ++int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser) + { +- struct device *dev = &parser->pdev->dev; ++ struct platform_device *pdev = parser->pdev; + struct drm_bridge *bridge; + +- bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0); ++ bridge = devm_drm_of_get_bridge(dev, pdev->dev.of_node, 1, 0); + if (IS_ERR(bridge)) + return PTR_ERR(bridge); + +diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h +index 866c1a82bf1a..d30ab773db46 100644 +--- a/drivers/gpu/drm/msm/dp/dp_parser.h ++++ b/drivers/gpu/drm/msm/dp/dp_parser.h +@@ -138,8 +138,9 @@ struct dp_parser { + struct dp_parser *dp_parser_get(struct platform_device *pdev); + + /** +- * dp_parser_find_next_bridge() - find an additional bridge to DP ++ * devm_dp_parser_find_next_bridge() - find an additional bridge to DP + * ++ * @dev: device to tie bridge lifetime to + * @parser: dp_parser data from client + * + * This function is used to find any additional bridge attached to +@@ -147,6 +148,6 @@ struct dp_parser *dp_parser_get(struct platform_device *pdev); + * + * Return: 0 if able to get the bridge, otherwise negative errno for failure. + */ +-int dp_parser_find_next_bridge(struct dp_parser *parser); ++int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser); + + #endif +-- +2.39.0 + diff --git a/patches.suse/drm-msm-dp-fix-memory-corruption-with-too-many-bridg.patch b/patches.suse/drm-msm-dp-fix-memory-corruption-with-too-many-bridg.patch new file mode 100644 index 0000000..a67b2ee --- /dev/null +++ b/patches.suse/drm-msm-dp-fix-memory-corruption-with-too-many-bridg.patch @@ -0,0 +1,46 @@ +From 74466e46e7543c7f74f1502181e9ba93f7521374 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Tue, 13 Sep 2022 10:53:12 +0200 +Subject: drm/msm/dp: fix memory corruption with too many bridges +Git-commit: 74466e46e7543c7f74f1502181e9ba93f7521374 +Patch-mainline: v6.1-rc3 +References: git-fixes + +Add the missing sanity check on the bridge counter to avoid corrupting +data beyond the fixed-sized bridge array in case there are ever more +than eight bridges. + +Fixes: 8a3b4c17f863 ("drm/msm/dp: employ bridge mechanism for display enable and disable") +Cc: stable@vger.kernel.org # 5.17 +Signed-off-by: Johan Hovold +Tested-by: Kuogee Hsieh +Reviewed-by: Kuogee Hsieh +Reviewed-by: Dmitry Baryshkov +Patchwork: https://patchwork.freedesktop.org/patch/502664/ +Link: https://lore.kernel.org/r/20220913085320.8577-3-johan+linaro@kernel.org +Signed-off-by: Abhinav Kumar +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/msm/dp/dp_display.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c +index bfd0aeff3f0d..be9ed891dc3f 100644 +--- a/drivers/gpu/drm/msm/dp/dp_display.c ++++ b/drivers/gpu/drm/msm/dp/dp_display.c +@@ -1597,6 +1597,12 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, + return -EINVAL; + + priv = dev->dev_private; ++ ++ if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) { ++ DRM_DEV_ERROR(dev->dev, "too many bridges\n"); ++ return -ENOSPC; ++ } ++ + dp_display->drm_dev = dev; + + dp_priv = container_of(dp_display, struct dp_display_private, dp_display); +-- +2.39.0 + diff --git a/patches.suse/drm-msm-dpu-Fix-memory-leak-in-msm_mdss_parse_data_b.patch b/patches.suse/drm-msm-dpu-Fix-memory-leak-in-msm_mdss_parse_data_b.patch new file mode 100644 index 0000000..4e7cda3 --- /dev/null +++ b/patches.suse/drm-msm-dpu-Fix-memory-leak-in-msm_mdss_parse_data_b.patch @@ -0,0 +1,51 @@ +From 45dac1352b55b1d8cb17f218936b2bc2bc1fb4ee Mon Sep 17 00:00:00 2001 +From: Miaoqian Lin +Date: Wed, 7 Dec 2022 10:59:22 +0400 +Subject: drm/msm/dpu: Fix memory leak in msm_mdss_parse_data_bus_icc_path +Git-commit: 45dac1352b55b1d8cb17f218936b2bc2bc1fb4ee +Patch-mainline: v6.2-rc4 +References: git-fixes + +of_icc_get() alloc resources for path1, we should release it when not +need anymore. Early return when IS_ERR_OR_NULL(path0) may leak path1. +Defer getting path1 to fix this. + +Fixes: b9364eed9232 ("drm/msm/dpu: Move min BW request and full BW disable back to mdss") +Signed-off-by: Miaoqian Lin +Reviewed-by: Douglas Anderson +Reviewed-by: Abhinav Kumar +Patchwork: https://patchwork.freedesktop.org/patch/514264/ +Link: https://lore.kernel.org/r/20221207065922.2086368-1-linmq006@gmail.com +Signed-off-by: Abhinav Kumar +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/msm/msm_mdss.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c +index 86b28add1fff..2527afef9c19 100644 +--- a/drivers/gpu/drm/msm/msm_mdss.c ++++ b/drivers/gpu/drm/msm/msm_mdss.c +@@ -47,15 +47,17 @@ struct msm_mdss { + static int msm_mdss_parse_data_bus_icc_path(struct device *dev, + struct msm_mdss *msm_mdss) + { +- struct icc_path *path0 = of_icc_get(dev, "mdp0-mem"); +- struct icc_path *path1 = of_icc_get(dev, "mdp1-mem"); ++ struct icc_path *path0; ++ struct icc_path *path1; + ++ path0 = of_icc_get(dev, "mdp0-mem"); + if (IS_ERR_OR_NULL(path0)) + return PTR_ERR_OR_ZERO(path0); + + msm_mdss->path[0] = path0; + msm_mdss->num_paths = 1; + ++ path1 = of_icc_get(dev, "mdp1-mem"); + if (!IS_ERR_OR_NULL(path1)) { + msm_mdss->path[1] = path1; + msm_mdss->num_paths++; +-- +2.39.0 + diff --git a/patches.suse/drm-msm-dpu-Fix-some-kernel-doc-comments.patch b/patches.suse/drm-msm-dpu-Fix-some-kernel-doc-comments.patch new file mode 100644 index 0000000..551a41f --- /dev/null +++ b/patches.suse/drm-msm-dpu-Fix-some-kernel-doc-comments.patch @@ -0,0 +1,53 @@ +From 1bdeb321d1f856346fe0078af09c9e7ffbd2ca7a Mon Sep 17 00:00:00 2001 +From: Yang Li +Date: Tue, 15 Nov 2022 09:49:02 +0800 +Subject: drm/msm/dpu: Fix some kernel-doc comments +Git-commit: 1bdeb321d1f856346fe0078af09c9e7ffbd2ca7a +Patch-mainline: v6.2-rc4 +References: git-fixes + +Make the description of @init to @p in dpu_encoder_phys_wb_init() +and remove @wb_roi in dpu_encoder_phys_wb_setup_fb() to clear the below +warnings: + +drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c:139: warning: Excess function parameter 'wb_roi' description in 'dpu_encoder_phys_wb_setup_fb' +drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c:699: warning: Function parameter or member 'p' not described in 'dpu_encoder_phys_wb_init' +drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c:699: warning: Excess function parameter 'init' description in 'dpu_encoder_phys_wb_init' + +Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3067 +Reported-by: Abaci Robot +Signed-off-by: Yang Li +Fixes: d7d0e73f7de3 ("drm/msm/dpu: introduce the dpu_encoder_phys_* for writeback") +Reviewed-by: Abhinav Kumar +Patchwork: https://patchwork.freedesktop.org/patch/511605/ +Link: https://lore.kernel.org/r/20221115014902.45240-1-yang.lee@linux.alibaba.com +Signed-off-by: Abhinav Kumar +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c +index 7cbcef6efe17..62f6ff6abf41 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c ++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c +@@ -132,7 +132,6 @@ static void dpu_encoder_phys_wb_set_qos(struct dpu_encoder_phys *phys_enc) + * dpu_encoder_phys_wb_setup_fb - setup output framebuffer + * @phys_enc: Pointer to physical encoder + * @fb: Pointer to output framebuffer +- * @wb_roi: Pointer to output region of interest + */ + static void dpu_encoder_phys_wb_setup_fb(struct dpu_encoder_phys *phys_enc, + struct drm_framebuffer *fb) +@@ -692,7 +691,7 @@ static void dpu_encoder_phys_wb_init_ops(struct dpu_encoder_phys_ops *ops) + + /** + * dpu_encoder_phys_wb_init - initialize writeback encoder +- * @init: Pointer to init info structure with initialization params ++ * @p: Pointer to init info structure with initialization params + */ + struct dpu_encoder_phys *dpu_encoder_phys_wb_init( + struct dpu_enc_phys_init_params *p) +-- +2.39.0 + diff --git a/patches.suse/drm-msm-dpu-drop-unused-memory-allocation.patch b/patches.suse/drm-msm-dpu-drop-unused-memory-allocation.patch new file mode 100644 index 0000000..a5327a7 --- /dev/null +++ b/patches.suse/drm-msm-dpu-drop-unused-memory-allocation.patch @@ -0,0 +1,44 @@ +From 1364a4ee9a99f10ebf490aa9be2bb2920989e886 Mon Sep 17 00:00:00 2001 +From: Dmitry Baryshkov +Date: Mon, 22 Aug 2022 20:24:55 +0300 +Subject: drm/msm/dpu: drop unused memory allocation +Git-commit: 1364a4ee9a99f10ebf490aa9be2bb2920989e886 +Patch-mainline: v6.1-rc1 +References: git-fixes + +Drop the dpu_cfg variable and corresponding kzalloc, which became unused +after changing hw catalog to static configuration. + +Fixes: de7d480f5e8c ("drm/msm/dpu: make dpu hardware catalog static const") +Reported-by: kernel test robot +Reported-by: Dan Carpenter +Signed-off-by: Dmitry Baryshkov +Reviewed-by: Abhinav Kumar +Patchwork: https://patchwork.freedesktop.org/patch/498738/ +Link: https://lore.kernel.org/r/20220822172455.282923-1-dmitry.baryshkov@linaro.org +Signed-off-by: Dmitry Baryshkov +Signed-off-by: Rob Clark +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +index 76b35410be71..27f029fdc682 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c ++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +@@ -1939,11 +1939,6 @@ static const struct dpu_mdss_hw_cfg_handler cfg_handler[] = { + const struct dpu_mdss_cfg *dpu_hw_catalog_init(u32 hw_rev) + { + int i; +- struct dpu_mdss_cfg *dpu_cfg; +- +- dpu_cfg = kzalloc(sizeof(*dpu_cfg), GFP_KERNEL); +- if (!dpu_cfg) +- return ERR_PTR(-ENOMEM); + + for (i = 0; i < ARRAY_SIZE(cfg_handler); i++) { + if (cfg_handler[i].hw_rev == hw_rev) +-- +2.39.0 + diff --git a/patches.suse/drm-msm-dpu-drop-unused-variable-from-dpu_kms_mdp_sn.patch b/patches.suse/drm-msm-dpu-drop-unused-variable-from-dpu_kms_mdp_sn.patch new file mode 100644 index 0000000..5292f63 --- /dev/null +++ b/patches.suse/drm-msm-dpu-drop-unused-variable-from-dpu_kms_mdp_sn.patch @@ -0,0 +1,45 @@ +From 4bca876458caf7c105ab2ae9d80ff2cc9c60388d Mon Sep 17 00:00:00 2001 +From: Dmitry Baryshkov +Date: Mon, 22 Aug 2022 20:22:04 +0300 +Subject: drm/msm/dpu: drop unused variable from dpu_kms_mdp_snapshot() +Git-commit: 4bca876458caf7c105ab2ae9d80ff2cc9c60388d +Patch-mainline: v6.1-rc1 +References: git-fixes + +Follow up the merge of address fields and drop the variable that became +unused after the commit 9403f9a42c88 ("drm/msm/dpu: merge base_off with +blk_off in struct dpu_hw_blk_reg_map"). + +Fixes: 9403f9a42c88 ("drm/msm/dpu: merge base_off with blk_off in struct dpu_hw_blk_reg_map") +Signed-off-by: Dmitry Baryshkov +Reviewed-by: Stephen Boyd +Reviewed-by: Abhinav Kumar +Patchwork: https://patchwork.freedesktop.org/patch/498736/ +Link: https://lore.kernel.org/r/20220822172204.281045-1-dmitry.baryshkov@linaro.org +Signed-off-by: Dmitry Baryshkov +Signed-off-by: Rob Clark +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +index ffdb4fcd3bcc..fd13157568d0 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c ++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +@@ -897,12 +897,10 @@ static void dpu_kms_mdp_snapshot(struct msm_disp_state *disp_state, struct msm_k + int i; + struct dpu_kms *dpu_kms; + const struct dpu_mdss_cfg *cat; +- struct dpu_hw_mdp *top; + + dpu_kms = to_dpu_kms(kms); + + cat = dpu_kms->catalog; +- top = dpu_kms->hw_mdp; + + pm_runtime_get_sync(&dpu_kms->pdev->dev); + +-- +2.39.0 + diff --git a/patches.suse/drm-msm-gpu-Fix-potential-double-free.patch b/patches.suse/drm-msm-gpu-Fix-potential-double-free.patch new file mode 100644 index 0000000..d98269f --- /dev/null +++ b/patches.suse/drm-msm-gpu-Fix-potential-double-free.patch @@ -0,0 +1,87 @@ +From a66f1efcf748febea7758c4c3c8b5bc5294949ef Mon Sep 17 00:00:00 2001 +From: Rob Clark +Date: Tue, 10 Jan 2023 13:28:59 -0800 +Subject: drm/msm/gpu: Fix potential double-free +Git-commit: a66f1efcf748febea7758c4c3c8b5bc5294949ef +Patch-mainline: v6.2-rc5 +References: git-fixes + +If userspace was calling the MSM_SET_PARAM ioctl on multiple threads to +set the COMM or CMDLINE param, it could trigger a race causing the +previous value to be kfree'd multiple times. Fix this by serializing on +the gpu lock. + +Signed-off-by: Rob Clark +Fixes: d4726d770068 ("drm/msm: Add a way to override processes comm/cmdline") +Patchwork: https://patchwork.freedesktop.org/patch/517778/ +Link: https://lore.kernel.org/r/20230110212903.1925878-1-robdclark@gmail.com +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/msm/adreno/adreno_gpu.c | 4 ++++ + drivers/gpu/drm/msm/msm_gpu.c | 2 ++ + drivers/gpu/drm/msm/msm_gpu.h | 12 ++++++++++-- + 3 files changed, 16 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c +index 57586c794b84..3605f095b2de 100644 +--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c ++++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c +@@ -352,6 +352,8 @@ int adreno_set_param(struct msm_gpu *gpu, struct msm_file_private *ctx, + /* Ensure string is null terminated: */ + str[len] = '\0'; + ++ mutex_lock(&gpu->lock); ++ + if (param == MSM_PARAM_COMM) { + paramp = &ctx->comm; + } else { +@@ -361,6 +363,8 @@ int adreno_set_param(struct msm_gpu *gpu, struct msm_file_private *ctx, + kfree(*paramp); + *paramp = str; + ++ mutex_unlock(&gpu->lock); ++ + return 0; + } + case MSM_PARAM_SYSPROF: +diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c +index 021f4e29b613..4f495eecc34b 100644 +--- a/drivers/gpu/drm/msm/msm_gpu.c ++++ b/drivers/gpu/drm/msm/msm_gpu.c +@@ -335,6 +335,8 @@ static void get_comm_cmdline(struct msm_gem_submit *submit, char **comm, char ** + struct msm_file_private *ctx = submit->queue->ctx; + struct task_struct *task; + ++ WARN_ON(!mutex_is_locked(&submit->gpu->lock)); ++ + /* Note that kstrdup will return NULL if argument is NULL: */ + *comm = kstrdup(ctx->comm, GFP_KERNEL); + *cmd = kstrdup(ctx->cmdline, GFP_KERNEL); +diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h +index 58a72e6b1400..a89bfdc3d7f9 100644 +--- a/drivers/gpu/drm/msm/msm_gpu.h ++++ b/drivers/gpu/drm/msm/msm_gpu.h +@@ -366,10 +366,18 @@ struct msm_file_private { + */ + int sysprof; + +- /** comm: Overridden task comm, see MSM_PARAM_COMM */ ++ /** ++ * comm: Overridden task comm, see MSM_PARAM_COMM ++ * ++ * Accessed under msm_gpu::lock ++ */ + char *comm; + +- /** cmdline: Overridden task cmdline, see MSM_PARAM_CMDLINE */ ++ /** ++ * cmdline: Overridden task cmdline, see MSM_PARAM_CMDLINE ++ * ++ * Accessed under msm_gpu::lock ++ */ + char *cmdline; + + /** +-- +2.39.0 + diff --git a/patches.suse/drm-msm-lookup-the-ICC-paths-in-both-mdp5-dpu-and-md.patch b/patches.suse/drm-msm-lookup-the-ICC-paths-in-both-mdp5-dpu-and-md.patch new file mode 100644 index 0000000..106f1aa --- /dev/null +++ b/patches.suse/drm-msm-lookup-the-ICC-paths-in-both-mdp5-dpu-and-md.patch @@ -0,0 +1,129 @@ +From 5ccdcecaf8f732f593e359ebfb65de96b11bae66 Mon Sep 17 00:00:00 2001 +From: Dmitry Baryshkov +Date: Fri, 5 Aug 2022 14:56:30 +0300 +Subject: drm/msm: lookup the ICC paths in both mdp5/dpu and mdss devices +Git-commit: 5ccdcecaf8f732f593e359ebfb65de96b11bae66 +Patch-mainline: v6.1-rc1 +References: git-fixes + +The commit 6874f48bb8b0 ("drm/msm: make mdp5/dpu devices master +components") changed the MDP5 driver to look for the interconnect paths +in the MDSS device rather than in the MDP5 device itself. This was left +unnoticed since on my testing devices the interconnects probably didn't +reach the sync state. + +Rather than just using the MDP5 device for ICC path lookups for the MDP5 +devices, introduce an additional helper to check both MDP5/DPU and MDSS +nodes. This will be helpful for the MDP5->DPU conversion, since the +driver will have to check both nodes. + +Fixes: 6874f48bb8b0 ("drm/msm: make mdp5/dpu devices master components") +Reported-by: Marijn Suijten +Reported-by: Yassine Oudjana +Signed-off-by: Dmitry Baryshkov +Tested-by: Marijn Suijten # On sdm630 +Tested-by: Yassine Oudjana # msm8996 +Patchwork: https://patchwork.freedesktop.org/patch/496488/ +Link: https://lore.kernel.org/r/20220805115630.506391-1-dmitry.baryshkov@linaro.org +Signed-off-by: Dmitry Baryshkov +Signed-off-by: Rob Clark +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 7 ++----- + drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 9 +++------ + drivers/gpu/drm/msm/msm_drv.h | 2 ++ + drivers/gpu/drm/msm/msm_io_utils.c | 22 ++++++++++++++++++++++ + 4 files changed, 29 insertions(+), 11 deletions(-) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +index 008e1420e6e5..8646fd0603cb 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c ++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +@@ -384,12 +384,9 @@ static int dpu_kms_parse_data_bus_icc_path(struct dpu_kms *dpu_kms) + struct icc_path *path1; + struct drm_device *dev = dpu_kms->dev; + struct device *dpu_dev = dev->dev; +- struct device *mdss_dev = dpu_dev->parent; + +- /* Interconnects are a part of MDSS device tree binding, not the +- * MDP/DPU device. */ +- path0 = of_icc_get(mdss_dev, "mdp0-mem"); +- path1 = of_icc_get(mdss_dev, "mdp1-mem"); ++ path0 = msm_icc_get(dpu_dev, "mdp0-mem"); ++ path1 = msm_icc_get(dpu_dev, "mdp1-mem"); + + if (IS_ERR_OR_NULL(path0)) + return PTR_ERR_OR_ZERO(path0); +diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +index d2a48caf9d27..b0d21838a134 100644 +--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c ++++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +@@ -902,12 +902,9 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev) + + static int mdp5_setup_interconnect(struct platform_device *pdev) + { +- /* Interconnects are a part of MDSS device tree binding, not the +- * MDP5 device. */ +- struct device *mdss_dev = pdev->dev.parent; +- struct icc_path *path0 = of_icc_get(mdss_dev, "mdp0-mem"); +- struct icc_path *path1 = of_icc_get(mdss_dev, "mdp1-mem"); +- struct icc_path *path_rot = of_icc_get(mdss_dev, "rotator-mem"); ++ struct icc_path *path0 = msm_icc_get(&pdev->dev, "mdp0-mem"); ++ struct icc_path *path1 = msm_icc_get(&pdev->dev, "mdp1-mem"); ++ struct icc_path *path_rot = msm_icc_get(&pdev->dev, "rotator-mem"); + + if (IS_ERR(path0)) + return PTR_ERR(path0); +diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h +index 4229a7222088..f6670f82e350 100644 +--- a/drivers/gpu/drm/msm/msm_drv.h ++++ b/drivers/gpu/drm/msm/msm_drv.h +@@ -467,6 +467,8 @@ void __iomem *msm_ioremap_size(struct platform_device *pdev, const char *name, + phys_addr_t *size); + void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name); + ++struct icc_path *msm_icc_get(struct device *dev, const char *name); ++ + #define msm_writel(data, addr) writel((data), (addr)) + #define msm_readl(addr) readl((addr)) + +diff --git a/drivers/gpu/drm/msm/msm_io_utils.c b/drivers/gpu/drm/msm/msm_io_utils.c +index 7b504617833a..d02cd29ce829 100644 +--- a/drivers/gpu/drm/msm/msm_io_utils.c ++++ b/drivers/gpu/drm/msm/msm_io_utils.c +@@ -5,6 +5,8 @@ + * Author: Rob Clark + */ + ++#include ++ + #include "msm_drv.h" + + /* +@@ -124,3 +126,23 @@ void msm_hrtimer_work_init(struct msm_hrtimer_work *work, + work->worker = worker; + kthread_init_work(&work->work, fn); + } ++ ++struct icc_path *msm_icc_get(struct device *dev, const char *name) ++{ ++ struct device *mdss_dev = dev->parent; ++ struct icc_path *path; ++ ++ path = of_icc_get(dev, name); ++ if (path) ++ return path; ++ ++ /* ++ * If there are no interconnects attached to the corresponding device ++ * node, of_icc_get() will return NULL. ++ * ++ * If the MDP5/DPU device node doesn't have interconnects, lookup the ++ * path in the parent (MDSS) device. ++ */ ++ return of_icc_get(mdss_dev, name); ++ ++} +-- +2.39.0 + diff --git a/patches.suse/drm-msm-mdp5-stop-overriding-drvdata.patch b/patches.suse/drm-msm-mdp5-stop-overriding-drvdata.patch new file mode 100644 index 0000000..17d74a6 --- /dev/null +++ b/patches.suse/drm-msm-mdp5-stop-overriding-drvdata.patch @@ -0,0 +1,143 @@ +From c6122688f2652d7f8a44000ce21e84e82bae2b5e Mon Sep 17 00:00:00 2001 +From: Dmitry Baryshkov +Date: Mon, 24 Oct 2022 18:26:42 +0300 +Subject: drm/msm/mdp5: stop overriding drvdata +Git-commit: c6122688f2652d7f8a44000ce21e84e82bae2b5e +Patch-mainline: v6.2-rc1 +References: git-fixes + +The rest of the code expects that master's device drvdata is the +struct msm_drm_private instance. Do not override the mdp5's drvdata. + +Fixes: 6874f48bb8b0 ("drm/msm: make mdp5/dpu devices master components") +Signed-off-by: Dmitry Baryshkov +Reviewed-by: Abhinav Kumar +Patchwork: https://patchwork.freedesktop.org/patch/508334/ +Link: https://lore.kernel.org/r/20221024152642.3213488-1-dmitry.baryshkov@linaro.org +Signed-off-by: Dmitry Baryshkov +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 32 +++++++++++++----------- + 1 file changed, 17 insertions(+), 15 deletions(-) + +diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +index b0d21838a134..b46f983f2b46 100644 +--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c ++++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +@@ -203,7 +203,7 @@ static int mdp5_set_split_display(struct msm_kms *kms, + slave_encoder); + } + +-static void mdp5_destroy(struct platform_device *pdev); ++static void mdp5_destroy(struct mdp5_kms *mdp5_kms); + + static void mdp5_kms_destroy(struct msm_kms *kms) + { +@@ -223,7 +223,7 @@ static void mdp5_kms_destroy(struct msm_kms *kms) + } + + mdp_kms_destroy(&mdp5_kms->base); +- mdp5_destroy(mdp5_kms->pdev); ++ mdp5_destroy(mdp5_kms); + } + + #ifdef CONFIG_DEBUG_FS +@@ -519,9 +519,10 @@ static void read_mdp_hw_revision(struct mdp5_kms *mdp5_kms, + struct device *dev = &mdp5_kms->pdev->dev; + u32 version; + +- pm_runtime_get_sync(dev); ++ /* Manually enable the MDP5, as pm runtime isn't usable yet. */ ++ mdp5_enable(mdp5_kms); + version = mdp5_read(mdp5_kms, REG_MDP5_HW_VERSION); +- pm_runtime_put_sync(dev); ++ mdp5_disable(mdp5_kms); + + *major = FIELD(version, MDP5_HW_VERSION_MAJOR); + *minor = FIELD(version, MDP5_HW_VERSION_MINOR); +@@ -559,6 +560,8 @@ static int mdp5_kms_init(struct drm_device *dev) + int irq, i, ret; + + ret = mdp5_init(to_platform_device(dev->dev), dev); ++ if (ret) ++ return ret; + + /* priv->kms would have been populated by the MDP5 driver */ + kms = priv->kms; +@@ -632,9 +635,8 @@ static int mdp5_kms_init(struct drm_device *dev) + return ret; + } + +-static void mdp5_destroy(struct platform_device *pdev) ++static void mdp5_destroy(struct mdp5_kms *mdp5_kms) + { +- struct mdp5_kms *mdp5_kms = platform_get_drvdata(pdev); + int i; + + if (mdp5_kms->ctlm) +@@ -648,7 +650,7 @@ static void mdp5_destroy(struct platform_device *pdev) + kfree(mdp5_kms->intfs[i]); + + if (mdp5_kms->rpm_enabled) +- pm_runtime_disable(&pdev->dev); ++ pm_runtime_disable(&mdp5_kms->pdev->dev); + + drm_atomic_private_obj_fini(&mdp5_kms->glob_state); + drm_modeset_lock_fini(&mdp5_kms->glob_state_lock); +@@ -797,8 +799,6 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev) + goto fail; + } + +- platform_set_drvdata(pdev, mdp5_kms); +- + spin_lock_init(&mdp5_kms->resource_lock); + + mdp5_kms->dev = dev; +@@ -839,9 +839,6 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev) + */ + clk_set_rate(mdp5_kms->core_clk, 200000000); + +- pm_runtime_enable(&pdev->dev); +- mdp5_kms->rpm_enabled = true; +- + read_mdp_hw_revision(mdp5_kms, &major, &minor); + + mdp5_kms->cfg = mdp5_cfg_init(mdp5_kms, major, minor); +@@ -893,10 +890,13 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev) + /* set uninit-ed kms */ + priv->kms = &mdp5_kms->base.base; + ++ pm_runtime_enable(&pdev->dev); ++ mdp5_kms->rpm_enabled = true; ++ + return 0; + fail: + if (mdp5_kms) +- mdp5_destroy(pdev); ++ mdp5_destroy(mdp5_kms); + return ret; + } + +@@ -953,7 +953,8 @@ static int mdp5_dev_remove(struct platform_device *pdev) + static __maybe_unused int mdp5_runtime_suspend(struct device *dev) + { + struct platform_device *pdev = to_platform_device(dev); +- struct mdp5_kms *mdp5_kms = platform_get_drvdata(pdev); ++ struct msm_drm_private *priv = platform_get_drvdata(pdev); ++ struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(priv->kms)); + + DBG(""); + +@@ -963,7 +964,8 @@ static __maybe_unused int mdp5_runtime_suspend(struct device *dev) + static __maybe_unused int mdp5_runtime_resume(struct device *dev) + { + struct platform_device *pdev = to_platform_device(dev); +- struct mdp5_kms *mdp5_kms = platform_get_drvdata(pdev); ++ struct msm_drm_private *priv = platform_get_drvdata(pdev); ++ struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(priv->kms)); + + DBG(""); + +-- +2.39.0 + diff --git a/patches.suse/drm-panel-use-select-for-Ili9341-panel-driver-helper.patch b/patches.suse/drm-panel-use-select-for-Ili9341-panel-driver-helper.patch new file mode 100644 index 0000000..21847c4 --- /dev/null +++ b/patches.suse/drm-panel-use-select-for-Ili9341-panel-driver-helper.patch @@ -0,0 +1,47 @@ +From 84dfc46594b0167e5d3736273b0e0e05365da641 Mon Sep 17 00:00:00 2001 +From: Randy Dunlap +Date: Mon, 22 Aug 2022 17:42:27 -0700 +Subject: drm/panel: use 'select' for Ili9341 panel driver helpers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Git-commit: 84dfc46594b0167e5d3736273b0e0e05365da641 +Patch-mainline: v6.1-rc1 +References: git-fixes + +Use 'select' instead of 'depends on' for DRM helpers for the +Ilitek ILI9341 panel driver. +This is what is done in the vast majority of other cases and +this makes it possible to fix a build error with drm_mipi_dbi. + +Fixes: 5a04227326b0 ("drm/panel: Add ilitek ili9341 panel driver") +Signed-off-by: Randy Dunlap +Cc: Dillon Min +Cc: Linus Walleij +Cc: Sam Ravnborg +Cc: Noralf Trønnes +Cc: Thomas Zimmermann +Cc: Thierry Reding +Cc: dri-devel@lists.freedesktop.org +Cc: David Airlie +Cc: Daniel Vetter +Signed-off-by: Linus Walleij +Link: https://patchwork.freedesktop.org/patch/msgid/20220823004227.10820-1-rdunlap@infradead.org +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/panel/Kconfig | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/panel/Kconfig ++++ b/drivers/gpu/drm/panel/Kconfig +@@ -165,8 +165,8 @@ + config DRM_PANEL_ILITEK_ILI9341 + tristate "Ilitek ILI9341 240x320 QVGA panels" + depends on OF && SPI +- depends on DRM_KMS_HELPER +- depends on DRM_GEM_CMA_HELPER ++ select DRM_KMS_HELPER ++ select DRM_GEM_CMA_HELPER + depends on BACKLIGHT_CLASS_DEVICE + select DRM_MIPI_DBI + help diff --git a/patches.suse/drm-rcar-du-Drop-leftovers-dependencies-from-Kconfig.patch b/patches.suse/drm-rcar-du-Drop-leftovers-dependencies-from-Kconfig.patch new file mode 100644 index 0000000..0d59914 --- /dev/null +++ b/patches.suse/drm-rcar-du-Drop-leftovers-dependencies-from-Kconfig.patch @@ -0,0 +1,38 @@ +From 1760eb547276299ab0c6a6cd3d29469e54ade615 Mon Sep 17 00:00:00 2001 +From: Laurent Pinchart +Date: Sun, 2 Oct 2022 00:31:10 +0300 +Subject: drm: rcar-du: Drop leftovers dependencies from Kconfig +Git-commit: 1760eb547276299ab0c6a6cd3d29469e54ade615 +Patch-mainline: v6.2-rc1 +References: git-fixes + +Commit 841281fe52a7 ("drm: rcar-du: Drop LVDS device tree backward +compatibility") has removed device tree overlay sources used for +backward compatibility with old bindings, but forgot to remove related +dependencies from Kconfig. Fix it. + +Fixes: 841281fe52a7 ("drm: rcar-du: Drop LVDS device tree backward compatibility") +Reviewed-by: Geert Uytterhoeven +Reviewed-by: Kieran Bingham +Signed-off-by: Laurent Pinchart +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/rcar-du/Kconfig | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/gpu/drm/rcar-du/Kconfig b/drivers/gpu/drm/rcar-du/Kconfig +index c959e8c6be7d..13c4ad327771 100644 +--- a/drivers/gpu/drm/rcar-du/Kconfig ++++ b/drivers/gpu/drm/rcar-du/Kconfig +@@ -41,8 +41,6 @@ config DRM_RCAR_LVDS + depends on DRM_RCAR_USE_LVDS + select DRM_KMS_HELPER + select DRM_PANEL +- select OF_FLATTREE +- select OF_OVERLAY + + config DRM_RCAR_MIPI_DSI + tristate "R-Car DU MIPI DSI Encoder Support" +-- +2.39.0 + diff --git a/patches.suse/drm-rcar-du-Drop-leftovers-variables-from-Makefile.patch b/patches.suse/drm-rcar-du-Drop-leftovers-variables-from-Makefile.patch new file mode 100644 index 0000000..8268df4 --- /dev/null +++ b/patches.suse/drm-rcar-du-Drop-leftovers-variables-from-Makefile.patch @@ -0,0 +1,40 @@ +From b3c0b3105d9f5cd0632faac1af4da1201eb15d82 Mon Sep 17 00:00:00 2001 +From: Laurent Pinchart +Date: Sat, 27 Aug 2022 03:10:37 +0300 +Subject: drm: rcar-du: Drop leftovers variables from Makefile +Git-commit: b3c0b3105d9f5cd0632faac1af4da1201eb15d82 +Patch-mainline: v6.1-rc1 +References: git-fixes + +Commit 841281fe52a7 ("drm: rcar-du: Drop LVDS device tree backward +compatibility") has removed device tree overlay sources used for +backward compatibility with old bindings, but forgot to remove related +variables from the Makefile. Fix it. + +Fixes: 841281fe52a7 ("drm: rcar-du: Drop LVDS device tree backward compatibility") +Signed-off-by: Laurent Pinchart +Reviewed-by: Geert Uytterhoeven +Reviewed-by: Kieran Bingham +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/rcar-du/Makefile | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/drivers/gpu/drm/rcar-du/Makefile b/drivers/gpu/drm/rcar-du/Makefile +index e7275b5e7ec8..6f132325c8b7 100644 +--- a/drivers/gpu/drm/rcar-du/Makefile ++++ b/drivers/gpu/drm/rcar-du/Makefile +@@ -14,10 +14,3 @@ obj-$(CONFIG_DRM_RCAR_DU) += rcar-du-drm.o + obj-$(CONFIG_DRM_RCAR_DW_HDMI) += rcar_dw_hdmi.o + obj-$(CONFIG_DRM_RCAR_LVDS) += rcar_lvds.o + obj-$(CONFIG_DRM_RCAR_MIPI_DSI) += rcar_mipi_dsi.o +- +-# 'remote-endpoint' is fixed up at run-time +-DTC_FLAGS_rcar_du_of_lvds_r8a7790 += -Wno-graph_endpoint +-DTC_FLAGS_rcar_du_of_lvds_r8a7791 += -Wno-graph_endpoint +-DTC_FLAGS_rcar_du_of_lvds_r8a7793 += -Wno-graph_endpoint +-DTC_FLAGS_rcar_du_of_lvds_r8a7795 += -Wno-graph_endpoint +-DTC_FLAGS_rcar_du_of_lvds_r8a7796 += -Wno-graph_endpoint +-- +2.39.0 + diff --git a/patches.suse/drm-rockchip-dw_hdmi-filter-regulator-EPROBE_DEFER-e.patch b/patches.suse/drm-rockchip-dw_hdmi-filter-regulator-EPROBE_DEFER-e.patch new file mode 100644 index 0000000..2240960 --- /dev/null +++ b/patches.suse/drm-rockchip-dw_hdmi-filter-regulator-EPROBE_DEFER-e.patch @@ -0,0 +1,44 @@ +From bfab00b94bd8569cdb84a6511d6615e6a8104e9c Mon Sep 17 00:00:00 2001 +From: Aurelien Jarno +Date: Mon, 26 Sep 2022 22:37:52 +0200 +Subject: drm/rockchip: dw_hdmi: filter regulator -EPROBE_DEFER error messages +Git-commit: bfab00b94bd8569cdb84a6511d6615e6a8104e9c +Patch-mainline: v6.1-rc4 +References: git-fixes + +When the avdd-0v9 or avdd-1v8 supply are not yet available, EPROBE_DEFER +is returned by rockchip_hdmi_parse_dt(). This causes the following error +message to be printed multiple times: + + dwhdmi-rockchip fe0a0000.hdmi: [drm:dw_hdmi_rockchip_bind [rockchipdrm]] *ERROR* Unable to parse OF data + +Fix that by not printing the message when rockchip_hdmi_parse_dt() +returns -EPROBE_DEFER. + +Fixes: ca80c4eb4b01 ("drm/rockchip: dw_hdmi: add regulator support") +Signed-off-by: Aurelien Jarno +Reviewed-by: Dmitry Osipenko +Signed-off-by: Heiko Stuebner +Link: https://patchwork.freedesktop.org/patch/msgid/20220926203752.5430-1-aurelien@aurel32.net +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index c14f88893868..2f4b8f64cbad 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -565,7 +565,8 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, + + ret = rockchip_hdmi_parse_dt(hdmi); + if (ret) { +- DRM_DEV_ERROR(hdmi->dev, "Unable to parse OF data\n"); ++ if (ret != -EPROBE_DEFER) ++ DRM_DEV_ERROR(hdmi->dev, "Unable to parse OF data\n"); + return ret; + } + +-- +2.39.0 + diff --git a/patches.suse/drm-rockchip-fix-fbdev-on-non-IOMMU-devices.patch b/patches.suse/drm-rockchip-fix-fbdev-on-non-IOMMU-devices.patch new file mode 100644 index 0000000..9931462 --- /dev/null +++ b/patches.suse/drm-rockchip-fix-fbdev-on-non-IOMMU-devices.patch @@ -0,0 +1,53 @@ +From ab78c74cfc5a3caa2bbb7627cb8f3bca40bb5fb0 Mon Sep 17 00:00:00 2001 +From: John Keeping +Date: Thu, 20 Oct 2022 19:12:47 +0100 +Subject: drm/rockchip: fix fbdev on non-IOMMU devices +Git-commit: ab78c74cfc5a3caa2bbb7627cb8f3bca40bb5fb0 +Patch-mainline: v6.1-rc4 +References: git-fixes + +When switching to the generic fbdev infrastructure, it was missed that +framebuffers were created with the alloc_kmap parameter to +rockchip_gem_create_object() set to true. The generic infrastructure +calls this via the .dumb_create() driver operation and thus creates a +buffer without an associated kmap. + +alloc_kmap only makes a difference on devices without an IOMMU, but when +it is missing rockchip_gem_prime_vmap() fails and the framebuffer cannot +be used. + +Detect the case where a buffer is being allocated for the framebuffer +and ensure a kernel mapping is created in this case. + +Fixes: 24af7c34b290 ("drm/rockchip: use generic fbdev setup") +Reported-by: Johan Jonker +Cc: Thomas Zimmermann +Signed-off-by: John Keeping +Signed-off-by: Heiko Stuebner +Link: https://patchwork.freedesktop.org/patch/msgid/20221020181248.2497065-1-john@metanate.com +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +index 614e97aaac80..da8a69953706 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +@@ -364,9 +364,12 @@ rockchip_gem_create_with_handle(struct drm_file *file_priv, + { + struct rockchip_gem_object *rk_obj; + struct drm_gem_object *obj; ++ bool is_framebuffer; + int ret; + +- rk_obj = rockchip_gem_create_object(drm, size, false); ++ is_framebuffer = drm->fb_helper && file_priv == drm->fb_helper->client.file; ++ ++ rk_obj = rockchip_gem_create_object(drm, size, is_framebuffer); + if (IS_ERR(rk_obj)) + return ERR_CAST(rk_obj); + +-- +2.39.0 + diff --git a/patches.suse/drm-vc4-hdmi-Enforce-the-minimum-rate-at-runtime_res.patch b/patches.suse/drm-vc4-hdmi-Enforce-the-minimum-rate-at-runtime_res.patch new file mode 100644 index 0000000..66da79b --- /dev/null +++ b/patches.suse/drm-vc4-hdmi-Enforce-the-minimum-rate-at-runtime_res.patch @@ -0,0 +1,63 @@ +From ae71ab585c819f83aec84f91eb01157a90552ef2 Mon Sep 17 00:00:00 2001 +From: Maxime Ripard +Date: Thu, 29 Sep 2022 11:21:17 +0200 +Subject: drm/vc4: hdmi: Enforce the minimum rate at runtime_resume +Git-commit: ae71ab585c819f83aec84f91eb01157a90552ef2 +Patch-mainline: v6.1-rc2 +References: git-fixes + +This is a revert of commit fd5894fa2413 ("drm/vc4: hdmi: Remove clock +rate initialization"), with the code slightly moved around. + +It turns out that we can't downright remove that code from the driver, +since the Pi0-3 and Pi4 are in different cases, and it only works for +the Pi4. + +Indeed, the commit mentioned above was relying on the RaspberryPi +firmware clocks driver to initialize the rate if it wasn't done by the +firmware. However, the Pi0-3 are using the clk-bcm2835 clock driver that +wasn't doing this initialization. We therefore end up with the clock not +being assigned a rate, and the CPU stalling when trying to access a +register. + +We can't move that initialization in the clk-bcm2835 driver, since the +HSM clock we depend on is actually part of the HDMI power domain, so any +rate setup is only valid when the power domain is enabled. Thus, we +reinstated the minimum rate setup at runtime_suspend, which should +address both issues. + +Link: https://lore.kernel.org/dri-devel/20220922145448.w3xfywkn5ecak2et@pengutronix.de/ +Fixes: fd5894fa2413 ("drm/vc4: hdmi: Remove clock rate initialization") +Reported-by: Marc Kleine-Budde +Reviewed-by: Javier Martinez Canillas +Tested-by: Stefan Wahren +Signed-off-by: Maxime Ripard +Link: https://patchwork.freedesktop.org/patch/msgid/20220929-rpi-pi3-unplugged-fixes-v1-1-cd22e962296c@cerno.tech +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/vc4/vc4_hdmi.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c +index 1e5f68704d7d..780a19a75c3f 100644 +--- a/drivers/gpu/drm/vc4/vc4_hdmi.c ++++ b/drivers/gpu/drm/vc4/vc4_hdmi.c +@@ -2871,6 +2871,15 @@ static int vc4_hdmi_runtime_resume(struct device *dev) + u32 __maybe_unused value; + int ret; + ++ /* ++ * The HSM clock is in the HDMI power domain, so we need to set ++ * its frequency while the power domain is active so that it ++ * keeps its rate. ++ */ ++ ret = clk_set_min_rate(vc4_hdmi->hsm_clock, HSM_MIN_CLOCK_FREQ); ++ if (ret) ++ return ret; ++ + ret = clk_prepare_enable(vc4_hdmi->hsm_clock); + if (ret) + return ret; +-- +2.39.0 + diff --git a/patches.suse/drm-virtio-Fix-same-context-optimization.patch b/patches.suse/drm-virtio-Fix-same-context-optimization.patch new file mode 100644 index 0000000..67611e6 --- /dev/null +++ b/patches.suse/drm-virtio-Fix-same-context-optimization.patch @@ -0,0 +1,37 @@ +From 3007dc2af6e86ac00b4daf7414142637fdf50bfa Mon Sep 17 00:00:00 2001 +From: Rob Clark +Date: Fri, 12 Aug 2022 15:40:00 -0700 +Subject: drm/virtio: Fix same-context optimization +Git-commit: 3007dc2af6e86ac00b4daf7414142637fdf50bfa +Patch-mainline: v6.1-rc1 +References: git-fixes + +When VIRTGPU_EXECBUF_RING_IDX is used, we should be considering the +timeline that the EB if running on rather than the global driver fence +context. + +Fixes: 85c83ea915ed ("drm/virtio: implement context init: allocate an array of fence contexts") +Signed-off-by: Rob Clark +Link: http://patchwork.freedesktop.org/patch/msgid/20220812224001.2806463-1-robdclark@gmail.com +Signed-off-by: Gerd Hoffmann +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/virtio/virtgpu_ioctl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c +index 9b2702116f93..3b1701607aae 100644 +--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c ++++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c +@@ -168,7 +168,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, + * array contains any fence from a foreign context. + */ + ret = 0; +- if (!dma_fence_match_context(in_fence, vgdev->fence_drv.context)) ++ if (!dma_fence_match_context(in_fence, fence_ctx + ring_idx)) + ret = dma_fence_wait(in_fence, true); + + dma_fence_put(in_fence); +-- +2.39.0 + diff --git a/patches.suse/drm-virtio-Unlock-reservations-on-dma_resv_reserve_f.patch b/patches.suse/drm-virtio-Unlock-reservations-on-dma_resv_reserve_f.patch new file mode 100644 index 0000000..09c2b8d --- /dev/null +++ b/patches.suse/drm-virtio-Unlock-reservations-on-dma_resv_reserve_f.patch @@ -0,0 +1,44 @@ +From 0f877398d30e1df657a31a62f7c7de1869b072b5 Mon Sep 17 00:00:00 2001 +From: Dmitry Osipenko +Date: Thu, 30 Jun 2022 23:07:21 +0300 +Subject: drm/virtio: Unlock reservations on dma_resv_reserve_fences() error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Git-commit: 0f877398d30e1df657a31a62f7c7de1869b072b5 +Patch-mainline: v6.1-rc1 +References: git-fixes + +Unlock reservations on dma_resv_reserve_fences() error to fix recursive +locking of the reservations when this error happens. + +Cc: stable@vger.kernel.org +Fixes: c8d4c18bfbc4 ("dma-buf/drivers: make reserving a shared slot mandatory v4") +Reviewed-by: Thomas Hellström +Signed-off-by: Dmitry Osipenko +Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-5-dmitry.osipenko@collabora.com +Signed-off-by: Gerd Hoffmann +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/virtio/virtgpu_gem.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c +index 580a78809836..7db48d17ee3a 100644 +--- a/drivers/gpu/drm/virtio/virtgpu_gem.c ++++ b/drivers/gpu/drm/virtio/virtgpu_gem.c +@@ -228,8 +228,10 @@ int virtio_gpu_array_lock_resv(struct virtio_gpu_object_array *objs) + + for (i = 0; i < objs->nents; ++i) { + ret = dma_resv_reserve_fences(objs->objs[i]->resv, 1); +- if (ret) ++ if (ret) { ++ virtio_gpu_array_unlock_resv(objs); + return ret; ++ } + } + return ret; + } +-- +2.39.0 + diff --git a/patches.suse/drm-virtio-set-fb_modifiers_not_supported.patch b/patches.suse/drm-virtio-set-fb_modifiers_not_supported.patch new file mode 100644 index 0000000..6e0a23b --- /dev/null +++ b/patches.suse/drm-virtio-set-fb_modifiers_not_supported.patch @@ -0,0 +1,40 @@ +From 85faca8ca0f659263b5fb2385e4c231cc075bd84 Mon Sep 17 00:00:00 2001 +From: Chia-I Wu +Date: Wed, 31 Aug 2022 12:06:01 -0700 +Subject: drm/virtio: set fb_modifiers_not_supported +Git-commit: 85faca8ca0f659263b5fb2385e4c231cc075bd84 +Patch-mainline: v6.1-rc1 +References: git-fixes + +Without this, the drm core advertises LINEAR modifier which is +incorrect. + +Also userspace virgl does not support modifiers. For example, it causes +chrome on ozone/drm to fail with "Failed to create scanout buffer". + +Fixes: 2af104290da5 ("drm: introduce fb_modifiers_not_supported flag in mode_config") +Suggested-by: Shao-Chuan Lee +Signed-off-by: Chia-I Wu +Link: http://patchwork.freedesktop.org/patch/msgid/20220831190601.1295129-1-olvaffe@gmail.com +Signed-off-by: Gerd Hoffmann +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/virtio/virtgpu_display.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c +index 5c7f198c0712..9ea7611a9e0f 100644 +--- a/drivers/gpu/drm/virtio/virtgpu_display.c ++++ b/drivers/gpu/drm/virtio/virtgpu_display.c +@@ -349,6 +349,8 @@ int virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev) + vgdev->ddev->mode_config.max_width = XRES_MAX; + vgdev->ddev->mode_config.max_height = YRES_MAX; + ++ vgdev->ddev->mode_config.fb_modifiers_not_supported = true; ++ + for (i = 0 ; i < vgdev->num_scanouts; ++i) + vgdev_output_init(vgdev, i); + +-- +2.39.0 + diff --git a/patches.suse/ipvs-add-a-default-case-in-do_ip_vs_set_ctl.patch b/patches.suse/ipvs-add-a-default-case-in-do_ip_vs_set_ctl.patch new file mode 100644 index 0000000..6a2eed0 --- /dev/null +++ b/patches.suse/ipvs-add-a-default-case-in-do_ip_vs_set_ctl.patch @@ -0,0 +1,40 @@ +From ba57ee0944ff0085652cf8df91f9c571883debe6 Mon Sep 17 00:00:00 2001 +From: Li Qiong +Date: Mon, 12 Dec 2022 15:43:51 +0800 +Subject: [PATCH] ipvs: add a 'default' case in do_ip_vs_set_ctl() +Git-commit: ba57ee0944ff0085652cf8df91f9c571883debe6 +Patch-mainline: v6.2-rc1 +References: bsc#1207361 + +It is better to return the default switch case with +'-EINVAL', in case new commands are added. otherwise, +return a uninitialized value of ret. + +Signed-off-by: Li Qiong +Reviewed-by: Simon Horman +Acked-by: Julian Anastasov +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Jiri Wiesner +--- + net/netfilter/ipvs/ip_vs_ctl.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c +index 988222fff9f0..97f6a1c8933a 100644 +--- a/net/netfilter/ipvs/ip_vs_ctl.c ++++ b/net/netfilter/ipvs/ip_vs_ctl.c +@@ -2590,6 +2590,11 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, sockptr_t ptr, unsigned int len) + break; + case IP_VS_SO_SET_DELDEST: + ret = ip_vs_del_dest(svc, &udest); ++ break; ++ default: ++ WARN_ON_ONCE(1); ++ ret = -EINVAL; ++ break; + } + + out_unlock: +-- +2.35.3 + diff --git a/patches.suse/ipvs-add-est_cpulist-and-est_nice-sysctl-vars.patch b/patches.suse/ipvs-add-est_cpulist-and-est_nice-sysctl-vars.patch new file mode 100644 index 0000000..f4cf5b6 --- /dev/null +++ b/patches.suse/ipvs-add-est_cpulist-and-est_nice-sysctl-vars.patch @@ -0,0 +1,403 @@ +From f0be83d5421718ead31707b6ece34cf77d411c00 Mon Sep 17 00:00:00 2001 +From: Julian Anastasov +Date: Tue, 22 Nov 2022 18:46:03 +0200 +Subject: [PATCH] ipvs: add est_cpulist and est_nice sysctl vars +Git-commit: f0be83d5421718ead31707b6ece34cf77d411c00 +Patch-mainline: v6.2-rc1 +References: bsc#1207361 + +Allow the kthreads for stats to be configured for +specific cpulist (isolation) and niceness (scheduling +priority). + +Signed-off-by: Julian Anastasov +Cc: yunhong-cgl jiang +Cc: "dust.li" +Reviewed-by: Jiri Wiesner +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Jiri Wiesner +--- + Documentation/networking/ipvs-sysctl.rst | 20 ++++ + include/net/ip_vs.h | 58 +++++++++ + net/netfilter/ipvs/ip_vs_ctl.c | 143 ++++++++++++++++++++++- + net/netfilter/ipvs/ip_vs_est.c | 12 +- + 4 files changed, 229 insertions(+), 4 deletions(-) + +diff --git a/Documentation/networking/ipvs-sysctl.rst b/Documentation/networking/ipvs-sysctl.rst +index 387fda80f05f..1b778705d706 100644 +--- a/Documentation/networking/ipvs-sysctl.rst ++++ b/Documentation/networking/ipvs-sysctl.rst +@@ -129,6 +129,26 @@ drop_packet - INTEGER + threshold. When the mode 3 is set, the always mode drop rate + is controlled by the /proc/sys/net/ipv4/vs/am_droprate. + ++est_cpulist - CPULIST ++ Allowed CPUs for estimation kthreads ++ ++ Syntax: standard cpulist format ++ empty list - stop kthread tasks and estimation ++ default - the system's housekeeping CPUs for kthreads ++ ++ Example: ++ "all": all possible CPUs ++ "0-N": all possible CPUs, N denotes last CPU number ++ "0,1-N:1/2": first and all CPUs with odd number ++ "": empty list ++ ++est_nice - INTEGER ++ default 0 ++ Valid range: -20 (more favorable) .. 19 (less favorable) ++ ++ Niceness value to use for the estimation kthreads (scheduling ++ priority) ++ + expire_nodest_conn - BOOLEAN + - 0 - disabled (default) + - not 0 - enabled +diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h +index 04960dc6228f..dc51b5497cf7 100644 +--- a/include/net/ip_vs.h ++++ b/include/net/ip_vs.h +@@ -29,6 +29,7 @@ + #include + #endif + #include /* Netw namespace */ ++#include + + #define IP_VS_HDR_INVERSE 1 + #define IP_VS_HDR_ICMP 2 +@@ -365,6 +366,9 @@ struct ip_vs_cpu_stats { + struct u64_stats_sync syncp; + }; + ++/* Default nice for estimator kthreads */ ++#define IPVS_EST_NICE 0 ++ + /* IPVS statistics objects */ + struct ip_vs_estimator { + struct hlist_node list; +@@ -1009,6 +1013,12 @@ struct netns_ipvs { + int sysctl_schedule_icmp; + int sysctl_ignore_tunneled; + int sysctl_run_estimation; ++#ifdef CONFIG_SYSCTL ++ cpumask_var_t sysctl_est_cpulist; /* kthread cpumask */ ++ int est_cpulist_valid; /* cpulist set */ ++ int sysctl_est_nice; /* kthread nice */ ++ int est_stopped; /* stop tasks */ ++#endif + + /* ip_vs_lblc */ + int sysctl_lblc_expiration; +@@ -1162,6 +1172,19 @@ static inline int sysctl_run_estimation(struct netns_ipvs *ipvs) + return ipvs->sysctl_run_estimation; + } + ++static inline const struct cpumask *sysctl_est_cpulist(struct netns_ipvs *ipvs) ++{ ++ if (ipvs->est_cpulist_valid) ++ return ipvs->sysctl_est_cpulist; ++ else ++ return housekeeping_cpumask(HK_FLAG_KTHREAD); ++} ++ ++static inline int sysctl_est_nice(struct netns_ipvs *ipvs) ++{ ++ return ipvs->sysctl_est_nice; ++} ++ + #else + + static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs) +@@ -1259,6 +1282,16 @@ static inline int sysctl_run_estimation(struct netns_ipvs *ipvs) + return 1; + } + ++static inline const struct cpumask *sysctl_est_cpulist(struct netns_ipvs *ipvs) ++{ ++ return housekeeping_cpumask(HK_FLAG_KTHREAD); ++} ++ ++static inline int sysctl_est_nice(struct netns_ipvs *ipvs) ++{ ++ return IPVS_EST_NICE; ++} ++ + #endif + + /* IPVS core functions +@@ -1569,6 +1602,31 @@ int ip_vs_est_kthread_start(struct netns_ipvs *ipvs, + struct ip_vs_est_kt_data *kd); + void ip_vs_est_kthread_stop(struct ip_vs_est_kt_data *kd); + ++static inline void ip_vs_est_stopped_recalc(struct netns_ipvs *ipvs) ++{ ++#ifdef CONFIG_SYSCTL ++ ipvs->est_stopped = ipvs->est_cpulist_valid && ++ cpumask_empty(sysctl_est_cpulist(ipvs)); ++#endif ++} ++ ++static inline bool ip_vs_est_stopped(struct netns_ipvs *ipvs) ++{ ++#ifdef CONFIG_SYSCTL ++ return ipvs->est_stopped; ++#else ++ return false; ++#endif ++} ++ ++static inline int ip_vs_est_max_threads(struct netns_ipvs *ipvs) ++{ ++ unsigned int limit = IPVS_EST_CPU_KTHREADS * ++ cpumask_weight(sysctl_est_cpulist(ipvs)); ++ ++ return max(1U, limit); ++} ++ + /* Various IPVS packet transmitters (from ip_vs_xmit.c) */ + int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, + struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); +diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c +index c41a5392edc9..38df3ee655ed 100644 +--- a/net/netfilter/ipvs/ip_vs_ctl.c ++++ b/net/netfilter/ipvs/ip_vs_ctl.c +@@ -263,7 +263,7 @@ static void est_reload_work_handler(struct work_struct *work) + /* New config ? Stop kthread tasks */ + if (genid != genid_done) + ip_vs_est_kthread_stop(kd); +- if (!kd->task) { ++ if (!kd->task && !ip_vs_est_stopped(ipvs)) { + /* Do not start kthreads above 0 in calc phase */ + if ((!id || !ipvs->est_calc_phase) && + ip_vs_est_kthread_start(ipvs, kd) < 0) +@@ -1940,6 +1940,122 @@ proc_do_sync_ports(struct ctl_table *table, int write, + return rc; + } + ++static int ipvs_proc_est_cpumask_set(struct ctl_table *table, void *buffer) ++{ ++ struct netns_ipvs *ipvs = table->extra2; ++ cpumask_var_t *valp = table->data; ++ cpumask_var_t newmask; ++ int ret; ++ ++ if (!zalloc_cpumask_var(&newmask, GFP_KERNEL)) ++ return -ENOMEM; ++ ++ ret = cpulist_parse(buffer, newmask); ++ if (ret) ++ goto out; ++ ++ mutex_lock(&ipvs->est_mutex); ++ ++ if (!ipvs->est_cpulist_valid) { ++ if (!zalloc_cpumask_var(valp, GFP_KERNEL)) { ++ ret = -ENOMEM; ++ goto unlock; ++ } ++ ipvs->est_cpulist_valid = 1; ++ } ++ cpumask_and(newmask, newmask, ¤t->cpus_mask); ++ cpumask_copy(*valp, newmask); ++ /* est_max_threads may depend on cpulist size */ ++ ipvs->est_max_threads = ip_vs_est_max_threads(ipvs); ++ ipvs->est_calc_phase = 1; ++ ip_vs_est_reload_start(ipvs); ++ ++unlock: ++ mutex_unlock(&ipvs->est_mutex); ++ ++out: ++ free_cpumask_var(newmask); ++ return ret; ++} ++ ++static int ipvs_proc_est_cpumask_get(struct ctl_table *table, void *buffer, ++ size_t size) ++{ ++ struct netns_ipvs *ipvs = table->extra2; ++ cpumask_var_t *valp = table->data; ++ struct cpumask *mask; ++ int ret; ++ ++ mutex_lock(&ipvs->est_mutex); ++ ++ if (ipvs->est_cpulist_valid) ++ mask = *valp; ++ else ++ mask = (struct cpumask *)housekeeping_cpumask(HK_FLAG_KTHREAD); ++ ret = scnprintf(buffer, size, "%*pbl\n", cpumask_pr_args(mask)); ++ ++ mutex_unlock(&ipvs->est_mutex); ++ ++ return ret; ++} ++ ++static int ipvs_proc_est_cpulist(struct ctl_table *table, int write, ++ void *buffer, size_t *lenp, loff_t *ppos) ++{ ++ int ret; ++ ++ /* Ignore both read and write(append) if *ppos not 0 */ ++ if (*ppos || !*lenp) { ++ *lenp = 0; ++ return 0; ++ } ++ if (write) { ++ /* proc_sys_call_handler() appends terminator */ ++ ret = ipvs_proc_est_cpumask_set(table, buffer); ++ if (ret >= 0) ++ *ppos += *lenp; ++ } else { ++ /* proc_sys_call_handler() allocates 1 byte for terminator */ ++ ret = ipvs_proc_est_cpumask_get(table, buffer, *lenp + 1); ++ if (ret >= 0) { ++ *lenp = ret; ++ *ppos += *lenp; ++ ret = 0; ++ } ++ } ++ return ret; ++} ++ ++static int ipvs_proc_est_nice(struct ctl_table *table, int write, ++ void *buffer, size_t *lenp, loff_t *ppos) ++{ ++ struct netns_ipvs *ipvs = table->extra2; ++ int *valp = table->data; ++ int val = *valp; ++ int ret; ++ ++ struct ctl_table tmp_table = { ++ .data = &val, ++ .maxlen = sizeof(int), ++ .mode = table->mode, ++ }; ++ ++ ret = proc_dointvec(&tmp_table, write, buffer, lenp, ppos); ++ if (write && ret >= 0) { ++ if (val < MIN_NICE || val > MAX_NICE) { ++ ret = -EINVAL; ++ } else { ++ mutex_lock(&ipvs->est_mutex); ++ if (*valp != val) { ++ *valp = val; ++ ip_vs_est_reload_start(ipvs); ++ } ++ mutex_unlock(&ipvs->est_mutex); ++ } ++ } ++ return ret; ++} ++ + /* + * IPVS sysctl table (under the /proc/sys/net/ipv4/vs/) + * Do not change order or insert new entries without +@@ -2116,6 +2232,18 @@ static struct ctl_table vs_vars[] = { + .mode = 0644, + .proc_handler = proc_dointvec, + }, ++ { ++ .procname = "est_cpulist", ++ .maxlen = NR_CPUS, /* unused */ ++ .mode = 0644, ++ .proc_handler = ipvs_proc_est_cpulist, ++ }, ++ { ++ .procname = "est_nice", ++ .maxlen = sizeof(int), ++ .mode = 0644, ++ .proc_handler = ipvs_proc_est_nice, ++ }, + #ifdef CONFIG_IP_VS_DEBUG + { + .procname = "debug_level", +@@ -4134,6 +4262,7 @@ static int __net_init ip_vs_control_net_init_sysctl(struct netns_ipvs *ipvs) + INIT_DELAYED_WORK(&ipvs->defense_work, defense_work_handler); + INIT_DELAYED_WORK(&ipvs->expire_nodest_conn_work, + expire_nodest_conn_handler); ++ ipvs->est_stopped = 0; + + if (!net_eq(net, &init_net)) { + tbl = kmemdup(vs_vars, sizeof(vs_vars), GFP_KERNEL); +@@ -4195,6 +4324,15 @@ static int __net_init ip_vs_control_net_init_sysctl(struct netns_ipvs *ipvs) + tbl[idx++].data = &ipvs->sysctl_ignore_tunneled; + ipvs->sysctl_run_estimation = 1; + tbl[idx++].data = &ipvs->sysctl_run_estimation; ++ ++ ipvs->est_cpulist_valid = 0; ++ tbl[idx].extra2 = ipvs; ++ tbl[idx++].data = &ipvs->sysctl_est_cpulist; ++ ++ ipvs->sysctl_est_nice = IPVS_EST_NICE; ++ tbl[idx].extra2 = ipvs; ++ tbl[idx++].data = &ipvs->sysctl_est_nice; ++ + #ifdef CONFIG_IP_VS_DEBUG + /* Global sysctls must be ro in non-init netns */ + if (!net_eq(net, &init_net)) +@@ -4234,6 +4372,9 @@ static void __net_exit ip_vs_control_net_cleanup_sysctl(struct netns_ipvs *ipvs) + unregister_net_sysctl_table(ipvs->sysctl_hdr); + ip_vs_stop_estimator(ipvs, &ipvs->tot_stats->s); + ++ if (ipvs->est_cpulist_valid) ++ free_cpumask_var(ipvs->sysctl_est_cpulist); ++ + if (!net_eq(net, &init_net)) + kfree(ipvs->sysctl_tbl); + } +diff --git a/net/netfilter/ipvs/ip_vs_est.c b/net/netfilter/ipvs/ip_vs_est.c +index 2fb6c097437c..e0f5f5da5b6d 100644 +--- a/net/netfilter/ipvs/ip_vs_est.c ++++ b/net/netfilter/ipvs/ip_vs_est.c +@@ -57,6 +57,9 @@ + - kthread contexts are created and attached to array + - the kthread tasks are started when first service is added, before that + the total stats are not estimated ++ - when configuration (cpulist/nice) is changed, the tasks are restarted ++ by work (est_reload_work) ++ - kthread tasks are stopped while the cpulist is empty + - the kthread context holds lists with estimators (chains) which are + processed every 2 seconds + - as estimators can be added dynamically and in bursts, we try to spread +@@ -229,6 +232,7 @@ void ip_vs_est_reload_start(struct netns_ipvs *ipvs) + /* Ignore reloads before first service is added */ + if (!ipvs->enable) + return; ++ ip_vs_est_stopped_recalc(ipvs); + /* Bump the kthread configuration genid */ + atomic_inc(&ipvs->est_genid); + queue_delayed_work(system_long_wq, &ipvs->est_reload_work, 0); +@@ -259,6 +263,9 @@ int ip_vs_est_kthread_start(struct netns_ipvs *ipvs, + goto out; + } + ++ set_user_nice(kd->task, sysctl_est_nice(ipvs)); ++ set_cpus_allowed_ptr(kd->task, sysctl_est_cpulist(ipvs)); ++ + pr_info("starting estimator thread %d...\n", kd->id); + wake_up_process(kd->task); + +@@ -334,7 +341,7 @@ static int ip_vs_est_add_kthread(struct netns_ipvs *ipvs) + } + + /* Start kthread tasks only when services are present */ +- if (ipvs->enable) { ++ if (ipvs->enable && !ip_vs_est_stopped(ipvs)) { + ret = ip_vs_est_kthread_start(ipvs, kd); + if (ret < 0) + goto out; +@@ -478,8 +485,7 @@ int ip_vs_start_estimator(struct netns_ipvs *ipvs, struct ip_vs_stats *stats) + int ret; + + if (!ipvs->est_max_threads && ipvs->enable) +- ipvs->est_max_threads = IPVS_EST_CPU_KTHREADS * +- num_possible_cpus(); ++ ipvs->est_max_threads = ip_vs_est_max_threads(ipvs); + + est->ktid = -1; + est->ktrow = IPVS_EST_NTICKS - 1; /* Initial delay */ +-- +2.35.3 + diff --git a/patches.suse/ipvs-add-rcu-protection-to-stats.patch b/patches.suse/ipvs-add-rcu-protection-to-stats.patch new file mode 100644 index 0000000..b0eb5f1 --- /dev/null +++ b/patches.suse/ipvs-add-rcu-protection-to-stats.patch @@ -0,0 +1,296 @@ +From 5df7d714d8cbcce7642936cc0f6532f0c4c3d197 Mon Sep 17 00:00:00 2001 +From: Julian Anastasov +Date: Tue, 22 Nov 2022 18:45:59 +0200 +Subject: [PATCH] ipvs: add rcu protection to stats +Git-commit: 5df7d714d8cbcce7642936cc0f6532f0c4c3d197 +Patch-mainline: v6.2-rc1 +References: bsc#1207361 + +In preparation to using RCU locking for the list +with estimators, make sure the struct ip_vs_stats +are released after RCU grace period by using RCU +callbacks. This affects ipvs->tot_stats where we +can not use RCU callbacks for ipvs, so we use +allocated struct ip_vs_stats_rcu. For services +and dests we force RCU callbacks for all cases. + +Signed-off-by: Julian Anastasov +Cc: yunhong-cgl jiang +Cc: "dust.li" +Reviewed-by: Jiri Wiesner +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Jiri Wiesner +--- + include/net/ip_vs.h | 8 ++++- + net/netfilter/ipvs/ip_vs_core.c | 10 ++++-- + net/netfilter/ipvs/ip_vs_ctl.c | 64 ++++++++++++++++++++++----------- + 3 files changed, 57 insertions(+), 25 deletions(-) + +diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h +index ff1804a0c469..bd8ae137e43b 100644 +--- a/include/net/ip_vs.h ++++ b/include/net/ip_vs.h +@@ -405,6 +405,11 @@ struct ip_vs_stats { + struct ip_vs_kstats kstats0; /* reset values */ + }; + ++struct ip_vs_stats_rcu { ++ struct ip_vs_stats s; ++ struct rcu_head rcu_head; ++}; ++ + struct dst_entry; + struct iphdr; + struct ip_vs_conn; +@@ -688,6 +693,7 @@ struct ip_vs_dest { + union nf_inet_addr vaddr; /* virtual IP address */ + __u32 vfwmark; /* firewall mark of service */ + ++ struct rcu_head rcu_head; + struct list_head t_list; /* in dest_trash */ + unsigned int in_rs_table:1; /* we are in rs_table */ + }; +@@ -869,7 +875,7 @@ struct netns_ipvs { + atomic_t conn_count; /* connection counter */ + + /* ip_vs_ctl */ +- struct ip_vs_stats tot_stats; /* Statistics & est. */ ++ struct ip_vs_stats_rcu *tot_stats; /* Statistics & est. */ + + int num_services; /* no of virtual services */ + int num_services6; /* IPv6 virtual services */ +diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c +index 51ad557a525b..fcdaef1fcccf 100644 +--- a/net/netfilter/ipvs/ip_vs_core.c ++++ b/net/netfilter/ipvs/ip_vs_core.c +@@ -143,7 +143,7 @@ ip_vs_in_stats(struct ip_vs_conn *cp, struct sk_buff *skb) + s->cnt.inbytes += skb->len; + u64_stats_update_end(&s->syncp); + +- s = this_cpu_ptr(ipvs->tot_stats.cpustats); ++ s = this_cpu_ptr(ipvs->tot_stats->s.cpustats); + u64_stats_update_begin(&s->syncp); + s->cnt.inpkts++; + s->cnt.inbytes += skb->len; +@@ -179,7 +179,7 @@ ip_vs_out_stats(struct ip_vs_conn *cp, struct sk_buff *skb) + s->cnt.outbytes += skb->len; + u64_stats_update_end(&s->syncp); + +- s = this_cpu_ptr(ipvs->tot_stats.cpustats); ++ s = this_cpu_ptr(ipvs->tot_stats->s.cpustats); + u64_stats_update_begin(&s->syncp); + s->cnt.outpkts++; + s->cnt.outbytes += skb->len; +@@ -208,7 +208,7 @@ ip_vs_conn_stats(struct ip_vs_conn *cp, struct ip_vs_service *svc) + s->cnt.conns++; + u64_stats_update_end(&s->syncp); + +- s = this_cpu_ptr(ipvs->tot_stats.cpustats); ++ s = this_cpu_ptr(ipvs->tot_stats->s.cpustats); + u64_stats_update_begin(&s->syncp); + s->cnt.conns++; + u64_stats_update_end(&s->syncp); +@@ -2448,6 +2448,10 @@ static void __exit ip_vs_cleanup(void) + ip_vs_conn_cleanup(); + ip_vs_protocol_cleanup(); + ip_vs_control_cleanup(); ++ /* common rcu_barrier() used by: ++ * - ip_vs_control_cleanup() ++ */ ++ rcu_barrier(); + pr_info("ipvs unloaded.\n"); + } + +diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c +index 4d62059a6021..9016b641ae52 100644 +--- a/net/netfilter/ipvs/ip_vs_ctl.c ++++ b/net/netfilter/ipvs/ip_vs_ctl.c +@@ -483,17 +483,14 @@ static void ip_vs_service_rcu_free(struct rcu_head *head) + ip_vs_service_free(svc); + } + +-static void __ip_vs_svc_put(struct ip_vs_service *svc, bool do_delay) ++static void __ip_vs_svc_put(struct ip_vs_service *svc) + { + if (atomic_dec_and_test(&svc->refcnt)) { + IP_VS_DBG_BUF(3, "Removing service %u/%s:%u\n", + svc->fwmark, + IP_VS_DBG_ADDR(svc->af, &svc->addr), + ntohs(svc->port)); +- if (do_delay) +- call_rcu(&svc->rcu_head, ip_vs_service_rcu_free); +- else +- ip_vs_service_free(svc); ++ call_rcu(&svc->rcu_head, ip_vs_service_rcu_free); + } + } + +@@ -780,14 +777,22 @@ ip_vs_trash_get_dest(struct ip_vs_service *svc, int dest_af, + return dest; + } + ++static void ip_vs_dest_rcu_free(struct rcu_head *head) ++{ ++ struct ip_vs_dest *dest; ++ ++ dest = container_of(head, struct ip_vs_dest, rcu_head); ++ free_percpu(dest->stats.cpustats); ++ ip_vs_dest_put_and_free(dest); ++} ++ + static void ip_vs_dest_free(struct ip_vs_dest *dest) + { + struct ip_vs_service *svc = rcu_dereference_protected(dest->svc, 1); + + __ip_vs_dst_cache_reset(dest); +- __ip_vs_svc_put(svc, false); +- free_percpu(dest->stats.cpustats); +- ip_vs_dest_put_and_free(dest); ++ __ip_vs_svc_put(svc); ++ call_rcu(&dest->rcu_head, ip_vs_dest_rcu_free); + } + + /* +@@ -811,6 +816,16 @@ static void ip_vs_trash_cleanup(struct netns_ipvs *ipvs) + } + } + ++static void ip_vs_stats_rcu_free(struct rcu_head *head) ++{ ++ struct ip_vs_stats_rcu *rs = container_of(head, ++ struct ip_vs_stats_rcu, ++ rcu_head); ++ ++ free_percpu(rs->s.cpustats); ++ kfree(rs); ++} ++ + static void + ip_vs_copy_stats(struct ip_vs_kstats *dst, struct ip_vs_stats *src) + { +@@ -923,7 +938,7 @@ __ip_vs_update_dest(struct ip_vs_service *svc, struct ip_vs_dest *dest, + if (old_svc != svc) { + ip_vs_zero_stats(&dest->stats); + __ip_vs_bind_svc(dest, svc); +- __ip_vs_svc_put(old_svc, true); ++ __ip_vs_svc_put(old_svc); + } + } + +@@ -1571,7 +1586,7 @@ static void __ip_vs_del_service(struct ip_vs_service *svc, bool cleanup) + /* + * Free the service if nobody refers to it + */ +- __ip_vs_svc_put(svc, true); ++ __ip_vs_svc_put(svc); + + /* decrease the module use count */ + ip_vs_use_count_dec(); +@@ -1761,7 +1776,7 @@ static int ip_vs_zero_all(struct netns_ipvs *ipvs) + } + } + +- ip_vs_zero_stats(&ipvs->tot_stats); ++ ip_vs_zero_stats(&ipvs->tot_stats->s); + return 0; + } + +@@ -2255,7 +2270,7 @@ static int ip_vs_stats_show(struct seq_file *seq, void *v) + seq_puts(seq, + " Conns Packets Packets Bytes Bytes\n"); + +- ip_vs_copy_stats(&show, &net_ipvs(net)->tot_stats); ++ ip_vs_copy_stats(&show, &net_ipvs(net)->tot_stats->s); + seq_printf(seq, "%8LX %8LX %8LX %16LX %16LX\n\n", + (unsigned long long)show.conns, + (unsigned long long)show.inpkts, +@@ -2279,7 +2294,7 @@ static int ip_vs_stats_show(struct seq_file *seq, void *v) + static int ip_vs_stats_percpu_show(struct seq_file *seq, void *v) + { + struct net *net = seq_file_single_net(seq); +- struct ip_vs_stats *tot_stats = &net_ipvs(net)->tot_stats; ++ struct ip_vs_stats *tot_stats = &net_ipvs(net)->tot_stats->s; + struct ip_vs_cpu_stats __percpu *cpustats = tot_stats->cpustats; + struct ip_vs_kstats kstats; + int i; +@@ -4107,7 +4122,6 @@ static int __net_init ip_vs_control_net_init_sysctl(struct netns_ipvs *ipvs) + kfree(tbl); + return -ENOMEM; + } +- ip_vs_start_estimator(ipvs, &ipvs->tot_stats); + ipvs->sysctl_tbl = tbl; + /* Schedule defense work */ + INIT_DELAYED_WORK(&ipvs->defense_work, defense_work_handler); +@@ -4118,6 +4132,7 @@ static int __net_init ip_vs_control_net_init_sysctl(struct netns_ipvs *ipvs) + INIT_DELAYED_WORK(&ipvs->expire_nodest_conn_work, + expire_nodest_conn_handler); + ++ ip_vs_start_estimator(ipvs, &ipvs->tot_stats->s); + return 0; + } + +@@ -4129,7 +4144,7 @@ static void __net_exit ip_vs_control_net_cleanup_sysctl(struct netns_ipvs *ipvs) + cancel_delayed_work_sync(&ipvs->defense_work); + cancel_work_sync(&ipvs->defense_work.work); + unregister_net_sysctl_table(ipvs->sysctl_hdr); +- ip_vs_stop_estimator(ipvs, &ipvs->tot_stats); ++ ip_vs_stop_estimator(ipvs, &ipvs->tot_stats->s); + + if (!net_eq(net, &init_net)) + kfree(ipvs->sysctl_tbl); +@@ -4165,17 +4180,20 @@ int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs) + atomic_set(&ipvs->conn_out_counter, 0); + + /* procfs stats */ +- ipvs->tot_stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats); +- if (!ipvs->tot_stats.cpustats) ++ ipvs->tot_stats = kzalloc(sizeof(*ipvs->tot_stats), GFP_KERNEL); ++ if (!ipvs->tot_stats) + return -ENOMEM; ++ ipvs->tot_stats->s.cpustats = alloc_percpu(struct ip_vs_cpu_stats); ++ if (!ipvs->tot_stats->s.cpustats) ++ goto err_tot_stats; + + for_each_possible_cpu(i) { + struct ip_vs_cpu_stats *ipvs_tot_stats; +- ipvs_tot_stats = per_cpu_ptr(ipvs->tot_stats.cpustats, i); ++ ipvs_tot_stats = per_cpu_ptr(ipvs->tot_stats->s.cpustats, i); + u64_stats_init(&ipvs_tot_stats->syncp); + } + +- spin_lock_init(&ipvs->tot_stats.lock); ++ spin_lock_init(&ipvs->tot_stats->s.lock); + + #ifdef CONFIG_PROC_FS + if (!proc_create_net("ip_vs", 0, ipvs->net->proc_net, +@@ -4207,7 +4225,10 @@ int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs) + + err_vs: + #endif +- free_percpu(ipvs->tot_stats.cpustats); ++ free_percpu(ipvs->tot_stats->s.cpustats); ++ ++err_tot_stats: ++ kfree(ipvs->tot_stats); + return -ENOMEM; + } + +@@ -4220,7 +4241,7 @@ void __net_exit ip_vs_control_net_cleanup(struct netns_ipvs *ipvs) + remove_proc_entry("ip_vs_stats", ipvs->net->proc_net); + remove_proc_entry("ip_vs", ipvs->net->proc_net); + #endif +- free_percpu(ipvs->tot_stats.cpustats); ++ call_rcu(&ipvs->tot_stats->rcu_head, ip_vs_stats_rcu_free); + } + + int __init ip_vs_register_nl_ioctl(void) +@@ -4280,5 +4301,6 @@ void ip_vs_control_cleanup(void) + { + EnterFunction(2); + unregister_netdevice_notifier(&ip_vs_dst_notifier); ++ /* relying on common rcu_barrier() in ip_vs_cleanup() */ + LeaveFunction(2); + } +-- +2.35.3 + diff --git a/patches.suse/ipvs-autoload-ipvs-on-genl-access.patch b/patches.suse/ipvs-autoload-ipvs-on-genl-access.patch new file mode 100644 index 0000000..8bee01d --- /dev/null +++ b/patches.suse/ipvs-autoload-ipvs-on-genl-access.patch @@ -0,0 +1,40 @@ +From 2199f562730dd1382946e0a2532afc38cd444129 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= +Date: Thu, 21 Oct 2021 15:02:55 +0200 +Subject: [PATCH] ipvs: autoload ipvs on genl access +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Git-commit: 2199f562730dd1382946e0a2532afc38cd444129 +Patch-mainline: v5.16-rc1 +References: bsc#1207361 + +The kernel provides the functionality to automatically load modules +providing genl families. Use this to remove the need for users to +manually load the module. + +Signed-off-by: Thomas Weißschuh +Acked-by: Julian Anastasov +Acked-by: Simon Horman +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Jiri Wiesner +--- + net/netfilter/ipvs/ip_vs_ctl.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c +index 29ec3ef63edc..0ff94c66641f 100644 +--- a/net/netfilter/ipvs/ip_vs_ctl.c ++++ b/net/netfilter/ipvs/ip_vs_ctl.c +@@ -48,6 +48,8 @@ + + #include + ++MODULE_ALIAS_GENL_FAMILY(IPVS_GENL_NAME); ++ + /* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */ + static DEFINE_MUTEX(__ip_vs_mutex); + +-- +2.35.3 + diff --git a/patches.suse/ipvs-correctly-print-the-memory-size-of-ip_vs_conn_t.patch b/patches.suse/ipvs-correctly-print-the-memory-size-of-ip_vs_conn_t.patch new file mode 100644 index 0000000..ad84bf7 --- /dev/null +++ b/patches.suse/ipvs-correctly-print-the-memory-size-of-ip_vs_conn_t.patch @@ -0,0 +1,37 @@ +From eba1a872cb73314280d5448d934935b23e30b7ca Mon Sep 17 00:00:00 2001 +From: Pengcheng Yang +Date: Tue, 12 Apr 2022 19:05:45 +0800 +Subject: [PATCH] ipvs: correctly print the memory size of ip_vs_conn_tab +Git-commit: eba1a872cb73314280d5448d934935b23e30b7ca +Patch-mainline: v5.18-rc5 +References: bsc#1207361 + +The memory size of ip_vs_conn_tab changed after we use hlist +instead of list. + +Fixes: 731109e78415 ("ipvs: use hlist instead of list") +Signed-off-by: Pengcheng Yang +Acked-by: Julian Anastasov +Acked-by: Simon Horman +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Jiri Wiesner +--- + net/netfilter/ipvs/ip_vs_conn.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c +index 2c467c422dc6..fb67f1ca2495 100644 +--- a/net/netfilter/ipvs/ip_vs_conn.c ++++ b/net/netfilter/ipvs/ip_vs_conn.c +@@ -1495,7 +1495,7 @@ int __init ip_vs_conn_init(void) + pr_info("Connection hash table configured " + "(size=%d, memory=%ldKbytes)\n", + ip_vs_conn_tab_size, +- (long)(ip_vs_conn_tab_size*sizeof(struct list_head))/1024); ++ (long)(ip_vs_conn_tab_size*sizeof(*ip_vs_conn_tab))/1024); + IP_VS_DBG(0, "Each connection entry needs %zd bytes at least\n", + sizeof(struct ip_vs_conn)); + +-- +2.35.3 + diff --git a/patches.suse/ipvs-fix-WARNING-in-__ip_vs_cleanup_batch.patch b/patches.suse/ipvs-fix-WARNING-in-__ip_vs_cleanup_batch.patch new file mode 100644 index 0000000..80e537e --- /dev/null +++ b/patches.suse/ipvs-fix-WARNING-in-__ip_vs_cleanup_batch.patch @@ -0,0 +1,89 @@ +From 3d00c6a0da8ddcf75213e004765e4a42acc71d5d Mon Sep 17 00:00:00 2001 +From: Zhengchao Shao +Date: Mon, 31 Oct 2022 20:07:04 +0800 +Subject: [PATCH] ipvs: fix WARNING in __ip_vs_cleanup_batch() +Git-commit: 3d00c6a0da8ddcf75213e004765e4a42acc71d5d +Patch-mainline: v6.1-rc4 +References: bsc#1207361 + +During the initialization of ip_vs_conn_net_init(), if file ip_vs_conn +or ip_vs_conn_sync fails to be created, the initialization is successful +by default. Therefore, the ip_vs_conn or ip_vs_conn_sync file doesn't +be found during the remove. + +The following is the stack information: +name 'ip_vs_conn_sync' +WARNING: CPU: 3 PID: 9 at fs/proc/generic.c:712 +remove_proc_entry+0x389/0x460 +Modules linked in: +Workqueue: netns cleanup_net +RIP: 0010:remove_proc_entry+0x389/0x460 +Call Trace: + +__ip_vs_cleanup_batch+0x7d/0x120 +ops_exit_list+0x125/0x170 +cleanup_net+0x4ea/0xb00 +process_one_work+0x9bf/0x1710 +worker_thread+0x665/0x1080 +kthread+0x2e4/0x3a0 +ret_from_fork+0x1f/0x30 + + +Fixes: 61b1ab4583e2 ("IPVS: netns, add basic init per netns.") +Signed-off-by: Zhengchao Shao +Acked-by: Julian Anastasov +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Jiri Wiesner +--- + net/netfilter/ipvs/ip_vs_conn.c | 26 +++++++++++++++++++++----- + 1 file changed, 21 insertions(+), 5 deletions(-) + +diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c +index 7c4866c04343..13534e02346c 100644 +--- a/net/netfilter/ipvs/ip_vs_conn.c ++++ b/net/netfilter/ipvs/ip_vs_conn.c +@@ -1447,20 +1447,36 @@ int __net_init ip_vs_conn_net_init(struct netns_ipvs *ipvs) + { + atomic_set(&ipvs->conn_count, 0); + +- proc_create_net("ip_vs_conn", 0, ipvs->net->proc_net, +- &ip_vs_conn_seq_ops, sizeof(struct ip_vs_iter_state)); +- proc_create_net("ip_vs_conn_sync", 0, ipvs->net->proc_net, +- &ip_vs_conn_sync_seq_ops, +- sizeof(struct ip_vs_iter_state)); ++#ifdef CONFIG_PROC_FS ++ if (!proc_create_net("ip_vs_conn", 0, ipvs->net->proc_net, ++ &ip_vs_conn_seq_ops, ++ sizeof(struct ip_vs_iter_state))) ++ goto err_conn; ++ ++ if (!proc_create_net("ip_vs_conn_sync", 0, ipvs->net->proc_net, ++ &ip_vs_conn_sync_seq_ops, ++ sizeof(struct ip_vs_iter_state))) ++ goto err_conn_sync; ++#endif ++ + return 0; ++ ++#ifdef CONFIG_PROC_FS ++err_conn_sync: ++ remove_proc_entry("ip_vs_conn", ipvs->net->proc_net); ++err_conn: ++ return -ENOMEM; ++#endif + } + + void __net_exit ip_vs_conn_net_cleanup(struct netns_ipvs *ipvs) + { + /* flush all the connection entries first */ + ip_vs_conn_flush(ipvs); ++#ifdef CONFIG_PROC_FS + remove_proc_entry("ip_vs_conn", ipvs->net->proc_net); + remove_proc_entry("ip_vs_conn_sync", ipvs->net->proc_net); ++#endif + } + + int __init ip_vs_conn_init(void) +-- +2.35.3 + diff --git a/patches.suse/ipvs-fix-WARNING-in-ip_vs_app_net_cleanup.patch b/patches.suse/ipvs-fix-WARNING-in-ip_vs_app_net_cleanup.patch new file mode 100644 index 0000000..53a47ad --- /dev/null +++ b/patches.suse/ipvs-fix-WARNING-in-ip_vs_app_net_cleanup.patch @@ -0,0 +1,67 @@ +From 5663ed63adb9619c98ab7479aa4606fa9b7a548c Mon Sep 17 00:00:00 2001 +From: Zhengchao Shao +Date: Mon, 31 Oct 2022 20:07:05 +0800 +Subject: [PATCH] ipvs: fix WARNING in ip_vs_app_net_cleanup() +Git-commit: 5663ed63adb9619c98ab7479aa4606fa9b7a548c +Patch-mainline: v6.1-rc4 +References: bsc#1207361 + +During the initialization of ip_vs_app_net_init(), if file ip_vs_app +fails to be created, the initialization is successful by default. +Therefore, the ip_vs_app file doesn't be found during the remove in +ip_vs_app_net_cleanup(). It will cause WRNING. + +The following is the stack information: +name 'ip_vs_app' +WARNING: CPU: 1 PID: 9 at fs/proc/generic.c:712 remove_proc_entry+0x389/0x460 +Modules linked in: +Workqueue: netns cleanup_net +RIP: 0010:remove_proc_entry+0x389/0x460 +Call Trace: + +ops_exit_list+0x125/0x170 +cleanup_net+0x4ea/0xb00 +process_one_work+0x9bf/0x1710 +worker_thread+0x665/0x1080 +kthread+0x2e4/0x3a0 +ret_from_fork+0x1f/0x30 + + +Fixes: 457c4cbc5a3d ("[NET]: Make /proc/net per network namespace") +Signed-off-by: Zhengchao Shao +Acked-by: Julian Anastasov +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Jiri Wiesner +--- + net/netfilter/ipvs/ip_vs_app.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/net/netfilter/ipvs/ip_vs_app.c b/net/netfilter/ipvs/ip_vs_app.c +index f9b16f2b2219..fdacbc3c15be 100644 +--- a/net/netfilter/ipvs/ip_vs_app.c ++++ b/net/netfilter/ipvs/ip_vs_app.c +@@ -599,13 +599,19 @@ static const struct seq_operations ip_vs_app_seq_ops = { + int __net_init ip_vs_app_net_init(struct netns_ipvs *ipvs) + { + INIT_LIST_HEAD(&ipvs->app_list); +- proc_create_net("ip_vs_app", 0, ipvs->net->proc_net, &ip_vs_app_seq_ops, +- sizeof(struct seq_net_private)); ++#ifdef CONFIG_PROC_FS ++ if (!proc_create_net("ip_vs_app", 0, ipvs->net->proc_net, ++ &ip_vs_app_seq_ops, ++ sizeof(struct seq_net_private))) ++ return -ENOMEM; ++#endif + return 0; + } + + void __net_exit ip_vs_app_net_cleanup(struct netns_ipvs *ipvs) + { + unregister_ip_vs_app(ipvs, NULL /* all */); ++#ifdef CONFIG_PROC_FS + remove_proc_entry("ip_vs_app", ipvs->net->proc_net); ++#endif + } +-- +2.35.3 + diff --git a/patches.suse/ipvs-fix-type-warning-in-do_div-on-32-bit.patch b/patches.suse/ipvs-fix-type-warning-in-do_div-on-32-bit.patch new file mode 100644 index 0000000..53f40d4 --- /dev/null +++ b/patches.suse/ipvs-fix-type-warning-in-do_div-on-32-bit.patch @@ -0,0 +1,57 @@ +From 7c4a6309e27f411743817fe74a832ec2d2798a4b Mon Sep 17 00:00:00 2001 +From: Jakub Kicinski +Date: Mon, 12 Dec 2022 19:20:37 -0800 +Subject: [PATCH] ipvs: fix type warning in do_div() on 32 bit +Git-commit: 7c4a6309e27f411743817fe74a832ec2d2798a4b +Patch-mainline: v6.2-rc1 +References: bsc#1207361 + +32 bit platforms without 64bit div generate the following warning: + +net/netfilter/ipvs/ip_vs_est.c: In function 'ip_vs_est_calc_limits': +include/asm-generic/div64.h:222:35: warning: comparison of distinct pointer types lacks a cast + 222 | (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ + | ^~ +net/netfilter/ipvs/ip_vs_est.c:694:17: note: in expansion of macro 'do_div' + 694 | do_div(val, loops); + | ^~~~~~ +include/asm-generic/div64.h:222:35: warning: comparison of distinct pointer types lacks a cast + 222 | (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ + | ^~ +net/netfilter/ipvs/ip_vs_est.c:700:33: note: in expansion of macro 'do_div' + 700 | do_div(val, min_est); + | ^~~~~~ + +first argument of do_div() should be unsigned. We can't just cast +as do_div() updates it as well, so we need an lval. +Make val unsigned in the first place, all paths check that the value +they assign to this variables are non-negative already. + +Fixes: 705dd3444081 ("ipvs: use kthreads for stats estimation") +Signed-off-by: Jakub Kicinski +Link: https://lore.kernel.org/r/20221213032037.844517-1-kuba@kernel.org +Signed-off-by: Paolo Abeni +Signed-off-by: Jiri Wiesner +--- + net/netfilter/ipvs/ip_vs_est.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/netfilter/ipvs/ip_vs_est.c b/net/netfilter/ipvs/ip_vs_est.c +index df56073bb282..ce2a1549b304 100644 +--- a/net/netfilter/ipvs/ip_vs_est.c ++++ b/net/netfilter/ipvs/ip_vs_est.c +@@ -640,9 +640,10 @@ static int ip_vs_est_calc_limits(struct netns_ipvs *ipvs, int *chain_max) + int i, loops, ntest; + s32 min_est = 0; + ktime_t t1, t2; +- s64 diff, val; + int max = 8; + int ret = 1; ++ s64 diff; ++ u64 val; + + INIT_HLIST_HEAD(&chain); + mutex_lock(&__ip_vs_mutex); +-- +2.35.3 + diff --git a/patches.suse/ipvs-remove-unused-variable-for-ip_vs_new_dest.patch b/patches.suse/ipvs-remove-unused-variable-for-ip_vs_new_dest.patch new file mode 100644 index 0000000..860e060 --- /dev/null +++ b/patches.suse/ipvs-remove-unused-variable-for-ip_vs_new_dest.patch @@ -0,0 +1,55 @@ +From fc5e0352ccb58508274de289c66832c7a0b68161 Mon Sep 17 00:00:00 2001 +From: GuoYong Zheng +Date: Fri, 5 Nov 2021 19:39:40 +0800 +Subject: [PATCH] ipvs: remove unused variable for ip_vs_new_dest +Git-commit: fc5e0352ccb58508274de289c66832c7a0b68161 +Patch-mainline: v5.17-rc1 +References: bsc#1207361 + +The dest variable is not used after ip_vs_new_dest anymore in +ip_vs_add_dest, do not need pass it to ip_vs_new_dest, remove it. + +Signed-off-by: GuoYong Zheng +Acked-by: Julian Anastasov +Acked-by: Simon Horman +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Jiri Wiesner +--- + net/netfilter/ipvs/ip_vs_ctl.c | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c +index 39c523bd775c..7f645328b47f 100644 +--- a/net/netfilter/ipvs/ip_vs_ctl.c ++++ b/net/netfilter/ipvs/ip_vs_ctl.c +@@ -960,8 +960,7 @@ __ip_vs_update_dest(struct ip_vs_service *svc, struct ip_vs_dest *dest, + * Create a destination for the given service + */ + static int +-ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest, +- struct ip_vs_dest **dest_p) ++ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest) + { + struct ip_vs_dest *dest; + unsigned int atype, i; +@@ -1021,8 +1020,6 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest, + spin_lock_init(&dest->stats.lock); + __ip_vs_update_dest(svc, dest, udest, 1); + +- *dest_p = dest; +- + LeaveFunction(2); + return 0; + +@@ -1096,7 +1093,7 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest) + /* + * Allocate and initialize the dest structure + */ +- ret = ip_vs_new_dest(svc, udest, &dest); ++ ret = ip_vs_new_dest(svc, udest); + } + LeaveFunction(2); + +-- +2.35.3 + diff --git a/patches.suse/ipvs-run_estimation-should-control-the-kthread-tasks.patch b/patches.suse/ipvs-run_estimation-should-control-the-kthread-tasks.patch new file mode 100644 index 0000000..f2a8a6f --- /dev/null +++ b/patches.suse/ipvs-run_estimation-should-control-the-kthread-tasks.patch @@ -0,0 +1,125 @@ +From 144361c1949f227df9244302da02c258a363b674 Mon Sep 17 00:00:00 2001 +From: Julian Anastasov +Date: Tue, 22 Nov 2022 18:46:04 +0200 +Subject: [PATCH] ipvs: run_estimation should control the kthread tasks +Git-commit: 144361c1949f227df9244302da02c258a363b674 +Patch-mainline: v6.2-rc1 +References: bsc#1207361 + +Change the run_estimation flag to start/stop the kthread tasks. + +Signed-off-by: Julian Anastasov +Cc: yunhong-cgl jiang +Cc: "dust.li" +Reviewed-by: Jiri Wiesner +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Jiri Wiesner +--- + Documentation/networking/ipvs-sysctl.rst | 4 ++-- + include/net/ip_vs.h | 6 +++-- + net/netfilter/ipvs/ip_vs_ctl.c | 29 +++++++++++++++++++++++- + net/netfilter/ipvs/ip_vs_est.c | 2 +- + 4 files changed, 35 insertions(+), 6 deletions(-) + +diff --git a/Documentation/networking/ipvs-sysctl.rst b/Documentation/networking/ipvs-sysctl.rst +index 1b778705d706..3fb5fa142eef 100644 +--- a/Documentation/networking/ipvs-sysctl.rst ++++ b/Documentation/networking/ipvs-sysctl.rst +@@ -324,8 +324,8 @@ run_estimation - BOOLEAN + 0 - disabled + not 0 - enabled (default) + +- If disabled, the estimation will be stop, and you can't see +- any update on speed estimation data. ++ If disabled, the estimation will be suspended and kthread tasks ++ stopped. + + You can always re-enable estimation by setting this value to 1. + But be careful, the first estimation after re-enable is not +diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h +index dc51b5497cf7..c6c61100d244 100644 +--- a/include/net/ip_vs.h ++++ b/include/net/ip_vs.h +@@ -1605,8 +1605,10 @@ void ip_vs_est_kthread_stop(struct ip_vs_est_kt_data *kd); + static inline void ip_vs_est_stopped_recalc(struct netns_ipvs *ipvs) + { + #ifdef CONFIG_SYSCTL +- ipvs->est_stopped = ipvs->est_cpulist_valid && +- cpumask_empty(sysctl_est_cpulist(ipvs)); ++ /* Stop tasks while cpulist is empty or if disabled with flag */ ++ ipvs->est_stopped = !sysctl_run_estimation(ipvs) || ++ (ipvs->est_cpulist_valid && ++ cpumask_empty(sysctl_est_cpulist(ipvs))); + #endif + } + +diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c +index 38df3ee655ed..c9f598505642 100644 +--- a/net/netfilter/ipvs/ip_vs_ctl.c ++++ b/net/netfilter/ipvs/ip_vs_ctl.c +@@ -2056,6 +2056,32 @@ static int ipvs_proc_est_nice(struct ctl_table *table, int write, + return ret; + } + ++static int ipvs_proc_run_estimation(struct ctl_table *table, int write, ++ void *buffer, size_t *lenp, loff_t *ppos) ++{ ++ struct netns_ipvs *ipvs = table->extra2; ++ int *valp = table->data; ++ int val = *valp; ++ int ret; ++ ++ struct ctl_table tmp_table = { ++ .data = &val, ++ .maxlen = sizeof(int), ++ .mode = table->mode, ++ }; ++ ++ ret = proc_dointvec(&tmp_table, write, buffer, lenp, ppos); ++ if (write && ret >= 0) { ++ mutex_lock(&ipvs->est_mutex); ++ if (*valp != val) { ++ *valp = val; ++ ip_vs_est_reload_start(ipvs); ++ } ++ mutex_unlock(&ipvs->est_mutex); ++ } ++ return ret; ++} ++ + /* + * IPVS sysctl table (under the /proc/sys/net/ipv4/vs/) + * Do not change order or insert new entries without +@@ -2230,7 +2256,7 @@ static struct ctl_table vs_vars[] = { + .procname = "run_estimation", + .maxlen = sizeof(int), + .mode = 0644, +- .proc_handler = proc_dointvec, ++ .proc_handler = ipvs_proc_run_estimation, + }, + { + .procname = "est_cpulist", +@@ -4323,6 +4349,7 @@ static int __net_init ip_vs_control_net_init_sysctl(struct netns_ipvs *ipvs) + tbl[idx++].data = &ipvs->sysctl_schedule_icmp; + tbl[idx++].data = &ipvs->sysctl_ignore_tunneled; + ipvs->sysctl_run_estimation = 1; ++ tbl[idx].extra2 = ipvs; + tbl[idx++].data = &ipvs->sysctl_run_estimation; + + ipvs->est_cpulist_valid = 0; +diff --git a/net/netfilter/ipvs/ip_vs_est.c b/net/netfilter/ipvs/ip_vs_est.c +index e0f5f5da5b6d..df56073bb282 100644 +--- a/net/netfilter/ipvs/ip_vs_est.c ++++ b/net/netfilter/ipvs/ip_vs_est.c +@@ -212,7 +212,7 @@ static int ip_vs_estimation_kthread(void *data) + kd->est_timer = now; + } + +- if (sysctl_run_estimation(ipvs) && kd->tick_len[row]) ++ if (kd->tick_len[row]) + ip_vs_tick_estimation(kd, row); + + row++; +-- +2.35.3 + diff --git a/patches.suse/ipvs-use-common-functions-for-stats-allocation.patch b/patches.suse/ipvs-use-common-functions-for-stats-allocation.patch new file mode 100644 index 0000000..eb4e55f --- /dev/null +++ b/patches.suse/ipvs-use-common-functions-for-stats-allocation.patch @@ -0,0 +1,248 @@ +From de39afb3d811ba2c028de8662adafedb4899327b Mon Sep 17 00:00:00 2001 +From: Julian Anastasov +Date: Tue, 22 Nov 2022 18:46:00 +0200 +Subject: [PATCH] ipvs: use common functions for stats allocation +Git-commit: de39afb3d811ba2c028de8662adafedb4899327b +Patch-mainline: v6.2-rc1 +References: bsc#1207361 + +Move alloc_percpu/free_percpu logic in new functions + +Signed-off-by: Julian Anastasov +Cc: yunhong-cgl jiang +Cc: "dust.li" +Reviewed-by: Jiri Wiesner +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Jiri Wiesner +--- + include/net/ip_vs.h | 5 ++ + net/netfilter/ipvs/ip_vs_ctl.c | 96 +++++++++++++++++++--------------- + 2 files changed, 60 insertions(+), 41 deletions(-) + +diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h +index bd8ae137e43b..e5582c01a4a3 100644 +--- a/include/net/ip_vs.h ++++ b/include/net/ip_vs.h +@@ -410,6 +410,11 @@ struct ip_vs_stats_rcu { + struct rcu_head rcu_head; + }; + ++int ip_vs_stats_init_alloc(struct ip_vs_stats *s); ++struct ip_vs_stats *ip_vs_stats_alloc(void); ++void ip_vs_stats_release(struct ip_vs_stats *stats); ++void ip_vs_stats_free(struct ip_vs_stats *stats); ++ + struct dst_entry; + struct iphdr; + struct ip_vs_conn; +diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c +index 9016b641ae52..ec6db864ac36 100644 +--- a/net/netfilter/ipvs/ip_vs_ctl.c ++++ b/net/netfilter/ipvs/ip_vs_ctl.c +@@ -471,7 +471,7 @@ __ip_vs_bind_svc(struct ip_vs_dest *dest, struct ip_vs_service *svc) + + static void ip_vs_service_free(struct ip_vs_service *svc) + { +- free_percpu(svc->stats.cpustats); ++ ip_vs_stats_release(&svc->stats); + kfree(svc); + } + +@@ -782,7 +782,7 @@ static void ip_vs_dest_rcu_free(struct rcu_head *head) + struct ip_vs_dest *dest; + + dest = container_of(head, struct ip_vs_dest, rcu_head); +- free_percpu(dest->stats.cpustats); ++ ip_vs_stats_release(&dest->stats); + ip_vs_dest_put_and_free(dest); + } + +@@ -822,7 +822,7 @@ static void ip_vs_stats_rcu_free(struct rcu_head *head) + struct ip_vs_stats_rcu, + rcu_head); + +- free_percpu(rs->s.cpustats); ++ ip_vs_stats_release(&rs->s); + kfree(rs); + } + +@@ -879,6 +879,47 @@ ip_vs_zero_stats(struct ip_vs_stats *stats) + spin_unlock_bh(&stats->lock); + } + ++/* Allocate fields after kzalloc */ ++int ip_vs_stats_init_alloc(struct ip_vs_stats *s) ++{ ++ int i; ++ ++ spin_lock_init(&s->lock); ++ s->cpustats = alloc_percpu(struct ip_vs_cpu_stats); ++ if (!s->cpustats) ++ return -ENOMEM; ++ ++ for_each_possible_cpu(i) { ++ struct ip_vs_cpu_stats *cs = per_cpu_ptr(s->cpustats, i); ++ ++ u64_stats_init(&cs->syncp); ++ } ++ return 0; ++} ++ ++struct ip_vs_stats *ip_vs_stats_alloc(void) ++{ ++ struct ip_vs_stats *s = kzalloc(sizeof(*s), GFP_KERNEL); ++ ++ if (s && ip_vs_stats_init_alloc(s) >= 0) ++ return s; ++ kfree(s); ++ return NULL; ++} ++ ++void ip_vs_stats_release(struct ip_vs_stats *stats) ++{ ++ free_percpu(stats->cpustats); ++} ++ ++void ip_vs_stats_free(struct ip_vs_stats *stats) ++{ ++ if (stats) { ++ ip_vs_stats_release(stats); ++ kfree(stats); ++ } ++} ++ + /* + * Update a destination in the given service + */ +@@ -978,14 +1019,13 @@ static int + ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest) + { + struct ip_vs_dest *dest; +- unsigned int atype, i; ++ unsigned int atype; ++ int ret; + + EnterFunction(2); + + #ifdef CONFIG_IP_VS_IPV6 + if (udest->af == AF_INET6) { +- int ret; +- + atype = ipv6_addr_type(&udest->addr.in6); + if ((!(atype & IPV6_ADDR_UNICAST) || + atype & IPV6_ADDR_LINKLOCAL) && +@@ -1007,16 +1047,10 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest) + if (dest == NULL) + return -ENOMEM; + +- dest->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats); +- if (!dest->stats.cpustats) ++ ret = ip_vs_stats_init_alloc(&dest->stats); ++ if (ret < 0) + goto err_alloc; + +- for_each_possible_cpu(i) { +- struct ip_vs_cpu_stats *ip_vs_dest_stats; +- ip_vs_dest_stats = per_cpu_ptr(dest->stats.cpustats, i); +- u64_stats_init(&ip_vs_dest_stats->syncp); +- } +- + dest->af = udest->af; + dest->protocol = svc->protocol; + dest->vaddr = svc->addr; +@@ -1032,7 +1066,6 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest) + + INIT_HLIST_NODE(&dest->d_list); + spin_lock_init(&dest->dst_lock); +- spin_lock_init(&dest->stats.lock); + __ip_vs_update_dest(svc, dest, udest, 1); + + LeaveFunction(2); +@@ -1040,7 +1073,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest) + + err_alloc: + kfree(dest); +- return -ENOMEM; ++ return ret; + } + + +@@ -1299,7 +1332,7 @@ static int + ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u, + struct ip_vs_service **svc_p) + { +- int ret = 0, i; ++ int ret = 0; + struct ip_vs_scheduler *sched = NULL; + struct ip_vs_pe *pe = NULL; + struct ip_vs_service *svc = NULL; +@@ -1359,18 +1392,9 @@ ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u, + ret = -ENOMEM; + goto out_err; + } +- svc->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats); +- if (!svc->stats.cpustats) { +- ret = -ENOMEM; ++ ret = ip_vs_stats_init_alloc(&svc->stats); ++ if (ret < 0) + goto out_err; +- } +- +- for_each_possible_cpu(i) { +- struct ip_vs_cpu_stats *ip_vs_stats; +- ip_vs_stats = per_cpu_ptr(svc->stats.cpustats, i); +- u64_stats_init(&ip_vs_stats->syncp); +- } +- + + /* I'm the first user of the service */ + atomic_set(&svc->refcnt, 0); +@@ -1387,7 +1411,6 @@ ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u, + + INIT_LIST_HEAD(&svc->destinations); + spin_lock_init(&svc->sched_lock); +- spin_lock_init(&svc->stats.lock); + + /* Bind the scheduler */ + if (sched) { +@@ -4166,7 +4189,7 @@ static struct notifier_block ip_vs_dst_notifier = { + + int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs) + { +- int i, idx; ++ int idx; + + /* Initialize rs_table */ + for (idx = 0; idx < IP_VS_RTAB_SIZE; idx++) +@@ -4183,18 +4206,9 @@ int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs) + ipvs->tot_stats = kzalloc(sizeof(*ipvs->tot_stats), GFP_KERNEL); + if (!ipvs->tot_stats) + return -ENOMEM; +- ipvs->tot_stats->s.cpustats = alloc_percpu(struct ip_vs_cpu_stats); +- if (!ipvs->tot_stats->s.cpustats) ++ if (ip_vs_stats_init_alloc(&ipvs->tot_stats->s) < 0) + goto err_tot_stats; + +- for_each_possible_cpu(i) { +- struct ip_vs_cpu_stats *ipvs_tot_stats; +- ipvs_tot_stats = per_cpu_ptr(ipvs->tot_stats->s.cpustats, i); +- u64_stats_init(&ipvs_tot_stats->syncp); +- } +- +- spin_lock_init(&ipvs->tot_stats->s.lock); +- + #ifdef CONFIG_PROC_FS + if (!proc_create_net("ip_vs", 0, ipvs->net->proc_net, + &ip_vs_info_seq_ops, sizeof(struct ip_vs_iter))) +@@ -4225,7 +4239,7 @@ int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs) + + err_vs: + #endif +- free_percpu(ipvs->tot_stats->s.cpustats); ++ ip_vs_stats_release(&ipvs->tot_stats->s); + + err_tot_stats: + kfree(ipvs->tot_stats); +-- +2.35.3 + diff --git a/patches.suse/ipvs-use-explicitly-signed-chars.patch b/patches.suse/ipvs-use-explicitly-signed-chars.patch new file mode 100644 index 0000000..8ac1e30 --- /dev/null +++ b/patches.suse/ipvs-use-explicitly-signed-chars.patch @@ -0,0 +1,40 @@ +From 5c26159c97b324dc5174a5713eafb8c855cf8106 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Wed, 26 Oct 2022 14:32:16 +0200 +Subject: [PATCH] ipvs: use explicitly signed chars +Git-commit: 5c26159c97b324dc5174a5713eafb8c855cf8106 +Patch-mainline: v6.1-rc4 +References: bsc#1207361 + +The `char` type with no explicit sign is sometimes signed and sometimes +unsigned. This code will break on platforms such as arm, where char is +unsigned. So mark it here as explicitly signed, so that the +todrop_counter decrement and subsequent comparison is correct. + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Signed-off-by: Jason A. Donenfeld +Acked-by: Julian Anastasov +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Jiri Wiesner +--- + net/netfilter/ipvs/ip_vs_conn.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c +index 8c04bb57dd6f..7c4866c04343 100644 +--- a/net/netfilter/ipvs/ip_vs_conn.c ++++ b/net/netfilter/ipvs/ip_vs_conn.c +@@ -1265,8 +1265,8 @@ static inline int todrop_entry(struct ip_vs_conn *cp) + * The drop rate array needs tuning for real environments. + * Called from timer bh only => no locking + */ +- static const char todrop_rate[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; +- static char todrop_counter[9] = {0}; ++ static const signed char todrop_rate[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; ++ static signed char todrop_counter[9] = {0}; + int i; + + /* if the conn entry hasn't lasted for 60 seconds, don't drop it. +-- +2.35.3 + diff --git a/patches.suse/ipvs-use-kthreads-for-stats-estimation.patch b/patches.suse/ipvs-use-kthreads-for-stats-estimation.patch new file mode 100644 index 0000000..83f4ad7 --- /dev/null +++ b/patches.suse/ipvs-use-kthreads-for-stats-estimation.patch @@ -0,0 +1,1451 @@ +From 705dd34440812735ece298eb5bc153fde9544d42 Mon Sep 17 00:00:00 2001 +From: Julian Anastasov +Date: Tue, 22 Nov 2022 18:46:02 +0200 +Subject: [PATCH] ipvs: use kthreads for stats estimation +Git-commit: 705dd34440812735ece298eb5bc153fde9544d42 +Patch-mainline: v6.2-rc1 +References: bsc#1207361 + +Estimating all entries in single list in timer context +by single CPU causes large latency with multiple IPVS rules +as reported in [1], [2], [3]. + +Spread the estimator structures in multiple chains and +use kthread(s) for the estimation. The chains are processed +in multiple (50) timer ticks to ensure the 2-second interval +between estimations with some accuracy. Every chain is +processed under RCU lock. + +Every kthread works over its own data structure and all +such contexts are attached to array. The contexts can be +preserved while the kthread tasks are stopped or restarted. +When estimators are removed, unused kthread contexts are +released and the slots in array are left empty. + +First kthread determines parameters to use, eg. maximum +number of estimators to process per kthread based on +chain's length (chain_max), allowing sub-100us cond_resched +rate and estimation taking up to 1/8 of the CPU capacity +to avoid any problems if chain_max is not correctly +calculated. + +chain_max is calculated taking into account factors +such as CPU speed and memory/cache speed where the +cache_factor (4) is selected from real tests with +current generation of CPU/NUMA configurations to +correct the difference in CPU usage between +cached (during calc phase) and non-cached (working) state +of the estimated per-cpu data. + +First kthread also plays the role of distributor of +added estimators to all kthreads, keeping low the +time to add estimators. The optimization is based on +the fact that newly added estimator should be estimated +after 2 seconds, so we have the time to offload the +adding to chain from controlling process to kthread 0. + +The allocated kthread context may grow from 1 to 50 +allocated structures for timer ticks which saves memory for +setups with small number of estimators. + +We also add delayed work est_reload_work that will +make sure the kthread tasks are properly started/stopped. + +ip_vs_start_estimator() is changed to report errors +which allows to safely store the estimators in +allocated structures. + +Many thanks to Jiri Wiesner for his valuable comments +and for spending a lot of time reviewing and testing +the changes on different platforms with 48-256 CPUs and +1-8 NUMA nodes under different cpufreq governors. + +[1] Report from Yunhong Jiang: +https://lore.kernel.org/netdev/D25792C1-1B89-45DE-9F10-EC350DC04ADC@gmail.com/ +[2] +https://marc.info/?l=linux-virtual-server&m=159679809118027&w=2 +[3] Report from Dust: +https://archive.linuxvirtualserver.org/html/lvs-devel/2020-12/msg00000.html + +Signed-off-by: Julian Anastasov +Cc: yunhong-cgl jiang +Cc: "dust.li" +Reviewed-by: Jiri Wiesner +Tested-by: Jiri Wiesner +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Jiri Wiesner +--- + include/net/ip_vs.h | 88 +++- + net/netfilter/ipvs/ip_vs_ctl.c | 126 ++++- + net/netfilter/ipvs/ip_vs_est.c | 876 ++++++++++++++++++++++++++++++--- + 3 files changed, 990 insertions(+), 100 deletions(-) + +diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h +index a4d44138c2a8..04960dc6228f 100644 +--- a/include/net/ip_vs.h ++++ b/include/net/ip_vs.h +@@ -42,6 +42,8 @@ static inline struct netns_ipvs *net_ipvs(struct net* net) + /* Connections' size value needed by ip_vs_ctl.c */ + extern int ip_vs_conn_tab_size; + ++extern struct mutex __ip_vs_mutex; ++ + struct ip_vs_iphdr { + int hdr_flags; /* ipvs flags */ + __u32 off; /* Where IP or IPv4 header starts */ +@@ -365,7 +367,7 @@ struct ip_vs_cpu_stats { + + /* IPVS statistics objects */ + struct ip_vs_estimator { +- struct list_head list; ++ struct hlist_node list; + + u64 last_inbytes; + u64 last_outbytes; +@@ -378,6 +380,10 @@ struct ip_vs_estimator { + u64 outpps; + u64 inbps; + u64 outbps; ++ ++ s32 ktid:16, /* kthread ID, -1=temp list */ ++ ktrow:8, /* row/tick ID for kthread */ ++ ktcid:8; /* chain ID for kthread tick */ + }; + + /* +@@ -415,6 +421,66 @@ struct ip_vs_stats *ip_vs_stats_alloc(void); + void ip_vs_stats_release(struct ip_vs_stats *stats); + void ip_vs_stats_free(struct ip_vs_stats *stats); + ++/* Process estimators in multiple timer ticks (20/50/100, see ktrow) */ ++#define IPVS_EST_NTICKS 50 ++/* Estimation uses a 2-second period containing ticks (in jiffies) */ ++#define IPVS_EST_TICK ((2 * HZ) / IPVS_EST_NTICKS) ++ ++/* Limit of CPU load per kthread (8 for 12.5%), ratio of CPU capacity (1/C). ++ * Value of 4 and above ensures kthreads will take work without exceeding ++ * the CPU capacity under different circumstances. ++ */ ++#define IPVS_EST_LOAD_DIVISOR 8 ++ ++/* Kthreads should not have work that exceeds the CPU load above 50% */ ++#define IPVS_EST_CPU_KTHREADS (IPVS_EST_LOAD_DIVISOR / 2) ++ ++/* Desired number of chains per timer tick (chain load factor in 100us units), ++ * 48=4.8ms of 40ms tick (12% CPU usage): ++ * 2 sec * 1000 ms in sec * 10 (100us in ms) / 8 (12.5%) / 50 ++ */ ++#define IPVS_EST_CHAIN_FACTOR \ ++ ALIGN_DOWN(2 * 1000 * 10 / IPVS_EST_LOAD_DIVISOR / IPVS_EST_NTICKS, 8) ++ ++/* Compiled number of chains per tick ++ * The defines should match cond_resched_rcu ++ */ ++#if defined(CONFIG_DEBUG_ATOMIC_SLEEP) || !defined(CONFIG_PREEMPT_RCU) ++#define IPVS_EST_TICK_CHAINS IPVS_EST_CHAIN_FACTOR ++#else ++#define IPVS_EST_TICK_CHAINS 1 ++#endif ++ ++#if IPVS_EST_NTICKS > 127 ++#error Too many timer ticks for ktrow ++#endif ++ ++/* Multiple chains processed in same tick */ ++struct ip_vs_est_tick_data { ++ struct hlist_head chains[IPVS_EST_TICK_CHAINS]; ++ DECLARE_BITMAP(present, IPVS_EST_TICK_CHAINS); ++ DECLARE_BITMAP(full, IPVS_EST_TICK_CHAINS); ++ int chain_len[IPVS_EST_TICK_CHAINS]; ++}; ++ ++/* Context for estimation kthread */ ++struct ip_vs_est_kt_data { ++ struct netns_ipvs *ipvs; ++ struct task_struct *task; /* task if running */ ++ struct ip_vs_est_tick_data __rcu *ticks[IPVS_EST_NTICKS]; ++ DECLARE_BITMAP(avail, IPVS_EST_NTICKS); /* tick has space for ests */ ++ unsigned long est_timer; /* estimation timer (jiffies) */ ++ struct ip_vs_stats *calc_stats; /* Used for calculation */ ++ int tick_len[IPVS_EST_NTICKS]; /* est count */ ++ int id; /* ktid per netns */ ++ int chain_max; /* max ests per tick chain */ ++ int tick_max; /* max ests per tick */ ++ int est_count; /* attached ests to kthread */ ++ int est_max_count; /* max ests per kthread */ ++ int add_row; /* row for new ests */ ++ int est_row; /* estimated row */ ++}; ++ + struct dst_entry; + struct iphdr; + struct ip_vs_conn; +@@ -953,9 +1019,17 @@ struct netns_ipvs { + struct ctl_table_header *lblcr_ctl_header; + struct ctl_table *lblcr_ctl_table; + /* ip_vs_est */ +- struct list_head est_list; /* estimator list */ +- spinlock_t est_lock; +- struct timer_list est_timer; /* Estimation timer */ ++ struct delayed_work est_reload_work;/* Reload kthread tasks */ ++ struct mutex est_mutex; /* protect kthread tasks */ ++ struct hlist_head est_temp_list; /* Ests during calc phase */ ++ struct ip_vs_est_kt_data **est_kt_arr; /* Array of kthread data ptrs */ ++ unsigned long est_max_threads;/* Hard limit of kthreads */ ++ int est_calc_phase; /* Calculation phase */ ++ int est_chain_max; /* Calculated chain_max */ ++ int est_kt_count; /* Allocated ptrs */ ++ int est_add_ktid; /* ktid where to add ests */ ++ atomic_t est_genid; /* kthreads reload genid */ ++ atomic_t est_genid_done; /* applied genid */ + /* ip_vs_sync */ + spinlock_t sync_lock; + struct ipvs_master_sync_state *ms; +@@ -1486,10 +1560,14 @@ int stop_sync_thread(struct netns_ipvs *ipvs, int state); + void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts); + + /* IPVS rate estimator prototypes (from ip_vs_est.c) */ +-void ip_vs_start_estimator(struct netns_ipvs *ipvs, struct ip_vs_stats *stats); ++int ip_vs_start_estimator(struct netns_ipvs *ipvs, struct ip_vs_stats *stats); + void ip_vs_stop_estimator(struct netns_ipvs *ipvs, struct ip_vs_stats *stats); + void ip_vs_zero_estimator(struct ip_vs_stats *stats); + void ip_vs_read_estimator(struct ip_vs_kstats *dst, struct ip_vs_stats *stats); ++void ip_vs_est_reload_start(struct netns_ipvs *ipvs); ++int ip_vs_est_kthread_start(struct netns_ipvs *ipvs, ++ struct ip_vs_est_kt_data *kd); ++void ip_vs_est_kthread_stop(struct ip_vs_est_kt_data *kd); + + /* Various IPVS packet transmitters (from ip_vs_xmit.c) */ + int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, +diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c +index 5f9cc2e7ba71..c41a5392edc9 100644 +--- a/net/netfilter/ipvs/ip_vs_ctl.c ++++ b/net/netfilter/ipvs/ip_vs_ctl.c +@@ -49,8 +49,7 @@ + + MODULE_ALIAS_GENL_FAMILY(IPVS_GENL_NAME); + +-/* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */ +-static DEFINE_MUTEX(__ip_vs_mutex); ++DEFINE_MUTEX(__ip_vs_mutex); /* Serialize configuration with sockopt/netlink */ + + /* sysctl variables */ + +@@ -241,6 +240,47 @@ static void defense_work_handler(struct work_struct *work) + } + #endif + ++static void est_reload_work_handler(struct work_struct *work) ++{ ++ struct netns_ipvs *ipvs = ++ container_of(work, struct netns_ipvs, est_reload_work.work); ++ int genid_done = atomic_read(&ipvs->est_genid_done); ++ unsigned long delay = HZ / 10; /* repeat startups after failure */ ++ bool repeat = false; ++ int genid; ++ int id; ++ ++ mutex_lock(&ipvs->est_mutex); ++ genid = atomic_read(&ipvs->est_genid); ++ for (id = 0; id < ipvs->est_kt_count; id++) { ++ struct ip_vs_est_kt_data *kd = ipvs->est_kt_arr[id]; ++ ++ /* netns clean up started, abort delayed work */ ++ if (!ipvs->enable) ++ goto unlock; ++ if (!kd) ++ continue; ++ /* New config ? Stop kthread tasks */ ++ if (genid != genid_done) ++ ip_vs_est_kthread_stop(kd); ++ if (!kd->task) { ++ /* Do not start kthreads above 0 in calc phase */ ++ if ((!id || !ipvs->est_calc_phase) && ++ ip_vs_est_kthread_start(ipvs, kd) < 0) ++ repeat = true; ++ } ++ } ++ ++ atomic_set(&ipvs->est_genid_done, genid); ++ ++ if (repeat) ++ queue_delayed_work(system_long_wq, &ipvs->est_reload_work, ++ delay); ++ ++unlock: ++ mutex_unlock(&ipvs->est_mutex); ++} ++ + int + ip_vs_use_count_inc(void) + { +@@ -831,7 +871,7 @@ ip_vs_copy_stats(struct ip_vs_kstats *dst, struct ip_vs_stats *src) + { + #define IP_VS_SHOW_STATS_COUNTER(c) dst->c = src->kstats.c - src->kstats0.c + +- spin_lock_bh(&src->lock); ++ spin_lock(&src->lock); + + IP_VS_SHOW_STATS_COUNTER(conns); + IP_VS_SHOW_STATS_COUNTER(inpkts); +@@ -841,7 +881,7 @@ ip_vs_copy_stats(struct ip_vs_kstats *dst, struct ip_vs_stats *src) + + ip_vs_read_estimator(dst, src); + +- spin_unlock_bh(&src->lock); ++ spin_unlock(&src->lock); + } + + static void +@@ -862,7 +902,7 @@ ip_vs_export_stats_user(struct ip_vs_stats_user *dst, struct ip_vs_kstats *src) + static void + ip_vs_zero_stats(struct ip_vs_stats *stats) + { +- spin_lock_bh(&stats->lock); ++ spin_lock(&stats->lock); + + /* get current counters as zero point, rates are zeroed */ + +@@ -876,7 +916,7 @@ ip_vs_zero_stats(struct ip_vs_stats *stats) + + ip_vs_zero_estimator(stats); + +- spin_unlock_bh(&stats->lock); ++ spin_unlock(&stats->lock); + } + + /* Allocate fields after kzalloc */ +@@ -998,7 +1038,6 @@ __ip_vs_update_dest(struct ip_vs_service *svc, struct ip_vs_dest *dest, + spin_unlock_bh(&dest->dst_lock); + + if (add) { +- ip_vs_start_estimator(svc->ipvs, &dest->stats); + list_add_rcu(&dest->n_list, &svc->destinations); + svc->num_dests++; + sched = rcu_dereference_protected(svc->scheduler, 1); +@@ -1051,6 +1090,10 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest) + if (ret < 0) + goto err_alloc; + ++ ret = ip_vs_start_estimator(svc->ipvs, &dest->stats); ++ if (ret < 0) ++ goto err_stats; ++ + dest->af = udest->af; + dest->protocol = svc->protocol; + dest->vaddr = svc->addr; +@@ -1071,6 +1114,9 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest) + LeaveFunction(2); + return 0; + ++err_stats: ++ ip_vs_stats_release(&dest->stats); ++ + err_alloc: + kfree(dest); + return ret; +@@ -1135,14 +1181,18 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest) + IP_VS_DBG_ADDR(svc->af, &dest->vaddr), + ntohs(dest->vport)); + ++ ret = ip_vs_start_estimator(svc->ipvs, &dest->stats); ++ if (ret < 0) ++ goto err; + __ip_vs_update_dest(svc, dest, udest, 1); +- ret = 0; + } else { + /* + * Allocate and initialize the dest structure + */ + ret = ip_vs_new_dest(svc, udest); + } ++ ++err: + LeaveFunction(2); + + return ret; +@@ -1420,6 +1470,10 @@ ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u, + sched = NULL; + } + ++ ret = ip_vs_start_estimator(ipvs, &svc->stats); ++ if (ret < 0) ++ goto out_err; ++ + /* Bind the ct retriever */ + RCU_INIT_POINTER(svc->pe, pe); + pe = NULL; +@@ -1432,8 +1486,6 @@ ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u, + if (svc->pe && svc->pe->conn_out) + atomic_inc(&ipvs->conn_out_counter); + +- ip_vs_start_estimator(ipvs, &svc->stats); +- + /* Count only IPv4 services for old get/setsockopt interface */ + if (svc->af == AF_INET) + ipvs->num_services++; +@@ -1444,8 +1496,15 @@ ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u, + ip_vs_svc_hash(svc); + + *svc_p = svc; +- /* Now there is a service - full throttle */ +- ipvs->enable = 1; ++ ++ if (!ipvs->enable) { ++ /* Now there is a service - full throttle */ ++ ipvs->enable = 1; ++ ++ /* Start estimation for first time */ ++ ip_vs_est_reload_start(ipvs); ++ } ++ + return 0; + + +@@ -4065,13 +4124,16 @@ static void ip_vs_genl_unregister(void) + static int __net_init ip_vs_control_net_init_sysctl(struct netns_ipvs *ipvs) + { + struct net *net = ipvs->net; +- int idx; + struct ctl_table *tbl; ++ int idx, ret; + + atomic_set(&ipvs->dropentry, 0); + spin_lock_init(&ipvs->dropentry_lock); + spin_lock_init(&ipvs->droppacket_lock); + spin_lock_init(&ipvs->securetcp_lock); ++ INIT_DELAYED_WORK(&ipvs->defense_work, defense_work_handler); ++ INIT_DELAYED_WORK(&ipvs->expire_nodest_conn_work, ++ expire_nodest_conn_handler); + + if (!net_eq(net, &init_net)) { + tbl = kmemdup(vs_vars, sizeof(vs_vars), GFP_KERNEL); +@@ -4139,24 +4201,27 @@ static int __net_init ip_vs_control_net_init_sysctl(struct netns_ipvs *ipvs) + tbl[idx++].mode = 0444; + #endif + ++ ret = -ENOMEM; + ipvs->sysctl_hdr = register_net_sysctl(net, "net/ipv4/vs", tbl); +- if (ipvs->sysctl_hdr == NULL) { +- if (!net_eq(net, &init_net)) +- kfree(tbl); +- return -ENOMEM; +- } ++ if (!ipvs->sysctl_hdr) ++ goto err; + ipvs->sysctl_tbl = tbl; ++ ++ ret = ip_vs_start_estimator(ipvs, &ipvs->tot_stats->s); ++ if (ret < 0) ++ goto err; ++ + /* Schedule defense work */ +- INIT_DELAYED_WORK(&ipvs->defense_work, defense_work_handler); + queue_delayed_work(system_long_wq, &ipvs->defense_work, + DEFENSE_TIMER_PERIOD); + +- /* Init delayed work for expiring no dest conn */ +- INIT_DELAYED_WORK(&ipvs->expire_nodest_conn_work, +- expire_nodest_conn_handler); +- +- ip_vs_start_estimator(ipvs, &ipvs->tot_stats->s); + return 0; ++ ++err: ++ unregister_net_sysctl_table(ipvs->sysctl_hdr); ++ if (!net_eq(net, &init_net)) ++ kfree(tbl); ++ return ret; + } + + static void __net_exit ip_vs_control_net_cleanup_sysctl(struct netns_ipvs *ipvs) +@@ -4189,6 +4254,7 @@ static struct notifier_block ip_vs_dst_notifier = { + + int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs) + { ++ int ret = -ENOMEM; + int idx; + + /* Initialize rs_table */ +@@ -4202,10 +4268,12 @@ int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs) + atomic_set(&ipvs->nullsvc_counter, 0); + atomic_set(&ipvs->conn_out_counter, 0); + ++ INIT_DELAYED_WORK(&ipvs->est_reload_work, est_reload_work_handler); ++ + /* procfs stats */ + ipvs->tot_stats = kzalloc(sizeof(*ipvs->tot_stats), GFP_KERNEL); + if (!ipvs->tot_stats) +- return -ENOMEM; ++ goto out; + if (ip_vs_stats_init_alloc(&ipvs->tot_stats->s) < 0) + goto err_tot_stats; + +@@ -4222,7 +4290,8 @@ int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs) + goto err_percpu; + #endif + +- if (ip_vs_control_net_init_sysctl(ipvs)) ++ ret = ip_vs_control_net_init_sysctl(ipvs); ++ if (ret < 0) + goto err; + + return 0; +@@ -4243,13 +4312,16 @@ int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs) + + err_tot_stats: + kfree(ipvs->tot_stats); +- return -ENOMEM; ++ ++out: ++ return ret; + } + + void __net_exit ip_vs_control_net_cleanup(struct netns_ipvs *ipvs) + { + ip_vs_trash_cleanup(ipvs); + ip_vs_control_net_cleanup_sysctl(ipvs); ++ cancel_delayed_work_sync(&ipvs->est_reload_work); + #ifdef CONFIG_PROC_FS + remove_proc_entry("ip_vs_stats_percpu", ipvs->net->proc_net); + remove_proc_entry("ip_vs_stats", ipvs->net->proc_net); +diff --git a/net/netfilter/ipvs/ip_vs_est.c b/net/netfilter/ipvs/ip_vs_est.c +index f53150d82a92..2fb6c097437c 100644 +--- a/net/netfilter/ipvs/ip_vs_est.c ++++ b/net/netfilter/ipvs/ip_vs_est.c +@@ -30,9 +30,6 @@ + long interval, it is easy to implement a user level daemon which + periodically reads those statistical counters and measure rate. + +- Currently, the measurement is activated by slow timer handler. Hope +- this measurement will not introduce too much load. +- + We measure rate during the last 8 seconds every 2 seconds: + + avgrate = avgrate*(1-W) + rate*W +@@ -47,68 +44,76 @@ + to 32-bit values for conns, packets, bps, cps and pps. + + * A lot of code is taken from net/core/gen_estimator.c +- */ +- + +-/* +- * Make a summary from each cpu ++ KEY POINTS: ++ - cpustats counters are updated per-cpu in SoftIRQ context with BH disabled ++ - kthreads read the cpustats to update the estimators (svcs, dests, total) ++ - the states of estimators can be read (get stats) or modified (zero stats) ++ from processes ++ ++ KTHREADS: ++ - estimators are added initially to est_temp_list and later kthread 0 ++ distributes them to one or many kthreads for estimation ++ - kthread contexts are created and attached to array ++ - the kthread tasks are started when first service is added, before that ++ the total stats are not estimated ++ - the kthread context holds lists with estimators (chains) which are ++ processed every 2 seconds ++ - as estimators can be added dynamically and in bursts, we try to spread ++ them to multiple chains which are estimated at different time ++ - on start, kthread 0 enters calculation phase to determine the chain limits ++ and the limit of estimators per kthread ++ - est_add_ktid: ktid where to add new ests, can point to empty slot where ++ we should add kt data + */ +-static void ip_vs_read_cpu_stats(struct ip_vs_kstats *sum, +- struct ip_vs_cpu_stats __percpu *stats) +-{ +- int i; +- bool add = false; +- +- for_each_possible_cpu(i) { +- struct ip_vs_cpu_stats *s = per_cpu_ptr(stats, i); +- unsigned int start; +- u64 conns, inpkts, outpkts, inbytes, outbytes; + +- if (add) { +- do { +- start = u64_stats_fetch_begin(&s->syncp); +- conns = u64_stats_read(&s->cnt.conns); +- inpkts = u64_stats_read(&s->cnt.inpkts); +- outpkts = u64_stats_read(&s->cnt.outpkts); +- inbytes = u64_stats_read(&s->cnt.inbytes); +- outbytes = u64_stats_read(&s->cnt.outbytes); +- } while (u64_stats_fetch_retry(&s->syncp, start)); +- sum->conns += conns; +- sum->inpkts += inpkts; +- sum->outpkts += outpkts; +- sum->inbytes += inbytes; +- sum->outbytes += outbytes; +- } else { +- add = true; +- do { +- start = u64_stats_fetch_begin(&s->syncp); +- sum->conns = u64_stats_read(&s->cnt.conns); +- sum->inpkts = u64_stats_read(&s->cnt.inpkts); +- sum->outpkts = u64_stats_read(&s->cnt.outpkts); +- sum->inbytes = u64_stats_read(&s->cnt.inbytes); +- sum->outbytes = u64_stats_read(&s->cnt.outbytes); +- } while (u64_stats_fetch_retry(&s->syncp, start)); +- } +- } +-} ++static struct lock_class_key __ipvs_est_key; + ++static void ip_vs_est_calc_phase(struct netns_ipvs *ipvs); ++static void ip_vs_est_drain_temp_list(struct netns_ipvs *ipvs); + +-static void estimation_timer(struct timer_list *t) ++static void ip_vs_chain_estimation(struct hlist_head *chain) + { + struct ip_vs_estimator *e; ++ struct ip_vs_cpu_stats *c; + struct ip_vs_stats *s; + u64 rate; +- struct netns_ipvs *ipvs = from_timer(ipvs, t, est_timer); + +- if (!sysctl_run_estimation(ipvs)) +- goto skip; ++ hlist_for_each_entry_rcu(e, chain, list) { ++ u64 conns, inpkts, outpkts, inbytes, outbytes; ++ u64 kconns = 0, kinpkts = 0, koutpkts = 0; ++ u64 kinbytes = 0, koutbytes = 0; ++ unsigned int start; ++ int i; ++ ++ if (kthread_should_stop()) ++ break; + +- spin_lock(&ipvs->est_lock); +- list_for_each_entry(e, &ipvs->est_list, list) { + s = container_of(e, struct ip_vs_stats, est); ++ for_each_possible_cpu(i) { ++ c = per_cpu_ptr(s->cpustats, i); ++ do { ++ start = u64_stats_fetch_begin(&c->syncp); ++ conns = u64_stats_read(&c->cnt.conns); ++ inpkts = u64_stats_read(&c->cnt.inpkts); ++ outpkts = u64_stats_read(&c->cnt.outpkts); ++ inbytes = u64_stats_read(&c->cnt.inbytes); ++ outbytes = u64_stats_read(&c->cnt.outbytes); ++ } while (u64_stats_fetch_retry(&c->syncp, start)); ++ kconns += conns; ++ kinpkts += inpkts; ++ koutpkts += outpkts; ++ kinbytes += inbytes; ++ koutbytes += outbytes; ++ } + + spin_lock(&s->lock); +- ip_vs_read_cpu_stats(&s->kstats, s->cpustats); ++ ++ s->kstats.conns = kconns; ++ s->kstats.inpkts = kinpkts; ++ s->kstats.outpkts = koutpkts; ++ s->kstats.inbytes = kinbytes; ++ s->kstats.outbytes = koutbytes; + + /* scaled by 2^10, but divided 2 seconds */ + rate = (s->kstats.conns - e->last_conns) << 9; +@@ -133,30 +138,754 @@ static void estimation_timer(struct timer_list *t) + e->outbps += ((s64)rate - (s64)e->outbps) >> 2; + spin_unlock(&s->lock); + } +- spin_unlock(&ipvs->est_lock); ++} + +-skip: +- mod_timer(&ipvs->est_timer, jiffies + 2*HZ); ++static void ip_vs_tick_estimation(struct ip_vs_est_kt_data *kd, int row) ++{ ++ struct ip_vs_est_tick_data *td; ++ int cid; ++ ++ rcu_read_lock(); ++ td = rcu_dereference(kd->ticks[row]); ++ if (!td) ++ goto out; ++ for_each_set_bit(cid, td->present, IPVS_EST_TICK_CHAINS) { ++ if (kthread_should_stop()) ++ break; ++ ip_vs_chain_estimation(&td->chains[cid]); ++ cond_resched_rcu(); ++ td = rcu_dereference(kd->ticks[row]); ++ if (!td) ++ break; ++ } ++ ++out: ++ rcu_read_unlock(); + } + +-void ip_vs_start_estimator(struct netns_ipvs *ipvs, struct ip_vs_stats *stats) ++static int ip_vs_estimation_kthread(void *data) + { +- struct ip_vs_estimator *est = &stats->est; ++ struct ip_vs_est_kt_data *kd = data; ++ struct netns_ipvs *ipvs = kd->ipvs; ++ int row = kd->est_row; ++ unsigned long now; ++ int id = kd->id; ++ long gap; ++ ++ if (id > 0) { ++ if (!ipvs->est_chain_max) ++ return 0; ++ } else { ++ if (!ipvs->est_chain_max) { ++ ipvs->est_calc_phase = 1; ++ /* commit est_calc_phase before reading est_genid */ ++ smp_mb(); ++ } ++ ++ /* kthread 0 will handle the calc phase */ ++ if (ipvs->est_calc_phase) ++ ip_vs_est_calc_phase(ipvs); ++ } ++ ++ while (1) { ++ if (!id && !hlist_empty(&ipvs->est_temp_list)) ++ ip_vs_est_drain_temp_list(ipvs); ++ set_current_state(TASK_IDLE); ++ if (kthread_should_stop()) ++ break; ++ ++ /* before estimation, check if we should sleep */ ++ now = jiffies; ++ gap = kd->est_timer - now; ++ if (gap > 0) { ++ if (gap > IPVS_EST_TICK) { ++ kd->est_timer = now - IPVS_EST_TICK; ++ gap = IPVS_EST_TICK; ++ } ++ schedule_timeout(gap); ++ } else { ++ __set_current_state(TASK_RUNNING); ++ if (gap < -8 * IPVS_EST_TICK) ++ kd->est_timer = now; ++ } ++ ++ if (sysctl_run_estimation(ipvs) && kd->tick_len[row]) ++ ip_vs_tick_estimation(kd, row); ++ ++ row++; ++ if (row >= IPVS_EST_NTICKS) ++ row = 0; ++ WRITE_ONCE(kd->est_row, row); ++ kd->est_timer += IPVS_EST_TICK; ++ } ++ __set_current_state(TASK_RUNNING); ++ ++ return 0; ++} ++ ++/* Schedule stop/start for kthread tasks */ ++void ip_vs_est_reload_start(struct netns_ipvs *ipvs) ++{ ++ /* Ignore reloads before first service is added */ ++ if (!ipvs->enable) ++ return; ++ /* Bump the kthread configuration genid */ ++ atomic_inc(&ipvs->est_genid); ++ queue_delayed_work(system_long_wq, &ipvs->est_reload_work, 0); ++} ++ ++/* Start kthread task with current configuration */ ++int ip_vs_est_kthread_start(struct netns_ipvs *ipvs, ++ struct ip_vs_est_kt_data *kd) ++{ ++ unsigned long now; ++ int ret = 0; ++ long gap; ++ ++ lockdep_assert_held(&ipvs->est_mutex); ++ ++ if (kd->task) ++ goto out; ++ now = jiffies; ++ gap = kd->est_timer - now; ++ /* Sync est_timer if task is starting later */ ++ if (abs(gap) > 4 * IPVS_EST_TICK) ++ kd->est_timer = now; ++ kd->task = kthread_create(ip_vs_estimation_kthread, kd, "ipvs-e:%d:%d", ++ ipvs->gen, kd->id); ++ if (IS_ERR(kd->task)) { ++ ret = PTR_ERR(kd->task); ++ kd->task = NULL; ++ goto out; ++ } ++ ++ pr_info("starting estimator thread %d...\n", kd->id); ++ wake_up_process(kd->task); ++ ++out: ++ return ret; ++} ++ ++void ip_vs_est_kthread_stop(struct ip_vs_est_kt_data *kd) ++{ ++ if (kd->task) { ++ pr_info("stopping estimator thread %d...\n", kd->id); ++ kthread_stop(kd->task); ++ kd->task = NULL; ++ } ++} ++ ++/* Apply parameters to kthread */ ++static void ip_vs_est_set_params(struct netns_ipvs *ipvs, ++ struct ip_vs_est_kt_data *kd) ++{ ++ kd->chain_max = ipvs->est_chain_max; ++ /* We are using single chain on RCU preemption */ ++ if (IPVS_EST_TICK_CHAINS == 1) ++ kd->chain_max *= IPVS_EST_CHAIN_FACTOR; ++ kd->tick_max = IPVS_EST_TICK_CHAINS * kd->chain_max; ++ kd->est_max_count = IPVS_EST_NTICKS * kd->tick_max; ++} ++ ++/* Create and start estimation kthread in a free or new array slot */ ++static int ip_vs_est_add_kthread(struct netns_ipvs *ipvs) ++{ ++ struct ip_vs_est_kt_data *kd = NULL; ++ int id = ipvs->est_kt_count; ++ int ret = -ENOMEM; ++ void *arr = NULL; ++ int i; ++ ++ if ((unsigned long)ipvs->est_kt_count >= ipvs->est_max_threads && ++ ipvs->enable && ipvs->est_max_threads) ++ return -EINVAL; ++ ++ mutex_lock(&ipvs->est_mutex); ++ ++ for (i = 0; i < id; i++) { ++ if (!ipvs->est_kt_arr[i]) ++ break; ++ } ++ if (i >= id) { ++ arr = krealloc_array(ipvs->est_kt_arr, id + 1, ++ sizeof(struct ip_vs_est_kt_data *), ++ GFP_KERNEL); ++ if (!arr) ++ goto out; ++ ipvs->est_kt_arr = arr; ++ } else { ++ id = i; ++ } ++ ++ kd = kzalloc(sizeof(*kd), GFP_KERNEL); ++ if (!kd) ++ goto out; ++ kd->ipvs = ipvs; ++ bitmap_fill(kd->avail, IPVS_EST_NTICKS); ++ kd->est_timer = jiffies; ++ kd->id = id; ++ ip_vs_est_set_params(ipvs, kd); ++ ++ /* Pre-allocate stats used in calc phase */ ++ if (!id && !kd->calc_stats) { ++ kd->calc_stats = ip_vs_stats_alloc(); ++ if (!kd->calc_stats) ++ goto out; ++ } ++ ++ /* Start kthread tasks only when services are present */ ++ if (ipvs->enable) { ++ ret = ip_vs_est_kthread_start(ipvs, kd); ++ if (ret < 0) ++ goto out; ++ } ++ ++ if (arr) ++ ipvs->est_kt_count++; ++ ipvs->est_kt_arr[id] = kd; ++ kd = NULL; ++ /* Use most recent kthread for new ests */ ++ ipvs->est_add_ktid = id; ++ ret = 0; ++ ++out: ++ mutex_unlock(&ipvs->est_mutex); ++ if (kd) { ++ ip_vs_stats_free(kd->calc_stats); ++ kfree(kd); ++ } ++ ++ return ret; ++} ++ ++/* Select ktid where to add new ests: available, unused or new slot */ ++static void ip_vs_est_update_ktid(struct netns_ipvs *ipvs) ++{ ++ int ktid, best = ipvs->est_kt_count; ++ struct ip_vs_est_kt_data *kd; ++ ++ for (ktid = 0; ktid < ipvs->est_kt_count; ktid++) { ++ kd = ipvs->est_kt_arr[ktid]; ++ if (kd) { ++ if (kd->est_count < kd->est_max_count) { ++ best = ktid; ++ break; ++ } ++ } else if (ktid < best) { ++ best = ktid; ++ } ++ } ++ ipvs->est_add_ktid = best; ++} ++ ++/* Add estimator to current kthread (est_add_ktid) */ ++static int ip_vs_enqueue_estimator(struct netns_ipvs *ipvs, ++ struct ip_vs_estimator *est) ++{ ++ struct ip_vs_est_kt_data *kd = NULL; ++ struct ip_vs_est_tick_data *td; ++ int ktid, row, crow, cid, ret; ++ int delay = est->ktrow; ++ ++ BUILD_BUG_ON_MSG(IPVS_EST_TICK_CHAINS > 127, ++ "Too many chains for ktcid"); ++ ++ if (ipvs->est_add_ktid < ipvs->est_kt_count) { ++ kd = ipvs->est_kt_arr[ipvs->est_add_ktid]; ++ if (kd) ++ goto add_est; ++ } ++ ++ ret = ip_vs_est_add_kthread(ipvs); ++ if (ret < 0) ++ goto out; ++ kd = ipvs->est_kt_arr[ipvs->est_add_ktid]; ++ ++add_est: ++ ktid = kd->id; ++ /* For small number of estimators prefer to use few ticks, ++ * otherwise try to add into the last estimated row. ++ * est_row and add_row point after the row we should use ++ */ ++ if (kd->est_count >= 2 * kd->tick_max || delay < IPVS_EST_NTICKS - 1) ++ crow = READ_ONCE(kd->est_row); ++ else ++ crow = kd->add_row; ++ crow += delay; ++ if (crow >= IPVS_EST_NTICKS) ++ crow -= IPVS_EST_NTICKS; ++ /* Assume initial delay ? */ ++ if (delay >= IPVS_EST_NTICKS - 1) { ++ /* Preserve initial delay or decrease it if no space in tick */ ++ row = crow; ++ if (crow < IPVS_EST_NTICKS - 1) { ++ crow++; ++ row = find_last_bit(kd->avail, crow); ++ } ++ if (row >= crow) ++ row = find_last_bit(kd->avail, IPVS_EST_NTICKS); ++ } else { ++ /* Preserve delay or increase it if no space in tick */ ++ row = IPVS_EST_NTICKS; ++ if (crow > 0) ++ row = find_next_bit(kd->avail, IPVS_EST_NTICKS, crow); ++ if (row >= IPVS_EST_NTICKS) ++ row = find_first_bit(kd->avail, IPVS_EST_NTICKS); ++ } ++ ++ td = rcu_dereference_protected(kd->ticks[row], 1); ++ if (!td) { ++ td = kzalloc(sizeof(*td), GFP_KERNEL); ++ if (!td) { ++ ret = -ENOMEM; ++ goto out; ++ } ++ rcu_assign_pointer(kd->ticks[row], td); ++ } ++ ++ cid = find_first_zero_bit(td->full, IPVS_EST_TICK_CHAINS); ++ ++ kd->est_count++; ++ kd->tick_len[row]++; ++ if (!td->chain_len[cid]) ++ __set_bit(cid, td->present); ++ td->chain_len[cid]++; ++ est->ktid = ktid; ++ est->ktrow = row; ++ est->ktcid = cid; ++ hlist_add_head_rcu(&est->list, &td->chains[cid]); ++ ++ if (td->chain_len[cid] >= kd->chain_max) { ++ __set_bit(cid, td->full); ++ if (kd->tick_len[row] >= kd->tick_max) ++ __clear_bit(row, kd->avail); ++ } ++ ++ /* Update est_add_ktid to point to first available/empty kt slot */ ++ if (kd->est_count == kd->est_max_count) ++ ip_vs_est_update_ktid(ipvs); ++ ++ ret = 0; ++ ++out: ++ return ret; ++} + +- INIT_LIST_HEAD(&est->list); ++/* Start estimation for stats */ ++int ip_vs_start_estimator(struct netns_ipvs *ipvs, struct ip_vs_stats *stats) ++{ ++ struct ip_vs_estimator *est = &stats->est; ++ int ret; ++ ++ if (!ipvs->est_max_threads && ipvs->enable) ++ ipvs->est_max_threads = IPVS_EST_CPU_KTHREADS * ++ num_possible_cpus(); ++ ++ est->ktid = -1; ++ est->ktrow = IPVS_EST_NTICKS - 1; /* Initial delay */ ++ ++ /* We prefer this code to be short, kthread 0 will requeue the ++ * estimator to available chain. If tasks are disabled, we ++ * will not allocate much memory, just for kt 0. ++ */ ++ ret = 0; ++ if (!ipvs->est_kt_count || !ipvs->est_kt_arr[0]) ++ ret = ip_vs_est_add_kthread(ipvs); ++ if (ret >= 0) ++ hlist_add_head(&est->list, &ipvs->est_temp_list); ++ else ++ INIT_HLIST_NODE(&est->list); ++ return ret; ++} + +- spin_lock_bh(&ipvs->est_lock); +- list_add(&est->list, &ipvs->est_list); +- spin_unlock_bh(&ipvs->est_lock); ++static void ip_vs_est_kthread_destroy(struct ip_vs_est_kt_data *kd) ++{ ++ if (kd) { ++ if (kd->task) { ++ pr_info("stop unused estimator thread %d...\n", kd->id); ++ kthread_stop(kd->task); ++ } ++ ip_vs_stats_free(kd->calc_stats); ++ kfree(kd); ++ } + } + ++/* Unlink estimator from chain */ + void ip_vs_stop_estimator(struct netns_ipvs *ipvs, struct ip_vs_stats *stats) + { + struct ip_vs_estimator *est = &stats->est; ++ struct ip_vs_est_tick_data *td; ++ struct ip_vs_est_kt_data *kd; ++ int ktid = est->ktid; ++ int row = est->ktrow; ++ int cid = est->ktcid; ++ ++ /* Failed to add to chain ? */ ++ if (hlist_unhashed(&est->list)) ++ return; ++ ++ /* On return, estimator can be freed, dequeue it now */ ++ ++ /* In est_temp_list ? */ ++ if (ktid < 0) { ++ hlist_del(&est->list); ++ goto end_kt0; ++ } ++ ++ hlist_del_rcu(&est->list); ++ kd = ipvs->est_kt_arr[ktid]; ++ td = rcu_dereference_protected(kd->ticks[row], 1); ++ __clear_bit(cid, td->full); ++ td->chain_len[cid]--; ++ if (!td->chain_len[cid]) ++ __clear_bit(cid, td->present); ++ kd->tick_len[row]--; ++ __set_bit(row, kd->avail); ++ if (!kd->tick_len[row]) { ++ RCU_INIT_POINTER(kd->ticks[row], NULL); ++ kfree_rcu(td); ++ } ++ kd->est_count--; ++ if (kd->est_count) { ++ /* This kt slot can become available just now, prefer it */ ++ if (ktid < ipvs->est_add_ktid) ++ ipvs->est_add_ktid = ktid; ++ return; ++ } + +- spin_lock_bh(&ipvs->est_lock); +- list_del(&est->list); +- spin_unlock_bh(&ipvs->est_lock); ++ if (ktid > 0) { ++ mutex_lock(&ipvs->est_mutex); ++ ip_vs_est_kthread_destroy(kd); ++ ipvs->est_kt_arr[ktid] = NULL; ++ if (ktid == ipvs->est_kt_count - 1) { ++ ipvs->est_kt_count--; ++ while (ipvs->est_kt_count > 1 && ++ !ipvs->est_kt_arr[ipvs->est_kt_count - 1]) ++ ipvs->est_kt_count--; ++ } ++ mutex_unlock(&ipvs->est_mutex); ++ ++ /* This slot is now empty, prefer another available kt slot */ ++ if (ktid == ipvs->est_add_ktid) ++ ip_vs_est_update_ktid(ipvs); ++ } ++ ++end_kt0: ++ /* kt 0 is freed after all other kthreads and chains are empty */ ++ if (ipvs->est_kt_count == 1 && hlist_empty(&ipvs->est_temp_list)) { ++ kd = ipvs->est_kt_arr[0]; ++ if (!kd || !kd->est_count) { ++ mutex_lock(&ipvs->est_mutex); ++ if (kd) { ++ ip_vs_est_kthread_destroy(kd); ++ ipvs->est_kt_arr[0] = NULL; ++ } ++ ipvs->est_kt_count--; ++ mutex_unlock(&ipvs->est_mutex); ++ ipvs->est_add_ktid = 0; ++ } ++ } ++} ++ ++/* Register all ests from est_temp_list to kthreads */ ++static void ip_vs_est_drain_temp_list(struct netns_ipvs *ipvs) ++{ ++ struct ip_vs_estimator *est; ++ ++ while (1) { ++ int max = 16; ++ ++ mutex_lock(&__ip_vs_mutex); ++ ++ while (max-- > 0) { ++ est = hlist_entry_safe(ipvs->est_temp_list.first, ++ struct ip_vs_estimator, list); ++ if (est) { ++ if (kthread_should_stop()) ++ goto unlock; ++ hlist_del_init(&est->list); ++ if (ip_vs_enqueue_estimator(ipvs, est) >= 0) ++ continue; ++ est->ktid = -1; ++ hlist_add_head(&est->list, ++ &ipvs->est_temp_list); ++ /* Abort, some entries will not be estimated ++ * until next attempt ++ */ ++ } ++ goto unlock; ++ } ++ mutex_unlock(&__ip_vs_mutex); ++ cond_resched(); ++ } ++ ++unlock: ++ mutex_unlock(&__ip_vs_mutex); ++} ++ ++/* Calculate limits for all kthreads */ ++static int ip_vs_est_calc_limits(struct netns_ipvs *ipvs, int *chain_max) ++{ ++ DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq); ++ struct ip_vs_est_kt_data *kd; ++ struct hlist_head chain; ++ struct ip_vs_stats *s; ++ int cache_factor = 4; ++ int i, loops, ntest; ++ s32 min_est = 0; ++ ktime_t t1, t2; ++ s64 diff, val; ++ int max = 8; ++ int ret = 1; ++ ++ INIT_HLIST_HEAD(&chain); ++ mutex_lock(&__ip_vs_mutex); ++ kd = ipvs->est_kt_arr[0]; ++ mutex_unlock(&__ip_vs_mutex); ++ s = kd ? kd->calc_stats : NULL; ++ if (!s) ++ goto out; ++ hlist_add_head(&s->est.list, &chain); ++ ++ loops = 1; ++ /* Get best result from many tests */ ++ for (ntest = 0; ntest < 12; ntest++) { ++ if (!(ntest & 3)) { ++ /* Wait for cpufreq frequency transition */ ++ wait_event_idle_timeout(wq, kthread_should_stop(), ++ HZ / 50); ++ if (!ipvs->enable || kthread_should_stop()) ++ goto stop; ++ } ++ ++ local_bh_disable(); ++ rcu_read_lock(); ++ ++ /* Put stats in cache */ ++ ip_vs_chain_estimation(&chain); ++ ++ t1 = ktime_get(); ++ for (i = loops * cache_factor; i > 0; i--) ++ ip_vs_chain_estimation(&chain); ++ t2 = ktime_get(); ++ ++ rcu_read_unlock(); ++ local_bh_enable(); ++ ++ if (!ipvs->enable || kthread_should_stop()) ++ goto stop; ++ cond_resched(); ++ ++ diff = ktime_to_ns(ktime_sub(t2, t1)); ++ if (diff <= 1 * NSEC_PER_USEC) { ++ /* Do more loops on low time resolution */ ++ loops *= 2; ++ continue; ++ } ++ if (diff >= NSEC_PER_SEC) ++ continue; ++ val = diff; ++ do_div(val, loops); ++ if (!min_est || val < min_est) { ++ min_est = val; ++ /* goal: 95usec per chain */ ++ val = 95 * NSEC_PER_USEC; ++ if (val >= min_est) { ++ do_div(val, min_est); ++ max = (int)val; ++ } else { ++ max = 1; ++ } ++ } ++ } ++ ++out: ++ if (s) ++ hlist_del_init(&s->est.list); ++ *chain_max = max; ++ return ret; ++ ++stop: ++ ret = 0; ++ goto out; ++} ++ ++/* Calculate the parameters and apply them in context of kt #0 ++ * ECP: est_calc_phase ++ * ECM: est_chain_max ++ * ECP ECM Insert Chain enable Description ++ * --------------------------------------------------------------------------- ++ * 0 0 est_temp_list 0 create kt #0 context ++ * 0 0 est_temp_list 0->1 service added, start kthread #0 task ++ * 0->1 0 est_temp_list 1 kt task #0 started, enters calc phase ++ * 1 0 est_temp_list 1 kt #0: determine est_chain_max, ++ * stop tasks, move ests to est_temp_list ++ * and free kd for kthreads 1..last ++ * 1->0 0->N kt chains 1 ests can go to kthreads ++ * 0 N kt chains 1 drain est_temp_list, create new kthread ++ * contexts, start tasks, estimate ++ */ ++static void ip_vs_est_calc_phase(struct netns_ipvs *ipvs) ++{ ++ int genid = atomic_read(&ipvs->est_genid); ++ struct ip_vs_est_tick_data *td; ++ struct ip_vs_est_kt_data *kd; ++ struct ip_vs_estimator *est; ++ struct ip_vs_stats *stats; ++ int id, row, cid, delay; ++ bool last, last_td; ++ int chain_max; ++ int step; ++ ++ if (!ip_vs_est_calc_limits(ipvs, &chain_max)) ++ return; ++ ++ mutex_lock(&__ip_vs_mutex); ++ ++ /* Stop all other tasks, so that we can immediately move the ++ * estimators to est_temp_list without RCU grace period ++ */ ++ mutex_lock(&ipvs->est_mutex); ++ for (id = 1; id < ipvs->est_kt_count; id++) { ++ /* netns clean up started, abort */ ++ if (!ipvs->enable) ++ goto unlock2; ++ kd = ipvs->est_kt_arr[id]; ++ if (!kd) ++ continue; ++ ip_vs_est_kthread_stop(kd); ++ } ++ mutex_unlock(&ipvs->est_mutex); ++ ++ /* Move all estimators to est_temp_list but carefully, ++ * all estimators and kthread data can be released while ++ * we reschedule. Even for kthread 0. ++ */ ++ step = 0; ++ ++ /* Order entries in est_temp_list in ascending delay, so now ++ * walk delay(desc), id(desc), cid(asc) ++ */ ++ delay = IPVS_EST_NTICKS; ++ ++next_delay: ++ delay--; ++ if (delay < 0) ++ goto end_dequeue; ++ ++last_kt: ++ /* Destroy contexts backwards */ ++ id = ipvs->est_kt_count; ++ ++next_kt: ++ if (!ipvs->enable || kthread_should_stop()) ++ goto unlock; ++ id--; ++ if (id < 0) ++ goto next_delay; ++ kd = ipvs->est_kt_arr[id]; ++ if (!kd) ++ goto next_kt; ++ /* kt 0 can exist with empty chains */ ++ if (!id && kd->est_count <= 1) ++ goto next_delay; ++ ++ row = kd->est_row + delay; ++ if (row >= IPVS_EST_NTICKS) ++ row -= IPVS_EST_NTICKS; ++ td = rcu_dereference_protected(kd->ticks[row], 1); ++ if (!td) ++ goto next_kt; ++ ++ cid = 0; ++ ++walk_chain: ++ if (kthread_should_stop()) ++ goto unlock; ++ step++; ++ if (!(step & 63)) { ++ /* Give chance estimators to be added (to est_temp_list) ++ * and deleted (releasing kthread contexts) ++ */ ++ mutex_unlock(&__ip_vs_mutex); ++ cond_resched(); ++ mutex_lock(&__ip_vs_mutex); ++ ++ /* Current kt released ? */ ++ if (id >= ipvs->est_kt_count) ++ goto last_kt; ++ if (kd != ipvs->est_kt_arr[id]) ++ goto next_kt; ++ /* Current td released ? */ ++ if (td != rcu_dereference_protected(kd->ticks[row], 1)) ++ goto next_kt; ++ /* No fatal changes on the current kd and td */ ++ } ++ est = hlist_entry_safe(td->chains[cid].first, struct ip_vs_estimator, ++ list); ++ if (!est) { ++ cid++; ++ if (cid >= IPVS_EST_TICK_CHAINS) ++ goto next_kt; ++ goto walk_chain; ++ } ++ /* We can cheat and increase est_count to protect kt 0 context ++ * from release but we prefer to keep the last estimator ++ */ ++ last = kd->est_count <= 1; ++ /* Do not free kt #0 data */ ++ if (!id && last) ++ goto next_delay; ++ last_td = kd->tick_len[row] <= 1; ++ stats = container_of(est, struct ip_vs_stats, est); ++ ip_vs_stop_estimator(ipvs, stats); ++ /* Tasks are stopped, move without RCU grace period */ ++ est->ktid = -1; ++ est->ktrow = row - kd->est_row; ++ if (est->ktrow < 0) ++ est->ktrow += IPVS_EST_NTICKS; ++ hlist_add_head(&est->list, &ipvs->est_temp_list); ++ /* kd freed ? */ ++ if (last) ++ goto next_kt; ++ /* td freed ? */ ++ if (last_td) ++ goto next_kt; ++ goto walk_chain; ++ ++end_dequeue: ++ /* All estimators removed while calculating ? */ ++ if (!ipvs->est_kt_count) ++ goto unlock; ++ kd = ipvs->est_kt_arr[0]; ++ if (!kd) ++ goto unlock; ++ kd->add_row = kd->est_row; ++ ipvs->est_chain_max = chain_max; ++ ip_vs_est_set_params(ipvs, kd); ++ ++ pr_info("using max %d ests per chain, %d per kthread\n", ++ kd->chain_max, kd->est_max_count); ++ ++ /* Try to keep tot_stats in kt0, enqueue it early */ ++ if (ipvs->tot_stats && !hlist_unhashed(&ipvs->tot_stats->s.est.list) && ++ ipvs->tot_stats->s.est.ktid == -1) { ++ hlist_del(&ipvs->tot_stats->s.est.list); ++ hlist_add_head(&ipvs->tot_stats->s.est.list, ++ &ipvs->est_temp_list); ++ } ++ ++ mutex_lock(&ipvs->est_mutex); ++ ++ /* We completed the calc phase, new calc phase not requested */ ++ if (genid == atomic_read(&ipvs->est_genid)) ++ ipvs->est_calc_phase = 0; ++ ++unlock2: ++ mutex_unlock(&ipvs->est_mutex); ++ ++unlock: ++ mutex_unlock(&__ip_vs_mutex); + } + + void ip_vs_zero_estimator(struct ip_vs_stats *stats) +@@ -191,14 +920,25 @@ void ip_vs_read_estimator(struct ip_vs_kstats *dst, struct ip_vs_stats *stats) + + int __net_init ip_vs_estimator_net_init(struct netns_ipvs *ipvs) + { +- INIT_LIST_HEAD(&ipvs->est_list); +- spin_lock_init(&ipvs->est_lock); +- timer_setup(&ipvs->est_timer, estimation_timer, 0); +- mod_timer(&ipvs->est_timer, jiffies + 2 * HZ); ++ INIT_HLIST_HEAD(&ipvs->est_temp_list); ++ ipvs->est_kt_arr = NULL; ++ ipvs->est_max_threads = 0; ++ ipvs->est_calc_phase = 0; ++ ipvs->est_chain_max = 0; ++ ipvs->est_kt_count = 0; ++ ipvs->est_add_ktid = 0; ++ atomic_set(&ipvs->est_genid, 0); ++ atomic_set(&ipvs->est_genid_done, 0); ++ __mutex_init(&ipvs->est_mutex, "ipvs->est_mutex", &__ipvs_est_key); + return 0; + } + + void __net_exit ip_vs_estimator_net_cleanup(struct netns_ipvs *ipvs) + { +- del_timer_sync(&ipvs->est_timer); ++ int i; ++ ++ for (i = 0; i < ipvs->est_kt_count; i++) ++ ip_vs_est_kthread_destroy(ipvs->est_kt_arr[i]); ++ kfree(ipvs->est_kt_arr); ++ mutex_destroy(&ipvs->est_mutex); + } +-- +2.35.3 + diff --git a/patches.suse/ipvs-use-u64_stats_t-for-the-per-cpu-counters.patch b/patches.suse/ipvs-use-u64_stats_t-for-the-per-cpu-counters.patch new file mode 100644 index 0000000..5dca737 --- /dev/null +++ b/patches.suse/ipvs-use-u64_stats_t-for-the-per-cpu-counters.patch @@ -0,0 +1,189 @@ +From 1dbd8d9a82e3f26b9d063292d47ece673f48fce2 Mon Sep 17 00:00:00 2001 +From: Julian Anastasov +Date: Tue, 22 Nov 2022 18:46:01 +0200 +Subject: [PATCH] ipvs: use u64_stats_t for the per-cpu counters +Git-commit: 1dbd8d9a82e3f26b9d063292d47ece673f48fce2 +Patch-mainline: v6.2-rc1 +References: bsc#1207361 + +Use the provided u64_stats_t type to avoid +load/store tearing. + +Fixes: 316580b69d0a ("u64_stats: provide u64_stats_t type") +Signed-off-by: Julian Anastasov +Cc: yunhong-cgl jiang +Cc: "dust.li" +Reviewed-by: Jiri Wiesner +Tested-by: Jiri Wiesner +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Jiri Wiesner +--- + include/net/ip_vs.h | 10 +++++----- + net/netfilter/ipvs/ip_vs_core.c | 30 +++++++++++++++--------------- + net/netfilter/ipvs/ip_vs_ctl.c | 10 +++++----- + net/netfilter/ipvs/ip_vs_est.c | 20 ++++++++++---------- + 4 files changed, 35 insertions(+), 35 deletions(-) + +diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h +index e5582c01a4a3..a4d44138c2a8 100644 +--- a/include/net/ip_vs.h ++++ b/include/net/ip_vs.h +@@ -351,11 +351,11 @@ struct ip_vs_seq { + + /* counters per cpu */ + struct ip_vs_counters { +- __u64 conns; /* connections scheduled */ +- __u64 inpkts; /* incoming packets */ +- __u64 outpkts; /* outgoing packets */ +- __u64 inbytes; /* incoming bytes */ +- __u64 outbytes; /* outgoing bytes */ ++ u64_stats_t conns; /* connections scheduled */ ++ u64_stats_t inpkts; /* incoming packets */ ++ u64_stats_t outpkts; /* outgoing packets */ ++ u64_stats_t inbytes; /* incoming bytes */ ++ u64_stats_t outbytes; /* outgoing bytes */ + }; + /* Stats per cpu */ + struct ip_vs_cpu_stats { +diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c +index fcdaef1fcccf..2fcc26507d69 100644 +--- a/net/netfilter/ipvs/ip_vs_core.c ++++ b/net/netfilter/ipvs/ip_vs_core.c +@@ -132,21 +132,21 @@ ip_vs_in_stats(struct ip_vs_conn *cp, struct sk_buff *skb) + + s = this_cpu_ptr(dest->stats.cpustats); + u64_stats_update_begin(&s->syncp); +- s->cnt.inpkts++; +- s->cnt.inbytes += skb->len; ++ u64_stats_inc(&s->cnt.inpkts); ++ u64_stats_add(&s->cnt.inbytes, skb->len); + u64_stats_update_end(&s->syncp); + + svc = rcu_dereference(dest->svc); + s = this_cpu_ptr(svc->stats.cpustats); + u64_stats_update_begin(&s->syncp); +- s->cnt.inpkts++; +- s->cnt.inbytes += skb->len; ++ u64_stats_inc(&s->cnt.inpkts); ++ u64_stats_add(&s->cnt.inbytes, skb->len); + u64_stats_update_end(&s->syncp); + + s = this_cpu_ptr(ipvs->tot_stats->s.cpustats); + u64_stats_update_begin(&s->syncp); +- s->cnt.inpkts++; +- s->cnt.inbytes += skb->len; ++ u64_stats_inc(&s->cnt.inpkts); ++ u64_stats_add(&s->cnt.inbytes, skb->len); + u64_stats_update_end(&s->syncp); + + local_bh_enable(); +@@ -168,21 +168,21 @@ ip_vs_out_stats(struct ip_vs_conn *cp, struct sk_buff *skb) + + s = this_cpu_ptr(dest->stats.cpustats); + u64_stats_update_begin(&s->syncp); +- s->cnt.outpkts++; +- s->cnt.outbytes += skb->len; ++ u64_stats_inc(&s->cnt.outpkts); ++ u64_stats_add(&s->cnt.outbytes, skb->len); + u64_stats_update_end(&s->syncp); + + svc = rcu_dereference(dest->svc); + s = this_cpu_ptr(svc->stats.cpustats); + u64_stats_update_begin(&s->syncp); +- s->cnt.outpkts++; +- s->cnt.outbytes += skb->len; ++ u64_stats_inc(&s->cnt.outpkts); ++ u64_stats_add(&s->cnt.outbytes, skb->len); + u64_stats_update_end(&s->syncp); + + s = this_cpu_ptr(ipvs->tot_stats->s.cpustats); + u64_stats_update_begin(&s->syncp); +- s->cnt.outpkts++; +- s->cnt.outbytes += skb->len; ++ u64_stats_inc(&s->cnt.outpkts); ++ u64_stats_add(&s->cnt.outbytes, skb->len); + u64_stats_update_end(&s->syncp); + + local_bh_enable(); +@@ -200,17 +200,17 @@ ip_vs_conn_stats(struct ip_vs_conn *cp, struct ip_vs_service *svc) + + s = this_cpu_ptr(cp->dest->stats.cpustats); + u64_stats_update_begin(&s->syncp); +- s->cnt.conns++; ++ u64_stats_inc(&s->cnt.conns); + u64_stats_update_end(&s->syncp); + + s = this_cpu_ptr(svc->stats.cpustats); + u64_stats_update_begin(&s->syncp); +- s->cnt.conns++; ++ u64_stats_inc(&s->cnt.conns); + u64_stats_update_end(&s->syncp); + + s = this_cpu_ptr(ipvs->tot_stats->s.cpustats); + u64_stats_update_begin(&s->syncp); +- s->cnt.conns++; ++ u64_stats_inc(&s->cnt.conns); + u64_stats_update_end(&s->syncp); + + local_bh_enable(); +diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c +index 22068824ffe7..dc513e1e9343 100644 +--- a/net/netfilter/ipvs/ip_vs_ctl.c ++++ b/net/netfilter/ipvs/ip_vs_ctl.c +@@ -2338,11 +2338,11 @@ static int ip_vs_stats_percpu_show(struct seq_file *seq, void *v) + + do { + start = u64_stats_fetch_begin_irq(&u->syncp); +- conns = u->cnt.conns; +- inpkts = u->cnt.inpkts; +- outpkts = u->cnt.outpkts; +- inbytes = u->cnt.inbytes; +- outbytes = u->cnt.outbytes; ++ conns = u64_stats_read(&u->cnt.conns); ++ inpkts = u64_stats_read(&u->cnt.inpkts); ++ outpkts = u64_stats_read(&u->cnt.outpkts); ++ inbytes = u64_stats_read(&u->cnt.inbytes); ++ outbytes = u64_stats_read(&u->cnt.outbytes); + } while (u64_stats_fetch_retry_irq(&u->syncp, start)); + + seq_printf(seq, "%3X %8LX %8LX %8LX %16LX %16LX\n", +diff --git a/net/netfilter/ipvs/ip_vs_est.c b/net/netfilter/ipvs/ip_vs_est.c +index 9a1a7af6a186..f53150d82a92 100644 +--- a/net/netfilter/ipvs/ip_vs_est.c ++++ b/net/netfilter/ipvs/ip_vs_est.c +@@ -67,11 +67,11 @@ static void ip_vs_read_cpu_stats(struct ip_vs_kstats *sum, + if (add) { + do { + start = u64_stats_fetch_begin(&s->syncp); +- conns = s->cnt.conns; +- inpkts = s->cnt.inpkts; +- outpkts = s->cnt.outpkts; +- inbytes = s->cnt.inbytes; +- outbytes = s->cnt.outbytes; ++ conns = u64_stats_read(&s->cnt.conns); ++ inpkts = u64_stats_read(&s->cnt.inpkts); ++ outpkts = u64_stats_read(&s->cnt.outpkts); ++ inbytes = u64_stats_read(&s->cnt.inbytes); ++ outbytes = u64_stats_read(&s->cnt.outbytes); + } while (u64_stats_fetch_retry(&s->syncp, start)); + sum->conns += conns; + sum->inpkts += inpkts; +@@ -82,11 +82,11 @@ static void ip_vs_read_cpu_stats(struct ip_vs_kstats *sum, + add = true; + do { + start = u64_stats_fetch_begin(&s->syncp); +- sum->conns = s->cnt.conns; +- sum->inpkts = s->cnt.inpkts; +- sum->outpkts = s->cnt.outpkts; +- sum->inbytes = s->cnt.inbytes; +- sum->outbytes = s->cnt.outbytes; ++ sum->conns = u64_stats_read(&s->cnt.conns); ++ sum->inpkts = u64_stats_read(&s->cnt.inpkts); ++ sum->outpkts = u64_stats_read(&s->cnt.outpkts); ++ sum->inbytes = u64_stats_read(&s->cnt.inbytes); ++ sum->outbytes = u64_stats_read(&s->cnt.outbytes); + } while (u64_stats_fetch_retry(&s->syncp, start)); + } + } +-- +2.35.3 diff --git a/patches.suse/net-sched-Fix-use-after-free-in-red_enqueue.patch b/patches.suse/net-sched-Fix-use-after-free-in-red_enqueue.patch new file mode 100644 index 0000000..c378020 --- /dev/null +++ b/patches.suse/net-sched-Fix-use-after-free-in-red_enqueue.patch @@ -0,0 +1,48 @@ +From 8bdc2acd420c6f3dd1f1c78750ec989f02a1e2b9 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Fri, 28 Oct 2022 18:05:00 +0300 +Subject: [PATCH] net: sched: Fix use after free in red_enqueue() +Git-commit: 8bdc2acd420c6f3dd1f1c78750ec989f02a1e2b9 +Patch-mainline: v6.1-rc4 +References: bsc#1207361 + +We can't use "skb" again after passing it to qdisc_enqueue(). This is +basically identical to commit 2f09707d0c97 ("sch_sfb: Also store skb +len before calling child enqueue"). + +Fixes: d7f4f332f082 ("sch_red: update backlog as well") +Signed-off-by: Dan Carpenter +Reviewed-by: Eric Dumazet +Signed-off-by: David S. Miller +Signed-off-by: Jiri Wiesner +--- + net/sched/sch_red.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c +index a5a401f93c1a..98129324e157 100644 +--- a/net/sched/sch_red.c ++++ b/net/sched/sch_red.c +@@ -72,6 +72,7 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc *sch, + { + struct red_sched_data *q = qdisc_priv(sch); + struct Qdisc *child = q->qdisc; ++ unsigned int len; + int ret; + + q->vars.qavg = red_calc_qavg(&q->parms, +@@ -126,9 +127,10 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc *sch, + break; + } + ++ len = qdisc_pkt_len(skb); + ret = qdisc_enqueue(skb, child, to_free); + if (likely(ret == NET_XMIT_SUCCESS)) { +- qdisc_qstats_backlog_inc(sch, skb); ++ sch->qstats.backlog += len; + sch->q.qlen++; + } else if (net_xmit_drop_count(ret)) { + q->stats.pdrop++; +-- +2.35.3 + diff --git a/patches.suse/net-sched-act_ct-Fix-flow-table-lookup-after-ct-clea.patch b/patches.suse/net-sched-act_ct-Fix-flow-table-lookup-after-ct-clea.patch new file mode 100644 index 0000000..abbcf4f --- /dev/null +++ b/patches.suse/net-sched-act_ct-Fix-flow-table-lookup-after-ct-clea.patch @@ -0,0 +1,47 @@ +From 2f131de361f6d0eaff17db26efdb844c178432f8 Mon Sep 17 00:00:00 2001 +From: Paul Blakey +Date: Thu, 17 Feb 2022 11:30:48 +0200 +Subject: [PATCH] net/sched: act_ct: Fix flow table lookup after ct clear or + switching zones +Git-commit: 2f131de361f6d0eaff17db26efdb844c178432f8 +Patch-mainline: v5.17-rc6 +References: bsc#1207361 + +Flow table lookup is skipped if packet either went through ct clear +action (which set the IP_CT_UNTRACKED flag on the packet), or while +switching zones and there is already a connection associated with +the packet. This will result in no SW offload of the connection, +and the and connection not being removed from flow table with +TCP teardown (fin/rst packet). + +To fix the above, remove these unneccary checks in flow +table lookup. + +Fixes: 46475bb20f4b ("net/sched: act_ct: Software offload of established flows") +Signed-off-by: Paul Blakey +Acked-by: Marcelo Ricardo Leitner +Signed-off-by: David S. Miller +Signed-off-by: Jiri Wiesner +--- + net/sched/act_ct.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c +index f99247fc6468..33e70d60f0bf 100644 +--- a/net/sched/act_ct.c ++++ b/net/sched/act_ct.c +@@ -533,11 +533,6 @@ static bool tcf_ct_flow_table_lookup(struct tcf_ct_params *p, + struct nf_conn *ct; + u8 dir; + +- /* Previously seen or loopback */ +- ct = nf_ct_get(skb, &ctinfo); +- if ((ct && !nf_ct_is_template(ct)) || ctinfo == IP_CT_UNTRACKED) +- return false; +- + switch (family) { + case NFPROTO_IPV4: + if (!tcf_ct_flow_table_fill_tuple_ipv4(skb, &tuple, &tcph)) +-- +2.35.3 + diff --git a/patches.suse/net-sched-act_ct-fix-possible-refcount-leak-in-tcf_c.patch b/patches.suse/net-sched-act_ct-fix-possible-refcount-leak-in-tcf_c.patch new file mode 100644 index 0000000..75ccce5 --- /dev/null +++ b/patches.suse/net-sched-act_ct-fix-possible-refcount-leak-in-tcf_c.patch @@ -0,0 +1,46 @@ +From 6e23ec0ba92d426c77a73a9ccab16346e5e0ef49 Mon Sep 17 00:00:00 2001 +From: Hangyu Hua +Date: Fri, 23 Sep 2022 10:00:46 +0800 +Subject: [PATCH] net: sched: act_ct: fix possible refcount leak in + tcf_ct_init() +Git-commit: 6e23ec0ba92d426c77a73a9ccab16346e5e0ef49 +Patch-mainline: v6.0 +References: bsc#1207361 + +nf_ct_put need to be called to put the refcount got by tcf_ct_fill_params +to avoid possible refcount leak when tcf_ct_flow_table_get fails. + +Fixes: c34b961a2492 ("net/sched: act_ct: Create nf flow table per zone") +Signed-off-by: Hangyu Hua +Link: https://lore.kernel.org/r/20220923020046.8021-1-hbh25y@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Jiri Wiesner +--- + net/sched/act_ct.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c +index d55afb8d14be..5950974ae8f6 100644 +--- a/net/sched/act_ct.c ++++ b/net/sched/act_ct.c +@@ -1307,7 +1307,7 @@ static int tcf_ct_init(struct net *net, struct nlattr *nla, + + err = tcf_ct_flow_table_get(params); + if (err) +- goto cleanup; ++ goto cleanup_params; + + spin_lock_bh(&c->tcf_lock); + goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); +@@ -1409,6 +1409,9 @@ static int tcf_ct_init(struct net *net, struct nlattr *nla, + + return res; + ++cleanup_params: ++ if (params->tmpl) ++ nf_ct_put(params->tmpl); + cleanup: + if (goto_ch) + tcf_chain_put_by_act(goto_ch); +-- +2.35.3 diff --git a/patches.suse/net-sched-act_ct-fix-ref-leak-when-switching-zones.patch b/patches.suse/net-sched-act_ct-fix-ref-leak-when-switching-zones.patch new file mode 100644 index 0000000..c7347af --- /dev/null +++ b/patches.suse/net-sched-act_ct-fix-ref-leak-when-switching-zones.patch @@ -0,0 +1,63 @@ +From bcb74e132a76ce0502bb33d5b65533a4ed72d159 Mon Sep 17 00:00:00 2001 +From: Marcelo Ricardo Leitner +Date: Thu, 24 Mar 2022 16:22:10 -0300 +Subject: [PATCH] net/sched: act_ct: fix ref leak when switching zones +Git-commit: bcb74e132a76ce0502bb33d5b65533a4ed72d159 +Patch-mainline: v5.18-rc1 +References: bsc#1207361 + +When switching zones or network namespaces without doing a ct clear in +between, it is now leaking a reference to the old ct entry. That's +because tcf_ct_skb_nfct_cached() returns false and +tcf_ct_flow_table_lookup() may simply overwrite it. + +The fix is to, as the ct entry is not reusable, free it already at +tcf_ct_skb_nfct_cached(). + +Reported-by: Florian Westphal +Fixes: 2f131de361f6 ("net/sched: act_ct: Fix flow table lookup after ct clear or switching zones") +Signed-off-by: Marcelo Ricardo Leitner +Signed-off-by: David S. Miller +Signed-off-by: Jiri Wiesner +--- + net/sched/act_ct.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c +index 6a34f7b80a6d..b1f502fce595 100644 +--- a/net/sched/act_ct.c ++++ b/net/sched/act_ct.c +@@ -583,22 +583,25 @@ static bool tcf_ct_skb_nfct_cached(struct net *net, struct sk_buff *skb, + if (!ct) + return false; + if (!net_eq(net, read_pnet(&ct->ct_net))) +- return false; ++ goto drop_ct; + if (nf_ct_zone(ct)->id != zone_id) +- return false; ++ goto drop_ct; + + /* Force conntrack entry direction. */ + if (force && CTINFO2DIR(ctinfo) != IP_CT_DIR_ORIGINAL) { + if (nf_ct_is_confirmed(ct)) + nf_ct_kill(ct); + +- nf_conntrack_put(&ct->ct_general); +- nf_ct_set(skb, NULL, IP_CT_UNTRACKED); +- +- return false; ++ goto drop_ct; + } + + return true; ++ ++drop_ct: ++ nf_conntrack_put(&ct->ct_general); ++ nf_ct_set(skb, NULL, IP_CT_UNTRACKED); ++ ++ return false; + } + + /* Trim the skb to the length specified by the IP/IPv6 header, +-- +2.35.3 diff --git a/patches.suse/net-sched-add-barrier-to-fix-packet-stuck-problem-fo.patch b/patches.suse/net-sched-add-barrier-to-fix-packet-stuck-problem-fo.patch new file mode 100644 index 0000000..3055f82 --- /dev/null +++ b/patches.suse/net-sched-add-barrier-to-fix-packet-stuck-problem-fo.patch @@ -0,0 +1,70 @@ +From 2e8728c955ce0624b958eee6e030a37aca3a5d86 Mon Sep 17 00:00:00 2001 +From: Guoju Fang +Date: Sat, 28 May 2022 18:16:28 +0800 +Subject: [PATCH] net: sched: add barrier to fix packet stuck problem for + lockless qdisc +Git-commit: 2e8728c955ce0624b958eee6e030a37aca3a5d86 +Patch-mainline: v5.19-rc1 +References: bsc#1207361 + +In qdisc_run_end(), the spin_unlock() only has store-release semantic, +which guarantees all earlier memory access are visible before it. But +the subsequent test_bit() has no barrier semantics so may be reordered +ahead of the spin_unlock(). The store-load reordering may cause a packet +stuck problem. + +The concurrent operations can be described as below, + CPU 0 | CPU 1 + qdisc_run_end() | qdisc_run_begin() + . | . + ----> /* may be reorderd here */ | . +| . | . +| spin_unlock() | set_bit() +| . | smp_mb__after_atomic() + ---- test_bit() | spin_trylock() + . | . + +Consider the following sequence of events: + CPU 0 reorder test_bit() ahead and see MISSED = 0 + CPU 1 calls set_bit() + CPU 1 calls spin_trylock() and return fail + CPU 0 executes spin_unlock() + +At the end of the sequence, CPU 0 calls spin_unlock() and does nothing +because it see MISSED = 0. The skb on CPU 1 has beed enqueued but no one +take it, until the next cpu pushing to the qdisc (if ever ...) will +notice and dequeue it. + +This patch fix this by adding one explicit barrier. As spin_unlock() and +test_bit() ordering is a store-load ordering, a full memory barrier +smp_mb() is needed here. + +Fixes: a90c57f2cedd ("net: sched: fix packet stuck problem for lockless qdisc") +Signed-off-by: Guoju Fang +Link: https://lore.kernel.org/r/20220528101628.120193-1-gjfang@linux.alibaba.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Jiri Wiesner +--- + include/net/sch_generic.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h +index 80973ce820f3..d6cf5116b5f9 100644 +--- a/include/net/sch_generic.h ++++ b/include/net/sch_generic.h +@@ -209,6 +209,12 @@ static inline void qdisc_run_end(struct Qdisc *qdisc) + if (qdisc->flags & TCQ_F_NOLOCK) { + spin_unlock(&qdisc->seqlock); + ++ /* spin_unlock() only has store-release semantic. The unlock ++ * and test_bit() ordering is a store-load ordering, so a full ++ * memory barrier is needed here. ++ */ ++ smp_mb(); ++ + if (unlikely(test_bit(__QDISC_STATE_MISSED, + &qdisc->state))) + __netif_schedule(qdisc); +-- +2.35.3 + diff --git a/patches.suse/net-sched-atm-dont-intepret-cls-results-when-asked-t.patch b/patches.suse/net-sched-atm-dont-intepret-cls-results-when-asked-t.patch new file mode 100644 index 0000000..2c1f2c3 --- /dev/null +++ b/patches.suse/net-sched-atm-dont-intepret-cls-results-when-asked-t.patch @@ -0,0 +1,41 @@ +From a2965c7be0522eaa18808684b7b82b248515511b Mon Sep 17 00:00:00 2001 +From: Jamal Hadi Salim +Date: Sun, 1 Jan 2023 16:57:43 -0500 +Subject: [PATCH] net: sched: atm: dont intepret cls results when asked to drop +Git-commit: a2965c7be0522eaa18808684b7b82b248515511b +Patch-mainline: v6.2-rc3 +References: bsc#1207361 + +If asked to drop a packet via TC_ACT_SHOT it is unsafe to assume +res.class contains a valid pointer +Fixes: b0188d4dbe5f ("[NET_SCHED]: sch_atm: Lindent") + +Signed-off-by: Jamal Hadi Salim +Signed-off-by: David S. Miller +Signed-off-by: Jiri Wiesner +--- + net/sched/sch_atm.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c +index f52255fea652..4a981ca90b0b 100644 +--- a/net/sched/sch_atm.c ++++ b/net/sched/sch_atm.c +@@ -393,10 +393,13 @@ static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch, + result = tcf_classify(skb, NULL, fl, &res, true); + if (result < 0) + continue; ++ if (result == TC_ACT_SHOT) ++ goto done; ++ + flow = (struct atm_flow_data *)res.class; + if (!flow) + flow = lookup_flow(sch, res.classid); +- goto done; ++ goto drop; + } + } + flow = NULL; +-- +2.35.3 + diff --git a/patches.suse/net-sched-cake-fix-null-pointer-access-issue-when-ca.patch b/patches.suse/net-sched-cake-fix-null-pointer-access-issue-when-ca.patch new file mode 100644 index 0000000..3e657a9 --- /dev/null +++ b/patches.suse/net-sched-cake-fix-null-pointer-access-issue-when-ca.patch @@ -0,0 +1,85 @@ +From 51f9a8921ceacd7bf0d3f47fa867a64988ba1dcb Mon Sep 17 00:00:00 2001 +From: Zhengchao Shao +Date: Tue, 18 Oct 2022 14:31:59 +0800 +Subject: [PATCH] net: sched: cake: fix null pointer access issue when + cake_init() fails +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Git-commit: 51f9a8921ceacd7bf0d3f47fa867a64988ba1dcb +Patch-mainline: v6.1-rc2 +References: bsc#1207361 + +When the default qdisc is cake, if the qdisc of dev_queue fails to be +inited during mqprio_init(), cake_reset() is invoked to clear +resources. In this case, the tins is NULL, and it will cause gpf issue. + +The process is as follows: +qdisc_create_dflt() + cake_init() + q->tins = kvcalloc(...) --->failed, q->tins is NULL + ... + qdisc_put() + ... + cake_reset() + ... + cake_dequeue_one() + b = &q->tins[...] --->q->tins is NULL + +The following is the Call Trace information: +general protection fault, probably for non-canonical address +0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN +KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] +RIP: 0010:cake_dequeue_one+0xc9/0x3c0 +Call Trace: + +cake_reset+0xb1/0x140 +qdisc_reset+0xed/0x6f0 +qdisc_destroy+0x82/0x4c0 +qdisc_put+0x9e/0xb0 +qdisc_create_dflt+0x2c3/0x4a0 +mqprio_init+0xa71/0x1760 +qdisc_create+0x3eb/0x1000 +tc_modify_qdisc+0x408/0x1720 +rtnetlink_rcv_msg+0x38e/0xac0 +netlink_rcv_skb+0x12d/0x3a0 +netlink_unicast+0x4a2/0x740 +netlink_sendmsg+0x826/0xcc0 +sock_sendmsg+0xc5/0x100 +____sys_sendmsg+0x583/0x690 +___sys_sendmsg+0xe8/0x160 +__sys_sendmsg+0xbf/0x160 +do_syscall_64+0x35/0x80 +entry_SYSCALL_64_after_hwframe+0x46/0xb0 +RIP: 0033:0x7f89e5122d04 + + +Fixes: 046f6fd5daef ("sched: Add Common Applications Kept Enhanced (cake) qdisc") +Signed-off-by: Zhengchao Shao +Acked-by: Toke Høiland-Jørgensen +Signed-off-by: David S. Miller +Signed-off-by: Jiri Wiesner +--- + net/sched/sch_cake.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c +index 55c6879d2c7e..87f8ce2c65ee 100644 +--- a/net/sched/sch_cake.c ++++ b/net/sched/sch_cake.c +@@ -2224,8 +2224,12 @@ static struct sk_buff *cake_dequeue(struct Qdisc *sch) + + static void cake_reset(struct Qdisc *sch) + { ++ struct cake_sched_data *q = qdisc_priv(sch); + u32 c; + ++ if (!q->tins) ++ return; ++ + for (c = 0; c < CAKE_MAX_TINS; c++) + cake_clear_tin(sch, c); + } +-- +2.35.3 + diff --git a/patches.suse/net-sched-cbq-dont-intepret-cls-results-when-asked-t.patch b/patches.suse/net-sched-cbq-dont-intepret-cls-results-when-asked-t.patch new file mode 100644 index 0000000..8a0972e --- /dev/null +++ b/patches.suse/net-sched-cbq-dont-intepret-cls-results-when-asked-t.patch @@ -0,0 +1,146 @@ +From caa4b35b4317d5147b3ab0fbdc9c075c7d2e9c12 Mon Sep 17 00:00:00 2001 +From: Jamal Hadi Salim +Date: Sun, 1 Jan 2023 16:57:44 -0500 +Subject: [PATCH] net: sched: cbq: dont intepret cls results when asked to drop +Git-commit: caa4b35b4317d5147b3ab0fbdc9c075c7d2e9c12 +Patch-mainline: v6.2-rc3 +References: bsc#1207361 + +If asked to drop a packet via TC_ACT_SHOT it is unsafe to assume that +res.class contains a valid pointer + +Sample splat reported by Kyle Zeng + +[ 5.405624] 0: reclassify loop, rule prio 0, protocol 800 +[ 5.406326] ================================================================== +[ 5.407240] BUG: KASAN: slab-out-of-bounds in cbq_enqueue+0x54b/0xea0 +[ 5.407987] Read of size 1 at addr ffff88800e3122aa by task poc/299 +[ 5.408731] +[ 5.408897] CPU: 0 PID: 299 Comm: poc Not tainted 5.10.155+ #15 +[ 5.409516] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), +BIOS 1.15.0-1 04/01/2014 +[ 5.410439] Call Trace: +[ 5.410764] dump_stack+0x87/0xcd +[ 5.411153] print_address_description+0x7a/0x6b0 +[ 5.411687] ? vprintk_func+0xb9/0xc0 +[ 5.411905] ? printk+0x76/0x96 +[ 5.412110] ? cbq_enqueue+0x54b/0xea0 +[ 5.412323] kasan_report+0x17d/0x220 +[ 5.412591] ? cbq_enqueue+0x54b/0xea0 +[ 5.412803] __asan_report_load1_noabort+0x10/0x20 +[ 5.413119] cbq_enqueue+0x54b/0xea0 +[ 5.413400] ? __kasan_check_write+0x10/0x20 +[ 5.413679] __dev_queue_xmit+0x9c0/0x1db0 +[ 5.413922] dev_queue_xmit+0xc/0x10 +[ 5.414136] ip_finish_output2+0x8bc/0xcd0 +[ 5.414436] __ip_finish_output+0x472/0x7a0 +[ 5.414692] ip_finish_output+0x5c/0x190 +[ 5.414940] ip_output+0x2d8/0x3c0 +[ 5.415150] ? ip_mc_finish_output+0x320/0x320 +[ 5.415429] __ip_queue_xmit+0x753/0x1760 +[ 5.415664] ip_queue_xmit+0x47/0x60 +[ 5.415874] __tcp_transmit_skb+0x1ef9/0x34c0 +[ 5.416129] tcp_connect+0x1f5e/0x4cb0 +[ 5.416347] tcp_v4_connect+0xc8d/0x18c0 +[ 5.416577] __inet_stream_connect+0x1ae/0xb40 +[ 5.416836] ? local_bh_enable+0x11/0x20 +[ 5.417066] ? lock_sock_nested+0x175/0x1d0 +[ 5.417309] inet_stream_connect+0x5d/0x90 +[ 5.417548] ? __inet_stream_connect+0xb40/0xb40 +[ 5.417817] __sys_connect+0x260/0x2b0 +[ 5.418037] __x64_sys_connect+0x76/0x80 +[ 5.418267] do_syscall_64+0x31/0x50 +[ 5.418477] entry_SYSCALL_64_after_hwframe+0x61/0xc6 +[ 5.418770] RIP: 0033:0x473bb7 +[ 5.418952] Code: 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 +00 00 90 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2a 00 00 +00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 18 89 54 24 0c 48 89 34 +24 89 +[ 5.420046] RSP: 002b:00007fffd20eb0f8 EFLAGS: 00000246 ORIG_RAX: +000000000000002a +[ 5.420472] RAX: ffffffffffffffda RBX: 00007fffd20eb578 RCX: 0000000000473bb7 +[ 5.420872] RDX: 0000000000000010 RSI: 00007fffd20eb110 RDI: 0000000000000007 +[ 5.421271] RBP: 00007fffd20eb150 R08: 0000000000000001 R09: 0000000000000004 +[ 5.421671] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 +[ 5.422071] R13: 00007fffd20eb568 R14: 00000000004fc740 R15: 0000000000000002 +[ 5.422471] +[ 5.422562] Allocated by task 299: +[ 5.422782] __kasan_kmalloc+0x12d/0x160 +[ 5.423007] kasan_kmalloc+0x5/0x10 +[ 5.423208] kmem_cache_alloc_trace+0x201/0x2e0 +[ 5.423492] tcf_proto_create+0x65/0x290 +[ 5.423721] tc_new_tfilter+0x137e/0x1830 +[ 5.423957] rtnetlink_rcv_msg+0x730/0x9f0 +[ 5.424197] netlink_rcv_skb+0x166/0x300 +[ 5.424428] rtnetlink_rcv+0x11/0x20 +[ 5.424639] netlink_unicast+0x673/0x860 +[ 5.424870] netlink_sendmsg+0x6af/0x9f0 +[ 5.425100] __sys_sendto+0x58d/0x5a0 +[ 5.425315] __x64_sys_sendto+0xda/0xf0 +[ 5.425539] do_syscall_64+0x31/0x50 +[ 5.425764] entry_SYSCALL_64_after_hwframe+0x61/0xc6 +[ 5.426065] +[ 5.426157] The buggy address belongs to the object at ffff88800e312200 +[ 5.426157] which belongs to the cache kmalloc-128 of size 128 +[ 5.426955] The buggy address is located 42 bytes to the right of +[ 5.426955] 128-byte region [ffff88800e312200, ffff88800e312280) +[ 5.427688] The buggy address belongs to the page: +[ 5.427992] page:000000009875fabc refcount:1 mapcount:0 +mapping:0000000000000000 index:0x0 pfn:0xe312 +[ 5.428562] flags: 0x100000000000200(slab) +[ 5.428812] raw: 0100000000000200 dead000000000100 dead000000000122 +ffff888007843680 +[ 5.429325] raw: 0000000000000000 0000000000100010 00000001ffffffff +ffff88800e312401 +[ 5.429875] page dumped because: kasan: bad access detected +[ 5.430214] page->mem_cgroup:ffff88800e312401 +[ 5.430471] +[ 5.430564] Memory state around the buggy address: +[ 5.430846] ffff88800e312180: fc fc fc fc fc fc fc fc fc fc fc fc +fc fc fc fc +[ 5.431267] ffff88800e312200: 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 fc +[ 5.431705] >ffff88800e312280: fc fc fc fc fc fc fc fc fc fc fc fc +fc fc fc fc +[ 5.432123] ^ +[ 5.432391] ffff88800e312300: 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 fc +[ 5.432810] ffff88800e312380: fc fc fc fc fc fc fc fc fc fc fc fc +fc fc fc fc +[ 5.433229] ================================================================== +[ 5.433648] Disabling lock debugging due to kernel taint + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Reported-by: Kyle Zeng +Signed-off-by: Jamal Hadi Salim +Signed-off-by: David S. Miller +Signed-off-by: Jiri Wiesner +--- + net/sched/sch_cbq.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c +index 6568e17c4c63..36db5f6782f2 100644 +--- a/net/sched/sch_cbq.c ++++ b/net/sched/sch_cbq.c +@@ -230,6 +230,8 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) + result = tcf_classify(skb, NULL, fl, &res, true); + if (!fl || result < 0) + goto fallback; ++ if (result == TC_ACT_SHOT) ++ return NULL; + + cl = (void *)res.class; + if (!cl) { +@@ -250,8 +252,6 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) + case TC_ACT_TRAP: + *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; + fallthrough; +- case TC_ACT_SHOT: +- return NULL; + case TC_ACT_RECLASSIFY: + return cbq_reclassify(skb, cl); + } +-- +2.35.3 + diff --git a/patches.suse/net-sched-cls_api-Fix-flow-action-initialization.patch b/patches.suse/net-sched-cls_api-Fix-flow-action-initialization.patch new file mode 100644 index 0000000..4e839d7 --- /dev/null +++ b/patches.suse/net-sched-cls_api-Fix-flow-action-initialization.patch @@ -0,0 +1,72 @@ +From c0f47c2822aadeb8b2829f3e4c3792f184c7be33 Mon Sep 17 00:00:00 2001 +From: Oz Shlomo +Date: Tue, 19 Jul 2022 15:24:09 +0300 +Subject: [PATCH] net/sched: cls_api: Fix flow action initialization +Git-commit: c0f47c2822aadeb8b2829f3e4c3792f184c7be33 +Patch-mainline: v5.19-rc8 +References: bsc#1207361 + +The cited commit refactored the flow action initialization sequence to +use an interface method when translating tc action instances to flow +offload objects. The refactored version skips the initialization of the +generic flow action attributes for tc actions, such as pedit, that allocate +more than one offload entry. This can cause potential issues for drivers +mapping flow action ids. + +Populate the generic flow action fields for all the flow action entries. + +Fixes: c54e1d920f04 ("flow_offload: add ops to tc_action_ops for flow action setup") +Signed-off-by: Oz Shlomo +Reviewed-by: Roi Dayan + +---- +v1 -> v2: + - coalese the generic flow action fields initialization to a single loop +Reviewed-by: Baowen Zheng + +Signed-off-by: David S. Miller +Signed-off-by: Jiri Wiesner +--- + net/sched/cls_api.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c +index 9bb4d3dcc994..ac366c99086f 100644 +--- a/net/sched/cls_api.c ++++ b/net/sched/cls_api.c +@@ -3533,7 +3533,7 @@ int tc_setup_action(struct flow_action *flow_action, + struct tc_action *actions[], + struct netlink_ext_ack *extack) + { +- int i, j, index, err = 0; ++ int i, j, k, index, err = 0; + struct tc_action *act; + + BUILD_BUG_ON(TCA_ACT_HW_STATS_ANY != FLOW_ACTION_HW_STATS_ANY); +@@ -3553,14 +3553,18 @@ int tc_setup_action(struct flow_action *flow_action, + if (err) + goto err_out_locked; + +- entry->hw_stats = tc_act_hw_stats(act->hw_stats); +- entry->hw_index = act->tcfa_index; + index = 0; + err = tc_setup_offload_act(act, entry, &index, extack); +- if (!err) +- j += index; +- else ++ if (err) + goto err_out_locked; ++ ++ for (k = 0; k < index ; k++) { ++ entry[k].hw_stats = tc_act_hw_stats(act->hw_stats); ++ entry[k].hw_index = act->tcfa_index; ++ } ++ ++ j += index; ++ + spin_unlock_bh(&act->tcfa_lock); + } + +-- +2.35.3 + diff --git a/patches.suse/net-sched-cls_u32-fix-possible-leak-in-u32_init_knod.patch b/patches.suse/net-sched-cls_u32-fix-possible-leak-in-u32_init_knod.patch new file mode 100644 index 0000000..c58e84d --- /dev/null +++ b/patches.suse/net-sched-cls_u32-fix-possible-leak-in-u32_init_knod.patch @@ -0,0 +1,56 @@ +From ec5b0f605b105457f257f2870acad4a5d463984b Mon Sep 17 00:00:00 2001 +From: Eric Dumazet +Date: Wed, 13 Apr 2022 10:35:42 -0700 +Subject: [PATCH] net/sched: cls_u32: fix possible leak in u32_init_knode() +Git-commit: ec5b0f605b105457f257f2870acad4a5d463984b +Patch-mainline: v5.18-rc4 +References: bsc#1207361 + +While investigating a related syzbot report, +I found that whenever call to tcf_exts_init() +from u32_init_knode() is failing, we end up +with an elevated refcount on ht->refcnt + +To avoid that, only increase the refcount after +all possible errors have been evaluated. + +Fixes: b9a24bb76bf6 ("net_sched: properly handle failure case of tcf_exts_init()") +Signed-off-by: Eric Dumazet +Cc: Cong Wang +Cc: Jiri Pirko +Acked-by: Jamal Hadi Salim +Signed-off-by: Jakub Kicinski +Signed-off-by: Jiri Wiesner +--- + net/sched/cls_u32.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c +index fcba6c43ba50..4d27300c287c 100644 +--- a/net/sched/cls_u32.c ++++ b/net/sched/cls_u32.c +@@ -815,10 +815,6 @@ static struct tc_u_knode *u32_init_knode(struct net *net, struct tcf_proto *tp, + new->flags = n->flags; + RCU_INIT_POINTER(new->ht_down, ht); + +- /* bump reference count as long as we hold pointer to structure */ +- if (ht) +- ht->refcnt++; +- + #ifdef CONFIG_CLS_U32_PERF + /* Statistics may be incremented by readers during update + * so we must keep them in tact. When the node is later destroyed +@@ -840,6 +836,10 @@ static struct tc_u_knode *u32_init_knode(struct net *net, struct tcf_proto *tp, + return NULL; + } + ++ /* bump reference count as long as we hold pointer to structure */ ++ if (ht) ++ ht->refcnt++; ++ + return new; + } + +-- +2.35.3 + diff --git a/patches.suse/net-sched-fix-incorrect-vlan_push_eth-dest-field.patch b/patches.suse/net-sched-fix-incorrect-vlan_push_eth-dest-field.patch new file mode 100644 index 0000000..84426f6 --- /dev/null +++ b/patches.suse/net-sched-fix-incorrect-vlan_push_eth-dest-field.patch @@ -0,0 +1,37 @@ +From 054d5575cd6ed2792611a7cbb8c88663cc873780 Mon Sep 17 00:00:00 2001 +From: Louis Peens +Date: Wed, 23 Mar 2022 11:25:06 +0200 +Subject: [PATCH] net/sched: fix incorrect vlan_push_eth dest field +Git-commit: 054d5575cd6ed2792611a7cbb8c88663cc873780 +Patch-mainline: v5.18-rc1 +References: bsc#1207361 + +Seems like a potential copy-paste bug slipped in here, +the second memcpy should of course be populating src +and not dest. + +Fixes: ab95465cde23 ("net/sched: add vlan push_eth and pop_eth action to the hardware IR") +Signed-off-by: Louis Peens +Link: https://lore.kernel.org/r/20220323092506.21639-1-louis.peens@corigine.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Jiri Wiesner +--- + include/net/tc_act/tc_vlan.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/net/tc_act/tc_vlan.h b/include/net/tc_act/tc_vlan.h +index a97600f742de..904eddfc1826 100644 +--- a/include/net/tc_act/tc_vlan.h ++++ b/include/net/tc_act/tc_vlan.h +@@ -84,7 +84,7 @@ static inline void tcf_vlan_push_eth(unsigned char *src, unsigned char *dest, + { + rcu_read_lock(); + memcpy(dest, rcu_dereference(to_vlan(a)->vlan_p)->tcfv_push_dst, ETH_ALEN); +- memcpy(dest, rcu_dereference(to_vlan(a)->vlan_p)->tcfv_push_src, ETH_ALEN); ++ memcpy(src, rcu_dereference(to_vlan(a)->vlan_p)->tcfv_push_src, ETH_ALEN); + rcu_read_unlock(); + } + +-- +2.35.3 + diff --git a/patches.suse/net-sched-fix-initialization-order-when-updating-cha.patch b/patches.suse/net-sched-fix-initialization-order-when-updating-cha.patch new file mode 100644 index 0000000..fbb2447 --- /dev/null +++ b/patches.suse/net-sched-fix-initialization-order-when-updating-cha.patch @@ -0,0 +1,66 @@ +From e65812fd22eba32f11abe28cb377cbd64cfb1ba0 Mon Sep 17 00:00:00 2001 +From: Marcelo Ricardo Leitner +Date: Thu, 7 Apr 2022 11:29:23 -0300 +Subject: [PATCH] net/sched: fix initialization order when updating chain 0 + head +Git-commit: e65812fd22eba32f11abe28cb377cbd64cfb1ba0 +Patch-mainline: v5.18-rc3 +References: bsc#1207361 + +Currently, when inserting a new filter that needs to sit at the head +of chain 0, it will first update the heads pointer on all devices using +the (shared) block, and only then complete the initialization of the new +element so that it has a "next" element. + +This can lead to a situation that the chain 0 head is propagated to +another CPU before the "next" initialization is done. When this race +condition is triggered, packets being matched on that CPU will simply +miss all other filters, and will flow through the stack as if there were +no other filters installed. If the system is using OVS + TC, such +packets will get handled by vswitchd via upcall, which results in much +higher latency and reordering. For other applications it may result in +packet drops. + +This is reproducible with a tc only setup, but it varies from system to +system. It could be reproduced with a shared block amongst 10 veth +tunnels, and an ingress filter mirroring packets to another veth. +That's because using the last added veth tunnel to the shared block to +do the actual traffic, it makes the race window bigger and easier to +trigger. + +The fix is rather simple, to just initialize the next pointer of the new +filter instance (tp) before propagating the head change. + +The fixes tag is pointing to the original code though this issue should +only be observed when using it unlocked. + +Fixes: 2190d1d0944f ("net: sched: introduce helpers to work with filter chains") +Signed-off-by: Marcelo Ricardo Leitner +Signed-off-by: Vlad Buslov +Reviewed-by: Davide Caratti +Link: https://lore.kernel.org/r/b97d5f4eaffeeb9d058155bcab63347527261abf.1649341369.git.marcelo.leitner@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Jiri Wiesner +--- + net/sched/cls_api.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c +index 2957f8f5cea7..f0699f39afdb 100644 +--- a/net/sched/cls_api.c ++++ b/net/sched/cls_api.c +@@ -1672,10 +1672,10 @@ static int tcf_chain_tp_insert(struct tcf_chain *chain, + if (chain->flushing) + return -EAGAIN; + ++ RCU_INIT_POINTER(tp->next, tcf_chain_tp_prev(chain, chain_info)); + if (*chain_info->pprev == chain->filter_chain) + tcf_chain0_head_change(chain, tp); + tcf_proto_get(tp); +- RCU_INIT_POINTER(tp->next, tcf_chain_tp_prev(chain, chain_info)); + rcu_assign_pointer(*chain_info->pprev, tp); + + return 0; +-- +2.35.3 + diff --git a/patches.suse/net-sched-fix-memory-leak-in-tcindex_set_parms.patch b/patches.suse/net-sched-fix-memory-leak-in-tcindex_set_parms.patch new file mode 100644 index 0000000..de69629 --- /dev/null +++ b/patches.suse/net-sched-fix-memory-leak-in-tcindex_set_parms.patch @@ -0,0 +1,149 @@ +From 399ab7fe0fa0d846881685fd4e57e9a8ef7559f7 Mon Sep 17 00:00:00 2001 +From: Hawkins Jiawei +Date: Thu, 22 Dec 2022 11:51:19 +0800 +Subject: [PATCH] net: sched: fix memory leak in tcindex_set_parms +Git-commit: 399ab7fe0fa0d846881685fd4e57e9a8ef7559f7 +Patch-mainline: v6.2-rc3 +References: bsc#1207361 + +Syzkaller reports a memory leak as follows: +==================================== +BUG: memory leak +unreferenced object 0xffff88810c287f00 (size 256): + comm "syz-executor105", pid 3600, jiffies 4294943292 (age 12.990s) + hex dump (first 32 bytes): + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + backtrace: + [] kmalloc_trace+0x20/0x90 mm/slab_common.c:1046 + [] kmalloc include/linux/slab.h:576 [inline] + [] kmalloc_array include/linux/slab.h:627 [inline] + [] kcalloc include/linux/slab.h:659 [inline] + [] tcf_exts_init include/net/pkt_cls.h:250 [inline] + [] tcindex_set_parms+0xa7/0xbe0 net/sched/cls_tcindex.c:342 + [] tcindex_change+0xdf/0x120 net/sched/cls_tcindex.c:553 + [] tc_new_tfilter+0x4f2/0x1100 net/sched/cls_api.c:2147 + [] rtnetlink_rcv_msg+0x4dc/0x5d0 net/core/rtnetlink.c:6082 + [] netlink_rcv_skb+0x87/0x1d0 net/netlink/af_netlink.c:2540 + [] netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] + [] netlink_unicast+0x397/0x4c0 net/netlink/af_netlink.c:1345 + [] netlink_sendmsg+0x396/0x710 net/netlink/af_netlink.c:1921 + [] sock_sendmsg_nosec net/socket.c:714 [inline] + [] sock_sendmsg+0x56/0x80 net/socket.c:734 + [] ____sys_sendmsg+0x178/0x410 net/socket.c:2482 + [] ___sys_sendmsg+0xa8/0x110 net/socket.c:2536 + [] __sys_sendmmsg+0x105/0x330 net/socket.c:2622 + [] __do_sys_sendmmsg net/socket.c:2651 [inline] + [] __se_sys_sendmmsg net/socket.c:2648 [inline] + [] __x64_sys_sendmmsg+0x24/0x30 net/socket.c:2648 + [] do_syscall_x64 arch/x86/entry/common.c:50 [inline] + [] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 + [] entry_SYSCALL_64_after_hwframe+0x63/0xcd +==================================== + +Kernel uses tcindex_change() to change an existing +filter properties. + +Yet the problem is that, during the process of changing, +if `old_r` is retrieved from `p->perfect`, then +kernel uses tcindex_alloc_perfect_hash() to newly +allocate filter results, uses tcindex_filter_result_init() +to clear the old filter result, without destroying +its tcf_exts structure, which triggers the above memory leak. + +To be more specific, there are only two source for the `old_r`, +according to the tcindex_lookup(). `old_r` is retrieved from +`p->perfect`, or `old_r` is retrieved from `p->h`. + + * If `old_r` is retrieved from `p->perfect`, kernel uses +tcindex_alloc_perfect_hash() to newly allocate the +filter results. Then `r` is assigned with `cp->perfect + handle`, +which is newly allocated. So condition `old_r && old_r != r` is +true in this situation, and kernel uses tcindex_filter_result_init() +to clear the old filter result, without destroying +its tcf_exts structure + + * If `old_r` is retrieved from `p->h`, then `p->perfect` is NULL +according to the tcindex_lookup(). Considering that `cp->h` +is directly copied from `p->h` and `p->perfect` is NULL, +`r` is assigned with `tcindex_lookup(cp, handle)`, whose value +should be the same as `old_r`, so condition `old_r && old_r != r` +is false in this situation, kernel ignores using +tcindex_filter_result_init() to clear the old filter result. + +So only when `old_r` is retrieved from `p->perfect` does kernel use +tcindex_filter_result_init() to clear the old filter result, which +triggers the above memory leak. + +Considering that there already exists a tc_filter_wq workqueue +to destroy the old tcindex_data by tcindex_partial_destroy_work() +at the end of tcindex_set_parms(), this patch solves +this memory leak bug by removing this old filter result +clearing part and delegating it to the tc_filter_wq workqueue. + +Note that this patch doesn't introduce any other issues. If +`old_r` is retrieved from `p->perfect`, this patch just +delegates old filter result clearing part to the +tc_filter_wq workqueue; If `old_r` is retrieved from `p->h`, +kernel doesn't reach the old filter result clearing part, so +removing this part has no effect. + +[Thanks to the suggestion from Jakub Kicinski, Cong Wang, Paolo Abeni +and Dmitry Vyukov] + +Fixes: b9a24bb76bf6 ("net_sched: properly handle failure case of tcf_exts_init()") +Link: https://lore.kernel.org/all/0000000000001de5c505ebc9ec59@google.com/ +Reported-by: syzbot+232ebdbd36706c965ebf@syzkaller.appspotmail.com +Tested-by: syzbot+232ebdbd36706c965ebf@syzkaller.appspotmail.com +Cc: Cong Wang +Cc: Jakub Kicinski +Cc: Paolo Abeni +Cc: Dmitry Vyukov +Acked-by: Paolo Abeni +Signed-off-by: Hawkins Jiawei +Signed-off-by: David S. Miller +Signed-off-by: Jiri Wiesner +--- + net/sched/cls_tcindex.c | 12 ++---------- + 1 file changed, 2 insertions(+), 10 deletions(-) + +diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c +index eb0e9458e722..ee2a050c887b 100644 +--- a/net/sched/cls_tcindex.c ++++ b/net/sched/cls_tcindex.c +@@ -333,7 +333,7 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base, + struct tcindex_filter_result *r, struct nlattr **tb, + struct nlattr *est, u32 flags, struct netlink_ext_ack *extack) + { +- struct tcindex_filter_result new_filter_result, *old_r = r; ++ struct tcindex_filter_result new_filter_result; + struct tcindex_data *cp = NULL, *oldp; + struct tcindex_filter *f = NULL; /* make gcc behave */ + struct tcf_result cr = {}; +@@ -402,7 +402,7 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base, + err = tcindex_filter_result_init(&new_filter_result, cp, net); + if (err < 0) + goto errout_alloc; +- if (old_r) ++ if (r) + cr = r->res; + + err = -EBUSY; +@@ -479,14 +479,6 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base, + tcf_bind_filter(tp, &cr, base); + } + +- if (old_r && old_r != r) { +- err = tcindex_filter_result_init(old_r, cp, net); +- if (err < 0) { +- kfree(f); +- goto errout_alloc; +- } +- } +- + oldp = p; + r->res = cr; + tcf_exts_change(&r->exts, &e); +-- +2.35.3 + diff --git a/patches.suse/net-sched-fix-misuse-of-qcpu-backlog-in-gnet_stats_a.patch b/patches.suse/net-sched-fix-misuse-of-qcpu-backlog-in-gnet_stats_a.patch new file mode 100644 index 0000000..96de35b --- /dev/null +++ b/patches.suse/net-sched-fix-misuse-of-qcpu-backlog-in-gnet_stats_a.patch @@ -0,0 +1,37 @@ +From de64b6b6fb6f369840d171b7c5a9baf31b8b2630 Mon Sep 17 00:00:00 2001 +From: Zhengchao Shao +Date: Mon, 15 Aug 2022 11:08:48 +0800 +Subject: [PATCH] net: sched: fix misuse of qcpu->backlog in + gnet_stats_add_queue_cpu +Git-commit: de64b6b6fb6f369840d171b7c5a9baf31b8b2630 +Patch-mainline: v6.0-rc2 +References: bsc#1207361 + +In the gnet_stats_add_queue_cpu function, the qstats->qlen statistics +are incorrectly set to qcpu->backlog. + +Fixes: 448e163f8b9b ("gen_stats: Add gnet_stats_add_queue()") +Signed-off-by: Zhengchao Shao +Link: https://lore.kernel.org/r/20220815030848.276746-1-shaozhengchao@huawei.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Jiri Wiesner +--- + net/core/gen_stats.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c +index a10335b4ba2d..c8d137ef5980 100644 +--- a/net/core/gen_stats.c ++++ b/net/core/gen_stats.c +@@ -345,7 +345,7 @@ static void gnet_stats_add_queue_cpu(struct gnet_stats_queue *qstats, + for_each_possible_cpu(i) { + const struct gnet_stats_queue *qcpu = per_cpu_ptr(q, i); + +- qstats->qlen += qcpu->backlog; ++ qstats->qlen += qcpu->qlen; + qstats->backlog += qcpu->backlog; + qstats->drops += qcpu->drops; + qstats->requeues += qcpu->requeues; +-- +2.35.3 + diff --git a/patches.suse/net-sched-fix-netdevice-reference-leaks-in-attach_de.patch b/patches.suse/net-sched-fix-netdevice-reference-leaks-in-attach_de.patch new file mode 100644 index 0000000..5fdff50 --- /dev/null +++ b/patches.suse/net-sched-fix-netdevice-reference-leaks-in-attach_de.patch @@ -0,0 +1,111 @@ +From f612466ebecb12a00d9152344ddda6f6345f04dc Mon Sep 17 00:00:00 2001 +From: Wang Hai +Date: Fri, 26 Aug 2022 17:00:55 +0800 +Subject: [PATCH] net/sched: fix netdevice reference leaks in + attach_default_qdiscs() +Git-commit: f612466ebecb12a00d9152344ddda6f6345f04dc +Patch-mainline: v6.0-rc4 +References: bsc#1207361 + +In attach_default_qdiscs(), if a dev has multiple queues and queue 0 fails +to attach qdisc because there is no memory in attach_one_default_qdisc(). +Then dev->qdisc will be noop_qdisc by default. But the other queues may be +able to successfully attach to default qdisc. + +In this case, the fallback to noqueue process will be triggered. If the +original attached qdisc is not released and a new one is directly +attached, this will cause netdevice reference leaks. + +The following is the bug log: + +veth0: default qdisc (fq_codel) fail, fallback to noqueue +unregister_netdevice: waiting for veth0 to become free. Usage count = 32 +leaked reference. + qdisc_alloc+0x12e/0x210 + qdisc_create_dflt+0x62/0x140 + attach_one_default_qdisc.constprop.41+0x44/0x70 + dev_activate+0x128/0x290 + __dev_open+0x12a/0x190 + __dev_change_flags+0x1a2/0x1f0 + dev_change_flags+0x23/0x60 + do_setlink+0x332/0x1150 + __rtnl_newlink+0x52f/0x8e0 + rtnl_newlink+0x43/0x70 + rtnetlink_rcv_msg+0x140/0x3b0 + netlink_rcv_skb+0x50/0x100 + netlink_unicast+0x1bb/0x290 + netlink_sendmsg+0x37c/0x4e0 + sock_sendmsg+0x5f/0x70 + ____sys_sendmsg+0x208/0x280 + +Fix this bug by clearing any non-noop qdiscs that may have been assigned +before trying to re-attach. + +Fixes: bf6dba76d278 ("net: sched: fallback to qdisc noqueue if default qdisc setup fail") +Signed-off-by: Wang Hai +Link: https://lore.kernel.org/r/20220826090055.24424-1-wanghai38@huawei.com +Signed-off-by: Paolo Abeni +Signed-off-by: Jiri Wiesner +--- + net/sched/sch_generic.c | 31 ++++++++++++++++--------------- + 1 file changed, 16 insertions(+), 15 deletions(-) + +diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c +index 99b697ad2b98..7a8ea03f673d 100644 +--- a/net/sched/sch_generic.c ++++ b/net/sched/sch_generic.c +@@ -1122,6 +1122,21 @@ struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue, + } + EXPORT_SYMBOL(dev_graft_qdisc); + ++static void shutdown_scheduler_queue(struct net_device *dev, ++ struct netdev_queue *dev_queue, ++ void *_qdisc_default) ++{ ++ struct Qdisc *qdisc = dev_queue->qdisc_sleeping; ++ struct Qdisc *qdisc_default = _qdisc_default; ++ ++ if (qdisc) { ++ rcu_assign_pointer(dev_queue->qdisc, qdisc_default); ++ dev_queue->qdisc_sleeping = qdisc_default; ++ ++ qdisc_put(qdisc); ++ } ++} ++ + static void attach_one_default_qdisc(struct net_device *dev, + struct netdev_queue *dev_queue, + void *_unused) +@@ -1169,6 +1184,7 @@ static void attach_default_qdiscs(struct net_device *dev) + if (qdisc == &noop_qdisc) { + netdev_warn(dev, "default qdisc (%s) fail, fallback to %s\n", + default_qdisc_ops->id, noqueue_qdisc_ops.id); ++ netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc); + dev->priv_flags |= IFF_NO_QUEUE; + netdev_for_each_tx_queue(dev, attach_one_default_qdisc, NULL); + qdisc = txq->qdisc_sleeping; +@@ -1447,21 +1463,6 @@ void dev_init_scheduler(struct net_device *dev) + timer_setup(&dev->watchdog_timer, dev_watchdog, 0); + } + +-static void shutdown_scheduler_queue(struct net_device *dev, +- struct netdev_queue *dev_queue, +- void *_qdisc_default) +-{ +- struct Qdisc *qdisc = dev_queue->qdisc_sleeping; +- struct Qdisc *qdisc_default = _qdisc_default; +- +- if (qdisc) { +- rcu_assign_pointer(dev_queue->qdisc, qdisc_default); +- dev_queue->qdisc_sleeping = qdisc_default; +- +- qdisc_put(qdisc); +- } +-} +- + void dev_shutdown(struct net_device *dev) + { + netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc); +-- +2.35.3 + diff --git a/patches.suse/net-sched-fix-possible-refcount-leak-in-tc_new_tfilt.patch b/patches.suse/net-sched-fix-possible-refcount-leak-in-tc_new_tfilt.patch new file mode 100644 index 0000000..63e2f4c --- /dev/null +++ b/patches.suse/net-sched-fix-possible-refcount-leak-in-tc_new_tfilt.patch @@ -0,0 +1,37 @@ +From c2e1cfefcac35e0eea229e148c8284088ce437b5 Mon Sep 17 00:00:00 2001 +From: Hangyu Hua +Date: Wed, 21 Sep 2022 17:27:34 +0800 +Subject: [PATCH] net: sched: fix possible refcount leak in tc_new_tfilter() +Git-commit: c2e1cfefcac35e0eea229e148c8284088ce437b5 +Patch-mainline: v6.0-rc7 +References: bsc#1207361 + +tfilter_put need to be called to put the refount got by tp->ops->get to +avoid possible refcount leak when chain->tmplt_ops != NULL and +chain->tmplt_ops != tp->ops. + +Fixes: 7d5509fa0d3d ("net: sched: extend proto ops with 'put' callback") +Signed-off-by: Hangyu Hua +Reviewed-by: Vlad Buslov +Link: https://lore.kernel.org/r/20220921092734.31700-1-hbh25y@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Jiri Wiesner +--- + net/sched/cls_api.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c +index 790d6809be81..51d175f3fbcb 100644 +--- a/net/sched/cls_api.c ++++ b/net/sched/cls_api.c +@@ -2137,6 +2137,7 @@ static int tc_new_tfilter(struct sk_buff *skb, struct nlmsghdr *n, + } + + if (chain->tmplt_ops && chain->tmplt_ops != tp->ops) { ++ tfilter_put(tp, fh); + NL_SET_ERR_MSG(extack, "Chain template is set to a different filter kind"); + err = -EINVAL; + goto errout; +-- +2.35.3 + diff --git a/patches.suse/net-sched-fix-race-condition-in-qdisc_graft.patch b/patches.suse/net-sched-fix-race-condition-in-qdisc_graft.patch new file mode 100644 index 0000000..ae79d41 --- /dev/null +++ b/patches.suse/net-sched-fix-race-condition-in-qdisc_graft.patch @@ -0,0 +1,264 @@ +From ebda44da44f6f309d302522b049f43d6f829f7aa Mon Sep 17 00:00:00 2001 +From: Eric Dumazet +Date: Tue, 18 Oct 2022 20:32:58 +0000 +Subject: [PATCH] net: sched: fix race condition in qdisc_graft() +Git-commit: ebda44da44f6f309d302522b049f43d6f829f7aa +Patch-mainline: v6.1-rc2 +References: bsc#1207361 + +We had one syzbot report [1] in syzbot queue for a while. +I was waiting for more occurrences and/or a repro but +Dmitry Vyukov spotted the issue right away. + + +qdisc_graft() drops reference to qdisc in notify_and_destroy +while it's still assigned to dev->qdisc + + +Indeed, RCU rules are clear when replacing a data structure. +The visible pointer (dev->qdisc in this case) must be updated +to the new object _before_ RCU grace period is started +(qdisc_put(old) in this case). + +[1] +BUG: KASAN: use-after-free in __tcf_qdisc_find.part.0+0xa3a/0xac0 net/sched/cls_api.c:1066 +Read of size 4 at addr ffff88802065e038 by task syz-executor.4/21027 + +CPU: 0 PID: 21027 Comm: syz-executor.4 Not tainted 6.0.0-rc3-syzkaller-00363-g7726d4c3e60b #0 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022 +Call Trace: + +__dump_stack lib/dump_stack.c:88 [inline] +dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 +print_address_description mm/kasan/report.c:317 [inline] +print_report.cold+0x2ba/0x719 mm/kasan/report.c:433 +kasan_report+0xb1/0x1e0 mm/kasan/report.c:495 +__tcf_qdisc_find.part.0+0xa3a/0xac0 net/sched/cls_api.c:1066 +__tcf_qdisc_find net/sched/cls_api.c:1051 [inline] +tc_new_tfilter+0x34f/0x2200 net/sched/cls_api.c:2018 +rtnetlink_rcv_msg+0x955/0xca0 net/core/rtnetlink.c:6081 +netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2501 +netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] +netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345 +netlink_sendmsg+0x917/0xe10 net/netlink/af_netlink.c:1921 +sock_sendmsg_nosec net/socket.c:714 [inline] +sock_sendmsg+0xcf/0x120 net/socket.c:734 +____sys_sendmsg+0x6eb/0x810 net/socket.c:2482 +___sys_sendmsg+0x110/0x1b0 net/socket.c:2536 +__sys_sendmsg+0xf3/0x1c0 net/socket.c:2565 +do_syscall_x64 arch/x86/entry/common.c:50 [inline] +do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 +entry_SYSCALL_64_after_hwframe+0x63/0xcd +RIP: 0033:0x7f5efaa89279 +Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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:00007f5efbc31168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e +RAX: ffffffffffffffda RBX: 00007f5efab9bf80 RCX: 00007f5efaa89279 +RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000000005 +RBP: 00007f5efaae32e9 R08: 0000000000000000 R09: 0000000000000000 +R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 +R13: 00007f5efb0cfb1f R14: 00007f5efbc31300 R15: 0000000000022000 + + +Allocated by task 21027: +kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 +kasan_set_track mm/kasan/common.c:45 [inline] +set_alloc_info mm/kasan/common.c:437 [inline] +____kasan_kmalloc mm/kasan/common.c:516 [inline] +____kasan_kmalloc mm/kasan/common.c:475 [inline] +__kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:525 +kmalloc_node include/linux/slab.h:623 [inline] +kzalloc_node include/linux/slab.h:744 [inline] +qdisc_alloc+0xb0/0xc50 net/sched/sch_generic.c:938 +qdisc_create_dflt+0x71/0x4a0 net/sched/sch_generic.c:997 +attach_one_default_qdisc net/sched/sch_generic.c:1152 [inline] +netdev_for_each_tx_queue include/linux/netdevice.h:2437 [inline] +attach_default_qdiscs net/sched/sch_generic.c:1170 [inline] +dev_activate+0x760/0xcd0 net/sched/sch_generic.c:1229 +__dev_open+0x393/0x4d0 net/core/dev.c:1441 +__dev_change_flags+0x583/0x750 net/core/dev.c:8556 +rtnl_configure_link+0xee/0x240 net/core/rtnetlink.c:3189 +rtnl_newlink_create net/core/rtnetlink.c:3371 [inline] +__rtnl_newlink+0x10b8/0x17e0 net/core/rtnetlink.c:3580 +rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3593 +rtnetlink_rcv_msg+0x43a/0xca0 net/core/rtnetlink.c:6090 +netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2501 +netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] +netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345 +netlink_sendmsg+0x917/0xe10 net/netlink/af_netlink.c:1921 +sock_sendmsg_nosec net/socket.c:714 [inline] +sock_sendmsg+0xcf/0x120 net/socket.c:734 +____sys_sendmsg+0x6eb/0x810 net/socket.c:2482 +___sys_sendmsg+0x110/0x1b0 net/socket.c:2536 +__sys_sendmsg+0xf3/0x1c0 net/socket.c:2565 +do_syscall_x64 arch/x86/entry/common.c:50 [inline] +do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 +entry_SYSCALL_64_after_hwframe+0x63/0xcd + +Freed by task 21020: +kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 +kasan_set_track+0x21/0x30 mm/kasan/common.c:45 +kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 +____kasan_slab_free mm/kasan/common.c:367 [inline] +____kasan_slab_free+0x166/0x1c0 mm/kasan/common.c:329 +kasan_slab_free include/linux/kasan.h:200 [inline] +slab_free_hook mm/slub.c:1754 [inline] +slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1780 +slab_free mm/slub.c:3534 [inline] +kfree+0xe2/0x580 mm/slub.c:4562 +rcu_do_batch kernel/rcu/tree.c:2245 [inline] +rcu_core+0x7b5/0x1890 kernel/rcu/tree.c:2505 +__do_softirq+0x1d3/0x9c6 kernel/softirq.c:571 + +Last potentially related work creation: +kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 +__kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 +call_rcu+0x99/0x790 kernel/rcu/tree.c:2793 +qdisc_put+0xcd/0xe0 net/sched/sch_generic.c:1083 +notify_and_destroy net/sched/sch_api.c:1012 [inline] +qdisc_graft+0xeb1/0x1270 net/sched/sch_api.c:1084 +tc_modify_qdisc+0xbb7/0x1a00 net/sched/sch_api.c:1671 +rtnetlink_rcv_msg+0x43a/0xca0 net/core/rtnetlink.c:6090 +netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2501 +netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] +netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345 +netlink_sendmsg+0x917/0xe10 net/netlink/af_netlink.c:1921 +sock_sendmsg_nosec net/socket.c:714 [inline] +sock_sendmsg+0xcf/0x120 net/socket.c:734 +____sys_sendmsg+0x6eb/0x810 net/socket.c:2482 +___sys_sendmsg+0x110/0x1b0 net/socket.c:2536 +__sys_sendmsg+0xf3/0x1c0 net/socket.c:2565 +do_syscall_x64 arch/x86/entry/common.c:50 [inline] +do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 +entry_SYSCALL_64_after_hwframe+0x63/0xcd + +Second to last potentially related work creation: +kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 +__kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 +kvfree_call_rcu+0x74/0x940 kernel/rcu/tree.c:3322 +neigh_destroy+0x431/0x630 net/core/neighbour.c:912 +neigh_release include/net/neighbour.h:454 [inline] +neigh_cleanup_and_release+0x1f8/0x330 net/core/neighbour.c:103 +neigh_del net/core/neighbour.c:225 [inline] +neigh_remove_one+0x37d/0x460 net/core/neighbour.c:246 +neigh_forced_gc net/core/neighbour.c:276 [inline] +neigh_alloc net/core/neighbour.c:447 [inline] +___neigh_create+0x18b5/0x29a0 net/core/neighbour.c:642 +ip6_finish_output2+0xfb8/0x1520 net/ipv6/ip6_output.c:125 +__ip6_finish_output net/ipv6/ip6_output.c:195 [inline] +ip6_finish_output+0x690/0x1160 net/ipv6/ip6_output.c:206 +NF_HOOK_COND include/linux/netfilter.h:296 [inline] +ip6_output+0x1ed/0x540 net/ipv6/ip6_output.c:227 +dst_output include/net/dst.h:451 [inline] +NF_HOOK include/linux/netfilter.h:307 [inline] +NF_HOOK include/linux/netfilter.h:301 [inline] +mld_sendpack+0xa09/0xe70 net/ipv6/mcast.c:1820 +mld_send_cr net/ipv6/mcast.c:2121 [inline] +mld_ifc_work+0x71c/0xdc0 net/ipv6/mcast.c:2653 +process_one_work+0x991/0x1610 kernel/workqueue.c:2289 +worker_thread+0x665/0x1080 kernel/workqueue.c:2436 +kthread+0x2e4/0x3a0 kernel/kthread.c:376 +ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 + +The buggy address belongs to the object at ffff88802065e000 +which belongs to the cache kmalloc-1k of size 1024 +The buggy address is located 56 bytes inside of +1024-byte region [ffff88802065e000, ffff88802065e400) + +The buggy address belongs to the physical page: +page:ffffea0000819600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x20658 +head:ffffea0000819600 order:3 compound_mapcount:0 compound_pincount:0 +flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) +raw: 00fff00000010200 0000000000000000 dead000000000001 ffff888011841dc0 +raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 +page dumped because: kasan: bad access detected +page_owner tracks the page as allocated +page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3523, tgid 3523 (sshd), ts 41495190986, free_ts 41417713212 +prep_new_page mm/page_alloc.c:2532 [inline] +get_page_from_freelist+0x109b/0x2ce0 mm/page_alloc.c:4283 +__alloc_pages+0x1c7/0x510 mm/page_alloc.c:5515 +alloc_pages+0x1a6/0x270 mm/mempolicy.c:2270 +alloc_slab_page mm/slub.c:1824 [inline] +allocate_slab+0x27e/0x3d0 mm/slub.c:1969 +new_slab mm/slub.c:2029 [inline] +___slab_alloc+0x7f1/0xe10 mm/slub.c:3031 +__slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3118 +slab_alloc_node mm/slub.c:3209 [inline] +__kmalloc_node_track_caller+0x2f2/0x380 mm/slub.c:4955 +kmalloc_reserve net/core/skbuff.c:358 [inline] +__alloc_skb+0xd9/0x2f0 net/core/skbuff.c:430 +alloc_skb_fclone include/linux/skbuff.h:1307 [inline] +tcp_stream_alloc_skb+0x38/0x580 net/ipv4/tcp.c:861 +tcp_sendmsg_locked+0xc36/0x2f80 net/ipv4/tcp.c:1325 +tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1483 +inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:819 +sock_sendmsg_nosec net/socket.c:714 [inline] +sock_sendmsg+0xcf/0x120 net/socket.c:734 +sock_write_iter+0x291/0x3d0 net/socket.c:1108 +call_write_iter include/linux/fs.h:2187 [inline] +new_sync_write fs/read_write.c:491 [inline] +vfs_write+0x9e9/0xdd0 fs/read_write.c:578 +ksys_write+0x1e8/0x250 fs/read_write.c:631 +page last free stack trace: +reset_page_owner include/linux/page_owner.h:24 [inline] +free_pages_prepare mm/page_alloc.c:1449 [inline] +free_pcp_prepare+0x5e4/0xd20 mm/page_alloc.c:1499 +free_unref_page_prepare mm/page_alloc.c:3380 [inline] +free_unref_page+0x19/0x4d0 mm/page_alloc.c:3476 +__unfreeze_partials+0x17c/0x1a0 mm/slub.c:2548 +qlink_free mm/kasan/quarantine.c:168 [inline] +qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 +kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294 +__kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:447 +kasan_slab_alloc include/linux/kasan.h:224 [inline] +slab_post_alloc_hook mm/slab.h:727 [inline] +slab_alloc_node mm/slub.c:3243 [inline] +slab_alloc mm/slub.c:3251 [inline] +__kmem_cache_alloc_lru mm/slub.c:3258 [inline] +kmem_cache_alloc+0x267/0x3b0 mm/slub.c:3268 +kmem_cache_zalloc include/linux/slab.h:723 [inline] +alloc_buffer_head+0x20/0x140 fs/buffer.c:2974 +alloc_page_buffers+0x280/0x790 fs/buffer.c:829 +create_empty_buffers+0x2c/0xee0 fs/buffer.c:1558 +ext4_block_write_begin+0x1004/0x1530 fs/ext4/inode.c:1074 +ext4_da_write_begin+0x422/0xae0 fs/ext4/inode.c:2996 +generic_perform_write+0x246/0x560 mm/filemap.c:3738 +ext4_buffered_write_iter+0x15b/0x460 fs/ext4/file.c:270 +ext4_file_write_iter+0x44a/0x1660 fs/ext4/file.c:679 +call_write_iter include/linux/fs.h:2187 [inline] +new_sync_write fs/read_write.c:491 [inline] +vfs_write+0x9e9/0xdd0 fs/read_write.c:578 + +Fixes: af356afa010f ("net_sched: reintroduce dev->qdisc for use by sch_api") +Reported-by: syzbot +Diagnosed-by: Dmitry Vyukov +Signed-off-by: Eric Dumazet +Link: https://lore.kernel.org/r/20221018203258.2793282-1-edumazet@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Jiri Wiesner +--- + net/sched/sch_api.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c +index c98af0ada706..4a27dfb1ba0f 100644 +--- a/net/sched/sch_api.c ++++ b/net/sched/sch_api.c +@@ -1099,12 +1099,13 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, + + skip: + if (!ingress) { +- notify_and_destroy(net, skb, n, classid, +- rtnl_dereference(dev->qdisc), new); ++ old = rtnl_dereference(dev->qdisc); + if (new && !new->ops->attach) + qdisc_refcount_inc(new); + rcu_assign_pointer(dev->qdisc, new ? : &noop_qdisc); + ++ notify_and_destroy(net, skb, n, classid, old, new); ++ + if (new && new->ops->attach) + new->ops->attach(new); + } else { +-- +2.35.3 + diff --git a/patches.suse/net-sched-fixed-barrier-to-prevent-skbuff-sticking-i.patch b/patches.suse/net-sched-fixed-barrier-to-prevent-skbuff-sticking-i.patch new file mode 100644 index 0000000..30829b9 --- /dev/null +++ b/patches.suse/net-sched-fixed-barrier-to-prevent-skbuff-sticking-i.patch @@ -0,0 +1,140 @@ +From a54ce3703613e41fe1d98060b62ec09a3984dc28 Mon Sep 17 00:00:00 2001 +From: Vincent Ray +Date: Wed, 25 May 2022 17:17:46 -0700 +Subject: [PATCH] net: sched: fixed barrier to prevent skbuff sticking in qdisc + backlog +Git-commit: a54ce3703613e41fe1d98060b62ec09a3984dc28 +Patch-mainline: v5.19-rc1 +References: bsc#1207361 + +In qdisc_run_begin(), smp_mb__before_atomic() used before test_bit() +does not provide any ordering guarantee as test_bit() is not an atomic +operation. This, added to the fact that the spin_trylock() call at +the beginning of qdisc_run_begin() does not guarantee acquire +semantics if it does not grab the lock, makes it possible for the +following statement : + +if (test_bit(__QDISC_STATE_MISSED, &qdisc->state)) + +to be executed before an enqueue operation called before +qdisc_run_begin(). + +As a result the following race can happen : + + CPU 1 CPU 2 + + qdisc_run_begin() qdisc_run_begin() /* true */ + set(MISSED) . + /* returns false */ . + . /* sees MISSED = 1 */ + . /* so qdisc not empty */ + . __qdisc_run() + . . + . pfifo_fast_dequeue() + ----> /* may be done here */ . +| . clear(MISSED) +| . . +| . smp_mb __after_atomic(); +| . . +| . /* recheck the queue */ +| . /* nothing => exit */ +| enqueue(skb1) +| . +| qdisc_run_begin() +| . +| spin_trylock() /* fail */ +| . +| smp_mb__before_atomic() /* not enough */ +| . + ---- if (test_bit(MISSED)) + return false; /* exit */ + +In the above scenario, CPU 1 and CPU 2 both try to grab the +qdisc->seqlock at the same time. Only CPU 2 succeeds and enters the +bypass code path, where it emits its skb then calls __qdisc_run(). + +CPU1 fails, sets MISSED and goes down the traditionnal enqueue() + +dequeue() code path. But when executing qdisc_run_begin() for the +second time, after enqueuing its skbuff, it sees the MISSED bit still +set (by itself) and consequently chooses to exit early without setting +it again nor trying to grab the spinlock again. + +Meanwhile CPU2 has seen MISSED = 1, cleared it, checked the queue +and found it empty, so it returned. + +At the end of the sequence, we end up with skb1 enqueued in the +backlog, both CPUs out of __dev_xmit_skb(), the MISSED bit not set, +and no __netif_schedule() called made. skb1 will now linger in the +qdisc until somebody later performs a full __qdisc_run(). Associated +to the bypass capacity of the qdisc, and the ability of the TCP layer +to avoid resending packets which it knows are still in the qdisc, this +can lead to serious traffic "holes" in a TCP connection. + +We fix this by replacing the smp_mb__before_atomic() / test_bit() / +set_bit() / smp_mb__after_atomic() sequence inside qdisc_run_begin() +by a single test_and_set_bit() call, which is more concise and +enforces the needed memory barriers. + +Fixes: 89837eb4b246 ("net: sched: add barrier to ensure correct ordering for lockless qdisc") +Signed-off-by: Vincent Ray +Signed-off-by: Eric Dumazet +Link: https://lore.kernel.org/r/20220526001746.2437669-1-eric.dumazet@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Jiri Wiesner +--- + include/net/sch_generic.h | 36 ++++++++---------------------------- + 1 file changed, 8 insertions(+), 28 deletions(-) + +diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h +index 9bab396c1f3b..80973ce820f3 100644 +--- a/include/net/sch_generic.h ++++ b/include/net/sch_generic.h +@@ -187,37 +187,17 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc) + if (spin_trylock(&qdisc->seqlock)) + return true; + +- /* Paired with smp_mb__after_atomic() to make sure +- * STATE_MISSED checking is synchronized with clearing +- * in pfifo_fast_dequeue(). ++ /* No need to insist if the MISSED flag was already set. ++ * Note that test_and_set_bit() also gives us memory ordering ++ * guarantees wrt potential earlier enqueue() and below ++ * spin_trylock(), both of which are necessary to prevent races + */ +- smp_mb__before_atomic(); +- +- /* If the MISSED flag is set, it means other thread has +- * set the MISSED flag before second spin_trylock(), so +- * we can return false here to avoid multi cpus doing +- * the set_bit() and second spin_trylock() concurrently. +- */ +- if (test_bit(__QDISC_STATE_MISSED, &qdisc->state)) ++ if (test_and_set_bit(__QDISC_STATE_MISSED, &qdisc->state)) + return false; + +- /* Set the MISSED flag before the second spin_trylock(), +- * if the second spin_trylock() return false, it means +- * other cpu holding the lock will do dequeuing for us +- * or it will see the MISSED flag set after releasing +- * lock and reschedule the net_tx_action() to do the +- * dequeuing. +- */ +- set_bit(__QDISC_STATE_MISSED, &qdisc->state); +- +- /* spin_trylock() only has load-acquire semantic, so use +- * smp_mb__after_atomic() to ensure STATE_MISSED is set +- * before doing the second spin_trylock(). +- */ +- smp_mb__after_atomic(); +- +- /* Retry again in case other CPU may not see the new flag +- * after it releases the lock at the end of qdisc_run_end(). ++ /* Try to take the lock again to make sure that we will either ++ * grab it or the CPU that still has it will see MISSED set ++ * when testing it in qdisc_run_end() + */ + return spin_trylock(&qdisc->seqlock); + } +-- +2.35.3 + diff --git a/patches.suse/net-sched-fq_pie-prevent-dismantle-issue.patch b/patches.suse/net-sched-fq_pie-prevent-dismantle-issue.patch new file mode 100644 index 0000000..a28fb04 --- /dev/null +++ b/patches.suse/net-sched-fq_pie-prevent-dismantle-issue.patch @@ -0,0 +1,100 @@ +From 61c2402665f1e10c5742033fce18392e369931d7 Mon Sep 17 00:00:00 2001 +From: Eric Dumazet +Date: Thu, 9 Dec 2021 00:49:37 -0800 +Subject: [PATCH] net/sched: fq_pie: prevent dismantle issue +Git-commit: 61c2402665f1e10c5742033fce18392e369931d7 +Patch-mainline: v5.16-rc5 +References: bsc#1207361 + +For some reason, fq_pie_destroy() did not copy +working code from pie_destroy() and other qdiscs, +thus causing elusive bug. + +Before calling del_timer_sync(&q->adapt_timer), +we need to ensure timer will not rearm itself. + +rcu: INFO: rcu_preempt self-detected stall on CPU +rcu: 0-....: (4416 ticks this GP) idle=60d/1/0x4000000000000000 softirq=10433/10434 fqs=2579 + (t=10501 jiffies g=13085 q=3989) +NMI backtrace for cpu 0 +CPU: 0 PID: 13 Comm: ksoftirqd/0 Not tainted 5.16.0-rc4-syzkaller #0 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 +Call Trace: + + __dump_stack lib/dump_stack.c:88 [inline] + dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 + nmi_cpu_backtrace.cold+0x47/0x144 lib/nmi_backtrace.c:111 + nmi_trigger_cpumask_backtrace+0x1b3/0x230 lib/nmi_backtrace.c:62 + trigger_single_cpu_backtrace include/linux/nmi.h:164 [inline] + rcu_dump_cpu_stacks+0x25e/0x3f0 kernel/rcu/tree_stall.h:343 + print_cpu_stall kernel/rcu/tree_stall.h:627 [inline] + check_cpu_stall kernel/rcu/tree_stall.h:711 [inline] + rcu_pending kernel/rcu/tree.c:3878 [inline] + rcu_sched_clock_irq.cold+0x9d/0x746 kernel/rcu/tree.c:2597 + update_process_times+0x16d/0x200 kernel/time/timer.c:1785 + tick_sched_handle+0x9b/0x180 kernel/time/tick-sched.c:226 + tick_sched_timer+0x1b0/0x2d0 kernel/time/tick-sched.c:1428 + __run_hrtimer kernel/time/hrtimer.c:1685 [inline] + __hrtimer_run_queues+0x1c0/0xe50 kernel/time/hrtimer.c:1749 + hrtimer_interrupt+0x31c/0x790 kernel/time/hrtimer.c:1811 + local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1086 [inline] + __sysvec_apic_timer_interrupt+0x146/0x530 arch/x86/kernel/apic/apic.c:1103 + sysvec_apic_timer_interrupt+0x8e/0xc0 arch/x86/kernel/apic/apic.c:1097 + + + asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:638 +RIP: 0010:write_comp_data kernel/kcov.c:221 [inline] +RIP: 0010:__sanitizer_cov_trace_const_cmp1+0x1d/0x80 kernel/kcov.c:273 +Code: 54 c8 20 48 89 10 c3 66 0f 1f 44 00 00 53 41 89 fb 41 89 f1 bf 03 00 00 00 65 48 8b 0c 25 40 70 02 00 48 89 ce 4c 8b 54 24 08 4e f7 ff ff 84 c0 74 51 48 8b 81 88 15 00 00 44 8b 81 84 15 00 +RSP: 0018:ffffc90000d27b28 EFLAGS: 00000246 +RAX: 0000000000000000 RBX: ffff888064bf1bf0 RCX: ffff888011928000 +RDX: ffff888011928000 RSI: ffff888011928000 RDI: 0000000000000003 +RBP: ffff888064bf1c28 R08: 0000000000000000 R09: 0000000000000000 +R10: ffffffff875d8295 R11: 0000000000000000 R12: 0000000000000000 +R13: ffff8880783dd300 R14: 0000000000000000 R15: 0000000000000000 + pie_calculate_probability+0x405/0x7c0 net/sched/sch_pie.c:418 + fq_pie_timer+0x170/0x2a0 net/sched/sch_fq_pie.c:383 + call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421 + expire_timers kernel/time/timer.c:1466 [inline] + __run_timers.part.0+0x675/0xa20 kernel/time/timer.c:1734 + __run_timers kernel/time/timer.c:1715 [inline] + run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1747 + __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 + run_ksoftirqd kernel/softirq.c:921 [inline] + run_ksoftirqd+0x2d/0x60 kernel/softirq.c:913 + smpboot_thread_fn+0x645/0x9c0 kernel/smpboot.c:164 + kthread+0x405/0x4f0 kernel/kthread.c:327 + ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 + + +Fixes: ec97ecf1ebe4 ("net: sched: add Flow Queue PIE packet scheduler") +Signed-off-by: Eric Dumazet +Reported-by: syzbot +Cc: Mohit P. Tahiliani +Cc: Sachin D. Patil +Cc: V. Saicharan +Cc: Mohit Bhasi +Cc: Leslie Monis +Cc: Gautam Ramakrishnan +Link: https://lore.kernel.org/r/20211209084937.3500020-1-eric.dumazet@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Jiri Wiesner +--- + net/sched/sch_fq_pie.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/net/sched/sch_fq_pie.c b/net/sched/sch_fq_pie.c +index 830f3559f727..d6aba6edd16e 100644 +--- a/net/sched/sch_fq_pie.c ++++ b/net/sched/sch_fq_pie.c +@@ -531,6 +531,7 @@ static void fq_pie_destroy(struct Qdisc *sch) + struct fq_pie_sched_data *q = qdisc_priv(sch); + + tcf_block_put(q->block); ++ q->p_params.tupdate = 0; + del_timer_sync(&q->adapt_timer); + kvfree(q->flows); + } +-- +2.35.3 + diff --git a/patches.suse/net-sched-sch_ets-don-t-peek-at-classes-beyond-nband.patch b/patches.suse/net-sched-sch_ets-don-t-peek-at-classes-beyond-nband.patch new file mode 100644 index 0000000..1944652 --- /dev/null +++ b/patches.suse/net-sched-sch_ets-don-t-peek-at-classes-beyond-nband.patch @@ -0,0 +1,100 @@ +From de6d25924c2a8c2988c6a385990cafbe742061bf Mon Sep 17 00:00:00 2001 +From: Davide Caratti +Date: Wed, 24 Nov 2021 17:14:40 +0100 +Subject: [PATCH] net/sched: sch_ets: don't peek at classes beyond 'nbands' +Git-commit: de6d25924c2a8c2988c6a385990cafbe742061bf +Patch-mainline: v5.16-rc3 +References: bsc#1207361 + +when the number of DRR classes decreases, the round-robin active list can +contain elements that have already been freed in ets_qdisc_change(). As a +consequence, it's possible to see a NULL dereference crash, caused by the +attempt to call cl->qdisc->ops->peek(cl->qdisc) when cl->qdisc is NULL: + + BUG: kernel NULL pointer dereference, address: 0000000000000018 + #PF: supervisor read access in kernel mode + #PF: error_code(0x0000) - not-present page + PGD 0 P4D 0 + Oops: 0000 [#1] PREEMPT SMP NOPTI + CPU: 1 PID: 910 Comm: mausezahn Not tainted 5.16.0-rc1+ #475 + Hardware name: Red Hat KVM, BIOS 1.11.1-4.module+el8.1.0+4066+0f1aadab 04/01/2014 + RIP: 0010:ets_qdisc_dequeue+0x129/0x2c0 [sch_ets] + Code: c5 01 41 39 ad e4 02 00 00 0f 87 18 ff ff ff 49 8b 85 c0 02 00 00 49 39 c4 0f 84 ba 00 00 00 49 8b ad c0 02 00 00 48 8b 7d 10 <48> 8b 47 18 48 8b 40 38 0f ae e8 ff d0 48 89 c3 48 85 c0 0f 84 9d + RSP: 0000:ffffbb36c0b5fdd8 EFLAGS: 00010287 + RAX: ffff956678efed30 RBX: 0000000000000000 RCX: 0000000000000000 + RDX: 0000000000000002 RSI: ffffffff9b938dc9 RDI: 0000000000000000 + RBP: ffff956678efed30 R08: e2f3207fe360129c R09: 0000000000000000 + R10: 0000000000000001 R11: 0000000000000001 R12: ffff956678efeac0 + R13: ffff956678efe800 R14: ffff956611545000 R15: ffff95667ac8f100 + FS: 00007f2aa9120740(0000) GS:ffff95667b800000(0000) knlGS:0000000000000000 + CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 + CR2: 0000000000000018 CR3: 000000011070c000 CR4: 0000000000350ee0 + Call Trace: + + qdisc_peek_dequeued+0x29/0x70 [sch_ets] + tbf_dequeue+0x22/0x260 [sch_tbf] + __qdisc_run+0x7f/0x630 + net_tx_action+0x290/0x4c0 + __do_softirq+0xee/0x4f8 + irq_exit_rcu+0xf4/0x130 + sysvec_apic_timer_interrupt+0x52/0xc0 + asm_sysvec_apic_timer_interrupt+0x12/0x20 + RIP: 0033:0x7f2aa7fc9ad4 + Code: b9 ff ff 48 8b 54 24 18 48 83 c4 08 48 89 ee 48 89 df 5b 5d e9 ed fc ff ff 0f 1f 00 66 2e 0f 1f 84 00 00 00 00 00 f3 0f 1e fa <53> 48 83 ec 10 48 8b 05 10 64 33 00 48 8b 00 48 85 c0 0f 85 84 00 + RSP: 002b:00007ffe5d33fab8 EFLAGS: 00000202 + RAX: 0000000000000002 RBX: 0000561f72c31460 RCX: 0000561f72c31720 + RDX: 0000000000000002 RSI: 0000561f72c31722 RDI: 0000561f72c31720 + RBP: 000000000000002a R08: 00007ffe5d33fa40 R09: 0000000000000014 + R10: 0000000000000000 R11: 0000000000000246 R12: 0000561f7187e380 + R13: 0000000000000000 R14: 0000000000000000 R15: 0000561f72c31460 + + Modules linked in: sch_ets sch_tbf dummy rfkill iTCO_wdt intel_rapl_msr iTCO_vendor_support intel_rapl_common joydev virtio_balloon lpc_ich i2c_i801 i2c_smbus pcspkr ip_tables xfs libcrc32c crct10dif_pclmul crc32_pclmul crc32c_intel ahci libahci ghash_clmulni_intel serio_raw libata virtio_blk virtio_console virtio_net net_failover failover sunrpc dm_mirror dm_region_hash dm_log dm_mod + CR2: 0000000000000018 + +Ensuring that 'alist' was never zeroed [1] was not sufficient, we need to +remove from the active list those elements that are no more SP nor DRR. + +[1] https://lore.kernel.org/netdev/60d274838bf09777f0371253416e8af71360bc08.1633609148.git.dcaratti@redhat.com/ + +v3: fix race between ets_qdisc_change() and ets_qdisc_dequeue() delisting + DRR classes beyond 'nbands' in ets_qdisc_change() with the qdisc lock + acquired, thanks to Cong Wang. + +v2: when a NULL qdisc is found in the DRR active list, try to dequeue skb + from the next list item. + +Reported-by: Hangbin Liu +Fixes: dcc68b4d8084 ("net: sch_ets: Add a new Qdisc") +Signed-off-by: Davide Caratti +Link: https://lore.kernel.org/r/7a5c496eed2d62241620bdbb83eb03fb9d571c99.1637762721.git.dcaratti@redhat.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Jiri Wiesner +--- + net/sched/sch_ets.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/net/sched/sch_ets.c b/net/sched/sch_ets.c +index 0eae9ff5edf6..e007fc75ef2f 100644 +--- a/net/sched/sch_ets.c ++++ b/net/sched/sch_ets.c +@@ -665,12 +665,14 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt, + q->classes[i].deficit = quanta[i]; + } + } ++ for (i = q->nbands; i < oldbands; i++) { ++ qdisc_tree_flush_backlog(q->classes[i].qdisc); ++ if (i >= q->nstrict) ++ list_del(&q->classes[i].alist); ++ } + q->nstrict = nstrict; + memcpy(q->prio2band, priomap, sizeof(priomap)); + +- for (i = q->nbands; i < oldbands; i++) +- qdisc_tree_flush_backlog(q->classes[i].qdisc); +- + for (i = 0; i < q->nbands; i++) + q->classes[i].quantum = quanta[i]; + +-- +2.35.3 + diff --git a/patches.suse/net-sched-sch_ets-don-t-remove-idle-classes-from-the.patch b/patches.suse/net-sched-sch_ets-don-t-remove-idle-classes-from-the.patch new file mode 100644 index 0000000..62e55a8 --- /dev/null +++ b/patches.suse/net-sched-sch_ets-don-t-remove-idle-classes-from-the.patch @@ -0,0 +1,108 @@ +From c062f2a0b04d86c5b8c9d973bea43493eaca3d32 Mon Sep 17 00:00:00 2001 +From: Davide Caratti +Date: Fri, 10 Dec 2021 17:42:47 +0100 +Subject: [PATCH] net/sched: sch_ets: don't remove idle classes from the + round-robin list +Git-commit: c062f2a0b04d86c5b8c9d973bea43493eaca3d32 +Patch-mainline: v5.16-rc6 +References: bsc#1207361 + +Shuang reported that the following script: + + 1) tc qdisc add dev ddd0 handle 10: parent 1: ets bands 8 strict 4 priomap 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 + 2) mausezahn ddd0 -A 10.10.10.1 -B 10.10.10.2 -c 0 -a own -b 00:c1:a0:c1:a0:00 -t udp & + 3) tc qdisc change dev ddd0 handle 10: ets bands 4 strict 2 quanta 2500 2500 priomap 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 + +crashes systematically when line 2) is commented: + + list_del corruption, ffff8e028404bd30->next is LIST_POISON1 (dead000000000100) + ------------[ cut here ]------------ + kernel BUG at lib/list_debug.c:47! + invalid opcode: 0000 [#1] PREEMPT SMP NOPTI + CPU: 0 PID: 954 Comm: tc Not tainted 5.16.0-rc4+ #478 + Hardware name: Red Hat KVM, BIOS 1.11.1-4.module+el8.1.0+4066+0f1aadab 04/01/2014 + RIP: 0010:__list_del_entry_valid.cold.1+0x12/0x47 + Code: fe ff 0f 0b 48 89 c1 4c 89 c6 48 c7 c7 08 42 1b 87 e8 1d c5 fe ff 0f 0b 48 89 fe 48 89 c2 48 c7 c7 98 42 1b 87 e8 09 c5 fe ff <0f> 0b 48 c7 c7 48 43 1b 87 e8 fb c4 fe ff 0f 0b 48 89 f2 48 89 fe + RSP: 0018:ffffae46807a3888 EFLAGS: 00010246 + RAX: 000000000000004e RBX: 0000000000000007 RCX: 0000000000000202 + RDX: 0000000000000000 RSI: ffffffff871ac536 RDI: 00000000ffffffff + RBP: ffffae46807a3a10 R08: 0000000000000000 R09: c0000000ffff7fff + R10: 0000000000000001 R11: ffffae46807a36a8 R12: ffff8e028404b800 + R13: ffff8e028404bd30 R14: dead000000000100 R15: ffff8e02fafa2400 + FS: 00007efdc92e4480(0000) GS:ffff8e02fb600000(0000) knlGS:0000000000000000 + CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 + CR2: 0000000000682f48 CR3: 00000001058be000 CR4: 0000000000350ef0 + Call Trace: + + ets_qdisc_change+0x58b/0xa70 [sch_ets] + tc_modify_qdisc+0x323/0x880 + rtnetlink_rcv_msg+0x169/0x4a0 + netlink_rcv_skb+0x50/0x100 + netlink_unicast+0x1a5/0x280 + netlink_sendmsg+0x257/0x4d0 + sock_sendmsg+0x5b/0x60 + ____sys_sendmsg+0x1f2/0x260 + ___sys_sendmsg+0x7c/0xc0 + __sys_sendmsg+0x57/0xa0 + do_syscall_64+0x3a/0x80 + entry_SYSCALL_64_after_hwframe+0x44/0xae + RIP: 0033:0x7efdc8031338 + Code: 89 02 48 c7 c0 ff ff ff ff eb b5 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8d 05 25 43 2c 00 8b 00 85 c0 75 17 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 41 89 d4 55 + RSP: 002b:00007ffdf1ce9828 EFLAGS: 00000246 ORIG_RAX: 000000000000002e + RAX: ffffffffffffffda RBX: 0000000061b37a97 RCX: 00007efdc8031338 + RDX: 0000000000000000 RSI: 00007ffdf1ce9890 RDI: 0000000000000003 + RBP: 0000000000000000 R08: 0000000000000001 R09: 000000000078a940 + R10: 000000000000000c R11: 0000000000000246 R12: 0000000000000001 + R13: 0000000000688880 R14: 0000000000000000 R15: 0000000000000000 + + Modules linked in: sch_ets sch_tbf dummy rfkill iTCO_wdt iTCO_vendor_support intel_rapl_msr intel_rapl_common joydev pcspkr i2c_i801 virtio_balloon i2c_smbus lpc_ich ip_tables xfs libcrc32c crct10dif_pclmul crc32_pclmul crc32c_intel serio_raw ghash_clmulni_intel ahci libahci libata virtio_blk virtio_console virtio_net net_failover failover sunrpc dm_mirror dm_region_hash dm_log dm_mod [last unloaded: sch_ets] + ---[ end trace f35878d1912655c2 ]--- + RIP: 0010:__list_del_entry_valid.cold.1+0x12/0x47 + Code: fe ff 0f 0b 48 89 c1 4c 89 c6 48 c7 c7 08 42 1b 87 e8 1d c5 fe ff 0f 0b 48 89 fe 48 89 c2 48 c7 c7 98 42 1b 87 e8 09 c5 fe ff <0f> 0b 48 c7 c7 48 43 1b 87 e8 fb c4 fe ff 0f 0b 48 89 f2 48 89 fe + RSP: 0018:ffffae46807a3888 EFLAGS: 00010246 + RAX: 000000000000004e RBX: 0000000000000007 RCX: 0000000000000202 + RDX: 0000000000000000 RSI: ffffffff871ac536 RDI: 00000000ffffffff + RBP: ffffae46807a3a10 R08: 0000000000000000 R09: c0000000ffff7fff + R10: 0000000000000001 R11: ffffae46807a36a8 R12: ffff8e028404b800 + R13: ffff8e028404bd30 R14: dead000000000100 R15: ffff8e02fafa2400 + FS: 00007efdc92e4480(0000) GS:ffff8e02fb600000(0000) knlGS:0000000000000000 + CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 + CR2: 0000000000682f48 CR3: 00000001058be000 CR4: 0000000000350ef0 + Kernel panic - not syncing: Fatal exception in interrupt + Kernel Offset: 0x4e00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff) + ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]--- + +we can remove 'q->classes[i].alist' only if DRR class 'i' was part of the +active list. In the ETS scheduler DRR classes belong to that list only if +the queue length is greater than zero: we need to test for non-zero value +of 'q->classes[i].qdisc->q.qlen' before removing from the list, similarly +to what has been done elsewhere in the ETS code. + +Fixes: de6d25924c2a ("net/sched: sch_ets: don't peek at classes beyond 'nbands'") +Reported-by: Shuang Li +Signed-off-by: Davide Caratti +Signed-off-by: David S. Miller +Signed-off-by: Jiri Wiesner +--- + net/sched/sch_ets.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/net/sched/sch_ets.c b/net/sched/sch_ets.c +index e007fc75ef2f..d73393493553 100644 +--- a/net/sched/sch_ets.c ++++ b/net/sched/sch_ets.c +@@ -666,9 +666,9 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt, + } + } + for (i = q->nbands; i < oldbands; i++) { +- qdisc_tree_flush_backlog(q->classes[i].qdisc); +- if (i >= q->nstrict) ++ if (i >= q->nstrict && q->classes[i].qdisc->q.qlen) + list_del(&q->classes[i].alist); ++ qdisc_tree_flush_backlog(q->classes[i].qdisc); + } + q->nstrict = nstrict; + memcpy(q->prio2band, priomap, sizeof(priomap)); +-- +2.35.3 + diff --git a/patches.suse/net-sched-sch_netem-Fix-arithmetic-in-netem_dump-for.patch b/patches.suse/net-sched-sch_netem-Fix-arithmetic-in-netem_dump-for.patch new file mode 100644 index 0000000..3fe6625 --- /dev/null +++ b/patches.suse/net-sched-sch_netem-Fix-arithmetic-in-netem_dump-for.patch @@ -0,0 +1,72 @@ +From a2b1a5d40bd12b44322c2ccd40bb0ec1699708b6 Mon Sep 17 00:00:00 2001 +From: Peilin Ye +Date: Thu, 16 Jun 2022 16:43:36 -0700 +Subject: [PATCH] net/sched: sch_netem: Fix arithmetic in netem_dump() for + 32-bit platforms +Git-commit: a2b1a5d40bd12b44322c2ccd40bb0ec1699708b6 +Patch-mainline: v5.19-rc4 +References: bsc#1207361 + +As reported by Yuming, currently tc always show a latency of UINT_MAX +for netem Qdisc's on 32-bit platforms: + + $ tc qdisc add dev dummy0 root netem latency 100ms + $ tc qdisc show dev dummy0 + qdisc netem 8001: root refcnt 2 limit 1000 delay 275s 275s + ^^^^^^^^^^^^^^^^ + +Let us take a closer look at netem_dump(): + + qopt.latency = min_t(psched_tdiff_t, PSCHED_NS2TICKS(q->latency, + UINT_MAX); + +qopt.latency is __u32, psched_tdiff_t is signed long, +(psched_tdiff_t)(UINT_MAX) is negative for 32-bit platforms, so +qopt.latency is always UINT_MAX. + +Fix it by using psched_time_t (u64) instead. + +Note: confusingly, users have two ways to specify 'latency': + + 1. normally, via '__u32 latency' in struct tc_netem_qopt; + 2. via the TCA_NETEM_LATENCY64 attribute, which is s64. + +For the second case, theoretically 'latency' could be negative. This +patch ignores that corner case, since it is broken (i.e. assigning a +negative s64 to __u32) anyways, and should be handled separately. + +Thanks Ted Lin for the analysis [1] . + +[1] https://github.com/raspberrypi/linux/issues/3512 + +Reported-by: Yuming Chen +Fixes: 112f9cb65643 ("netem: convert to qdisc_watchdog_schedule_ns") +Reviewed-by: Cong Wang +Signed-off-by: Peilin Ye +Acked-by: Stephen Hemminger +Link: https://lore.kernel.org/r/20220616234336.2443-1-yepeilin.cs@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Jiri Wiesner +--- + net/sched/sch_netem.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c +index ed4ccef5d6a8..5449ed114e40 100644 +--- a/net/sched/sch_netem.c ++++ b/net/sched/sch_netem.c +@@ -1146,9 +1146,9 @@ static int netem_dump(struct Qdisc *sch, struct sk_buff *skb) + struct tc_netem_rate rate; + struct tc_netem_slot slot; + +- qopt.latency = min_t(psched_tdiff_t, PSCHED_NS2TICKS(q->latency), ++ qopt.latency = min_t(psched_time_t, PSCHED_NS2TICKS(q->latency), + UINT_MAX); +- qopt.jitter = min_t(psched_tdiff_t, PSCHED_NS2TICKS(q->jitter), ++ qopt.jitter = min_t(psched_time_t, PSCHED_NS2TICKS(q->jitter), + UINT_MAX); + qopt.limit = q->limit; + qopt.loss = q->loss; +-- +2.35.3 + diff --git a/patches.suse/net-sched-sfb-fix-null-pointer-access-issue-when-sfb.patch b/patches.suse/net-sched-sfb-fix-null-pointer-access-issue-when-sfb.patch new file mode 100644 index 0000000..566bc72 --- /dev/null +++ b/patches.suse/net-sched-sfb-fix-null-pointer-access-issue-when-sfb.patch @@ -0,0 +1,76 @@ +From 2a3fc78210b9f0e85372a2435368962009f480fc Mon Sep 17 00:00:00 2001 +From: Zhengchao Shao +Date: Tue, 18 Oct 2022 14:32:01 +0800 +Subject: [PATCH] net: sched: sfb: fix null pointer access issue when + sfb_init() fails +Git-commit: 2a3fc78210b9f0e85372a2435368962009f480fc +Patch-mainline: v6.1-rc2 +References: bsc#1207361 + +When the default qdisc is sfb, if the qdisc of dev_queue fails to be +inited during mqprio_init(), sfb_reset() is invoked to clear resources. +In this case, the q->qdisc is NULL, and it will cause gpf issue. + +The process is as follows: +qdisc_create_dflt() + sfb_init() + tcf_block_get() --->failed, q->qdisc is NULL + ... + qdisc_put() + ... + sfb_reset() + qdisc_reset(q->qdisc) --->q->qdisc is NULL + ops = qdisc->ops + +The following is the Call Trace information: +general protection fault, probably for non-canonical address +0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN +KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f] +RIP: 0010:qdisc_reset+0x2b/0x6f0 +Call Trace: + +sfb_reset+0x37/0xd0 +qdisc_reset+0xed/0x6f0 +qdisc_destroy+0x82/0x4c0 +qdisc_put+0x9e/0xb0 +qdisc_create_dflt+0x2c3/0x4a0 +mqprio_init+0xa71/0x1760 +qdisc_create+0x3eb/0x1000 +tc_modify_qdisc+0x408/0x1720 +rtnetlink_rcv_msg+0x38e/0xac0 +netlink_rcv_skb+0x12d/0x3a0 +netlink_unicast+0x4a2/0x740 +netlink_sendmsg+0x826/0xcc0 +sock_sendmsg+0xc5/0x100 +____sys_sendmsg+0x583/0x690 +___sys_sendmsg+0xe8/0x160 +__sys_sendmsg+0xbf/0x160 +do_syscall_64+0x35/0x80 +entry_SYSCALL_64_after_hwframe+0x46/0xb0 +RIP: 0033:0x7f2164122d04 + + +Fixes: e13e02a3c68d ("net_sched: SFB flow scheduler") +Signed-off-by: Zhengchao Shao +Signed-off-by: David S. Miller +Signed-off-by: Jiri Wiesner +--- + net/sched/sch_sfb.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c +index e2389fa3cff8..73ae2e726512 100644 +--- a/net/sched/sch_sfb.c ++++ b/net/sched/sch_sfb.c +@@ -455,7 +455,8 @@ static void sfb_reset(struct Qdisc *sch) + { + struct sfb_sched_data *q = qdisc_priv(sch); + +- qdisc_reset(q->qdisc); ++ if (likely(q->qdisc)) ++ qdisc_reset(q->qdisc); + sch->qstats.backlog = 0; + sch->q.qlen = 0; + q->slot = 0; +-- +2.35.3 diff --git a/patches.suse/net-sched-taprio-Check-if-socket-flags-are-valid.patch b/patches.suse/net-sched-taprio-Check-if-socket-flags-are-valid.patch new file mode 100644 index 0000000..8507e43 --- /dev/null +++ b/patches.suse/net-sched-taprio-Check-if-socket-flags-are-valid.patch @@ -0,0 +1,47 @@ +From e8a64bbaaad1f6548cec5508297bc6d45e8ab69e Mon Sep 17 00:00:00 2001 +From: Benedikt Spranger +Date: Fri, 8 Apr 2022 11:47:45 +0200 +Subject: [PATCH] net/sched: taprio: Check if socket flags are valid +Git-commit: e8a64bbaaad1f6548cec5508297bc6d45e8ab69e +Patch-mainline: v5.18-rc3 +References: bsc#1207361 + +A user may set the SO_TXTIME socket option to ensure a packet is send +at a given time. The taprio scheduler has to confirm, that it is allowed +to send a packet at that given time, by a check against the packet time +schedule. The scheduler drop the packet, if the gates are closed at the +given send time. + +The check, if SO_TXTIME is set, may fail since sk_flags are part of an +union and the union is used otherwise. This happen, if a socket is not +a full socket, like a request socket for example. + +Add a check to verify, if the union is used for sk_flags. + +Fixes: 4cfd5779bd6e ("taprio: Add support for txtime-assist mode") +Signed-off-by: Benedikt Spranger +Reviewed-by: Kurt Kanzenbach +Acked-by: Vinicius Costa Gomes +Signed-off-by: David S. Miller +Signed-off-by: Jiri Wiesner +--- + net/sched/sch_taprio.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c +index 377f896bdedc..b9c71a304d39 100644 +--- a/net/sched/sch_taprio.c ++++ b/net/sched/sch_taprio.c +@@ -417,7 +417,8 @@ static int taprio_enqueue_one(struct sk_buff *skb, struct Qdisc *sch, + { + struct taprio_sched *q = qdisc_priv(sch); + +- if (skb->sk && sock_flag(skb->sk, SOCK_TXTIME)) { ++ /* sk_flags are only safe to use on full sockets. */ ++ if (skb->sk && sk_fullsock(skb->sk) && sock_flag(skb->sk, SOCK_TXTIME)) { + if (!is_valid_interval(skb, sch)) + return qdisc_drop(skb, sch, to_free); + } else if (TXTIME_ASSIST_IS_ENABLED(q->flags)) { +-- +2.35.3 + diff --git a/patches.suse/net-sched-taprio-avoid-disabling-offload-when-it-was.patch b/patches.suse/net-sched-taprio-avoid-disabling-offload-when-it-was.patch new file mode 100644 index 0000000..9459e86 --- /dev/null +++ b/patches.suse/net-sched-taprio-avoid-disabling-offload-when-it-was.patch @@ -0,0 +1,146 @@ +From db46e3a88a09c5cf7e505664d01da7238cd56c92 Mon Sep 17 00:00:00 2001 +From: Vladimir Oltean +Date: Thu, 15 Sep 2022 13:08:01 +0300 +Subject: [PATCH] net/sched: taprio: avoid disabling offload when it was never + enabled +Git-commit: db46e3a88a09c5cf7e505664d01da7238cd56c92 +Patch-mainline: v6.0-rc7 +References: bsc#1207361 + +In an incredibly strange API design decision, qdisc->destroy() gets +called even if qdisc->init() never succeeded, not exclusively since +commit 87b60cfacf9f ("net_sched: fix error recovery at qdisc creation"), +but apparently also earlier (in the case of qdisc_create_dflt()). + +The taprio qdisc does not fully acknowledge this when it attempts full +offload, because it starts off with q->flags = TAPRIO_FLAGS_INVALID in +taprio_init(), then it replaces q->flags with TCA_TAPRIO_ATTR_FLAGS +parsed from netlink (in taprio_change(), tail called from taprio_init()). + +But in taprio_destroy(), we call taprio_disable_offload(), and this +determines what to do based on FULL_OFFLOAD_IS_ENABLED(q->flags). + +But looking at the implementation of FULL_OFFLOAD_IS_ENABLED() +(a bitwise check of bit 1 in q->flags), it is invalid to call this macro +on q->flags when it contains TAPRIO_FLAGS_INVALID, because that is set +to U32_MAX, and therefore FULL_OFFLOAD_IS_ENABLED() will return true on +an invalid set of flags. + +As a result, it is possible to crash the kernel if user space forces an +error between setting q->flags = TAPRIO_FLAGS_INVALID, and the calling +of taprio_enable_offload(). This is because drivers do not expect the +offload to be disabled when it was never enabled. + +The error that we force here is to attach taprio as a non-root qdisc, +but instead as child of an mqprio root qdisc: + +$ tc qdisc add dev swp0 root handle 1: \ + mqprio num_tc 8 map 0 1 2 3 4 5 6 7 \ + queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 hw 0 +$ tc qdisc replace dev swp0 parent 1:1 \ + taprio num_tc 8 map 0 1 2 3 4 5 6 7 \ + queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 base-time 0 \ + sched-entry S 0x7f 990000 sched-entry S 0x80 100000 \ + flags 0x0 clockid CLOCK_TAI +Unable to handle kernel paging request at virtual address fffffffffffffff8 +[fffffffffffffff8] pgd=0000000000000000, p4d=0000000000000000 +Internal error: Oops: 96000004 [#1] PREEMPT SMP +Call trace: + taprio_dump+0x27c/0x310 + vsc9959_port_setup_tc+0x1f4/0x460 + felix_port_setup_tc+0x24/0x3c + dsa_slave_setup_tc+0x54/0x27c + taprio_disable_offload.isra.0+0x58/0xe0 + taprio_destroy+0x80/0x104 + qdisc_create+0x240/0x470 + tc_modify_qdisc+0x1fc/0x6b0 + rtnetlink_rcv_msg+0x12c/0x390 + netlink_rcv_skb+0x5c/0x130 + rtnetlink_rcv+0x1c/0x2c + +Fix this by keeping track of the operations we made, and undo the +offload only if we actually did it. + +I've added "bool offloaded" inside a 4 byte hole between "int clockid" +and "atomic64_t picos_per_byte". Now the first cache line looks like +below: + +$ pahole -C taprio_sched net/sched/sch_taprio.o +struct taprio_sched { + struct Qdisc * * qdiscs; /* 0 8 */ + struct Qdisc * root; /* 8 8 */ + u32 flags; /* 16 4 */ + enum tk_offsets tk_offset; /* 20 4 */ + int clockid; /* 24 4 */ + bool offloaded; /* 28 1 */ + + /* XXX 3 bytes hole, try to pack */ + + atomic64_t picos_per_byte; /* 32 0 */ + + /* XXX 8 bytes hole, try to pack */ + + spinlock_t current_entry_lock; /* 40 0 */ + + /* XXX 8 bytes hole, try to pack */ + + struct sched_entry * current_entry; /* 48 8 */ + struct sched_gate_list * oper_sched; /* 56 8 */ + /* --- cacheline 1 boundary (64 bytes) --- */ + +Fixes: 9c66d1564676 ("taprio: Add support for hardware offloading") +Signed-off-by: Vladimir Oltean +Reviewed-by: Vinicius Costa Gomes +Signed-off-by: Jakub Kicinski +Signed-off-by: Jiri Wiesner +--- + net/sched/sch_taprio.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c +index 0b941dd63d26..9bec73019f94 100644 +--- a/net/sched/sch_taprio.c ++++ b/net/sched/sch_taprio.c +@@ -67,6 +67,7 @@ struct taprio_sched { + u32 flags; + enum tk_offsets tk_offset; + int clockid; ++ bool offloaded; + atomic64_t picos_per_byte; /* Using picoseconds because for 10Gbps+ + * speeds it's sub-nanoseconds per byte + */ +@@ -1279,6 +1280,8 @@ static int taprio_enable_offload(struct net_device *dev, + goto done; + } + ++ q->offloaded = true; ++ + done: + taprio_offload_free(offload); + +@@ -1293,12 +1296,9 @@ static int taprio_disable_offload(struct net_device *dev, + struct tc_taprio_qopt_offload *offload; + int err; + +- if (!FULL_OFFLOAD_IS_ENABLED(q->flags)) ++ if (!q->offloaded) + return 0; + +- if (!ops->ndo_setup_tc) +- return -EOPNOTSUPP; +- + offload = taprio_offload_alloc(0); + if (!offload) { + NL_SET_ERR_MSG(extack, +@@ -1314,6 +1314,8 @@ static int taprio_disable_offload(struct net_device *dev, + goto out; + } + ++ q->offloaded = false; ++ + out: + taprio_offload_free(offload); + +-- +2.35.3 + diff --git a/patches.suse/net-sched-tbf-don-t-call-qdisc_put-while-holding-tre.patch b/patches.suse/net-sched-tbf-don-t-call-qdisc_put-while-holding-tre.patch new file mode 100644 index 0000000..06596bd --- /dev/null +++ b/patches.suse/net-sched-tbf-don-t-call-qdisc_put-while-holding-tre.patch @@ -0,0 +1,54 @@ +From b05972f01e7d30419987a1f221b5593668fd6448 Mon Sep 17 00:00:00 2001 +From: Zhengchao Shao +Date: Fri, 26 Aug 2022 09:39:30 +0800 +Subject: [PATCH] net: sched: tbf: don't call qdisc_put() while holding tree + lock +Git-commit: b05972f01e7d30419987a1f221b5593668fd6448 +Patch-mainline: v6.0-rc4 +References: bsc#1207361 + +The issue is the same to commit c2999f7fb05b ("net: sched: multiq: don't +call qdisc_put() while holding tree lock"). Qdiscs call qdisc_put() while +holding sch tree spinlock, which results sleeping-while-atomic BUG. + +Fixes: c266f64dbfa2 ("net: sched: protect block state with mutex") +Signed-off-by: Zhengchao Shao +Link: https://lore.kernel.org/r/20220826013930.340121-1-shaozhengchao@huawei.com +Signed-off-by: Paolo Abeni +Signed-off-by: Jiri Wiesner +--- + net/sched/sch_tbf.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c +index 72102277449e..36079fdde2cb 100644 +--- a/net/sched/sch_tbf.c ++++ b/net/sched/sch_tbf.c +@@ -356,6 +356,7 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt, + struct nlattr *tb[TCA_TBF_MAX + 1]; + struct tc_tbf_qopt *qopt; + struct Qdisc *child = NULL; ++ struct Qdisc *old = NULL; + struct psched_ratecfg rate; + struct psched_ratecfg peak; + u64 max_size; +@@ -447,7 +448,7 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt, + sch_tree_lock(sch); + if (child) { + qdisc_tree_flush_backlog(q->qdisc); +- qdisc_put(q->qdisc); ++ old = q->qdisc; + q->qdisc = child; + } + q->limit = qopt->limit; +@@ -467,6 +468,7 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt, + memcpy(&q->peak, &peak, sizeof(struct psched_ratecfg)); + + sch_tree_unlock(sch); ++ qdisc_put(old); + err = 0; + + tbf_offload_change(sch); +-- +2.35.3 + diff --git a/patches.suse/net_sched-em_meta-add-READ_ONCE-in-var_sk_bound_if.patch b/patches.suse/net_sched-em_meta-add-READ_ONCE-in-var_sk_bound_if.patch new file mode 100644 index 0000000..ad7e558 --- /dev/null +++ b/patches.suse/net_sched-em_meta-add-READ_ONCE-in-var_sk_bound_if.patch @@ -0,0 +1,50 @@ +From 70f87de9fa0d454c5c176876fe5d5f6a7bb1fe9d Mon Sep 17 00:00:00 2001 +From: Eric Dumazet +Date: Fri, 13 May 2022 11:55:47 -0700 +Subject: [PATCH] net_sched: em_meta: add READ_ONCE() in var_sk_bound_if() +Git-commit: 70f87de9fa0d454c5c176876fe5d5f6a7bb1fe9d +Patch-mainline: v5.19-rc1 +References: bsc#1207361 + +sk->sk_bound_dev_if can change under us, use READ_ONCE() annotation. + +Signed-off-by: Eric Dumazet +Signed-off-by: David S. Miller +Signed-off-by: Jiri Wiesner +--- + net/sched/em_meta.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c +index 0a04468b7314..49bae3d5006b 100644 +--- a/net/sched/em_meta.c ++++ b/net/sched/em_meta.c +@@ -311,12 +311,15 @@ META_COLLECTOR(int_sk_bound_if) + + META_COLLECTOR(var_sk_bound_if) + { ++ int bound_dev_if; ++ + if (skip_nonlocal(skb)) { + *err = -1; + return; + } + +- if (skb->sk->sk_bound_dev_if == 0) { ++ bound_dev_if = READ_ONCE(skb->sk->sk_bound_dev_if); ++ if (bound_dev_if == 0) { + dst->value = (unsigned long) "any"; + dst->len = 3; + } else { +@@ -324,7 +327,7 @@ META_COLLECTOR(var_sk_bound_if) + + rcu_read_lock(); + dev = dev_get_by_index_rcu(sock_net(skb->sk), +- skb->sk->sk_bound_dev_if); ++ bound_dev_if); + *err = var_dev(dev, dst); + rcu_read_unlock(); + } +-- +2.35.3 + diff --git a/patches.suse/net_sched-restore-mpu-xxx-handling.patch b/patches.suse/net_sched-restore-mpu-xxx-handling.patch new file mode 100644 index 0000000..de28ab7 --- /dev/null +++ b/patches.suse/net_sched-restore-mpu-xxx-handling.patch @@ -0,0 +1,105 @@ +From fb80445c438c78b40b547d12b8d56596ce4ccfeb Mon Sep 17 00:00:00 2001 +From: Kevin Bracey +Date: Wed, 12 Jan 2022 19:02:10 +0200 +Subject: [PATCH] net_sched: restore "mpu xxx" handling +Git-commit: fb80445c438c78b40b547d12b8d56596ce4ccfeb +Patch-mainline: v5.17-rc1 +References: bsc#1207361 + +commit 56b765b79e9a ("htb: improved accuracy at high rates") broke +"overhead X", "linklayer atm" and "mpu X" attributes. + +"overhead X" and "linklayer atm" have already been fixed. This restores +the "mpu X" handling, as might be used by DOCSIS or Ethernet shaping: + + tc class add ... htb rate X overhead 4 mpu 64 + +The code being fixed is used by htb, tbf and act_police. Cake has its +own mpu handling. qdisc_calculate_pkt_len still uses the size table +containing values adjusted for mpu by user space. + +iproute2 tc has always passed mpu into the kernel via a tc_ratespec +structure, but the kernel never directly acted on it, merely stored it +so that it could be read back by `tc class show`. + +Rather, tc would generate length-to-time tables that included the mpu +(and linklayer) in their construction, and the kernel used those tables. + +Since v3.7, the tables were no longer used. Along with "mpu", this also +broke "overhead" and "linklayer" which were fixed in 01cb71d2d47b +("net_sched: restore "overhead xxx" handling", v3.10) and 8a8e3d84b171 +("net_sched: restore "linklayer atm" handling", v3.11). + +"overhead" was fixed by simply restoring use of tc_ratespec::overhead - +this had originally been used by the kernel but was initially omitted +from the new non-table-based calculations. + +"linklayer" had been handled in the table like "mpu", but the mode was +not originally passed in tc_ratespec. The new implementation was made to +handle it by getting new versions of tc to pass the mode in an extended +tc_ratespec, and for older versions of tc the table contents were analysed +at load time to deduce linklayer. + +As "mpu" has always been given to the kernel in tc_ratespec, +accompanying the mpu-based table, we can restore system functionality +with no userspace change by making the kernel act on the tc_ratespec +value. + +Fixes: 56b765b79e9a ("htb: improved accuracy at high rates") +Signed-off-by: Kevin Bracey +Cc: Eric Dumazet +Cc: Jiri Pirko +Cc: Vimalkumar +Link: https://lore.kernel.org/r/20220112170210.1014351-1-kevin@bracey.fi +Signed-off-by: Jakub Kicinski +Signed-off-by: Jiri Wiesner +--- + include/net/sch_generic.h | 5 +++++ + net/sched/sch_generic.c | 1 + + 2 files changed, 6 insertions(+) + +diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h +index c11dbac5abb2..472843eedbae 100644 +--- a/include/net/sch_generic.h ++++ b/include/net/sch_generic.h +@@ -1244,6 +1244,7 @@ struct psched_ratecfg { + u64 rate_bytes_ps; /* bytes per second */ + u32 mult; + u16 overhead; ++ u16 mpu; + u8 linklayer; + u8 shift; + }; +@@ -1253,6 +1254,9 @@ static inline u64 psched_l2t_ns(const struct psched_ratecfg *r, + { + len += r->overhead; + ++ if (len < r->mpu) ++ len = r->mpu; ++ + if (unlikely(r->linklayer == TC_LINKLAYER_ATM)) + return ((u64)(DIV_ROUND_UP(len,48)*53) * r->mult) >> r->shift; + +@@ -1275,6 +1279,7 @@ static inline void psched_ratecfg_getrate(struct tc_ratespec *res, + res->rate = min_t(u64, r->rate_bytes_ps, ~0U); + + res->overhead = r->overhead; ++ res->mpu = r->mpu; + res->linklayer = (r->linklayer & TC_LINKLAYER_MASK); + } + +diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c +index b07bd1c7330f..f893d9a81b01 100644 +--- a/net/sched/sch_generic.c ++++ b/net/sched/sch_generic.c +@@ -1529,6 +1529,7 @@ void psched_ratecfg_precompute(struct psched_ratecfg *r, + { + memset(r, 0, sizeof(*r)); + r->overhead = conf->overhead; ++ r->mpu = conf->mpu; + r->rate_bytes_ps = max_t(u64, conf->rate, rate64); + r->linklayer = (conf->linklayer & TC_LINKLAYER_MASK); + psched_ratecfg_precompute__(r->rate_bytes_ps, &r->mult, &r->shift); +-- +2.35.3 + diff --git a/patches.suse/nouveau-fix-migrate_to_ram-for-faulting-page.patch b/patches.suse/nouveau-fix-migrate_to_ram-for-faulting-page.patch index 068d857..3190d14 100644 --- a/patches.suse/nouveau-fix-migrate_to_ram-for-faulting-page.patch +++ b/patches.suse/nouveau-fix-migrate_to_ram-for-faulting-page.patch @@ -3,6 +3,7 @@ From: Alistair Popple Date: Wed, 19 Oct 2022 23:29:34 +1100 Subject: [PATCH] nouveau: fix migrate_to_ram() for faulting page Git-commit: 97061d441110528dc02972818f2f1dad485107f9 +Alt-commit: 1beca7f1471e14802f7f6730ac9ac0a3de7c8f8b Patch-mainline: v6.1-rc2 References: git-fixes diff --git a/patches.suse/paddings-add-for-type-C-new-in-SP5.patch b/patches.suse/paddings-add-for-type-C-new-in-SP5.patch new file mode 100644 index 0000000..3ab6a21 --- /dev/null +++ b/patches.suse/paddings-add-for-type-C-new-in-SP5.patch @@ -0,0 +1,102 @@ +From 9016ba13e8957943ed572e26b95cd15d8ddaffe5 Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Tue, 24 Jan 2023 09:22:21 +0100 +Subject: [PATCH 1/3] paddings: add for type C new in SP5 +Patch-mainline: Never (kABI padding) +References: bsc#1207439 + +The new structures need paddings. + +Signed-off-by: Oliver Neukum +--- + include/linux/usb/typec.h | 5 +++++ + include/linux/usb/typec_mux.h | 6 ++++++ + include/linux/usb/typec_retimer.h | 4 ++++ + 3 files changed, 15 insertions(+) + +diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h +index a9aa04460..696281ef9 100644 +--- a/include/linux/usb/typec.h ++++ b/include/linux/usb/typec.h +@@ -193,6 +193,7 @@ struct typec_cable_desc { + struct usb_pd_identity *identity; + u16 pd_revision; /* 0300H = "3.0" */ + ++ void *suse_kabi_padding; + }; + + /* +@@ -216,6 +217,8 @@ struct typec_partner_desc { + enum typec_accessory accessory; + struct usb_pd_identity *identity; + u16 pd_revision; /* 0300H = "3.0" */ ++ ++ void *suse_kabi_padding; + }; + + /** +@@ -237,6 +240,8 @@ struct typec_operations { + enum typec_port_type type); + struct usb_power_delivery **(*pd_get)(struct typec_port *port); + int (*pd_set)(struct typec_port *port, struct usb_power_delivery *pd); ++ ++ void *suse_kabi_padding; + }; + + enum usb_pd_svdm_ver { +diff --git a/include/linux/usb/typec_mux.h b/include/linux/usb/typec_mux.h +index a9d995793..9e96b57a2 100644 +--- a/include/linux/usb/typec_mux.h ++++ b/include/linux/usb/typec_mux.h +@@ -20,6 +20,8 @@ struct typec_switch_desc { + typec_switch_set_fn_t set; + const char *name; + void *drvdata; ++ ++ void *suse_kabi_padding; + }; + + struct typec_switch *fwnode_typec_switch_get(struct fwnode_handle *fwnode); +@@ -44,6 +46,8 @@ struct typec_mux_state { + struct typec_altmode *alt; + unsigned long mode; + void *data; ++ ++ void *suse_kabi_padding; + }; + + typedef int (*typec_mux_set_fn_t)(struct typec_mux *mux, +@@ -54,6 +58,8 @@ struct typec_mux_desc { + typec_mux_set_fn_t set; + const char *name; + void *drvdata; ++ ++ void *suse_kabi_padding; + }; + + struct typec_mux *fwnode_typec_mux_get(struct fwnode_handle *fwnode, +diff --git a/include/linux/usb/typec_retimer.h b/include/linux/usb/typec_retimer.h +index 5e036b336..622b484f7 100644 +--- a/include/linux/usb/typec_retimer.h ++++ b/include/linux/usb/typec_retimer.h +@@ -15,6 +15,8 @@ struct typec_retimer_state { + struct typec_altmode *alt; + unsigned long mode; + void *data; ++ ++ void *suse_kabi_padding; + }; + + typedef int (*typec_retimer_set_fn_t)(struct typec_retimer *retimer, +@@ -25,6 +27,8 @@ struct typec_retimer_desc { + typec_retimer_set_fn_t set; + const char *name; + void *drvdata; ++ ++ void *suse_kabi_padding; + }; + + struct typec_retimer *fwnode_typec_retimer_get(struct fwnode_handle *fwnode); +-- +2.39.0 + diff --git a/patches.suse/paddings-for-TB-and-USB4-XDomain-structures.patch b/patches.suse/paddings-for-TB-and-USB4-XDomain-structures.patch new file mode 100644 index 0000000..3d15517 --- /dev/null +++ b/patches.suse/paddings-for-TB-and-USB4-XDomain-structures.patch @@ -0,0 +1,94 @@ +From 9fc60dc996e3a6095107ac534bc5ff45f0c74844 Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Tue, 24 Jan 2023 10:07:01 +0100 +Subject: [PATCH] for TB and USB4 XDomain structures +Patch-mainline: Never (kABI padding) +References: bsc#1207439 + +Signed-off-by: Oliver Neukum +--- + include/linux/pci.h | 4 ++++ + include/linux/thunderbolt.h | 10 ++++++++++ + 2 files changed, 14 insertions(+) + +diff --git a/include/linux/pci.h b/include/linux/pci.h +index 0a0eb65df..c61080612 100644 +--- a/include/linux/pci.h ++++ b/include/linux/pci.h +@@ -763,6 +763,8 @@ struct pci_ops { + void __iomem *(*map_bus)(struct pci_bus *bus, unsigned int devfn, int where); + int (*read)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val); + int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val); ++ ++ void *suse_kabi_padding; + }; + + /* +@@ -838,6 +840,8 @@ struct pci_error_handlers { + + /* Device driver may resume normal operations */ + void (*resume)(struct pci_dev *dev); ++ ++ void *suse_kabi_padding; + }; + + +diff --git a/include/linux/thunderbolt.h b/include/linux/thunderbolt.h +index 9020a4b45..d31e8fb82 100644 +--- a/include/linux/thunderbolt.h ++++ b/include/linux/thunderbolt.h +@@ -144,6 +144,7 @@ struct tb_property { + char *text; + u32 immediate; + } value; ++ + void *suse_kabi_padding; + }; + +@@ -258,6 +259,8 @@ struct tb_xdomain { + u8 target_link_width; + u8 link; + u8 depth; ++ ++ void *suse_kabi_padding; + }; + + int tb_xdomain_lane_bonding_enable(struct tb_xdomain *xd); +@@ -361,6 +364,8 @@ struct tb_protocol_handler { + int (*callback)(const void *buf, size_t size, void *data); + void *data; + struct list_head list; ++ ++ void *suse_kabi_padding; + }; + + int tb_register_protocol_handler(struct tb_protocol_handler *handler); +@@ -392,6 +397,8 @@ struct tb_service { + u32 prtcrevs; + u32 prtcstns; + struct dentry *debugfs_dir; ++ ++ void *suse_kabi_padding; + }; + + static inline struct tb_service *tb_service_get(struct tb_service *svc) +@@ -433,6 +440,8 @@ struct tb_service_driver { + void (*remove)(struct tb_service *svc); + void (*shutdown)(struct tb_service *svc); + const struct tb_service_id *id_table; ++ ++ void *suse_kabi_padding; + }; + + #define TB_SERVICE(key, id) \ +@@ -542,6 +551,7 @@ struct tb_ring { + u16 eof_mask; + void (*start_poll)(void *data); + void *poll_data; ++ + void *suse_kabi_padding; + }; + +-- +2.39.0 + diff --git a/patches.suse/paddings-for-ath-802.11.patch b/patches.suse/paddings-for-ath-802.11.patch new file mode 100644 index 0000000..c01eb02 --- /dev/null +++ b/patches.suse/paddings-for-ath-802.11.patch @@ -0,0 +1,28 @@ +From 3955727904623a2f1cccacd067a458077e7bd71f Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Tue, 24 Jan 2023 10:39:43 +0100 +Subject: [PATCH 3/3] paddings for ath 802.11 +Patch-mainline: Never (kABI padding) +References: bsc#1207439 + +Signed-off-by: Oliver Neukum +--- + drivers/net/wireless/ath/ath.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h +index f083fb903..4ffe4d671 100644 +--- a/drivers/net/wireless/ath/ath.h ++++ b/drivers/net/wireless/ath/ath.h +@@ -178,6 +178,8 @@ struct ath_common { + const struct ath_bus_ops *bus_ops; + const struct ath_ps_ops *ps_ops; + ++ void *suse_kabi_padding; ++ + bool btcoex_enabled; + bool disable_ani; + bool bt_ant_diversity; +-- +2.39.0 + diff --git a/patches.suse/paddings-for-gadgets.patch b/patches.suse/paddings-for-gadgets.patch new file mode 100644 index 0000000..91fc3fb --- /dev/null +++ b/patches.suse/paddings-for-gadgets.patch @@ -0,0 +1,73 @@ +From 379954b607cd3c094fced46fecac1d9096859666 Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Tue, 24 Jan 2023 09:38:05 +0100 +Subject: [PATCH 3/3] paddings for gadgets +Patch-mainline: Never (kABI padding) +References: bsc#1207439 + +Signed-off-by: Oliver Neukum +--- + include/linux/usb/gadget.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h +index dc3092cea..8210e4168 100644 +--- a/include/linux/usb/gadget.h ++++ b/include/linux/usb/gadget.h +@@ -120,6 +120,8 @@ struct usb_request { + + int status; + unsigned actual; ++ ++ void *suse_kabi_padding; + }; + + /*-------------------------------------------------------------------------*/ +@@ -150,6 +152,8 @@ struct usb_ep_ops { + + int (*fifo_status) (struct usb_ep *ep); + void (*fifo_flush) (struct usb_ep *ep); ++ ++ void *suse_kabi_padding; + }; + + /** +@@ -238,6 +242,8 @@ struct usb_ep { + u8 address; + const struct usb_endpoint_descriptor *desc; + const struct usb_ss_ep_comp_descriptor *comp_desc; ++ ++ void *suse_kabi_padding; + }; + + /*-------------------------------------------------------------------------*/ +@@ -328,6 +334,8 @@ struct usb_gadget_ops { + struct usb_endpoint_descriptor *, + struct usb_ss_ep_comp_descriptor *); + int (*check_config)(struct usb_gadget *gadget); ++ ++ void *suse_kabi_padding; + }; + + /** +@@ -446,6 +454,8 @@ struct usb_gadget { + unsigned lpm_capable:1; + int irq; + int id_number; ++ ++ void *suse_kabi_padding; + }; + #define work_to_gadget(w) (container_of((w), struct usb_gadget, work)) + +@@ -731,6 +741,8 @@ struct usb_gadget_driver { + char *udc_name; + unsigned match_existing_only:1; + bool is_bound:1; ++ ++ void *suse_kabi_padding; + }; + + +-- +2.39.0 + diff --git a/patches.suse/paddings-for-mediatek-802.11.patch b/patches.suse/paddings-for-mediatek-802.11.patch new file mode 100644 index 0000000..1dd0ffe --- /dev/null +++ b/patches.suse/paddings-for-mediatek-802.11.patch @@ -0,0 +1,83 @@ +From b7ff61aa9de1cd398012a433932a5898e38de2eb Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Tue, 24 Jan 2023 10:37:16 +0100 +Subject: [PATCH 2/3] paddings for mediatek 802.11 +Patch-mainline: Never (kABI padding) +References: bsc#1207439 + +Signed-off-by: Oliver Neukum +--- + drivers/net/wireless/mediatek/mt76/mt76.h | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h +index a3af2e99b..9778ec32a 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt76.h ++++ b/drivers/net/wireless/mediatek/mt76/mt76.h +@@ -53,6 +53,9 @@ struct mt76_bus_ops { + const struct mt76_reg_pair *rp, int len); + int (*rd_rp)(struct mt76_dev *dev, u32 base, + struct mt76_reg_pair *rp, int len); ++ ++ void *suse_kabi_padding; ++ + enum mt76_bus_type type; + }; + +@@ -184,6 +187,8 @@ struct mt76_mcu_ops { + int (*mcu_rd_rp)(struct mt76_dev *dev, u32 base, + struct mt76_reg_pair *rp, int len); + int (*mcu_restart)(struct mt76_dev *dev); ++ ++ void *suse_kabi_padding; + }; + + struct mt76_queue_ops { +@@ -214,6 +219,8 @@ struct mt76_queue_ops { + void (*kick)(struct mt76_dev *dev, struct mt76_queue *q); + + void (*reset_q)(struct mt76_dev *dev, struct mt76_queue *q); ++ ++ void *suse_kabi_padding; + }; + + enum mt76_wcid_flags { +@@ -383,6 +390,8 @@ struct mt76_driver_ops { + + void (*sta_remove)(struct mt76_dev *dev, struct ieee80211_vif *vif, + struct ieee80211_sta *sta); ++ ++ void *suse_kabi_padding; + }; + + struct mt76_channel_state { +@@ -486,6 +495,8 @@ struct mt76_usb { + u32 base; + bool burst; + } mcu; ++ ++ void *suse_kabi_padding; + }; + + #define MT76S_XMIT_BUF_SZ (16 * PAGE_SIZE) +@@ -507,6 +518,8 @@ struct mt76_sdio { + int pse_mcu_quota; + int deficit; + } sched; ++ ++ void *suse_kabi_padding; + }; + + struct mt76_mmio { +@@ -738,6 +751,8 @@ struct mt76_dev { + #endif + struct workqueue_struct *wq; + ++ void *suse_kabi_padding; ++ + union { + struct mt76_mmio mmio; + struct mt76_usb usb; +-- +2.39.0 + diff --git a/patches.suse/paddings-for-realtik-802.11.patch b/patches.suse/paddings-for-realtik-802.11.patch new file mode 100644 index 0000000..19564bb --- /dev/null +++ b/patches.suse/paddings-for-realtik-802.11.patch @@ -0,0 +1,71 @@ +From 75cec086f07180f7439707e70836adba79e27348 Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Tue, 24 Jan 2023 10:33:18 +0100 +Subject: [PATCH 1/3] paddings for realtik 802.11 +Patch-mainline: Never (kABI padding) +References: bsc#1207439 + +Signed-off-by: Oliver Neukum +--- + drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8180.h | 3 +++ + drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8187.h | 2 ++ + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 ++ + drivers/net/wireless/realtek/rtlwifi/wifi.h | 2 ++ + 4 files changed, 9 insertions(+) + +diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8180.h b/drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8180.h +index 2ff00800d..d359a21a5 100644 +--- a/drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8180.h ++++ b/drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8180.h +@@ -121,6 +121,9 @@ struct rtl8180_priv { + struct ieee80211_supported_band band; + struct ieee80211_tx_queue_params queue_param[4]; + struct pci_dev *pdev; ++ ++ void *suse_kabi_padding; ++ + u32 rx_conf; + u8 slot_time; + u16 ack_time; +diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8187.h b/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8187.h +index 36f3460cc..79ee9fbd0 100644 +--- a/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8187.h ++++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8187.h +@@ -153,6 +153,8 @@ struct rtl8187_priv { + } *io_dmabuf ____cacheline_aligned; + bool rfkill_off; + u16 seqno; ++ ++ void *suse_kabi_padding; + }; + + void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data); +diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +index cd3ff9847..de639e530 100644 +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -1351,6 +1351,8 @@ struct rtl8xxxu_priv { + + struct mutex h2c_mutex; + ++ void *suse_kabi_padding; ++ + struct usb_anchor rx_anchor; + struct usb_anchor tx_anchor; + struct usb_anchor int_anchor; +diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h +index aa0785641..3074db656 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h ++++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h +@@ -2773,6 +2773,8 @@ struct rtl_priv { + + struct rtl_rate_priv *rate_priv; + ++ void *suse_kabi_padding; ++ + /* sta entry list for ap adhoc or mesh */ + struct list_head entry_list; + +-- +2.39.0 + diff --git a/patches.suse/paddings-for-the-inter-DMN-tunnel-stuff-of-TB.patch b/patches.suse/paddings-for-the-inter-DMN-tunnel-stuff-of-TB.patch new file mode 100644 index 0000000..f6acd81 --- /dev/null +++ b/patches.suse/paddings-for-the-inter-DMN-tunnel-stuff-of-TB.patch @@ -0,0 +1,56 @@ +From 0f0b1df6ced4cdddf1926376ce494d68852b6f37 Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Tue, 24 Jan 2023 11:35:36 +0100 +Subject: [PATCH] paddings for the inter DMN tunnel stuff of TB +Patch-mainline: Never (kABI paddings) +References: bsc#1207439 + +Signed-off-by: Oliver Neukum +--- + drivers/thunderbolt/ctl.h | 2 ++ + drivers/thunderbolt/nhi.h | 2 ++ + drivers/thunderbolt/tunnel.h | 2 ++ + 3 files changed, 6 insertions(+) + +diff --git a/drivers/thunderbolt/ctl.h b/drivers/thunderbolt/ctl.h +index e8c64898d..7339e955e 100644 +--- a/drivers/thunderbolt/ctl.h ++++ b/drivers/thunderbolt/ctl.h +@@ -92,6 +92,8 @@ struct tb_cfg_request { + struct work_struct work; + struct tb_cfg_result result; + struct list_head list; ++ ++ void *suse_kabi_padding; + }; + + #define TB_CFG_REQUEST_ACTIVE 0 +diff --git a/drivers/thunderbolt/nhi.h b/drivers/thunderbolt/nhi.h +index 01190d9ce..a486b91a7 100644 +--- a/drivers/thunderbolt/nhi.h ++++ b/drivers/thunderbolt/nhi.h +@@ -46,6 +46,8 @@ struct tb_nhi_ops { + int (*runtime_suspend)(struct tb_nhi *nhi); + int (*runtime_resume)(struct tb_nhi *nhi); + void (*shutdown)(struct tb_nhi *nhi); ++ ++ void *suse_kabi_padding; + }; + + extern const struct tb_nhi_ops icl_nhi_ops; +diff --git a/drivers/thunderbolt/tunnel.h b/drivers/thunderbolt/tunnel.h +index bb4d1f1d6..81440da44 100644 +--- a/drivers/thunderbolt/tunnel.h ++++ b/drivers/thunderbolt/tunnel.h +@@ -62,6 +62,8 @@ struct tb_tunnel { + int max_down; + int allocated_up; + int allocated_down; ++ ++ void *suse_kabi_padding; + }; + + struct tb_tunnel *tb_tunnel_discover_pci(struct tb *tb, struct tb_port *down, +-- +2.39.0 + diff --git a/patches.suse/paddings-for-the-new-structures-for-roles.patch b/patches.suse/paddings-for-the-new-structures-for-roles.patch new file mode 100644 index 0000000..c984259 --- /dev/null +++ b/patches.suse/paddings-for-the-new-structures-for-roles.patch @@ -0,0 +1,101 @@ +From 4468fe74a8c64e7953627fc100ea875b0f4314e0 Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Tue, 24 Jan 2023 09:31:58 +0100 +Subject: [PATCH 2/3] paddings for the new structures for roles +Patch-mainline: Never (kABI padding) +References: bsc#1207439 + +Signed-off-by: Oliver Neukum +--- + include/linux/usb/otg-fsm.h | 4 ++++ + include/linux/usb/otg.h | 1 + + include/linux/usb/phy.h | 4 ++++ + include/linux/usb/phy_companion.h | 2 ++ + include/linux/usb/role.h | 2 ++ + 5 files changed, 13 insertions(+) + +diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h +index 6135d076c..2a92b1b8b 100644 +--- a/include/linux/usb/otg-fsm.h ++++ b/include/linux/usb/otg-fsm.h +@@ -185,6 +185,8 @@ struct otg_fsm { + struct delayed_work hnp_polling_work; + bool hnp_work_inited; + bool state_changed; ++ ++ void *suse_kabi_padding; + }; + + struct otg_fsm_ops { +@@ -199,6 +201,8 @@ struct otg_fsm_ops { + void (*del_timer)(struct otg_fsm *fsm, enum otg_fsm_timer timer); + int (*start_host)(struct otg_fsm *fsm, int on); + int (*start_gadget)(struct otg_fsm *fsm, int on); ++ ++ void *suse_kabi_padding; + }; + + +diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h +index 6475f880b..a89d58b9a 100644 +--- a/include/linux/usb/otg.h ++++ b/include/linux/usb/otg.h +@@ -40,6 +40,7 @@ struct usb_otg { + /* start or continue HNP role switch */ + int (*start_hnp)(struct usb_otg *otg); + ++ void *suse_kabi_padding; + }; + + /** +diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h +index e4de6bc1f..b1f5a96b0 100644 +--- a/include/linux/usb/phy.h ++++ b/include/linux/usb/phy.h +@@ -72,6 +72,8 @@ struct usb_otg; + struct usb_phy_io_ops { + int (*read)(struct usb_phy *x, u32 reg); + int (*write)(struct usb_phy *x, u32 val, u32 reg); ++ ++ void *suse_kabi_padding; + }; + + struct usb_charger_current { +@@ -155,6 +157,8 @@ struct usb_phy { + * manually detect the charger type. + */ + enum usb_charger_type (*charger_detect)(struct usb_phy *x); ++ ++ void *suse_kabi_padding; + }; + + /* for board-specific init logic */ +diff --git a/include/linux/usb/phy_companion.h b/include/linux/usb/phy_companion.h +index 862aaeca2..502439961 100644 +--- a/include/linux/usb/phy_companion.h ++++ b/include/linux/usb/phy_companion.h +@@ -20,6 +20,8 @@ struct phy_companion { + + /* for B devices only: start session with A-Host */ + int (*start_srp)(struct phy_companion *x); ++ ++ void *suse_kabi_padding; + }; + + #endif /* __DRIVERS_PHY_COMPANION_H */ +diff --git a/include/linux/usb/role.h b/include/linux/usb/role.h +index b5deafd91..054850dd9 100644 +--- a/include/linux/usb/role.h ++++ b/include/linux/usb/role.h +@@ -45,6 +45,8 @@ struct usb_role_switch_desc { + bool allow_userspace_control; + void *driver_data; + const char *name; ++ ++ void *suse_kabi_padding; + }; + + +-- +2.39.0 + diff --git a/patches.suse/tcp-Don-t-acquire-inet_listen_hashbucket-lock-with-d.patch b/patches.suse/tcp-Don-t-acquire-inet_listen_hashbucket-lock-with-d.patch new file mode 100644 index 0000000..57bf626 --- /dev/null +++ b/patches.suse/tcp-Don-t-acquire-inet_listen_hashbucket-lock-with-d.patch @@ -0,0 +1,173 @@ +From 4f9bf2a2f5aacf988e6d5e56b961ba45c5a25248 Mon Sep 17 00:00:00 2001 +From: Sebastian Andrzej Siewior +Date: Wed, 9 Feb 2022 19:56:57 +0100 +Subject: [PATCH] tcp: Don't acquire inet_listen_hashbucket::lock with disabled + BH. +Git-commit: 4f9bf2a2f5aacf988e6d5e56b961ba45c5a25248 +Patch-mainline: v5.18-rc1 +References: bsc#1207361 + +Commit + 9652dc2eb9e40 ("tcp: relax listening_hash operations") + +removed the need to disable bottom half while acquiring +listening_hash.lock. There are still two callers left which disable +bottom half before the lock is acquired. + +On PREEMPT_RT the softirqs are preemptible and local_bh_disable() acts +as a lock to ensure that resources, that are protected by disabling +bottom halves, remain protected. +This leads to a circular locking dependency if the lock acquired with +disabled bottom halves is also acquired with enabled bottom halves +followed by disabling bottom halves. This is the reverse locking order. +It has been observed with inet_listen_hashbucket::lock: + +local_bh_disable() + spin_lock(&ilb->lock): + inet_listen() + inet_csk_listen_start() + sk->sk_prot->hash() := inet_hash() + local_bh_disable() + __inet_hash() + spin_lock(&ilb->lock); + acquire(&ilb->lock); + +Reverse order: spin_lock(&ilb2->lock) + local_bh_disable(): + tcp_seq_next() + listening_get_next() + spin_lock(&ilb2->lock); + acquire(&ilb2->lock); + + tcp4_seq_show() + get_tcp4_sock() + sock_i_ino() + read_lock_bh(&sk->sk_callback_lock); + acquire(softirq_ctrl) // <---- whoops + acquire(&sk->sk_callback_lock) + +Drop local_bh_disable() around __inet_hash() which acquires +listening_hash->lock. Split inet_unhash() and acquire the +listen_hashbucket lock without disabling bottom halves; the inet_ehash +lock with disabled bottom halves. + +Reported-by: Mike Galbraith +Signed-off-by: Sebastian Andrzej Siewior +Link: https://lkml.kernel.org/r/12d6f9879a97cd56c09fb53dee343cbb14f7f1f7.camel@gmx.de +Link: https://lkml.kernel.org/r/X9CheYjuXWc75Spa@hirez.programming.kicks-ass.net +Link: https://lore.kernel.org/r/YgQOebeZ10eNx1W6@linutronix.de +Signed-off-by: Jakub Kicinski +Signed-off-by: Jiri Wiesner +--- + net/ipv4/inet_hashtables.c | 53 ++++++++++++++++++++++--------------- + net/ipv6/inet6_hashtables.c | 5 +--- + 2 files changed, 33 insertions(+), 25 deletions(-) + +diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c +index 30ab717ff1b8..17440840a791 100644 +--- a/net/ipv4/inet_hashtables.c ++++ b/net/ipv4/inet_hashtables.c +@@ -637,7 +637,9 @@ int __inet_hash(struct sock *sk, struct sock *osk) + int err = 0; + + if (sk->sk_state != TCP_LISTEN) { ++ local_bh_disable(); + inet_ehash_nolisten(sk, osk, NULL); ++ local_bh_enable(); + return 0; + } + WARN_ON(!sk_unhashed(sk)); +@@ -669,45 +671,54 @@ int inet_hash(struct sock *sk) + { + int err = 0; + +- if (sk->sk_state != TCP_CLOSE) { +- local_bh_disable(); ++ if (sk->sk_state != TCP_CLOSE) + err = __inet_hash(sk, NULL); +- local_bh_enable(); +- } + + return err; + } + EXPORT_SYMBOL_GPL(inet_hash); + +-void inet_unhash(struct sock *sk) ++static void __inet_unhash(struct sock *sk, struct inet_listen_hashbucket *ilb) + { +- struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; +- struct inet_listen_hashbucket *ilb = NULL; +- spinlock_t *lock; +- + if (sk_unhashed(sk)) + return; + +- if (sk->sk_state == TCP_LISTEN) { +- ilb = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)]; +- lock = &ilb->lock; +- } else { +- lock = inet_ehash_lockp(hashinfo, sk->sk_hash); +- } +- spin_lock_bh(lock); +- if (sk_unhashed(sk)) +- goto unlock; +- + if (rcu_access_pointer(sk->sk_reuseport_cb)) + reuseport_stop_listen_sock(sk); + if (ilb) { ++ struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; ++ + inet_unhash2(hashinfo, sk); + ilb->count--; + } + __sk_nulls_del_node_init_rcu(sk); + sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); +-unlock: +- spin_unlock_bh(lock); ++} ++ ++void inet_unhash(struct sock *sk) ++{ ++ struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; ++ ++ if (sk_unhashed(sk)) ++ return; ++ ++ if (sk->sk_state == TCP_LISTEN) { ++ struct inet_listen_hashbucket *ilb; ++ ++ ilb = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)]; ++ /* Don't disable bottom halves while acquiring the lock to ++ * avoid circular locking dependency on PREEMPT_RT. ++ */ ++ spin_lock(&ilb->lock); ++ __inet_unhash(sk, ilb); ++ spin_unlock(&ilb->lock); ++ } else { ++ spinlock_t *lock = inet_ehash_lockp(hashinfo, sk->sk_hash); ++ ++ spin_lock_bh(lock); ++ __inet_unhash(sk, NULL); ++ spin_unlock_bh(lock); ++ } + } + EXPORT_SYMBOL_GPL(inet_unhash); + +diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c +index 4514444e96c8..4740afecf7c6 100644 +--- a/net/ipv6/inet6_hashtables.c ++++ b/net/ipv6/inet6_hashtables.c +@@ -333,11 +333,8 @@ int inet6_hash(struct sock *sk) + { + int err = 0; + +- if (sk->sk_state != TCP_CLOSE) { +- local_bh_disable(); ++ if (sk->sk_state != TCP_CLOSE) + err = __inet_hash(sk, NULL); +- local_bh_enable(); +- } + + return err; + } +-- +2.35.3 + diff --git a/patches.suse/tcp-Fix-a-data-race-around-sysctl_tcp_tso_rtt_log.patch b/patches.suse/tcp-Fix-a-data-race-around-sysctl_tcp_tso_rtt_log.patch new file mode 100644 index 0000000..a342bec --- /dev/null +++ b/patches.suse/tcp-Fix-a-data-race-around-sysctl_tcp_tso_rtt_log.patch @@ -0,0 +1,35 @@ +From 2455e61b85e9c99af38cd889a7101f1d48b33cb4 Mon Sep 17 00:00:00 2001 +From: Kuniyuki Iwashima +Date: Wed, 20 Jul 2022 09:50:23 -0700 +Subject: [PATCH] tcp: Fix a data-race around sysctl_tcp_tso_rtt_log. +Git-commit: 2455e61b85e9c99af38cd889a7101f1d48b33cb4 +Patch-mainline: v5.19 +References: bsc#1207361 + +While reading sysctl_tcp_tso_rtt_log, it can be changed concurrently. +Thus, we need to add READ_ONCE() to its reader. + +Fixes: 65466904b015 ("tcp: adjust TSO packet sizes based on min_rtt") +Signed-off-by: Kuniyuki Iwashima +Signed-off-by: David S. Miller +Signed-off-by: Jiri Wiesner +--- + net/ipv4/tcp_output.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c +index 6e29cf391a64..cf6713c9567e 100644 +--- a/net/ipv4/tcp_output.c ++++ b/net/ipv4/tcp_output.c +@@ -1976,7 +1976,7 @@ static u32 tcp_tso_autosize(const struct sock *sk, unsigned int mss_now, + + bytes = sk->sk_pacing_rate >> READ_ONCE(sk->sk_pacing_shift); + +- r = tcp_min_rtt(tcp_sk(sk)) >> sock_net(sk)->ipv4.sysctl_tcp_tso_rtt_log; ++ r = tcp_min_rtt(tcp_sk(sk)) >> READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_tso_rtt_log); + if (r < BITS_PER_TYPE(sk->sk_gso_max_size)) + bytes += sk->sk_gso_max_size >> r; + +-- +2.35.3 + diff --git a/patches.suse/tcp-adjust-TSO-packet-sizes-based-on-min_rtt.patch b/patches.suse/tcp-adjust-TSO-packet-sizes-based-on-min_rtt.patch new file mode 100644 index 0000000..bf3319f --- /dev/null +++ b/patches.suse/tcp-adjust-TSO-packet-sizes-based-on-min_rtt.patch @@ -0,0 +1,243 @@ +From 65466904b015f6eeb9225b51aeb29b01a1d4b59c Mon Sep 17 00:00:00 2001 +From: Eric Dumazet +Date: Tue, 8 Mar 2022 17:57:57 -0800 +Subject: [PATCH] tcp: adjust TSO packet sizes based on min_rtt +Git-commit: 65466904b015f6eeb9225b51aeb29b01a1d4b59c +Patch-mainline: v5.18-rc1 +References: bsc#1207361 + +Back when tcp_tso_autosize() and TCP pacing were introduced, +our focus was really to reduce burst sizes for long distance +flows. + +The simple heuristic of using sk_pacing_rate/1024 has worked +well, but can lead to too small packets for hosts in the same +rack/cluster, when thousands of flows compete for the bottleneck. + +Neal Cardwell had the idea of making the TSO burst size +a function of both sk_pacing_rate and tcp_min_rtt() + +Indeed, for local flows, sending bigger bursts is better +to reduce cpu costs, as occasional losses can be repaired +quite fast. + +This patch is based on Neal Cardwell implementation +done more than two years ago. +bbr is adjusting max_pacing_rate based on measured bandwidth, +while cubic would over estimate max_pacing_rate. + +/proc/sys/net/ipv4/tcp_tso_rtt_log can be used to tune or disable +this new feature, in logarithmic steps. + +Tested: + +100Gbit NIC, two hosts in the same rack, 4K MTU. +600 flows rate-limited to 20000000 bytes per second. + +Before patch: (TSO sizes would be limited to 20000000/1024/4096 -> 4 segments per TSO) + +~# echo 0 >/proc/sys/net/ipv4/tcp_tso_rtt_log +~# nstat -n;perf stat ./super_netperf 600 -H otrv6 -l 20 -- -K dctcp -q 20000000;nstat|egrep "TcpInSegs|TcpOutSegs|TcpRetransSegs|Delivered" + 96005 + + Performance counter stats for './super_netperf 600 -H otrv6 -l 20 -- -K dctcp -q 20000000': + + 65,945.29 msec task-clock # 2.845 CPUs utilized + 1,314,632 context-switches # 19935.279 M/sec + 5,292 cpu-migrations # 80.249 M/sec + 940,641 page-faults # 14264.023 M/sec + 201,117,030,926 cycles # 3049769.216 GHz (83.45%) + 17,699,435,405 stalled-cycles-frontend # 8.80% frontend cycles idle (83.48%) + 136,584,015,071 stalled-cycles-backend # 67.91% backend cycles idle (83.44%) + 53,809,530,436 instructions # 0.27 insn per cycle + # 2.54 stalled cycles per insn (83.36%) + 9,062,315,523 branches # 137422329.563 M/sec (83.22%) + 153,008,621 branch-misses # 1.69% of all branches (83.32%) + + 23.182970846 seconds time elapsed + +TcpInSegs 15648792 0.0 +TcpOutSegs 58659110 0.0 # Average of 3.7 4K segments per TSO packet +TcpExtTCPDelivered 58654791 0.0 +TcpExtTCPDeliveredCE 19 0.0 + +After patch: + +~# echo 9 >/proc/sys/net/ipv4/tcp_tso_rtt_log +~# nstat -n;perf stat ./super_netperf 600 -H otrv6 -l 20 -- -K dctcp -q 20000000;nstat|egrep "TcpInSegs|TcpOutSegs|TcpRetransSegs|Delivered" + 96046 + + Performance counter stats for './super_netperf 600 -H otrv6 -l 20 -- -K dctcp -q 20000000': + + 48,982.58 msec task-clock # 2.104 CPUs utilized + 186,014 context-switches # 3797.599 M/sec + 3,109 cpu-migrations # 63.472 M/sec + 941,180 page-faults # 19214.814 M/sec + 153,459,763,868 cycles # 3132982.807 GHz (83.56%) + 12,069,861,356 stalled-cycles-frontend # 7.87% frontend cycles idle (83.32%) + 120,485,917,953 stalled-cycles-backend # 78.51% backend cycles idle (83.24%) + 36,803,672,106 instructions # 0.24 insn per cycle + # 3.27 stalled cycles per insn (83.18%) + 5,947,266,275 branches # 121417383.427 M/sec (83.64%) + 87,984,616 branch-misses # 1.48% of all branches (83.43%) + + 23.281200256 seconds time elapsed + +TcpInSegs 1434706 0.0 +TcpOutSegs 58883378 0.0 # Average of 41 4K segments per TSO packet +TcpExtTCPDelivered 58878971 0.0 +TcpExtTCPDeliveredCE 9664 0.0 + +Signed-off-by: Eric Dumazet +Reviewed-by: Neal Cardwell +Link: https://lore.kernel.org/r/20220309015757.2532973-1-eric.dumazet@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Jiri Wiesner +--- + Documentation/networking/ip-sysctl.rst | 23 ++++++++++++++++++ + include/net/netns/ipv4.h | 3 ++- + net/ipv4/sysctl_net_ipv4.c | 7 ++++++ + net/ipv4/tcp_ipv4.c | 1 + + net/ipv4/tcp_output.c | 33 ++++++++++++++++---------- + 5 files changed, 54 insertions(+), 13 deletions(-) + +diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/networking/ip-sysctl.rst +index 2572eecc3e86..b0024aa7b051 100644 +--- a/Documentation/networking/ip-sysctl.rst ++++ b/Documentation/networking/ip-sysctl.rst +@@ -878,6 +878,29 @@ tcp_min_tso_segs - INTEGER + + Default: 2 + ++tcp_tso_rtt_log - INTEGER ++ Adjustment of TSO packet sizes based on min_rtt ++ ++ Starting from linux-5.18, TCP autosizing can be tweaked ++ for flows having small RTT. ++ ++ Old autosizing was splitting the pacing budget to send 1024 TSO ++ per second. ++ ++ tso_packet_size = sk->sk_pacing_rate / 1024; ++ ++ With the new mechanism, we increase this TSO sizing using: ++ ++ distance = min_rtt_usec / (2^tcp_tso_rtt_log) ++ tso_packet_size += gso_max_size >> distance; ++ ++ This means that flows between very close hosts can use bigger ++ TSO packets, reducing their cpu costs. ++ ++ If you want to use the old autosizing, set this sysctl to 0. ++ ++ Default: 9 (2^9 = 512 usec) ++ + tcp_pacing_ss_ratio - INTEGER + sk->sk_pacing_rate is set by TCP stack using a ratio applied + to current rate. (current_rate = cwnd * mss / srtt) +diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h +index f0687867b5cd..ce0cc4e8d8c7 100644 +--- a/include/net/netns/ipv4.h ++++ b/include/net/netns/ipv4.h +@@ -127,6 +127,7 @@ struct netns_ipv4 { + u8 sysctl_tcp_synack_retries; + u8 sysctl_tcp_syncookies; + u8 sysctl_tcp_migrate_req; ++ u8 sysctl_tcp_comp_sack_nr; + int sysctl_tcp_reordering; + u8 sysctl_tcp_retries1; + u8 sysctl_tcp_retries2; +@@ -160,9 +161,9 @@ struct netns_ipv4 { + int sysctl_tcp_challenge_ack_limit; + int sysctl_tcp_min_rtt_wlen; + u8 sysctl_tcp_min_tso_segs; ++ u8 sysctl_tcp_tso_rtt_log; + u8 sysctl_tcp_autocorking; + u8 sysctl_tcp_reflect_tos; +- u8 sysctl_tcp_comp_sack_nr; + int sysctl_tcp_invalid_ratelimit; + int sysctl_tcp_pacing_ss_ratio; + int sysctl_tcp_pacing_ca_ratio; +diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c +index 1cae27b5dcd8..ad80d180b60b 100644 +--- a/net/ipv4/sysctl_net_ipv4.c ++++ b/net/ipv4/sysctl_net_ipv4.c +@@ -1271,6 +1271,13 @@ static struct ctl_table ipv4_net_table[] = { + .proc_handler = proc_dou8vec_minmax, + .extra1 = SYSCTL_ONE, + }, ++ { ++ .procname = "tcp_tso_rtt_log", ++ .data = &init_net.ipv4.sysctl_tcp_tso_rtt_log, ++ .maxlen = sizeof(u8), ++ .mode = 0644, ++ .proc_handler = proc_dou8vec_minmax, ++ }, + { + .procname = "tcp_min_rtt_wlen", + .data = &init_net.ipv4.sysctl_tcp_min_rtt_wlen, +diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c +index 81694a354110..f9cec624068d 100644 +--- a/net/ipv4/tcp_ipv4.c ++++ b/net/ipv4/tcp_ipv4.c +@@ -3137,6 +3137,7 @@ static int __net_init tcp_sk_init(struct net *net) + /* rfc5961 challenge ack rate limiting */ + net->ipv4.sysctl_tcp_challenge_ack_limit = 1000; + net->ipv4.sysctl_tcp_min_tso_segs = 2; ++ net->ipv4.sysctl_tcp_tso_rtt_log = 9; /* 2^9 = 512 usec */ + net->ipv4.sysctl_tcp_min_rtt_wlen = 300; + net->ipv4.sysctl_tcp_autocorking = 1; + net->ipv4.sysctl_tcp_invalid_ratelimit = HZ/2; +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c +index 2319531267c6..81aaa7da3e8c 100644 +--- a/net/ipv4/tcp_output.c ++++ b/net/ipv4/tcp_output.c +@@ -1956,25 +1956,34 @@ static bool tcp_nagle_check(bool partial, const struct tcp_sock *tp, + } + + /* Return how many segs we'd like on a TSO packet, +- * to send one TSO packet per ms ++ * depending on current pacing rate, and how close the peer is. ++ * ++ * Rationale is: ++ * - For close peers, we rather send bigger packets to reduce ++ * cpu costs, because occasional losses will be repaired fast. ++ * - For long distance/rtt flows, we would like to get ACK clocking ++ * with 1 ACK per ms. ++ * ++ * Use min_rtt to help adapt TSO burst size, with smaller min_rtt resulting ++ * in bigger TSO bursts. We we cut the RTT-based allowance in half ++ * for every 2^9 usec (aka 512 us) of RTT, so that the RTT-based allowance ++ * is below 1500 bytes after 6 * ~500 usec = 3ms. + */ + static u32 tcp_tso_autosize(const struct sock *sk, unsigned int mss_now, + int min_tso_segs) + { +- u32 bytes, segs; ++ unsigned long bytes; ++ u32 r; + +- bytes = min_t(unsigned long, +- sk->sk_pacing_rate >> READ_ONCE(sk->sk_pacing_shift), +- sk->sk_gso_max_size - 1 - MAX_TCP_HEADER); ++ bytes = sk->sk_pacing_rate >> READ_ONCE(sk->sk_pacing_shift); + +- /* Goal is to send at least one packet per ms, +- * not one big TSO packet every 100 ms. +- * This preserves ACK clocking and is consistent +- * with tcp_tso_should_defer() heuristic. +- */ +- segs = max_t(u32, bytes / mss_now, min_tso_segs); ++ r = tcp_min_rtt(tcp_sk(sk)) >> sock_net(sk)->ipv4.sysctl_tcp_tso_rtt_log; ++ if (r < BITS_PER_TYPE(sk->sk_gso_max_size)) ++ bytes += sk->sk_gso_max_size >> r; ++ ++ bytes = min_t(unsigned long, bytes, sk->sk_gso_max_size); + +- return segs; ++ return max_t(u32, bytes / mss_now, min_tso_segs); + } + + /* Return the number of segments we want in the skb we are transmitting. +-- +2.35.3 diff --git a/patches.suse/tcp-move-inet-rx_dst_ifindex-to-sk-sk_rx_dst_ifindex.patch b/patches.suse/tcp-move-inet-rx_dst_ifindex-to-sk-sk_rx_dst_ifindex.patch new file mode 100644 index 0000000..3d56970 --- /dev/null +++ b/patches.suse/tcp-move-inet-rx_dst_ifindex-to-sk-sk_rx_dst_ifindex.patch @@ -0,0 +1,128 @@ +From 0c0a5ef809f9150e9229e7b13e43183b681b7a39 Mon Sep 17 00:00:00 2001 +From: Eric Dumazet +Date: Mon, 25 Oct 2021 09:48:16 -0700 +Subject: [PATCH] tcp: move inet->rx_dst_ifindex to sk->sk_rx_dst_ifindex +Git-commit: 0c0a5ef809f9150e9229e7b13e43183b681b7a39 +Patch-mainline: v5.16-rc1 +References: bsc#1207361 + +Increase cache locality by moving rx_dst_ifindex next to sk->sk_rx_dst + +This is part of an effort to reduce cache line misses in TCP fast path. + +This removes one cache line miss in early demux. + +Signed-off-by: Eric Dumazet +Acked-by: Soheil Hassas Yeganeh +Signed-off-by: Jakub Kicinski +Signed-off-by: Jiri Wiesner +--- + include/net/inet_sock.h | 3 +-- + include/net/sock.h | 3 +++ + net/ipv4/tcp_ipv4.c | 6 +++--- + net/ipv6/tcp_ipv6.c | 6 +++--- + 4 files changed, 10 insertions(+), 8 deletions(-) + +diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h +index 89163ef8cf4b..9e1111f5915b 100644 +--- a/include/net/inet_sock.h ++++ b/include/net/inet_sock.h +@@ -207,11 +207,10 @@ struct inet_sock { + __be32 inet_saddr; + __s16 uc_ttl; + __u16 cmsg_flags; ++ struct ip_options_rcu __rcu *inet_opt; + __be16 inet_sport; + __u16 inet_id; + +- struct ip_options_rcu __rcu *inet_opt; +- int rx_dst_ifindex; + __u8 tos; + __u8 min_ttl; + __u8 mc_ttl; +diff --git a/include/net/sock.h b/include/net/sock.h +index 596ba85611bc..0bfb3f138bda 100644 +--- a/include/net/sock.h ++++ b/include/net/sock.h +@@ -259,6 +259,7 @@ struct bpf_local_storage; + * @sk_rcvbuf: size of receive buffer in bytes + * @sk_wq: sock wait queue and async head + * @sk_rx_dst: receive input route used by early demux ++ * @sk_rx_dst_ifindex: ifindex for @sk_rx_dst + * @sk_dst_cache: destination cache + * @sk_dst_pending_confirm: need to confirm neighbour + * @sk_policy: flow policy +@@ -430,6 +431,8 @@ struct sock { + struct xfrm_policy __rcu *sk_policy[2]; + #endif + struct dst_entry *sk_rx_dst; ++ int sk_rx_dst_ifindex; ++ + struct dst_entry __rcu *sk_dst_cache; + atomic_t sk_omem_alloc; + int sk_sndbuf; +diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c +index 5e6d8cb82ce5..2bdc32c1afb6 100644 +--- a/net/ipv4/tcp_ipv4.c ++++ b/net/ipv4/tcp_ipv4.c +@@ -1703,7 +1703,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) + sock_rps_save_rxhash(sk, skb); + sk_mark_napi_id(sk, skb); + if (dst) { +- if (inet_sk(sk)->rx_dst_ifindex != skb->skb_iif || ++ if (sk->sk_rx_dst_ifindex != skb->skb_iif || + !INDIRECT_CALL_1(dst->ops->check, ipv4_dst_check, + dst, 0)) { + dst_release(dst); +@@ -1788,7 +1788,7 @@ int tcp_v4_early_demux(struct sk_buff *skb) + if (dst) + dst = dst_check(dst, 0); + if (dst && +- inet_sk(sk)->rx_dst_ifindex == skb->skb_iif) ++ sk->sk_rx_dst_ifindex == skb->skb_iif) + skb_dst_set_noref(skb, dst); + } + } +@@ -2195,7 +2195,7 @@ void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb) + + if (dst && dst_hold_safe(dst)) { + sk->sk_rx_dst = dst; +- inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; ++ sk->sk_rx_dst_ifindex = skb->skb_iif; + } + } + EXPORT_SYMBOL(inet_sk_rx_dst_set); +diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c +index 1ef27cd7dbff..3e8669b6d636 100644 +--- a/net/ipv6/tcp_ipv6.c ++++ b/net/ipv6/tcp_ipv6.c +@@ -108,7 +108,7 @@ static void inet6_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb) + const struct rt6_info *rt = (const struct rt6_info *)dst; + + sk->sk_rx_dst = dst; +- inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; ++ sk->sk_rx_dst_ifindex = skb->skb_iif; + tcp_inet6_sk(sk)->rx_dst_cookie = rt6_get_cookie(rt); + } + } +@@ -1509,7 +1509,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) + sock_rps_save_rxhash(sk, skb); + sk_mark_napi_id(sk, skb); + if (dst) { +- if (inet_sk(sk)->rx_dst_ifindex != skb->skb_iif || ++ if (sk->sk_rx_dst_ifindex != skb->skb_iif || + INDIRECT_CALL_1(dst->ops->check, ip6_dst_check, + dst, np->rx_dst_cookie) == NULL) { + dst_release(dst); +@@ -1874,7 +1874,7 @@ INDIRECT_CALLABLE_SCOPE void tcp_v6_early_demux(struct sk_buff *skb) + if (dst) + dst = dst_check(dst, tcp_inet6_sk(sk)->rx_dst_cookie); + if (dst && +- inet_sk(sk)->rx_dst_ifindex == skb->skb_iif) ++ sk->sk_rx_dst_ifindex == skb->skb_iif) + skb_dst_set_noref(skb, dst); + } + } +-- +2.35.3 + diff --git a/patches.suse/tcp-tweak-len-truesize-ratio-for-coalesce-candidates.patch b/patches.suse/tcp-tweak-len-truesize-ratio-for-coalesce-candidates.patch new file mode 100644 index 0000000..a558c9f --- /dev/null +++ b/patches.suse/tcp-tweak-len-truesize-ratio-for-coalesce-candidates.patch @@ -0,0 +1,146 @@ +From 240bfd134c592791fdceba1ce7fc3f973c33df2d Mon Sep 17 00:00:00 2001 +From: Eric Dumazet +Date: Wed, 21 Jul 2021 03:15:28 -0700 +Subject: [PATCH] tcp: tweak len/truesize ratio for coalesce candidates +Git-commit: 240bfd134c592791fdceba1ce7fc3f973c33df2d +Patch-mainline: v5.15-rc1 +References: bsc#1207361 + +tcp_grow_window() is using skb->len/skb->truesize to increase tp->rcv_ssthresh +which has a direct impact on advertized window sizes. + +We added TCP coalescing in linux-3.4 & linux-3.5: + +Instead of storing skbs with one or two MSS in receive queue (or OFO queue), +we try to append segments together to reduce memory overhead. + +High performance network drivers tend to cook skb with 3 parts : + +1) sk_buff structure (256 bytes) +2) skb->head contains room to copy headers as needed, and skb_shared_info +3) page fragment(s) containing the ~1514 bytes frame (or more depending on MTU) + +Once coalesced into a previous skb, 1) and 2) are freed. + +We can therefore tweak the way we compute len/truesize ratio knowing +that skb->truesize is inflated by 1) and 2) soon to be freed. + +This is done only for in-order skb, or skb coalesced into OFO queue. + +The result is that low rate flows no longer pay the memory price of having +low GRO aggregation factor. Same result for drivers not using GRO. + +This is critical to allow a big enough receiver window, +typically tcp_rmem[2] / 2. + +We have been using this at Google for about 5 years, it is due time +to make it upstream. + +Signed-off-by: Eric Dumazet +Cc: Soheil Hassas Yeganeh +Cc: Neal Cardwell +Cc: Yuchung Cheng +Acked-by: Soheil Hassas Yeganeh +Signed-off-by: David S. Miller +Signed-off-by: Jiri Wiesner +--- + net/ipv4/tcp_input.c | 38 ++++++++++++++++++++++++++++++-------- + 1 file changed, 30 insertions(+), 8 deletions(-) + +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c +index bef2c8b64d83..501d8d4d4ba4 100644 +--- a/net/ipv4/tcp_input.c ++++ b/net/ipv4/tcp_input.c +@@ -454,11 +454,12 @@ static void tcp_sndbuf_expand(struct sock *sk) + */ + + /* Slow part of check#2. */ +-static int __tcp_grow_window(const struct sock *sk, const struct sk_buff *skb) ++static int __tcp_grow_window(const struct sock *sk, const struct sk_buff *skb, ++ unsigned int skbtruesize) + { + struct tcp_sock *tp = tcp_sk(sk); + /* Optimize this! */ +- int truesize = tcp_win_from_space(sk, skb->truesize) >> 1; ++ int truesize = tcp_win_from_space(sk, skbtruesize) >> 1; + int window = tcp_win_from_space(sk, sock_net(sk)->ipv4.sysctl_tcp_rmem[2]) >> 1; + + while (tp->rcv_ssthresh <= window) { +@@ -471,7 +472,27 @@ static int __tcp_grow_window(const struct sock *sk, const struct sk_buff *skb) + return 0; + } + +-static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb) ++/* Even if skb appears to have a bad len/truesize ratio, TCP coalescing ++ * can play nice with us, as sk_buff and skb->head might be either ++ * freed or shared with up to MAX_SKB_FRAGS segments. ++ * Only give a boost to drivers using page frag(s) to hold the frame(s), ++ * and if no payload was pulled in skb->head before reaching us. ++ */ ++static u32 truesize_adjust(bool adjust, const struct sk_buff *skb) ++{ ++ u32 truesize = skb->truesize; ++ ++ if (adjust && !skb_headlen(skb)) { ++ truesize -= SKB_TRUESIZE(skb_end_offset(skb)); ++ /* paranoid check, some drivers might be buggy */ ++ if (unlikely((int)truesize < (int)skb->len)) ++ truesize = skb->truesize; ++ } ++ return truesize; ++} ++ ++static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb, ++ bool adjust) + { + struct tcp_sock *tp = tcp_sk(sk); + int room; +@@ -480,15 +501,16 @@ static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb) + + /* Check #1 */ + if (room > 0 && !tcp_under_memory_pressure(sk)) { ++ unsigned int truesize = truesize_adjust(adjust, skb); + int incr; + + /* Check #2. Increase window, if skb with such overhead + * will fit to rcvbuf in future. + */ +- if (tcp_win_from_space(sk, skb->truesize) <= skb->len) ++ if (tcp_win_from_space(sk, truesize) <= skb->len) + incr = 2 * tp->advmss; + else +- incr = __tcp_grow_window(sk, skb); ++ incr = __tcp_grow_window(sk, skb, truesize); + + if (incr) { + incr = max_t(int, incr, 2 * skb->len); +@@ -782,7 +804,7 @@ static void tcp_event_data_recv(struct sock *sk, struct sk_buff *skb) + tcp_ecn_check_ce(sk, skb); + + if (skb->len >= 128) +- tcp_grow_window(sk, skb); ++ tcp_grow_window(sk, skb, true); + } + + /* Called to compute a smoothed rtt estimate. The data fed to this +@@ -4769,7 +4791,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb) + * and trigger fast retransmit. + */ + if (tcp_is_sack(tp)) +- tcp_grow_window(sk, skb); ++ tcp_grow_window(sk, skb, true); + kfree_skb_partial(skb, fragstolen); + skb = NULL; + goto add_sack; +@@ -4857,7 +4879,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb) + * and trigger fast retransmit. + */ + if (tcp_is_sack(tp)) +- tcp_grow_window(sk, skb); ++ tcp_grow_window(sk, skb, false); + skb_condense(skb); + skb_set_owner_r(skb, sk); + } +-- +2.35.3 + diff --git a/patches.suse/virtio-gpu-fix-shift-wrapping-bug-in-virtio_gpu_fenc.patch b/patches.suse/virtio-gpu-fix-shift-wrapping-bug-in-virtio_gpu_fenc.patch new file mode 100644 index 0000000..29c016f --- /dev/null +++ b/patches.suse/virtio-gpu-fix-shift-wrapping-bug-in-virtio_gpu_fenc.patch @@ -0,0 +1,40 @@ +From 37a78445763a5921bb54e9bad01937d0dfa521c1 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Mon, 19 Sep 2022 09:36:30 +0300 +Subject: virtio-gpu: fix shift wrapping bug in virtio_gpu_fence_event_create() +Git-commit: 37a78445763a5921bb54e9bad01937d0dfa521c1 +Patch-mainline: v6.1-rc1 +References: git-fixes + +The ->ring_idx_mask variable is a u64 so static checkers, Smatch in +this case, complain if the BIT() is not also a u64. + +drivers/gpu/drm/virtio/virtgpu_ioctl.c:50 virtio_gpu_fence_event_create() +warn: should '(1 << ring_idx)' be a 64 bit type? + +Fixes: cd7f5ca33585 ("drm/virtio: implement context init: add virtio_gpu_fence_event") +Signed-off-by: Dan Carpenter +Reviewed-by: Chia-I Wu +Link: http://patchwork.freedesktop.org/patch/msgid/YygN7jY0GdUSQSy0@kili +Signed-off-by: Gerd Hoffmann +Acked-by: Patrik Jakobsson +--- + drivers/gpu/drm/virtio/virtgpu_ioctl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c +index 3b1701607aae..5d05093014ac 100644 +--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c ++++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c +@@ -47,7 +47,7 @@ static int virtio_gpu_fence_event_create(struct drm_device *dev, + struct virtio_gpu_fence_event *e = NULL; + int ret; + +- if (!(vfpriv->ring_idx_mask & (1 << ring_idx))) ++ if (!(vfpriv->ring_idx_mask & BIT_ULL(ring_idx))) + return 0; + + e = kzalloc(sizeof(*e), GFP_KERNEL); +-- +2.39.0 + diff --git a/patches.suse/xhci-Prevent-infinite-loop-in-transaction-errors-rec.patch b/patches.suse/xhci-Prevent-infinite-loop-in-transaction-errors-rec.patch new file mode 100644 index 0000000..af4226e --- /dev/null +++ b/patches.suse/xhci-Prevent-infinite-loop-in-transaction-errors-rec.patch @@ -0,0 +1,91 @@ +From a1575120972ecd7baa6af6a69e4e7ea9213bde7c Mon Sep 17 00:00:00 2001 +From: Mathias Nyman +Date: Wed, 30 Nov 2022 11:19:43 +0200 +Subject: [PATCH] xhci: Prevent infinite loop in transaction errors recovery + for streams +Git-commit: a1575120972ecd7baa6af6a69e4e7ea9213bde7c +References: git-fixes +Patch-mainline: v6.2-rc1 + +Make sure to also limit the amount of soft reset retries for transaction +errors on streams in cases where the transaction error event doesn't point +to any specific TRB. + +In these cases we don't know the TRB or stream ring, but we do know which +endpoint had the error. + +To keep error counting simple and functional, move the current err_count +from ring structure to endpoint structure. + +Cc: stable@vger.kernel.org +Signed-off-by: Mathias Nyman +Link: https://lore.kernel.org/r/20221130091944.2171610-6-mathias.nyman@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Oliver Neukum +--- + drivers/usb/host/xhci-ring.c | 14 ++++++++++---- + drivers/usb/host/xhci.h | 2 +- + 2 files changed, 11 insertions(+), 5 deletions(-) + +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c +index f6af479188e8..039ec9734fcd 100644 +--- a/drivers/usb/host/xhci-ring.c ++++ b/drivers/usb/host/xhci-ring.c +@@ -2458,7 +2458,7 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, + + switch (trb_comp_code) { + case COMP_SUCCESS: +- ep_ring->err_count = 0; ++ ep->err_count = 0; + /* handle success with untransferred data as short packet */ + if (ep_trb != td->last_trb || remaining) { + xhci_warn(xhci, "WARN Successful completion on short TX\n"); +@@ -2484,7 +2484,7 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, + break; + case COMP_USB_TRANSACTION_ERROR: + if (xhci->quirks & XHCI_NO_SOFT_RETRY || +- (ep_ring->err_count++ > MAX_SOFT_RETRY) || ++ (ep->err_count++ > MAX_SOFT_RETRY) || + le32_to_cpu(slot_ctx->tt_info) & TT_SLOT) + break; + +@@ -2565,8 +2565,14 @@ static int handle_tx_event(struct xhci_hcd *xhci, + case COMP_USB_TRANSACTION_ERROR: + case COMP_INVALID_STREAM_TYPE_ERROR: + case COMP_INVALID_STREAM_ID_ERROR: +- xhci_handle_halted_endpoint(xhci, ep, 0, NULL, +- EP_SOFT_RESET); ++ xhci_dbg(xhci, "Stream transaction error ep %u no id\n", ++ ep_index); ++ if (ep->err_count++ > MAX_SOFT_RETRY) ++ xhci_handle_halted_endpoint(xhci, ep, 0, NULL, ++ EP_HARD_RESET); ++ else ++ xhci_handle_halted_endpoint(xhci, ep, 0, NULL, ++ EP_SOFT_RESET); + goto cleanup; + case COMP_RING_UNDERRUN: + case COMP_RING_OVERRUN: +diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h +index cc084d9505cd..c9f06c5e4e9d 100644 +--- a/drivers/usb/host/xhci.h ++++ b/drivers/usb/host/xhci.h +@@ -933,6 +933,7 @@ struct xhci_virt_ep { + * have to restore the device state to the previous state + */ + struct xhci_ring *new_ring; ++ unsigned int err_count; + unsigned int ep_state; + #define SET_DEQ_PENDING (1 << 0) + #define EP_HALTED (1 << 1) /* For stall handling */ +@@ -1627,7 +1628,6 @@ struct xhci_ring { + * if we own the TRB (if we are the consumer). See section 4.9.1. + */ + u32 cycle_state; +- unsigned int err_count; + unsigned int stream_id; + unsigned int num_segs; + unsigned int num_trbs_free; +-- +2.39.0 + diff --git a/series.conf b/series.conf index 14f1454..f36f9ea 100644 --- a/series.conf +++ b/series.conf @@ -973,6 +973,7 @@ patches.suse/i40e-add-support-for-PTP-external-synchronization-cl.patch patches.suse/usb-hso-remove-the-bailout-parameter.patch patches.suse/ionic-drop-useless-check-of-PCI-driver-data-validity.patch + patches.suse/tcp-tweak-len-truesize-ratio-for-coalesce-candidates.patch patches.suse/ionic-cleanly-release-devlink-instance.patch patches.suse/net-usb-asix-ax88772-add-missing-stop.patch patches.suse/nfp-flower-make-the-match-compilation-functions-reus.patch @@ -8158,6 +8159,7 @@ patches.suse/fddi-defza-add-missing-pointer-type-cast.patch patches.suse/bluetooth-use-eth_hw_addr_set.patch patches.suse/bluetooth-use-dev_addr_set.patch + patches.suse/tcp-move-inet-rx_dst_ifindex-to-sk-sk_rx_dst_ifindex.patch patches.suse/net-qed_ptp-fix-check-of-true-rc-expression.patch patches.suse/net-qed_dev-fix-check-of-true-rc-expression.patch patches.suse/tcp-don-t-free-a-FIN-sk_buff-in-tcp_remove_empty_skb.patch @@ -11329,6 +11331,7 @@ patches.suse/arm64-cpufeature-Export-this_cpu_has_cap-helper.patch patches.suse/net-davinci_emac-Fix-interrupt-pacing-disable.patch patches.suse/netfilter-nfnetlink_queue-fix-OOB-when-mac-header-wa.patch + patches.suse/ipvs-autoload-ipvs-on-genl-access.patch patches.suse/bnxt_en-avoid-newline-at-end-of-message-in-NL_SET_ER.patch patches.suse/kselftests-net-add-missed-icmp.sh-test-to-Makefile.patch patches.suse/ethtool-fix-ethtool-msg-len-calculation-for-pause-st.patch @@ -12027,6 +12030,7 @@ patches.suse/igb-fix-netpoll-exit-with-traffic.patch patches.suse/mdio-aspeed-Fix-Link-is-Down-issue.patch patches.suse/net-stmmac-Disable-Tx-queues-when-reconfiguring-the-.patch + patches.suse/net-sched-sch_ets-don-t-peek-at-classes-beyond-nband.patch patches.suse/ethtool-ioctl-fix-potential-NULL-deref-in-ethtool_se.patch patches.suse/net-smc-Don-t-call-clcsock-shutdown-twice-when-smc-shutdown patches.suse/net-qed-fix-the-array-may-be-out-of-bound.patch @@ -12364,6 +12368,7 @@ patches.suse/nfc-fix-potential-NULL-pointer-deref-in-nfc_genl_dum.patch patches.suse/nfp-Fix-memory-leak-in-nfp_cpp_area_cache_add.patch patches.suse/msft-hv-2484-net-mana-Fix-memory-leak-in-mana_hwc_create_wq.patch + patches.suse/net-sched-fq_pie-prevent-dismantle-issue.patch patches.suse/net-dsa-felix-Fix-memory-leak-in-felix_setup_mmio_fi.patch patches.suse/net-dsa-mv88e6xxx-allow-use-of-PHYs-on-CPU-and-DSA-p.patch patches.suse/RDMA-Fix-use-after-free-in-rxe_queue_cleanup.patch @@ -12530,6 +12535,7 @@ patches.suse/selftests-Add-duplicate-config-only-for-MD5-VRF-test.patch patches.suse/selftests-Fix-raw-socket-bind-tests-with-VRF.patch patches.suse/selftests-Fix-IPv6-address-bind-tests.patch + patches.suse/net-sched-sch_ets-don-t-remove-idle-classes-from-the.patch patches.suse/net-dsa-mv88e6xxx-Unforce-speed-duplex-in-mac_link_d.patch patches.suse/selftest-net-forwarding-declare-NETIFS-p9-p10.patch patches.suse/net-stmmac-fix-tc-flower-deletion-for-VLAN-priority-.patch @@ -14652,6 +14658,7 @@ patches.suse/net-mlx5e-Add-post_parse-op-to-tc-action-infrastruct.patch patches.suse/net-mlx5e-Move-vlan-action-chunk-into-tc-action-vlan.patch patches.suse/net-mlx5e-Move-goto-action-checks-into-tc_action-got.patch + patches.suse/ipvs-remove-unused-variable-for-ip_vs_new_dest.patch patches.suse/net-mlx5-Separate-FDB-namespace.patch patches.suse/net-mlx5-Refactor-mlx5_get_flow_namespace.patch patches.suse/net-mlx5-Create-more-priorities-for-FDB-bypass-names.patch @@ -16738,6 +16745,7 @@ patches.suse/net-smc-Resolve-the-race-between-link-group-access-a.patch patches.suse/net-smc-Introduce-a-new-conn-lgr-validity-check-help.patch patches.suse/net-smc-Resolve-the-race-between-SMC-R-link-access-a.patch + patches.suse/net_sched-restore-mpu-xxx-handling.patch patches.suse/bcmgenet-add-WOL-IRQ-check.patch patches.suse/net-usb-Correct-reset-handling-of-smsc95xx.patch patches.suse/lib82596-Fix-IRQ-check-in-sni_82596_probe.patch @@ -17599,6 +17607,7 @@ patches.suse/bpf-Fix-crash-due-to-out-of-bounds-access-into-reg2b.patch patches.suse/bpf-Add-schedule-points-in-batch-ops.patch patches.suse/drivers-hamradio-6pack-fix-UAF-bug-caused-by-mod_tim.patch + patches.suse/net-sched-act_ct-Fix-flow-table-lookup-after-ct-clea.patch patches.suse/sr9700-sanity-check-for-packet-length.patch patches.suse/net-ll_temac-check-the-return-value-of-devm_kmalloc.patch patches.suse/nfp-flower-Fix-a-potential-leak-in-nfp_tunnel_add_sh.patch @@ -19470,6 +19479,7 @@ patches.suse/libbpf-Fix-compilation-warning-due-to-mismatched-pri.patch patches.suse/bpf-Make-remote_port-field-in-struct-bpf_sk_lookup-1.patch patches.suse/selftests-bpf-Cover-4-byte-load-from-remote_port-in-.patch + patches.suse/tcp-Don-t-acquire-inet_listen_hashbucket-lock-with-d.patch patches.suse/ice-Refactor-spoofcheck-configuration-functions.patch patches.suse/ice-Add-helper-function-for-adding-VLAN-0.patch patches.suse/ice-Add-new-VSI-VLAN-ops.patch @@ -19762,6 +19772,7 @@ patches.suse/e1000e-Print-PHY-register-address-when-MDI-read-writ.patch patches.suse/bnxt-revert-hastily-merged-uAPI-aberrations.patch patches.suse/net-smc-fix-Wmissing-prototypes-warning-when-CONFIG_.patch + patches.suse/tcp-adjust-TSO-packet-sizes-based-on-min_rtt.patch patches.suse/net-mlx5e-TC-Fix-use-after-free-in-mlx5e_clone_flow_.patch patches.suse/net-mlx5-Add-command-failures-data-to-debugfs.patch patches.suse/net-mlx5-Remove-redundant-notify-fail-on-give-pages.patch @@ -20206,6 +20217,7 @@ patches.suse/iwlwifi-mvm-Don-t-fail-if-PPAG-isn-t-supported.patch patches.suse/net-mlx5e-Fix-build-warning-detected-write-beyond-si.patch patches.suse/drivers-net-xgene-Fix-regression-in-CRC-stripping.patch + patches.suse/net-sched-fix-incorrect-vlan_push_eth-dest-field.patch patches.suse/llc-fix-netdevice-reference-leaks-in-llc_ui_bind.patch patches.suse/netfilter-nf_tables-validate-registers-coming-from-u.patch patches.suse/netfilter-nf_tables-initialize-registers-in-nft_do_c.patch @@ -22441,6 +22453,7 @@ patches.suse/net-x25-Fix-null-ptr-deref-caused-by-x25_disconnect.patch patches.suse/octeontx2-af-initialize-action-variable.patch patches.suse/net-smc-fix-a-memory-leak-in-smc_sysctl_net_exit.patch + patches.suse/net-sched-act_ct-fix-ref-leak-when-switching-zones.patch patches.suse/netfilter-nf_conntrack_tcp-preserve-liberal-flag-in-.patch patches.suse/net-bnxt_ptp-fix-compilation-error.patch patches.suse/net-dsa-bcm_sf2_cfp-fix-an-incorrect-NULL-check-on-l.patch @@ -22914,9 +22927,11 @@ patches.suse/flow_dissector-fix-false-positive-__read_overflow2_f.patch patches.suse/net-mdio-don-t-defer-probe-forever-if-PHY-IRQ-provid.patch patches.suse/mlxsw-i2c-Fix-initialization-error-flow.patch + patches.suse/net-sched-fix-initialization-order-when-updating-cha.patch patches.suse/net-dsa-felix-suppress-EPROBE_DEFER-errors.patch patches.suse/net-atlantic-Avoid-out-of-bounds-indexing.patch patches.suse/net-ethernet-stmmac-fix-altr_tse_pcs-function-when-u.patch + patches.suse/net-sched-taprio-Check-if-socket-flags-are-valid.patch patches.suse/net-smc-use-memcpy-instead-of-snprintf-to-avoid-out-of-bounds-read patches.suse/net-smc-Fix-NULL-pointer-dereference-in-smc_pnet_find_ib patches.suse/net-smc-Fix-af_ops-of-child-socket-pointing-to-relea.patch @@ -23032,6 +23047,7 @@ patches.suse/igc-Fix-suspending-when-PTM-is-active.patch patches.suse/e1000e-Fix-possible-overflow-in-LTR-decoding.patch patches.suse/net-sched-cls_u32-fix-netns-refcount-changes-in-u32_.patch + patches.suse/net-sched-cls_u32-fix-possible-leak-in-u32_init_knod.patch patches.suse/l3mdev-l3mdev_master_upper_ifindex_by_index_rcu-shou.patch patches.suse/can-isotp-stop-timeout-monitoring-when-no-first-fram.patch patches.suse/net-mscc-ocelot-fix-broken-IP-multicast-flooding.patch @@ -23172,6 +23188,7 @@ patches.suse/thermal-int340x-Fix-attr.show-callback-prototype.patch patches.suse/wireguard-device-check-for-metadata_dst-with-skb_val.patch patches.suse/net-ethernet-stmmac-fix-write-to-sgmii_adapter_base.patch + patches.suse/ipvs-correctly-print-the-memory-size-of-ip_vs_conn_t.patch patches.suse/net-hns3-clear-inited-state-and-stop-client-after-fa.patch patches.suse/net-hns3-align-the-debugfs-output-to-the-left.patch patches.suse/net-hns3-modify-the-return-code-of-hclge_get_ring_ch.patch @@ -24660,6 +24677,7 @@ patches.suse/net-mlx5e-Use-XFRM-state-direction-instead-of-flags.patch patches.suse/ixgbe-add-xdp-frags-support-to-ndo_xdp_xmit.patch patches.suse/ice-Expose-RSS-indirection-tables-for-queue-groups-v.patch + patches.suse/net_sched-em_meta-add-READ_ONCE-in-var_sk_bound_if.patch patches.suse/octeontx2-pf-Remove-unnecessary-synchronize_irq-befo.patch patches.suse/net-phy-micrel-Allow-probing-without-.driver_data.patch patches.suse/qed-Remove-unnecessary-synchronize_irq-before-free_i.patch @@ -25468,6 +25486,7 @@ patches.suse/0591-amdgpu-pm-Enable-sysfs-nodes-for-vclk-and-dclk-for-N.patch patches.suse/0592-drm-amd-display-Fix-unused-but-set-variable-warning.patch patches.suse/0593-drm-amdgpu-vcn-Remove-unneeded-semicolon.patch + patches.suse/0001-drm-amdgpu-don-t-use-BACO-for-reset-in-S3.patch patches.suse/0594-drm-amdgpu-Flush-TLB-after-mapping-for-VG20-XGMI.patch patches.suse/0595-drm-amd-display-Add-flip-interval-workaround.patch patches.suse/0596-drm-amd-display-Remove-underflow-IRQ-type.patch @@ -27509,6 +27528,7 @@ patches.suse/ceph-allow-ceph.dir.rctime-xattr-to-be-updatable.patch patches.suse/net-smc-set-ini-smcrv2.ib_dev_v2-to-NULL-if-SMC-Rv2-is-unavailable patches.suse/netfilter-nf_tables-disallow-non-stateful-expression.patch + patches.suse/net-sched-fixed-barrier-to-prevent-skbuff-sticking-i.patch patches.suse/net-ethernet-mtk_eth_soc-out-of-bounds-read-in-mtk_h.patch patches.suse/net-ethernet-ti-am65-cpsw-nuss-Fix-some-refcount-lea.patch patches.suse/net-dsa-mv88e6xxx-Fix-refcount-leak-in-mv88e6xxx_mdi.patch @@ -27519,6 +27539,7 @@ patches.suse/sfc-fix-considering-that-all-channels-have-TX-queues.patch patches.suse/sfc-fix-wrong-tx-channel-offset-with-efx_separate_tx.patch patches.suse/xen-netback-fix-incorrect-usage-of-RING_HAS_UNCONSUM.patch + patches.suse/net-sched-add-barrier-to-fix-packet-stuck-problem-fo.patch patches.suse/netfilter-nf_tables-sanitize-nft_set_desc_concat_par.patch patches.suse/octeontx2-af-fix-error-code-in-is_valid_offset.patch patches.suse/macsec-fix-UAF-bug-for-real_dev.patch @@ -28217,6 +28238,7 @@ patches.suse/igb-fix-a-use-after-free-issue-in-igb_clean_tx_ring.patch patches.suse/bonding-ARP-monitor-spams-NETDEV_NOTIFY_PEERS-notifi.patch patches.suse/0001-ethtool-Fix-get-module-eeprom-fallback.patch + patches.suse/net-sched-sch_netem-Fix-arithmetic-in-netem_dump-for.patch patches.suse/net-phy-smsc-Disable-Energy-Detect-Power-Down-in-int.patch patches.suse/selftests-netfilter-correct-PKTGEN_SCRIPT_PATHS-in-n.patch patches.suse/igb-Make-DMA-faster-when-CPU-is-active-on-the-PCIe-l.patch @@ -28806,6 +28828,7 @@ patches.suse/xfrm-xfrm_policy-fix-a-possible-double-xfrm_pols_put.patch patches.suse/ipv4-Fix-data-races-around-sysctl_fib_multipath_hash.patch patches.suse/tcp-Fix-data-races-around-sysctl-knobs-related-to-SY.patch + patches.suse/net-sched-cls_api-Fix-flow-action-initialization.patch patches.suse/mlxsw-spectrum_router-Fix-IPv4-nexthop-gateway-indic.patch patches.suse/mtd-rawnand-gpmi-Set-WAIT_FOR_READY-timeout-based-on.patch patches.suse/1867-drm-i915-guc-Support-programming-the-EU-priority-in-.patch @@ -28837,6 +28860,7 @@ patches.suse/watch_queue-Fix-missing-locking-in-add_watch_to_obje.patch patches.suse/net-pcs-xpcs-propagate-xpcs_read-error-to-xpcs_get_s.patch patches.suse/net-sungem_phy-Add-of_node_put-for-reference-returne.patch + patches.suse/tcp-Fix-a-data-race-around-sysctl_tcp_tso_rtt_log.patch patches.suse/Documentation-fix-sctp_wmem-in-ip-sysctl.rst.patch patches.suse/nfp-bpf-Fix-typo-the-the-in-comment.patch patches.suse/s390-qeth-Fix-typo-the-the-in-comment @@ -32402,6 +32426,7 @@ patches.suse/iavf-Fix-NULL-pointer-dereference-in-iavf_get_link_k.patch patches.suse/iavf-Fix-reset-error-handling.patch patches.suse/iavf-Fix-deadlock-in-initialization.patch + patches.suse/net-sched-fix-misuse-of-qcpu-backlog-in-gnet_stats_a.patch patches.suse/i40e-Fix-tunnel-checksum-offload-with-fragmented-tra.patch patches.suse/i40e-Fix-to-stop-tx_timeout-recovery-if-GLOBR-fails.patch patches.suse/net-dsa-microchip-ksz9477-fix-fdb_dump-last-invalid-.patch @@ -32693,6 +32718,8 @@ patches.suse/Bluetooth-move-from-strlcpy-with-unused-retval-to-st.patch patches.suse/Bluetooth-hci_sync-hold-hdev-lock-when-cleanup-hci_c.patch patches.suse/tg3-Disable-tg3-device-on-system-reboot-to-avoid-tri.patch + patches.suse/net-sched-tbf-don-t-call-qdisc_put-while-holding-tre.patch + patches.suse/net-sched-fix-netdevice-reference-leaks-in-attach_de.patch patches.suse/ieee802154-adf7242-defer-destroy_workqueue-call.patch patches.suse/ieee802154-cc2520-add-rc-code-in-cc2520_tx.patch patches.suse/ethernet-rocker-fix-sleep-in-atomic-context-bug-in-n.patch @@ -33054,6 +33081,7 @@ patches.suse/gve-Fix-GFP-flags-when-allocing-pages-8ccac4edc8da.patch patches.suse/sfc-siena-fix-TX-channel-offset-when-using-legacy-in.patch patches.suse/sfc-siena-fix-null-pointer-dereference-in-efx_hard_s.patch + patches.suse/net-sched-taprio-avoid-disabling-offload-when-it-was.patch patches.suse/can-gs_usb-gs_can_open-fix-race-dev-can.state-condit.patch patches.suse/iavf-Fix-bad-page-state.patch patches.suse/iavf-Fix-set-max-MTU-size-with-port-VLAN-and-jumbo-f.patch @@ -33063,6 +33091,7 @@ patches.suse/ice-config-netdev-tc-before-setting-queues-number.patch patches.suse/ice-Fix-interface-being-down-after-reset-with-link-d.patch patches.suse/net-smc-Stop-the-CLC-flow-if-no-link-to-map-buffers-.patch + patches.suse/net-sched-fix-possible-refcount-leak-in-tc_new_tfilt.patch patches.suse/bnxt-prevent-skb-UAF-after-handing-over-to-PTP-worke.patch patches.suse/selftests-forwarding-add-shebang-for-sch_red.sh.patch patches.suse/firmware-arm_scmi-Improve-checks-in-the-info_get-ope.patch @@ -33160,6 +33189,7 @@ patches.suse/Input-snvs_pwrkey-fix-SNVS_HPVIDR1-register-address.patch patches.suse/sfc-correct-filter_table_remove-method-for-EF10-PFs.patch patches.suse/usbnet-Fix-memory-leak-in-usbnet_disconnect.patch + patches.suse/net-sched-act_ct-fix-possible-refcount-leak-in-tcf_c.patch patches.suse/net-stmmac-power-up-down-serdes-in-stmmac_open-relea.patch patches.suse/net-phy-Don-t-WARN-for-PHY_UP-state-in-mdio_bus_phy_.patch patches.suse/selftests-Fix-the-if-conditions-of-in-test_extra_fil.patch @@ -33551,13 +33581,17 @@ patches.suse/drm-Prevent-drm_copy_field-to-attempt-copying-a-NULL.patch patches.suse/0005-drm-amdgpu-reapply-fix-start-calculation-in-amdgpu_v.patch patches.suse/0006-drm-amdgpu-re-apply-move-internal-vram_mgr-function-.patch + patches.suse/drm-bridge-it6505-Power-on-downstream-device-in-.ato.patch patches.suse/0001-drm-mgag200-remove-rebundant-word-or-in-comments.patch patches.suse/drm-virtio-Check-whether-transferred-2D-BO-is-shmem.patch patches.suse/drm-virtio-Unlock-reservations-on-virtio_gpu_object_.patch + patches.suse/drm-virtio-Unlock-reservations-on-dma_resv_reserve_f.patch + patches.suse/drm-bridge-tc358767-Add-of_node_put-when-breaking-ou.patch patches.suse/drm-bridge-parade-ps8640-Fix-regulator-supply-order.patch patches.suse/drm-komeda-Fix-handling-of-atomic-commits-in-the-ato.patch patches.suse/0007-drm-amdgpu-use-idr_init_base-to-initialize-mgr-ctx_h.patch patches.suse/0008-drm-amdgpu-use-idr_init_base-to-initialize-fpriv-bo_.patch + patches.suse/drm-format-helper-Fix-test-on-big-endian-architectur.patch patches.suse/0002-drm-mgag200-Split-mgag200_modeset_init.patch patches.suse/0003-drm-mgag200-Move-DAC-register-setup-into-model-speci.patch patches.suse/0004-drm-mgag200-Move-ER-EW3-register-initialization-to-p.patch @@ -33582,12 +33616,21 @@ patches.suse/0010-drm-amdgpu_dm-Rely-on-split-out-luminance-calculatio.patch patches.suse/drm-nouveau-kms-nv140-Disable-interlacing.patch patches.suse/drm-msm-Make-.remove-and-.shutdown-HW-shutdown-consi.patch + patches.suse/drm-lcdif-Clean-up-headers.patch + patches.suse/drm-lcdif-Consistently-use-plain-timings.patch + patches.suse/drm-lcdif-Clean-up-debug-prints-and-comments.patch + patches.suse/drm-lcdif-switch-to-devm_drm_of_get_bridge.patch patches.suse/0011-drm-amdgpu-dc-mst-Rename-dp_mst_stream_allocation-_t.patch patches.suse/0012-drm-amdgpu-dm-mst-Rename-get_payload_table.patch patches.suse/udmabuf-Set-ubuf-sg-NULL-if-the-creation-of-sg-table.patch + patches.suse/drm-virtio-Fix-same-context-optimization.patch + patches.suse/drm-panel-use-select-for-Ili9341-panel-driver-helper.patch + patches.suse/drm-fix-drm_mipi_dbi-build-errors.patch patches.suse/drm-bridge-dw_hdmi-only-trigger-hotplug-event-on-lin.patch patches.suse/drm-bridge-megachips-Fix-a-null-pointer-dereference-.patch + patches.suse/drm-bridge-it6505-Fix-the-order-of-DP_SET_POWER-comm.patch patches.suse/drm-scheduler-quieten-kernel-doc-warnings.patch + patches.suse/drm-virtio-set-fb_modifiers_not_supported.patch patches.suse/0013-drm-amdgpu-add-mode2-reset-for-sienna_cichlid.patch patches.suse/0014-drm-amdgpu-let-mode2-reset-fallback-to-default-when-.patch patches.suse/0015-drm-amdgpu-add-debugfs-amdgpu_reset_level.patch @@ -33816,10 +33859,14 @@ patches.suse/0212-drm-amd-display-make-some-functions-static.patch patches.suse/0213-drm-amd-display-make-optc32_phantom_crtc_post_enable.patch patches.suse/0214-drm-amd-display-fix-boolconv.cocci-warning.patch + patches.suse/drm-rcar-du-Drop-leftovers-variables-from-Makefile.patch patches.suse/dt-bindings-display-msm-dpu-sc7180-add-missing-DPU-o.patch patches.suse/dt-bindings-display-msm-dpu-sdm845-add-missing-DPU-o.patch + patches.suse/drm-msm-lookup-the-ICC-paths-in-both-mdp5-dpu-and-md.patch patches.suse/drm-msm-dpu-index-dpu_kms-hw_vbif-using-vbif_idx.patch + patches.suse/drm-msm-dpu-drop-unused-memory-allocation.patch patches.suse/drm-msm-dpu-Fix-comment-typo.patch + patches.suse/drm-msm-dpu-drop-unused-variable-from-dpu_kms_mdp_sn.patch patches.suse/drm-msm-dp-Silence-inconsistent-indent-warning.patch patches.suse/drm-msm-dp-correct-1.62G-link-rate-at-dp_catalog_ctr.patch patches.suse/drm-omap-dss-Fix-refcount-leak-bugs.patch @@ -33834,6 +33881,7 @@ patches.suse/drm-udl-Fix-inconsistent-urbs.count-value-during-udl.patch patches.suse/drm-udl-Don-t-re-initialize-stuff-at-retrying-the-UR.patch patches.suse/drm-udl-Sync-pending-URBs-at-the-end-of-suspend.patch + patches.suse/drm-bridge-it6505-use-drm_debug_enabled-in-it6505_de.patch patches.suse/0215-drm-amd-pm-remove-unused-declarations-in-hardwareman.patch patches.suse/drm-panel-orientation-quirks-Add-quirk-for-Anbernic-.patch patches.suse/0001-drm-ast-Add-resolution-support-for-1152x864-75.patch @@ -33909,6 +33957,7 @@ patches.suse/0284-drm-amdgpu-Use-vm-status_lock-to-protect-pt-free.patch patches.suse/0285-drm-amdgpu-Fix-amdgpu_vm_pt_free-warning.patch patches.suse/drm-meson-explicitly-remove-aggregate-driver-at-modu.patch + patches.suse/virtio-gpu-fix-shift-wrapping-bug-in-virtio_gpu_fenc.patch patches.suse/0003-drm-ast-make-ast_modeset-static.patch patches.suse/0286-drm-amdgpu-gfx9-switch-to-amdgpu_gfx_rlc_init_microc.patch patches.suse/0287-drm-amdgpu-gfx10-switch-to-amdgpu_gfx_rlc_init_micro.patch @@ -34511,6 +34560,7 @@ patches.suse/nilfs2-fix-leak-of-nilfs_root-in-case-of-writer-thre.patch patches.suse/xen-gntdev-Prevent-leaking-grants.patch patches.suse/xen-gntdev-Accommodate-VMA-splitting.patch + patches.suse/drm-i915-gvt-Add-missing-vfio_unregister_group_dev-c.patch patches.suse/drm-i915-gvt-fix-a-memory-leak-in-intel_gvt_init_vgp.patch patches.suse/watchdog-wdat_wdt-fix-min-max-timer-value.patch patches.suse/watchdog-hpwdt-Include-nmi.h-only-if-CONFIG_HPWDT_NM.patch @@ -34556,6 +34606,8 @@ patches.suse/mmc-sdhci-sprd-Fix-minimum-clock-limit.patch patches.suse/io_uring-af_unix-defer-registered-files-gc-to-io_uri.patch patches.suse/drm-i915-ehl-Update-MOCS-table-for-EHL.patch + patches.suse/drm-i915-guc-Fix-revocation-of-non-persistent-contex.patch + patches.suse/drm-i915-Fix-display-problems-after-resume.patch patches.suse/0338-drm-amd-display-Fix-mutex-lock-in-dcn10.patch patches.suse/0339-drm-amd-display-Only-commit-SubVP-state-after-pipe-p.patch patches.suse/0340-drm-amd-display-change-to-enc314_stream_encoder_dp_b.patch @@ -34708,9 +34760,13 @@ patches.suse/net-phy-dp83867-Extend-RX-strap-quirk-for-SGMII-mode.patch patches.suse/net-smc-Fix-an-error-code-in-smc_lgr_create patches.suse/bnxt_en-fix-memory-leak-in-bnxt_nvm_test.patch + patches.suse/net-sched-cake-fix-null-pointer-access-issue-when-ca.patch + patches.suse/net-sched-sfb-fix-null-pointer-access-issue-when-sfb.patch patches.suse/sfc-include-vport_id-in-filter-spec-hash-and-equal.patch patches.suse/wwan_hwsim-fix-possible-memory-leak-in-wwan_hwsim_de.patch + patches.suse/net-sched-fix-race-condition-in-qdisc_graft.patch patches.suse/net-phy-dp83822-disable-MDI-crossover-status-change-.patch + patches.suse/drm-vc4-hdmi-Enforce-the-minimum-rate-at-runtime_res.patch patches.suse/drm-amdgpu-set-vm_update_mode-0-as-default-for-Sienn.patch patches.suse/0436-Revert-drm-amdgpu-add-debugfs-amdgpu_reset_level.patch patches.suse/0437-Revert-drm-amdgpu-let-mode2-reset-fallback-to-defaul.patch @@ -34823,11 +34879,16 @@ patches.suse/net-mlx5e-Fix-macsec-rx-security-association-SA-upda.patch patches.suse/net-mlx5e-Fix-wrong-bitwise-comparison-usage-in-macs.patch patches.suse/net-mlx5e-Fix-macsec-sci-endianness-at-rx-sa-update.patch + patches.suse/drm-msm-a6xx-Replace-kcalloc-with-kvzalloc.patch + patches.suse/drm-msm-dp-add-atomic_check-to-bridge-ops.patch patches.suse/drm-msm-Fix-return-type-of-mdp4_lvds_connector_mode_.patch patches.suse/drm-msm-fix-use-after-free-on-probe-deferral.patch + patches.suse/drm-msm-dp-fix-memory-corruption-with-too-many-bridg.patch patches.suse/drm-msm-dsi-fix-memory-corruption-with-too-many-brid.patch patches.suse/drm-msm-hdmi-fix-memory-corruption-with-too-many-bri.patch patches.suse/drm-msm-dp-fix-IRQ-lifetime.patch + patches.suse/drm-msm-dp-fix-aux-bus-EP-lifetime.patch + patches.suse/drm-msm-dp-fix-bridge-lifetime.patch patches.suse/drm-msm-hdmi-fix-IRQ-lifetime.patch patches.suse/0462-drm-amdgpu-fix-pstate-setting-issue.patch patches.suse/0463-drm-amd-pm-update-driver-if-header-for-smu_v13_0_10.patch @@ -34843,7 +34904,9 @@ patches.suse/0473-drm-amdkfd-correct-the-cache-info-for-gfx1036.patch patches.suse/0474-drm-amd-display-Revert-logic-for-plane-modifiers.patch patches.suse/0475-drm-amdgpu-disallow-gfxoff-until-GC-IP-blocks-comple.patch + patches.suse/drm-i915-Extend-Wa_1607297627-to-Alderlake-P.patch patches.suse/drm-i915-dp-Reset-frl-trained-flag-before-restarting.patch + patches.suse/drm-bridge-ps8640-Add-back-the-50-ms-mystery-delay-a.patch patches.suse/ALSA-hda-realtek-simplify-the-return-of-comp_bind.patch patches.suse/ALSA-hda-realtek-Add-quirk-for-ASUS-Zenbook-using-CS.patch patches.suse/ALSA-ac97-fix-possible-memory-leak-in-snd_ac97_dev_r.patch @@ -34938,6 +35001,7 @@ patches.suse/nfc-nxp-nci-Fix-potential-memory-leak-in-nxp_nci_sen.patch patches.suse/nfc-s3fwrn5-Fix-potential-memory-leak-in-s3fwrn5_nci.patch patches.suse/nfc-nfcmrvl-Fix-potential-memory-leak-in-nfcmrvl_i2c.patch + patches.suse/net-sched-Fix-use-after-free-in-red_enqueue.patch patches.suse/sfc-Fix-an-error-handling-path-in-efx_pci_probe.patch patches.suse/rose-Fix-NULL-pointer-dereference-in-rose_send_frame.patch patches.suse/mISDN-fix-possible-memory-leak-in-mISDN_register_dev.patch @@ -34951,6 +35015,9 @@ patches.suse/Bluetooth-L2CAP-Fix-accepting-connection-request-for.patch patches.suse/Bluetooth-L2CAP-Fix-l2cap_global_chan_by_psm.patch patches.suse/Bluetooth-L2CAP-Fix-attempting-to-access-uninitializ.patch + patches.suse/ipvs-use-explicitly-signed-chars.patch + patches.suse/ipvs-fix-WARNING-in-__ip_vs_cleanup_batch.patch + patches.suse/ipvs-fix-WARNING-in-ip_vs_app_net_cleanup.patch patches.suse/ibmvnic-Free-rwi-on-reset-success.patch patches.suse/net-smc-Fix-possible-leaked-pernet-namespace-in-smc_init patches.suse/vsock-remove-the-unused-wait-in-vsock_connectible_re.patch @@ -34959,7 +35026,10 @@ patches.suse/fuse-fix-readdir-cache-race.patch patches.suse/fuse-add-file_modified-to-fallocate.patch patches.suse/ata-pata_legacy-fix-pdc20230_set_piomode.patch + patches.suse/drm-rockchip-dw_hdmi-filter-regulator-EPROBE_DEFER-e.patch patches.suse/drm-rockchip-dsi-Force-synchronous-probe.patch + patches.suse/drm-rockchip-fix-fbdev-on-non-IOMMU-devices.patch + patches.suse/drm-imx-Kconfig-Remove-duplicated-select-DRM_KMS_HEL.patch patches.suse/drm-imx-imx-tve-Fix-return-type-of-imx_tve_connector.patch patches.suse/0476-drm-amd-display-Update-DSC-capabilitie-for-DCN314.patch patches.suse/0477-drm-amd-display-Ignore-Cable-ID-Feature.patch @@ -35081,6 +35151,8 @@ patches.suse/drm-vc4-Fix-missing-platform_unregister_drivers-call.patch patches.suse/0510-drm-amdgpu-Fix-the-lpfn-checking-condition-in-drm-bu.patch patches.suse/drm-i915-dmabuf-fix-sg_table-handling-in-map_dma_buf.patch + patches.suse/drm-i915-psr-Send-update-also-on-invalidate.patch + patches.suse/drm-i915-Do-not-set-cache_dirty-for-DGFX.patch patches.suse/ALSA-hda-realtek-Add-quirk-for-ASUS-Zenbook-using-CS-8d06679b25fc.patch patches.suse/ALSA-hda-ca0132-add-quirk-for-EVGA-Z390-DARK.patch patches.suse/ALSA-usb-audio-Yet-more-regression-for-for-the-delay.patch @@ -35358,6 +35430,8 @@ patches.suse/0530-drm-amdgpu-handle-gang-submit-before-VMID.patch patches.suse/dma-buf-fix-racing-conflict-of-dma_heap_add.patch patches.suse/fbcon-Use-kzalloc-in-fbcon_prepare_logo.patch + patches.suse/drm-i915-Fix-warn-in-intel_display_power_-_domain-fu.patch + patches.suse/drm-i915-gvt-Get-reference-to-KVM-iff-attachment-to-.patch patches.suse/0531-drm-amd-display-Align-dcn314_smu-logging-with-other-.patch patches.suse/0532-drm-amdgpu-always-register-an-MMU-notifier-for-userp.patch patches.suse/0533-drm-amdgpu-fix-userptr-HMM-range-handling-v2.patch @@ -35708,10 +35782,14 @@ patches.suse/media-dvb-usb-az6027-fix-null-ptr-deref-in-az6027_i2.patch patches.suse/media-saa7164-fix-missing-pci_disable_device.patch patches.suse/media-si470x-Fix-use-after-free-in-si470x_int_in_cal.patch + patches.suse/drm-bridge-it6505-Adapt-runtime-power-management-fra.patch + patches.suse/drm-bridge-it6505-Add-pre_enable-post_disable-callba.patch patches.suse/drm-edid-Fix-minimum-bpc-supported-with-DSC1.2-for-H.patch patches.suse/0001-drm-ast-Add-Atomic-gamma-lut-support-for-aspeed.patch + patches.suse/drm-atomic-helper-Don-t-allocate-new-plane-state-in-.patch patches.suse/0001-drm-mgag200-Do-not-call-drm_atomic_add_affected_plan.patch patches.suse/drm-bridge-adv7533-remove-dynamic-lane-switching-fro.patch + patches.suse/drm-lcdif-Switch-to-limited-range-for-RGB-to-YUV-con.patch patches.suse/0002-drm-ast-Acquire-I-O-register-lock-in-atomic_commit_t.patch patches.suse/0003-drm-ast-Call-drm_atomic_helper_check_plane_state-unc.patch patches.suse/0004-drm-ast-Do-not-call-drm_atomic_add_affected_planes.patch @@ -35719,12 +35797,14 @@ patches.suse/0006-drm-ast-Rename-struct-ast_cursor_plane-to-struct-ast.patch patches.suse/0007-drm-ast-Style-cleanups-in-plane-code.patch patches.suse/0002-drm-mgag200-Fix-PLL-setup-for-G200_SE_A-rev-4.patch + patches.suse/drm-bridge-it6505-Initialize-AUX-channel-in-it6505_i.patch patches.suse/drm-connector-send-hotplug-uevent-on-connector-clean.patch patches.suse/drm-vmwgfx-Fix-a-sparse-warning-in-kernel-docs.patch patches.suse/drm-i915-Fix-watermark-calculations-for-DG2-CCS-modi.patch patches.suse/drm-i915-Fix-watermark-calculations-for-DG2-CCS-CC-m.patch patches.suse/drm-rockchip-lvds-fix-PM-usage-counter-unbalance-in-.patch patches.suse/drm-vmwgfx-Validate-the-box-size-for-the-snooped-cur.patch + patches.suse/drm-lcdif-change-burst-size-to-256B.patch patches.suse/drm-panel-panel-sitronix-st7701-Remove-panel-on-DSI-.patch patches.suse/drm-i915-dg2-introduce-Wa_22015475538.patch patches.suse/drm-i915-guc-Enable-compute-scheduling-on-DG2.patch @@ -35749,13 +35829,17 @@ patches.suse/drm-i915-display-handle-migration-for-dpt.patch patches.suse/drm-i915-allow-control-over-the-flags-when-migrating.patch patches.suse/drm-i915-display-consider-DG2_RC_CCS_CC-when-migrati.patch + patches.suse/drm-i915-Fix-compute-pre-emption-w-a-to-apply-to-com.patch + patches.suse/drm-amdgpu-Revert-drm-amdgpu-getting-fan-speed-pwm-f.patch patches.suse/drm-amdgpu-powerplay-psm-Fix-memory-leak-in-power-st.patch patches.suse/drm-amd-display-prevent-memory-leak.patch patches.suse/Revert-drm-amd-display-Limit-max-DSC-target-bpp-for-.patch patches.suse/drm-amdgpu-Fix-type-of-second-parameter-in-trans_msg.patch patches.suse/drm-amdgpu-Fix-type-of-second-parameter-in-odn_edit_.patch + patches.suse/drm-rcar-du-Drop-leftovers-dependencies-from-Kconfig.patch patches.suse/drm-ingenic-Fix-missing-platform_driver_unregister-c.patch patches.suse/dt-bindings-display-sun6i-dsi-Fix-clock-conditional.patch + patches.suse/drm-lcdif-Set-and-enable-FIFO-Panic-threshold.patch patches.suse/drm-msm-Use-drm_mode_copy.patch patches.suse/drm-rockchip-Use-drm_mode_copy.patch patches.suse/drm-sti-Use-drm_mode_copy.patch @@ -35763,6 +35847,7 @@ patches.suse/drm-etnaviv-add-missing-quirks-for-GC300.patch patches.suse/drm-etnaviv-don-t-truncate-physical-page-address.patch patches.suse/drm-radeon-Add-the-missed-acpi_put_table-to-fix-memo.patch + patches.suse/drm-amd-display-delete-the-duplicate-.set_odm_bypass.patch patches.suse/drm-amd-display-fix-array-index-out-of-bound-error-i.patch patches.suse/amdgpu-pm-prevent-array-underflow-in-vega20_odn_edit.patch patches.suse/drm-i915-ttm-never-purge-busy-objects.patch @@ -35772,6 +35857,9 @@ patches.suse/drm-tegra-Add-missing-clk_disable_unprepare-in-tegra.patch patches.suse/memory-tegra-Add-API-for-retrieving-carveout-bounds.patch patches.suse/drm-amdgpu-fix-pci-device-refcount-leak.patch + patches.suse/drm-msm-mdp5-stop-overriding-drvdata.patch + patches.suse/drm-i915-guc-make-default_lists-const-data.patch + patches.suse/drm-i915-bios-fix-a-memory-leak-in-generate_lfp_data.patch patches.suse/drm-i915-dsi-fix-VBT-send-packet-port-selection-for--f9cdf4130671.patch patches.suse/drm-amd-pm-smu11-BACO-is-supported-when-it-s-in-BACO.patch patches.suse/drm-radeon-Fix-PCI-device-refcount-leak-in-radeon_at.patch @@ -35893,6 +35981,12 @@ patches.suse/wifi-rtl8xxxu-Fix-the-channel-width-reporting.patch patches.suse/wifi-brcmfmac-Fix-error-return-code-in-brcmf_sdio_do.patch patches.suse/0001-sctp-sysctl-make-extra-pointers-netns-aware.patch + patches.suse/ipvs-add-rcu-protection-to-stats.patch + patches.suse/ipvs-use-common-functions-for-stats-allocation.patch + patches.suse/ipvs-use-u64_stats_t-for-the-per-cpu-counters.patch + patches.suse/ipvs-use-kthreads-for-stats-estimation.patch + patches.suse/ipvs-add-est_cpulist-and-est_nice-sysctl-vars.patch + patches.suse/ipvs-run_estimation-should-control-the-kthread-tasks.patch patches.suse/Bluetooth-MGMT-Fix-error-report-for-ADD_EXT_ADV_PARA.patch patches.suse/Bluetooth-Fix-EALREADY-and-ELOOP-cases-in-bt_status.patch patches.suse/Bluetooth-hci_conn-Fix-crash-on-hci_create_cis_sync.patch @@ -35906,6 +36000,7 @@ patches.suse/Bluetooth-RFCOMM-don-t-call-kfree_skb-under-spin_loc.patch patches.suse/hamradio-don-t-call-dev_kfree_skb-under-spin_lock_ir.patch patches.suse/af_unix-call-proto_unregister-in-the-error-path-in-a.patch + patches.suse/ipvs-fix-type-warning-in-do_div-on-32-bit.patch patches.suse/scsi-lpfc-Set-sli4_param-s-cmf-option-to-zero-when-C.patch patches.suse/scsi-lpfc-Fix-hard-lockup-when-reading-the-rx_monito.patch patches.suse/scsi-lpfc-Log-when-congestion-management-limits-are-.patch @@ -36032,6 +36127,7 @@ patches.suse/usb-cdnsp-fix-lack-of-ZLP-for-ep0.patch patches.suse/usb-dwc3-Fix-race-between-dwc3_set_mode-and-__dwc3_s.patch patches.suse/xhci-Apply-XHCI_RESET_TO_DEFAULT-quirk-to-ADL-N.patch + patches.suse/xhci-Prevent-infinite-loop-in-transaction-errors-rec.patch patches.suse/USB-serial-f81232-fix-division-by-zero-on-line-speed.patch patches.suse/USB-serial-f81534-fix-division-by-zero-on-line-speed.patch patches.suse/USB-serial-option-add-Quectel-EM05-G-modem-f0052d7a1edb.patch @@ -36104,6 +36200,7 @@ patches.suse/mISDN-hfcsusb-don-t-call-dev_kfree_skb-kfree_skb-und.patch patches.suse/mISDN-hfcpci-don-t-call-dev_kfree_skb-kfree_skb-unde.patch patches.suse/mISDN-hfcmulti-don-t-call-dev_kfree_skb-kfree_skb-un.patch + patches.suse/ipvs-add-a-default-case-in-do_ip_vs_set_ctl.patch patches.suse/nfc-pn533-Clear-nfc_target-before-being-used.patch patches.suse/r6040-Fix-kmemleak-in-probe-and-remove.patch patches.suse/selftests-devlink-fix-the-fd-redirect-in-dummy_repor.patch @@ -36156,6 +36253,8 @@ patches.suse/drm-amdgpu-handle-polaris10-11-overlap-asics-v2.patch patches.suse/drm-i915-Fix-documentation-for-intel_uncore_forcewak.patch patches.suse/drm-i915-display-Don-t-disable-DDI-Transcoder-when-s.patch + patches.suse/drm-i915-ttm-consider-CCS-for-backup-objects.patch + patches.suse/drm-amd-pm-avoid-large-variable-on-kernel-stack.patch patches.suse/ALSA-hda-hdmi-Add-HP-Device-0x8711-to-force-connect-.patch patches.suse/ALSA-usb-audio-add-the-quirk-for-KT0206-device.patch patches.suse/ALSA-hda-realtek-Add-quirk-for-Lenovo-TianYi510Pro-1.patch @@ -36183,6 +36282,7 @@ patches.suse/ACPI-resource-do-IRQ-override-on-Lenovo-14ALC7.patch patches.suse/ACPI-resource-Add-Asus-ExpertBook-B2502-to-Asus-quir.patch patches.suse/ata-ahci-Fix-PCS-quirk-application-for-suspend.patch + patches.suse/drm-i915-improve-the-catch-all-evict-to-handle-lock-.patch patches.suse/btrfs-fix-resolving-backrefs-for-inline-extent-follo.patch patches.suse/x86-kexec-Fix-double-free-of-elf-header-buffer.patch patches.suse/vdpa_sim-fix-possible-memory-leak-in-vdpasim_net_ini.patch @@ -36193,9 +36293,12 @@ patches.suse/fbdev-matroxfb-G200eW-Increase-max-memory-from-1-MB-.patch patches.suse/gpio-sifive-Fix-refcount-leak-in-sifive_gpio_probe.patch patches.suse/vmxnet3-correctly-report-csum_level-for-encapsulated.patch + patches.suse/net-sched-fix-memory-leak-in-tcindex_set_parms.patch patches.suse/nfc-Fix-potential-resource-leaks.patch patches.suse/net-phy-xgmiitorgmii-Fix-refcount-leak-in-xgmiitorgm.patch patches.suse/dt-bindings-net-sun8i-emac-Add-phy-supply-property.patch + patches.suse/net-sched-atm-dont-intepret-cls-results-when-asked-t.patch + patches.suse/net-sched-cbq-dont-intepret-cls-results-when-asked-t.patch patches.suse/octeontx2-pf-Fix-lmtst-ID-used-in-aura-free.patch patches.suse/usb-rndis_host-Secure-rndis_query-check-against-int-.patch patches.suse/caif-fix-memory-leak-in-cfctrl_linkup_request.patch @@ -36203,6 +36306,8 @@ patches.suse/drm-panfrost-Fix-GEM-handle-creation-ref-counting.patch patches.suse/drm-meson-Reduce-the-FIFO-lines-held-when-AFBC-is-no.patch patches.suse/drm-imx-ipuv3-plane-Fix-overlay-plane-width.patch + patches.suse/drm-amdkfd-Fix-kernel-warning-during-topology-setup.patch + patches.suse/Revert-drm-amd-display-Enable-Freesync-Video-Mode-by.patch patches.suse/drm-i915-unpin-on-error-in-intel_vgpu_shadow_mm_pin.patch patches.suse/drm-i915-gvt-fix-gvt-debugfs-destroy.patch patches.suse/drm-i915-gvt-fix-vgpu-debugfs-clean-in-remove.patch @@ -36220,9 +36325,12 @@ patches.suse/nfc-pn533-Wait-for-out_urb-s-completion-in-pn533_usb.patch patches.suse/net-sched-disallow-noqueue-for-qdisc-classes.patch patches.suse/drm-virtio-Fix-GEM-handle-creation-UAF.patch + patches.suse/drm-i915-Reserve-enough-fence-slot-for-i915_vma_unbi.patch patches.suse/drm-i915-gt-Reset-twice.patch + patches.suse/drm-msm-dpu-Fix-some-kernel-doc-comments.patch patches.suse/dt-bindings-msm-dsi-Don-t-require-vcca-supply-on-14n.patch patches.suse/dt-bindings-msm-dsi-Don-t-require-vdds-supply-on-10n.patch + patches.suse/drm-msm-dpu-Fix-memory-leak-in-msm_mdss_parse_data_b.patch patches.suse/drm-msm-dp-do-not-complete-dp_aux_cmd_fifo_tx-if-irq.patch patches.suse/dt-bindings-msm-dsi-phy-28nm-Add-missing-qcom-dsi-ph.patch patches.suse/dt-bindings-msm-dsi-controller-main-Fix-operating-po.patch @@ -36286,7 +36394,9 @@ patches.suse/dmaengine-tegra210-adma-fix-global-intr-clear.patch patches.suse/dmaengine-Fix-double-increment-of-client_count-in-dm.patch patches.suse/dmaengine-xilinx_dma-call-of_node_put-when-breaking-.patch + patches.suse/drm-msm-gpu-Fix-potential-double-free.patch patches.suse/drm-i915-re-disable-RC6p-on-Sandy-Bridge.patch + patches.suse/drm-i915-selftests-Unwind-hugepages-to-drop-wakeref-.patch patches.suse/drm-panfrost-fix-GENERIC_ATOMIC64-dependency.patch patches.suse/drm-amd-display-Calculate-output_color_space-after-p.patch patches.suse/drm-amd-display-Fix-COLOR_SPACE_YCBCR2020_TYPE-matri.patch @@ -36833,6 +36943,14 @@ patches.suse/kABI-padding-for-generic-crypto.patch patches.suse/kABI-padding-for-bpf.patch patches.suse/rfkill-add-kABI-padding.patch + patches.suse/paddings-add-for-type-C-new-in-SP5.patch + patches.suse/paddings-for-the-new-structures-for-roles.patch + patches.suse/paddings-for-gadgets.patch + patches.suse/paddings-for-TB-and-USB4-XDomain-structures.patch + patches.suse/paddings-for-realtik-802.11.patch + patches.suse/paddings-for-mediatek-802.11.patch + patches.suse/paddings-for-ath-802.11.patch + patches.suse/paddings-for-the-inter-DMN-tunnel-stuff-of-TB.patch ######################################################## # kABI consistency patches