* [libgpiod][PATCH 0/3] thread-safety doc + Rust modeling
@ 2023-09-28 14:37 Erik Schilling
2023-09-28 14:37 ` [libgpiod][PATCH 1/3] doc: drop unneeded <p> tags Erik Schilling
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Erik Schilling @ 2023-09-28 14:37 UTC (permalink / raw)
To: Linux-GPIO; +Cc: Bartosz Golaszewski, Viresh Kumar, Erik Schilling
This updates the docs with what was discussed in the linked thread.
Then, the Rust bindings are adjusted to match in behaviour.
To: Linux-GPIO <linux-gpio@vger.kernel.org>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://lore.kernel.org/r/CVHO091CC80Y.3KUOSLSOBVL0T@ablu-work
Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
---
Erik Schilling (3):
doc: drop unneeded <p> tags
doc: document thread safety guarantees
bindings: rust: mark all owning types as `Send`
bindings/rust/libgpiod/src/edge_event.rs | 4 ++++
bindings/rust/libgpiod/src/event_buffer.rs | 8 ++++++++
bindings/rust/libgpiod/src/info_event.rs | 4 ++++
bindings/rust/libgpiod/src/line_config.rs | 4 ++++
bindings/rust/libgpiod/src/line_request.rs | 4 ++++
bindings/rust/libgpiod/src/line_settings.rs | 4 ++++
bindings/rust/libgpiod/src/request_config.rs | 4 ++++
include/gpiod.h | 26 +++++++++++++++++++++++---
8 files changed, 55 insertions(+), 3 deletions(-)
---
base-commit: ced90e79217793957b11414f47f8aa8a77c7a2d5
change-id: 20230928-rust-send-trait-316a8f31bb97
Best regards,
--
Erik Schilling <erik.schilling@linaro.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [libgpiod][PATCH 1/3] doc: drop unneeded <p> tags
2023-09-28 14:37 [libgpiod][PATCH 0/3] thread-safety doc + Rust modeling Erik Schilling
@ 2023-09-28 14:37 ` Erik Schilling
2023-09-28 14:37 ` [libgpiod][PATCH 2/3] doc: document thread safety guarantees Erik Schilling
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Erik Schilling @ 2023-09-28 14:37 UTC (permalink / raw)
To: Linux-GPIO; +Cc: Bartosz Golaszewski, Viresh Kumar, Erik Schilling
Even before Doxygen gained Markdown support, empty lines were considered
as paragraphs. Changelogs indicate that this was the case since at least
the doxygen 1.2 series (where I found a mentiond that something around
this behaviour was fixed). So at least works in Doxygen versions
released after 2001 [1].
[1] https://sourceforge.net/p/doxygen/mailman/message/172899/
Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
---
include/gpiod.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/gpiod.h b/include/gpiod.h
index 71ae798..be51c3a 100644
--- a/include/gpiod.h
+++ b/include/gpiod.h
@@ -22,11 +22,11 @@ extern "C" {
* This is the complete documentation of the public API made available to
* users of libgpiod.
*
- * <p>The API is logically split into several sections. For each opaque data
+ * The API is logically split into several sections. For each opaque data
* class, there's a set of functions for manipulating it. Together they can be
* thought of as objects and their methods in OOP parlance.
*
- * <p>General note on error handling: all functions exported by libgpiod that
+ * General note on error handling: all functions exported by libgpiod that
* can fail, set errno to one of the error values defined in errno.h upon
* failure. The way of notifying the caller that an error occurred varies
* between functions, but in general a function that returns an int, returns -1
@@ -35,7 +35,7 @@ extern "C" {
* codes for every function as they propagate errors from the underlying libc
* functions.
*
- * <p>In general libgpiod functions are NULL-aware. For functions that are
+ * In general libgpiod functions are NULL-aware. For functions that are
* logically methods of data classes - ones that take a pointer to the object
* of that class as the first argument - passing a NULL pointer will result in
* the program aborting the execution. For non-methods, init functions and
--
2.41.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [libgpiod][PATCH 2/3] doc: document thread safety guarantees
2023-09-28 14:37 [libgpiod][PATCH 0/3] thread-safety doc + Rust modeling Erik Schilling
2023-09-28 14:37 ` [libgpiod][PATCH 1/3] doc: drop unneeded <p> tags Erik Schilling
@ 2023-09-28 14:37 ` Erik Schilling
2023-09-28 14:37 ` [libgpiod][PATCH 3/3] bindings: rust: mark all owning types as `Send` Erik Schilling
2023-10-02 7:16 ` [libgpiod][PATCH 0/3] thread-safety doc + Rust modeling Bartosz Golaszewski
3 siblings, 0 replies; 10+ messages in thread
From: Erik Schilling @ 2023-09-28 14:37 UTC (permalink / raw)
To: Linux-GPIO; +Cc: Bartosz Golaszewski, Viresh Kumar, Erik Schilling
This mostly adds the information from the linked thread to the doxygen
documentation.
Summarized:
- libgpiod object's require synchronization
- individual objects may be used concurrently by different threds
Link: https://lore.kernel.org/r/CVHO091CC80Y.3KUOSLSOBVL0T@ablu-work
Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
---
include/gpiod.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/include/gpiod.h b/include/gpiod.h
index be51c3a..d86c6ac 100644
--- a/include/gpiod.h
+++ b/include/gpiod.h
@@ -42,6 +42,14 @@ extern "C" {
* methods that take a pointer as any of the subsequent arguments, the handling
* of a NULL-pointer depends on the implementation and may range from gracefully
* handling it, ignoring it or returning an error.
+ *
+ * libgpiod is thread-aware but does not provide any further thread-safety
+ * guarantees. This requires the user to ensure that at most one thread may
+ * work with an object at any time. Sharing objects across threads is allowed
+ * if a suitable synchronization mechanism serializes the access. Different,
+ * standalone objects can safely be used concurrently. Most libgpiod objects
+ * are standalone. Exceptions - such as events allocated in buffers - exist and
+ * are noted in the documentation.
*/
/**
@@ -624,6 +632,12 @@ uint64_t gpiod_info_event_get_timestamp_ns(struct gpiod_info_event *event);
* @return Returns a pointer to the line-info object associated with the event.
* The object lifetime is tied to the event object, so the pointer must
* be not be freed by the caller.
+ * @warning Thread-safety:
+ * Since the line-info object is tied to the event, different threads
+ * may not operate on the event and line-info at the same time. The
+ * line-info can be copied using ::gpiod_line_info_copy in order to
+ * create a standalone object - which then may safely be used from a
+ * different thread concurrently.
*/
struct gpiod_line_info *
gpiod_info_event_get_line_info(struct gpiod_info_event *event);
@@ -1297,6 +1311,12 @@ void gpiod_edge_event_buffer_free(struct gpiod_edge_event_buffer *buffer);
* @return Pointer to an event stored in the buffer. The lifetime of the
* event is tied to the buffer object. Users must not free the event
* returned by this function.
+ * @warning Thread-safety:
+ * Since events are tied to the buffer instance, different threads
+ * may not operate on the buffer and any associated events at the same
+ * time. Events can be copied using ::gpiod_edge_event_copy in order
+ * to create a standalone objects - which each may safely be used from
+ * a different thread concurrently.
*/
struct gpiod_edge_event *
gpiod_edge_event_buffer_get_event(struct gpiod_edge_event_buffer *buffer,
--
2.41.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [libgpiod][PATCH 3/3] bindings: rust: mark all owning types as `Send`
2023-09-28 14:37 [libgpiod][PATCH 0/3] thread-safety doc + Rust modeling Erik Schilling
2023-09-28 14:37 ` [libgpiod][PATCH 1/3] doc: drop unneeded <p> tags Erik Schilling
2023-09-28 14:37 ` [libgpiod][PATCH 2/3] doc: document thread safety guarantees Erik Schilling
@ 2023-09-28 14:37 ` Erik Schilling
2023-09-29 10:58 ` Viresh Kumar
2023-10-02 7:16 ` [libgpiod][PATCH 0/3] thread-safety doc + Rust modeling Bartosz Golaszewski
3 siblings, 1 reply; 10+ messages in thread
From: Erik Schilling @ 2023-09-28 14:37 UTC (permalink / raw)
To: Linux-GPIO; +Cc: Bartosz Golaszewski, Viresh Kumar, Erik Schilling
The thread-safety rules of libgpiod allow individual object instances to
be used from different threads. So far, this was not actually possible
with the Rust bindings. Not being `Send` disallowed the user to transfer
the ownership to different threads.
Rust also has a `Sync` marker. That one would even allow sending
references of objects to other threads. Since we wrap a lot of C
functions with `fn foo(&self)` signatures, that would not be safe.
libgpiod does not allow concurrent API calls to the same object instance
- which Rust would allow for read-only references. Thus, we do not
define that one.
Chip was already modeled correctly.
line::Info is not marked as Send since it may either be owning or non-
owning. That problem is fixed as part of a separate pull request [1].
[1] https://lore.kernel.org/r/20230927-rust-line-info-soundness-v1-0-990dce6f18ab@linaro.org
Link: https://lore.kernel.org/r/CVHO091CC80Y.3KUOSLSOBVL0T@ablu-work
Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
---
bindings/rust/libgpiod/src/edge_event.rs | 4 ++++
bindings/rust/libgpiod/src/event_buffer.rs | 8 ++++++++
bindings/rust/libgpiod/src/info_event.rs | 4 ++++
bindings/rust/libgpiod/src/line_config.rs | 4 ++++
bindings/rust/libgpiod/src/line_request.rs | 4 ++++
bindings/rust/libgpiod/src/line_settings.rs | 4 ++++
bindings/rust/libgpiod/src/request_config.rs | 4 ++++
7 files changed, 32 insertions(+)
diff --git a/bindings/rust/libgpiod/src/edge_event.rs b/bindings/rust/libgpiod/src/edge_event.rs
index 0c0cfbc..639f033 100644
--- a/bindings/rust/libgpiod/src/edge_event.rs
+++ b/bindings/rust/libgpiod/src/edge_event.rs
@@ -24,6 +24,10 @@ use super::{
#[derive(Debug, Eq, PartialEq)]
pub struct Event(*mut gpiod::gpiod_edge_event);
+// SAFETY: Event models a wrapper around an owned gpiod_edge_event and may
+// be safely sent to other threads.
+unsafe impl Send for Event {}
+
impl Event {
pub fn event_clone(event: &Event) -> Result<Event> {
// SAFETY: `gpiod_edge_event` is guaranteed to be valid here.
diff --git a/bindings/rust/libgpiod/src/event_buffer.rs b/bindings/rust/libgpiod/src/event_buffer.rs
index 2e4bfd3..68d6e2f 100644
--- a/bindings/rust/libgpiod/src/event_buffer.rs
+++ b/bindings/rust/libgpiod/src/event_buffer.rs
@@ -68,6 +68,14 @@ pub struct Buffer {
events: Vec<*mut gpiod::gpiod_edge_event>,
}
+// SAFETY: Buffer models an owned gpiod_edge_event_buffer. However, there may
+// be events tied to it. Concurrent access from multiple threads to a buffer
+// and its associated events is not allowed by the C lib.
+// In Rust, those events will always be borrowed from a buffer instance. Thus,
+// either Rust prevents the user to move the Buffer while there are still
+// borrowed events, or we can safely send the the Buffer.
+unsafe impl Send for Buffer {}
+
impl Buffer {
/// Create a new edge event buffer.
///
diff --git a/bindings/rust/libgpiod/src/info_event.rs b/bindings/rust/libgpiod/src/info_event.rs
index db60600..1e26b37 100644
--- a/bindings/rust/libgpiod/src/info_event.rs
+++ b/bindings/rust/libgpiod/src/info_event.rs
@@ -25,6 +25,10 @@ pub struct Event {
pub(crate) event: *mut gpiod::gpiod_info_event,
}
+// SAFETY: Event models a wrapper around an owned gpiod_info_event and may be
+// safely sent to other threads.
+unsafe impl Send for Event {}
+
impl Event {
/// Get a single chip's line's status change event.
pub(crate) fn new(event: *mut gpiod::gpiod_info_event) -> Self {
diff --git a/bindings/rust/libgpiod/src/line_config.rs b/bindings/rust/libgpiod/src/line_config.rs
index f4f03f1..d0a4aba 100644
--- a/bindings/rust/libgpiod/src/line_config.rs
+++ b/bindings/rust/libgpiod/src/line_config.rs
@@ -28,6 +28,10 @@ pub struct Config {
pub(crate) config: *mut gpiod::gpiod_line_config,
}
+// SAFETY: Config models a wrapper around an owned gpiod_line_config and may be
+// safely sent to other threads.
+unsafe impl Send for Config {}
+
impl Config {
/// Create a new line config object.
pub fn new() -> Result<Self> {
diff --git a/bindings/rust/libgpiod/src/line_request.rs b/bindings/rust/libgpiod/src/line_request.rs
index a5697d6..64ef05d 100644
--- a/bindings/rust/libgpiod/src/line_request.rs
+++ b/bindings/rust/libgpiod/src/line_request.rs
@@ -20,6 +20,10 @@ pub struct Request {
pub(crate) request: *mut gpiod::gpiod_line_request,
}
+// SAFETY: Request models a wrapper around an owned gpiod_line_request and may
+// be safely sent to other threads.
+unsafe impl Send for Request {}
+
impl Request {
/// Request a set of lines for exclusive usage.
pub(crate) fn new(request: *mut gpiod::gpiod_line_request) -> Result<Self> {
diff --git a/bindings/rust/libgpiod/src/line_settings.rs b/bindings/rust/libgpiod/src/line_settings.rs
index f0b3e9c..c81d118 100644
--- a/bindings/rust/libgpiod/src/line_settings.rs
+++ b/bindings/rust/libgpiod/src/line_settings.rs
@@ -25,6 +25,10 @@ pub struct Settings {
pub(crate) settings: *mut gpiod::gpiod_line_settings,
}
+// SAFETY: Settings models a wrapper around an owned gpiod_line_settings and may
+// be safely sent to other threads.
+unsafe impl Send for Settings {}
+
impl Settings {
/// Create a new line settings object.
pub fn new() -> Result<Self> {
diff --git a/bindings/rust/libgpiod/src/request_config.rs b/bindings/rust/libgpiod/src/request_config.rs
index 5bde7c6..9b66cc9 100644
--- a/bindings/rust/libgpiod/src/request_config.rs
+++ b/bindings/rust/libgpiod/src/request_config.rs
@@ -20,6 +20,10 @@ pub struct Config {
pub(crate) config: *mut gpiod::gpiod_request_config,
}
+// SAFETY: Config models a wrapper around an owned gpiod_request_config and may
+// be safely sent to other threads.
+unsafe impl Send for Config {}
+
impl Config {
/// Create a new request config object.
pub fn new() -> Result<Self> {
--
2.41.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [libgpiod][PATCH 3/3] bindings: rust: mark all owning types as `Send`
2023-09-28 14:37 ` [libgpiod][PATCH 3/3] bindings: rust: mark all owning types as `Send` Erik Schilling
@ 2023-09-29 10:58 ` Viresh Kumar
2023-09-29 12:45 ` Bartosz Golaszewski
0 siblings, 1 reply; 10+ messages in thread
From: Viresh Kumar @ 2023-09-29 10:58 UTC (permalink / raw)
To: Erik Schilling; +Cc: Linux-GPIO, Bartosz Golaszewski
On 28-09-23, 16:37, Erik Schilling wrote:
> The thread-safety rules of libgpiod allow individual object instances to
> be used from different threads. So far, this was not actually possible
> with the Rust bindings. Not being `Send` disallowed the user to transfer
> the ownership to different threads.
>
> Rust also has a `Sync` marker. That one would even allow sending
> references of objects to other threads. Since we wrap a lot of C
> functions with `fn foo(&self)` signatures, that would not be safe.
> libgpiod does not allow concurrent API calls to the same object instance
> - which Rust would allow for read-only references. Thus, we do not
> define that one.
>
> Chip was already modeled correctly.
>
> line::Info is not marked as Send since it may either be owning or non-
> owning. That problem is fixed as part of a separate pull request [1].
>
> [1] https://lore.kernel.org/r/20230927-rust-line-info-soundness-v1-0-990dce6f18ab@linaro.org
>
> Link: https://lore.kernel.org/r/CVHO091CC80Y.3KUOSLSOBVL0T@ablu-work
> Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
> ---
> bindings/rust/libgpiod/src/edge_event.rs | 4 ++++
> bindings/rust/libgpiod/src/event_buffer.rs | 8 ++++++++
> bindings/rust/libgpiod/src/info_event.rs | 4 ++++
> bindings/rust/libgpiod/src/line_config.rs | 4 ++++
> bindings/rust/libgpiod/src/line_request.rs | 4 ++++
> bindings/rust/libgpiod/src/line_settings.rs | 4 ++++
> bindings/rust/libgpiod/src/request_config.rs | 4 ++++
> 7 files changed, 32 insertions(+)
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [libgpiod][PATCH 3/3] bindings: rust: mark all owning types as `Send`
2023-09-29 10:58 ` Viresh Kumar
@ 2023-09-29 12:45 ` Bartosz Golaszewski
2023-09-29 12:47 ` Erik Schilling
0 siblings, 1 reply; 10+ messages in thread
From: Bartosz Golaszewski @ 2023-09-29 12:45 UTC (permalink / raw)
To: Viresh Kumar; +Cc: Erik Schilling, Linux-GPIO
On Fri, Sep 29, 2023 at 12:58 PM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> On 28-09-23, 16:37, Erik Schilling wrote:
> > The thread-safety rules of libgpiod allow individual object instances to
> > be used from different threads. So far, this was not actually possible
> > with the Rust bindings. Not being `Send` disallowed the user to transfer
> > the ownership to different threads.
> >
> > Rust also has a `Sync` marker. That one would even allow sending
> > references of objects to other threads. Since we wrap a lot of C
> > functions with `fn foo(&self)` signatures, that would not be safe.
> > libgpiod does not allow concurrent API calls to the same object instance
> > - which Rust would allow for read-only references. Thus, we do not
> > define that one.
> >
> > Chip was already modeled correctly.
> >
> > line::Info is not marked as Send since it may either be owning or non-
> > owning. That problem is fixed as part of a separate pull request [1].
> >
> > [1] https://lore.kernel.org/r/20230927-rust-line-info-soundness-v1-0-990dce6f18ab@linaro.org
> >
> > Link: https://lore.kernel.org/r/CVHO091CC80Y.3KUOSLSOBVL0T@ablu-work
> > Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
> > ---
> > bindings/rust/libgpiod/src/edge_event.rs | 4 ++++
> > bindings/rust/libgpiod/src/event_buffer.rs | 8 ++++++++
> > bindings/rust/libgpiod/src/info_event.rs | 4 ++++
> > bindings/rust/libgpiod/src/line_config.rs | 4 ++++
> > bindings/rust/libgpiod/src/line_request.rs | 4 ++++
> > bindings/rust/libgpiod/src/line_settings.rs | 4 ++++
> > bindings/rust/libgpiod/src/request_config.rs | 4 ++++
> > 7 files changed, 32 insertions(+)
>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
>
Thanks, do you have any comments about the other patches in this series?
Bart
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [libgpiod][PATCH 3/3] bindings: rust: mark all owning types as `Send`
2023-09-29 12:45 ` Bartosz Golaszewski
@ 2023-09-29 12:47 ` Erik Schilling
2023-09-29 13:07 ` Bartosz Golaszewski
0 siblings, 1 reply; 10+ messages in thread
From: Erik Schilling @ 2023-09-29 12:47 UTC (permalink / raw)
To: Bartosz Golaszewski, Viresh Kumar; +Cc: Linux-GPIO
On Fri Sep 29, 2023 at 2:45 PM CEST, Bartosz Golaszewski wrote:
> On Fri, Sep 29, 2023 at 12:58 PM Viresh Kumar <viresh.kumar@linaro.org> wrote:
> >
> > On 28-09-23, 16:37, Erik Schilling wrote:
> > > The thread-safety rules of libgpiod allow individual object instances to
> > > be used from different threads. So far, this was not actually possible
> > > with the Rust bindings. Not being `Send` disallowed the user to transfer
> > > the ownership to different threads.
> > >
> > > Rust also has a `Sync` marker. That one would even allow sending
> > > references of objects to other threads. Since we wrap a lot of C
> > > functions with `fn foo(&self)` signatures, that would not be safe.
> > > libgpiod does not allow concurrent API calls to the same object instance
> > > - which Rust would allow for read-only references. Thus, we do not
> > > define that one.
> > >
> > > Chip was already modeled correctly.
> > >
> > > line::Info is not marked as Send since it may either be owning or non-
> > > owning. That problem is fixed as part of a separate pull request [1].
> > >
> > > [1] https://lore.kernel.org/r/20230927-rust-line-info-soundness-v1-0-990dce6f18ab@linaro.org
> > >
> > > Link: https://lore.kernel.org/r/CVHO091CC80Y.3KUOSLSOBVL0T@ablu-work
> > > Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
> > > ---
> > > bindings/rust/libgpiod/src/edge_event.rs | 4 ++++
> > > bindings/rust/libgpiod/src/event_buffer.rs | 8 ++++++++
> > > bindings/rust/libgpiod/src/info_event.rs | 4 ++++
> > > bindings/rust/libgpiod/src/line_config.rs | 4 ++++
> > > bindings/rust/libgpiod/src/line_request.rs | 4 ++++
> > > bindings/rust/libgpiod/src/line_settings.rs | 4 ++++
> > > bindings/rust/libgpiod/src/request_config.rs | 4 ++++
> > > 7 files changed, 32 insertions(+)
> >
> > Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> >
>
> Thanks, do you have any comments about the other patches in this series?
Hm. The others are not Rust-related and mostly try to document our
discussion about thread-safety of the C lib. It would probably be good
if you could double-check that I summarized everything correctly.
- Erik
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [libgpiod][PATCH 3/3] bindings: rust: mark all owning types as `Send`
2023-09-29 12:47 ` Erik Schilling
@ 2023-09-29 13:07 ` Bartosz Golaszewski
0 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2023-09-29 13:07 UTC (permalink / raw)
To: Erik Schilling; +Cc: Viresh Kumar, Linux-GPIO
On Fri, Sep 29, 2023 at 2:47 PM Erik Schilling
<erik.schilling@linaro.org> wrote:
>
> On Fri Sep 29, 2023 at 2:45 PM CEST, Bartosz Golaszewski wrote:
> > On Fri, Sep 29, 2023 at 12:58 PM Viresh Kumar <viresh.kumar@linaro.org> wrote:
> > >
> > > On 28-09-23, 16:37, Erik Schilling wrote:
> > > > The thread-safety rules of libgpiod allow individual object instances to
> > > > be used from different threads. So far, this was not actually possible
> > > > with the Rust bindings. Not being `Send` disallowed the user to transfer
> > > > the ownership to different threads.
> > > >
> > > > Rust also has a `Sync` marker. That one would even allow sending
> > > > references of objects to other threads. Since we wrap a lot of C
> > > > functions with `fn foo(&self)` signatures, that would not be safe.
> > > > libgpiod does not allow concurrent API calls to the same object instance
> > > > - which Rust would allow for read-only references. Thus, we do not
> > > > define that one.
> > > >
> > > > Chip was already modeled correctly.
> > > >
> > > > line::Info is not marked as Send since it may either be owning or non-
> > > > owning. That problem is fixed as part of a separate pull request [1].
> > > >
> > > > [1] https://lore.kernel.org/r/20230927-rust-line-info-soundness-v1-0-990dce6f18ab@linaro.org
> > > >
> > > > Link: https://lore.kernel.org/r/CVHO091CC80Y.3KUOSLSOBVL0T@ablu-work
> > > > Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
> > > > ---
> > > > bindings/rust/libgpiod/src/edge_event.rs | 4 ++++
> > > > bindings/rust/libgpiod/src/event_buffer.rs | 8 ++++++++
> > > > bindings/rust/libgpiod/src/info_event.rs | 4 ++++
> > > > bindings/rust/libgpiod/src/line_config.rs | 4 ++++
> > > > bindings/rust/libgpiod/src/line_request.rs | 4 ++++
> > > > bindings/rust/libgpiod/src/line_settings.rs | 4 ++++
> > > > bindings/rust/libgpiod/src/request_config.rs | 4 ++++
> > > > 7 files changed, 32 insertions(+)
> > >
> > > Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> > >
> >
> > Thanks, do you have any comments about the other patches in this series?
>
> Hm. The others are not Rust-related and mostly try to document our
> discussion about thread-safety of the C lib. It would probably be good
> if you could double-check that I summarized everything correctly.
>
> - Erik
>
Of course they aren't and I should have read them before assuming the
entire series is for rust bindings. :)
Thanks.
Bart
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [libgpiod][PATCH 0/3] thread-safety doc + Rust modeling
2023-09-28 14:37 [libgpiod][PATCH 0/3] thread-safety doc + Rust modeling Erik Schilling
` (2 preceding siblings ...)
2023-09-28 14:37 ` [libgpiod][PATCH 3/3] bindings: rust: mark all owning types as `Send` Erik Schilling
@ 2023-10-02 7:16 ` Bartosz Golaszewski
2023-10-02 7:22 ` Erik Schilling
3 siblings, 1 reply; 10+ messages in thread
From: Bartosz Golaszewski @ 2023-10-02 7:16 UTC (permalink / raw)
To: Erik Schilling; +Cc: Linux-GPIO, Viresh Kumar
On Thu, Sep 28, 2023 at 4:37 PM Erik Schilling
<erik.schilling@linaro.org> wrote:
>
> This updates the docs with what was discussed in the linked thread.
> Then, the Rust bindings are adjusted to match in behaviour.
>
> To: Linux-GPIO <linux-gpio@vger.kernel.org>
> Cc: Bartosz Golaszewski <brgl@bgdev.pl>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
>
> Link: https://lore.kernel.org/r/CVHO091CC80Y.3KUOSLSOBVL0T@ablu-work
> Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
> ---
> Erik Schilling (3):
> doc: drop unneeded <p> tags
> doc: document thread safety guarantees
> bindings: rust: mark all owning types as `Send`
>
> bindings/rust/libgpiod/src/edge_event.rs | 4 ++++
> bindings/rust/libgpiod/src/event_buffer.rs | 8 ++++++++
> bindings/rust/libgpiod/src/info_event.rs | 4 ++++
> bindings/rust/libgpiod/src/line_config.rs | 4 ++++
> bindings/rust/libgpiod/src/line_request.rs | 4 ++++
> bindings/rust/libgpiod/src/line_settings.rs | 4 ++++
> bindings/rust/libgpiod/src/request_config.rs | 4 ++++
> include/gpiod.h | 26 +++++++++++++++++++++++---
> 8 files changed, 55 insertions(+), 3 deletions(-)
> ---
> base-commit: ced90e79217793957b11414f47f8aa8a77c7a2d5
> change-id: 20230928-rust-send-trait-316a8f31bb97
>
> Best regards,
> --
> Erik Schilling <erik.schilling@linaro.org>
>
Series applied, thanks!
Bart
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [libgpiod][PATCH 0/3] thread-safety doc + Rust modeling
2023-10-02 7:16 ` [libgpiod][PATCH 0/3] thread-safety doc + Rust modeling Bartosz Golaszewski
@ 2023-10-02 7:22 ` Erik Schilling
0 siblings, 0 replies; 10+ messages in thread
From: Erik Schilling @ 2023-10-02 7:22 UTC (permalink / raw)
To: Bartosz Golaszewski; +Cc: Linux-GPIO, Viresh Kumar
On Mon Oct 2, 2023 at 9:16 AM CEST, Bartosz Golaszewski wrote:
> On Thu, Sep 28, 2023 at 4:37 PM Erik Schilling
> <erik.schilling@linaro.org> wrote:
> >
> > This updates the docs with what was discussed in the linked thread.
> > Then, the Rust bindings are adjusted to match in behaviour.
> >
> > To: Linux-GPIO <linux-gpio@vger.kernel.org>
> > Cc: Bartosz Golaszewski <brgl@bgdev.pl>
> > Cc: Viresh Kumar <viresh.kumar@linaro.org>
> >
> > Link: https://lore.kernel.org/r/CVHO091CC80Y.3KUOSLSOBVL0T@ablu-work
> > Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
> > ---
> > Erik Schilling (3):
> > doc: drop unneeded <p> tags
> > doc: document thread safety guarantees
> > bindings: rust: mark all owning types as `Send`
> >
> > bindings/rust/libgpiod/src/edge_event.rs | 4 ++++
> > bindings/rust/libgpiod/src/event_buffer.rs | 8 ++++++++
> > bindings/rust/libgpiod/src/info_event.rs | 4 ++++
> > bindings/rust/libgpiod/src/line_config.rs | 4 ++++
> > bindings/rust/libgpiod/src/line_request.rs | 4 ++++
> > bindings/rust/libgpiod/src/line_settings.rs | 4 ++++
> > bindings/rust/libgpiod/src/request_config.rs | 4 ++++
> > include/gpiod.h | 26 +++++++++++++++++++++++---
> > 8 files changed, 55 insertions(+), 3 deletions(-)
> > ---
> > base-commit: ced90e79217793957b11414f47f8aa8a77c7a2d5
> > change-id: 20230928-rust-send-trait-316a8f31bb97
> >
> > Best regards,
> > --
> > Erik Schilling <erik.schilling@linaro.org>
> >
>
> Series applied, thanks!
Thanks for merging and the clarifications!
- Erik
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-10-02 7:22 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-28 14:37 [libgpiod][PATCH 0/3] thread-safety doc + Rust modeling Erik Schilling
2023-09-28 14:37 ` [libgpiod][PATCH 1/3] doc: drop unneeded <p> tags Erik Schilling
2023-09-28 14:37 ` [libgpiod][PATCH 2/3] doc: document thread safety guarantees Erik Schilling
2023-09-28 14:37 ` [libgpiod][PATCH 3/3] bindings: rust: mark all owning types as `Send` Erik Schilling
2023-09-29 10:58 ` Viresh Kumar
2023-09-29 12:45 ` Bartosz Golaszewski
2023-09-29 12:47 ` Erik Schilling
2023-09-29 13:07 ` Bartosz Golaszewski
2023-10-02 7:16 ` [libgpiod][PATCH 0/3] thread-safety doc + Rust modeling Bartosz Golaszewski
2023-10-02 7:22 ` Erik Schilling
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).