Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2501439ybg; Fri, 31 Jul 2020 01:16:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5B3NLJb0N0jdhZYyS/g7X+JYPcKEv4U9mZINPyteToH5AlwefAj9zJAFXVK7jw7zYioOH X-Received: by 2002:aa7:d299:: with SMTP id w25mr2721339edq.209.1596183379985; Fri, 31 Jul 2020 01:16:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596183379; cv=none; d=google.com; s=arc-20160816; b=zamyU4FJ547eBdzJHo0W8hn0TNWZNQ9diE453UILCJvpv2L4Invt7fDvwzwBFBp/uG AOsOg8AHSeyacGnabs2BiJDEVnZK83cDdGeWrt7gEHL2IPbgLhOYWWiX8BU1HgRsJwvb B0VQtD+iSgWr/uRV1PfmCQGNHhvUSDuKomcKBFs4iJdZnI9c3cF2SrpTMKy73TyKJaoQ hcnrM+oNq/tjC4W8156q7AGR4QzQjT2W6wH+RVaaDWR+czIIXBE8yRN1QtLyxO2jsmCB rubAlEpk4iyeVlS+H7Bd9J6swVYGHbNGAwMoZHI8WZlrnRX9Gf9TZm5CiPI80Ha5qeip fflQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=BaDdckvChXm5vI0pHcBWCpqT1AqCBk0El00OT3lH/lo=; b=BuAIYP3teEW18i+0WbdVG5bee5BBbb49GStJ3eZmIXq6PtM8m2V4mnlL/1qYYU0DH4 ajDxhkUd0jHi61mU9tO7u41HjkkbmTE4z9CExLNeEJUfwFP/EppRJepuQKexrZrTgAov dOmJWoIMg3KZYioTF2FOnsv+1cdG4YWXUcBkiyp00YIRmn9nVmQoQPepNbragauRmRTS jisdhw7LF9x6J/MLCMD0lUj8sloQKPdTiXpdi5MExF7MTNm1lfmKViJB3dTuYPiaMH9k wmIdyEeSdR4QXkwAY0v/mZHxXSX1crql+YbBFnuou/FtfsnnXrraSkUMdfnJ5yFSbIB9 cn9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ds18si6048647ejc.591.2020.07.31.01.15.54; Fri, 31 Jul 2020 01:16:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731557AbgGaIPw (ORCPT + 99 others); Fri, 31 Jul 2020 04:15:52 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:54564 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731522AbgGaIPw (ORCPT ); Fri, 31 Jul 2020 04:15:52 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id C7903F9AA541EADF5447; Fri, 31 Jul 2020 16:15:48 +0800 (CST) Received: from [127.0.0.1] (10.74.173.29) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Fri, 31 Jul 2020 16:15:42 +0800 Subject: Re: [PATCH v3 08/10] crypto: hisilicon/qm - fix the process of register algorithms to crypto To: Herbert Xu References: <1595488780-22085-1-git-send-email-shenyang39@huawei.com> <1595488780-22085-9-git-send-email-shenyang39@huawei.com> <20200731075722.GA20350@gondor.apana.org.au> CC: , , , From: "shenyang (M)" Message-ID: <79b37e17-8eb6-b89b-d49f-46a3faf2783a@huawei.com> Date: Fri, 31 Jul 2020 16:15:41 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20200731075722.GA20350@gondor.apana.org.au> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.74.173.29] X-CFilter-Loop: Reflected Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 2020/7/31 15:57, Herbert Xu wrote: > On Thu, Jul 23, 2020 at 03:19:38PM +0800, Yang Shen wrote: >> When the devices are removed or not existing, the corresponding algorithms >> which are registered by 'hisi-zip' driver can't be used. >> >> Move 'hisi_zip_register_to_crypto' from 'hisi_zip_init' to >> 'hisi_zip_probe'. The algorithms will be registered to crypto only when >> there is device bind on the driver. And when the devices are removed, >> the algorithms will be unregistered. >> >> In the previous process, the function 'xxx_register_to_crypto' need a lock >> and a static variable to judge if the registration is the first time. >> Move this action into the function 'hisi_qm_alg_register'. Each device >> will call 'hisi_qm_alg_register' to add itself to qm list in probe process >> and registering algs when the qm list is empty. >> >> Signed-off-by: Yang Shen >> Reviewed-by: Zhou Wang > > You still haven't resolved the issue of unregistering crypto > algorithms that may be allocated. > Here if the user alloc a tfm of the algorithm the driver registers, the function 'hisi_qm_wait_task_finish' which be added in patch 10 will stop to remove the driver until the tfm is freed. Thanks, > Cheers, >