FreeBSD Bugzilla – Attachment 256343 Details for
Bug 280037
KTLS with Intel QAT may trigger kernel panics
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
experimental patch that utilizes extra IRQ instances of QAT driver
patch-qat_balance.patch (text/plain), 8.68 KB, created by
ss3bsd
on 2025-01-02 11:29:54 UTC
(
hide
)
Description:
experimental patch that utilizes extra IRQ instances of QAT driver
Filename:
MIME Type:
Creator:
ss3bsd
Created:
2025-01-02 11:29:54 UTC
Size:
8.68 KB
patch
obsolete
>diff --git sys/dev/qat/include/common/adf_cfg.h sys/dev/qat/include/common/adf_cfg.h >index 52d2029c7c46..21290a0fba99 100644 >--- sys/dev/qat/include/common/adf_cfg.h >+++ sys/dev/qat/include/common/adf_cfg.h >@@ -16,40 +16,42 @@ struct adf_cfg_key_val { > enum adf_cfg_val_type type; > struct list_head list; > }; > > struct adf_cfg_section { > char name[ADF_CFG_MAX_SECTION_LEN_IN_BYTES]; > bool processed; > bool is_derived; > struct list_head list; > struct list_head param_head; > }; > > struct adf_cfg_device_data { > struct adf_cfg_device *dev; > struct list_head sec_list; > struct sysctl_oid *debug; > struct sx lock; > char cfg_services[ADF_CFG_MAX_VAL]; > char cfg_mode[ADF_CFG_MAX_VAL]; > u16 num_user_processes; >+ u16 use_extra_instances; >+ u16 balance_interrupts; > }; > > struct adf_cfg_depot_list { > struct list_head sec_list; > }; > > int adf_cfg_dev_add(struct adf_accel_dev *accel_dev); > void adf_cfg_dev_remove(struct adf_accel_dev *accel_dev); > int adf_cfg_depot_restore_all(struct adf_accel_dev *accel_dev, > struct adf_cfg_depot_list *dev_hp_cfg); > int adf_cfg_section_add(struct adf_accel_dev *accel_dev, const char *name); > void adf_cfg_del_all(struct adf_accel_dev *accel_dev); > void adf_cfg_depot_del_all(struct list_head *head); > int adf_cfg_add_key_value_param(struct adf_accel_dev *accel_dev, > const char *section_name, > const char *key, > const void *val, > enum adf_cfg_val_type type); > int adf_cfg_get_param_value(struct adf_accel_dev *accel_dev, > const char *section, >diff --git sys/dev/qat/qat_common/adf_cfg.c sys/dev/qat/qat_common/adf_cfg.c >index 736ede860840..0d35f3b83934 100644 >--- sys/dev/qat/qat_common/adf_cfg.c >+++ sys/dev/qat/qat_common/adf_cfg.c >@@ -56,40 +56,43 @@ adf_cfg_dev_add(struct adf_accel_dev *accel_dev) > ADF_CFG_KERNEL, > ADF_CFG_MAX_VAL); > dev_cfg_data->num_user_processes = 0; > strncpy(dev_cfg_data->cfg_services, > ADF_CFG_SYM_DC, > ADF_CFG_MAX_VAL); > } > } else { > dev_cfg_data->num_user_processes = > ADF_CFG_STATIC_CONF_USER_PROCESSES_NUM; > > strncpy(dev_cfg_data->cfg_mode, > ADF_CFG_KERNEL, > ADF_CFG_MAX_VAL); > > strncpy(dev_cfg_data->cfg_services, > "sym;asym", > ADF_CFG_MAX_VAL); > } > >+ dev_cfg_data->use_extra_instances = 0; >+ dev_cfg_data->balance_interrupts = 0; >+ > if (adf_cfg_sysctl_add(accel_dev)) > goto err; > > if (adf_cfg_dev_dbg_add(accel_dev)) > goto err; > > if (!accel_dev->is_vf) { > if (adf_heartbeat_dbg_add(accel_dev)) > goto err; > > if (adf_ver_dbg_add(accel_dev)) > goto err; > > if (adf_fw_counters_add(accel_dev)) > goto err; > > if (adf_cnvnr_freq_counters_add(accel_dev)) > goto err; > } > return 0; >diff --git sys/dev/qat/qat_common/adf_cfg_device.c sys/dev/qat/qat_common/adf_cfg_device.c >index a26d2fdfd32e..8ec9d824ed30 100644 >--- sys/dev/qat/qat_common/adf_cfg_device.c >+++ sys/dev/qat/qat_common/adf_cfg_device.c >@@ -826,40 +826,44 @@ adf_cfg_static_conf_kernel(struct adf_accel_dev *accel_dev, > > if (dc_enabled) { > if (instances >= def_dc_inst) { > dc_instances = def_dc_inst; > instances -= dc_instances; > } else { > return EFAULT; > } > } > > if (asym_enabled || sym_enabled) { > if (instances >= def_cy_poll_inst) { > cy_poll_instances = def_cy_poll_inst; > instances -= cy_poll_instances; > } else { > return EFAULT; > } > > if (sym_enabled) { > if (instances >= def_cy_irq_inst) { >+ if (accel_dev->cfg->use_extra_instances){ >+ /* enables irq instances up to the number of online cpus */ >+ def_cy_irq_inst = (instances < cpus) ? instances : cpus; >+ } > cy_irq_instances = def_cy_irq_inst; > instances -= cy_irq_instances; > } else { > return EFAULT; > } > } > } > > val = (cy_poll_instances + cy_irq_instances); > snprintf(key, ADF_CFG_MAX_KEY_LEN_IN_BYTES, ADF_NUM_CY); > ret |= adf_cfg_add_key_value_param( > accel_dev, ADF_KERNEL_SAL_SEC, key, (void *)&val, ADF_DEC); > > val = dc_instances; > snprintf(key, ADF_CFG_MAX_KEY_LEN_IN_BYTES, ADF_NUM_DC); > ret |= adf_cfg_add_key_value_param( > accel_dev, ADF_KERNEL_SAL_SEC, key, (void *)&val, ADF_DEC); > > for (i = 0; i < (cy_irq_instances); i++) { > val = (accel_dev->accel_id * cy_irq_instances + i) % cpus; >diff --git sys/dev/qat/qat_common/adf_cfg_sysctl.c sys/dev/qat/qat_common/adf_cfg_sysctl.c >index 621c3cc5b6c6..b94574ead093 100644 >--- sys/dev/qat/qat_common/adf_cfg_sysctl.c >+++ sys/dev/qat/qat_common/adf_cfg_sysctl.c >@@ -258,40 +258,76 @@ static int adf_cfg_sysctl_num_processes_handle(SYSCTL_HANDLER_ARGS) > ret = sysctl_handle_int(oidp, &num_user_processes, 0, req); > if (ret != 0 || req->newptr == NULL) > return ret; > > if (adf_dev_started(accel_dev)) { > device_printf( > GET_DEV(accel_dev), > "QAT: configuration could be changed in down state only\n"); > return EBUSY; > } > > if (num_user_processes > ADF_CFG_MAX_USER_PROCESSES) { > return EINVAL; > } > > dev_cfg_data->num_user_processes = num_user_processes; > > return ret; > } > >+static int adf_cfg_sysctl_use_extra_instances_handle(SYSCTL_HANDLER_ARGS) >+{ >+ struct adf_cfg_device_data *dev_cfg_data; >+ struct adf_accel_dev *accel_dev; >+ uint32_t use_extra_instances = 0; >+ int ret = 0; >+ >+ accel_dev = arg1; >+ if (!accel_dev) >+ return ENXIO; >+ >+ dev_cfg_data = accel_dev->cfg; >+ if (!dev_cfg_data) >+ return ENXIO; >+ >+ use_extra_instances = dev_cfg_data->use_extra_instances; >+ >+ ret = sysctl_handle_int(oidp, &use_extra_instances, 0, req); >+ if (ret != 0 || req->newptr == NULL) >+ return ret; >+ >+ if (adf_dev_started(accel_dev)) { >+ device_printf( >+ GET_DEV(accel_dev), >+ "QAT: configuration could be changed in down state only\n"); >+ return EBUSY; >+ } >+ >+ dev_cfg_data->use_extra_instances = use_extra_instances ? 1 : 0; >+ >+ /* do we need a separate sysctl entry for this? */ >+ dev_cfg_data->balance_interrupts = use_extra_instances ? 1 : 0; >+ >+ return ret; >+} >+ > int > adf_cfg_sysctl_add(struct adf_accel_dev *accel_dev) > { > struct sysctl_ctx_list *qat_sysctl_ctx; > struct sysctl_oid *qat_sysctl_tree; > > if (!accel_dev) > return EINVAL; > > qat_sysctl_ctx = > device_get_sysctl_ctx(accel_dev->accel_pci_dev.pci_dev); > qat_sysctl_tree = > device_get_sysctl_tree(accel_dev->accel_pci_dev.pci_dev); > > SYSCTL_ADD_PROC(qat_sysctl_ctx, > SYSCTL_CHILDREN(qat_sysctl_tree), > OID_AUTO, > "state", > CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_NEEDGIANT, > accel_dev, >@@ -316,27 +352,38 @@ adf_cfg_sysctl_add(struct adf_accel_dev *accel_dev) > OID_AUTO, > "cfg_mode", > CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, > accel_dev, > 0, > adf_cfg_sysctl_mode_handle, > "A", > "QAT mode configuration"); > > SYSCTL_ADD_PROC(qat_sysctl_ctx, > SYSCTL_CHILDREN(qat_sysctl_tree), > OID_AUTO, > "num_user_processes", > CTLTYPE_U32 | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, > accel_dev, > 0, > adf_cfg_sysctl_num_processes_handle, > "I", > "QAT user processes number "); > >+ SYSCTL_ADD_PROC(qat_sysctl_ctx, >+ SYSCTL_CHILDREN(qat_sysctl_tree), >+ OID_AUTO, >+ "use_extra_instances", >+ CTLTYPE_U32 | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, >+ accel_dev, >+ 0, >+ adf_cfg_sysctl_use_extra_instances_handle, >+ "I", >+ "QAT utilizes extra instances up to cpu num."); >+ > return 0; > } > > void > adf_cfg_sysctl_remove(struct adf_accel_dev *accel_dev) > { > } >diff --git sys/dev/qat/qat_common/adf_isr.c sys/dev/qat/qat_common/adf_isr.c >index 18c98c9448ca..2c17fc42d980 100644 >--- sys/dev/qat/qat_common/adf_isr.c >+++ sys/dev/qat/qat_common/adf_isr.c >@@ -130,41 +130,44 @@ adf_msix_isr_ae(void *dev_ptr) > adf_print_err_registers(accel_dev); > else > device_printf(GET_DEV(accel_dev), "spurious AE interrupt\n"); > > return; > } > > static int > adf_get_irq_affinity(struct adf_accel_dev *accel_dev, int bank) > { > int core = CPU_FIRST(); > char val[ADF_CFG_MAX_VAL_LEN_IN_BYTES]; > char bankName[ADF_CFG_MAX_KEY_LEN_IN_BYTES]; > > snprintf(bankName, > ADF_CFG_MAX_KEY_LEN_IN_BYTES - 1, > ADF_ETRMGR_CORE_AFFINITY_FORMAT, > bank); > bankName[ADF_CFG_MAX_KEY_LEN_IN_BYTES - 1] = '\0'; > >- if (adf_cfg_get_param_value(accel_dev, "Accelerator0", bankName, val)) { >+ if (accel_dev->cfg->balance_interrupts){ >+ core = (bank % num_online_cpus()); >+ } >+ else if (adf_cfg_get_param_value(accel_dev, "Accelerator0", bankName, val)) { > device_printf(GET_DEV(accel_dev), > "No CoreAffinity Set - using default core: %d\n", > core); > } else { > if (compat_strtouint(val, 10, &core)) { > device_printf(GET_DEV(accel_dev), > "Can't get cpu core ID\n"); > } > } > return (core); > } > > static int > adf_request_irqs(struct adf_accel_dev *accel_dev) > { > struct adf_accel_pci *info_pci_dev = &accel_dev->accel_pci_dev; > struct adf_hw_device_data *hw_data = accel_dev->hw_device; > struct msix_entry *msixe = info_pci_dev->msix_entries.entries; > int ret = 0, rid = 0, i = 0; > struct adf_etr_data *etr_data = accel_dev->transport;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 280037
:
251744
|
251776
|
251786
|
256331
| 256343