From: "yekai(A)" <yekai13@huawei.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: <herbert@gondor.apana.org.au>, <linux-crypto@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <wangzhou1@hisilicon.com>
Subject: Re: [PATCH v5 1/3] uacce: supports device isolation feature
Date: Fri, 8 Jul 2022 17:33:42 +0800 [thread overview]
Message-ID: <288f82bf-ca0b-b049-4dcf-fd7b6a29607b@huawei.com> (raw)
In-Reply-To: <YsfctnUkPCo+qGJW@kroah.com>
On 2022/7/8 15:28, Greg KH wrote:
> On Fri, Jul 08, 2022 at 03:08:18PM +0800, Kai Ye wrote:
>> UACCE adds the hardware error isolation API. Users can configure
>> the isolation frequency by this sysfs node. UACCE reports the device
>> isolate state to the user space. If the AER error frequency exceeds
>> the value of setting for a certain period of time, the device will be
>> isolated.
>>
>> Signed-off-by: Kai Ye <yekai13@huawei.com>
>> ---
>> drivers/misc/uacce/uacce.c | 55 ++++++++++++++++++++++++++++++++++++++
>> include/linux/uacce.h | 11 ++++++++
>> 2 files changed, 66 insertions(+)
>>
>> diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c
>> index 281c54003edc..d07b5f1f0596 100644
>> --- a/drivers/misc/uacce/uacce.c
>> +++ b/drivers/misc/uacce/uacce.c
>> @@ -7,6 +7,8 @@
>> #include <linux/slab.h>
>> #include <linux/uacce.h>
>>
>> +#define MAX_ERR_ISOLATE_COUNT 65535
>> +
>> static struct class *uacce_class;
>> static dev_t uacce_devt;
>> static DEFINE_MUTEX(uacce_mutex);
>> @@ -339,12 +341,63 @@ static ssize_t region_dus_size_show(struct device *dev,
>> uacce->qf_pg_num[UACCE_QFRT_DUS] << PAGE_SHIFT);
>> }
>>
>> +static ssize_t isolate_show(struct device *dev,
>> + struct device_attribute *attr, char *buf)
>> +{
>> + struct uacce_device *uacce = to_uacce_device(dev);
>> +
>> + if (!uacce->ops->get_isolate_state)
>> + return -ENODEV;
>
> If there is no callback, why is this sysfs even created at all? Please
> do not create it if it can not be accessed.
>
> Use the is_visable() callback for the group to do this.
>
If is_visable() is used as the judgment, all uacce device nodes cannot
be registered if there is no callback by test.
>> +
>> + return sysfs_emit(buf, "%d\n", uacce->ops->get_isolate_state(uacce));
>> +}
>> +
>> +static ssize_t isolate_strategy_show(struct device *dev,
>> + struct device_attribute *attr, char *buf)
>> +{
>> + struct uacce_device *uacce = to_uacce_device(dev);
>> + u32 val;
>> +
>> + if (!uacce->ops->isolate_strategy_read)
>> + return -ENODEV;
>
> Same here, don't have a sysfs file that does nothing.
>
>> +
>> + val = uacce->ops->isolate_strategy_read(uacce);
>> + if (val > MAX_ERR_ISOLATE_COUNT)
>> + return -EINVAL;
>> +
>> + return sysfs_emit(buf, "%u\n", val);
>> +}
>> +
>> +static ssize_t isolate_strategy_store(struct device *dev,
>> + struct device_attribute *attr,
>> + const char *buf, size_t count)
>> +{
>> + struct uacce_device *uacce = to_uacce_device(dev);
>> + unsigned long val;
>> + int ret;
>> +
>> + if (!uacce->ops->isolate_strategy_write)
>> + return -ENODEV;
>
> Same here.
>
> thanks,
>
> greg k-h
> .
>
next prev parent reply other threads:[~2022-07-08 9:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-08 7:08 [PATCH v5 0/3] crypto: hisilicon - " Kai Ye
2022-07-08 7:08 ` [PATCH v5 1/3] uacce: " Kai Ye
2022-07-08 7:28 ` Greg KH
2022-07-08 9:33 ` yekai(A) [this message]
2022-07-08 10:01 ` Greg KH
2022-07-08 7:08 ` [PATCH v5 2/3] Documentation: add a isolation strategy sysfs node for uacce Kai Ye
2022-07-08 7:30 ` Greg KH
2022-07-08 9:38 ` yekai(A)
2022-07-08 10:02 ` Greg KH
2022-07-08 7:30 ` Greg KH
2022-07-08 7:08 ` [PATCH v5 3/3] crypto: hisilicon/qm - defining the device isolation strategy Kai Ye
2022-07-08 7:35 ` Greg KH
2022-07-21 8:14 ` yekai(A)
2022-07-23 7:21 ` yekai(A)
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=288f82bf-ca0b-b049-4dcf-fd7b6a29607b@huawei.com \
--to=yekai13@huawei.com \
--cc=gregkh@linuxfoundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wangzhou1@hisilicon.com \
/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
all inboxes | Powered by JetHome®