From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
hreitz@redhat.com, "Daniel P. Berrangé" <berrange@redhat.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [PATCH experiment 00/16] C++20 coroutine backend
Date: Wed, 16 Mar 2022 17:15:40 +0100 [thread overview]
Message-ID: <YjINLHMDP1l19ARu@redhat.com> (raw)
In-Reply-To: <YjHazSWJEM3lU8j6@stefanha-x1.localdomain>
[-- Attachment #1: Type: text/plain, Size: 3589 bytes --]
Am 16.03.2022 um 13:40 hat Stefan Hajnoczi geschrieben:
> On Wed, Mar 16, 2022 at 12:08:33AM +0100, Paolo Bonzini wrote:
> > On 3/15/22 16:55, Daniel P. Berrangé wrote:
> > > Expecting maintainers to enforce a subset during code review feels
> > > like it would be a tedious burden, that will inevitably let stuff
> > > through because humans are fallible, especially when presented
> > > with uninspiring, tedious, repetitive tasks.
> > >
> > > Restricting ourselves to a subset is only viable if we have
> > > an automated tool that can reliably enforce that subset. I'm not
> > > sure that any such tool exists, and not convinced our time is
> > > best served by trying to write & maintainer one either.
> >
> > We don't need to have a policy on which features are used. We need to have
> > goals for what to use C++ for. I won't go into further details here,
> > because I had already posted "When and how to use C++"[1] about an hour
> > before your reply.
> >
> > > IOW, I fear one we allow C++ in any level, it won't be practical
> > > to constrain it as much we desire. I fear us turning QEMU into
> > > even more of a monster like other big C++ apps I see which take
> > > all hours to compile while using all available RAM in Fedora RPM
> > > build hosts.
> >
> > Sorry but this is FUD. There's plenty of C++ apps and libraries that do not
> > "take hours to compile while using all available RAM". You're probably
> > thinking of the Chromium/Firefox/Libreoffice triplet but those are an order
> > of magnitude larger than QEMU. And in fact, QEMU is *already* a monster
> > that takes longer to compile than most other packages, no matter the
> > language they're written in.
> >
> > Most of KDE and everything that uses Qt is written in C++, and so is
> > Inkscape in GTK+ land. LLVM and Clang are written in C++. Hotspot and V8
> > are written in C++. Kodi, MAME and DolphinEmu are written in C++. GCC and
> > GDB have migrated to C++ and their compile times have not exploded.
> >
> > > My other question is whether adoption of C++ would complicate any
> > > desire to make more use of Rust in QEMU ? I know Rust came out of
> > > work by the Mozilla Firefox crew, and Firefox was C++, but I don't
> > > have any idea how they integrated use of Rust with Firefox, so
> > > whether there are any gotcha's for us or not ?
> >
> > Any Rust integration would go through C APIs. Using Rust in the block layer
> > would certainly be much harder, though perhaps not impossible, if the block
> > layer uses C++ coroutines. Rust supports something similar, but
> > two-direction interoperability would be hard.
>
> I haven't looked at this in depth but there is a solution for Rust-C++
> interop: https://cxx.rs/
"Direct FFI of async functions is absolutely in scope for CXX (on C++20
and up) but is not implemented yet in the current release."
With the current QEMU coroutines, calling Rust async fns from C is
relatively easy, and calling C coroutine_fns from a Rust async fn is
trivial when the Rust async fn is already called from a C coroutine
(because qemu_coroutine_yield() just works, we still have a coroutine
stack from the original C caller).
I suppose calling Rust async fns from C++ could actually have the same
implementation as with C when using Paolo's wrappers, but the other
direction might be a bit harder - to be honest, I can't tell because
I've never checked how C++ coroutines work internally. Could as well be
that a Rust wrapper for them isn't that hard after all.
Kevin
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-03-16 16:18 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-14 9:31 [PATCH experiment 00/16] C++20 coroutine backend Paolo Bonzini
2022-03-14 9:31 ` [PATCH experiment 01/16] coroutine: add missing coroutine_fn annotations for CoRwlock functions Paolo Bonzini
2022-03-14 9:31 ` [PATCH experiment 02/16] coroutine: qemu_coroutine_get_aio_context is not a coroutine_fn Paolo Bonzini
2022-03-14 9:31 ` [PATCH experiment 03/16] coroutine: small code cleanup in qemu_co_rwlock_wrlock Paolo Bonzini
2022-03-14 13:32 ` Philippe Mathieu-Daudé
2022-03-14 9:31 ` [PATCH experiment 04/16] coroutine: introduce QemuCoLockable Paolo Bonzini
2022-03-14 9:31 ` [PATCH experiment 05/16] port atomic.h to C++ Paolo Bonzini
2022-03-14 9:31 ` [PATCH experiment 06/16] use g_new0 instead of g_malloc0 Paolo Bonzini
2022-03-14 11:16 ` Markus Armbruster
2022-03-14 9:31 ` [PATCH experiment 07/16] start porting compiler.h to C++ Paolo Bonzini
2022-03-14 9:31 ` [PATCH experiment 08/16] tracetool: add extern "C" around generated headers Paolo Bonzini
2022-03-14 13:33 ` Philippe Mathieu-Daudé
2022-03-14 13:44 ` Paolo Bonzini
2022-03-14 9:31 ` [PATCH experiment 09/16] start adding extern "C" markers Paolo Bonzini
2022-03-14 9:31 ` [PATCH experiment 10/16] add space between liter and string macro Paolo Bonzini
2022-03-14 9:31 ` [PATCH experiment 11/16] bump to C++20 Paolo Bonzini
2022-03-14 9:31 ` [PATCH experiment 12/16] remove "new" keyword from trace-events Paolo Bonzini
2022-03-14 13:30 ` Philippe Mathieu-Daudé
2022-03-14 9:32 ` [PATCH experiment 13/16] disable some code Paolo Bonzini
2022-03-14 9:32 ` [PATCH experiment 14/16] util: introduce C++ stackless coroutine backend Paolo Bonzini
2022-03-14 14:37 ` Stefan Hajnoczi
2022-03-14 19:36 ` Paolo Bonzini
2022-03-14 9:32 ` [PATCH experiment 15/16] port QemuCoLockable to C++ coroutines Paolo Bonzini
2022-03-14 9:32 ` [PATCH experiment 16/16] port test-coroutine " Paolo Bonzini
2022-03-14 14:07 ` [PATCH experiment 00/16] C++20 coroutine backend Stefan Hajnoczi
2022-03-14 16:21 ` Paolo Bonzini
2022-03-14 19:51 ` Richard Henderson
2022-03-15 14:05 ` Stefan Hajnoczi
2022-03-15 14:24 ` Peter Maydell
2022-03-15 17:29 ` Paolo Bonzini
2022-03-16 12:32 ` Stefan Hajnoczi
2022-03-16 13:06 ` Daniel P. Berrangé
2022-03-16 16:44 ` Stefan Hajnoczi
2022-03-17 15:11 ` Paolo Bonzini
2022-03-17 15:53 ` Hanna Reitz
2022-03-31 11:37 ` Markus Armbruster
2022-03-15 14:50 ` Kevin Wolf
2022-03-15 15:35 ` Stefan Hajnoczi
2022-03-15 15:55 ` Daniel P. Berrangé
2022-03-15 23:08 ` Paolo Bonzini
2022-03-16 12:40 ` Stefan Hajnoczi
2022-03-16 16:15 ` Kevin Wolf [this message]
2022-03-17 12:16 ` Dr. David Alan Gilbert
2022-03-17 12:51 ` Daniel P. Berrangé
2022-03-31 11:52 ` Markus Armbruster
2022-03-15 17:23 ` When and how to use C++ (was Re: [PATCH experiment 00/16] C++20 coroutine backend) Paolo Bonzini
2022-03-14 16:52 ` [PATCH experiment 00/16] C++20 coroutine backend Daniel P. Berrangé
2022-03-15 9:05 ` Paolo Bonzini
2022-03-15 9:32 ` Daniel P. Berrangé
2022-03-15 17:27 ` Paolo Bonzini
2022-03-15 18:12 ` Daniel P. Berrangé
2022-03-15 16:15 ` Daniel P. Berrangé
2022-03-15 17:50 ` Paolo Bonzini
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=YjINLHMDP1l19ARu@redhat.com \
--to=kwolf@redhat.com \
--cc=berrange@redhat.com \
--cc=hreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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.