linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Errors and segmentation fault while building Golang on Kernel after v5.4-rc3
@ 2020-01-31 13:14 Carlos Eduardo de Paula
  2020-01-31 13:32 ` David Abdurachmanov
  0 siblings, 1 reply; 12+ messages in thread
From: Carlos Eduardo de Paula @ 2020-01-31 13:14 UTC (permalink / raw)
  To: linux-riscv, David Abdurachmanov, Palmer Dabbelt, Paul Walmsley,
	Joel Sing

Golang has been recently upstreamed and I've been building multiple
versions on my Unleashed board successfully with kernel 5.3-rc4 and
previous.

I noticed that after I updated my Kernel from v5.3-rc4 to v5.5-rc5,
Golang doesn't build anymore failing on multiple points and
segfaulting as well.

I've captured a few logs with the error building here:

I've bisected the versions between v5.4-rc3 and v5.4 and it pointed
out that the commit below is the starting point.

eb93685847a9055283d05951c1b205e737f38533 is the first bad commit
commit eb93685847a9055283d05951c1b205e737f38533
Author: Paul Walmsley <paul.walmsley@sifive.com>
Date: Wed Aug 7 19:07:34 2019 -0700

riscv: fix flush_tlb_range() end address for flush_tlb_page()

The RISC-V kernel implementation of flush_tlb_page() when CONFIG_SMP
is set is wrong. It passes zero to flush_tlb_range() as the final
address to flush, but it should be at least 'addr'.

Some other Linux architecture ports use the beginning address to
flush, plus PAGE_SIZE, as the final address to flush. This might
flush slightly more than what's needed, but it seems unlikely that
being more clever would improve anything. So let's just take that
implementation for now.

While here, convert the macro into a static inline function, primarily
to avoid unintentional multiple evaluations of 'addr'.

This second version of the patch fixes a coding style issue found by
Christoph Hellwig <hch@lst.de>.

Reported-by: Andreas Schwab <schwab@suse.de>
Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>

:040000 040000 1a4ee20b3614c93de2a925bba2df6f2e1518f227
6b4ffd3e1a2245912cf734a8a3f61db7eb0ccd67 M arch

> git bisect visualize
eb93685 N 6 months ago Paul ..riscv: fix flush_tlb_range() end address
for flush_tlb_page() HEAD, refs/bisect/bad


> git diff eb93685^!

```diff
diff --git a/arch/riscv/include/asm/tlbflush.h
b/arch/riscv/include/asm/tlbflush.h
index 687dd19..4d9bbe8 100644
--- a/arch/riscv/include/asm/tlbflush.h
+++ b/arch/riscv/include/asm/tlbflush.h
@@ -53,10 +53,17 @@ static inline void remote_sfence_vma(struct
cpumask *cmask, unsigned long start,
}

#define flush_tlb_all() sbi_remote_sfence_vma(NULL, 0, -1)
-#define flush_tlb_page(vma, addr) flush_tlb_range(vma, addr, 0)
+
#define flush_tlb_range(vma, start, end) \
remote_sfence_vma(mm_cpumask((vma)->vm_mm), start, (end) - (start))
-#define flush_tlb_mm(mm) \
+
+static inline void flush_tlb_page(struct vm_area_struct *vma,
+ unsigned long addr)
+{
+ flush_tlb_range(vma, addr, addr + PAGE_SIZE);
+}
+
+#define flush_tlb_mm(mm) \
remote_sfence_vma(mm_cpumask(mm), 0, -1)

#endif /* CONFIG_SMP */
```

I was not able to revert this change from recent v5.5.0 so I don't
know if this is the problem or some close commits:

> git log 2b245b8b..2f478b60 |grep riscv
2f478b6 N 6 months ago Linus..Merge tag 'riscv/for-v5.3-rc5' of
git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
69703eb N 6 months ago Vince..riscv: Make __fstate_clean() work correctly.
8ac71d7 N 6 months ago Vince..riscv: Correct the initialized flow of FP register
eb93685 N 6 months ago Paul ..riscv: fix flush_tlb_range() end address
for flush_tlb_page()

Carlos
-- 
________________________________________
Carlos Eduardo de Paula
me@carlosedp.com
http://carlosedp.com
http://twitter.com/carlosedp
Linkedin
________________________________________


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-03-13 17:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-31 13:14 Errors and segmentation fault while building Golang on Kernel after v5.4-rc3 Carlos Eduardo de Paula
2020-01-31 13:32 ` David Abdurachmanov
2020-01-31 14:20   ` Carlos Eduardo de Paula
2020-01-31 16:32     ` Carlos Eduardo de Paula
2020-02-01  4:58       ` Atish Patra
2020-02-01  5:08         ` William Grant
2020-02-01 18:58           ` Carlos Eduardo de Paula
2020-02-01 23:37             ` William Grant
2020-02-02 12:30               ` Atish Patra
2020-02-03 15:06                 ` Carlos Eduardo de Paula
     [not found]                   ` <CADnnUqeBrJ9MwwDTY2rBkboAJHSwivuZ_Rk69C0sNGSRw1UR3Q@mail.gmail.com>
     [not found]                     ` <CAPSAq_wVVvBAo184tYa0V7e8KoFRJMQULA7jYW=Lu=Wgbipx2A@mail.gmail.com>
2020-03-13 17:55                       ` Carlos Eduardo de Paula
2020-02-13  2:02         ` Paul Walmsley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).