From: Paul Burton <paul.burton@imgtec.com>
To: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Cc: <linux-mips@linux-mips.org>, <rusty@rustcorp.com.au>,
<alexinbeijing@gmail.com>, <david.daney@cavium.com>,
<alex@alex-smith.me.uk>, <linux-kernel@vger.kernel.org>,
<ralf@linux-mips.org>, <james.hogan@imgtec.com>,
<markos.chandras@imgtec.com>, <macro@linux-mips.org>,
<eunb.song@samsung.com>, <manuel.lauss@gmail.com>,
<andreas.herrmann@caviumnetworks.com>
Subject: Re: [PATCH 1/2] MIPS: MSA: bugfix - disable MSA during thread switch correctly
Date: Thu, 21 May 2015 10:12:04 +0100 [thread overview]
Message-ID: <20150521090741.GG13811@NP-P-BURTON> (raw)
In-Reply-To: <20150519211351.35859.80332.stgit@ubuntu-yegoshin>
[-- Attachment #1: Type: text/plain, Size: 2097 bytes --]
On Tue, May 19, 2015 at 02:13:51PM -0700, Leonid Yegoshin wrote:
> During thread cloning the new (child) thread should have MSA disabled even
> at first thread entry. So, the code to disable MSA is moved from macro
> 'switch_to' to assembler function 'resume' before it switches kernel stack
> to 'next' (new) thread. Call of 'disable_msa' after 'resume' in 'switch_to'
> macro never called a first time entry into thread.
Hi Leonid,
I'm not sure I understand what you're trying to say here. Do you have an
example of a program that demonstrates the behaviour you believe to be
broken?
Thanks,
Paul
> Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
> ---
> arch/mips/include/asm/switch_to.h | 1 -
> arch/mips/kernel/r4k_switch.S | 6 ++++++
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/arch/mips/include/asm/switch_to.h b/arch/mips/include/asm/switch_to.h
> index e92d6c4b5ed1..0d0f7f8f8b3a 100644
> --- a/arch/mips/include/asm/switch_to.h
> +++ b/arch/mips/include/asm/switch_to.h
> @@ -104,7 +104,6 @@ do { \
> if (test_and_clear_tsk_thread_flag(prev, TIF_USEDMSA)) \
> __fpsave = FP_SAVE_VECTOR; \
> (last) = resume(prev, next, task_thread_info(next), __fpsave); \
> - disable_msa(); \
> } while (0)
>
> #define finish_arch_switch(prev) \
> diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
> index 04cbbde3521b..7dbb64656bfe 100644
> --- a/arch/mips/kernel/r4k_switch.S
> +++ b/arch/mips/kernel/r4k_switch.S
> @@ -25,6 +25,7 @@
> /* preprocessor replaces the fp in ".set fp=64" with $30 otherwise */
> #undef fp
>
> +#define t4 $12
> /*
> * Offset to the current process status flags, the first 32 bytes of the
> * stack are not used.
> @@ -73,6 +74,11 @@
> cfc1 t1, fcr31
> msa_save_all a0
> .set pop /* SET_HARDFLOAT */
> + li t4, MIPS_CONF5_MSAEN
> + mfc0 t3, CP0_CONFIG, 5
> + or t3, t3, t4
> + xor t3, t3, t4
> + mtc0 t3, CP0_CONFIG, 5
>
> sw t1, THREAD_FCR31(a0)
> b 2f
>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Paul Burton <paul.burton@imgtec.com>
To: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Cc: linux-mips@linux-mips.org, rusty@rustcorp.com.au,
alexinbeijing@gmail.com, david.daney@cavium.com,
alex@alex-smith.me.uk, linux-kernel@vger.kernel.org,
ralf@linux-mips.org, james.hogan@imgtec.com,
markos.chandras@imgtec.com, macro@linux-mips.org,
eunb.song@samsung.com, manuel.lauss@gmail.com,
andreas.herrmann@caviumnetworks.com
Subject: Re: [PATCH 1/2] MIPS: MSA: bugfix - disable MSA during thread switch correctly
Date: Thu, 21 May 2015 10:12:04 +0100 [thread overview]
Message-ID: <20150521090741.GG13811@NP-P-BURTON> (raw)
Message-ID: <20150521091204.bGfzu_xv5VV4oHe5I61C_gL0AKoKzu0Wt_vLDwrYT4I@z> (raw)
In-Reply-To: <20150519211351.35859.80332.stgit@ubuntu-yegoshin>
[-- Attachment #1: Type: text/plain, Size: 2097 bytes --]
On Tue, May 19, 2015 at 02:13:51PM -0700, Leonid Yegoshin wrote:
> During thread cloning the new (child) thread should have MSA disabled even
> at first thread entry. So, the code to disable MSA is moved from macro
> 'switch_to' to assembler function 'resume' before it switches kernel stack
> to 'next' (new) thread. Call of 'disable_msa' after 'resume' in 'switch_to'
> macro never called a first time entry into thread.
Hi Leonid,
I'm not sure I understand what you're trying to say here. Do you have an
example of a program that demonstrates the behaviour you believe to be
broken?
Thanks,
Paul
> Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
> ---
> arch/mips/include/asm/switch_to.h | 1 -
> arch/mips/kernel/r4k_switch.S | 6 ++++++
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/arch/mips/include/asm/switch_to.h b/arch/mips/include/asm/switch_to.h
> index e92d6c4b5ed1..0d0f7f8f8b3a 100644
> --- a/arch/mips/include/asm/switch_to.h
> +++ b/arch/mips/include/asm/switch_to.h
> @@ -104,7 +104,6 @@ do { \
> if (test_and_clear_tsk_thread_flag(prev, TIF_USEDMSA)) \
> __fpsave = FP_SAVE_VECTOR; \
> (last) = resume(prev, next, task_thread_info(next), __fpsave); \
> - disable_msa(); \
> } while (0)
>
> #define finish_arch_switch(prev) \
> diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
> index 04cbbde3521b..7dbb64656bfe 100644
> --- a/arch/mips/kernel/r4k_switch.S
> +++ b/arch/mips/kernel/r4k_switch.S
> @@ -25,6 +25,7 @@
> /* preprocessor replaces the fp in ".set fp=64" with $30 otherwise */
> #undef fp
>
> +#define t4 $12
> /*
> * Offset to the current process status flags, the first 32 bytes of the
> * stack are not used.
> @@ -73,6 +74,11 @@
> cfc1 t1, fcr31
> msa_save_all a0
> .set pop /* SET_HARDFLOAT */
> + li t4, MIPS_CONF5_MSAEN
> + mfc0 t3, CP0_CONFIG, 5
> + or t3, t3, t4
> + xor t3, t3, t4
> + mtc0 t3, CP0_CONFIG, 5
>
> sw t1, THREAD_FCR31(a0)
> b 2f
>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-05-21 9:12 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-19 21:13 [PATCH 0/2] MIPS: MSA: bugfixes of context switch Leonid Yegoshin
2015-05-19 21:13 ` Leonid Yegoshin
2015-05-19 21:13 ` [PATCH 1/2] MIPS: MSA: bugfix - disable MSA during thread switch correctly Leonid Yegoshin
2015-05-19 21:13 ` Leonid Yegoshin
2015-05-21 9:12 ` Paul Burton [this message]
2015-05-21 9:12 ` Paul Burton
2015-05-21 16:11 ` Leonid Yegoshin
2015-05-21 16:11 ` Leonid Yegoshin
2015-05-21 16:20 ` [PATCH] MIPS: tidy up FPU context switching Paul Burton
2015-05-21 16:20 ` Paul Burton
2015-05-22 10:42 ` [PATCH v2] " Paul Burton
2015-05-22 10:42 ` Paul Burton
2015-05-22 9:38 ` [PATCH 1/2] MIPS: MSA: bugfix - disable MSA during thread switch correctly Ralf Baechle
2015-05-22 18:37 ` Leonid Yegoshin
2015-05-22 18:37 ` Leonid Yegoshin
2015-05-22 19:06 ` Leonid Yegoshin
2015-05-22 19:06 ` Leonid Yegoshin
2015-05-22 23:20 ` Ralf Baechle
2015-05-23 0:00 ` Leonid Yegoshin
2015-05-23 0:00 ` Leonid Yegoshin
2015-05-19 21:13 ` [PATCH 2/2] MIPS: MSA: bugfix of keeping MSA live context through clone or fork Leonid Yegoshin
2015-05-19 21:13 ` Leonid Yegoshin
2015-05-20 19:23 ` Leonid Yegoshin
2015-05-20 19:23 ` Leonid Yegoshin
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=20150521090741.GG13811@NP-P-BURTON \
--to=paul.burton@imgtec.com \
--cc=Leonid.Yegoshin@imgtec.com \
--cc=alex@alex-smith.me.uk \
--cc=alexinbeijing@gmail.com \
--cc=andreas.herrmann@caviumnetworks.com \
--cc=david.daney@cavium.com \
--cc=eunb.song@samsung.com \
--cc=james.hogan@imgtec.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=macro@linux-mips.org \
--cc=manuel.lauss@gmail.com \
--cc=markos.chandras@imgtec.com \
--cc=ralf@linux-mips.org \
--cc=rusty@rustcorp.com.au \
/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