public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rex Zhang <rex.zhang@intel.com>
To: tom.zanussi@linux.intel.com
Cc: dave.jiang@intel.com, davem@davemloft.net,
	dmaengine@vger.kernel.org, fenghua.yu@intel.com,
	giovanni.cabiddu@intel.com, herbert@gondor.apana.org.au,
	james.guilford@intel.com, kanchana.p.sridhar@intel.com,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	pavel@ucw.cz, tony.luck@intel.com, vinodh.gopal@intel.com,
	vkoul@kernel.org, wajdi.k.feghali@intel.com
Subject: Re: [PATCH v11 11/14] crypto: iaa - Add support for deflate-iaa compression algorithm
Date: Mon,  4 Dec 2023 23:00:28 +0800	[thread overview]
Message-ID: <20231204150028.3544490-1-rex.zhang@intel.com> (raw)
In-Reply-To: <20231201201035.172465-12-tom.zanussi@linux.intel.com>

Hi, Tom,

On 2023-12-01 at 14:10:32 -0600, Tom Zanussi wrote:

[snip]

> +static int iaa_wq_put(struct idxd_wq *wq)
> +{
> +	struct idxd_device *idxd = wq->idxd;
> +	struct iaa_wq *iaa_wq;
> +	bool free = false;
> +	int ret = 0;
> +
> +	spin_lock(&idxd->dev_lock);
> +	iaa_wq = idxd_wq_get_private(wq);
> +	if (iaa_wq) {
> +		iaa_wq->ref--;
> +		if (iaa_wq->ref == 0 && iaa_wq->remove) {
> +			__free_iaa_wq(iaa_wq);
> +			idxd_wq_set_private(wq, NULL);
> +			free = true;
> +		}
> +		idxd_wq_put(wq);
> +	} else {
> +		ret = -ENODEV;
> +	}
> +	spin_unlock(&idxd->dev_lock);
__free_iaa_wq() may cause schedule, whether it should be move out of the
context between spin_lock() and spin_unlock()?
> +	if (free)
> +		kfree(iaa_wq);
> +
> +	return ret;
> +}

[snip]

> @@ -800,12 +1762,38 @@ static void iaa_crypto_remove(struct idxd_dev *idxd_dev)
>  
>  	remove_iaa_wq(wq);
>  
> +	spin_lock(&idxd->dev_lock);
> +	iaa_wq = idxd_wq_get_private(wq);
> +	if (!iaa_wq) {
> +		spin_unlock(&idxd->dev_lock);
> +		pr_err("%s: no iaa_wq available to remove\n", __func__);
> +		goto out;
> +	}
> +
> +	if (iaa_wq->ref) {
> +		iaa_wq->remove = true;
> +	} else {
> +		wq = iaa_wq->wq;
> +		__free_iaa_wq(iaa_wq);
> +		idxd_wq_set_private(wq, NULL);
> +		free = true;
> +	}
> +	spin_unlock(&idxd->dev_lock);
__free_iaa_wq() may cause schedule, whether it should be move out of the
context between spin_lock() and spin_unlock()?
> +
> +	if (free)
> +		kfree(iaa_wq);
> +
>  	idxd_drv_disable_wq(wq);
>  	rebalance_wq_table();
>  
> -	if (nr_iaa == 0)
> +	if (nr_iaa == 0) {
> +		iaa_crypto_enabled = false;
Is it necessary to add iaa_unregister_compression_device() here?
All iaa devices are disabled cause the variable first_wq will be true,
if enable wq, iaa_register_compression_device() will fail due to the
algorithm is existed.
>  		free_wq_table();
> +		module_put(THIS_MODULE);
>  
> +		pr_info("iaa_crypto now DISABLED\n");
> +	}
> +out:
>  	mutex_unlock(&iaa_devices_lock);
>  	mutex_unlock(&wq->wq_lock);
>  }

[snip]

Thanks,
Rex Zhang
> -- 
> 2.34.1
> 

  reply	other threads:[~2023-12-04 15:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01 20:10 [PATCH v11 00/14] crypto: Add Intel Analytics Accelerator (IAA) crypto compression driver Tom Zanussi
2023-12-01 20:10 ` [PATCH v11 01/14] dmaengine: idxd: add external module driver support for dsa_bus_type Tom Zanussi
2023-12-01 20:10 ` [PATCH v11 02/14] dmaengine: idxd: Rename drv_enable/disable_wq to idxd_drv_enable/disable_wq, and export Tom Zanussi
2023-12-01 20:10 ` [PATCH v11 03/14] dmaengine: idxd: Export descriptor management functions Tom Zanussi
2023-12-01 20:10 ` [PATCH v11 04/14] dmaengine: idxd: Export wq resource " Tom Zanussi
2023-12-01 20:10 ` [PATCH v11 05/14] dmaengine: idxd: Add wq private data accessors Tom Zanussi
2023-12-01 20:10 ` [PATCH v11 06/14] dmaengine: idxd: add callback support for iaa crypto Tom Zanussi
2023-12-01 20:10 ` [PATCH v11 07/14] crypto: iaa - Add IAA Compression Accelerator Documentation Tom Zanussi
2023-12-01 20:10 ` [PATCH v11 08/14] crypto: iaa - Add Intel IAA Compression Accelerator crypto driver core Tom Zanussi
2023-12-01 20:10 ` [PATCH v11 09/14] crypto: iaa - Add per-cpu workqueue table with rebalancing Tom Zanussi
2023-12-01 20:10 ` [PATCH v11 10/14] crypto: iaa - Add compression mode management along with fixed mode Tom Zanussi
2023-12-01 20:10 ` [PATCH v11 11/14] crypto: iaa - Add support for deflate-iaa compression algorithm Tom Zanussi
2023-12-04 15:00   ` Rex Zhang [this message]
2023-12-04 21:41     ` Tom Zanussi
2023-12-05  2:26       ` Rex Zhang
2023-12-05 21:18         ` Tom Zanussi
2023-12-01 20:10 ` [PATCH v11 12/14] crypto: iaa - Add irq support for the crypto async interface Tom Zanussi
2023-12-01 20:10 ` [PATCH v11 13/14] crypto: iaa - Add IAA Compression Accelerator stats Tom Zanussi
2023-12-01 20:10 ` [PATCH v11 14/14] dmaengine: idxd: Add support for device/wq defaults Tom Zanussi
2023-12-05  9:21   ` Rex Zhang
2023-12-05 15:52     ` Dave Jiang
2023-12-08 20:12   ` Fenghua Yu
2023-12-08 22:13     ` Tom Zanussi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231204150028.3544490-1-rex.zhang@intel.com \
    --to=rex.zhang@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=davem@davemloft.net \
    --cc=dmaengine@vger.kernel.org \
    --cc=fenghua.yu@intel.com \
    --cc=giovanni.cabiddu@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=james.guilford@intel.com \
    --cc=kanchana.p.sridhar@intel.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=tom.zanussi@linux.intel.com \
    --cc=tony.luck@intel.com \
    --cc=vinodh.gopal@intel.com \
    --cc=vkoul@kernel.org \
    --cc=wajdi.k.feghali@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox