On Sun, 31 Jul 2022 23:06:31 +0800 Tao Zhou <tao.zhou@xxxxxxxxx> wrote: > > All things above are misled by the first interpretation but,,, > > Yeah, this is not that clear from my above words expression. I said the return > value of da_monitor_init_*() will be 0, but it is not right. Global and per-cpu > monitor will return 0, per-task monitor may return a positive value when the > slot is equal or greater than RV_PER_TASK_MONITOR_INIT(how possible this will > happen I do know yet). This is from reading the current code implementation. > I just want to say that there may be a bug here. Well, rv_get_monitor_slot() can currently only return 0 or negative. This is because PER_TASK_MONITORS is just 1 and we can not return that or greater. > If rv_enable_monitor() return a positive value and the error happened(as above With the current code this can not happen, as we only allow for a single PER_TASK_MONITORS. But in the future, if we increment this, then you are correct. We can not just check retval, but need to check retval < 0. This does need to be fixed. But because it currently isn't an issue because we they can only return 0 or negative, I'm going to pull this series in. But Daniel, these checks do need to be updated. Please send patches on top of this series to address it. -- Steve > said), user space will not know this is a error return value, but regard it as a > right writing. Even if the return value(the slot value not in [0..RV_PER_TASK_MONITOR_INIT)) > is equal to count of charaters that are writen to the file(the string length of monitor name), > it will still be not a right writing. >