pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: 吴亚飞 <wuyf41619@hundsun.com>
To: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Subject: spinlock support on loongarch64
Date: Wed, 2 Nov 2022 05:56:36 +0000
Message-ID: <761ac43d44b84d679ba803c2bd947cc0@HSMAILSVR04.hs.handsome.com.cn> (raw)

add spinlock support on loongarch64.


Attachments:

0001-spinlock-support-on-loongarch64.patch (application/octet-stream, 1.1K) download From 4af425ee79bfe02bc353d87c7cc49bdb9b6a2907 Mon Sep 17 00:00:00 2001 From: Yafei Wu <wuyf41619@hundsun.com> Date: Wed, 2 Nov 2022 13:47:52 +0800 Subject: [PATCH] spinlock support on loongarch64 --- src/include/storage/s_lock.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h index 4225d9b7fc..74aa1af80c 100644 --- a/src/include/storage/s_lock.h +++ b/src/include/storage/s_lock.h @@ -618,6 +618,27 @@ tas(volatile slock_t *lock) #endif /* __hppa || __hppa__ */ +/* + * On loongarch64, we use __sync_lock_test_and_set(int *, int) if available. + */ +#if defined(__loongarch64) +#ifdef HAVE_GCC__SYNC_INT32_TAS +#define HAS_TEST_AND_SET + +#define TAS(lock) tas(lock) + +typedef int slock_t; + +static __inline__ int +tas(volatile slock_t *lock) +{ + return __sync_lock_test_and_set(lock, 1); +} + +#define S_UNLOCK(lock) __sync_lock_release(lock) + +#endif /* HAVE_GCC__SYNC_INT32_TAS */ +#endif /* __loongarch64 */ /* * Default implementation of S_UNLOCK() for gcc/icc. -- 2.34.1

view thread (8+ messages)  latest in thread

Message-ID: <761ac43d44b84d679ba803c2bd947cc0@HSMAILSVR04.hs.handsome.com.cn>
Permalink:  ../761ac43d44b84d679ba803c2bd947cc0@HSMAILSVR04.hs.handsome.com.cn/
Also on:    postgresql.org/message-id/761ac43d44b84d679ba803c2bd947cc0@HSMAILSVR04.hs.handsome.com.cn

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: wuyf41619@hundsun.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: spinlock support on loongarch64
  In-Reply-To: <761ac43d44b84d679ba803c2bd947cc0@HSMAILSVR04.hs.handsome.com.cn>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox