Re: [PATCH v3 1/1] scsi: ufs: core: Add support to notify userspace of UniPro QoS events

From: Can Guo

Date: Wed Mar 04 2026 - 04:21:46 EST




On 3/4/2026 5:12 PM, Peter Wang (王信友) wrote:

On Sun, 2026-03-01 at 04:51 -0800, Can Guo wrote:
> @@ -1768,3 +1768,26 @@ Description:
>                 ====================   ===========================
> >                 The attribute is read only.
> +
> +What: > /sys/bus/platform/drivers/ufshcd/*/dme_qos_notification
> +What:          /sys/bus/platform/devices/*.ufs/dme_qos_notification
> +Date:          February 2026

March 2026
Good catch

> @@ -9097,6 +9106,12 @@ static int ufshcd_post_device_init(struct
> ufs_hba *hba)
> >         /* UFS device is also active now */
>         ufshcd_set_ufs_dev_active(hba);
> +
> +       /* Indicate that DME QoS Monitor has been reset */
> +       atomic_set(&hba->dme_qos_notification, 0x1);
>
Reset value should be 0?
Bit[0] is used to communicate to userspace that DME QOS has been reset,
see also the bit assignments explained in the patch.

> @@ -1116,6 +1121,10 @@ struct ufs_hba {
>         int critical_health_count;
>         atomic_t dev_lvl_exception_count;
>         u64 dev_lvl_exception_id;
> +
> +       atomic_t dme_qos_notification;
> +       struct kernfs_node *dme_qos_sysfs_handle;

Why is dme_qos_sysfs_handle necessary?
Wouldn't it be sufficient to use
sysfs_notify(&hba->dev->kobj, NULL, "dme_qos_notification");
without checking whether dme_qos_sysfs_handle is NULL?
sysfs_notify() cannot be used under atomic context, i.e., IRQ context.

Thanks,
Can Guo.

Thanks
Peter

************* MEDIATEK Confidentiality Notice
********************
The information contained in this e-mail message (including any
attachments) may be confidential, proprietary, privileged, or otherwise
exempt from disclosure under applicable laws. It is intended to be
conveyed only to the designated recipient(s). Any use, dissemination,
distribution, printing, retaining or copying of this e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited and may
be unlawful. If you are not an intended recipient of this e-mail, or believe
that you have received this e-mail in error, please notify the sender
immediately (by replying to this e-mail), delete any and all copies of
this e-mail (including any attachments) from your system, and do not
disclose the content of this e-mail to any other person. Thank you!