Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread LIU Zhiwei
On 2023/3/22 14:40, Wu, Fei wrote: On 3/22/2023 11:36 AM, Wu, Fei wrote: On 3/22/2023 11:31 AM, Richard Henderson wrote: On 3/21/23 19:47, Wu, Fei wrote: You should be making use of different softmmu indexes, similar to how ARM uses a separate index for PAN (privileged access never) mode.  I

Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread Wu, Fei
On 3/22/2023 11:36 AM, Wu, Fei wrote: > On 3/22/2023 11:31 AM, Richard Henderson wrote: >> On 3/21/23 19:47, Wu, Fei wrote: > You should be making use of different softmmu indexes, similar to how > ARM uses a separate index for PAN (privileged access never) mode.  If > I read the manual

Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread Wu, Fei
On 3/22/2023 11:31 AM, Richard Henderson wrote: > On 3/21/23 19:47, Wu, Fei wrote: You should be making use of different softmmu indexes, similar to how ARM uses a separate index for PAN (privileged access never) mode.  If I read the manual properly, PAN == !SUM. When you d

Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread Richard Henderson
On 3/21/23 19:47, Wu, Fei wrote: You should be making use of different softmmu indexes, similar to how ARM uses a separate index for PAN (privileged access never) mode.  If I read the manual properly, PAN == !SUM. When you do this, you need no additional flushing. Hi Fei, Let's follow Richard

Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread LIU Zhiwei
On 2023/3/22 10:47, Wu, Fei wrote: On 3/22/2023 9:58 AM, LIU Zhiwei wrote: On 2023/3/22 0:10, Richard Henderson wrote: On 3/20/23 23:37, fei2...@intel.com wrote: From: Fei Wu Kernel needs to access user mode memory e.g. during syscalls, the window is usually opened up for a very limited ti

Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread Wu, Fei
On 3/22/2023 9:58 AM, LIU Zhiwei wrote: > > On 2023/3/22 0:10, Richard Henderson wrote: >> On 3/20/23 23:37, fei2...@intel.com wrote: >>> From: Fei Wu >>> >>> Kernel needs to access user mode memory e.g. during syscalls, the window >>> is usually opened up for a very limited time through MSTATUS.

Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread LIU Zhiwei
On 2023/3/22 0:10, Richard Henderson wrote: On 3/20/23 23:37, fei2...@intel.com wrote: From: Fei Wu Kernel needs to access user mode memory e.g. during syscalls, the window is usually opened up for a very limited time through MSTATUS.SUM, the overhead is too much if tlb_flush() gets called f

Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread Richard Henderson
On 3/20/23 23:37, fei2...@intel.com wrote: From: Fei Wu Kernel needs to access user mode memory e.g. during syscalls, the window is usually opened up for a very limited time through MSTATUS.SUM, the overhead is too much if tlb_flush() gets called for every SUM change. This patch saves addresses

Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread liweiwei
On 2023/3/21 21:22, Wu, Fei wrote: On 3/21/2023 8:58 PM, liweiwei wrote: On 2023/3/21 14:37, fei2...@intel.com wrote: From: Fei Wu Kernel needs to access user mode memory e.g. during syscalls, the window is usually opened up for a very limited time through MSTATUS.SUM, the overhead is too m

Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread Wu, Fei
On 3/21/2023 8:58 PM, liweiwei wrote: > > On 2023/3/21 14:37, fei2...@intel.com wrote: >> From: Fei Wu >> >> Kernel needs to access user mode memory e.g. during syscalls, the window >> is usually opened up for a very limited time through MSTATUS.SUM, the >> overhead is too much if tlb_flush() get

Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread liweiwei
On 2023/3/21 14:37, fei2...@intel.com wrote: From: Fei Wu Kernel needs to access user mode memory e.g. during syscalls, the window is usually opened up for a very limited time through MSTATUS.SUM, the overhead is too much if tlb_flush() gets called for every SUM change. This patch saves addre

Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread liweiwei
On 2023/3/21 20:00, Wu, Fei wrote: On 3/21/2023 5:47 PM, liweiwei wrote: On 2023/3/21 17:14, Wu, Fei wrote: On 3/21/2023 4:50 PM, liweiwei wrote: On 2023/3/21 16:40, Wu, Fei wrote: On 3/21/2023 4:28 PM, liweiwei wrote: On 2023/3/21 14:37,fei2...@intel.com wrote: From: Fei Wu Kernel needs

Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread Wu, Fei
On 3/21/2023 5:47 PM, liweiwei wrote: > > On 2023/3/21 17:14, Wu, Fei wrote: >> On 3/21/2023 4:50 PM, liweiwei wrote: >>> On 2023/3/21 16:40, Wu, Fei wrote: On 3/21/2023 4:28 PM, liweiwei wrote: > On 2023/3/21 14:37, fei2...@intel.com wrote: >> From: Fei Wu >> >> Kernel needs

Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread liweiwei
On 2023/3/21 17:14, Wu, Fei wrote: On 3/21/2023 4:50 PM, liweiwei wrote: On 2023/3/21 16:40, Wu, Fei wrote: On 3/21/2023 4:28 PM, liweiwei wrote: On 2023/3/21 14:37, fei2...@intel.com wrote: From: Fei Wu Kernel needs to access user mode memory e.g. during syscalls, the window is usually o

Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread Wu, Fei
On 3/21/2023 4:50 PM, liweiwei wrote: > > On 2023/3/21 16:40, Wu, Fei wrote: >> On 3/21/2023 4:28 PM, liweiwei wrote: >>> On 2023/3/21 14:37, fei2...@intel.com wrote: From: Fei Wu Kernel needs to access user mode memory e.g. during syscalls, the window is usually opened u

Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread liweiwei
On 2023/3/21 16:40, Wu, Fei wrote: On 3/21/2023 4:28 PM, liweiwei wrote: On 2023/3/21 14:37, fei2...@intel.com wrote: From: Fei Wu Kernel needs to access user mode memory e.g. during syscalls, the window is usually opened up for a very limited time through MSTATUS.SUM, the overhead is too m

Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread Wu, Fei
On 3/21/2023 4:28 PM, liweiwei wrote: > > On 2023/3/21 14:37, fei2...@intel.com wrote: >> From: Fei Wu >> >> Kernel needs to access user mode memory e.g. during syscalls, the window >> is usually opened up for a very limited time through MSTATUS.SUM, the >> overhead is too much if tlb_flush() get

Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-21 Thread liweiwei
On 2023/3/21 14:37, fei2...@intel.com wrote: From: Fei Wu Kernel needs to access user mode memory e.g. during syscalls, the window is usually opened up for a very limited time through MSTATUS.SUM, the overhead is too much if tlb_flush() gets called for every SUM change. This patch saves addre

[PATCH] target/riscv: reduce overhead of MSTATUS_SUM change

2023-03-20 Thread fei2 . wu
From: Fei Wu Kernel needs to access user mode memory e.g. during syscalls, the window is usually opened up for a very limited time through MSTATUS.SUM, the overhead is too much if tlb_flush() gets called for every SUM change. This patch saves addresses accessed when SUM=1, and flushs only these p