From nobody Sun Sep 8 07:44:16 2024 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4X1hn01NCcz5WGTX for ; Sun, 08 Sep 2024 07:44:20 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X1hn00Tjvz4Nr1; Sun, 8 Sep 2024 07:44:20 +0000 (UTC) (envelope-from kp@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725781460; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6cX3f/NFWhEm+d1CTUtU6H8uV6yrb1+yR7L4RR4HBiM=; b=nYnW8P5MBUhx5hvnZGCvj9Njrry/xCnMp/UCtW6I+WQKc55ckHBLOERSwUpYEWx6+EEiCz 6bfbJL5/25DqJBG1rtVk3fGpmq73LI95d3wtSf3FAySN5LP4rEioQt9zTyYZivJDw15kI9 lGkdQ+CXRBI+tqwihdj1npNvK0hzLx/HGogwv3rFVDT+h2mQ9BRGUurnBd1V7YU7NQJ07s kbJT5Dzf9H5d5lkVikzM74s28q6OCQJhJnAdkhIjQKR5IknEhxVWMQmJIJISaZbZETfSwU eBTDJf4MLcWHAEeEwHDv6uX379up8plkDQqFmoAs/QtqNbhYTsnIY2roOMkcSw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725781460; a=rsa-sha256; cv=none; b=EtOEBVBvy14FyEwrWBeaP7YW7NhxfjRYynUpQUwZc/JbhDzF//5G3OE6oI1s7Wb6OnHxA7 SFjAs9mTQT1uY1WUJKZ9hoSzQORJv6rFNqGDszsASHs80+m4nNApMB4loGwRJAARqDvnm1 Vd1NyC2DOEmrOCMvXxeB4DpQ0mQ+GFTksSkOhPoFn6cYdHrfuv1UokzHFNgQGxMUJ9j4NT 1J70Ev7QZnzNhUI/1WxGLo9qBgX3q6Ldp8KxGtWmYiXYc0aWsA++WDh+MdSRZa3jOAcuAb M+Av2zqIpazKJthJZ5Uo/9oemQ12XZujgai0QSnmmjChNjBy/IHZdRw7wW00jw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725781460; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6cX3f/NFWhEm+d1CTUtU6H8uV6yrb1+yR7L4RR4HBiM=; b=GghWnXG/2M9y71xNkS4vV0m60qUvjE1B9Nham7UHFRAljaaIAGpT1XzR4Y/G/dULatQZZ8 erjYxKbe4+WmywJKQWU6pTztVq3ZES1WYR6ndv7hJTJmB+1TR6CS4u3Q9gENfRGgU0sScg XMxNUDPUfp6Dsr8sGxT/zv1S14UaPXlZb7Ovy/OEgVP/MelVP8sOb/dQgKw3ZZvFng5GpV jzugnNYhjKql1umPW7IbbPJ4Q7xyr++ssUTmzWO/bZ6Den88Mw7AsikmvSMCMu0NNUlgv2 aJFb/whrCNDb6rSzcabK0VxdU/sJ0q/78bg6LDx+LTYMUvTnGnearEBOtm4how== Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx1.codepro.be", Issuer "R11" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 4X1hmz6SXzzJhH; Sun, 8 Sep 2024 07:44:19 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id E656445555; Sun, 08 Sep 2024 09:44:17 +0200 (CEST) From: Kristof Provost To: David Chisnall Cc: Poul-Henning Kamp , Alan Somers , Dmitry Salychev , Jan Knepper , freebsd-hackers@freebsd.org Subject: Re: The Case for Rust (in any system) Date: Sun, 08 Sep 2024 09:44:16 +0200 X-Mailer: MailMate (1.14r5937) Message-ID: In-Reply-To: <4E4FB8CC-A974-42C4-95D5-2E1E4BF681AD@freebsd.org> References: <202409060725.4867P3ul040678@critter.freebsd.dk> <4E4FB8CC-A974-42C4-95D5-2E1E4BF681AD@freebsd.org> List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_MailMate_E5759273-0E93-4EE1-AC01-902E3AC4744A_=" Content-Transfer-Encoding: 8bit --=_MailMate_E5759273-0E93-4EE1-AC01-902E3AC4744A_= Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 6 Sep 2024, at 9:41, David Chisnall wrote: > The strategy document that I coauthored at Microsoft recommended the > following: > > - C++ conforming to the Core Guidelines and with static analysis for > existing C/C++ projects with the C parts incrementally migrated to > C++. While I’d be interested in seeing Rust demonstrated there are clearly still some practical issues to work out before we can, even in user space. So, at the risk of derailing the Rust conversation, I want to ask about C++. We already ship user space C++ code, what’s stopping us from doing so for kernel code? If we can get some of the benefit of a more modern language with much less effort would that be a worthwhile step? RAII would not *always* make reasoning about locks easier, but it would in at least 95% of cases. What would we need to do to be able to use C++ in the kernel? Best regards, Kristof --=_MailMate_E5759273-0E93-4EE1-AC01-902E3AC4744A_= Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

On 6 Sep 2024, at 9:41, David Chisnall wrote:

The strategy document that I coauth= ored at Microsoft recommended the following:

- C++ conforming to the Core Guidelines and with static = analysis for existing C/C++ projects with the C parts incrementally migra= ted to C++.

While I=E2=80=99d be interested in seeing Rust demonstrat= ed there are clearly still some practical issues to work out before we ca= n, even in user space.

So, at the risk of derailing the Rust conversation, I wan= t to ask about C++.

We already ship user space C++ code, what=E2=80=99s stopp= ing us from doing so for kernel code?
If we can get some of the benefit of a more modern language with much les= s effort would that be a worthwhile step? RAII would not always = make reasoning about locks easier, but it would in at least 95% of cases.=

What would we need to do to be able to use C++ in the ker= nel?

Best regards,
Kristof

--=_MailMate_E5759273-0E93-4EE1-AC01-902E3AC4744A_=--