lkml.org 
[lkml]   [2022]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 3/3] crypto: hisilicon/qm - defining the device isolation strategy
From
Date


On 2022/6/16 21:45, Jonathan Cameron wrote:
> ...
>
>>>
>>>> + 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
>
> .
>

Yes, I will provide some information here for VF.

thanks

Kai

\
 
 \ /
  Last update: 2022-06-17 04:10    [W:2.100 / U:2.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site