-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uORB::DeviceNode allocate buffer on advertise #12802
Conversation
2089058
to
3343a2f
Compare
58e7b23
to
ed15a96
Compare
ed15a96
to
9f8b481
Compare
return PX4_ERROR; | ||
} | ||
|
||
// switch to new data | ||
memcpy(data, _data, _meta->o_size * _queue_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Increasing the queue size does not work: due to the generation % _queue_size
logic, a subscriber could access invalid data after this update.
Better keep the existing logic until we move the queue size to the meta-data.
@@ -267,7 +269,7 @@ class uORB::DeviceNode : public cdev::CDev, public ListNode<uORB::DeviceNode *> | |||
const uint8_t _instance; /**< orb multi instance identifier */ | |||
uint8_t *_data{nullptr}; /**< allocated object buffer */ | |||
hrt_abstime _last_update{0}; /**< time the object was last updated */ | |||
volatile unsigned _generation{0}; /**< object generation count */ | |||
unsigned _generation{0}; /**< object generation count */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this atomic? It's accessed concurrently w/o locks.
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
With the updated uORB::Subscription we've eliminated the majority of the unpublished uORB device nodes created from every orb_subscribe. As a result we can allocate the internal buffer immediately (on advertise) and relax the null checks (and interrupt context check).