Skip to content

Commit d9e2f07

Browse files
brettcreeleykuba-moo
authored andcommitted
pds_core: Prevent possible adminq overflow/stuck condition
The pds_core's adminq is protected by the adminq_lock, which prevents more than 1 command to be posted onto it at any one time. This makes it so the client drivers cannot simultaneously post adminq commands. However, the completions happen in a different context, which means multiple adminq commands can be posted sequentially and all waiting on completion. On the FW side, the backing adminq request queue is only 16 entries long and the retry mechanism and/or overflow/stuck prevention is lacking. This can cause the adminq to get stuck, so commands are no longer processed and completions are no longer sent by the FW. As an initial fix, prevent more than 16 outstanding adminq commands so there's no way to cause the adminq from getting stuck. This works because the backing adminq request queue will never have more than 16 pending adminq commands, so it will never overflow. This is done by reducing the adminq depth to 16. Fixes: 45d76f4 ("pds_core: set up device and adminq") Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Brett Creeley <brett.creeley@amd.com> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Link: https://patch.msgid.link/20250421174606.3892-2-shannon.nelson@amd.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 497041d commit d9e2f07

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

drivers/net/ethernet/amd/pds_core/core.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,7 @@ static int pdsc_core_init(struct pdsc *pdsc)
325325
size_t sz;
326326
int err;
327327

328-
/* Scale the descriptor ring length based on number of CPUs and VFs */
329-
numdescs = max_t(int, PDSC_ADMINQ_MIN_LENGTH, num_online_cpus());
330-
numdescs += 2 * pci_sriov_get_totalvfs(pdsc->pdev);
331-
numdescs = roundup_pow_of_two(numdescs);
328+
numdescs = PDSC_ADMINQ_MAX_LENGTH;
332329
err = pdsc_qcq_alloc(pdsc, PDS_CORE_QTYPE_ADMINQ, 0, "adminq",
333330
PDS_CORE_QCQ_F_CORE | PDS_CORE_QCQ_F_INTR,
334331
numdescs,

drivers/net/ethernet/amd/pds_core/core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#define PDSC_WATCHDOG_SECS 5
1818
#define PDSC_QUEUE_NAME_MAX_SZ 16
19-
#define PDSC_ADMINQ_MIN_LENGTH 16 /* must be a power of two */
19+
#define PDSC_ADMINQ_MAX_LENGTH 16 /* must be a power of two */
2020
#define PDSC_NOTIFYQ_LENGTH 64 /* must be a power of two */
2121
#define PDSC_TEARDOWN_RECOVERY false
2222
#define PDSC_TEARDOWN_REMOVING true

0 commit comments

Comments
 (0)