RE: [RFC PATCH 06/15] virt: tdx-guest: Support TDI bind and unbind operations
From: Duan, Zhenzhong
Date: Thu Oct 29 2026 - 03:42:41 EST
>On 10/27/2026 4:58 PM, Duan, Zhenzhong wrote:
>>> Btw, for TDX specific tdx_devsec_unlock(), the WARN_ON() is not proper
>>> IMHO.
>>> the failure can happen for various reasons, and the WARN can be treated
>as
>>> fatal
>>> when panic_on_warn is true. I think pr_warn_ratelimit() would suffice?
>> OK, but unlock() isn't a loop operation, I prefer to use pr_warn().
>
>I think guest userspace can invoke unlock() in a writing sysfs loop?
>
>If a device is not locked before, the unlock() will surely fail? If so, I
>think
>we can drop the warn/WARN.
Yes, see below. I'll drop the warn/WARN, it looks redundant if we return error code to user space.
static ssize_t unlock_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t len)
{
...
if (!pdev->tsm)
return -EINVAL;