rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Question] import third-party crates in kernel modules
@ 2021-04-26 17:01 Hanqing Zhao
  2021-04-26 18:32 ` Miguel Ojeda
  0 siblings, 1 reply; 9+ messages in thread
From: Hanqing Zhao @ 2021-04-26 17:01 UTC (permalink / raw)
  To: rust-for-linux

Hi, Rust-for-Linux community,

Is it possible to import third-party crates in the kernel modules?
(e.g., crates on crates.io)

Previously, in the linux-kernel-module-rust project,
we can add dependencies in the cargo.toml.
(https://github.com/fishinabarrel/linux-kernel-module-rust/blob/master/hello-world/Cargo.toml)

However, I noticed that all of the cargo's infrastructures have been
removed in the new rust-linux project.

Any suggestions to import crates while writing kernel modules?  TIA.

Best,
Hanqing Zhao
Georgia Tech

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

* Re: [Question] import third-party crates in kernel modules
  2021-04-26 17:01 [Question] import third-party crates in kernel modules Hanqing Zhao
@ 2021-04-26 18:32 ` Miguel Ojeda
  2021-04-26 19:10   ` Hanqing Zhao
  0 siblings, 1 reply; 9+ messages in thread
From: Miguel Ojeda @ 2021-04-26 18:32 UTC (permalink / raw)
  To: Hanqing Zhao; +Cc: rust-for-linux

Hi Hanqing,

On Mon, Apr 26, 2021 at 7:01 PM Hanqing Zhao <ouckarlzhao@gmail.com> wrote:
>
> Is it possible to import third-party crates in the kernel modules?
> (e.g., crates on crates.io)
>
> Any suggestions to import crates while writing kernel modules?  TIA.

Which crates do you need? We may end up importing some things into the
kernel (such as `alloc` and `syn`), but we do not plan to depend on
crates.io (offline or otherwise).

Cheers,
Miguel

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

* Re: [Question] import third-party crates in kernel modules
  2021-04-26 18:32 ` Miguel Ojeda
@ 2021-04-26 19:10   ` Hanqing Zhao
  2021-04-26 20:20     ` Miguel Ojeda
  0 siblings, 1 reply; 9+ messages in thread
From: Hanqing Zhao @ 2021-04-26 19:10 UTC (permalink / raw)
  To: Miguel Ojeda; +Cc: rust-for-linux

Hi Miguel,

I am actually writing a new alloc crate for linux kernel.

I aim to implement it as a cross-platform crate, which can be
used both in kernel and userland.

In general,
I currently have
- a faster lazy_static crate: static_init (https://crates.io/crates/static_init)
- crates for writing cfg easier: cfg_if (https://crates.io/crates/cfg_if)
- rand for random number generation (https://crates.io/crates/rand)
- syn for my heuristic marcos

Because my crate supports userspace as well,
it has some userland dependencies like
libc, winapi, criterion, and bencher (for benchmarking),
even if they won't be compiled for supporting kernel
allocation.

Of course, I can somehow remove those dependencies by replicating
them in my crate though.

Furthermore, I currently have dynamically generated codes in build.rs,
according to cpu numbers, cpu features, etc.

I think it would be better if we can import 3rd-party crates while
developing and testing our own kernel modules,
i.e., we do not need to guarantee that the kernel module having
3rd-party dependencies can become an in-tree module,
but we can compile a .ko that has a 3rd-part dependency
during offline development and testing.

Best,
Hanqing Zhao
Georgia Tech

On Mon, Apr 26, 2021 at 2:32 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> Hi Hanqing,
>
> On Mon, Apr 26, 2021 at 7:01 PM Hanqing Zhao <ouckarlzhao@gmail.com> wrote:
> >
> > Is it possible to import third-party crates in the kernel modules?
> > (e.g., crates on crates.io)
> >
> > Any suggestions to import crates while writing kernel modules?  TIA.
>
> Which crates do you need? We may end up importing some things into the
> kernel (such as `alloc` and `syn`), but we do not plan to depend on
> crates.io (offline or otherwise).
>
> Cheers,
> Miguel

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

* Re: [Question] import third-party crates in kernel modules
  2021-04-26 19:10   ` Hanqing Zhao
@ 2021-04-26 20:20     ` Miguel Ojeda
  2021-04-26 20:41       ` Hanqing Zhao
  2021-04-26 23:54       ` Kajetan Puchalski
  0 siblings, 2 replies; 9+ messages in thread
From: Miguel Ojeda @ 2021-04-26 20:20 UTC (permalink / raw)
  To: Hanqing Zhao; +Cc: rust-for-linux

On Mon, Apr 26, 2021 at 9:10 PM Hanqing Zhao <ouckarlzhao@gmail.com> wrote:
>
> I am actually writing a new alloc crate for linux kernel.

Please note that we are still evaluating how to approach this. The
best way to get involved with high-level design is to join the
meetings.

> I think it would be better if we can import 3rd-party crates while
> developing and testing our own kernel modules,
> i.e., we do not need to guarantee that the kernel module having
> 3rd-party dependencies can become an in-tree module,
> but we can compile a .ko that has a 3rd-part dependency
> during offline development and testing.

We need whatever infrastructure is required to be available for
in-tree modules too (and we need to focus on those first). A lot of
things are missing, indeed, but we will get there!

Meanwhile, perhaps you can manually import them as a workaround -- I
understand that missing functionality can be a bit painful.

Cheers,
Miguel

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

* Re: [Question] import third-party crates in kernel modules
  2021-04-26 20:20     ` Miguel Ojeda
@ 2021-04-26 20:41       ` Hanqing Zhao
  2021-04-26 23:16         ` Miguel Ojeda
  2021-04-27  1:28         ` Wedson Almeida Filho
  2021-04-26 23:54       ` Kajetan Puchalski
  1 sibling, 2 replies; 9+ messages in thread
From: Hanqing Zhao @ 2021-04-26 20:41 UTC (permalink / raw)
  To: Miguel Ojeda; +Cc: rust-for-linux

Sounds good.

I'll manually replicate them tentatively.

After I finish the linux kernel integration, I'll show my
demonstration to the rust-linux community.

Best,
Hanqing Zhao
Georgia Tech

On Mon, Apr 26, 2021 at 4:20 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Mon, Apr 26, 2021 at 9:10 PM Hanqing Zhao <ouckarlzhao@gmail.com> wrote:
> >
> > I am actually writing a new alloc crate for linux kernel.
>
> Please note that we are still evaluating how to approach this. The
> best way to get involved with high-level design is to join the
> meetings.
>
> > I think it would be better if we can import 3rd-party crates while
> > developing and testing our own kernel modules,
> > i.e., we do not need to guarantee that the kernel module having
> > 3rd-party dependencies can become an in-tree module,
> > but we can compile a .ko that has a 3rd-part dependency
> > during offline development and testing.
>
> We need whatever infrastructure is required to be available for
> in-tree modules too (and we need to focus on those first). A lot of
> things are missing, indeed, but we will get there!
>
> Meanwhile, perhaps you can manually import them as a workaround -- I
> understand that missing functionality can be a bit painful.
>
> Cheers,
> Miguel

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

* Re: [Question] import third-party crates in kernel modules
  2021-04-26 20:41       ` Hanqing Zhao
@ 2021-04-26 23:16         ` Miguel Ojeda
  2021-04-27  1:28         ` Wedson Almeida Filho
  1 sibling, 0 replies; 9+ messages in thread
From: Miguel Ojeda @ 2021-04-26 23:16 UTC (permalink / raw)
  To: Hanqing Zhao; +Cc: rust-for-linux

On Mon, Apr 26, 2021 at 10:41 PM Hanqing Zhao <ouckarlzhao@gmail.com> wrote:
>
> After I finish the linux kernel integration, I'll show my
> demonstration to the rust-linux community.

I mentioned the meetings because we have been discussing this topic
for a long while and is usually better to talk about particular
approaches before putting a lot of work just in case we go for another
strategy.

Cheers,
Miguel

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

* Re: [Question] import third-party crates in kernel modules
  2021-04-26 20:20     ` Miguel Ojeda
  2021-04-26 20:41       ` Hanqing Zhao
@ 2021-04-26 23:54       ` Kajetan Puchalski
  2021-04-27  0:36         ` Miguel Ojeda
  1 sibling, 1 reply; 9+ messages in thread
From: Kajetan Puchalski @ 2021-04-26 23:54 UTC (permalink / raw)
  To: Miguel Ojeda; +Cc: rust-for-linux


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

> Please note that we are still evaluating how to approach this. 
> The
> best way to get involved with high-level design is to join the
> meetings.

Hi,
Is there any way someone interested in the project could watch or 
listen to the meetings?
I don't think I have enough knowledge/experience to contribute at 
this point
but I'd definitely like to watch the progress more closely.

--
Kind regards,
Kajetan

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

* Re: [Question] import third-party crates in kernel modules
  2021-04-26 23:54       ` Kajetan Puchalski
@ 2021-04-27  0:36         ` Miguel Ojeda
  0 siblings, 0 replies; 9+ messages in thread
From: Miguel Ojeda @ 2021-04-27  0:36 UTC (permalink / raw)
  To: Kajetan Puchalski; +Cc: rust-for-linux

On Tue, Apr 27, 2021 at 1:54 AM Kajetan Puchalski <mrkajetanp@gmail.com> wrote:
>
> Hi,
> Is there any way someone interested in the project could watch or
> listen to the meetings?
> I don't think I have enough knowledge/experience to contribute at
> this point
> but I'd definitely like to watch the progress more closely.

Yes, feel free to join! We announce the meetings in the mailing list.

Cheers,
Miguel

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

* Re: [Question] import third-party crates in kernel modules
  2021-04-26 20:41       ` Hanqing Zhao
  2021-04-26 23:16         ` Miguel Ojeda
@ 2021-04-27  1:28         ` Wedson Almeida Filho
  1 sibling, 0 replies; 9+ messages in thread
From: Wedson Almeida Filho @ 2021-04-27  1:28 UTC (permalink / raw)
  To: Hanqing Zhao; +Cc: Miguel Ojeda, rust-for-linux

On Mon, Apr 26, 2021 at 04:41:04PM -0400, Hanqing Zhao wrote:
> After I finish the linux kernel integration, I'll show my
> demonstration to the rust-linux community.

Hanqing, Miguel himself is already working on an alloc crate for the kernel. We
discussed this a couple of days ago in the meeting, that's why he's inviting you
to participate there as well.

It is of course fine for more than one person to work on any given aspect and we
are glad that you intend to contribute. But we think we'll be more effective if
we coordinate with others before spending a lot of effort on something -- it'll
also reduce the risk of frustation and I hope better utilise our limited
resources.

Cheers,
-Wedson

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

end of thread, other threads:[~2021-04-27  1:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-26 17:01 [Question] import third-party crates in kernel modules Hanqing Zhao
2021-04-26 18:32 ` Miguel Ojeda
2021-04-26 19:10   ` Hanqing Zhao
2021-04-26 20:20     ` Miguel Ojeda
2021-04-26 20:41       ` Hanqing Zhao
2021-04-26 23:16         ` Miguel Ojeda
2021-04-27  1:28         ` Wedson Almeida Filho
2021-04-26 23:54       ` Kajetan Puchalski
2021-04-27  0:36         ` Miguel Ojeda

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