All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Serge Guelton <sguelton@redhat.com>
Cc: Florian Weimer <fweimer@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	qemu-devel <qemu-devel@nongnu.org>,
	Stefan Hajnoczi <stefanha@gmail.com>
Subject: Re: Portable inline asm to get address of TLS variable
Date: Thu, 17 Feb 2022 15:11:59 +0000	[thread overview]
Message-ID: <Yg5lv/PeUyZx4BPk@stefanha-x1.localdomain> (raw)
In-Reply-To: <20220217150216.GD11782@sguelton.remote.csb>

[-- Attachment #1: Type: text/plain, Size: 1660 bytes --]

On Thu, Feb 17, 2022 at 04:02:16PM +0100, Serge Guelton wrote:
> On Thu, Feb 17, 2022 at 12:40:40PM +0100, Paolo Bonzini wrote:
> > On 2/17/22 10:28, Stefan Hajnoczi wrote:
> > >>But going against ABI and toolchain in this way is really no long-term
> > >>solution.  You need to switch to stackless co-routines, or we need to
> > >>provide proper ABI-level support for this.  Today it's the thread
> > >>pointer, tomorrow it's the shadow stack pointer, and the day after that,
> > >>it's the SafeStack pointer.  And further down the road, it's some thread
> > >>state for garbage collection support.  Or something like that.
> > >
> > >Yes, understood :(. This does feel like solving an undefined behavior
> > >problem by adding more undefined behavior on top!
> > 
> > Yes, this is the kind of thing that I generally despise when I see
> > other programs do it...  it's easy to dig ourselves in the same
> > hole.
> > 
> > >I took a quick look at C++20 coroutines since they are available in
> > >compilers but the primitives look hard to use even from C++, let alone
> > >from C.
> > 
> > They're C++ only in GCC, too.  I really think that QEMU should be
> > compilable in C++, but I'm not sure how easy a sell it is.
> 
> It's perfectly fine to have one compilation unit written in C++ with a few
> symbol in `extern "C"`. No need to touch the other part of the project.
> 

I don't think that's possible in this case because the coroutine
functions are spread throughout the codebase. All coroutine functions
need to be in C++ source units so the compiler can transform them and
emit code callable as a coroutine.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2022-02-17 15:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16 17:46 Portable inline asm to get address of TLS variable Stefan Hajnoczi
2022-02-16 18:13 ` Florian Weimer
2022-02-16 20:28   ` Stefan Hajnoczi
2022-02-16 20:33     ` Stefan Hajnoczi
2022-02-16 20:46       ` Florian Weimer
2022-02-17  9:30         ` Stefan Hajnoczi
2022-02-16 20:40     ` Florian Weimer
2022-02-17  9:28       ` Stefan Hajnoczi
2022-02-17 11:40         ` Paolo Bonzini
2022-02-17 15:02           ` Serge Guelton
2022-02-17 15:11             ` Stefan Hajnoczi [this message]
2022-02-17 15:51             ` Paolo Bonzini
2022-02-17 14:59         ` Serge Guelton
2022-03-01 11:54         ` Florian Weimer
2022-03-01 13:39           ` Stefan Hajnoczi
2022-04-19 11:32             ` Florian Weimer
2022-04-19 18:38               ` Thomas Rodgers
2022-04-20 14:12               ` Stefan Hajnoczi
2022-02-16 22:28 ` 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=Yg5lv/PeUyZx4BPk@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=sguelton@redhat.com \
    --cc=stefanha@gmail.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.