*Linux kernel in-tree Rust support
@ 2020-07-09 18:41 Nick Desaulniers
2020-07-09 20:52 ` Miguel Ojeda
` (2 more replies)0 siblings, 3 replies; 9+ messages in thread
From: Nick Desaulniers @ 2020-07-09 18:41 UTC (permalink / raw)
To: alex.gaynor, geofft, jbaublitz, Masahiro Yamada, Linus Torvalds,
Greg KH, Miguel Ojeda, Josh Triplett
Cc: Steven Rostedt, LKML, clang-built-linux
Hello folks,
I’m working on putting together an LLVM “Micro Conference” for the
upcoming Linux Plumbers Conf
(https://www.linuxplumbersconf.org/event/7/page/47-attend). It’s not
solidified yet, but I would really like to run a session on support
for Rust “in tree.” I suspect we could cover technical aspects of
what that might look like (I have a prototype of that, was trivial to
wire up KBuild support), but also a larger question of “should we do
this?” or “how might we place limits on where this can be used?”
Question to folks explicitly in To:, are you planning on attending plumbers?
If so, would this be an interesting topic that you’d participate in?

Thanks,
~Nick Desaulniers
^permalinkrawreply[flat|nested] 9+ messages in thread
*Re: Linux kernel in-tree Rust support
2020-07-09 18:41 Linux kernel in-tree Rust support Nick Desaulniers
@ 2020-07-09 20:52 ` Miguel Ojeda
2020-07-10 5:36 ` Josh Triplett
2020-07-10 6:28 ` Greg KH2 siblings, 0 replies; 9+ messages in thread
From: Miguel Ojeda @ 2020-07-09 20:52 UTC (permalink / raw)
To: Nick Desaulniers
Cc: alex.gaynor, geofft, jbaublitz, Masahiro Yamada, Linus Torvalds,
Greg KH, Josh Triplett, Steven Rostedt, LKML, clang-built-linux
Hi Nick,
On Thu, Jul 9, 2020 at 8:42 PM Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> Hello folks,
> I’m working on putting together an LLVM “Micro Conference” for the
> upcoming Linux Plumbers Conf
> (https://www.linuxplumbersconf.org/event/7/page/47-attend). It’s not
> solidified yet, but I would really like to run a session on support
> for Rust “in tree.” I suspect we could cover technical aspects of
> what that might look like (I have a prototype of that, was trivial to
Agreed, I wrote one ~half a year ago that compiled TUs through rustc
mimicking what we do with cc to some degree (i.e. no cargo etc.), and
it was quite pleasant.
> wire up KBuild support), but also a larger question of “should we do
> this?” or “how might we place limits on where this can be used?”
Indeed, I would say that is going to be the major topic, not so much
the technical bits.
> Question to folks explicitly in To:, are you planning on attending plumbers?
I wasn’t, but it definitely is an interesting topic that I wouldn’t
want to miss!
Cheers,
Miguel
^permalinkrawreply[flat|nested] 9+ messages in thread
*Re: Linux kernel in-tree Rust support
2020-07-09 18:41 Linux kernel in-tree Rust support Nick Desaulniers
2020-07-09 20:52 ` Miguel Ojeda@ 2020-07-10 5:36 ` Josh Triplett
2020-07-10 6:28 ` Greg KH2 siblings, 0 replies; 9+ messages in thread
From: Josh Triplett @ 2020-07-10 5:36 UTC (permalink / raw)
To: Nick Desaulniers
Cc: alex.gaynor, geofft, jbaublitz, Masahiro Yamada, Linus Torvalds,
Greg KH, Miguel Ojeda, Steven Rostedt, LKML, clang-built-linux
On Thu, Jul 09, 2020 at 11:41:47AM -0700, Nick Desaulniers wrote:
> Hello folks,
> I’m working on putting together an LLVM “Micro Conference” for the
> upcoming Linux Plumbers Conf
> (https://www.linuxplumbersconf.org/event/7/page/47-attend). It’s not
> solidified yet, but I would really like to run a session on support
> for Rust “in tree.” I suspect we could cover technical aspects of
> what that might look like (I have a prototype of that, was trivial to
> wire up KBuild support), but also a larger question of “should we do
> this?” or “how might we place limits on where this can be used?”
>
> Question to folks explicitly in To:, are you planning on attending plumbers?
>
> If so, would this be an interesting topic that you’d participate in?
I hadn’t planned to attend the virtual event, but this sounds like a
topic I absolutely have to attend. Please follow up if this proposal
gets accepted.
I’d love to see a path to incorporating Rust into the kernel, as long as
we can ensure that:
– There are appropriate Rustic interfaces that are natural and safe to
use (not just C FFI, and not *just* trivial transformations like
slices instead of buffer+len pairs).
– Those Rustic interfaces are easy to maintain and evolve with the kernel.
– We provide compelling use cases that go beyond just basic safety, such
as concurrency checking, or lifetimes for object ownership.
– We make Rust fit naturally into the kernel’s norms and standards,
while also introducing some of Rust’s norms and standards where they
make sense. (We want to fit into the kernel, and at the same time, we
don’t want to hastily saw off all the corners that don’t immediately
fit, because some of those corners provide value. Let’s take our
time.)
– We move slowly and carefully, making sure it’s a gradual introduction,
and give people time to incorporate the Rust toolchain into their
kernel workflows.
Also, with my “Rust language team lead” hat on, I’d be happy to have the
Linux kernel feeding into Rust language development priorities. If
building Rustic interfaces within the kernel requires some additional
language features, we should see what enhancements to the language would
best serve those requirements. I’ve often seen the sentiment that
co-evolving Linux and a C compiler would be beneficial for both; I think
the same would be true of Linux and the Rust compiler.
^permalinkrawreply[flat|nested] 9+ messages in thread
*Re: Linux kernel in-tree Rust support
2020-07-09 18:41 Linux kernel in-tree Rust support Nick Desaulniers
2020-07-09 20:52 ` Miguel Ojeda
2020-07-10 5:36 ` Josh Triplett@ 2020-07-10 6:28 ` Greg KH
2020-07-10 12:50 ` Christian Brauner2 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2020-07-10 6:28 UTC (permalink / raw)
To: Nick Desaulniers
Cc: alex.gaynor, geofft, jbaublitz, Masahiro Yamada, Linus Torvalds,
Miguel Ojeda, Josh Triplett, Steven Rostedt, LKML,
clang-built-linux
On Thu, Jul 09, 2020 at 11:41:47AM -0700, Nick Desaulniers wrote:
> Hello folks,
> I’m working on putting together an LLVM “Micro Conference” for the
> upcoming Linux Plumbers Conf
> (https://www.linuxplumbersconf.org/event/7/page/47-attend). It’s not
> solidified yet, but I would really like to run a session on support
> for Rust “in tree.” I suspect we could cover technical aspects of
> what that might look like (I have a prototype of that, was trivial to
> wire up KBuild support), but also a larger question of “should we do
> this?” or “how might we place limits on where this can be used?”
>
> Question to folks explicitly in To:, are you planning on attending plumbers?
>
> If so, would this be an interesting topic that you’d participate in?
Yes, I’ll be there.
thanks,
greg k-h
^permalinkrawreply[flat|nested] 9+ messages in thread
*Re: Linux kernel in-tree Rust support
2020-07-10 6:28 ` Greg KH@ 2020-07-10 12:50 ` Christian Brauner
2020-07-10 16:10 ` Kees Cook
2020-07-10 22:59 ` Josh Triplett0 siblings, 2 replies; 9+ messages in thread
From: Christian Brauner @ 2020-07-10 12:50 UTC (permalink / raw)
To: Nick Desaulniers
Cc: alex.gaynor, Greg KH, geofft, jbaublitz, Masahiro Yamada,
Linus Torvalds, Miguel Ojeda, Josh Triplett, Steven Rostedt,
LKML, clang-built-linux, keescook
On Fri, Jul 10, 2020 at 08:28:03AM +0200, Greg KH wrote:
> On Thu, Jul 09, 2020 at 11:41:47AM -0700, Nick Desaulniers wrote:
> > Hello folks,
> > I’m working on putting together an LLVM “Micro Conference” for the
> > upcoming Linux Plumbers Conf
> > (https://www.linuxplumbersconf.org/event/7/page/47-attend). It’s not
> > solidified yet, but I would really like to run a session on support
> > for Rust “in tree.” I suspect we could cover technical aspects of
> > what that might look like (I have a prototype of that, was trivial to
> > wire up KBuild support), but also a larger question of “should we do
> > this?” or “how might we place limits on where this can be used?”
> >
> > Question to folks explicitly in To:, are you planning on attending plumbers?
> >
> > If so, would this be an interesting topic that you’d participate in?
>
> Yes, I’ll be there.
We actually had this dicussion a while back and there were some more
people interested in this. I’d be interested to attend this and I’ve
spoken with Kees and a few others about this topic at last Plumbers (I
think Greg might have been around for this informal discussion as well.
But I might be imagining things.).
Christian
^permalinkrawreply[flat|nested] 9+ messages in thread
*Re: Linux kernel in-tree Rust support
2020-07-10 12:50 ` Christian Brauner@ 2020-07-10 16:10 ` Kees Cook
[not found] ` <CAFRnB2WNo45J8h3-ncopLKENvcO0rf7J3xsy_eRKwFSpDD-5sQ@mail.gmail.com>
2020-07-10 22:59 ` Josh Triplett1 sibling, 1 reply; 9+ messages in thread
From: Kees Cook @ 2020-07-10 16:10 UTC (permalink / raw)
To: Christian Brauner
Cc: Nick Desaulniers, alex.gaynor, Greg KH, geofft, jbaublitz,
Masahiro Yamada, Linus Torvalds, Miguel Ojeda, Josh Triplett,
Steven Rostedt, LKML, clang-built-linux
On Fri, Jul 10, 2020 at 02:50:22PM +0200, Christian Brauner wrote:
> On Fri, Jul 10, 2020 at 08:28:03AM +0200, Greg KH wrote:
> > On Thu, Jul 09, 2020 at 11:41:47AM -0700, Nick Desaulniers wrote:
> > > Hello folks,
> > > I’m working on putting together an LLVM “Micro Conference” for the
> > > upcoming Linux Plumbers Conf
> > > (https://www.linuxplumbersconf.org/event/7/page/47-attend). It’s not
> > > solidified yet, but I would really like to run a session on support
> > > for Rust “in tree.” I suspect we could cover technical aspects of
> > > what that might look like (I have a prototype of that, was trivial to
> > > wire up KBuild support), but also a larger question of “should we do
> > > this?” or “how might we place limits on where this can be used?”
> > >
> > > Question to folks explicitly in To:, are you planning on attending plumbers?
> > >
> > > If so, would this be an interesting topic that you’d participate in?
> >
> > Yes, I’ll be there.
>
> We actually had this dicussion a while back and there were some more
> people interested in this. I’d be interested to attend this and I’ve
> spoken with Kees and a few others about this topic at last Plumbers (I
> think Greg might have been around for this informal discussion as well.
> But I might be imagining things.).
I’m quite interested in this topic still, yes. 🙂 (And will be attending
Plumbers.)
We had interesting discussions with the LSS 2019 “Rust in the kernel”[1]
speakers, and I know Nick has reviewed their work[2] too. Perhaps we should
reach out to them as well?
-Kees
[1] https://ldpreload.com/p/kernel-modules-in-rust-lssna2019.pdf
[2] https://github.com/fishinabarrel/linux-kernel-module-rust

Kees Cook
^permalinkrawreply[flat|nested] 9+ messages in thread
*Re: Linux kernel in-tree Rust support
2020-07-10 12:50 ` Christian Brauner
2020-07-10 16:10 ` Kees Cook@ 2020-07-10 22:59 ` Josh Triplett
2020-07-10 23:54 ` Linus Torvalds1 sibling, 1 reply; 9+ messages in thread
From: Josh Triplett @ 2020-07-10 22:59 UTC (permalink / raw)
To: Christian Brauner
Cc: Nick Desaulniers, alex.gaynor, Greg KH, geofft, jbaublitz,
Masahiro Yamada, Linus Torvalds, Miguel Ojeda, Steven Rostedt,
LKML, clang-built-linux, keescook
On Fri, Jul 10, 2020 at 02:50:22PM +0200, Christian Brauner wrote:
> On Fri, Jul 10, 2020 at 08:28:03AM +0200, Greg KH wrote:
> > On Thu, Jul 09, 2020 at 11:41:47AM -0700, Nick Desaulniers wrote:
> > > Hello folks,
> > > I’m working on putting together an LLVM “Micro Conference” for the
> > > upcoming Linux Plumbers Conf
> > > (https://www.linuxplumbersconf.org/event/7/page/47-attend). It’s not
> > > solidified yet, but I would really like to run a session on support
> > > for Rust “in tree.” I suspect we could cover technical aspects of
> > > what that might look like (I have a prototype of that, was trivial to
> > > wire up KBuild support), but also a larger question of “should we do
> > > this?” or “how might we place limits on where this can be used?”
> > >
> > > Question to folks explicitly in To:, are you planning on attending plumbers?
> > >
> > > If so, would this be an interesting topic that you’d participate in?
> >
> > Yes, I’ll be there.
>
> We actually had this dicussion a while back and there were some more
> people interested in this. I’d be interested to attend this and I’ve
> spoken with Kees and a few others about this topic at last Plumbers (I
> think Greg might have been around for this informal discussion as well.
> But I might be imagining things.).
I was around for one of the informal conversations with Greg and Kees
and others.
As I recall, Greg’s biggest condition for initial introduction of this
was to do the same kind of “turn this Kconfig option on and turn an
option under it off” trick that LTO uses, so that neither “make
allnoconfig” nor “make allyesconfig” would require Rust until we’ve had
plenty of time to experiment with it. And that seems entirely
reasonable to me too.
– Josh
^permalinkrawreply[flat|nested] 9+ messages in thread
*Re: Linux kernel in-tree Rust support
[not found] ` <CAFRnB2WNo45J8h3-ncopLKENvcO0rf7J3xsy_eRKwFSpDD-5sQ@mail.gmail.com>
@ 2020-07-10 23:05 ` Kees Cook0 siblings, 0 replies; 9+ messages in thread
From: Kees Cook @ 2020-07-10 23:05 UTC (permalink / raw)
To: Alex Gaynor
Cc: Christian Brauner, Nick Desaulniers, Greg KH, Geoffrey Thomas,
jbaublitz, Masahiro Yamada, Linus Torvalds, Miguel Ojeda,
Josh Triplett, Steven Rostedt, LKML, clang-built-linux
On Fri, Jul 10, 2020 at 12:28:30PM -0400, Alex Gaynor wrote:
> :wave:,
>
> Hey Kees, that’s Geoffrey Thomas and I, we’re both on this thread 🙂
*face palm* Hello! I swear I can read. Though perhaps not well enough
before lunch. 🙂

Kees Cook
^permalinkrawreply[flat|nested] 9+ messages in thread
*Re: Linux kernel in-tree Rust support
2020-07-10 22:59 ` Josh Triplett@ 2020-07-10 23:54 ` Linus Torvalds0 siblings, 0 replies; 9+ messages in thread
From: Linus Torvalds @ 2020-07-10 23:54 UTC (permalink / raw)
To: Josh Triplett
Cc: Christian Brauner, Nick Desaulniers, alex.gaynor, Greg KH,
geofft, jbaublitz, Masahiro Yamada, Miguel Ojeda, Steven Rostedt,
LKML, clang-built-linux, Kees Cook
On Fri, Jul 10, 2020 at 3:59 PM Josh Triplett <josh@joshtriplett.org> wrote:
>
> As I recall, Greg’s biggest condition for initial introduction of this
> was to do the same kind of “turn this Kconfig option on and turn an
> option under it off” trick that LTO uses, so that neither “make
> allnoconfig” nor “make allyesconfig” would require Rust until we’ve had
> plenty of time to experiment with it.
No, please make it a “is rust available” automatic config option. The
exact same way we already do the compiler versions and check for
various availability of compiler flags at config time.
See init/Kconfig for things like
config LD_IS_LLD
def_bool $(success,$(LD) -v | head -n 1 | grep -q LLD)
and the rust support should be similar. Something like
config RUST_IS_AVAILABLE
def_bool $(success,$(RUST) ..sometest..)
because I _don’t_ want us to be in the situation where any new rust
support isn’t even build-tested by default.
Quite the reverse. I’d want the first rust driver (or whatever) to be
introduced in such a simple format that failures will be obvious and
simple.
The _worst_ situation to be in is that s (small) group of people start
testing their very special situation, and do bad and crazy things
because “nobody else cares, it’s hidden”.
No, thank you.
Linus
^permalinkrawreply[flat|nested] 9+ messages in thread
end of thread, back to indexThread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
— links below jump to the message on this page —
2020-07-09 18:41 Linux kernel in-tree Rust support Nick Desaulniers
2020-07-09 20:52 ` Miguel Ojeda
2020-07-10 5:36 ` Josh Triplett
2020-07-10 6:28 ` Greg KH
2020-07-10 12:50 ` Christian Brauner
2020-07-10 16:10 ` Kees Cook
[not found] ` <CAFRnB2WNo45J8h3-ncopLKENvcO0rf7J3xsy_eRKwFSpDD-5sQ@mail.gmail.com>
2020-07-10 23:05 ` Kees Cook
2020-07-10 22:59 ` Josh Triplett
2020-07-10 23:54 ` Linus Torvalds
LKML Archive on lore.kernel.org
Archives are clonable:
git clone –mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
git clone –mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
git clone –mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
git clone –mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
git clone –mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
git clone –mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
git clone –mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
git clone –mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
git clone –mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
linux-kernel@vger.kernel.org
public-inbox-index lkml
Example config snippet for mirrors
Newsgroup available over NNTP:
nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git