riscv: enable EFFICIENT_UNALIGNED_ACCESS and DCACHE_WORD_ACCESS
Status from this message: This series was applied to riscv/linux.git (for-next)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest2 patches 2 repliesApplied 2/2
- v32 patches 1 replySuperseded
- v22 patches 8 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 2 patches | 2 replies | Superseded |
Changes in v4 from the cover letter
- adopt Eric's suggestions, such as better Kconfig help msg and so on.
Patches in v4 All 2 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | riscv: introduce RISCV_EFFICIENT_UNALIGNED_ACCESSarch/ arch/ | +15 | 2 replies | Applied |
| 2/2 | riscv: select DCACHE_WORD_ACCESS for efficient unaligned access HWarch/ arch/ arch/ +1 more | +74 | 0 replies | Applied |
Reviews trailers per patch
1 of 2 patches has a Reviewed-by or Acked-by.
| Patch | Charlie Jenkins | Eric Biggers |
|---|---|---|
| 1/2 | R-b | R-b |
| 2/2 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v4 0/2] riscv: enable EFFICIENT_UNALIGNED_ACCESS and DCACHE_WORD_ACCESS
Some riscv implementations such as T-HEAD's C906, C908, C910 and C920 support efficient unaligned access, for performance reason we want to enable HAVE_EFFICIENT_UNALIGNED_ACCESS on these platforms. To avoid performance regressions on non efficient unaligned access platforms, HAVE_EFFICIENT_UNALIGNED_ACCESS can't be globally selected.
To solve this problem, runtime code patching based on the detected speed is a good solution. But that's not easy, it involves lots of work to modify vairous subsystems such as net, mm, lib and so on. This can be done step by step.
So let's take an easier solution: add support to efficient unaligned access and hide the support under NONPORTABLE.
patch1 introduces RISCV_EFFICIENT_UNALIGNED_ACCESS which depends on NONPORTABLE, if users know during config time that the kernel will be only run on those efficient unaligned access hw platforms, they can enable it. Obviously, generic unified kernel Image shouldn't enable it.
patch2 adds support DCACHE_WORD_ACCESS when MMU and RISCV_EFFICIENT_UNALIGNED_ACCESS.
Below test program and step shows how much performance can be improved:
$ cat tt.c #include <sys/types.h> #include <sys/stat.h> #include <unistd.h>
#define ITERATIONS 1000000
#define PATH "123456781234567812345678123456781"
int main(void)
{
unsigned long i;
struct stat buf;
for (i = 0; i < ITERATIONS; i++)
stat(PATH, &buf);
return 0;}
$ gcc -O2 tt.c $ touch 123456781234567812345678123456781 $ time ./a.out
Per my test on T-HEAD C910 platforms, the above test performance is improved by about 7.5%.
Since v3:
- adopt Eric's suggestions, such as better Kconfig help msg and so on.
Since v2:
- Don't set "-mstrict-align" CFLAGS if HAVE_EFFICIENT_UNALIGNED_ACCESS
- collect Reviewed-by tag
Since v1:
- fix typo in commit msg
- fix build error if NOMMU
Jisheng Zhang (2):
riscv: introduce RISCV_EFFICIENT_UNALIGNED_ACCESS
riscv: select DCACHE_WORD_ACCESS for efficient unaligned access HW
arch/riscv/Kconfig | 14 +++++++++++ arch/riscv/Makefile | 2 ++ arch/riscv/include/asm/asm-extable.h | 15 ++++++++++++ arch/riscv/include/asm/word-at-a-time.h | 27 +++++++++++++++++++++ arch/riscv/mm/extable.c | 31 +++++++++++++++++++++++++ 5 files changed, 89 insertions(+)
Signature · 1 line
2.40.0