mailing list of musl libc
 help / color / Atom feed
* [musl] musl support riscv32
@ 2020-03-12 11:09 chengzhiwei (C)
  2020-03-12 13:57 ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: chengzhiwei (C) @ 2020-03-12 11:09 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1016 bytes --]

Hi, all:
Recently, we did a survey about musl lib supported by the target of riscv. As we know,  musl-riscv64 was released last year, it's a great job:
https://git.musl-libc.org/cgit/musl/commit/?id=0a48860c27a8eb291bcc7616ea9eb073dc660cab

But we want to know when musl will suoport riscv-32 target and be released in the community based on the latest version?
From the community, we found that the previous branch version supported 32 bits backend,
https://github.com/riscv/riscv-musl/tree/riscv-musl-1.1.18
https://github.com/riscv/riscv-musl/tree/riscv-musl-1.1.20
I guess there are still lots of tests to be done for stability reasons. Next release can support riscv-32 target?

Maybe it's not an easy job about atomic operation.  If the version support date is uncertain, can you share some solutions to circumvent it?
Our team is also considering the possibility of implementing the functionality in C code, could you give us some suggestions?

Hope your response!

All the best,
--zhiwei


[-- Attachment #2: Type: text/html, Size: 4363 bytes --]

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

* Re: [musl] musl support riscv32
  2020-03-12 11:09 [musl] musl support riscv32 chengzhiwei (C)
@ 2020-03-12 13:57 ` Rich Felker
  2020-03-13  2:05   ` [musl] 答复: " chengzhiwei (C)
       [not found]   ` <202003130543.02D5h9Zk085624@ATCSQR.andestech.com>
  0 siblings, 2 replies; 6+ messages in thread
From: Rich Felker @ 2020-03-12 13:57 UTC (permalink / raw)
  To: musl

On Thu, Mar 12, 2020 at 11:09:37AM +0000, chengzhiwei (C) wrote:
> Hi, all:
> Recently, we did a survey about musl lib supported by the target of riscv. As we know,  musl-riscv64 was released last year, it's a great job:
> https://git.musl-libc.org/cgit/musl/commit/?id=0a48860c27a8eb291bcc7616ea9eb073dc660cab
> 
> But we want to know when musl will suoport riscv-32 target and be released in the community based on the latest version?
> From the community, we found that the previous branch version supported 32 bits backend,
> https://github.com/riscv/riscv-musl/tree/riscv-musl-1.1.18
> https://github.com/riscv/riscv-musl/tree/riscv-musl-1.1.20
> I guess there are still lots of tests to be done for stability reasons. Next release can support riscv-32 target?
> 
> Maybe it's not an easy job about atomic operation.  If the version support date is uncertain, can you share some solutions to circumvent it?
> Our team is also considering the possibility of implementing the functionality in C code, could you give us some suggestions?
> 
> Hope your response!

The main blocker for riscv32 has been that the kernel has not declared
it a stable ABI yet. At the time it was first proposed, there were
still problems related to it being a 32-bit arch with no legacy 32-bit
time_t syscalls, but that's not an issue now. I'd be happy to look at
an updated riscv32 port now (ideally based on what's upstram in musl
for riscv64, converted to 32-bit, rather than the old proposal, since
lots of bugs were fixed after it was merged) and hopefully convince
Linus/kernel ppl to consider it stabilized on the basis that there's a
libc ready to use it.

Rich

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

* [musl] 答复: [musl] musl support riscv32
  2020-03-12 13:57 ` Rich Felker
@ 2020-03-13  2:05   ` " chengzhiwei (C)
  2020-03-13  2:13     ` Rich Felker
       [not found]   ` <202003130543.02D5h9Zk085624@ATCSQR.andestech.com>
  1 sibling, 1 reply; 6+ messages in thread
From: chengzhiwei (C) @ 2020-03-13  2:05 UTC (permalink / raw)
  To: musl; +Cc: liuyingying (F)

Thanks, Hopefully I am! 

Another thing is about atomic operation(if 32-bit based on what's upstram in musl for riscv64), musl's atomic operation for riscv64 is a handwritten assembly version, but some RISCV-V MCU omit such instructions LR/SC specified in the A standard extension.
Someone do related work to support processors without atomic instructions? Or considering the possibility of implementing the functionality in C code.

zhiwei 

-----邮件原件-----
发件人: Rich Felker [mailto:dalias@libc.org] 
发送时间: 2020年3月12日 21:57
收件人: musl@lists.openwall.com
主题: Re: [musl] musl support riscv32

On Thu, Mar 12, 2020 at 11:09:37AM +0000, chengzhiwei (C) wrote:
> Hi, all:
> Recently, we did a survey about musl lib supported by the target of riscv. As we know,  musl-riscv64 was released last year, it's a great job:
> https://git.musl-libc.org/cgit/musl/commit/?id=0a48860c27a8eb291bcc761
> 6ea9eb073dc660cab
> 
> But we want to know when musl will suoport riscv-32 target and be released in the community based on the latest version?
> From the community, we found that the previous branch version 
> supported 32 bits backend,
> https://github.com/riscv/riscv-musl/tree/riscv-musl-1.1.18
> https://github.com/riscv/riscv-musl/tree/riscv-musl-1.1.20
> I guess there are still lots of tests to be done for stability reasons. Next release can support riscv-32 target?
> 
> Maybe it's not an easy job about atomic operation.  If the version support date is uncertain, can you share some solutions to circumvent it?
> Our team is also considering the possibility of implementing the functionality in C code, could you give us some suggestions?
> 
> Hope your response!

The main blocker for riscv32 has been that the kernel has not declared it a stable ABI yet. At the time it was first proposed, there were still problems related to it being a 32-bit arch with no legacy 32-bit time_t syscalls, but that's not an issue now. I'd be happy to look at an updated riscv32 port now (ideally based on what's upstram in musl for riscv64, converted to 32-bit, rather than the old proposal, since lots of bugs were fixed after it was merged) and hopefully convince Linus/kernel ppl to consider it stabilized on the basis that there's a libc ready to use it.

Rich

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

* Re: [musl] 答复: [musl] musl support riscv32
  2020-03-13  2:05   ` [musl] 答复: " chengzhiwei (C)
@ 2020-03-13  2:13     ` Rich Felker
  0 siblings, 0 replies; 6+ messages in thread
From: Rich Felker @ 2020-03-13  2:13 UTC (permalink / raw)
  To: musl

On Fri, Mar 13, 2020 at 02:05:09AM +0000, chengzhiwei (C) wrote:
> Thanks, Hopefully I am! 
> 
> Another thing is about atomic operation(if 32-bit based on what's
> upstram in musl for riscv64), musl's atomic operation for riscv64 is
> a handwritten assembly version, but some RISCV-V MCU omit such
> instructions LR/SC specified in the A standard extension. Someone do
> related work to support processors without atomic instructions? Or
> considering the possibility of implementing the functionality in C
> code.

If the hardware lacks them the kernel needs to trap and emulate, or
provide some other mechanism (like kuser_helper on old ARM). There's
no way to have a working implementation without compare-and-swap.

I've said many times that it's ridiculous that RISC-V made them
optional. For a single-core CPU LR/SC are trivial to implement. LR
just sets a flag and all interrupts clear the flag. SC stores only if
the flag is set.

Rich

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

* Re: [musl]  musl support riscv32
       [not found]   ` <202003130543.02D5h9Zk085624@ATCSQR.andestech.com>
@ 2020-03-13  6:02     ` Ruinland ChuanTzu Tsai
  2020-03-13 14:05       ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: Ruinland ChuanTzu Tsai @ 2020-03-13  6:02 UTC (permalink / raw)
  To: musl; +Cc: wangtc

Hi zhiwei all,

We (Andes Technology) have been porting Drew and others' work on musl for RV32 to 1.2.0.
For now it can boot a busybox based RV32 Linux successfully and it passed most of the libc-test cases.
Further verification on our inhouse port is undergoing.


I think that wrapping atomic handling (e.g. LR/SC pair) is viable yet might need more discussion about the design.
My colleague Simon is also in the CC list, so if zhiwei has interets about customizing such parts.
We might work out together.

By the way, there are some interesting work trying to add A extension without LR/SC to wimpy softcores.
Such as Princeton's OpenPiton :
https://github.com/PrincetonUniversity/openpiton/commit/3f8ba2600fb36032ddb9510c862e53c5bcf963fc#diff-3199fa5f89bf3b9db625bd88a6a6b8c6

Best regards,
Ruinland

On Fri, Mar 13, 2020 at 02:05:09AM +0000, chengzhiwei (C) wrote:
> Thanks, Hopefully I am! 
> 
> Another thing is about atomic operation(if 32-bit based on what's upstram in musl for riscv64), musl's atomic operation for riscv64 is a handwritten assembly version, but some RISCV-V MCU omit such instructions LR/SC specified in the A standard extension.
> Someone do related work to support processors without atomic instructions? Or considering the possibility of implementing the functionality in C code.
> 
> zhiwei 
> 
> -----邮件原件-----
> 发件人: Rich Felker [mailto:dalias@libc.org] 
> 发送时间: 2020年3月12日 21:57
> 收件人: musl@lists.openwall.com
> 主题: Re: [musl] musl support riscv32
> 
> On Thu, Mar 12, 2020 at 11:09:37AM +0000, chengzhiwei (C) wrote:
> > Hi, all:
> > Recently, we did a survey about musl lib supported by the target of riscv. As we know,  musl-riscv64 was released last year, it's a great job:
> > https://git.musl-libc.org/cgit/musl/commit/?id=0a48860c27a8eb291bcc761
> > 6ea9eb073dc660cab
> > 
> > But we want to know when musl will suoport riscv-32 target and be released in the community based on the latest version?
> > From the community, we found that the previous branch version 
> > supported 32 bits backend,
> > https://github.com/riscv/riscv-musl/tree/riscv-musl-1.1.18
> > https://github.com/riscv/riscv-musl/tree/riscv-musl-1.1.20
> > I guess there are still lots of tests to be done for stability reasons. Next release can support riscv-32 target?
> > 
> > Maybe it's not an easy job about atomic operation.  If the version support date is uncertain, can you share some solutions to circumvent it?
> > Our team is also considering the possibility of implementing the functionality in C code, could you give us some suggestions?
> > 
> > Hope your response!
> 
> The main blocker for riscv32 has been that the kernel has not declared it a stable ABI yet. At the time it was first proposed, there were still problems related to it being a 32-bit arch with no legacy 32-bit time_t syscalls, but that's not an issue now. I'd be happy to look at an updated riscv32 port now (ideally based on what's upstram in musl for riscv64, converted to 32-bit, rather than the old proposal, since lots of bugs were fixed after it was merged) and hopefully convince Linus/kernel ppl to consider it stabilized on the basis that there's a libc ready to use it.
> 
> Rich

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

* Re: [musl]  musl support riscv32
  2020-03-13  6:02     ` Ruinland ChuanTzu Tsai
@ 2020-03-13 14:05       ` Rich Felker
  0 siblings, 0 replies; 6+ messages in thread
From: Rich Felker @ 2020-03-13 14:05 UTC (permalink / raw)
  To: Ruinland ChuanTzu Tsai; +Cc: musl, wangtc

On Fri, Mar 13, 2020 at 02:02:41PM +0800, Ruinland ChuanTzu Tsai wrote:
> Hi zhiwei all,
> 
> We (Andes Technology) have been porting Drew and others' work on musl for RV32 to 1.2.0.
> For now it can boot a busybox based RV32 Linux successfully and it passed most of the libc-test cases.
> Further verification on our inhouse port is undergoing.
> 
> 
> I think that wrapping atomic handling (e.g. LR/SC pair) is viable yet might need more discussion about the design.
> My colleague Simon is also in the CC list, so if zhiwei has interets about customizing such parts.
> We might work out together.
> 
> By the way, there are some interesting work trying to add A extension without LR/SC to wimpy softcores.
> Such as Princeton's OpenPiton :
> https://github.com/PrincetonUniversity/openpiton/commit/3f8ba2600fb36032ddb9510c862e53c5bcf963fc#diff-3199fa5f89bf3b9db625bd88a6a6b8c6

Is there a reason they're not just implementing LR/SC for "wimpy
softcores"? As long as you're not doing SMP it admits a trivial
implementation, and it's much easier than doing the other A
extensions which require support for instructions that can both load
and store (which impacts the kind of pipeline architectures you can
do, or requires support for microcoded instructions).

Rich



> On Fri, Mar 13, 2020 at 02:05:09AM +0000, chengzhiwei (C) wrote:
> > Thanks, Hopefully I am! 
> > 
> > Another thing is about atomic operation(if 32-bit based on what's upstram in musl for riscv64), musl's atomic operation for riscv64 is a handwritten assembly version, but some RISCV-V MCU omit such instructions LR/SC specified in the A standard extension.
> > Someone do related work to support processors without atomic instructions? Or considering the possibility of implementing the functionality in C code.
> > 
> > zhiwei 
> > 
> > -----邮件原件-----
> > 发件人: Rich Felker [mailto:dalias@libc.org] 
> > 发送时间: 2020年3月12日 21:57
> > 收件人: musl@lists.openwall.com
> > 主题: Re: [musl] musl support riscv32
> > 
> > On Thu, Mar 12, 2020 at 11:09:37AM +0000, chengzhiwei (C) wrote:
> > > Hi, all:
> > > Recently, we did a survey about musl lib supported by the target of riscv. As we know,  musl-riscv64 was released last year, it's a great job:
> > > https://git.musl-libc.org/cgit/musl/commit/?id=0a48860c27a8eb291bcc761
> > > 6ea9eb073dc660cab
> > > 
> > > But we want to know when musl will suoport riscv-32 target and be released in the community based on the latest version?
> > > From the community, we found that the previous branch version 
> > > supported 32 bits backend,
> > > https://github.com/riscv/riscv-musl/tree/riscv-musl-1.1.18
> > > https://github.com/riscv/riscv-musl/tree/riscv-musl-1.1.20
> > > I guess there are still lots of tests to be done for stability reasons. Next release can support riscv-32 target?
> > > 
> > > Maybe it's not an easy job about atomic operation.  If the version support date is uncertain, can you share some solutions to circumvent it?
> > > Our team is also considering the possibility of implementing the functionality in C code, could you give us some suggestions?
> > > 
> > > Hope your response!
> > 
> > The main blocker for riscv32 has been that the kernel has not declared it a stable ABI yet. At the time it was first proposed, there were still problems related to it being a 32-bit arch with no legacy 32-bit time_t syscalls, but that's not an issue now. I'd be happy to look at an updated riscv32 port now (ideally based on what's upstram in musl for riscv64, converted to 32-bit, rather than the old proposal, since lots of bugs were fixed after it was merged) and hopefully convince Linus/kernel ppl to consider it stabilized on the basis that there's a libc ready to use it.
> > 
> > Rich

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

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-12 11:09 [musl] musl support riscv32 chengzhiwei (C)
2020-03-12 13:57 ` Rich Felker
2020-03-13  2:05   ` [musl] 答复: " chengzhiwei (C)
2020-03-13  2:13     ` Rich Felker
     [not found]   ` <202003130543.02D5h9Zk085624@ATCSQR.andestech.com>
2020-03-13  6:02     ` Ruinland ChuanTzu Tsai
2020-03-13 14:05       ` Rich Felker

mailing list of musl libc

Archives are clonable: git clone --mirror http://inbox.vuxu.org/musl

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.musl


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git