Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Paul Burton <paul.burton@imgtec.com>
To: David Daney <ddaney.cavm@gmail.com>
Cc: <linux-mips@linux-mips.org>
Subject: Re: [PATCH 15/15] mips: save/restore MSA context around signals
Date: Mon, 27 Jan 2014 20:06:07 +0000	[thread overview]
Message-ID: <20140127200607.GM970@pburton-linux.le.imgtec.org> (raw)
In-Reply-To: <52E6B887.2070605@gmail.com>

On Mon, Jan 27, 2014 at 11:50:31AM -0800, David Daney wrote:
> ....
> On 01/27/2014 07:23 AM, Paul Burton wrote:
> >This patch extends sigcontext in order to hold the most significant 64
> >bits of each vector register in addition to the MSA control & status
> >register. The least significant 64 bits are already saved as the scalar
> >FP context. This makes things a little awkward since the least & most
> >significant 64 bits of each vector register are not contiguous in
> >memory. Thus the copy_u & insert instructions are used to transfer the
> >values of the most significant 64 bits via GP registers.
> >
> 
> Interesting.
> 
> This very much touches the userspace ABI of the kernel, so it merits very
> careful consideration.
> 

Absolutely :)

> 
> >Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> >---
> >  arch/mips/include/asm/sigcontext.h      |   2 +
> >  arch/mips/include/uapi/asm/sigcontext.h |   8 ++
> >  arch/mips/kernel/asm-offsets.c          |   3 +
> >  arch/mips/kernel/r4k_fpu.S              | 213 ++++++++++++++++++++++++++++++++
> >  arch/mips/kernel/signal.c               |  71 +++++++++--
> >  arch/mips/kernel/signal32.c             |  71 +++++++++--
> >  6 files changed, 352 insertions(+), 16 deletions(-)
> >
> [...]
> >diff --git a/arch/mips/include/uapi/asm/sigcontext.h b/arch/mips/include/uapi/asm/sigcontext.h
> >index 6c9906f..681c176 100644
> >--- a/arch/mips/include/uapi/asm/sigcontext.h
> >+++ b/arch/mips/include/uapi/asm/sigcontext.h
> >@@ -12,6 +12,10 @@
> >  #include <linux/types.h>
> >  #include <asm/sgidefs.h>
> >
> >+/* Bits which may be set in sc_used_math */
> >+#define USEDMATH_FP	(1 << 0)
> >+#define USEDMATH_MSA	(1 << 1)
> >+
> 
> How is this going to interact with existing userspace applications?
> 
> Is the current behavior to use / manipulate sc_used_math?
> 
> How will USEDMATH_MSA interact with existing code?
> 

My belief is that since previously sc_used_math was either 0 or 1, any
code using this is likely to simply check for it being non-zero and
continue to work just fine. The only issue would be if code explicitly
checks for sc_used_math==1. Even then it's only an issue if your program
also uses MSA, so there should certainly be no issue with old binaries.
If you can think of or find any uses of sc_used_math which would cause a
problem please do let me know.

Thanks,
    Paul

WARNING: multiple messages have this Message-ID (diff)
From: Paul Burton <paul.burton@imgtec.com>
To: David Daney <ddaney.cavm@gmail.com>
Cc: linux-mips@linux-mips.org
Subject: Re: [PATCH 15/15] mips: save/restore MSA context around signals
Date: Mon, 27 Jan 2014 20:06:07 +0000	[thread overview]
Message-ID: <20140127200607.GM970@pburton-linux.le.imgtec.org> (raw)
Message-ID: <20140127200607.rSVPECqyV3SQDy_cShlWNywdUPETN1f8eyLK4jbsu8Y@z> (raw)
In-Reply-To: <52E6B887.2070605@gmail.com>

On Mon, Jan 27, 2014 at 11:50:31AM -0800, David Daney wrote:
> ....
> On 01/27/2014 07:23 AM, Paul Burton wrote:
> >This patch extends sigcontext in order to hold the most significant 64
> >bits of each vector register in addition to the MSA control & status
> >register. The least significant 64 bits are already saved as the scalar
> >FP context. This makes things a little awkward since the least & most
> >significant 64 bits of each vector register are not contiguous in
> >memory. Thus the copy_u & insert instructions are used to transfer the
> >values of the most significant 64 bits via GP registers.
> >
> 
> Interesting.
> 
> This very much touches the userspace ABI of the kernel, so it merits very
> careful consideration.
> 

Absolutely :)

> 
> >Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> >---
> >  arch/mips/include/asm/sigcontext.h      |   2 +
> >  arch/mips/include/uapi/asm/sigcontext.h |   8 ++
> >  arch/mips/kernel/asm-offsets.c          |   3 +
> >  arch/mips/kernel/r4k_fpu.S              | 213 ++++++++++++++++++++++++++++++++
> >  arch/mips/kernel/signal.c               |  71 +++++++++--
> >  arch/mips/kernel/signal32.c             |  71 +++++++++--
> >  6 files changed, 352 insertions(+), 16 deletions(-)
> >
> [...]
> >diff --git a/arch/mips/include/uapi/asm/sigcontext.h b/arch/mips/include/uapi/asm/sigcontext.h
> >index 6c9906f..681c176 100644
> >--- a/arch/mips/include/uapi/asm/sigcontext.h
> >+++ b/arch/mips/include/uapi/asm/sigcontext.h
> >@@ -12,6 +12,10 @@
> >  #include <linux/types.h>
> >  #include <asm/sgidefs.h>
> >
> >+/* Bits which may be set in sc_used_math */
> >+#define USEDMATH_FP	(1 << 0)
> >+#define USEDMATH_MSA	(1 << 1)
> >+
> 
> How is this going to interact with existing userspace applications?
> 
> Is the current behavior to use / manipulate sc_used_math?
> 
> How will USEDMATH_MSA interact with existing code?
> 

My belief is that since previously sc_used_math was either 0 or 1, any
code using this is likely to simply check for it being non-zero and
continue to work just fine. The only issue would be if code explicitly
checks for sc_used_math==1. Even then it's only an issue if your program
also uses MSA, so there should certainly be no issue with old binaries.
If you can think of or find any uses of sc_used_math which would cause a
problem please do let me know.

Thanks,
    Paul

  reply	other threads:[~2014-01-27 20:06 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27 15:22 [PATCH 00/15] Initial MSA support Paul Burton
2014-01-27 15:22 ` Paul Burton
2014-01-27 15:23 ` [PATCH v2 01/15] mips: simplify FP context access Paul Burton
2014-01-27 15:23   ` Paul Burton
2014-02-13 11:26   ` [PATCH v3 " Paul Burton
2014-02-13 11:26     ` Paul Burton
2014-01-27 15:23 ` [PATCH 02/15] mips: update outdated comment Paul Burton
2014-01-27 15:23   ` Paul Burton
2014-01-27 15:23 ` [PATCH 03/15] mips: move & rename fpu_emulator_{save,restore}_context Paul Burton
2014-01-27 15:23   ` Paul Burton
2014-01-27 15:23 ` [PATCH 04/15] mips: don't require FPU on sigcontext setup/restore Paul Burton
2014-01-27 15:23   ` Paul Burton
2014-01-27 15:23 ` [PATCH 05/15] mips: replace hardcoded 32 with NUM_FPU_REGS in ptrace Paul Burton
2014-01-27 15:23   ` Paul Burton
2014-01-27 15:23 ` [PATCH 06/15] mips: clear upper bits of FP registers on emulator writes Paul Burton
2014-01-27 15:23   ` Paul Burton
2014-01-27 18:06   ` Sergei Shtylyov
2014-01-27 17:11     ` Paul Burton
2014-01-27 17:11       ` Paul Burton
2014-01-27 17:14     ` [PATCH v2 " Paul Burton
2014-01-27 17:14       ` Paul Burton
2014-01-27 15:23 ` [PATCH 07/15] mips: don't assume 64-bit FP registers for dump_{,task_}fpu Paul Burton
2014-01-27 15:23   ` Paul Burton
2014-01-27 15:23 ` [PATCH 08/15] mips: don't assume 64-bit FP registers for FP regset Paul Burton
2014-01-27 15:23   ` Paul Burton
2014-01-27 15:23 ` [PATCH 09/15] mips: don't assume 64-bit FP registers for context switch Paul Burton
2014-01-27 15:23   ` Paul Burton
2014-01-27 15:23 ` [PATCH 10/15] mips: add MSA register definitions & access Paul Burton
2014-01-27 15:23   ` Paul Burton
2014-01-27 15:23 ` [PATCH 11/15] mips: detect the MSA ASE Paul Burton
2014-01-27 15:23   ` Paul Burton
2014-01-27 15:23 ` [PATCH 12/15] mips: basic MSA context switching support Paul Burton
2014-01-27 15:23   ` Paul Burton
2014-01-27 15:23 ` [PATCH 13/15] mips: dumb MSA FP exception handler Paul Burton
2014-01-27 15:23   ` Paul Burton
2014-01-27 15:23 ` [PATCH 14/15] mips: panic if vector register partitioning is implemented Paul Burton
2014-01-27 15:23   ` Paul Burton
2014-01-27 18:38   ` David Daney
2014-01-27 19:39     ` Paul Burton
2014-01-27 19:39       ` Paul Burton
2014-01-27 19:56       ` David Daney
2014-01-28 14:20         ` Paul Burton
2014-01-28 14:20           ` Paul Burton
2014-01-28 14:28           ` [PATCH v2 14/15] mips: warn " Paul Burton
2014-01-28 14:28             ` Paul Burton
2014-01-27 15:23 ` [PATCH 15/15] mips: save/restore MSA context around signals Paul Burton
2014-01-27 15:23   ` Paul Burton
2014-01-27 19:50   ` David Daney
2014-01-27 20:06     ` Paul Burton [this message]
2014-01-27 20:06       ` Paul Burton
2014-02-13 11:27   ` [PATCH v2 " Paul Burton
2014-02-13 11:27     ` Paul Burton

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=20140127200607.GM970@pburton-linux.le.imgtec.org \
    --to=paul.burton@imgtec.com \
    --cc=ddaney.cavm@gmail.com \
    --cc=linux-mips@linux-mips.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