mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Probst <markus.probst@posteo.de>
To: "Andreas Hindborg" <a.hindborg@kernel.org>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Lorenzo Stoakes" <ljs@kernel.org>,
	"Vlastimil Babka" <vbabka@kernel.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	"Uladzislau Rezki" <urezki@gmail.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Onur Özkan" <work@onurozkan.dev>,
	"Lyude Paul" <lyude@redhat.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Christian Brauner" <brauner@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Dave Ertman" <david.m.ertman@intel.com>,
	"Leon Romanovsky" <leon@kernel.org>,
	"Paul Moore" <paul@paul-moore.com>,
	"Serge Hallyn" <sergeh@kernel.org>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Jan Kara" <jack@suse.cz>,
	"Igor Korotin" <igor.korotin@linux.dev>,
	"Viresh Kumar" <vireshk@kernel.org>, "Nishanth Menon" <nm@ti.com>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Pavel Tikhomirov" <ptikhomirov@virtuozzo.com>,
	"Michal Wilczynski" <m.wilczynski@samsung.com>,
	"Ira Weiny" <iweiny@kernel.org>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Johan Hovold" <johan@kernel.org>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Christian König" <christian.koenig@amd.com>,
	"Dave Jiang" <dave.jiang@intel.com>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Saeed Mahameed" <saeedm@nvidia.com>,
	"Zhi Wang" <zhiw@nvidia.com>,
	"Jonathan Cameron" <jic23@kernel.org>
Cc: "Philipp Stanner" <phasta@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, driver-core@lists.linux.dev,
	linux-block@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-fsdevel@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-pwm@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org,
	linux-serial@vger.kernel.org,
	"Oliver Mangold" <oliver.mangold@pm.me>,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	"Uwe Kleine-König" <ukleinek@kernel.org>
Subject: Re: [PATCH v22 4/5] rust: rename `AlwaysRefCounted` to `RefCounted`
Date: Fri, 20 Nov 2026 13:41:05 +0000	[thread overview]
Message-ID: <e4c77581b1c09f8e0c8be570283f653a2a7e2147.camel@posteo.de> (raw)
In-Reply-To: <20261116-unique-ref-v22-4-12029383206d@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1809 bytes --]

On Mon, 2026-11-16 at 15:21 +0100, Andreas Hindborg wrote:
> From: Oliver Mangold <oliver.mangold@pm.me>
> 
> There are types where it may both be reference counted in some cases and
> owned in others. For such types, obtaining an `ARef<T>` from a `&T` may be
> unsound, as it allows creation of an `ARef<T>` from a `&Owned<T>`.
> 
> Therefore, we split `AlwaysRefCounted` into `RefCounted` (which `ARef<T>`
> would require) and a marker trait to indicate that the `&T` -> `ARef<T>`
> conversion is sound for the type. A type that implements `Ownable` may
> only implement the marker trait if it allows an `ARef<T>` to exist
> together with an `Owned<T>`.
> 
> - Rename `AlwaysRefCounted` to `RefCounted`.
> - Add a new unsafe trait `AlwaysRefCounted`.
> - Implement the new trait `AlwaysRefCounted` for the newly renamed
>   `RefCounted` implementations. This leaves functionality of existing
>   implementers of `AlwaysRefCounted` intact.
> 
> Suggested-by: Alice Ryhl <aliceryhl@google.com>
> Signed-off-by: Oliver Mangold <oliver.mangold@pm.me>
> [ Andreas: Updated commit message, rebased on v7.4-rc2, converted new
>   implementers, relaxed the `ForeignOwnable` bound for `ARef<T>`, updated
>   safety comments. ]
> Acked-by: Igor Korotin <igor.korotin.linux@gmail.com>
> Acked-by: Danilo Krummrich <dakr@kernel.org>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> Co-developed-by: Andreas Hindborg <a.hindborg@kernel.org>
> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
> Acked-by: Uwe Kleine-König <ukleinek@kernel.org> # for pwm.rs

I haven't unterstood yet what use case this has, so I am trusting the
other ACKs here. Maybe a precise example would help?

For serdev:

Acked-by: Markus Probst <markus.probst@posteo.de>

Thanks
- Markus Probst

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 870 bytes --]

  parent reply	other threads:[~2026-11-20 13:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 14:20 [PATCH v22 0/5] rust: add `Ownable` trait and `Owned` type Andreas Hindborg
2026-11-16 14:20 ` [PATCH v22 1/5] rust: alloc: add `KBox::into_non_null` Andreas Hindborg
2026-11-16 14:20 ` [PATCH v22 2/5] rust: types: Add Ownable/Owned types Andreas Hindborg
2026-11-16 14:21 ` [PATCH v22 3/5] rust: implement `ForeignOwnable` for `Owned` Andreas Hindborg
2026-11-16 14:21 ` [PATCH v22 4/5] rust: rename `AlwaysRefCounted` to `RefCounted` Andreas Hindborg
2026-11-20 12:00   ` Christian Brauner
2026-11-20 13:41   ` Markus Probst [this message]
2026-11-16 14:21 ` [PATCH v22 5/5] rust: Add `OwnableIntoShared` and `OwnableTryFromShared` Andreas Hindborg

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=e4c77581b1c09f8e0c8be570283f653a2a7e2147.camel@posteo.de \
    --to=markus.probst@posteo.de \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bhelgaas@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=brauner@kernel.org \
    --cc=christian.koenig@amd.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dave.jiang@intel.com \
    --cc=david.m.ertman@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=igor.korotin@linux.dev \
    --cc=iweiny@kernel.org \
    --cc=jack@suse.cz \
    --cc=jgg@ziepe.ca \
    --cc=jic23@kernel.org \
    --cc=johan@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=leon@kernel.org \
    --cc=liam@infradead.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=lossin@kernel.org \
    --cc=lyude@redhat.com \
    --cc=m.wilczynski@samsung.com \
    --cc=matthew.brost@intel.com \
    --cc=nm@ti.com \
    --cc=ojeda@kernel.org \
    --cc=oliver.mangold@pm.me \
    --cc=paul@paul-moore.com \
    --cc=phasta@kernel.org \
    --cc=ptikhomirov@virtuozzo.com \
    --cc=rafael@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=sboyd@kernel.org \
    --cc=sergeh@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=sumit.semwal@linaro.org \
    --cc=tamird@kernel.org \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tmgross@umich.edu \
    --cc=ukleinek@kernel.org \
    --cc=urezki@gmail.com \
    --cc=vbabka@kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=vireshk@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=work@onurozkan.dev \
    --cc=zhiw@nvidia.com \
    /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

all inboxes | Powered by JetHome®