[PATCH] RDMA/core: Remove rcu attr for uverbs_api_ioctl_method.handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The current uverbs_api_ioctl_method definition:
  struct uverbs_api_ioctl_method {
        int(__rcu *handler)(struct uverbs_attr_bundle *attrs);
        DECLARE_BITMAP(attr_mandatory, UVERBS_API_ATTR_BKEY_LEN);
        ...
  };
The struct member 'handler' is marked with __rcu. But unless
the function body pointed by 'handler' is changing (e.g., jited)
during runtime, there is no need with __rcu.

I discovered this issue when I tried to define __rcu with
__attribute__((btf_type_tag("rcu"))). See [1] for an example
how __user is handled in a similar way.

clang crashed with __attribute__((btf_type_tag("rcu"))) since it
does not support such a pattern of btf_type_tag for a function
pointer. Removing __rcu attr for uverbs_api_ioctl_method.handler
allows building kernel successfully with __attribute__((btf_type_tag("rcu"))).
Since __rcu is not really needed in uverbs_api_ioctl_method.handler,
I suggest we remove it.

  [1] https://lore.kernel.org/r/20220127154600.652613-1-yhs@xxxxxx

Signed-off-by: Yonghong Song <yhs@xxxxxx>
---
 drivers/infiniband/core/rdma_core.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/rdma_core.h b/drivers/infiniband/core/rdma_core.h
index 33706dad6c0f..633a241d355a 100644
--- a/drivers/infiniband/core/rdma_core.h
+++ b/drivers/infiniband/core/rdma_core.h
@@ -85,7 +85,7 @@ struct ib_udata *uverbs_get_cleared_udata(struct uverbs_attr_bundle *attrs);
  */
 
 struct uverbs_api_ioctl_method {
-	int(__rcu *handler)(struct uverbs_attr_bundle *attrs);
+	int(*handler)(struct uverbs_attr_bundle *attrs);
 	DECLARE_BITMAP(attr_mandatory, UVERBS_API_ATTR_BKEY_LEN);
 	u16 bundle_size;
 	u8 use_stack:1;
-- 
2.30.2





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux