All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: phasta@kernel.org, "Christoph Hellwig" <hch@lst.de>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
	"Abdiel Janulgue" <abdiel.janulgue@gmail.com>,
	daniel.almeida@collabora.com, aliceryhl@google.com,
	robin.murphy@arm.com, rust-for-linux@vger.kernel.org,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Valentin Obst" <kernel@valentinobst.de>,
	"open list" <linux-kernel@vger.kernel.org>,
	"Marek Szyprowski" <m.szyprowski@samsung.com>,
	airlied@redhat.com,
	"open list:DMA MAPPING HELPERS" <iommu@lists.linux.dev>
Subject: Re: [PATCH v8 2/2] rust: add dma coherent allocator abstraction.
Date: Fri, 31 Jan 2025 09:54:21 -0400	[thread overview]
Message-ID: <20250131135421.GO5556@nvidia.com> (raw)
In-Reply-To: <2025013148-reversal-pessimism-1515@gregkh>

On Fri, Jan 31, 2025 at 08:47:54AM +0100, Greg KH wrote:
> On Thu, Jan 30, 2025 at 01:24:37PM -0400, Jason Gunthorpe wrote:
> > On Thu, Jan 30, 2025 at 05:11:43PM +0100, Greg KH wrote:
> > > On Thu, Jan 30, 2025 at 11:46:46AM -0400, Jason Gunthorpe wrote:
> > > > On Thu, Jan 30, 2025 at 02:19:16PM +0100, Philipp Stanner wrote:
> > > > > would some sort of official statement by the "entire community"
> > > > > reassure you that the burden of keeping Rust abstractions working with
> > > > > any changes on the C side rests entirely on the Rust side's
> > > > > shoulders?
> > > > 
> > > > You'd have to reconcile that with the recent event where Linus defered
> > > > the MM pull request and some C patches were dropped because of rust
> > > > kbuild bugs:
> > > > 
> > > > https://lore.kernel.org/linux-mm/CAHk-=whddBhfi5DUi370W3pYs+z3r2E7KYuHjwR=a1eRig5Gxg@mail.gmail.com/
> > > > 
> > > > It seems to me the message is now crystal clear, and the opposite of
> > > > what you claim.
> > > > 
> > > > All PRs to Linus must not break the rust build and the responsibilty
> > > > for that falls to all the maintainers. If the Rust team is not quick
> > > > enough to resolve any issues during the development window then
> > > > patches must be dropped before sending PRs, or Linus will refuse the
> > > > PR.
> > > > 
> > > > Effectively this seems to imply that patches changing some of the C
> > > > API cannot be merged by maintainers unless accompanied by matching
> > > > Rust hunks.
> > > > 
> > > > If there are different instructions to maintainers I would be
> > > > interested to know.
> > > 
> > > That's not the case, the one you point at above was a tooling issue that
> > > people missed due to the holidays.  Fixing it up was simple enough and
> > > people did so and moved on.
> > 
> > Regardless of holidays, you seem to be saying that Linus should have
> > accepted Andrew's PR and left rust with build failures?
> 
> I can't answer for Linus, sorry.  

Then I think we need a clear statement from Linus how he will be
working. If he is build testing rust or not.

Without that I don't think the Rust team should be saying "any changes
on the C side rests entirely on the Rust side's shoulders".

It is clearly not the process if Linus is build testing rust and
rejecting PRs that fail to build.

> But a generic "hey, this broke our
> working toolchain builds" is something that is much much much different

It broke some builds, it sounded like the typical rust build was not
effected because it used the same version of clang for C code and
bindgen. Linus was mixing gcc and clang in his build.

> than "an api changed so I now have to turn off this driver in my build"
> issue.

I tested this theory, allnoconfig x86 build, enable 64 bit, rust and
PCI only. *NO* Rust drivers enabled.

Make a hypothetical C API change:

       --- a/include/asm-generic/pci_iomap.h
       +++ b/include/asm-generic/pci_iomap.h
       @@ -18,7 +18,7 @@ extern void __iomem *pci_iomap_range(struct pci_dev *dev, int bar,
	extern void __iomem *pci_iomap_wc_range(struct pci_dev *dev, int bar,
					       unsigned long offset,
					       unsigned long maxlen);
       -extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
       +extern void pci_iounmap(struct pci_dev *dev, void __iomem *, unsigned int flags);
	/* Create a virtual mapping cookie for a port on a given PCI device.
	 * Do not call this directly, it exists to make it easier for architectures
	 * to override */
       diff --git a/lib/iomap.c b/lib/iomap.c
       index 4f8b31baa5752a..5b63063a1a811f 100644
       --- a/lib/iomap.c
       +++ b/lib/iomap.c
       @@ -421,7 +421,7 @@ EXPORT_SYMBOL(ioport_unmap);
	#ifdef CONFIG_PCI
	/* Hide the details if this is a MMIO or PIO address space and just do what
	 * you expect in the correct way. */
       -void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
       +void pci_iounmap(struct pci_dev *dev, void __iomem * addr, unsigned int flags)
	{
	       IO_COND(addr, /* nothing */, iounmap(addr));
	}

And the result is..

       error[E0061]: this function takes 3 arguments but 2 arguments were supplied
	  --> ../rust/kernel/pci.rs:320:13
	   |
       320 |             bindings::pci_iounmap(pdev.as_raw(), ioptr as _);
	   |             ^^^^^^^^^^^^^^^^^^^^^--------------------------- an argument of type `u32` is missing
	   |
       note: function defined here
	  --> /tmp/x/build/rust/bindings/bindings_generated.rs:3:1444598
	   |
       3   | ...> * mut ffi :: c_void ; } extern "C" { pub fn pci_iounmap (dev : * mut pci_dev , arg1 : * mut ffi :: c_v...
	   |                                                  ^^^^^^^^^^^
       help: provide the argument
	   |
       320 |             bindings::pci_iounmap(pdev.as_raw(), ioptr as _, /* u32 */);
	   |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Build fails.

Can't seem to fix this using kconfig without turning off CONFIG_RUST,
exactly the same outcome as Uros's case.

Doesn't seem "much much much different" to me.

This shouldn't be surprising. It doesn't work like C. Rust builds the
PCI bindings always once CONFIG_PCI is turned on. It doesn't matter if
no rust driver is being built that consumes those bindings. It won't
work like staging does where you can just turn off one driver.

Jason

  reply	other threads:[~2025-01-31 13:54 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-08 12:27 [PATCH v8 0/2] Add dma coherent allocator abstraction Abdiel Janulgue
2025-01-08 12:27 ` [PATCH v8 1/2] rust: error: Add EOVERFLOW Abdiel Janulgue
2025-01-08 12:27 ` [PATCH v8 2/2] rust: add dma coherent allocator abstraction Abdiel Janulgue
2025-01-08 13:59   ` Christoph Hellwig
2025-01-08 15:16     ` Miguel Ojeda
2025-01-08 15:18       ` Christoph Hellwig
2025-01-08 15:21         ` Danilo Krummrich
2025-01-09  8:08           ` Christoph Hellwig
2025-01-09  8:49             ` Danilo Krummrich
2025-01-10  8:39               ` Christoph Hellwig
2025-01-10 10:41                 ` Danilo Krummrich
2025-01-16 13:17                   ` Danilo Krummrich
2025-01-16 13:57                     ` Robin Murphy
2025-01-16 15:57                       ` Danilo Krummrich
2025-01-17 13:56                         ` Simona Vetter
2025-01-17 19:10                           ` Abdiel Janulgue
2025-01-28 10:14                             ` Daniel Almeida
2025-01-28  9:23                     ` Christoph Hellwig
2025-01-29 21:33                       ` Danilo Krummrich
2025-01-31  7:57                         ` Christoph Hellwig
2025-02-03  8:17                           ` Abdiel Janulgue
2025-02-04  5:29                             ` Christoph Hellwig
2025-01-30 13:19                       ` Philipp Stanner
2025-01-30 13:35                         ` Daniel Almeida
2025-01-30 13:43                           ` Philipp Stanner
2025-01-30 15:46                         ` Jason Gunthorpe
2025-01-30 16:11                           ` Greg KH
2025-01-30 17:24                             ` Jason Gunthorpe
2025-01-31  7:47                               ` Greg KH
2025-01-31 13:54                                 ` Jason Gunthorpe [this message]
2025-02-03 18:46                                   ` Hector Martin
2025-02-03 19:16                                     ` Jason Gunthorpe
2025-02-03 23:41                                       ` Hector Martin
2025-02-03 19:22                                     ` Paolo Bonzini
2025-02-03 23:05                                       ` Hector Martin
2025-02-05 18:52                                     ` On community influencing (was Re: [PATCH v8 2/2] rust: add dma coherent allocator abstraction.) Simona Vetter
2025-02-05 20:36                                       ` Dave Airlie
2025-02-06  9:19                                         ` Hector Martin
2025-02-06 17:58                                           ` Linus Torvalds
2025-02-07 12:16                                             ` Dr. Greg
2025-02-08  4:26                                               ` Steven Rostedt
2025-02-08  4:32                                                 ` Steven Rostedt
2025-02-08  8:31                                                 ` Hector Martin
2025-02-10  9:41                                                   ` Icenowy Zheng
2025-02-10 10:24                                                     ` Danilo Krummrich
2025-02-13  3:49                                                       ` Icenowy Zheng
2025-02-13  6:41                                                         ` Abdiel Janulgue
2025-02-13  9:50                                                           ` Icenowy Zheng
2025-02-13 11:34                                                         ` Danilo Krummrich
2025-02-13 12:26                                                           ` Icenowy Zheng
2025-02-08 20:44                                               ` Theodore Ts'o
2025-02-09  0:47                                                 ` Danilo Krummrich
2025-02-09  3:42                                                 ` comex
2025-02-13 10:20                                                 ` David Airlie
2025-02-20 16:24                                                   ` Simona Vetter
2025-02-20 16:37                                                     ` Jason Gunthorpe
2025-02-20 16:52                                                       ` Jarkko Sakkinen
2025-02-13 19:52                                                 ` Ronja Meyer
2025-02-13 19:22                                             ` 33KK
2025-02-06 19:37                                           ` Danilo Krummrich
2025-02-06 20:16                                             ` Hector Martin
2025-02-07 17:14                                               ` Konstantin Ryabitsev
2025-02-07 18:02                                                 ` Hector Martin
2025-02-07 18:16                                                   ` Konstantin Ryabitsev
2025-02-09  8:25                                                     ` Neal Gompa
2025-02-10 17:28                                                       ` Mark Brown
2025-02-14  7:10                                                         ` Neal Gompa
2025-02-14 19:49                                                           ` Al Viro
2025-02-19 15:03                                                           ` Mark Brown
2025-02-07 18:33                                                   ` Linus Torvalds
2025-02-07 19:18                                                     ` Hector Martin
2025-02-07 18:53                                                   ` Dr. David Alan Gilbert
2025-02-07  9:41                                       ` Hector Martin
2025-02-07 10:20                                         ` Hector Martin
2025-02-07 10:51                                           ` Greg KH
2025-02-07 13:49                                           ` Simona Vetter
2025-02-07 14:54                                             ` Hector Martin
2025-02-10  7:52                                             ` Simona Vetter
2025-02-08 23:55       ` [PATCH v8 2/2] rust: add dma coherent allocator abstraction Carlos Bilbao
2025-02-09  6:44         ` David Airlie
2025-02-09 16:19           ` Carlos Bilbao
2025-02-09 16:28             ` Carlos Bilbao
2025-01-08 18:08   ` Daniel Sedlak
2025-01-08 19:09     ` Daniel Almeida
2025-01-09 11:14       ` Abdiel Janulgue
2025-01-09 11:19         ` Miguel Ojeda
2025-01-09 11:32         ` Miguel Ojeda
2025-01-10  8:07           ` Abdiel Janulgue
2025-01-12  0:41   ` kernel test robot
2025-02-04 16:54   ` Thomas Hampton
2025-02-05  2:41     ` Thomas Hampton
2025-02-10  8:54 ` [PATCH v8 0/2] Add " Pyrex
2025-02-10  9:09   ` Danilo Krummrich

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=20250131135421.GO5556@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=abdiel.janulgue@gmail.com \
    --cc=airlied@redhat.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux.dev \
    --cc=kernel@valentinobst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=phasta@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.