mailweb.openeuler.org
Manage this list

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

Kernel

Threads by month
  • ----- 2026 -----
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
kernel@openeuler.org

  • 7 participants
  • 22683 discussions
[PATCH OLK-6.6 0/3] adapt LTS patch 5ba723cc37230e616fe47ec19d441ba3168b4c4c
by Quanmin Yan 02 Feb '26

02 Feb '26
The original LTS patch is incompatible with the atomic mode of the mm counter. Therefore, the patch needs to be reverted and adapted again. Baolin Wang (1): mm: fix the inaccurate memory statistics issue for users Quanmin Yan (2): Revert "mm: fix the inaccurate memory statistics issue for users" mm: add config option for atomic mode in mm counter arch/arm64/configs/openeuler_defconfig | 1 + arch/x86/configs/openeuler_defconfig | 1 + include/linux/mm.h | 53 ++++++++++++++++++++------ include/trace/events/kmem.h | 2 +- kernel/fork.c | 26 ++++++++++--- mm/Kconfig | 12 ++++++ 6 files changed, 78 insertions(+), 17 deletions(-) -- 2.43.0
2 4
0 0
[PATCH OLK-6.6] arch_topology: Fix incorrect error check in topology_parse_cpu_capacity()
by Wang Wensheng 02 Feb '26

02 Feb '26
From: Kaushlendra Kumar <kaushlendra.kumar(a)intel.com> stable inclusion from stable-v6.6.115 commit 3373f263bb647fcc3b5237cfaef757633b9ee25e category: bugfix bugzilla: https://atomgit.com/src-openeuler/kernel/issues/11599 CVE: CVE-2025-40346 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id… -------------------------------- commit 2eead19334516c8e9927c11b448fbe512b1f18a1 upstream. Fix incorrect use of PTR_ERR_OR_ZERO() in topology_parse_cpu_capacity() which causes the code to proceed with NULL clock pointers. The current logic uses !PTR_ERR_OR_ZERO(cpu_clk) which evaluates to true for both valid pointers and NULL, leading to potential NULL pointer dereference in clk_get_rate(). Per include/linux/err.h documentation, PTR_ERR_OR_ZERO(ptr) returns: "The error code within @ptr if it is an error pointer; 0 otherwise." This means PTR_ERR_OR_ZERO() returns 0 for both valid pointers AND NULL pointers. Therefore !PTR_ERR_OR_ZERO(cpu_clk) evaluates to true (proceed) when cpu_clk is either valid or NULL, causing clk_get_rate(NULL) to be called when of_clk_get() returns NULL. Replace with !IS_ERR_OR_NULL(cpu_clk) which only proceeds for valid pointers, preventing potential NULL pointer dereference in clk_get_rate(). Cc: stable <stable(a)kernel.org> Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar(a)intel.com> Reviewed-by: Sudeep Holla <sudeep.holla(a)arm.com> Fixes: b8fe128dad8f ("arch_topology: Adjust initial CPU capacities with current freq") Link: https://patch.msgid.link/20250923174308.1771906-1-kaushlendra.kumar@intel.c… Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org> Signed-off-by: Wang Hai <wanghai38(a)huawei.com> --- drivers/base/arch_topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 998aefb44315..14aade8b591d 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -347,7 +347,7 @@ bool __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) * frequency (by keeping the initial capacity_freq_ref value). */ cpu_clk = of_clk_get(cpu_node, 0); - if (!PTR_ERR_OR_ZERO(cpu_clk)) { + if (!IS_ERR_OR_NULL(cpu_clk)) { per_cpu(capacity_freq_ref, cpu) = clk_get_rate(cpu_clk) / HZ_PER_KHZ; clk_put(cpu_clk); -- 2.22.0
2 1
0 0
[PATCH OLK-6.6] drm/sched: Fix potential double free in drm_sched_job_add_resv_dependencies
by Wang Wensheng 02 Feb '26

02 Feb '26
From: Tvrtko Ursulin <tvrtko.ursulin(a)igalia.com> stable inclusion from stable-v6.6.114 commit 57239762aa90ad768dac055021f27705dae73344 category: bugfix bugzilla: https://atomgit.com/src-openeuler/kernel/issues/12320 CVE: CVE-2025-40096 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id… -------------------------------- commit 5801e65206b065b0b2af032f7f1eef222aa2fd83 upstream. When adding dependencies with drm_sched_job_add_dependency(), that function consumes the fence reference both on success and failure, so in the latter case the dma_fence_put() on the error path (xarray failed to expand) is a double free. Interestingly this bug appears to have been present ever since commit ebd5f74255b9 ("drm/sched: Add dependency tracking"), since the code back then looked like this: drm_sched_job_add_implicit_dependencies(): ... for (i = 0; i < fence_count; i++) { ret = drm_sched_job_add_dependency(job, fences[i]); if (ret) break; } for (; i < fence_count; i++) dma_fence_put(fences[i]); Which means for the failing 'i' the dma_fence_put was already a double free. Possibly there were no users at that time, or the test cases were insufficient to hit it. The bug was then only noticed and fixed after commit 9c2ba265352a ("drm/scheduler: use new iterator in drm_sched_job_add_implicit_dependencies v2") landed, with its fixup of commit 4eaf02d6076c ("drm/scheduler: fix drm_sched_job_add_implicit_dependencies"). At that point it was a slightly different flavour of a double free, which commit 963d0b356935 ("drm/scheduler: fix drm_sched_job_add_implicit_dependencies harder") noticed and attempted to fix. But it only moved the double free from happening inside the drm_sched_job_add_dependency(), when releasing the reference not yet obtained, to the caller, when releasing the reference already released by the former in the failure case. As such it is not easy to identify the right target for the fixes tag so lets keep it simple and just continue the chain. While fixing we also improve the comment and explain the reason for taking the reference and not dropping it. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin(a)igalia.com> Fixes: 963d0b356935 ("drm/scheduler: fix drm_sched_job_add_implicit_dependencies harder") Reported-by: Dan Carpenter <dan.carpenter(a)linaro.org> Closes: https://lore.kernel.org/dri-devel/aNFbXq8OeYl3QSdm@stanley.mountain/ Cc: Christian König <christian.koenig(a)amd.com> Cc: Rob Clark <robdclark(a)chromium.org> Cc: Daniel Vetter <daniel.vetter(a)ffwll.ch> Cc: Matthew Brost <matthew.brost(a)intel.com> Cc: Danilo Krummrich <dakr(a)kernel.org> Cc: Philipp Stanner <phasta(a)kernel.org> Cc: Christian König <ckoenig.leichtzumerken(a)gmail.com> Cc: dri-devel(a)lists.freedesktop.org Cc: stable(a)vger.kernel.org # v5.16+ Signed-off-by: Philipp Stanner <phasta(a)kernel.org> Link: https://lore.kernel.org/r/20251015084015.6273-1-tvrtko.ursulin@igalia.com Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org> Signed-off-by: Signed-off-by: Wang Wensheng <wangwensheng4(a)huawei.com> --- drivers/gpu/drm/scheduler/sched_main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index fa4652f23471..4faa2108c0a7 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -783,13 +783,14 @@ int drm_sched_job_add_resv_dependencies(struct drm_sched_job *job, dma_resv_assert_held(resv); dma_resv_for_each_fence(&cursor, resv, usage, fence) { - /* Make sure to grab an additional ref on the added fence */ - dma_fence_get(fence); - ret = drm_sched_job_add_dependency(job, fence); - if (ret) { - dma_fence_put(fence); + /* + * As drm_sched_job_add_dependency always consumes the fence + * reference (even when it fails), and dma_resv_for_each_fence + * is not obtaining one, we need to grab one before calling. + */ + ret = drm_sched_job_add_dependency(job, dma_fence_get(fence)); + if (ret) return ret; - } } return 0; } -- 2.22.0
2 1
0 0
[PATCH OLK-6.6] iommu/amd: Avoid stack buffer overflow from kernel cmdline
by Wang Wensheng 02 Feb '26

