[PATCH] Native spinlock support on RISC-V

From: Marek Szuba <marecki(at)gentoo(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] Native spinlock support on RISC-V
Date: 2021-08-13 11:54:52
Message-ID: dea97b6d-f55f-1f6d-9109-504aa7dfa421@gentoo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

The attached patch adds native spinlock support to PostgreSQL on RISC-V
systems. As suspected by Richard W.M. Jones of Red Hat back in 2016, the
__sync_lock_test_and_set() approach applied on arm and arm64 works here
as well.

Tested against PostgreSQL 13.3 on a physical rv64gc system (BeagleV
Starlight beta board) - builds and installs fine, all tests pass. From
what I can see in gcc documentation this should in theory work on rv32
(and possibly rv128) as well, therefore the patch as it stands covers
all RISC-V systems (i.e. doesn't check the value of __risc_xlen) - but I
haven't confirmed this experimentally.

--
MS

Attachment Content-Type Size
postgresql-riscv-spinlocks.patch text/x-patch 966 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2021-08-13 12:14:31 Re: Bug in huge simplehash
Previous Message Yura Sokolov 2021-08-13 11:40:08 Re: Bug in huge simplehash