rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alice Ryhl <aliceryhl@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Lyude Paul" <lyude@redhat.com>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	"Benno Lossin" <lossin@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>, "Will Deacon" <will@kernel.org>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Waiman Long" <longman@redhat.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>
Subject: Re: [PATCH v4] rust: lock: Export Guard::do_unlocked()
Date: Fri, 31 Oct 2025 10:24:38 +0000	[thread overview]
Message-ID: <aQSOZu7nN56Uqj6V@google.com> (raw)
In-Reply-To: <288ba4d2-b7db-46cf-b979-341a58613fc0@redhat.com>

On Fri, Oct 31, 2025 at 10:38:32AM +0100, Paolo Bonzini wrote:
> On 10/31/25 10:31, Alice Ryhl wrote:
> > I do agree that this behavior has a lot of potential to surprise
> > users, but I don't think it's incorrect per se. It was done
> > intentionally for Condvar, and it's not unsound. Just surprising.
> 
> Yes, I agree that it is not unsound.`
> 
> For conditional variables, wait() is clearly going to release the mutex to
> wait for someone else so the surprise factor is much less.  Having it return
> a new guard would be closer to std::sync::Condvar::wait, but it'd add churn
> and I'm not sure how much you all care about consistency with std.  std has
> the extra constraint of poisoned locks so it doesn't really have a choice.

I mean, it's not that much different.

	my_method(&mut guard);

might still call Condvar::wait internally, so it can release the lock
today.

Alice

  reply	other threads:[~2025-10-31 10:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-29 18:35 [PATCH v4] rust: lock: Export Guard::do_unlocked() Lyude Paul
2025-10-30 10:43 ` Paolo Bonzini
2025-10-30 17:41   ` Lyude Paul
2025-10-31  9:31     ` Alice Ryhl
2025-10-31  9:38       ` Paolo Bonzini
2025-10-31 10:24         ` Alice Ryhl [this message]
2025-11-05 20:41           ` Lyude Paul

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=aQSOZu7nN56Uqj6V@google.com \
    --to=aliceryhl@google.com \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=lossin@kernel.org \
    --cc=lyude@redhat.com \
    --cc=mingo@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=will@kernel.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).