2014-12-01 13:12:57

by Steffen Trumtrar

[permalink] [raw]
Subject: [QUESTION] How is the backlog supposed to be used?

Hi all!

I have a question regarding the use of the backlog in a driver
using the crypto API.
In my driver ("crypto: sahara - SHA support") I had a problem with
using the backlog when I am using more than one thread to enqueue
the requests and have a queue depth of 1. What happens is, that I
run into the backlog and then complete the request twice, if I do
it like all the other drivers. Random example:

backlog = crypto_get_backlog(&sdcp->queue[chan]);
arq = crypto_dequeue_request(&sdcp->queue[chan]);

if (backlog)
backlog->complete(backlog, -EINPROGRESS);

Everything works fine if I do not complete the request from the
backlog, but instead complete the request when it is due.
Alternative: make the queue deeper like some drivers have it.
If the queue is deeper than I have threads, it works, because
the requests never get onto the backlog.
So, how is the queue intended to be used? What is a correct max_depth?
Do I need to complete the requests from the backlog or not?

Thanks,
Steffen

--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |


2014-12-11 13:15:57

by Herbert Xu

[permalink] [raw]
Subject: Re: [QUESTION] How is the backlog supposed to be used?

Steffen Trumtrar <[email protected]> wrote:
>
> Everything works fine if I do not complete the request from the
> backlog, but instead complete the request when it is due.
> Alternative: make the queue deeper like some drivers have it.
> If the queue is deeper than I have threads, it works, because
> the requests never get onto the backlog.
> So, how is the queue intended to be used? What is a correct max_depth?

The queue depth is up to the driver to determine.

> Do I need to complete the requests from the backlog or not?

Completing the backlog with EINPROGRESS is meant to indicate
to the caller of the crypto API that we're now open to more
requests.

What crypto API user were you using to test this?

Cheers,
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt