All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiuyang Liu <liu@jiuyang.me>
To: Jisheng Zhang <Jisheng.Zhang@synaptics.com>, Alex Ghiti <alex@ghiti.fr>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
	Andrew Waterman <waterman@eecs.berkeley.edu>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] implement flush_cache_vmap for RISC-V
Date: Wed, 14 Apr 2021 09:16:34 +0000	[thread overview]
Message-ID: <9908880.BHKHtspdbC@nuc> (raw)
In-Reply-To: <18d198ac-7bc0-934d-e1e9-eca01b790d61@ghiti.fr>

On Wednesday, April 14, 2021 7:03:13 AM UTC you wrote:
> Hi,
> 
> Le 4/12/21 à 3:08 AM, Jisheng Zhang a écrit :
> > Hi Jiuyang,
> > 
> > On Mon, 12 Apr 2021 00:05:30 +0000 Jiuyang Liu <liu@jiuyang.me> wrote:
> >> This patch implements flush_cache_vmap for RISC-V, since it modifies PTE.
> >> Without this patch, SFENCE.VMA won't be added to related codes, which
> >> might introduce a bug in the out-of-order micro-architecture
> >> implementations.
> >> 
> >> Signed-off-by: Jiuyang Liu <liu@jiuyang.me>
> >> Reviewed-by: Alexandre Ghiti <alex@ghiti.fr>
> >> Reviewed-by: Palmer Dabbelt <palmer@dabbelt.com>
> > 
> > IIRC, Palmer hasn't given this Reviewed-by tag.
> > 
> >> ---
> > 
> > Could you plz add version and changes? IIRC, this is the v3.
> > 
> >>   arch/riscv/include/asm/cacheflush.h | 6 ++++++
> >>   1 file changed, 6 insertions(+)
> >> 
> >> diff --git a/arch/riscv/include/asm/cacheflush.h
> >> b/arch/riscv/include/asm/cacheflush.h index 23ff70350992..3fd528badc35
> >> 100644
> >> --- a/arch/riscv/include/asm/cacheflush.h
> >> +++ b/arch/riscv/include/asm/cacheflush.h
> >> @@ -30,6 +30,12 @@ static inline void flush_dcache_page(struct page
> >> *page)
> >> 
> >>   #define flush_icache_user_page(vma, pg, addr, len) \
> >>   
> >>          flush_icache_mm(vma->vm_mm, 0)
> >> 
> >> +/*
> >> + * flush_cache_vmap is invoked after map_kernel_range() has installed
> >> the page + * table entries, which modifies PTE, SFENCE.VMA should be
> >> inserted.> 
> > Just my humble opinion, flush_cache_vmap() may not be necessary.
> > vmalloc_fault can take care of this, and finally sfence.vma is inserted
> > in related path.
> I believe Palmer and Jisheng are right, my initial proposal to implement
> flush_cache_vmap is wrong.
> 
> But then, Jiuyang should not have noticed any problem here, so what's
> wrong? @Jiuyang: Does implementing flush_cache_vmap fix your issue?
Yes, I just checked this today, it did fix our issue.
But I'm happy to rework on this, thanks for your help! This week I will try to 
trace wave of our core, and give a more detail email then.
> And regarding flush_cache_vunmap, from Jisheng call stack, it seems also
> not necessary.
> 
> @Jiuyang: Can you tell us more about what you noticed?
> 
> > Regards
> > 
> >> + */
> >> +#define flush_cache_vmap(start, end) flush_tlb_all()
> >> +
> >> 
> >>   #ifndef CONFIG_SMP
> >>   
> >>   #define flush_icache_all() local_flush_icache_all()
> >> 
> >> --
> >> 2.31.1
> > 
> > _______________________________________________
> > linux-riscv mailing list
> > linux-riscv@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-riscv

Thanks,
Jiuyang



WARNING: multiple messages have this Message-ID (diff)
From: Jiuyang Liu <liu@jiuyang.me>
To: Jisheng Zhang <Jisheng.Zhang@synaptics.com>, Alex Ghiti <alex@ghiti.fr>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
	Andrew Waterman <waterman@eecs.berkeley.edu>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] implement flush_cache_vmap for RISC-V
