All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anshuman Khandual <khandual@linux.vnet.ibm.com>
To: Benjamin Herrenschmidt <benh@au1.ibm.com>
Cc: linuxppc-dev@ozlabs.org, Jeremy Kerr <jk@ozlabs.org>
Subject: Re: [RFC PATCH 1/2] powerpc: Add a proper syscall for switching endianness
Date: Wed, 11 Mar 2015 12:02:15 +0530	[thread overview]
Message-ID: <54FFE16F.5050106@linux.vnet.ibm.com> (raw)
In-Reply-To: <1426052605.17565.21.camel@au1.ibm.com>

On 03/11/2015 11:13 AM, Benjamin Herrenschmidt wrote:
> On Wed, 2015-03-11 at 11:08 +0530, Anshuman Khandual wrote:
>> On 03/10/2015 04:25 PM, Michael Ellerman wrote:
>>> On Tue, 2015-03-10 at 20:34 +1100, Benjamin Herrenschmidt wrote:
>>>> On Tue, 2015-03-10 at 18:36 +1100, Michael Ellerman wrote:
>>>>> We currently have a "special" syscall for switching endianness. This is
>>>>> syscall number 0x1ebe, which is handled explicitly in the 64-bit syscall
>>>>> exception entry.
>>>>>
>>>>> That has a few problems, firstly the syscall number is outside of the
>>>>> usual range, which confuses various tools. For example strace doesn't
>>>>> recognise the syscalls at all.
>>>>>
>>>>> Secondly it's handled explicitly as a special case in the syscall
>>>>> exception entry, which is complicated enough without it.
>>>>>
>>>>> As a first step toward removing the special syscall, we need to add a
>>>>> regular syscall that implements the same functionality.
>>>>>
>>>>> The logic is simple, it simply toggles the MSR_LE bit in the userspace
>>>>> MSR. This is the same as the special syscall, with the caveat that the
>>>>> special syscall clobbers fewer registers.
>>>>
>>>> You can set _TIF_RESTOREALL to force a restore of all the registers on
>>>> the way back which should do the job.
>>>
>>> Right, I'd forgotten we talked about that.
>>>
>>> I'll try that tomorrow.
>>
>> The test fails when we add set_thread_flag(TIF_RESTOREALL) after the MSR flip.
>> Though the test passes with the original patch.
> 
> We also need to wrap the syscall like we do for fork() etc... to
> save_nvgpr's.

Yeah right, replacing SYSCALL(switch_endian) with PPC_SYS(switch_endian)
in systbl.h does the trick and the test passes again.

      reply	other threads:[~2015-03-11  6:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10  7:36 [RFC PATCH 1/2] powerpc: Add a proper syscall for switching endianness Michael Ellerman
2015-03-10  7:36 ` [RFC PATCH 2/2] selftests/powerpc: Add a test of the switch_endian() syscall Michael Ellerman
2015-03-10  9:34 ` [RFC PATCH 1/2] powerpc: Add a proper syscall for switching endianness Benjamin Herrenschmidt
2015-03-10 10:55   ` Michael Ellerman
2015-03-11  5:38     ` Anshuman Khandual
2015-03-11  5:43       ` Benjamin Herrenschmidt
2015-03-11  6:32         ` Anshuman Khandual [this message]

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=54FFE16F.5050106@linux.vnet.ibm.com \
    --to=khandual@linux.vnet.ibm.com \
    --cc=benh@au1.ibm.com \
    --cc=jk@ozlabs.org \
    --cc=linuxppc-dev@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 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.