RDMA/srpt: Fix RCU debug build error
Subsystems (3)
PATCH 1/1 RDMA/srpt: Fix RCU debug build error
Combination of CONFIG_DEBUG_OBJECTS_RCU_HEAD=y and CONFIG_INFINIBAND_SRPT=m produces the following build error.
ERROR: "init_rcu_head" [drivers/infiniband/ulp/srpt/ib_srpt.ko] undefined! make[1]: *** [scripts/Makefile.modpost:92: __modpost] Error 1
make: *** [Makefile:1216: modules] Error 2
The reason to it that init_rcu_head() is not exported and not supposed to be used in modules. The correct function to use is init_rcu_head_on_stack().
--- drivers/infiniband/ulp/srpt/ib_srpt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/srpt/ib_srpt.c +2 -2
@@ -1950,7 +1950,7 @@ static struct srpt_nexus *srpt_get_nexus(struct srpt_port *sport, nexus =ERR_PTR (-ENOMEM );break ; } -init_rcu_head (&tmp_nexus->rcu); +init_rcu_head_on_stack (&tmp_nexus->rcu);INIT_LIST_HEAD (&tmp_nexus->ch_list);memcpy (tmp_nexus->i_port_id, i_port_id,16 );memcpy (tmp_nexus->t_port_id, t_port_id,16 );
@@ -2110,7 +2110,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, goto reject; } -init_rcu_head (&ch->rcu); +init_rcu_head_on_stack (&ch->rcu);kref_init (&ch->kref); ch->pkey =be16_to_cpu (pkey); ch->nexus = nexus;
--
2.15.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20180123115013.12213-1-leonro-VPRAkNaXOzVWk0Htik3J/[email protected]
Quoted 20 lines · Leon Romanovsky
Combination of
CONFIG_DEBUG_OBJECTS_RCU_HEAD=yandCONFIG_INFINIBAND_SRPT=mproduces the following build error.ERROR: "
init_rcu_head" [drivers/infiniband/ulp/srpt/ib_srpt.ko] undefined! make[1]: *** [scripts/Makefile.modpost:92:__modpost] Error 1
make: *** [Makefile:1216: modules] Error 2The reason to it that
init_rcu_head()is not exported and not supposed to be used in modules. The correct function to use isinit_rcu_head_on_stack().Fixes 795bc112cd5a ("IB/srpt: Make it safe to use RCU for srpt_device.rch_list")Fixes a11253142e6d ("IB/srpt: Rework multi-channel support")drivers/infiniband/ulp/srpt/ib_srpt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/infiniband/ulp/srpt/ib_srpt.c +1
-0+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
drivers/infiniband/ulp/srpt/ib_srpt.c static struct srpt_nexus *srpt_get_nexus(struct srpt_port *sport, · line 1953
Quoted 5 lines
drivers/infiniband/ulp/srpt/ib_srpt.c +1
-1@@ -1950,7 +1950,7 @@ static struct srpt_nexus *srpt_get_nexus(struct srpt_port *sport, nexus =ERR_PTR (-ENOMEM );break ; } -init_rcu_head (&tmp_nexus->rcu); +init_rcu_head_on_stack (&tmp_nexus->rcu);
The comments for init_rcu_head_on_stack say it should only be used for stack allocations and tmp_nexus is not a stack allocation.
Removing the init_rcu_head entirely seems like the right thing to do, and maybe that function is poorly named?
/*
* init_rcu_head_on_stack()/destroy_rcu_head_on_stack() are needed for dynamic
* initialization and destruction of rcu_head on the stack. rcu_head structures
* allocated dynamically in the heap or defined statically don't need any
* initialization.
*/
The commit that introduced init_rcu_head is 546a9d8519ed137b2804a3f5a3659003039dd49c which suggests it exists only to help the slab allocators, although curiously the allocators never call it these days..
Maybe Paul can confirm?
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20180123152142.GB30619-VPRAkNaXOzVWk0Htik3J/[email protected]
T24gVHVlLCAyMDE4LTAxLTIzIGF0IDA4OjIxIC0wNzAwLCBKYXNvbiBHdW50aG9ycGUgd3JvdGU6 DQo+IC8qDQo+ICAqIGluaXRfcmN1X2hlYWRfb25fc3RhY2soKS9kZXN0cm95X3JjdV9oZWFkX29u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vY2F0ZWQgYXJlIGF1 dG9tYXRpY2FsbHkgdHJhY2tlZCwgYnV0DQoJPHR0PnJjdV9oZWFkPC90dD4gc3RydWN0dXJlcyBh bGxvY2F0ZWQgb24gdGhlIHN0YWNrDQoJbXVzdCBiZSBpbml0aWFsaXplZCB3aXRoIDx0dD5pbml0 X3JjdV9oZWFkX29uX3N0YWNrKCk8L3R0Pg0KCWFuZCBjbGVhbmVkIHVwIHdpdGggPHR0PmRlc3Ry b3lfcmN1X2hlYWRfb25fc3RhY2soKTwvdHQ+Lg0KCVNpbWlsYXJseSwgc3RhdGljYWxseSBhbGxv Y2F0ZWQgbm9uLXN0YWNrIDx0dD5yY3VfaGVhZDwvdHQ+DQoJc3RydWN0dXJlcyBtdXN0IGJlIGlu aXRpYWxpemVkIHdpdGggPHR0PmluaXRfcmN1X2hlYWQoKTwvdHQ+DQoJYW5kIGNsZWFuZWQgdXAg d2l0aCA8dHQ+ZGVzdHJveV9yY3VfaGVhZCgpPC90dD4uDQoNCkJhcnQu
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 20 lines · Bart Van Assche
Quoted 7 lines · Jason Gunthorpe
/*
* init_rcu_head_on_stack()/destroy_rcu_head_on_stack() are needed for dynamic
* initialization and destruction ofrcu_headon the stack.rcu_headstructures
* allocated dynamically in the heap or defined statically don't need any
* initialization.
*/Quoted 6 lines
The commit that introduced
init_rcu_headis546a9d8519ed137b2804a3f5a3659003039dd49cwhich suggests it exists only to help the slab allocators, although curiously the allocators never call it these days..Maybe Paul can confirm?
It would be great if Paul could provide feedback. The comment in
include/linux/rcupdate.hseems to contradict the following paragraph fromDocumentation/RCU/Design/Requirements/Requirements.htmlfor statically allocated objects:
Quoted 8 lines
The corresponding <tt>rcu_head</tt> structures that are dynamically allocated are automatically tracked, but <tt>rcu_head</tt> structures allocated on the stack must be initialized with <tt>init_rcu_head_on_stack()</tt> and cleaned up with <tt>destroy_rcu_head_on_stack()</tt>. Similarly, statically allocated non-stack <tt>rcu_head</tt> structures must be initialized with <tt>init_rcu_head()</tt> and cleaned up with <tt>destroy_rcu_head()</tt>.
Right, I missed it.
So how are we going to solve that rdma/for-next doesn't compile?
Thanks
Quoted 2 lines
Bart.N?????r??y????b?X??ǧv?^?){.n?+????{??ٚ?{ay?ʇڙ?,j??f???h???z??w??????j:+v???w?j?m????????zZ+?????ݢj"??!
A message that is not in the archive (sent off-list or not yet received): 20180123185732.GA1393-U/[email protected]
T24gVHVlLCAyMDE4LTAxLTIzIGF0IDIwOjU3ICswMjAwLCBMZW9uIFJvbWFub3Zza3kgd3JvdGU6 DQo+IFNvIGhvdyBhcmUgd2UgZ29pbmcgdG8gc29sdmUgdGhhdCByZG1hL2Zvci1uZXh0IGRvZXNu J3QgY29tcGlsZT8NCg0KSG93IGFib3V0IHRoZSBmb2xsb3dpbmc/DQoNCltQQVRDSF0gSUIvc3Jw dDogRml4IENPTkZJR19ERUJVR19PQkpFQ1RTX1JDVV9IRUFEPXkgYnVpbGQNCg0KQXZvaWQgdGhh dCB0aGUga2VybmVsIGJ1aWxkIGZhaWxzIGFzIGZvbGxvd3MgaWYgUkNVIGRlYnVnZ2luZyBpcw0K ZW5hYmxlZDoNCg0KRVJST1I6ICJpbml0X3JjdV9oZWFkIiBbZHJpdmVycy9pbmZpbmliYW5kL3Vs cC9zcnB0L2liX3NycHQua29dIHVuZGVmaW5lZCENCg0KZGlmZiAtLWdpdCBhL2RyaXZlcnMvaW5m aW5pYmFuZC91bHAvc3JwdC9pYl9zcnB0LmMgYi9kcml2ZXJzL2luZmluaWJhbmQvdWxwL3NycHQv aWJfc3JwdC5jDQppbmRleCA1Y2NjNzVjMzg5ZTIuLmE3OGE3OTc5MTk1MCAxMDA2NDQNCi0tLSBh L2RyaXZlcnMvaW5maW5pYmFuZC91bHAvc3JwdC9pYl9zcnB0LmMNCisrKyBiL2RyaXZlcnMvaW5m aW5pYmFuZC91bHAvc3JwdC9pYl9zcnB0LmMNCkBAIC0xOTc3LDcgKzE5NzcsNiBAQCBzdGF0aWMg c3RydWN0IHNycHRfbmV4dXMgKnNycHRfZ2V0X25leHVzKHN0cnVjdCBzcnB0X3BvcnQgKnNwb3J0 LA0KIAkJCW5leHVzID0gRVJSX1BUUigtRU5PTUVNKTsNCiAJCQlicmVhazsNCiAJCX0NCi0JCWlu aXRfcmN1X2hlYWQoJnRtcF9uZXh1cy0+cmN1KTsNCiAJCUlOSVRfTElTVF9IRUFEKCZ0bXBfbmV4 dXMtPmNoX2xpc3QpOw0KIAkJbWVtY3B5KHRtcF9uZXh1cy0+aV9wb3J0X2lkLCBpX3BvcnRfaWQs IDE2KTsNCiAJCW1lbWNweSh0bXBfbmV4dXMtPnRfcG9ydF9pZCwgdF9wb3J0X2lkLCAxNik7DQpA QCAtMjE0Nyw3ICsyMTQ2LDYgQEAgc3RhdGljIGludCBzcnB0X2NtX3JlcV9yZWN2KHN0cnVjdCBz cnB0X2RldmljZSAqY29uc3Qgc2RldiwNCiAJCWdvdG8gcmVqZWN0Ow0KIAl9DQogDQotCWluaXRf cmN1X2hlYWQoJmNoLT5yY3UpOw0KIAlrcmVmX2luaXQoJmNoLT5rcmVmKTsNCiAJY2gtPnBrZXkg PSBiZTE2X3RvX2NwdShwa2V5KTsNCiAJY2gtPm5leHVzID0gbmV4dXM7DQo=
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 25 lines · Bart Van Assche
Quoted 1 line · Leon Romanovsky
So how are we going to solve that rdma/for-next doesn't compile?
How about the following?
[PATCH] IB/srpt: Fix
CONFIG_DEBUG_OBJECTS_RCU_HEAD=ybuildAvoid that the kernel build fails as follows if RCU debugging is enabled:
ERROR: "
init_rcu_head" [drivers/infiniband/ulp/srpt/ib_srpt.ko] undefined!drivers/infiniband/ulp/srpt/ib_srpt.c +0
-1@@ -1977,7 +1977,6 @@ static struct srpt_nexus *srpt_get_nexus(struct srpt_port *sport, nexus =ERR_PTR (-ENOMEM );break ; } -init_rcu_head (&tmp_nexus->rcu);INIT_LIST_HEAD (&tmp_nexus->ch_list);memcpy (tmp_nexus->i_port_id, i_port_id,16 );memcpy (tmp_nexus->t_port_id, t_port_id,16 );
drivers/infiniband/ulp/srpt/ib_srpt.c static int srpt_cm_req_recv(struct srpt_device *const sdev, · line 2151
Quoted 7 lines
drivers/infiniband/ulp/srpt/ib_srpt.c +0
-1@@ -2147,7 +2146,6 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev, goto reject; } -init_rcu_head (&ch->rcu);kref_init (&ch->kref); ch->pkey =be16_to_cpu (pkey); ch->nexus = nexus;
Thanks
Quoted 25 lines · Bart Van Assche
Quoted 1 line · Leon Romanovsky
So how are we going to solve that rdma/for-next doesn't compile?
How about the following?
[PATCH] IB/srpt: Fix
CONFIG_DEBUG_OBJECTS_RCU_HEAD=ybuildAvoid that the kernel build fails as follows if RCU debugging is enabled:
ERROR: "
init_rcu_head" [drivers/infiniband/ulp/srpt/ib_srpt.ko] undefined!drivers/infiniband/ulp/srpt/ib_srpt.c +0
-1@@ -1977,7 +1977,6 @@ static struct srpt_nexus *srpt_get_nexus(struct srpt_port *sport, nexus =ERR_PTR (-ENOMEM );break ; } -init_rcu_head (&tmp_nexus->rcu);INIT_LIST_HEAD (&tmp_nexus->ch_list);memcpy (tmp_nexus->i_port_id, i_port_id,16 );memcpy (tmp_nexus->t_port_id, t_port_id,16 );
drivers/infiniband/ulp/srpt/ib_srpt.c static int srpt_cm_req_recv(struct srpt_device *const sdev, · line 2151
Quoted 7 lines
drivers/infiniband/ulp/srpt/ib_srpt.c +0
-1@@ -2147,7 +2146,6 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev, goto reject; } -init_rcu_head (&ch->rcu);kref_init (&ch->kref); ch->pkey =be16_to_cpu (pkey); ch->nexus = nexus;
Hi Bart,
Can you please resend this as an official patch with SOB so we can pull this in? Thanks.
Signature · 3 lines
Doug Ledford <[email protected]> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
A message that is not in the archive (sent off-list or not yet received): 1516833393.27592.108.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
T24gV2VkLCAyMDE4LTAxLTI0IGF0IDE3OjM2IC0wNTAwLCBEb3VnIExlZGZvcmQgd3JvdGU6DQo+ IENhbiB5b3UgcGxlYXNlIHJlc2VuZCB0aGlzIGFzIGFuIG9mZmljaWFsIHBhdGNoIHdpdGggU09C IHNvIHdlIGNhbiBwdWxsDQo+IHRoaXMgaW4/ICBUaGFua3MuDQoNCkhlbGxvIERvdWcsDQoNCkNh biB5b3UgaGF2ZSBhIGxvb2sgYXQgdGhpcyBwYXRjaCBhbmQgc2VlIHdoZXRoZXIgdGhpcyBuZWVk cyBhbnkgZnVydGhlcg0KYWRqdXN0bWVudHM6IGh0dHBzOi8vbWFyYy5pbmZvLz9sPWxpbnV4LXJk bWEmbT0xNTE2Nzc2OTcxMjA3NzAuDQoNClRoYW5rcywNCg0KQmFydC4=
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 4 lines · Bart Van Assche
Quoted 2 lines · Doug Ledford
Can you please resend this as an official patch with SOB so we can pull this in? Thanks.
Quoted 8 lines
Hello Doug,
Can you have a look at this patch and see whether this needs any further
adjustments: https://marc.info/?l=linux-rdma&m=151677697120770.Thanks,
Bart.
That's good. I just missed it in my email client because the time/date sorting of the threads had this thread later in my list and that lone patch sitting by itself out of sight-out of mind. Thanks for the pointer ;-)
Signature · 3 lines
Doug Ledford <[email protected]> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
Quoted 20 lines · Bart Van Assche
Quoted 7 lines · Jason Gunthorpe
/*
* init_rcu_head_on_stack()/destroy_rcu_head_on_stack() are needed for dynamic
* initialization and destruction ofrcu_headon the stack.rcu_headstructures
* allocated dynamically in the heap or defined statically don't need any
* initialization.
*/Quoted 6 lines
The commit that introduced
init_rcu_headis546a9d8519ed137b2804a3f5a3659003039dd49cwhich suggests it exists only to help the slab allocators, although curiously the allocators never call it these days..Maybe Paul can confirm?
It would be great if Paul could provide feedback. The comment in
include/linux/rcupdate.hseems to contradict the following paragraph fromDocumentation/RCU/Design/Requirements/Requirements.htmlfor statically allocated objects:
Quoted 8 lines
The corresponding <tt>rcu_head</tt> structures that are dynamically allocated are automatically tracked, but <tt>rcu_head</tt> structures allocated on the stack must be initialized with <tt>init_rcu_head_on_stack()</tt> and cleaned up with <tt>destroy_rcu_head_on_stack()</tt>. Similarly, statically allocated non-stack <tt>rcu_head</tt> structures must be initialized with <tt>init_rcu_head()</tt> and cleaned up with <tt>destroy_rcu_head()</tt>.
And this is the intent. What breaks when you do that?
Thanx, Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20180123220337.GE3741-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org
T24gVHVlLCAyMDE4LTAxLTIzIGF0IDE0OjAzIC0wODAwLCBQYXVsIEUuIE1jS2VubmV5IHdyb3Rl Og0KPiBPbiBUdWUsIEphbiAyMywgMjAxOCBhdCAwNDowNDoxN1BNICswMDAwLCBCYXJ0IFZhbiBB c3NjaGUgd3JvdGU6DQo+ID4gSXQgd291bGQgYmUgZ3JlYXQgaWYgUGF1bCBjb3VsZCBwcm92aWRl IGZlZWRiYWNrLiBUaGUgY29tbWVudCBpbg0KPiA+IGluY2x1ZGUvbGludXgvcmN1cGRhdGUuaCBz ZWVtcyB0byBjb250cmFkaWN0IHRoZSBmb2xsb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kNCmFsbG9jYXRlZCBvYmplY3QgYW5kIHRoYXQgdHJpZ2dlcnMgYSBsaW5rZXIgZXJyb3Ig d2l0aA0KQ09ORklHX0RFQlVHX09CSkVDVFNfUkNVX0hFQUQ9eS4gSSBqdXN0IHZlcmlmaWVkIHRo YXQgdGhlIGliX3NycHQgZHJpdmVyIHN0aWxsDQp3b3JrcyBmaW5lIGlmIHRoZSBpbml0X3JjdV9o ZWFkKCkgY2FsbHMgYXJlIHJlbW92ZWQgZnJvbSB0aGF0IGRyaXZlci4gSG93ZXZlciwNCnRoZSBm b2xsb3dpbmcgcGFydCBvZiB0aGUgY29tbWVudCBpbiBpbmNsdWRlL2xpbnV4L3JjdXBkYXRlLmgg YWJvdmUNCmluaXRfcmN1X2hlYWQoKSBzZWVtcyBjb25mdXNpbmcgdG8gbWU6ICJyY3VfaGVhZCBz dHJ1Y3R1cmVzIGFsbG9jYXRlZA0KZHluYW1pY2FsbHkgaW4gdGhlIGhlYXAgb3IgZGVmaW5lZCBz dGF0aWNhbGx5IGRvbid0IG5lZWQgYW55IGluaXRpYWxpemF0aW9uLiINClNob3VsZCB0aGF0IGNv bW1lbnQgcGVyaGFwcyBiZSB1cGRhdGVkIHN1Y2ggdGhhdCBpdCBtYXRjaGVzDQpEb2N1bWVudGF0 aW9uL1JDVS9EZXNpZ24vUmVxdWlyZW1lbnRzL1JlcXVpcmVtZW50cy5odG1sPw0KDQpUaGFua3Ms DQoNCkJhcnQu
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 20 lines · Bart Van Assche
Quoted 15 lines · Paul E. McKenney
Quoted 5 lines · Bart Van Assche
It would be great if Paul could provide feedback. The comment in
include/linux/rcupdate.hseems to contradict the following paragraph fromDocumentation/RCU/Design/Requirements/Requirements.htmlfor statically allocated objects:Quoted 8 lines
The corresponding <tt>rcu_head</tt> structures that are dynamically allocated are automatically tracked, but <tt>rcu_head</tt> structures allocated on the stack must be initialized with <tt>init_rcu_head_on_stack()</tt> and cleaned up with <tt>destroy_rcu_head_on_stack()</tt>. Similarly, statically allocated non-stack <tt>rcu_head</tt> structures must be initialized with <tt>init_rcu_head()</tt> and cleaned up with <tt>destroy_rcu_head()</tt>.
Quoted 1 line
And this is the intent. What breaks when you do that?
Hello Paul,
Quoted 9 lines
I inserted a
init_rcu_head()call in theib_srptdriver for a dynamically allocated object and that triggers a linker error withCONFIG_DEBUG_OBJECTS_RCU_HEAD=y. I just verified that theib_srptdriver still works fine if theinit_rcu_head()calls are removed from that driver. However, the following part of the comment ininclude/linux/rcupdate.haboveinit_rcu_head()seems confusing to me: "rcu_headstructures allocated dynamically in the heap or defined statically don't need any initialization." Should that comment perhaps be updated such that it matchesDocumentation/RCU/Design/Requirements/Requirements.html?
Good catch!!! How about the patch below?
Thanx, Paul
------------------------------------------------------------------------
commit 2ccdd2a8f0ba33b71dab24da408fda79ed2ee063
Author: Paul E. McKenney <[email protected]> Date: Tue Jan 23 14:48:33 2018 -0800
rcu: Fix init_rcu_head() comment.
The current (and implicit) comment header for init_rcu_head() and destroy_rcu_head() incorrectly says that they are not needed for statically allocated rcu_head structures. This commit therefore fixes this comment.
include/linux/rcupdate.h +6 -4
@@ -214,10 +214,12 @@ do { \#endif /* -* init_rcu_head_on_stack()/destroy_rcu_head_on_stack() are needed for dynamic -* initialization and destruction of rcu_head on the stack. rcu_head structures -* allocated dynamically in the heap or defined statically don't need any -* initialization. +* The init_rcu_head_on_stack() and destroy_rcu_head_on_stack() calls +* are needed for dynamic initialization and destruction of rcu_head +* on the stack, and init_rcu_head()/destroy_rcu_head() are needed for +* dynamic initialization and destruction of statically allocated rcu_head +* structures. However, rcu_head structures allocated dynamically in the +* heap don't need any initialization. */ #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD void init_rcu_head (struct rcu_head *head);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20180123225054.GK3741-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org
T24gVHVlLCAyMDE4LTAxLTIzIGF0IDE0OjUwIC0wODAwLCBQYXVsIEUuIE1jS2VubmV5IHdyb3Rl Og0KPiANCj4gICAgIHJjdTogRml4IGluaXRfcmN1X2hlYWQoKSBjb21tZW50Lg0KPiAgICAgDQo+ ICAgICBUaGUgY3VycmVudCAoYW5kIGltcGxpY2l0KSBjb21tZW50IGhlYWRlciBmb3IgaW5pdF9y Y3VfaGVhZCgpIGFuZA0KPiAgICAgZGVzdHJveV9yY3VfaGVhZCgpIGluY29ycmVjdGx5IHNheXMg dGhhdCB0aGV5IGFyZSBub3QgbmVlZGVkIGZvcg0KPiAgICAgc3RhdGljYWxseSBhbGxvY2F0ZWQg cmN1X2hlYWQgc3RydWN0dXJlcy4gIFRoaXMgY29tbWl0IHRoZXJlZm9yZQ0KPiAgICAgZml4ZXMg dGhpcyBjb21tZW50Lg0KPiAgICAgDQo+ICAgICBSZXBvcnRlZC1ieTogQmFydCBWYW4gQXNzY2hl IDxCYXJ0LlZhbkFzc2NoZUB3ZGMuY29tPg0KPiAgICAgU2lnbmVkLW9mZi1ieTogUGF1bCBFLiBN Y0tlbm5leSA8cGF1bG1ja0BsaW51eC52bmV0LmlibS5jb20+DQo+IA0KPiBkaWZmIC0tZ2l0IGEv aW5jbHVkZS9saW51eC9yY3VwZGF0ZS5oIGIvaW5jbHVkZS9saW51eC9yY3VwZGF0ZS5oDQo+IGlu ZGV4IDA0M2QwNDc4NDY3NS4uMzYzNjBkMDdmMjViIDEwMDY0NA0KPiAtLS0gYS9pbmNsdWRlL2xp bnV4L3JjdXBkYXRlLmgNCj4gKysrIGIvaW5jbHVkZS9saW51eC9yY3VwZGF0ZS5oDQo+IEBAIC0y MTQsMTAgKzIxNCwxMiBAQCBkbyB7IFwNCj4gICNlbmRpZg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1X2hlYWQgKmhlYWQpOw0KDQpUaGFua3MhDQoNCkZlZWwgZnJl ZSB0byBhZGQ6DQoNClJldmlld2VkLWJ5OiBCYXJ0IFZhbiBBc3NjaGUgPGJhcnQudmFuYXNzY2hl QHdkYy5jb20+DQoNCg0KDQo=
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Leon Romanovsky
Reviewed-byQuoted 36 lines · Bart Van Assche
Quoted 22 lines · Paul E. McKenney
rcu: Fix
init_rcu_head()comment.The current (and implicit) comment header for
init_rcu_head()anddestroy_rcu_head()incorrectly says that they are not needed for statically allocatedrcu_headstructures. This commit therefore fixes this comment.Reported-by Bart Van Assche <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>include/linux/rcupdate.h +0
-3@@ -214,10 +214,12 @@ do { \#endif /* -* init_rcu_head_on_stack()/destroy_rcu_head_on_stack() are needed for dynamic -* initialization and destruction of rcu_head on the stack. rcu_head structures -* allocated dynamically in the heap or defined statically don't need any include/linux/rcupdate.h do { \ · line 225
Quoted 10 lines
include/linux/rcupdate.h +6
-1-* initialization. +* The init_rcu_head_on_stack() and destroy_rcu_head_on_stack() calls +* are needed for dynamic initialization and destruction of rcu_head +* on the stack, and init_rcu_head()/destroy_rcu_head() are needed for +* dynamic initialization and destruction of statically allocated rcu_head +* structures. However, rcu_head structures allocated dynamically in the +* heap don't need any initialization. */ #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD void init_rcu_head (struct rcu_head *head);Thanks!
Quoted 5 lines
Feel free to add:
Reviewed-by Bart Van Assche <[email protected]>
Paul,
Are you going to send it through your tree?
A message that is not in the archive (sent off-list or not yet received): 20180124064337.GB1393-U/[email protected]
Paul E. McKenney
AppliedQuoted 37 lines · Leon Romanovsky
Quoted 36 lines · Bart Van Assche
Quoted 22 lines · Paul E. McKenney
rcu: Fix
init_rcu_head()comment.The current (and implicit) comment header for
init_rcu_head()anddestroy_rcu_head()incorrectly says that they are not needed for statically allocatedrcu_headstructures. This commit therefore fixes this comment.Reported-by Bart Van Assche <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>include/linux/rcupdate.h +0
-3@@ -214,10 +214,12 @@ do { \#endif /* -* init_rcu_head_on_stack()/destroy_rcu_head_on_stack() are needed for dynamic -* initialization and destruction of rcu_head on the stack. rcu_head structures -* allocated dynamically in the heap or defined statically don't need any include/linux/rcupdate.h do { \ · line 225
Quoted 10 lines
include/linux/rcupdate.h +6
-1-* initialization. +* The init_rcu_head_on_stack() and destroy_rcu_head_on_stack() calls +* are needed for dynamic initialization and destruction of rcu_head +* on the stack, and init_rcu_head()/destroy_rcu_head() are needed for +* dynamic initialization and destruction of statically allocated rcu_head +* structures. However, rcu_head structures allocated dynamically in the +* heap don't need any initialization. */ #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD void init_rcu_head (struct rcu_head *head);Thanks!
Quoted 7 lines
Quoted 3 lines
Feel free to add:
Reviewed-by Bart Van Assche <[email protected]>Paul,
Are you going to send it through your tree?
It is currently queued for v4.17 -- didn't seem horribly urgent.
Quoted 1 line
Applied, thank you!
Thanx, Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html