From: Vinod Koul Date: Wed, 5 Jan 2022 07:18:05 +0000 (+0530) Subject: Merge branch 'fixes' into next X-Git-Tag: v5.17-rc1~45^2~21 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=5cb664fbeba0a11592c1d2774833a4cc49d1ca19;p=linux-block.git Merge branch 'fixes' into next We have a conflict in idxd driver between 'fixes' and 'next' and there are patches dependent on this so, merge the 'fixes' branch into next --- 5cb664fbeba0a11592c1d2774833a4cc49d1ca19 diff --cc drivers/dma/idxd/submit.c index 569815a84e95,83452fbbb168..11ac06be1f0a --- a/drivers/dma/idxd/submit.c +++ b/drivers/dma/idxd/submit.c @@@ -120,32 -134,20 +125,43 @@@ static void llist_abort_desc(struct idx spin_unlock(&ie->list_lock); if (found) - complete_desc(found, IDXD_COMPLETE_ABORT); + idxd_dma_complete_txd(found, IDXD_COMPLETE_ABORT, false); + + /* - * complete_desc() will return desc to allocator and the desc can be - * acquired by a different process and the desc->list can be modified. - * Delete desc from list so the list trasversing does not get corrupted - * by the other process. ++ * completing the descriptor will return desc to allocator and ++ * the desc can be acquired by a different process and the ++ * desc->list can be modified. Delete desc from list so the ++ * list trasversing does not get corrupted by the other process. + */ + list_for_each_entry_safe(d, t, &flist, list) { + list_del_init(&d->list); - complete_desc(d, IDXD_COMPLETE_NORMAL); ++ idxd_dma_complete_txd(found, IDXD_COMPLETE_ABORT, true); + } } +/* + * ENQCMDS typically fail when the WQ is inactive or busy. On host submission, the driver + * has better control of number of descriptors being submitted to a shared wq by limiting + * the number of driver allocated descriptors to the wq size. However, when the swq is + * exported to a guest kernel, it may be shared with multiple guest kernels. This means + * the likelihood of getting busy returned on the swq when submitting goes significantly up. + * Having a tunable retry mechanism allows the driver to keep trying for a bit before giving + * up. The sysfs knob can be tuned by the system administrator. + */ +int idxd_enqcmds(struct idxd_wq *wq, void __iomem *portal, const void *desc) +{ + int rc, retries = 0; + + do { + rc = enqcmds(portal, desc); + if (rc == 0) + break; + cpu_relax(); + } while (retries++ < wq->enqcmds_retries); + + return rc; +} + int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc) { struct idxd_device *idxd = wq->idxd;