[PATCH] dma/idxd: fix burst capacity calculation
Bruce Richardson
bruce.richardson at intel.com
Mon Jan 10 14:25:18 CET 2022
On Mon, Jan 10, 2022 at 01:09:02PM +0000, Pai G, Sunil wrote:
> Hi Bruce, Kevin
>
> This patch seems to have uncovered a bug in the driver.
> On applying, the idxd_burst_capacity API seems to return 0 for cases even when there are batch descriptors and ring space available.
> Seems like there is a wraparound missing when calculating the descriptor ring space, causing this behavior.
>
> Below change seems to fix the issue.
>
> @@ -483,7 +496,7 @@ idxd_burst_capacity(const void *dev_private, uint16_t vchan __rte_unused)
> /* For descriptors, check for wrap-around on write but not read */
> if (idxd->ids_returned > write_idx)
> write_idx += idxd->desc_ring_mask + 1;
> - used_space = write_idx - idxd->ids_returned;
> + used_space = (write_idx - idxd->ids_returned)&idxd->desc_ring_mask;
>
> <snipped>
>
> Could we include this fix in the current patch ?
>
Hi Sunil,
what values for the write_idx and ids_returned vars give this error, and
how does masking help? I'd expect masking to increase the number of times
the function returns zero, rather than decreasing it.
/Bruce
More information about the stable
mailing list