linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] riscv: force hart_lottery to put in .sdata section
@ 2020-02-04 11:19 Zong Li
  2020-02-04 11:39 ` Anup Patel
  2020-02-10  6:42 ` Alex Ghiti
  0 siblings, 2 replies; 6+ messages in thread
From: Zong Li @ 2020-02-04 11:19 UTC (permalink / raw)
  To: paul.walmsley, palmer, aou, linux-riscv, linux-kernel; +Cc: Zong Li

In PIC code model, the zero initialized data always be put in .bss
section, so when building kernel as PIE, the hart_lottery won't present
in small data section, and it causes more than one harts to get the
lottery, because the main hart clears the content of .bss section
immediately after it getting the lottery.

Signed-off-by: Zong Li <zong.li@sifive.com>
---
 arch/riscv/kernel/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index 22b671dbbcf1..45c63dc06360 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -40,7 +40,7 @@ struct screen_info screen_info = {
 #endif
 
 /* The lucky hart to first increment this variable will boot the other cores */
-atomic_t hart_lottery;
+atomic_t hart_lottery __section(.sdata);
 unsigned long boot_cpu_hartid;
 
 void __init parse_dtb(void)
-- 
2.25.0



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

end of thread, other threads:[~2020-02-19  8:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 11:19 [PATCH] riscv: force hart_lottery to put in .sdata section Zong Li
2020-02-04 11:39 ` Anup Patel
2020-02-05 11:07   ` Zong Li
2020-02-18 21:26     ` Palmer Dabbelt
2020-02-19  8:48       ` Zong Li
2020-02-10  6:42 ` Alex Ghiti

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).