public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/core: Remove rcu attr for uverbs_api_ioctl_method.handler
@ 2022-10-25 15:24 Yonghong Song
  2022-10-25 16:00 ` Jason Gunthorpe
  2022-10-25 23:33 ` kernel test robot
  0 siblings, 2 replies; 6+ messages in thread
From: Yonghong Song @ 2022-10-25 15:24 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky, linux-rdma; +Cc: Paul E . McKenney

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@fb.com

Signed-off-by: Yonghong Song <yhs@fb.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-10-25 23:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-25 15:24 [PATCH] RDMA/core: Remove rcu attr for uverbs_api_ioctl_method.handler Yonghong Song
2022-10-25 16:00 ` Jason Gunthorpe
2022-10-25 16:29   ` Paul E. McKenney
2022-10-25 16:30     ` Jason Gunthorpe
2022-10-25 17:51       ` Yonghong Song
2022-10-25 23:33 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox