rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RfL currently does not integrate very well with some Kconfigs
@ 2024-02-15 15:21 Philipp Stanner
  2024-02-15 16:22 ` Miguel Ojeda
  2024-02-16 19:25 ` Andreas Hindborg (Samsung)
  0 siblings, 2 replies; 4+ messages in thread
From: Philipp Stanner @ 2024-02-15 15:21 UTC (permalink / raw)
  To: rust-for-linux

Recently, I've been trying to accomplish some work on the rust-pci
branch in RfL.

I like to base my configs on an allnoconfig to get only the stuff I
really need.

Doing
make LLVM=1 allnoconfig && make LLVM=1 menuconfig
activating only 64-Bit and Rust already generates build-errors, for
example:

error[E0412]: cannot find type `dma_pool` in crate `bindings`
  --> rust/kernel/dma.rs:74:25
   |
74 |     ptr: *mut bindings::dma_pool,
   |                         ^^^^^^^^ not found in `bindings`

error[E0425]: cannot find function `dma_pool_create` in crate
`bindings`
  --> rust/kernel/dma.rs:92:23
   |
92 |             bindings::dma_pool_create(name.as_char_ptr(),
dev.raw_device(), size, align, boundary)
   |                       ^^^^^^^^^^^^^^^ not found in `bindings`

error[E0425]: cannot find function `dma_pool_alloc` in crate `bindings`
   --> rust/kernel/dma.rs:116:38
    |
116 |         let ptr = unsafe { bindings::dma_pool_alloc(self.ptr,
flags, &mut dma_handle) };
    |                                      ^^^^^^^^^^^^^^ not found in
`bindings`

error[E0412]: cannot find type `dma_pool` in crate `bindings`
   --> rust/kernel/dma.rs:136:42
    |
136 |     type AllocationData = *mut bindings::dma_pool;
    |                                          ^^^^^^^^ not found in
`bindings`



Switching on PCI, but not PCI's MSI, causes other errors, such as:

  RUSTC L rust/uapi.o
  EXPORTS rust/exports_alloc_generated.h
  EXPORTS rust/exports_bindings_generated.h
  RUSTC L rust/kernel.o
error[E0425]: cannot find function `pci_alloc_irq_vectors_affinity` in
crate `bindings`
   --> rust/kernel/pci.rs:289:23
    |
289 |             bindings::pci_alloc_irq_vectors_affinity(
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in
`bindings`

Strong suspect for the cause is that this function is defined as part
of MSI, so just activating PCI doesn't suffice.

I verified that this is indeed a config problem. The entire toolchain
is installed according to the official documentation, selecting that
one compiler version that currently works etc.

Setting PCI + MSI (and, in Hacking, Rust Hacking -> Allow unoptimized
build-time assertations) results in a valid build.


So, it would seem there are some "deponds on" entries missing
somewhere.
Is this problem known? Any plans or suggestions how to deal with it?

My instinct tells me that there could be many potentially broken
configs out there.


Regards,
P.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RfL currently does not integrate very well with some Kconfigs
  2024-02-15 15:21 RfL currently does not integrate very well with some Kconfigs Philipp Stanner
@ 2024-02-15 16:22 ` Miguel Ojeda
  2024-02-15 17:29   ` Andreas Hindborg (Samsung)
  2024-02-16 19:25 ` Andreas Hindborg (Samsung)
  1 sibling, 1 reply; 4+ messages in thread
From: Miguel Ojeda @ 2024-02-15 16:22 UTC (permalink / raw)
  To: Philipp Stanner; +Cc: rust-for-linux, Andreas Hindborg

On Thu, Feb 15, 2024 at 4:24 PM Philipp Stanner <pstanner@redhat.com> wrote:
>
> Recently, I've been trying to accomplish some work on the rust-pci
> branch in RfL.

For the `rust-pci` branch, please create issues in GitHub, ask in
Zulip and/or contact Andreas through Zulip like the website mentions.
It is not code ready for upstreaming. Please see:

    https://rust-for-linux.com/branches#rust-pci
    https://github.com/Rust-for-Linux/linux/blob/rust-pci/README

> So, it would seem there are some "deponds on" entries missing
> somewhere.

It sounds to me like there are missing `#[cfg(...)]`s in the code
(i.e. conditional compilation), rather than missing `depends on`.

> Is this problem known? Any plans or suggestions how to deal with it?

If you mean the specific issue, Andreas may or may not know already
about that one, but the suggestion would be to simply add the missing
`cfg`s -- I think Andreas would welcome a PR.

Thanks for the report!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RfL currently does not integrate very well with some Kconfigs
  2024-02-15 16:22 ` Miguel Ojeda
@ 2024-02-15 17:29   ` Andreas Hindborg (Samsung)
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Hindborg (Samsung) @ 2024-02-15 17:29 UTC (permalink / raw)
  To: Philipp Stanner; +Cc: Miguel Ojeda, rust-for-linux


Hi Philipp,

Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> writes:

> On Thu, Feb 15, 2024 at 4:24 PM Philipp Stanner <pstanner@redhat.com> wrote:
>>
>> Recently, I've been trying to accomplish some work on the rust-pci
>> branch in RfL.
>
> For the `rust-pci` branch, please create issues in GitHub, ask in
> Zulip and/or contact Andreas through Zulip like the website mentions.
> It is not code ready for upstreaming. Please see:
>
>     https://rust-for-linux.com/branches#rust-pci
>     https://github.com/Rust-for-Linux/linux/blob/rust-pci/README
>
>> So, it would seem there are some "deponds on" entries missing
>> somewhere.
>
> It sounds to me like there are missing `#[cfg(...)]`s in the code
> (i.e. conditional compilation), rather than missing `depends on`.

It is likely. The code is only tested with the NVMe driver. It is not
polished at all.

If you find an issue and fix it I would apply your patch to the rust-pci
branch. You can also send me error description and I will try to help
solve the issue. Email or Github issue is fine with me.

>> Is this problem known? Any plans or suggestions how to deal with it?

I am aware that there must be issues, but I am not aware of specific
issues. Again, patches or bug reports are welcome.

Best regards,
Andreas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RfL currently does not integrate very well with some Kconfigs
  2024-02-15 15:21 RfL currently does not integrate very well with some Kconfigs Philipp Stanner
  2024-02-15 16:22 ` Miguel Ojeda
@ 2024-02-16 19:25 ` Andreas Hindborg (Samsung)
  1 sibling, 0 replies; 4+ messages in thread
From: Andreas Hindborg (Samsung) @ 2024-02-16 19:25 UTC (permalink / raw)
  To: Philipp Stanner; +Cc: rust-for-linux


Philipp Stanner <pstanner@redhat.com> writes:


<snip>

>
> Strong suspect for the cause is that this function is defined as part
> of MSI, so just activating PCI doesn't suffice.
>
> I verified that this is indeed a config problem. The entire toolchain
> is installed according to the official documentation, selecting that
> one compiler version that currently works etc.
>
> Setting PCI + MSI (and, in Hacking, Rust Hacking -> Allow unoptimized
> build-time assertations) results in a valid build.
>
>
> So, it would seem there are some "deponds on" entries missing
> somewhere.
> Is this problem known? Any plans or suggestions how to deal with it?
>
> My instinct tells me that there could be many potentially broken
> configs out there.

Thanks for reporting. I think it is fixed now.

BR Andreas


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-16 19:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-15 15:21 RfL currently does not integrate very well with some Kconfigs Philipp Stanner
2024-02-15 16:22 ` Miguel Ojeda
2024-02-15 17:29   ` Andreas Hindborg (Samsung)
2024-02-16 19:25 ` Andreas Hindborg (Samsung)

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).