Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp285515iog; Wed, 15 Jun 2022 02:11:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tVR225MHPkSY/L4WR2aCSkeWA9GruPWLR9Y1M+2w8btUrIDH6EuxhU+33dt/AnyP8jeGn6 X-Received: by 2002:a17:902:ce8f:b0:163:cc85:ba89 with SMTP id f15-20020a170902ce8f00b00163cc85ba89mr8157351plg.79.1655284293608; Wed, 15 Jun 2022 02:11:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655284293; cv=none; d=google.com; s=arc-20160816; b=vg5xGsonia1nVMBg+UOwNZs30s5jNswZ/iu7kp9o+0gRuWtD2XVipTY+bcLnu81D0r sjUNo9kOfKCYorCF4tPjp7xMa2NxAYuufwU9kM/OqdI54a8RtV2ecKv1oNSkbToG6dm3 EMPWO8gZb0rMXj8KgyuFPTKtel7s0Mydn7SCa2v8f2/Wl3Tmu3XDFJgBdA49NToDzKUK eFvV3vKqliiextqowo4QE/wgEqq6MTyL1vt8raBM7GocrK0f80LlCG6DcLzUq2fffEas xe8JkHIMRICiAk6RR+2byKANlcCLf/WxOhpmKgwO/tBikP89YxWkiolqYUbrb2udThBw mTDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=e2oUMrVFTVD0PaxgceJVB3VC2vROcKVi9h8+cUX7mtg=; b=Zwux4rlVdD8w7wdDMnI//5W0fA2zpC9cIk8XijCVkC1N//lYxD2G6E4mhv+K3GC8z5 tdroyNSHmLGi4fsFfeVpCM4orswjstS9W/LDFBcOhppePJXflfl/syWHRAHnbjPIAKbY 4GU7Xeh77FDxB/mS088SN4JUjLc3iwoQF8Gw38/9W6kL4L4NjUDicOmtIIUwkuyEbHL+ UOYp1zv8vzOeK5Z5SIUifh+0ATtaQM81I/fNUW6ktwUP0v9p2h9MONPo7Nf6U5POaRDj fgrTipa3SwNC5Sc3mYs0gbJVRCGLGhT7lDsUu/TsnP59QYol3RXsGu/QR3Q40uzExHcl EbJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c23-20020a63da17000000b00408c3dbe25esi2169048pgh.22.2022.06.15.02.10.57; Wed, 15 Jun 2022 02:11:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229802AbiFOJKx (ORCPT + 99 others); Wed, 15 Jun 2022 05:10:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238242AbiFOJKv (ORCPT ); Wed, 15 Jun 2022 05:10:51 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FA1611C26; Wed, 15 Jun 2022 02:10:50 -0700 (PDT) Received: from dggpeml500020.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4LNKH65t0Wz1K9xV; Wed, 15 Jun 2022 17:08:50 +0800 (CST) Received: from dggpeml100012.china.huawei.com (7.185.36.121) by dggpeml500020.china.huawei.com (7.185.36.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 15 Jun 2022 17:10:48 +0800 Received: from [10.67.103.212] (10.67.103.212) by dggpeml100012.china.huawei.com (7.185.36.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 15 Jun 2022 17:10:48 +0800 Subject: Re: [PATCH v2 3/3] crypto: hisilicon/qm - defining the device isolation strategy To: Greg KH References: <20220614122943.1406-1-yekai13@huawei.com> <20220614122943.1406-4-yekai13@huawei.com> CC: , , , , , , From: "yekai(A)" Message-ID: Date: Wed, 15 Jun 2022 17:10:48 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.103.212] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml100012.china.huawei.com (7.185.36.121) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 2022/6/14 21:29, Greg KH wrote: > On Tue, Jun 14, 2022 at 09:24:08PM +0800, yekai(A) wrote: >>>> struct hisi_qm { >>>> enum qm_hw_ver ver; >>>> enum qm_fun_type fun_type; >>>> @@ -335,6 +341,9 @@ struct hisi_qm { >>>> struct qm_shaper_factor *factor; >>>> u32 mb_qos; >>>> u32 type_rate; >>>> + struct list_head uacce_hw_errs; >>>> + atomic_t uacce_ref; /* reference of the uacce */ >>> >>> That is not how reference counts work, sorry. Please use 'struct kref' >>> for a real reference count, never roll your own. >>> >>> thanks, >>> >>> greg k-h >>> . >>> >> >> this atomic_t reference is lightweight than 'struct kref', > > It's the same size, why would it be "lighter"? Why do you need it to be > lighter, what performance issue is there with a kref? > >> this reference >> means whether the task is running. So would it be better to use atomic_t >> reference? > > I do not know, as "running or not running" is a state, not a count or a > reference. why does this have to be atomic at all? > > thanks, > > greg k-h > . > I will use 'qm_state' instead of reference count by zhangfei Gao's opinion. Thanks Kai