On 2020/7/9 20:02, Herbert Xu wrote:
On Thu, Jul 09, 2020 at 07:05:11PM +0800, shenyang (M) wrote:

Yes, this patch just fixes the bug for 'hisi_zip'. As for 'hisi_hpre'
and 'hisi_sec2', this patch doesn't change the logic.
We have noticed the problem you say, and the patch is prepared. We fix
this in 'hisi_qm', and you will see it soon.

I cannot accept a clearly buggy patch.  So please fix this and
resubmit.

Thanks,


Here I give a example of hisi_hpre.ko. When the user unbind or remove
the driver, the driver checks whether the current device is stopped.

--- a/drivers/crypto/hisilicon/hpre/hpre_main.c
+++ b/drivers/crypto/hisilicon/hpre/hpre_main.c
@@ -903,9 +903,11 @@ static void hpre_remove(struct pci_dev *pdev)
        struct hisi_qm *qm = pci_get_drvdata(pdev);
        int ret;

+       hisi_qm_wait_task_finish(qm, &hpre_devices);
+
        hisi_qm_alg_unregister(qm, &hpre_devices);
        if (qm->fun_type == QM_HW_PF && qm->vfs_num) {
-               ret = hisi_qm_sriov_disable(pdev);
+               ret = hisi_qm_sriov_disable(pdev, qm->is_frozen);
                if (ret) {
                        pci_err(pdev, "Disable SRIOV fail!\n");
                        return;

This patch will be add on V3.

And in 'hisi_qm_alg_unregister', the driver will only unregister
algorithm when remove the last device.

So here the algorithm will be unregistered only when nobody holds
a reference count on it.

Thanks,
Yang

Reply via email to