02 Feb '26
From: Kees Cook <kees(a)kernel.org> stable inclusion from stable-v6.6.103 commit 8f80c633cba144f721d38d9380f23d23ab7db10e category: bugfix bugzilla: https://atomgit.com/src-openeuler/kernel/issues/9098 CVE: CVE-2025-38676 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id… -------------------------------- [ Upstream commit 8503d0fcb1086a7cfe26df67ca4bd9bd9e99bdec ] While the kernel command line is considered trusted in most environments, avoid writing 1 byte past the end of "acpiid" if the "str" argument is maximum length. Reported-by: Simcha Kosman <simcha.kosman(a)cyberark.com> Closes: https://lore.kernel.org/all/AS8P193MB2271C4B24BCEDA31830F37AE84A52@AS8P193M… Fixes: b6b26d86c61c ("iommu/amd: Add a length limitation for the ivrs_acpihid command-line parameter") Signed-off-by: Kees Cook <kees(a)kernel.org> Reviewed-by: Ankit Soni <Ankit.Soni(a)amd.com> Link: https://lore.kernel.org/r/20250804154023.work.970-kees@kernel.org Signed-off-by: Joerg Roedel <joerg.roedel(a)amd.com> Signed-off-by: Sasha Levin <sashal(a)kernel.org> Signed-off-by: Wang Wensheng <wangwensheng4(a)huawei.com> --- drivers/iommu/amd/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index e3d4a23b66fd..090b88a4b1e3 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -3633,7 +3633,7 @@ static int __init parse_ivrs_acpihid(char *str) { u32 seg = 0, bus, dev, fn; char *hid, *uid, *p, *addr; - char acpiid[ACPIID_LEN] = {0}; + char acpiid[ACPIID_LEN + 1] = { }; /* size with NULL terminator */ int i; addr = strchr(str, '@'); @@ -3659,7 +3659,7 @@ static int __init parse_ivrs_acpihid(char *str) /* We have the '@', make it the terminator to get just the acpiid */ *addr++ = 0; - if (strlen(str) > ACPIID_LEN + 1) + if (strlen(str) > ACPIID_LEN) goto not_found; if (sscanf(str, "=%s", acpiid) != 1) -- 2.22.0
2 1
0 0
[PATCH OLK-6.6] HID: core: Harden s32ton() against conversion to 0 bits
by Wang Wensheng 02 Feb '26

02 Feb '26
From: Alan Stern <stern(a)rowland.harvard.edu> mainline inclusion from mainline-v6.17-rc1 commit a6b87bfc2ab5bccb7ad953693c85d9062aef3fdd category: bugfix bugzilla: https://atomgit.com/src-openeuler/kernel/issues/9186 CVE: CVE-2025-38556 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id… -------------------------------- Testing by the syzbot fuzzer showed that the HID core gets a shift-out-of-bounds exception when it tries to convert a 32-bit quantity to a 0-bit quantity. Ideally this should never occur, but there are buggy devices and some might have a report field with size set to zero; we shouldn't reject the report or the device just because of that. Instead, harden the s32ton() routine so that it returns a reasonable result instead of crashing when it is called with the number of bits set to 0 -- the same as what snto32() does. Signed-off-by: Alan Stern <stern(a)rowland.harvard.edu> Reported-by: syzbot+b63d677d63bcac06cf90(a)syzkaller.appspotmail.com Closes: https://lore.kernel.org/linux-usb/68753a08.050a0220.33d347.0008.GAE@google.… Tested-by: syzbot+b63d677d63bcac06cf90(a)syzkaller.appspotmail.com Fixes: dde5845a529f ("[PATCH] Generic HID layer - code split") Cc: stable(a)vger.kernel.org Link: https://patch.msgid.link/613a66cd-4309-4bce-a4f7-2905f9bce0c9@rowland.harva… Signed-off-by: Benjamin Tissoires <bentiss(a)kernel.org> Conflicts: drivers/hid/hid-core.c [Only context conflict because of commit c653ffc283404 is not applied] Signed-off-by: Wang Wensheng <wangwensheng4(a)huawei.com> --- drivers/hid/hid-core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 266cd56dec50..d8fda282d049 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1351,7 +1351,12 @@ EXPORT_SYMBOL_GPL(hid_snto32); static u32 s32ton(__s32 value, unsigned n) { - s32 a = value >> (n - 1); + s32 a; + + if (!value || !n) + return 0; + + a = value >> (n - 1); if (a && a != -1) return value < 0 ? 1 << (n - 1) : (1 << (n - 1)) - 1; return value & ((1 << n) - 1); -- 2.22.0
2 1
0 0
[PATCH OLK-6.6] iommu: Fix two issues in iommu_copy_struct_from_user()
by Wang Wensheng 02 Feb '26

02 Feb '26
From: Nicolin Chen <nicolinc(a)nvidia.com> mainline inclusion from mainline-v6.15-rc5 commit 30a3f2f3e4bd6335b727c83c08a982d969752bc1 category: bugfix bugzilla: https://atomgit.com/src-openeuler/kernel/issues/10084 CVE: CVE-2025-37900 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?… -------------------------------- In the review for iommu_copy_struct_to_user() helper, Matt pointed out that a NULL pointer should be rejected prior to dereferencing it: https://lore.kernel.org/all/86881827-8E2D-461C-BDA3-FA8FD14C343C@nvidia.com And Alok pointed out a typo at the same time: https://lore.kernel.org/all/480536af-6830-43ce-a327-adbd13dc3f1d@oracle.com Since both issues were copied from iommu_copy_struct_from_user(), fix them first in the current header. Fixes: e9d36c07bb78 ("iommu: Add iommu_copy_struct_from_user helper") Cc: stable(a)vger.kernel.org Signed-off-by: Nicolin Chen <nicolinc(a)nvidia.com> Reviewed-by: Kevin Tian <kevin.tian(a)intel.com> Acked-by: Alok Tiwari <alok.a.tiwari(a)oracle.com> Reviewed-by: Matthew R. Ochs <mochs(a)nvidia.com> Link: https://lore.kernel.org/r/20250414191635.450472-1-nicolinc@nvidia.com Signed-off-by: Joerg Roedel <jroedel(a)suse.de> Signed-off-by: Wang Wensheng <wangwensheng4(a)huawei.com> --- include/linux/iommu.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index ceecbc5ba759..974c3b94365f 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -517,10 +517,10 @@ static inline int __iommu_copy_struct_from_user( void *dst_data, const struct iommu_user_data *src_data, unsigned int data_type, size_t data_len, size_t min_len) { - if (src_data->type != data_type) - return -EINVAL; if (WARN_ON(!dst_data || !src_data)) return -EINVAL; + if (src_data->type != data_type) + return -EINVAL; if (src_data->len < min_len || data_len < src_data->len) return -EINVAL; return copy_struct_from_user(dst_data, data_len, src_data->uptr, @@ -533,8 +533,8 @@ static inline int __iommu_copy_struct_from_user( * include/uapi/linux/iommufd.h * @user_data: Pointer to a struct iommu_user_data for user space data info * @data_type: The data type of the @kdst. Must match with @user_data->type - * @min_last: The last memember of the data structure @kdst points in the - * initial version. + * @min_last: The last member of the data structure @kdst points in the initial + * version. * Return 0 for success, otherwise -error. */ #define iommu_copy_struct_from_user(kdst, user_data, data_type, min_last) \ -- 2.22.0
2 1
0 0
[PATCH OLK-6.6] scsi: leapraid: add RAID disk hide/show events and fix misc issues
by haodongdong 02 Feb '26

02 Feb '26
LeapIO inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/8462 ------------------------------------------ This change introduces RAID disk hide/show events to allow dynamic visibility control of RAID devices. It also updates the MSI-X vector count retrieval logic and unifies driver naming from LeapRaid to LeapRAID for consistency. In addition, fix an issue where the fw_log workqueue was not properly released during system shutdown, which could lead to resource leaks. Signed-off-by: haodongdong <doubled(a)leap-io.com> --- drivers/scsi/leapraid/leapraid.h | 2 + drivers/scsi/leapraid/leapraid_func.c | 104 ++++++++++++++++++++++---- drivers/scsi/leapraid/leapraid_func.h | 47 ++++++------ drivers/scsi/leapraid/leapraid_os.c | 2 +- 4 files changed, 116 insertions(+), 39 deletions(-) diff --git a/drivers/scsi/leapraid/leapraid.h b/drivers/scsi/leapraid/leapraid.h index 842810d41542..77bb93b79254 100644 --- a/drivers/scsi/leapraid/leapraid.h +++ b/drivers/scsi/leapraid/leapraid.h @@ -310,6 +310,8 @@ #define LEAPRAID_EVT_IR_RC_PD_UNHIDDEN_TO_DELETE 0x04 #define LEAPRAID_EVT_IR_RC_PD_CREATED_TO_HIDE 0x05 #define LEAPRAID_EVT_IR_RC_PD_DELETED_TO_EXPOSE 0x06 +#define LEAPRAID_EVT_IR_RC_VOLUME_HIDE 0x0A +#define LEAPRAID_EVT_IR_RC_VOLUME_UNHIDE 0x0B /* sas topology change event */ #define LEAPRAID_EVT_SAS_TOPO_ES_NO_EXPANDER 0x00 diff --git a/drivers/scsi/leapraid/leapraid_func.c b/drivers/scsi/leapraid/leapraid_func.c index 2fc142fff982..ad8aee40e2c1 100644 --- a/drivers/scsi/leapraid/leapraid_func.c +++ b/drivers/scsi/leapraid/leapraid_func.c @@ -4132,6 +4132,66 @@ static void leapraid_sas_pd_expose( } } +static void leapraid_sas_vol_visibility(struct leapraid_adapter *adapter, + struct leapraid_evt_data_ir_change *evt_data) +{ + struct leapraid_raid_volume *raid_volume = NULL; + struct scsi_device *sdev = NULL; + u16 hdl = 0; + unsigned long flags; + u8 rc = 0; + u8 reprobe_flg = 0; + + hdl = le16_to_cpu(evt_data->vol_dev_hdl); + rc = evt_data->reason_code; + spin_lock_irqsave(&adapter->dev_topo.raid_volume_lock, flags); + raid_volume = leapraid_raid_volume_find_by_hdl(adapter, hdl); + if (!raid_volume) { + spin_unlock_irqrestore(&adapter->dev_topo.raid_volume_lock, + flags); + dev_warn(&adapter->pdev->dev, + "%s:%d: volume handle 0x%x not found\n", + __func__, __LINE__, hdl); + return; + } + + reprobe_flg = 0; + sdev = raid_volume->sdev; + if (sdev) { + if (sdev->no_uld_attach) { + if (rc == LEAPRAID_EVT_IR_RC_VOLUME_UNHIDE) { + sdev->no_uld_attach = 0; + reprobe_flg = 1; + } + } else { + if (rc == LEAPRAID_EVT_IR_RC_VOLUME_HIDE) { + sdev->no_uld_attach = 1; + reprobe_flg = 1; + } + } + + if (reprobe_flg) { + if (sdev->no_uld_attach) + sdev_printk(KERN_INFO, sdev, "hide vol\n"); + else + sdev_printk(KERN_INFO, sdev, "unhide vol\n"); + + WARN_ON(scsi_device_reprobe(sdev)); + } else { + dev_warn(&adapter->pdev->dev, + "%s:rc(0x%x):request matches, skipping.\n", + __func__, rc); + } + + } else { + dev_warn(&adapter->pdev->dev, + "%s:%d: volume handle 0x%x has no sdev\n", + __func__, __LINE__, hdl); + } + + spin_unlock_irqrestore(&adapter->dev_topo.raid_volume_lock, flags); +} + static void leapraid_sas_volume_add(struct leapraid_adapter *adapter, struct leapraid_evt_data_ir_change *evt_data) { @@ -4250,6 +4310,10 @@ static void leapraid_sas_ir_chg_evt(struct leapraid_adapter *adapter, case LEAPRAID_EVT_IR_RC_PD_DELETED_TO_EXPOSE: leapraid_sas_pd_expose(adapter, evt_data); break; + case LEAPRAID_EVT_IR_RC_VOLUME_HIDE: + case LEAPRAID_EVT_IR_RC_VOLUME_UNHIDE: + leapraid_sas_vol_visibility(adapter, evt_data); + break; default: break; } @@ -6397,6 +6461,8 @@ static int leapraid_get_adapter_features(struct leapraid_adapter *adapter) le16_to_cpu(leap_mpi_rep.hp_slot); adapter->adapter_attr.features.adapter_caps = le32_to_cpu(leap_mpi_rep.adapter_caps); + adapter->adapter_attr.features.max_msix_vectors = + leap_mpi_rep.max_msix_vectors; adapter->adapter_attr.features.max_volumes = leap_mpi_rep.max_volumes; if (!adapter->adapter_attr.features.max_volumes) @@ -6754,11 +6820,15 @@ static int leapraid_set_msix(struct leapraid_adapter *adapter) goto legacy_int; msix_cnt = leapraid_msix_cnt(adapter->pdev); - if (msix_cnt <= 0) { + if (msix_cnt <= 0 || + adapter->adapter_attr.features.max_msix_vectors == 0) { dev_info(&adapter->pdev->dev, "msix unsupported!\n"); goto legacy_int; } + msix_cnt = min_t(int, msix_cnt, + adapter->adapter_attr.features.max_msix_vectors); + if (reset_devices) adapter->adapter_attr.rq_cnt = 1; else @@ -6859,11 +6929,15 @@ static int leapraid_set_msi(struct leapraid_adapter *adapter) goto legacy_int1; msi_cnt = leapraid_msi_cnt(adapter->pdev); - if (msi_cnt <= 0) { - dev_info(&adapter->pdev->dev, "msix unsupported!\n"); + if (msi_cnt <= 0 || + adapter->adapter_attr.features.max_msix_vectors == 0) { + dev_info(&adapter->pdev->dev, "msi unsupported!\n"); goto legacy_int1; } + msi_cnt = min_t(int, msi_cnt, + adapter->adapter_attr.features.max_msix_vectors); + if (reset_devices) adapter->adapter_attr.rq_cnt = 1; else @@ -7015,6 +7089,18 @@ int leapraid_set_pcie_and_notification(struct leapraid_adapter *adapter) leapraid_mask_int(adapter); + rc = leapraid_make_adapter_ready(adapter, PART_RESET); + if (rc) { + dev_err(&adapter->pdev->dev, "make adapter ready failure\n"); + goto out_fail; + } + + rc = leapraid_get_adapter_features(adapter); + if (rc) { + dev_err(&adapter->pdev->dev, "get adapter feature failure\n"); + goto out_fail; + } + rc = leapraid_set_notification(adapter); if (rc) goto out_fail; @@ -8185,18 +8271,6 @@ int leapraid_ctrl_init(struct leapraid_adapter *adapter) PCI_EXP_DEVCTL_EXT_TAG); } - rc = leapraid_make_adapter_ready(adapter, PART_RESET); - if (rc) { - dev_err(&adapter->pdev->dev, "make adapter ready failure\n"); - goto out_free_resources; - } - - rc = leapraid_get_adapter_features(adapter); - if (rc) { - dev_err(&adapter->pdev->dev, "get adapter feature failure\n"); - goto out_free_resources; - } - rc = leapraid_fw_log_init(adapter); if (rc) { dev_err(&adapter->pdev->dev, "fw log init failure\n"); diff --git a/drivers/scsi/leapraid/leapraid_func.h b/drivers/scsi/leapraid/leapraid_func.h index 2c51ef359b7e..f7072d078315 100644 --- a/drivers/scsi/leapraid/leapraid_func.h +++ b/drivers/scsi/leapraid/leapraid_func.h @@ -46,15 +46,15 @@ #define LEAPRAID_SYS_LOG_BUF_RESERVE 0x1000 /* Driver version and name */ -#define LEAPRAID_DRIVER_NAME "LeapRaid" +#define LEAPRAID_DRIVER_NAME "LeapRAID" #define LEAPRAID_NAME_LENGTH 48 #define LEAPRAID_AUTHOR "LeapIO Inc." -#define LEAPRAID_DESCRIPTION "LeapRaid Driver" -#define LEAPRAID_DRIVER_VERSION "2.00.00.05" +#define LEAPRAID_DESCRIPTION "LeapRAID Driver" +#define LEAPRAID_DRIVER_VERSION "2.00.00.06" #define LEAPRAID_MAJOR_VERSION 2 #define LEAPRAID_MINOR_VERSION 00 #define LEAPRAID_BUILD_VERSION 00 -#define LEAPRAID_RELEASE_VERSION 05 +#define LEAPRAID_RELEASE_VERSION 06 /* Device ID */ #define LEAPRAID_VENDOR_ID 0xD405 @@ -243,6 +243,7 @@ struct leapraid_adapter_features { u16 hp_slot; u32 adapter_caps; u32 fw_version; + u8 max_msix_vectors; u8 max_volumes; u16 max_dev_handle; u16 min_dev_handle; @@ -349,7 +350,7 @@ struct leapraid_rep_desc_seg_maint { }; /** - * struct leapraid_mem_desc - Memory descriptor for LeapRaid adapter + * struct leapraid_mem_desc - Memory descriptor for LeapRAID adapter * * @task_desc: Pointer to task descriptor * @task_desc_dma: DMA address of task descriptor @@ -395,7 +396,7 @@ struct leapraid_mem_desc { #define LEAPRAID_CMD_RESET 0x0008 /** - * enum LEAPRAID_CB_INDEX - Callback index for LeapRaid driver + * enum LEAPRAID_CB_INDEX - Callback index for LeapRAID driver * * @LEAPRAID_SCAN_DEV_CB_IDX: Scan device callback index * @LEAPRAID_CONFIG_CB_IDX: Configuration callback index @@ -513,7 +514,7 @@ struct leapraid_dynamic_task_desc { * struct leapraid_fw_evt_work - Firmware event work structure * * @list: Linked list node for queuing the work - * @adapter: Pointer to the associated LeapRaid adapter + * @adapter: Pointer to the associated LeapRAID adapter * @work: Work structure used by the kernel workqueue * @refcnt: Reference counter for managing the lifetime of this work * @evt_data: Pointer to firmware event data @@ -554,9 +555,9 @@ struct leapraid_fw_evt_struct { }; /** - * struct leapraid_rq - Represents a LeapRaid request queue + * struct leapraid_rq - Represents a LeapRAID request queue * - * @adapter: Pointer to the associated LeapRaid adapter + * @adapter: Pointer to the associated LeapRAID adapter * @msix_idx: MSI-X vector index used by this queue * @rep_post_host_idx: Index of the last processed reply descriptor * @rep_desc: Pointer to the reply descriptor associated with this queue @@ -576,7 +577,7 @@ struct leapraid_rq { * struct leapraid_int_rq - Internal request queue for a CPU * * @affinity_hint: CPU affinity mask for the queue - * @rq: Underlying LeapRaid request queue structure + * @rq: Underlying LeapRAID request queue structure */ struct leapraid_int_rq { cpumask_var_t affinity_hint; @@ -584,11 +585,11 @@ struct leapraid_int_rq { }; /** - * struct leapraid_blk_mq_poll_rq - Polling request for LeapRaid blk-mq + * struct leapraid_blk_mq_poll_rq - Polling request for LeapRAID blk-mq * * @busy: Atomic flag indicating request is being processed * @pause: Atomic flag to temporarily suspend polling - * @rq: The underlying LeapRaid request structure + * @rq: The underlying LeapRAID request structure */ struct leapraid_blk_mq_poll_rq { atomic_t busy; @@ -598,7 +599,7 @@ struct leapraid_blk_mq_poll_rq { /** * struct leapraid_notification_desc - Notification - * descriptor for LeapRaid + * descriptor for LeapRAID * * @iopoll_qdex: Index of the I/O polling queue * @iopoll_qcnt: Count of I/O polling queues @@ -621,7 +622,7 @@ struct leapraid_notification_desc { }; /** - * struct leapraid_reset_desc - Reset descriptor for LeapRaid + * struct leapraid_reset_desc - Reset descriptor for LeapRAID * * @fault_reset_wq: Workqueue for fault reset operations * @fault_reset_work: Delayed work structure for fault reset @@ -651,7 +652,7 @@ struct leapraid_reset_desc { /** * struct leapraid_scan_dev_desc - Scan device descriptor - * for LeapRaid + * for LeapRAID * * @wait_scan_dev_done: Flag indicating if scan device operation is done * @driver_loading: Flag indicating if driver is loading @@ -670,7 +671,7 @@ struct leapraid_scan_dev_desc { }; /** - * struct leapraid_access_ctrl - Access control structure for LeapRaid + * struct leapraid_access_ctrl - Access control structure for LeapRAID * * @pci_access_lock: Mutex for PCI access control * @adapter_thermal_alert: Flag indicating if adapter thermal alert is active @@ -687,7 +688,7 @@ struct leapraid_access_ctrl { }; /** - * struct leapraid_fw_log_desc - Firmware log descriptor for LeapRaid + * struct leapraid_fw_log_desc - Firmware log descriptor for LeapRAID * * @fw_log_buffer: Buffer for firmware log data * @fw_log_buffer_dma: DMA address of the firmware log buffer @@ -711,7 +712,7 @@ struct leapraid_fw_log_desc { #define LEAPRAID_CARD_PORT_FLG_NEW 0x02 #define LEAPRAID_DISABLE_MP_PORT_ID 0xFF /** - * struct leapraid_card_port - Card port structure for LeapRaid + * struct leapraid_card_port - Card port structure for LeapRAID * * @list: List head for card port * @vphys_list: List head for virtual phy list @@ -732,7 +733,7 @@ struct leapraid_card_port { }; /** - * struct leapraid_card_phy - Card phy structure for LeapRaid + * struct leapraid_card_phy - Card phy structure for LeapRAID * * @port_siblings: List head for port siblings * @card_port: Pointer to the card port @@ -759,7 +760,7 @@ struct leapraid_card_phy { }; /** - * struct leapraid_topo_node - SAS topology node for LeapRaid + * struct leapraid_topo_node - SAS topology node for LeapRAID * * @list: List head for linking nodes * @sas_port_list: List of SAS ports @@ -792,7 +793,7 @@ struct leapraid_topo_node { }; /** - * struct leapraid_dev_topo - LeapRaid device topology management structure + * struct leapraid_dev_topo - LeapRAID device topology management structure * * @topo_node_lock: Spinlock for protecting topology node operations * @sas_dev_lock: Spinlock for SAS device list access @@ -832,7 +833,7 @@ struct leapraid_dev_topo { }; /** - * struct leapraid_boot_dev - Boot device structure for LeapRaid + * struct leapraid_boot_dev - Boot device structure for LeapRAID * * @dev: Device pointer * @chnl: Channel number @@ -871,7 +872,7 @@ struct leapraid_smart_poll_desc { }; /** - * struct leapraid_adapter - Main LeapRaid adapter structure + * struct leapraid_adapter - Main LeapRAID adapter structure * @list: List head for adapter management * @shost: SCSI host structure * @pdev: PCI device structure diff --git a/drivers/scsi/leapraid/leapraid_os.c b/drivers/scsi/leapraid/leapraid_os.c index be0f7cbb6684..f8354c68ab71 100644 --- a/drivers/scsi/leapraid/leapraid_os.c +++ b/drivers/scsi/leapraid/leapraid_os.c @@ -2124,7 +2124,7 @@ static void leapraid_shutdown(struct pci_dev *pdev) adapter->access_ctrl.host_removing = true; leapraid_wait_cmds_done(adapter); leapraid_clean_active_fw_evt(adapter); - + leapraid_fw_log_stop(adapter); spin_lock_irqsave(&adapter->fw_evt_s.fw_evt_lock, flags); wq = adapter->fw_evt_s.fw_evt_thread; adapter->fw_evt_s.fw_evt_thread = NULL; -- 2.25.1
2 2
0 0
[PATCH OLK-5.10] scsi: leapraid: add RAID disk hide/show events and fix misc issues
by haodongdong 02 Feb '26

