Le 23/11/2017 à 15:16, Vaibhav Jain a écrit :
Hi Christophe,

Few review comments:

Christophe Lombard <clomb...@linux.vnet.ibm.com> writes:
+
+int cxl_context_thread_tidr(struct cxl_context *ctx, int assign)
+{
+       int rc = 0;
+
+       /* Clear any TIDR value assigned to the current thread */
+       if (!assign) {
+               clear_thread_tidr(current);
+               ctx->tid = 0;
+       } else {
+               /* Assign a unique TIDR (thread id) for the current thread */
+               rc = set_thread_tidr(current);
+               if (!rc)
+                       ctx->tid = current->thread.tidr;
set_thread_tidr can also return non-zero error values and will never
return '0'. So this condition should be 'if(rc > 0)' instead of 'if (!rc)'

good point. Thanks for this.


+#define CXL_IOCTL_GET_AFU_ID           _IOR(CXL_MAGIC, 0x02, struct cxl_afu_id)
+#define CXL_IOCTL_THREAD_TIDR          _IOR(CXL_MAGIC, 0x03,
int)
Instead of adding a new syscall I think assiging a thread-id can be
better done by adding a new flag to the cxl_ioctl_start_work.flag
field and using one of the reserved fields to return the allocated tid
back to the user.


We have worked previously on this solution but this solution is too restrictive for now - we offer the possibility to configure and to clear
the tidr from user land - and for the future implementation.

Reply via email to