From: Yasha Cherikovsky <yasha.che3@gmail.com>
To: Paul Burton <paul.burton@mips.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
James Hogan <jhogan@kernel.org>,
"linux-mips@linux-mips.org" <linux-mips@linux-mips.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] MIPS: Add new Kconfig variable to avoid unaligned access instructions
Date: Tue, 25 Sep 2018 22:30:52 +0300 [thread overview]
Message-ID: <fc0016b8c3d08fc139356c39668c6ab5d8c297fd.camel@gmail.com> (raw)
In-Reply-To: <20180925174510.rg3j4lfmwvlecnqt@pburton-laptop>
Hi Paul,
On Tue, 2018-09-25 at 17:45 +0000, Paul Burton wrote:
> Hi Yasha,
>
> On Thu, Sep 20, 2018 at 08:03:06PM +0300, Yasha Cherikovsky wrote:
> > MIPSR6 doesn't support unaligned access instructions (lwl, lwr,
> > swl, swr).
> > The MIPS tree has some special cases to avoid these instructions,
> > and currently the code is testing for CONFIG_CPU_MIPSR6.
> >
> > Declare a new Kconfig variable:
> > CONFIG_CPU_HAS_NO_UNALIGNED_LOAD_STORE,
> > and make CONFIG_CPU_MIPSR6 select it.
> > And switch all the special cases to test for the new variable.
> >
> > Also, the new variable selects CONFIG_GENERIC_CSUM, to use
> > generic C checksum code (to avoid special assembly code that uses
> > the unsupported instructions).
>
> Thanks for your patch :)
>
> I think it would be cleaner to invert this logic & instead have the
> Kconfig entry indicate when kernel's build target *does* support the
> [ls]w[lr] instructions.
>
> It would be good for the name to be clear that these instructions are
> what it's about too - "unaligned load store" is a little too vague
> for
> my liking. For example one could easily misconstrue it to mean
> something
> akin to the inverse of CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS,
> whereas
> in the MIPSr6 case many CPUs actually handle unaligned accesses in
> hardware when using the regular load/store instructions. They don't
> have
> the [ls]w[lr] instructions, but they don't need them because they
> handle
> unaligned accesses more naturally without needing us to be explicit
> about them.
>
> How about we:
>
> - Add a Kconfig option CONFIG_CPU_SUPPORTS_LOAD_STORE_LR, and
> select
> it for all existing pre-r6 targets (probably from CONFIG_CPU_*).
>
> - Change CONFIG_GENERIC_CSUM to default y if
> !CONFIG_CPU_SUPPORTS_LOAD_STORE_LR, and drop the selects of it.
>
> That would avoid the double-negative ("if we don't not support this")
> that the #ifndef's currently represent. It would also mean any future
> architecture/ISA targets beyond MIPSr6 automatically avoid the
> instructions.
>
> Thanks,
> Paul
Thanks for your feedback, I'll start preparing v2.
Looking in arch/mips/Kconfig, some CPU options start
with CPU_SUPPORTS_ and some with CPU_HAS_.
Which perfix should we use here?
Thanks,
Yasha
next prev parent reply other threads:[~2018-09-25 19:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-20 17:03 [PATCH 0/1] MIPS: Lexra CPU support, prerequisite patch Yasha Cherikovsky
2018-09-20 17:03 ` [PATCH 1/1] MIPS: Add new Kconfig variable to avoid unaligned access instructions Yasha Cherikovsky
2018-09-25 17:45 ` Paul Burton
2018-09-25 19:30 ` Yasha Cherikovsky [this message]
2018-09-25 19:57 ` Paul Burton
2018-09-25 20:12 ` Yasha Cherikovsky
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=fc0016b8c3d08fc139356c39668c6ab5d8c297fd.camel@gmail.com \
--to=yasha.che3@gmail.com \
--cc=jhogan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=paul.burton@mips.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®