02 Feb '26
LeapIO inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/8463 ------------------------------------------ This change introduces RAID disk hide/show events to allow dynamic visibility control of RAID devices. It also updates the MSI-X vector count retrieval logic and unifies driver naming from LeapRaid to LeapRAID for consistency. In addition, fix an issue where the fw_log workqueue was not properly released during system shutdown, which could lead to resource leaks. Signed-off-by: haodongdong <doubled(a)leap-io.com> --- drivers/scsi/leapraid/leapraid.h | 2 + drivers/scsi/leapraid/leapraid_func.c | 104 ++++++++++++++++++++++---- drivers/scsi/leapraid/leapraid_func.h | 47 ++++++------ drivers/scsi/leapraid/leapraid_os.c | 2 +- 4 files changed, 116 insertions(+), 39 deletions(-) diff --git a/drivers/scsi/leapraid/leapraid.h b/drivers/scsi/leapraid/leapraid.h index 842810d41542..77bb93b79254 100644 --- a/drivers/scsi/leapraid/leapraid.h +++ b/drivers/scsi/leapraid/leapraid.h @@ -310,6 +310,8 @@ #define LEAPRAID_EVT_IR_RC_PD_UNHIDDEN_TO_DELETE 0x04 #define LEAPRAID_EVT_IR_RC_PD_CREATED_TO_HIDE 0x05 #define LEAPRAID_EVT_IR_RC_PD_DELETED_TO_EXPOSE 0x06 +#define LEAPRAID_EVT_IR_RC_VOLUME_HIDE 0x0A +#define LEAPRAID_EVT_IR_RC_VOLUME_UNHIDE 0x0B /* sas topology change event */ #define LEAPRAID_EVT_SAS_TOPO_ES_NO_EXPANDER 0x00 diff --git a/drivers/scsi/leapraid/leapraid_func.c b/drivers/scsi/leapraid/leapraid_func.c index c83c30f56805..5dfe95a8dd84 100644 --- a/drivers/scsi/leapraid/leapraid_func.c +++ b/drivers/scsi/leapraid/leapraid_func.c @@ -4117,6 +4117,66 @@ static void leapraid_sas_pd_expose( } } +static void leapraid_sas_vol_visibility(struct leapraid_adapter *adapter, + struct leapraid_evt_data_ir_change *evt_data) +{ + struct leapraid_raid_volume *raid_volume = NULL; + struct scsi_device *sdev = NULL; + u16 hdl = 0; + unsigned long flags; + u8 rc = 0; + u8 reprobe_flg = 0; + + hdl = le16_to_cpu(evt_data->vol_dev_hdl); + rc = evt_data->reason_code; + spin_lock_irqsave(&adapter->dev_topo.raid_volume_lock, flags); + raid_volume = leapraid_raid_volume_find_by_hdl(adapter, hdl); + if (!raid_volume) { + spin_unlock_irqrestore(&adapter->dev_topo.raid_volume_lock, + flags); + dev_warn(&adapter->pdev->dev, + "%s:%d: volume handle 0x%x not found\n", + __func__, __LINE__, hdl); + return; + } + + reprobe_flg = 0; + sdev = raid_volume->sdev; + if (sdev) { + if (sdev->no_uld_attach) { + if (rc == LEAPRAID_EVT_IR_RC_VOLUME_UNHIDE) { + sdev->no_uld_attach = 0; + reprobe_flg = 1; + } + } else { + if (rc == LEAPRAID_EVT_IR_RC_VOLUME_HIDE) { + sdev->no_uld_attach = 1; + reprobe_flg = 1; + } + } + + if (reprobe_flg) { + if (sdev->no_uld_attach) + sdev_printk(KERN_INFO, sdev, "hide vol\n"); + else + sdev_printk(KERN_INFO, sdev, "unhide vol\n"); + + WARN_ON(scsi_device_reprobe(sdev)); + } else { + dev_warn(&adapter->pdev->dev, + "%s:rc(0x%x):request matches, skipping.\n", + __func__, rc); + } + + } else { + dev_warn(&adapter->pdev->dev, + "%s:%d: volume handle 0x%x has no sdev\n", + __func__, __LINE__, hdl); + } + + spin_unlock_irqrestore(&adapter->dev_topo.raid_volume_lock, flags); +} + static void leapraid_sas_volume_add(struct leapraid_adapter *adapter, struct leapraid_evt_data_ir_change *evt_data) { @@ -4235,6 +4295,10 @@ static void leapraid_sas_ir_chg_evt(struct leapraid_adapter *adapter, case LEAPRAID_EVT_IR_RC_PD_DELETED_TO_EXPOSE: leapraid_sas_pd_expose(adapter, evt_data); break; + case LEAPRAID_EVT_IR_RC_VOLUME_HIDE: + case LEAPRAID_EVT_IR_RC_VOLUME_UNHIDE: + leapraid_sas_vol_visibility(adapter, evt_data); + break; default: break; } @@ -6382,6 +6446,8 @@ static int leapraid_get_adapter_features(struct leapraid_adapter *adapter) le16_to_cpu(leap_mpi_rep.hp_slot); adapter->adapter_attr.features.adapter_caps = le32_to_cpu(leap_mpi_rep.adapter_caps); + adapter->adapter_attr.features.max_msix_vectors = + leap_mpi_rep.max_msix_vectors; adapter->adapter_attr.features.max_volumes = leap_mpi_rep.max_volumes; if (!adapter->adapter_attr.features.max_volumes) @@ -6741,11 +6807,15 @@ static int leapraid_set_msix(struct leapraid_adapter *adapter) goto legacy_int; msix_cnt = leapraid_msix_cnt(adapter->pdev); - if (msix_cnt <= 0) { + if (msix_cnt <= 0 || + adapter->adapter_attr.features.max_msix_vectors == 0) { dev_info(&adapter->pdev->dev, "msix unsupported!\n"); goto legacy_int; } + msix_cnt = min_t(int, msix_cnt, + adapter->adapter_attr.features.max_msix_vectors); + if (reset_devices) adapter->adapter_attr.rq_cnt = 1; else @@ -6839,11 +6909,15 @@ static int leapraid_set_msi(struct leapraid_adapter *adapter) goto legacy_int1; msi_cnt = leapraid_msi_cnt(adapter->pdev); - if (msi_cnt <= 0) { - dev_info(&adapter->pdev->dev, "msix unsupported!\n"); + if (msi_cnt <= 0 || + adapter->adapter_attr.features.max_msix_vectors == 0) { + dev_info(&adapter->pdev->dev, "msi unsupported!\n"); goto legacy_int1; } + msi_cnt = min_t(int, msi_cnt, + adapter->adapter_attr.features.max_msix_vectors); + if (reset_devices) adapter->adapter_attr.rq_cnt = 1; else @@ -6988,6 +7062,18 @@ int leapraid_set_pcie_and_notification(struct leapraid_adapter *adapter) leapraid_mask_int(adapter); + rc = leapraid_make_adapter_ready(adapter, PART_RESET); + if (rc) { + dev_err(&adapter->pdev->dev, "make adapter ready failure\n"); + goto out_fail; + } + + rc = leapraid_get_adapter_features(adapter); + if (rc) { + dev_err(&adapter->pdev->dev, "get adapter feature failure\n"); + goto out_fail; + } + rc = leapraid_set_notification(adapter); if (rc) goto out_fail; @@ -8185,18 +8271,6 @@ int leapraid_ctrl_init(struct leapraid_adapter *adapter) PCI_EXP_DEVCTL_EXT_TAG); } - rc = leapraid_make_adapter_ready(adapter, PART_RESET); - if (rc) { - dev_err(&adapter->pdev->dev, "make adapter ready failure\n"); - goto out_free_resources; - } - - rc = leapraid_get_adapter_features(adapter); - if (rc) { - dev_err(&adapter->pdev->dev, "get adapter feature failure\n"); - goto out_free_resources; - } - rc = leapraid_fw_log_init(adapter); if (rc) { dev_err(&adapter->pdev->dev, "fw log init failure\n"); diff --git a/drivers/scsi/leapraid/leapraid_func.h b/drivers/scsi/leapraid/leapraid_func.h index 9f42763bda72..15293922aefa 100644 --- a/drivers/scsi/leapraid/leapraid_func.h +++ b/drivers/scsi/leapraid/leapraid_func.h @@ -45,15 +45,15 @@ #define LEAPRAID_SYS_LOG_BUF_RESERVE 0x1000 /* Driver version and name */ -#define LEAPRAID_DRIVER_NAME "LeapRaid" +#define LEAPRAID_DRIVER_NAME "LeapRAID" #define LEAPRAID_NAME_LENGTH 48 #define LEAPRAID_AUTHOR "LeapIO Inc." -#define LEAPRAID_DESCRIPTION "LeapRaid Driver" -#define LEAPRAID_DRIVER_VERSION "2.00.00.05" +#define LEAPRAID_DESCRIPTION "LeapRAID Driver" +#define LEAPRAID_DRIVER_VERSION "2.00.00.06" #define LEAPRAID_MAJOR_VERSION 2 #define LEAPRAID_MINOR_VERSION 00 #define LEAPRAID_BUILD_VERSION 00 -#define LEAPRAID_RELEASE_VERSION 05 +#define LEAPRAID_RELEASE_VERSION 06 /* Device ID */ #define LEAPRAID_VENDOR_ID 0xD405 @@ -242,6 +242,7 @@ struct leapraid_adapter_features { u16 hp_slot; u32 adapter_caps; u32 fw_version; + u8 max_msix_vectors; u8 max_volumes; u16 max_dev_handle; u16 min_dev_handle; @@ -348,7 +349,7 @@ struct leapraid_rep_desc_seg_maint { }; /** - * struct leapraid_mem_desc - Memory descriptor for LeapRaid adapter + * struct leapraid_mem_desc - Memory descriptor for LeapRAID adapter * * @task_desc: Pointer to task descriptor * @task_desc_dma: DMA address of task descriptor @@ -394,7 +395,7 @@ struct leapraid_mem_desc { #define LEAPRAID_CMD_RESET 0x0008 /** - * enum LEAPRAID_CB_INDEX - Callback index for LeapRaid driver + * enum LEAPRAID_CB_INDEX - Callback index for LeapRAID driver * * @LEAPRAID_SCAN_DEV_CB_IDX: Scan device callback index * @LEAPRAID_CONFIG_CB_IDX: Configuration callback index @@ -512,7 +513,7 @@ struct leapraid_dynamic_task_desc { * struct leapraid_fw_evt_work - Firmware event work structure * * @list: Linked list node for queuing the work - * @adapter: Pointer to the associated LeapRaid adapter + * @adapter: Pointer to the associated LeapRAID adapter * @work: Work structure used by the kernel workqueue * @refcnt: Reference counter for managing the lifetime of this work * @evt_data: Pointer to firmware event data @@ -553,9 +554,9 @@ struct leapraid_fw_evt_struct { }; /** - * struct leapraid_rq - Represents a LeapRaid request queue + * struct leapraid_rq - Represents a LeapRAID request queue * - * @adapter: Pointer to the associated LeapRaid adapter + * @adapter: Pointer to the associated LeapRAID adapter * @msix_idx: MSI-X vector index used by this queue * @rep_post_host_idx: Index of the last processed reply descriptor * @rep_desc: Pointer to the reply descriptor associated with this queue @@ -575,7 +576,7 @@ struct leapraid_rq { * struct leapraid_int_rq - Internal request queue for a CPU * * @affinity_hint: CPU affinity mask for the queue - * @rq: Underlying LeapRaid request queue structure + * @rq: Underlying LeapRAID request queue structure */ struct leapraid_int_rq { cpumask_var_t affinity_hint; @@ -583,11 +584,11 @@ struct leapraid_int_rq { }; /** - * struct leapraid_blk_mq_poll_rq - Polling request for LeapRaid blk-mq + * struct leapraid_blk_mq_poll_rq - Polling request for LeapRAID blk-mq * * @busy: Atomic flag indicating request is being processed * @pause: Atomic flag to temporarily suspend polling - * @rq: The underlying LeapRaid request structure + * @rq: The underlying LeapRAID request structure */ struct leapraid_blk_mq_poll_rq { atomic_t busy; @@ -597,7 +598,7 @@ struct leapraid_blk_mq_poll_rq { /** * struct leapraid_notification_desc - Notification - * descriptor for LeapRaid + * descriptor for LeapRAID * * @iopoll_qdex: Index of the I/O polling queue * @iopoll_qcnt: Count of I/O polling queues @@ -620,7 +621,7 @@ struct leapraid_notification_desc { }; /** - * struct leapraid_reset_desc - Reset descriptor for LeapRaid + * struct leapraid_reset_desc - Reset descriptor for LeapRAID * * @fault_reset_wq: Workqueue for fault reset operations * @fault_reset_work: Delayed work structure for fault reset @@ -650,7 +651,7 @@ struct leapraid_reset_desc { /** * struct leapraid_scan_dev_desc - Scan device descriptor - * for LeapRaid + * for LeapRAID * * @wait_scan_dev_done: Flag indicating if scan device operation is done * @driver_loading: Flag indicating if driver is loading @@ -669,7 +670,7 @@ struct leapraid_scan_dev_desc { }; /** - * struct leapraid_access_ctrl - Access control structure for LeapRaid + * struct leapraid_access_ctrl - Access control structure for LeapRAID * * @pci_access_lock: Mutex for PCI access control * @adapter_thermal_alert: Flag indicating if adapter thermal alert is active @@ -686,7 +687,7 @@ struct leapraid_access_ctrl { }; /** - * struct leapraid_fw_log_desc - Firmware log descriptor for LeapRaid + * struct leapraid_fw_log_desc - Firmware log descriptor for LeapRAID * * @fw_log_buffer: Buffer for firmware log data * @fw_log_buffer_dma: DMA address of the firmware log buffer @@ -710,7 +711,7 @@ struct leapraid_fw_log_desc { #define LEAPRAID_CARD_PORT_FLG_NEW 0x02 #define LEAPRAID_DISABLE_MP_PORT_ID 0xFF /** - * struct leapraid_card_port - Card port structure for LeapRaid + * struct leapraid_card_port - Card port structure for LeapRAID * * @list: List head for card port * @vphys_list: List head for virtual phy list @@ -731,7 +732,7 @@ struct leapraid_card_port { }; /** - * struct leapraid_card_phy - Card phy structure for LeapRaid + * struct leapraid_card_phy - Card phy structure for LeapRAID * * @port_siblings: List head for port siblings * @card_port: Pointer to the card port @@ -758,7 +759,7 @@ struct leapraid_card_phy { }; /** - * struct leapraid_topo_node - SAS topology node for LeapRaid + * struct leapraid_topo_node - SAS topology node for LeapRAID * * @list: List head for linking nodes * @sas_port_list: List of SAS ports @@ -791,7 +792,7 @@ struct leapraid_topo_node { }; /** - * struct leapraid_dev_topo - LeapRaid device topology management structure + * struct leapraid_dev_topo - LeapRAID device topology management structure * * @topo_node_lock: Spinlock for protecting topology node operations * @sas_dev_lock: Spinlock for SAS device list access @@ -831,7 +832,7 @@ struct leapraid_dev_topo { }; /** - * struct leapraid_boot_dev - Boot device structure for LeapRaid + * struct leapraid_boot_dev - Boot device structure for LeapRAID * * @dev: Device pointer * @chnl: Channel number @@ -870,7 +871,7 @@ struct leapraid_smart_poll_desc { }; /** - * struct leapraid_adapter - Main LeapRaid adapter structure + * struct leapraid_adapter - Main LeapRAID adapter structure * @list: List head for adapter management * @shost: SCSI host structure * @pdev: PCI device structure diff --git a/drivers/scsi/leapraid/leapraid_os.c b/drivers/scsi/leapraid/leapraid_os.c index 44ec2615648f..6635e74fd8ff 100644 --- a/drivers/scsi/leapraid/leapraid_os.c +++ b/drivers/scsi/leapraid/leapraid_os.c @@ -2029,7 +2029,7 @@ static void leapraid_shutdown(struct pci_dev *pdev) adapter->access_ctrl.host_removing = true; leapraid_wait_cmds_done(adapter); leapraid_clean_active_fw_evt(adapter); - + leapraid_fw_log_stop(adapter); spin_lock_irqsave(&adapter->fw_evt_s.fw_evt_lock, flags); wq = adapter->fw_evt_s.fw_evt_thread; adapter->fw_evt_s.fw_evt_thread = NULL; -- 2.25.1
2 2
0 0
[PATCH OLK-6.6] scsi: leapraid: add RAID disk hide/show events and fix misc issues
by haodongdong 02 Feb '26

