On 2020-05-19 21:46:06 [+0000], Song Bao Hua wrote:
> Hi Luis,
> In the below patch, in order to use the acomp APIs to leverage the power of 
> hardware compressors. I have moved to mutex:
> https://marc.info/?l=linux-crypto-vger&m=158941285830302&w=2
> https://marc.info/?l=linux-crypto-vger&m=158941287930311&w=2
> 
> so once we get some progress on that one, I guess we don't need a special 
> patch for RT any more.

If you convert this way from the current concept then we could drop it
from the series.
The second patch shows the following hunk:

|@@ -1075,11 +1124,20 @@ static int zswap_frontswap_store(unsigned type, 
pgoff_t offset,
| 
|       /* compress */
|       dst = get_cpu_var(zswap_dstmem);
|       acomp_ctx = *this_cpu_ptr(entry->pool->acomp_ctx);
|       put_cpu_var(zswap_dstmem);

So here you get per-CPU version of `dst' and `acomp_ctx' and then allow
preemption again.

|       mutex_lock(&acomp_ctx->mutex);
|
|       src = kmap(page);
|       sg_init_one(&input, src, PAGE_SIZE);
|       /* zswap_dstmem is of size (PAGE_SIZE * 2). Reflect same in sg_list */
|       sg_init_one(&output, dst, PAGE_SIZE * 2);

and here you use `dst' and `acomp_ctx' after the preempt_disable() has
been dropped so I don't understand why you used get_cpu_var(). It is
either protected by the mutex and doesn't require get_cpu_var() or it
isn't (and should have additional protection).

|       acomp_request_set_params(acomp_ctx->req, &input, &output, PAGE_SIZE, 
dlen);
|       ret = crypto_wait_req(crypto_acomp_compress(acomp_ctx->req), 
&acomp_ctx->wait);
|       dlen = acomp_ctx->req->dlen;
|       kunmap(page);
|
|       if (ret) {
|               ret = -EINVAL;
|               goto put_dstmem;
|

Sebastian

Reply via email to