From: Jisheng Zhang <jszhang@kernel.org>
To: Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Charlie Jenkins <charlie@rivosinc.com>,
Deepak Gupta <debug@rivosinc.com>,
Clement Leger <cleger@rivosinc.com>
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/7] riscv: convert bottom half of exception handling to C
Date: Sun, 21 Jul 2024 01:12:25 +0800 [thread overview]
Message-ID: <20240720171232.1753-1-jszhang@kernel.org> (raw)
For readability, maintainability and future scalability, convert the
bottom half of the exception handling to C.
During the conversion, I found Anton fixed a performance issue[1]
and my patches will touch the same exception asm code, so this series
is applied against Anton's patch.
patch1 and patch2 are cleanup patches.
patch3~patch7 do the conversion and some cleanup/optimization
after conversion.
Mostly the assembly code is converted to C in a relatively
straightforward manner.
However, there are two modifications I need to mention:
1. the cause I.E the CSR_CAUSE value is passed to do_traps() via. 2nd
param, do_traps() doesn't get it from pt_regs because this way an extra
memory load is needed, the exception handling sits in hot code path,
every instruction matters.
2.To cope with SIFIVE_CIP_453 errata, it looks like we don't need
alternative mechanism any more after the asm->c conversion. Just
replace the excp_vect_table two entries.
Link: https://lore.kernel.org/linux-riscv/20240607061335.2197383-1-cyrilbur@tenstorrent.com/ [1]
since v1:
- add two clean up patches
- remove the two patches which fix imbalance in RAS, instead, explicitly
mark this series is applied against one of them.
- save cause in pt_regs prior to calling do_traps()
- do more clean up and optimization after the asm->c conversion:
staticalize and mark do_irq() as __always_inline.
Jisheng Zhang (7):
riscv: traps: staticalize handle_break()
riscv: traps: remove __visible annotation
riscv: convert bottom half of exception handling to C
riscv: errata: remove ALT_INSN_FAULT and ALT_PAGE_FAULT
riscv: errata: sifive: remove NOMMU handling
riscv: staticalize and remove asmlinkage from updated functions
riscv: traps: mark do_irq() as __always_inline
arch/riscv/errata/sifive/errata.c | 25 +++++++---
arch/riscv/errata/sifive/errata_cip_453.S | 4 --
arch/riscv/include/asm/asm-prototypes.h | 20 +-------
arch/riscv/include/asm/entry-common.h | 1 -
arch/riscv/include/asm/errata_list.h | 21 ++-------
arch/riscv/kernel/entry.S | 57 +----------------------
arch/riscv/kernel/kernel_mode_vector.c | 2 +-
arch/riscv/kernel/traps.c | 55 ++++++++++++++++++----
8 files changed, 73 insertions(+), 112 deletions(-)
--
2.43.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Jisheng Zhang <jszhang@kernel.org>
To: Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Charlie Jenkins <charlie@rivosinc.com>,
Deepak Gupta <debug@rivosinc.com>,
Clement Leger <cleger@rivosinc.com>
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/7] riscv: convert bottom half of exception handling to C
Date: Sun, 21 Jul 2024 01:12:25 +0800 [thread overview]
Message-ID: <20240720171232.1753-1-jszhang@kernel.org> (raw)
For readability, maintainability and future scalability, convert the
bottom half of the exception handling to C.
During the conversion, I found Anton fixed a performance issue[1]
and my patches will touch the same exception asm code, so this series
is applied against Anton's patch.
patch1 and patch2 are cleanup patches.
patch3~patch7 do the conversion and some cleanup/optimization
after conversion.
Mostly the assembly code is converted to C in a relatively
straightforward manner.
However, there are two modifications I need to mention:
1. the cause I.E the CSR_CAUSE value is passed to do_traps() via. 2nd
param, do_traps() doesn't get it from pt_regs because this way an extra
memory load is needed, the exception handling sits in hot code path,
every instruction matters.
2.To cope with SIFIVE_CIP_453 errata, it looks like we don't need
alternative mechanism any more after the asm->c conversion. Just
replace the excp_vect_table two entries.
Link: https://lore.kernel.org/linux-riscv/20240607061335.2197383-1-cyrilbur@tenstorrent.com/ [1]
since v1:
- add two clean up patches
- remove the two patches which fix imbalance in RAS, instead, explicitly
mark this series is applied against one of them.
- save cause in pt_regs prior to calling do_traps()
- do more clean up and optimization after the asm->c conversion:
staticalize and mark do_irq() as __always_inline.
Jisheng Zhang (7):
riscv: traps: staticalize handle_break()
riscv: traps: remove __visible annotation
riscv: convert bottom half of exception handling to C
riscv: errata: remove ALT_INSN_FAULT and ALT_PAGE_FAULT
riscv: errata: sifive: remove NOMMU handling
riscv: staticalize and remove asmlinkage from updated functions
riscv: traps: mark do_irq() as __always_inline
arch/riscv/errata/sifive/errata.c | 25 +++++++---
arch/riscv/errata/sifive/errata_cip_453.S | 4 --
arch/riscv/include/asm/asm-prototypes.h | 20 +-------
arch/riscv/include/asm/entry-common.h | 1 -
arch/riscv/include/asm/errata_list.h | 21 ++-------
arch/riscv/kernel/entry.S | 57 +----------------------
arch/riscv/kernel/kernel_mode_vector.c | 2 +-
arch/riscv/kernel/traps.c | 55 ++++++++++++++++++----
8 files changed, 73 insertions(+), 112 deletions(-)
--
2.43.0
next reply other threads:[~2024-07-20 17:27 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-20 17:12 Jisheng Zhang [this message]
2024-07-20 17:12 ` [PATCH v2 0/7] riscv: convert bottom half of exception handling to C Jisheng Zhang
2024-07-20 17:12 ` [PATCH v2 1/7] riscv: traps: staticalize handle_break() Jisheng Zhang
2024-07-20 17:12 ` Jisheng Zhang
2024-07-20 17:12 ` [PATCH v2 2/7] riscv: traps: remove __visible annotation Jisheng Zhang
2024-07-20 17:12 ` Jisheng Zhang
2024-07-20 17:12 ` [PATCH v2 3/7] riscv: convert bottom half of exception handling to C Jisheng Zhang
2024-07-20 17:12 ` Jisheng Zhang
2024-11-26 0:08 ` Deepak Gupta
2024-11-26 0:08 ` Deepak Gupta
2024-07-20 17:12 ` [PATCH v2 4/7] riscv: errata: remove ALT_INSN_FAULT and ALT_PAGE_FAULT Jisheng Zhang
2024-07-20 17:12 ` Jisheng Zhang
2024-07-20 17:12 ` [PATCH v2 5/7] riscv: errata: sifive: remove NOMMU handling Jisheng Zhang
2024-07-20 17:12 ` Jisheng Zhang
2024-07-20 17:12 ` [PATCH v2 6/7] riscv: staticalize and remove asmlinkage from updated functions Jisheng Zhang
2024-07-20 17:12 ` Jisheng Zhang
2024-07-20 17:12 ` [PATCH v2 7/7] riscv: traps: mark do_irq() as __always_inline Jisheng Zhang
2024-07-20 17:12 ` Jisheng Zhang
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=20240720171232.1753-1-jszhang@kernel.org \
--to=jszhang@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=charlie@rivosinc.com \
--cc=cleger@rivosinc.com \
--cc=debug@rivosinc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.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 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.