From: Markus Wichmann <nullplan@gmx.net>
To: musl@lists.openwall.com
Subject: Re: [PATCH] RISC-V: add riscv64 architecture support
Date: Tue, 4 Jun 2019 18:59:55 +0200 [thread overview]
Message-ID: <20190604165955.GB18396@voyager> (raw)
In-Reply-To: <BUKE7ZTDDM7Z.2HWPBWS96AW6G@homura>
On Mon, Jun 03, 2019 at 04:46:56PM -0400, Drew DeVault wrote:
> Thanks for your patience, needed to wait until I returned from travel to
> take another look here.
>
> On Sun May 26, 2019 at 12:31 AM Rich Felker wrote:
> > I don't understand why a_cas is defined here, and it's almost surely
> > wrong since it has no barriers whatsoever. If a_cas is left undefined,
> > it would be auto-defined in terms of a_ll and a_sc. But if we want to
> > follow the ISA docs which place restrictions on the positioning of
> > ll/sc and what can be done between them, I think we can't define a_ll
> > and a_sc, but have to define a_cas (with proper barriers) and let
> > everything else get defined in terms of it...
>
> I don't grok the atomics code, to be honest. I'm not sure what the
> resolution is here.
>
The main atomics functions are those you find for instance in x86_64's
atomic.h. Those are used by the main library. We used to have that set
of atomics for every arch, however, we noticed that a large number of
archs are RISC archs, which basically all use the LL/SC approach. So, we
generalized that approach in src/internal/atomics.h, so now you only
need a_ll() and a_sc() (and the proper barriers a_pre_llsc() and
a_post_llsc()).
As for what barriers you need: If in doubt, use too large a barrier and
scale it back once the performance impact is too great. Better to solve
a performance problem than a concurrency problem, believe me. You
generally want a write barrier before and a read barrier after the
transaction, but if you start with a full memory barrier, you can always
scale it back later.
> > Is 2k min correct here? It's ABI so we should aim to get it right to
> > begin with.
>
> The spec doesn't recommend a minimum stack size afaict, so this as
> reasonable as any other number to me.
>
The minimum stack size must be able to contain a kernel signal context
even with SA_SIGINFO. We recently had an issue where PowerPC was not
happy with the 2k, since it can use a little bit more. So that's why its
minimum is now at 4k.
Ciao,
Markus
prev parent reply other threads:[~2019-06-04 16:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-24 14:46 Drew DeVault
2019-05-26 4:31 ` Rich Felker
2019-06-03 20:46 ` Drew DeVault
2019-06-03 21:23 ` Rich Felker
2019-06-04 16:59 ` Markus Wichmann [this message]
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=20190604165955.GB18396@voyager \
--to=nullplan@gmx.net \
--cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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).