From: Nick Kossifidis <mick@ics.forth.gr>
To: Christopher Lameter <cl@linux.com>
Cc: bjorn.topel@gmail.com, paul@pwsan.com,
Palmer Dabbelt <palmer@sifive.com>,
linux-riscv@lists.infradead.org
Subject: Re: per-cpu thoughts
Date: Fri, 22 Feb 2019 17:36:09 +0200 [thread overview]
Message-ID: <2acd8a4393d4e9c526bcfa4aca63e4cf@mailhost.ics.forth.gr> (raw)
In-Reply-To: <0100016915bc54e5-22f89b41-21e8-4133-9550-e85f4223ea32-000000@email.amazonses.com>
Στις 2019-02-22 17:04, Christopher Lameter έγραψε:
> On Thu, 21 Feb 2019, Palmer Dabbelt wrote:
>
>> That said, it's all a moot point here: our LR/SC instructions are part
>> of the
>> A extension, so if you have those you have AMOs. The general policy
>> here is
>> that if there is an AMO that efficiently implements what you're
>> looking for
>> then it should be preferred to an LR/SC sequence. This specific case
>> is
>> actually one of the places where AMOs have a big benefit as opposed to
>> LR/SC
>> sequences, with the AMO implementation looking roughly like
>>
>> li t0, 1
>> la t1, counter
>> amoadd.w zero, t0, 0(t1)
>
> Can you add a register that contains the per cpu area address for the
> current hardware thread in amoadd?
>
> If we do not disable interrupts and preemption then the instruction
> could
> be executed on any processor since the OS may preempt and reschedule
> the
> kernel thread arbitrarily. We need a global register that contains the
> per
> cpu area address (which is different for every hardware thread). If the
> instruction is rescheduled on a different thread then the other offset
> needs to be used so the instruction need to specify that the addres is
> relative to that global register.
>
> PowerPC uses such a global register. On Intel the GS segment register
> is
> abused for that purpose.
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
How about the scratch registers defined on priv spec ? We already use
sscratch on Linux for keeping per-hart kernel data structures (check out
entry.S) and mscratch on OpenSBI for keeping per-hart state etc.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2019-02-22 15:36 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-20 19:57 per-cpu thoughts Björn Töpel
2019-02-21 15:57 ` Christopher Lameter
2019-02-21 16:28 ` Paul Walmsley
2019-02-21 17:24 ` Björn Töpel
2019-02-21 17:49 ` Paul Walmsley
2019-02-21 19:40 ` Palmer Dabbelt
2019-02-22 15:04 ` Christopher Lameter
2019-02-22 15:36 ` Nick Kossifidis [this message]
2019-02-22 15:56 ` Christopher Lameter
2019-02-22 19:47 ` Björn Töpel
2019-02-22 19:56 ` Christopher Lameter
2019-02-28 12:20 ` Paul Walmsley
2019-02-28 17:58 ` Christopher Lameter
2019-02-28 18:42 ` Paul Walmsley
2019-02-28 19:09 ` Christopher Lameter
2019-02-28 20:21 ` Paul Walmsley
2019-03-01 1:13 ` Christopher Lameter
2019-03-08 7:17 ` Björn Töpel
2019-03-11 13:22 ` Palmer Dabbelt
2019-03-11 14:48 ` Björn Töpel
2019-03-11 14:56 ` Christopher Lameter
2019-03-11 15:05 ` Björn Töpel
2019-03-11 15:26 ` Paul Walmsley
2019-03-11 15:26 ` Paul Walmsley
2019-03-11 16:48 ` Mark Rutland
2019-03-11 16:48 ` Mark Rutland
2019-03-11 18:39 ` Paul Walmsley
2019-03-11 18:39 ` Paul Walmsley
2019-03-12 11:23 ` Mark Rutland
2019-03-12 11:23 ` Mark Rutland
2019-03-12 16:01 ` Paul Walmsley
2019-03-12 16:01 ` Paul Walmsley
2019-03-12 17:34 ` Christopher Lameter
2019-03-12 17:34 ` Christopher Lameter
2019-03-12 4:26 ` Christopher Lameter
2019-03-12 4:26 ` Christopher Lameter
2019-03-12 14:21 ` Paul Walmsley
2019-03-12 14:21 ` Paul Walmsley
2019-03-12 17:42 ` Christopher Lameter
2019-03-12 17:42 ` Christopher Lameter
2019-03-12 17:59 ` Gary Guo
2019-03-12 17:59 ` Gary Guo
2019-03-13 18:58 ` Christopher Lameter
2019-03-13 18:58 ` Christopher Lameter
2019-03-13 20:15 ` Paul Walmsley
2019-03-13 20:15 ` Paul Walmsley
2019-03-22 14:51 ` Nick Kossifidis
2019-03-22 14:51 ` Nick Kossifidis
2019-03-22 17:57 ` Christopher Lameter
2019-03-22 17:57 ` Christopher Lameter
2019-03-11 15:51 ` Christopher Lameter
2019-03-11 16:35 ` Björn Töpel
2019-03-12 4:22 ` Christopher Lameter
2019-02-22 19:48 ` Björn Töpel
2019-02-22 20:53 ` Nick Kossifidis
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=2acd8a4393d4e9c526bcfa4aca63e4cf@mailhost.ics.forth.gr \
--to=mick@ics.forth.gr \
--cc=bjorn.topel@gmail.com \
--cc=cl@linux.com \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@sifive.com \
--cc=paul@pwsan.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.