02 Feb '26
LeapIO inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/8462 This change introduces RAID disk hide/show events to allow dynamic visibility control of RAID devices. It also updates the MSI-X vector count retrieval logic and unifies driver naming from LeapRaid to LeapRAID for consistency. In addition, fix an issue where the fw_log workqueue was not properly released during system shutdown, which could lead to resource leaks. Signed-off-by: haodongdong <doubled(a)leap-io.com> --- drivers/scsi/leapraid/leapraid.h | 2 + drivers/scsi/leapraid/leapraid_func.c | 104 ++++++++++++++++++++++---- drivers/scsi/leapraid/leapraid_func.h | 47 ++++++------ drivers/scsi/leapraid/leapraid_os.c | 2 +- 4 files changed, 116 insertions(+), 39 deletions(-) diff --git a/drivers/scsi/leapraid/leapraid.h b/drivers/scsi/leapraid/leapraid.h index 842810d41542..77bb93b79254 100644 --- a/drivers/scsi/leapraid/leapraid.h +++ b/drivers/scsi/leapraid/leapraid.h @@ -310,6 +310,8 @@ #define LEAPRAID_EVT_IR_RC_PD_UNHIDDEN_TO_DELETE 0x04 #define LEAPRAID_EVT_IR_RC_PD_CREATED_TO_HIDE 0x05 #define LEAPRAID_EVT_IR_RC_PD_DELETED_TO_EXPOSE 0x06 +#define LEAPRAID_EVT_IR_RC_VOLUME_HIDE 0x0A +#define LEAPRAID_EVT_IR_RC_VOLUME_UNHIDE 0x0B /* sas topology change event */ #define LEAPRAID_EVT_SAS_TOPO_ES_NO_EXPANDER 0x00 diff --git a/drivers/scsi/leapraid/leapraid_func.c b/drivers/scsi/leapraid/leapraid_func.c index 2fc142fff982..ad8aee40e2c1 100644 --- a/drivers/scsi/leapraid/leapraid_func.c +++ b/drivers/scsi/leapraid/leapraid_func.c @@ -4132,6 +4132,66 @@ static void leapraid_sas_pd_expose( } } +static void leapraid_sas_vol_visibility(struct leapraid_adapter *adapter, + struct leapraid_evt_data_ir_change *evt_data) +{ + struct leapraid_raid_volume *raid_volume = NULL; + struct scsi_device *sdev = NULL; + u16 hdl = 0; + unsigned long flags; + u8 rc = 0; + u8 reprobe_flg = 0; + + hdl = le16_to_cpu(evt_data->vol_dev_hdl); + rc = evt_data->reason_code; + spin_lock_irqsave(&adapter->dev_topo.raid_volume_lock, flags); + raid_volume = leapraid_raid_volume_find_by_hdl(adapter, hdl); + if (!raid_volume) { + spin_unlock_irqrestore(&adapter->dev_topo.raid_volume_lock, + flags); + dev_warn(&adapter->pdev->dev, + "%s:%d: volume handle 0x%x not found\n", + __func__, __LINE__, hdl); + return; + } + + reprobe_flg = 0; + sdev = raid_volume->sdev; + if (sdev) { + if (sdev->no_uld_attach) { + if (rc == LEAPRAID_EVT_IR_RC_VOLUME_UNHIDE) { + sdev->no_uld_attach = 0; + reprobe_flg = 1; + } + } else { + if (rc == LEAPRAID_EVT_IR_RC_VOLUME_HIDE) { + sdev->no_uld_attach = 1; + reprobe_flg = 1; + } + } + + if (reprobe_flg) { + if (sdev->no_uld_attach) + sdev_printk(KERN_INFO, sdev, "hide vol\n"); + else + sdev_printk(KERN_INFO, sdev, "unhide vol\n"); + + WARN_ON(scsi_device_reprobe(sdev)); + } else { + dev_warn(&adapter->pdev->dev, + "%s:rc(0x%x):request matches, skipping.\n", + __func__, rc); + } + + } else { + dev_warn(&adapter->pdev->dev, + "%s:%d: volume handle 0x%x has no sdev\n", + __func__, __LINE__, hdl); + } + + spin_unlock_irqrestore(&adapter->dev_topo.raid_volume_lock, flags); +} + static void leapraid_sas_volume_add(struct leapraid_adapter *adapter, struct leapraid_evt_data_ir_change *evt_data) { @@ -4250,6 +4310,10 @@ static void leapraid_sas_ir_chg_evt(struct leapraid_adapter *adapter, case LEAPRAID_EVT_IR_RC_PD_DELETED_TO_EXPOSE: leapraid_sas_pd_expose(adapter, evt_data); break; + case LEAPRAID_EVT_IR_RC_VOLUME_HIDE: + case LEAPRAID_EVT_IR_RC_VOLUME_UNHIDE: + leapraid_sas_vol_visibility(adapter, evt_data); + break; default: break; } @@ -6397,6 +6461,8 @@ static int leapraid_get_adapter_features(struct leapraid_adapter *adapter) le16_to_cpu(leap_mpi_rep.hp_slot); adapter->adapter_attr.features.adapter_caps = le32_to_cpu(leap_mpi_rep.adapter_caps); + adapter->adapter_attr.features.max_msix_vectors = + leap_mpi_rep.max_msix_vectors; adapter->adapter_attr.features.max_volumes = leap_mpi_rep.max_volumes; if (!adapter->adapter_attr.features.max_volumes) @@ -6754,11 +6820,15 @@ static int leapraid_set_msix(struct leapraid_adapter *adapter) goto legacy_int; msix_cnt = leapraid_msix_cnt(adapter->pdev); - if (msix_cnt <= 0) { + if (msix_cnt <= 0 || + adapter->adapter_attr.features.max_msix_vectors == 0) { dev_info(&adapter->pdev->dev, "msix unsupported!\n"); goto legacy_int; } + msix_cnt = min_t(int, msix_cnt, + adapter->adapter_attr.features.max_msix_vectors); + if (reset_devices) adapter->adapter_attr.rq_cnt = 1; else @@ -6859,11 +6929,15 @@ static int leapraid_set_msi(struct leapraid_adapter *adapter) goto legacy_int1; msi_cnt = leapraid_msi_cnt(adapter->pdev); - if (msi_cnt <= 0) { - dev_info(&adapter->pdev->dev, "msix unsupported!\n"); + if (msi_cnt <= 0 || + adapter->adapter_attr.features.max_msix_vectors == 0) { + dev_info(&adapter->pdev->dev, "msi unsupported!\n"); goto legacy_int1; } + msi_cnt = min_t(int, msi_cnt, + adapter->adapter_attr.features.max_msix_vectors); + if (reset_devices) adapter->adapter_attr.rq_cnt = 1; else @@ -7015,6 +7089,18 @@ int leapraid_set_pcie_and_notification(struct leapraid_adapter *adapter) leapraid_mask_int(adapter); + rc = leapraid_make_adapter_ready(adapter, PART_RESET); + if (rc) { + dev_err(&adapter->pdev->dev, "make adapter ready failure\n"); + goto out_fail; + } + + rc = leapraid_get_adapter_features(adapter); + if (rc) { + dev_err(&adapter->pdev->dev, "get adapter feature failure\n"); + goto out_fail; + } + rc = leapraid_set_notification(adapter); if (rc) goto out_fail; @@ -8185,18 +8271,6 @@ int leapraid_ctrl_init(struct leapraid_adapter *adapter) PCI_EXP_DEVCTL_EXT_TAG); } - rc = leapraid_make_adapter_ready(adapter, PART_RESET); - if (rc) { - dev_err(&adapter->pdev->dev, "make adapter ready failure\n"); - goto out_free_resources; - } - - rc = leapraid_get_adapter_features(adapter); - if (rc) { - dev_err(&adapter->pdev->dev, "get adapter feature failure\n"); - goto out_free_resources; - } - rc = leapraid_fw_log_init(adapter); if (rc) { dev_err(&adapter->pdev->dev, "fw log init failure\n"); diff --git a/drivers/scsi/leapraid/leapraid_func.h b/drivers/scsi/leapraid/leapraid_func.h index 2c51ef359b7e..f7072d078315 100644 --- a/drivers/scsi/leapraid/leapraid_func.h +++ b/drivers/scsi/leapraid/leapraid_func.h @@ -46,15 +46,15 @@ #define LEAPRAID_SYS_LOG_BUF_RESERVE 0x1000 /* Driver version and name */ -#define LEAPRAID_DRIVER_NAME "LeapRaid" +#define LEAPRAID_DRIVER_NAME "LeapRAID" #define LEAPRAID_NAME_LENGTH 48 #define LEAPRAID_AUTHOR "LeapIO Inc." -#define LEAPRAID_DESCRIPTION "LeapRaid Driver" -#define LEAPRAID_DRIVER_VERSION "2.00.00.05" +#define LEAPRAID_DESCRIPTION "LeapRAID Driver" +#define LEAPRAID_DRIVER_VERSION "2.00.00.06" #define LEAPRAID_MAJOR_VERSION 2 #define LEAPRAID_MINOR_VERSION 00 #define LEAPRAID_BUILD_VERSION 00 -#define LEAPRAID_RELEASE_VERSION 05 +#define LEAPRAID_RELEASE_VERSION 06 /* Device ID */ #define LEAPRAID_VENDOR_ID 0xD405 @@ -243,6 +243,7 @@ struct leapraid_adapter_features { u16 hp_slot; u32 adapter_caps; u32 fw_version; + u8 max_msix_vectors; u8 max_volumes; u16 max_dev_handle; u16 min_dev_handle; @@ -349,7 +350,7 @@ struct leapraid_rep_desc_seg_maint { }; /** - * struct leapraid_mem_desc - Memory descriptor for LeapRaid adapter + * struct leapraid_mem_desc - Memory descriptor for LeapRAID adapter * * @task_desc: Pointer to task descriptor * @task_desc_dma: DMA address of task descriptor @@ -395,7 +396,7 @@ struct leapraid_mem_desc { #define LEAPRAID_CMD_RESET 0x0008 /** - * enum LEAPRAID_CB_INDEX - Callback index for LeapRaid driver + * enum LEAPRAID_CB_INDEX - Callback index for LeapRAID driver * * @LEAPRAID_SCAN_DEV_CB_IDX: Scan device callback index * @LEAPRAID_CONFIG_CB_IDX: Configuration callback index @@ -513,7 +514,7 @@ struct leapraid_dynamic_task_desc { * struct leapraid_fw_evt_work - Firmware event work structure * * @list: Linked list node for queuing the work - * @adapter: Pointer to the associated LeapRaid adapter + * @adapter: Pointer to the associated LeapRAID adapter * @work: Work structure used by the kernel workqueue * @refcnt: Reference counter for managing the lifetime of this work * @evt_data: Pointer to firmware event data @@ -554,9 +555,9 @@ struct leapraid_fw_evt_struct { }; /** - * struct leapraid_rq - Represents a LeapRaid request queue + * struct leapraid_rq - Represents a LeapRAID request queue * - * @adapter: Pointer to the associated LeapRaid adapter + * @adapter: Pointer to the associated LeapRAID adapter * @msix_idx: MSI-X vector index used by this queue * @rep_post_host_idx: Index of the last processed reply descriptor * @rep_desc: Pointer to the reply descriptor associated with this queue @@ -576,7 +577,7 @@ struct leapraid_rq { * struct leapraid_int_rq - Internal request queue for a CPU * * @affinity_hint: CPU affinity mask for the queue - * @rq: Underlying LeapRaid request queue structure + * @rq: Underlying LeapRAID request queue structure */ struct leapraid_int_rq { cpumask_var_t affinity_hint; @@ -584,11 +585,11 @@ struct leapraid_int_rq { }; /** - * struct leapraid_blk_mq_poll_rq - Polling request for LeapRaid blk-mq + * struct leapraid_blk_mq_poll_rq - Polling request for LeapRAID blk-mq * * @busy: Atomic flag indicating request is being processed * @pause: Atomic flag to temporarily suspend polling - * @rq: The underlying LeapRaid request structure + * @rq: The underlying LeapRAID request structure */ struct leapraid_blk_mq_poll_rq { atomic_t busy; @@ -598,7 +599,7 @@ struct leapraid_blk_mq_poll_rq { /** * struct leapraid_notification_desc - Notification - * descriptor for LeapRaid + * descriptor for LeapRAID * * @iopoll_qdex: Index of the I/O polling queue * @iopoll_qcnt: Count of I/O polling queues @@ -621,7 +622,7 @@ struct leapraid_notification_desc { }; /** - * struct leapraid_reset_desc - Reset descriptor for LeapRaid + * struct leapraid_reset_desc - Reset descriptor for LeapRAID * * @fault_reset_wq: Workqueue for fault reset operations * @fault_reset_work: Delayed work structure for fault reset @@ -651,7 +652,7 @@ struct leapraid_reset_desc { /** * struct leapraid_scan_dev_desc - Scan device descriptor - * for LeapRaid + * for LeapRAID * * @wait_scan_dev_done: Flag indicating if scan device operation is done * @driver_loading: Flag indicating if driver is loading @@ -670,7 +671,7 @@ struct leapraid_scan_dev_desc { }; /** - * struct leapraid_access_ctrl - Access control structure for LeapRaid + * struct leapraid_access_ctrl - Access control structure for LeapRAID * * @pci_access_lock: Mutex for PCI access control * @adapter_thermal_alert: Flag indicating if adapter thermal alert is active @@ -687,7 +688,7 @@ struct leapraid_access_ctrl { }; /** - * struct leapraid_fw_log_desc - Firmware log descriptor for LeapRaid + * struct leapraid_fw_log_desc - Firmware log descriptor for LeapRAID * * @fw_log_buffer: Buffer for firmware log data * @fw_log_buffer_dma: DMA address of the firmware log buffer @@ -711,7 +712,7 @@ struct leapraid_fw_log_desc { #define LEAPRAID_CARD_PORT_FLG_NEW 0x02 #define LEAPRAID_DISABLE_MP_PORT_ID 0xFF /** - * struct leapraid_card_port - Card port structure for LeapRaid + * struct leapraid_card_port - Card port structure for LeapRAID * * @list: List head for card port * @vphys_list: List head for virtual phy list @@ -732,7 +733,7 @@ struct leapraid_card_port { }; /** - * struct leapraid_card_phy - Card phy structure for LeapRaid + * struct leapraid_card_phy - Card phy structure for LeapRAID * * @port_siblings: List head for port siblings * @card_port: Pointer to the card port @@ -759,7 +760,7 @@ struct leapraid_card_phy { }; /** - * struct leapraid_topo_node - SAS topology node for LeapRaid + * struct leapraid_topo_node - SAS topology node for LeapRAID * * @list: List head for linking nodes * @sas_port_list: List of SAS ports @@ -792,7 +793,7 @@ struct leapraid_topo_node { }; /** - * struct leapraid_dev_topo - LeapRaid device topology management structure + * struct leapraid_dev_topo - LeapRAID device topology management structure * * @topo_node_lock: Spinlock for protecting topology node operations * @sas_dev_lock: Spinlock for SAS device list access @@ -832,7 +833,7 @@ struct leapraid_dev_topo { }; /** - * struct leapraid_boot_dev - Boot device structure for LeapRaid + * struct leapraid_boot_dev - Boot device structure for LeapRAID * * @dev: Device pointer * @chnl: Channel number @@ -871,7 +872,7 @@ struct leapraid_smart_poll_desc { }; /** - * struct leapraid_adapter - Main LeapRaid adapter structure + * struct leapraid_adapter - Main LeapRAID adapter structure * @list: List head for adapter management * @shost: SCSI host structure * @pdev: PCI device structure diff --git a/drivers/scsi/leapraid/leapraid_os.c b/drivers/scsi/leapraid/leapraid_os.c index be0f7cbb6684..f8354c68ab71 100644 --- a/drivers/scsi/leapraid/leapraid_os.c +++ b/drivers/scsi/leapraid/leapraid_os.c @@ -2124,7 +2124,7 @@ static void leapraid_shutdown(struct pci_dev *pdev) adapter->access_ctrl.host_removing = true; leapraid_wait_cmds_done(adapter); leapraid_clean_active_fw_evt(adapter); - + leapraid_fw_log_stop(adapter); spin_lock_irqsave(&adapter->fw_evt_s.fw_evt_lock, flags); wq = adapter->fw_evt_s.fw_evt_thread; adapter->fw_evt_s.fw_evt_thread = NULL; -- 2.25.1
2 1
0 0
[PATCH OLK-6.6] interference: Fix uninitialized ifs_clock compiling issue
by Pu Lehui 02 Feb '26

