From: Chris Smart <chris@distroguy.com>
To: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc: Add support for userspace P9 copy paste
Date: Thu, 28 Apr 2016 09:51:52 +1000 [thread overview]
Message-ID: <20160427235151.GA5362@distroguy.com> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D5F4AB9A0@AcuExch.aculab.com>
On Wed, Apr 27, 2016 at 03:25:59PM +0000, David Laight wrote:
>From: Chris Smart
>> Sent: 26 April 2016 01:29
>> The copy paste facility introduced in POWER9 provides an optimised
>> mechanism for a userspace application to copy a cacheline. This is
>> provided by a pair of instructions, copy and paste, while a third,
>> cp_abort (copy paste abort), provides a clean up of the state in case of
>> a failure.
>>
>> The copy instruction will read a 128 byte cacheline and store it in an
>> internal buffer. The subsequent paste instruction will store this
>> internal buffer to memory and set a CR field if the paste succeeds.
>>
>> Since the state of the copy paste buffer is internal (and not
>> architecturally visible), in the unlikely event of a context switch, the
>> state cannot be stored and the paste should therefore fail.
>>
>> The cp_abort instruction exists to fail and clean up any such
>> interrupted copy paste sequence and is to be called by the kernel as
>> part of the context switch. Doing so prevents data from a preceding copy
>> in one process leaking into the paste of another.
>>
>> This code enables use of the cp_abort instruction if a supported
>> processor is detected.
>
>In that case what actually completes the copy?
>I think you'd need to be inside a 'restartable atomic sequence'
>in which case the cp_abort need only be done when the/a RAS
>block is detected.
>
>Or have I missed something??
It's up to the userspace process that's doing the copy paste to check
the CR field after the paste to see whether it has succeeded. If it has
not succeeded, then the process can choose to re-do the copy and paste.
This is very similar to a lwarx stwcx where the user checks the CR after
the stwcx to verify whether it has succeeded.
Hope that makes sense.
-c
next prev parent reply other threads:[~2016-04-27 23:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-26 0:28 [PATCH] powerpc: Add support for userspace P9 copy paste Chris Smart
2016-04-26 6:42 ` Cyril Bur
2016-04-26 6:49 ` Chris Smart
2016-04-26 7:45 ` Balbir Singh
2016-04-27 2:05 ` Michael Neuling
2016-04-27 15:25 ` David Laight
2016-04-27 23:51 ` Chris Smart [this message]
2016-04-28 14:48 ` David Laight
2016-04-28 14:22 ` Michael Ellerman
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=20160427235151.GA5362@distroguy.com \
--to=chris@distroguy.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/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 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).