Date: Wed, 14 Apr 2021 09:16:34 +0000	[thread overview]
Message-ID: <9908880.BHKHtspdbC@nuc> (raw)
In-Reply-To: <18d198ac-7bc0-934d-e1e9-eca01b790d61@ghiti.fr>

On Wednesday, April 14, 2021 7:03:13 AM UTC you wrote:
> Hi,
> 
> Le 4/12/21 à 3:08 AM, Jisheng Zhang a écrit :
> > Hi Jiuyang,
> > 
> > On Mon, 12 Apr 2021 00:05:30 +0000 Jiuyang Liu <liu@jiuyang.me> wrote:
> >> This patch implements flush_cache_vmap for RISC-V, since it modifies PTE.
> >> Without this patch, SFENCE.VMA won't be added to related codes, which
> >> might introduce a bug in the out-of-order micro-architecture
> >> implementations.
> >> 
> >> Signed-off-by: Jiuyang Liu <liu@jiuyang.me>
> >> Reviewed-by: Alexandre Ghiti <alex@ghiti.fr>
> >> Reviewed-by: Palmer Dabbelt <palmer@dabbelt.com>
> > 
> > IIRC, Palmer hasn't given this Reviewed-by tag.
> > 
> >> ---
> > 
> > Could you plz add version and changes? IIRC, this is the v3.
> > 
> >>   arch/riscv/include/asm/cacheflush.h | 6 ++++++
> >>   1 file changed, 6 insertions(+)
> >> 
> >> diff --git a/arch/riscv/include/asm/cacheflush.h
> >> b/arch/riscv/include/asm/cacheflush.h index 23ff70350992..3fd528badc35
> >> 100644
> >> --- a/arch/riscv/include/asm/cacheflush.h
> >> +++ b/arch/riscv/include/asm/cacheflush.h
> >> @@ -30,6 +30,12 @@ static inline void flush_dcache_page(struct page
> >> *page)
> >> 
> >>   #define flush_icache_user_page(vma, pg, addr, len) \
> >>   
> >>          flush_icache_mm(vma->vm_mm, 0)
> >> 
> >> +/*
> >> + * flush_cache_vmap is invoked after map_kernel_range() has installed
> >> the page + * table entries, which modifies PTE, SFENCE.VMA should be
> >> inserted.> 
> > Just my humble opinion, flush_cache_vmap() may not be necessary.
> > vmalloc_fault can take care of this, and finally sfence.vma is inserted
> > in related path.
> I believe Palmer and Jisheng are right, my initial proposal to implement
> flush_cache_vmap is wrong.
> 
> But then, Jiuyang should not have noticed any problem here, so what's
> wrong? @Jiuyang: Does implementing flush_cache_vmap fix your issue?
Yes, I just checked this today, it did fix our issue.
But I'm happy to rework on this, thanks for your help! This week I will try to 
trace wave of our core, and give a more detail email then.
> And regarding flush_cache_vunmap, from Jisheng call stack, it seems also
> not necessary.
> 
> @Jiuyang: Can you tell us more about what you noticed?
> 
> > Regards
> > 
> >> + */
> >> +#define flush_cache_vmap(start, end) flush_tlb_all()
> >> +
> >> 
> >>   #ifndef CONFIG_SMP
> >>   
> >>   #define flush_icache_all() local_flush_icache_all()
> >> 
> >> --
> >> 2.31.1
> > 
> > _______________________________________________
> > linux-riscv mailing list
> > linux-riscv@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-riscv

Thanks,
Jiuyang



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2021-04-14  9:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12  0:05 [PATCH] implement flush_cache_vmap for RISC-V Jiuyang Liu
2021-04-12  0:05 ` Jiuyang Liu
2021-04-12  7:08 ` Jisheng Zhang
2021-04-12  7:08   ` Jisheng Zhang
2021-04-14  7:03   ` Alex Ghiti
2021-04-14  7:03     ` Alex Ghiti
2021-04-14  9:16     ` Jiuyang Liu [this message]
2021-04-14  9:16       ` Jiuyang Liu
2021-04-23  4:39     ` Palmer Dabbelt
2021-04-23  4:39       ` Palmer Dabbelt

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=9908880.BHKHtspdbC@nuc \
    --to=liu@jiuyang.me \
    --cc=Jisheng.Zhang@synaptics.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=waterman@eecs.berkeley.edu \
    /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.