02 Feb '26
hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/7429 -------------------------------- When compiling with clang, it will occur the warning: 623 | if (__mutex_trylock(lock)) { | ^~~~~~~~~~~~~~~~~~~~~ kernel/locking/mutex.c:725:24: note: uninitialized use occurs here 725 | cgroup_ifs_leave_lock(ifs_clock, IFS_MUTEX); | ^~~~~~~~~ kernel/locking/mutex.c:623:2: note: remove the 'if' if its condition is always false 623 | if (__mutex_trylock(lock)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 624 | if (ww_ctx) | ~~~~~~~~~~~ 625 | __ww_mutex_check_waiters(lock, ww_ctx); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 626 | 627 | goto skip_wait; | ~~~~~~~~~~~~~~~ 628 | } | ~ kernel/locking/mutex.c:576:15: note: initialize the variable 'ifs_clock' to silence this warning 576 | u64 ifs_clock; | ^ | = 0 2 warnings generated. Let's fix it by zero initialize ifs_clock. Fixes: a1ad9b2ed459 ("interference: Add mutex interference track support") Signed-off-by: Pu Lehui <pulehui(a)huawei.com> --- include/linux/cgroup.h | 3 +++ kernel/locking/mutex.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 05a9cef2edac..d4f69e89b3fb 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -1000,6 +1000,9 @@ static inline void cgroup_ifs_leave_lock(u64 clock, enum ifs_types t) if (!cgroup_ifs_enabled()) return; + if (unlikely(!clock)) + return; + ifs = current_ifs(); if (ifs) { ifsc = this_cpu_ptr(ifs->pcpu); diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c index 1003afe8dd74..038c6fb9d71d 100644 --- a/kernel/locking/mutex.c +++ b/kernel/locking/mutex.c @@ -573,7 +573,7 @@ __mutex_lock_common(struct mutex *lock, unsigned int state, unsigned int subclas { struct mutex_waiter waiter; struct ww_mutex *ww; - u64 ifs_clock; + u64 ifs_clock = 0; int ret; if (!use_ww_ctx) -- 2.34.1
2 1
0 0
  • ← Newer
  • 1
  • 2
  • 3
  • 4
  • ...
  • 2269
  • Older →

HyperKitty Powered by HyperKitty