Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1459632iog; Thu, 16 Jun 2022 06:52:11 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sgyCP0r6SQwLsQw8sqdXAwqrghh5pY580taSW/enpvjt0RuL6TmbxOzbrwOt4GHQZaGta1 X-Received: by 2002:a17:90a:9914:b0:1ea:7bc5:8218 with SMTP id b20-20020a17090a991400b001ea7bc58218mr16411439pjp.50.1655387530813; Thu, 16 Jun 2022 06:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655387530; cv=none; d=google.com; s=arc-20160816; b=bFtv8QFtyP8z28RFbNzwgtnbnNCHbkTtiIDczx0GCxph9waJxxxZqqI8HQZmwcYl+M b6gyj0Wr8x4l7QBFC1g5g2JhOT5dizfLjiYHGBi0OIlu82TWhQqX04g2AZFJScPyYcVX U46fik08zXqqijODl3ZyF51KbfqA97ddRyzHAb1BBYNjnwzqjhY0gPkfR09Fo/nOdFiT 4k3sqV48E+M/SHTve7QGHoQl0VsXC00p+rxBqOw3FpxyZsn2iiip9LsJ8sG/i5S3S3UT U4eCWZPPQo54l/+Nvy+NyqgyEbCLpMEFkl31mcf0ViN4D/EjRJIqPEduzHh+LB/drt8x c1jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=rNjCgnx2vNjcfwM/7+EdAcaE1u7Qb1EFuF/UKOQ5cR4=; b=h2II18YUTz4+3UE9BQfY8MhY3mrcKIFi6e3CUZM09M6Haueqw6AXhZlR7ovw4KL1Fa Uk7D3f3eza7VuDfJGYjeblsClvzEoPH3wTYAtASTtoClWsfpIzlAjyCw567WbRushYsI ySX2pJQhQke4P2lTGV4D50MDSp/7xfpfg87x4SonVvUCPf5RYhbM7WGbALbbIS48WJgS 1pXfSUeDsqmVl4ly+Gpnktyen/vnNb/Lt41WYFdCu1WxoPMXMF1Hwohl3hNdBFZsO8Q/ TU8FlyBjhPjjgybB3VZdrpEJYyrkuRbMcf5lw+8DsHPCARnDkmRbaVj2fYprR55R7ACj ohmA== 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 b15-20020a056a00114f00b0051c6152700asi2789374pfm.136.2022.06.16.06.51.44; Thu, 16 Jun 2022 06:52:10 -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 S231578AbiFPNpy (ORCPT + 99 others); Thu, 16 Jun 2022 09:45:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377096AbiFPNpx (ORCPT ); Thu, 16 Jun 2022 09:45:53 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 437273120C; Thu, 16 Jun 2022 06:45:52 -0700 (PDT) Received: from fraeml737-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LP3N46PqQz680Bd; Thu, 16 Jun 2022 21:45:40 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml737-chm.china.huawei.com (10.206.15.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 16 Jun 2022 15:45:49 +0200 Received: from localhost (10.202.226.42) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 16 Jun 2022 14:45:48 +0100 Date: Thu, 16 Jun 2022 14:45:47 +0100 From: Jonathan Cameron To: "yekai(A)" CC: Kai Ye via Linux-accelerators , , , , , , , Subject: Re: [PATCH v2 3/3] crypto: hisilicon/qm - defining the device isolation strategy Message-ID: <20220616144547.00003093@Huawei.com> In-Reply-To: References: <20220614122943.1406-1-yekai13@huawei.com> <20220614122943.1406-4-yekai13@huawei.com> <20220615140249.000077f8@Huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.29; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.42] X-ClientProxiedBy: lhreml723-chm.china.huawei.com (10.201.108.74) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,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 ... > > > >> + hw_err->tick_stamp = jiffies; > >> + list_for_each_entry_safe(err, tmp, &qm->uacce_hw_errs, list) { > > > > These are ordered (I think). Could take advantage of that by > > maintaining count of elements in parallel to the list then walking > > list in right direction + stop when you reach last one to need > > deleting. > > > > thanks, The current list + jiffies solution seems more simple. If list always remains relatively short then that's probably fine. > > > >> + if ((hw_err->tick_stamp - err->tick_stamp) / HZ > > >> + SECONDS_PER_HOUR) { > >> + list_del(&err->list); > >> + kfree(err); > >> + } else { > >> + count++; > >> + } > >> + } > >> + list_add(&hw_err->list, &qm->uacce_hw_errs); > >> + > >> + if (count >= isolate->hw_err_isolate_hz) > >> + atomic_set(&isolate->is_isolate, 1); > >> + > >> + return 0; > >> +} > >> + > > > > ... > > > >> +static int hisi_qm_isolate_strategy_write(struct uacce_device *uacce, > >> + const char *buf) > >> +{ > >> + struct hisi_qm *qm = uacce->priv; > >> + unsigned long val = 0; > >> + > >> +#define MAX_ISOLATE_STRATEGY 65535 > >> + > >> + if (atomic_read(&qm->uacce_ref)) > >> + return -EBUSY; > >> + > >> + /* must be set by PF */ > >> + if (atomic_read(&qm->isolate_data.is_isolate) || uacce->is_vf) > > > > Why is the file visible on the vf? Hide it or don't register it for vfs. > Because VF devices can be registered with UACCE. So this file node can > be visited on the vf. We're not sure if someone else's device is the > same as qm. So i configure it this way by driver. the 'isolate_strategy' > must be set by pf. > If possible have the uacce registration from the driver provide information on whether this applies to the VF. Much better to have no file presented by the VF than one that always returns an error code. Jonathan