From: Markos Chandras <Markos.Chandras@imgtec.com>
To: Paul Burton <paul.burton@imgtec.com>, <linux-mips@linux-mips.org>
Cc: Matthew Fortune <matthew.fortune@imgtec.com>,
LKML <linux-kernel@vger.kernel.org>, <linux-api@vger.kernel.org>
Subject: Re: [PATCH] MIPS,prctl: add PR_[GS]ET_FP_MODE prctl options for MIPS
Date: Fri, 16 Jan 2015 15:43:52 +0000 [thread overview]
Message-ID: <54B931B8.5050903@imgtec.com> (raw)
In-Reply-To: <54B519B6.5040604@imgtec.com>
On 01/13/2015 01:12 PM, Markos Chandras wrote:
> On 01/08/2015 12:17 PM, Paul Burton wrote:
>> Userland code may be built using an ABI which permits linking to objects
>> that have more restrictive floating point requirements. For example,
>> userland code may be built to target the O32 FPXX ABI. Such code may be
>> linked with other FPXX code, or code built for either one of the more
>> restrictive FP32 or FP64. When linking with more restrictive code, the
>> overall requirement of the process becomes that of the more restrictive
>> code. The kernel has no way to know in advance which mode the process
>> will need to be executed in, and indeed it may need to change during
>> execution. The dynamic loader is the only code which will know the
>> overall required mode, and so it needs to have a means to instruct the
>> kernel to switch the FP mode of the process.
>>
>> This patch introduces 2 new options to the prctl syscall which provide
>> such a capability. The FP mode of the process is represented as a
>> simple bitmask combining a number of mode bits mirroring those present
>> in the hardware. Userland can either retrieve the current FP mode of
>> the process:
>>
>> mode = prctl(PR_GET_FP_MODE);
>> [...]
>> +int mips_set_process_fp_mode(struct task_struct *task, unsigned int value)
>> +{
>> + const unsigned int known_bits = PR_FP_MODE_FR | PR_FP_MODE_FRE;
>> + unsigned long switch_count;
>> + struct task_struct *t;
>> +
>> + /* Check the value is valid */
>> + if (value & ~known_bits)
>> + return -EOPNOTSUPP;
>> +
>> + /* Avoid inadvertently triggering emulation */
>> + if ((value & PR_FP_MODE_FR) && cpu_has_fpu &&
>> + !(current_cpu_data.fpu_id & MIPS_FPIR_F64))
>> + return -EOPNOTSUPP;
>> + if ((value & PR_FP_MODE_FRE) && !cpu_has_fre)
>> + return -EOPNOTSUPP;
>> +
Hi Paul,
Do you think you can address this[1] suggestion by Matthew in this patch
since this hasn't been merged yet? Thanks
[1] http://www.linux-mips.org/archives/linux-mips/2015-01/msg00265.html
--
markos
WARNING: multiple messages have this Message-ID (diff)
From: Markos Chandras <Markos.Chandras@imgtec.com>
To: Paul Burton <paul.burton@imgtec.com>, linux-mips@linux-mips.org
Cc: Matthew Fortune <matthew.fortune@imgtec.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-api@vger.kernel.org
Subject: Re: [PATCH] MIPS,prctl: add PR_[GS]ET_FP_MODE prctl options for MIPS
Date: Fri, 16 Jan 2015 15:43:52 +0000 [thread overview]
Message-ID: <54B931B8.5050903@imgtec.com> (raw)
Message-ID: <20150116154352.Q9yydCbUGSceQDHPq7oAizf8Hb393PPGhKKVL5OjwCc@z> (raw)
In-Reply-To: <54B519B6.5040604@imgtec.com>
On 01/13/2015 01:12 PM, Markos Chandras wrote:
> On 01/08/2015 12:17 PM, Paul Burton wrote:
>> Userland code may be built using an ABI which permits linking to objects
>> that have more restrictive floating point requirements. For example,
>> userland code may be built to target the O32 FPXX ABI. Such code may be
>> linked with other FPXX code, or code built for either one of the more
>> restrictive FP32 or FP64. When linking with more restrictive code, the
>> overall requirement of the process becomes that of the more restrictive
>> code. The kernel has no way to know in advance which mode the process
>> will need to be executed in, and indeed it may need to change during
>> execution. The dynamic loader is the only code which will know the
>> overall required mode, and so it needs to have a means to instruct the
>> kernel to switch the FP mode of the process.
>>
>> This patch introduces 2 new options to the prctl syscall which provide
>> such a capability. The FP mode of the process is represented as a
>> simple bitmask combining a number of mode bits mirroring those present
>> in the hardware. Userland can either retrieve the current FP mode of
>> the process:
>>
>> mode = prctl(PR_GET_FP_MODE);
>> [...]
>> +int mips_set_process_fp_mode(struct task_struct *task, unsigned int value)
>> +{
>> + const unsigned int known_bits = PR_FP_MODE_FR | PR_FP_MODE_FRE;
>> + unsigned long switch_count;
>> + struct task_struct *t;
>> +
>> + /* Check the value is valid */
>> + if (value & ~known_bits)
>> + return -EOPNOTSUPP;
>> +
>> + /* Avoid inadvertently triggering emulation */
>> + if ((value & PR_FP_MODE_FR) && cpu_has_fpu &&
>> + !(current_cpu_data.fpu_id & MIPS_FPIR_F64))
>> + return -EOPNOTSUPP;
>> + if ((value & PR_FP_MODE_FRE) && !cpu_has_fre)
>> + return -EOPNOTSUPP;
>> +
Hi Paul,
Do you think you can address this[1] suggestion by Matthew in this patch
since this hasn't been merged yet? Thanks
[1] http://www.linux-mips.org/archives/linux-mips/2015-01/msg00265.html
--
markos
next prev parent reply other threads:[~2015-01-16 15:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-08 12:17 [PATCH] MIPS,prctl: add PR_[GS]ET_FP_MODE prctl options for MIPS Paul Burton
2015-01-08 12:17 ` Paul Burton
2015-01-08 12:54 ` Matthew Fortune
2015-01-09 2:25 ` Leonid Yegoshin
2015-01-09 2:25 ` Leonid Yegoshin
2015-01-09 8:34 ` Matthew Fortune
2015-01-09 18:42 ` Leonid Yegoshin
[not found] ` <54B024AA.1020400@imgtec.com>
2015-01-09 21:25 ` Matthew Fortune
2015-01-09 21:25 ` Matthew Fortune
2015-01-13 13:12 ` [PATCH] " Markos Chandras
2015-01-13 13:12 ` Markos Chandras
2015-01-16 15:43 ` Markos Chandras [this message]
2015-01-16 15:43 ` Markos Chandras
2015-01-18 21:47 ` Paul Burton
2015-01-18 21:47 ` 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=54B931B8.5050903@imgtec.com \
--to=markos.chandras@imgtec.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=matthew.fortune@imgtec.com \
--cc=paul.burton@imgtec.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox