From: "Erik Schilling" <erik.schilling@linaro.org>
To: "Bartosz Golaszewski" <brgl@bgdev.pl>,
"Viresh Kumar" <viresh.kumar@linaro.org>
Cc: "Linux-GPIO" <linux-gpio@vger.kernel.org>
Subject: Re: [libgpiod][PATCH 3/3] bindings: rust: mark all owning types as `Send`
Date: Fri, 29 Sep 2023 14:47:41 +0200 [thread overview]
Message-ID: <CVVEV9GFLWN5.1AB912RVJSYUC@ablu-work> (raw)
In-Reply-To: <CAMRc=MeU+yS7L_HguALjoYiw8NHqTWQ1=X5s4OmqnNiqAZmOOQ@mail.gmail.com>
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
next prev parent reply other threads:[~2023-09-29 12:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CVVEV9GFLWN5.1AB912RVJSYUC@ablu-work \
--to=erik.schilling@linaro.org \
--cc=brgl@bgdev.pl \
--cc=linux-gpio@vger.kernel.org \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).