public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: "yekai(A)" <yekai13@huawei.com>
Cc: Kai Ye via Linux-accelerators 
	<linux-accelerators@lists.ozlabs.org>,
	<gregkh@linuxfoundation.org>, <herbert@gondor.apana.org.au>,
	<linuxarm@huawei.com>, <linux-kernel@vger.kernel.org>,
	<wangzhou1@hisilicon.com>, <linux-crypto@vger.kernel.org>,
	<zhangfei.gao@linaro.org>
Subject: Re: [PATCH v2 3/3] crypto: hisilicon/qm - defining the device isolation strategy
Date: Thu, 16 Jun 2022 14:45:47 +0100	[thread overview]
Message-ID: <20220616144547.00003093@Huawei.com> (raw)
In-Reply-To: <f4fde630-a2ba-2416-5091-33c510c30593@huawei.com>

...

> >  
> >> +	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


  reply	other threads:[~2022-06-16 13:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14 12:29 [PATCH v2 0/3] crypto: hisilicon - supports device isolation feature Kai Ye
2022-06-14 12:29 ` [PATCH v2 1/3] uacce: " Kai Ye
2022-06-14 12:42   ` Greg KH
2022-06-15  8:52   ` Jonathan Cameron
2022-06-15  9:06     ` yekai(A)
2022-06-14 12:29 ` [PATCH v2 2/3] Documentation: add a isolation strategy vfs node for uacce Kai Ye
2022-06-14 12:41   ` Greg KH
2022-06-15  8:48     ` Jonathan Cameron
2022-06-15  9:18       ` yekai(A)
2022-06-14 12:29 ` [PATCH v2 3/3] crypto: hisilicon/qm - defining the device isolation strategy Kai Ye
2022-06-14 12:43   ` Greg KH
2022-06-14 13:24     ` yekai(A)
2022-06-14 13:29       ` Greg KH
2022-06-15  9:10         ` yekai(A)
2022-06-14 14:12   ` Zhangfei Gao
2022-06-15 13:02   ` Jonathan Cameron
2022-06-16  1:33     ` yekai(A)
2022-06-16 13:45       ` Jonathan Cameron [this message]
2022-06-17  2:07         ` yekai(A)
2022-06-14 12:29 ` [PATCH 1/3] uacce: supports device isolation feature Kai Ye
2022-06-14 14:14   ` Zhangfei Gao
2022-06-15  1:07     ` yekai(A)
2022-06-14 12:29 ` [PATCH 2/3] Documentation: add a isolation strategy vfs node for uacce Kai Ye
2022-06-14 12:29 ` [PATCH 3/3] crypto: hisilicon/qm - defining the device isolation strategy Kai Ye
  -- strict thread matches above, loose matches on Subject: below --
2022-06-14 12:23 [PATCH v2 0/3] crypto: hisilicon - supports device isolation feature Kai Ye
2022-06-14 12:23 ` [PATCH v2 3/3] crypto: hisilicon/qm - defining the device isolation strategy Kai Ye

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=20220616144547.00003093@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-accelerators@lists.ozlabs.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=wangzhou1@hisilicon.com \
    --cc=yekai13@huawei.com \
    --cc=zhangfei.gao@linaro.org \
    /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