All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Burton <paul.burton@imgtec.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	"linux-mips@linux-mips.org" <linux-mips@linux-mips.org>
Subject: Re: R2300 (not the hay baler)
Date: Tue, 19 Nov 2013 12:59:31 +0000	[thread overview]
Message-ID: <528B60B3.6030406@imgtec.com> (raw)
In-Reply-To: <alpine.LFD.2.03.1311191156570.3267@linux-mips.org>

On 19/11/13 12:27, Maciej W. Rozycki wrote:
> On Tue, 19 Nov 2013, Paul Burton wrote:
>
>> Does anyone still care about the R2300? I ask because I'm working on
>> the FP context switching code & noticed that I'm pretty sure the
>> fpu_save_single & fpu_restore_single macros used only from
>> r2300_switch.S are broken. They store each 32 bit value at the start
>> of the location of the 64 bit FP registers context in memory, which I
>> believe:
>>
>> 1) Won't work for odd indexed FP registers with the FPU emulator,
>>     ptrace or other code which assumes that 32 bit FP data is held in
>>     the even-indexed 64 bit FP register context.
>>
>> 2) On big endian systems the 32 bit values will get saved to the most
>>     significant bits of the 64 bit context which I imagine will cause
>>     yet more problems.
>>
>> It seems like the only changes to r2300_switch.S for a *long* time have
>> been to keep it in sync with r4k_switch.S & the CPU is old enough that
>> all I get when I google for it is information about some hay baler.
>>
>> In short: does anyone care if I just submit a patch removing the R2300
>> code instead of blindly attempting to fix it up?
>
>   Well, it worked the last time I tried (a couple of weeks ago) with actual
> hardware (an R3400 integrated CPU/FPU), though maybe I missed something.
> There hasn't been a lot of R2000/R3000-class hardware development recently
> so no surprise our code didn't need any changes to match hardware updates.
> At this point I see no reason to retire this code, there's nothing wrong
> with it.  If there's an actual bug, then it should be fixed.  A test case
> should be easy to make, and then we can start from there.
>

Yup that's fine, I'm not trying to scrap working code I just didn't
realise this code was still in use (which is why I asked about it). I
saw that the r2300_switch.S code seems to differ from the r4k_switch.S
code in its storage of 32 bit FP context & assumed that the older code
was less used & thus likely the incorrect one. It seems that assumption
was incorrect given the ABI expected by userland which you point out
below.

This does differ from the context layout the FPU emulator expects, but
I suppose that's not an issue.

>   If you are concerned about register layout in ptrace packets, then please
> see mips_read_fp_register_single and mips_read_fp_register_double in GDB
> sources and the comment above them; notice the register buffer offset of 4
> applied in the big-endian case -- what r2300_switch.S does is exactly what
> the userland expects (of course it might be that r4k_switch.S is wrong in
> some cases; actually I remember a discussion with Ralf where we came to
> this very conclusion and rather than converting r4k_switch.S to use
> LWC1/SWC1 -- that would degrade performance a bit for FP context switches
> -- considered a helper to convert between the internal and the ptrace
> format).
>
>    Maciej
>

Do you know what happened to that or have a link to that discussion? I
don't see that conversion being done at the moment, which makes me
suspect that the kernel might handle ptrace incorrectly (arguably
more nicely, but still incorrectly) for mips32 tasks with FR=0 on an
R4K class CPU. I'll have a look.

Thanks,
     Paul

  reply	other threads:[~2013-11-19 13:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-19 11:07 R2300 (not the hay baler) Paul Burton
2013-11-19 11:21 ` Ralf Baechle
2013-11-19 11:31   ` Paul Burton
2013-11-19 12:27 ` Maciej W. Rozycki
2013-11-19 12:59   ` Paul Burton [this message]
2013-11-21 19:52     ` Maciej W. Rozycki
2013-11-21 22:43       ` Ralf Baechle
2013-11-22  0:32         ` Maciej W. Rozycki
2013-11-27 17:11       ` Paul Burton
2013-12-03 16:49         ` MASS MAILING: " Paul Burton
2013-11-19 13:09 ` Ralf Baechle

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=528B60B3.6030406@imgtec.com \
    --to=paul.burton@imgtec.com \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@linux-mips.org \
    --cc=ralf@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 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.