mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: inaky.perez-gonzalez@intel.com
To: linux-kernel@vger.kernel.org
Cc: inaky.perez-gonzalez@intel.com, robustmutexes@lists.osdl.org
Subject: [RFC/PATCH] FUSYN 3/10: Support for i386
Date: Wed, 14 Jan 2004 14:50:01 -0800	[thread overview]
Message-ID: <0401141450.RcyaPdRdEcCb6bPcedXbgbQaHdHbcbOc9031@intel.com> (raw)
In-Reply-To: <0401141449.dbBcncYdzckbldFceb8bkcYaHaIc2aoc9031@intel.com>

 arch/i386/kernel/entry.S  |    5 +++
 include/asm-i386/fulock.h |   70 ++++++++++++++++++++++++++++++++++++++++++++++
 include/asm-i386/unistd.h |    7 +++-
 3 files changed, 81 insertions(+), 1 deletion(-)

--- linux/arch/i386/kernel/entry.S:1.1.1.10	Tue Jan 13 21:13:29 2004
+++ linux/arch/i386/kernel/entry.S	Wed Jan 14 11:11:48 2004
@@ -1048,5 +1048,10 @@
 	.long sys_utimes
  	.long sys_fadvise64_64
 	.long sys_ni_syscall	/* sys_vserver */
+	.long sys_ufulock_lock
+	.long sys_ufulock_unlock	/* 275 */
+	.long sys_ufulock_consistency
+	.long sys_ufuqueue_wait        
+	.long sys_ufuqueue_wake	     /* 278 */
 
 syscall_table_size=(.-sys_call_table)
--- /dev/null	Wed Jan 14 14:39:30 2004
+++ linux/include/asm-i386/fulock.h	Wed Jan  7 12:46:28 2004
@@ -0,0 +1,70 @@
+
+/*
+ * Fast User real-time/pi/pp/robust/deadlock SYNchronization
+ * (C) 2002-2003 Intel Corp
+ * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>.
+ *
+ * Licensed under the FSF's GNU Public License v2 or later.
+ *
+ * Based on normal futexes (futex.c), (C) Rusty Russell.
+ * Please refer to Documentation/fusyn.txt for more info.
+ */
+
+#ifndef __asm_i386_fulock_h__
+#define __asm_i386_fulock_h__
+
+    /* fulock value / state; anything that is not this is a PID that
+     * currently owns the fulock. */
+
+enum vfulock {
+	VFULOCK_UNLOCKED  = 0x00000000,	/* Unlocked */
+	VFULOCK_HEALTHY   = VFULOCK_UNLOCKED, /* KCO mode: the lock is healthy */
+	VFULOCK_KCO	  = 0xfffffffd,	/* kernel controls ownership */
+	VFULOCK_DEAD	  = 0xfffffffe,	/* dead, kernel controls ownership */
+	VFULOCK_NR	  = 0xffffffff	/* fulock is not-recoverable */
+};
+
+
+#ifdef __KERNEL__
+
+/**
+ * [User usable] Atomic compare and swap.
+ *
+ * Used for locking a vfulock.
+ *
+ * @value     Pointer to the value to compare and swap.
+ * @old_value Value that *value has to have for the swap to occur.
+ * @new_value New value to set it *value == old_value.
+ * @return    !0 if the swap succeeded. 0 if failed.
+ */
+static inline
+unsigned vfulock_acas (volatile unsigned *value,
+		       unsigned old_value, unsigned new_value)
+{
+	unsigned result;
+	asm __volatile__ (
+		"lock cmpxchg %3, %1"
+		: "=a" (result), "+m" ((*value))
+		: "a" (old_value), "r" (new_value)
+		: "memory");
+	return result == old_value;
+}
+
+
+/**
+ * Set an ufulock's associated value.
+ *
+ * @vfulock: Pointer to the address of the ufulock to contain for.
+ * @value:    New value to assign.
+ *
+ * Wrapper for arch-specific idiosyncrasies when setting a value that
+ * is shared across different address mappings.
+ */
+static inline
+void vfulock_set (volatile unsigned *vfulock, unsigned value)
+{
+	*vfulock = value;
+}
+
+#endif /* #ifdef __KERNEL__ */
+#endif /* #ifndef __asm_i386_fulock_h__ */
--- linux/include/asm-i386/unistd.h:1.1.1.5	Mon Oct 20 13:55:33 2003
+++ linux/include/asm-i386/unistd.h	Fri Nov 21 13:26:01 2003
@@ -279,8 +279,13 @@
 #define __NR_utimes		271
 #define __NR_fadvise64_64	272
 #define __NR_vserver		273
+#define __NR_ufulock_lock	274
+#define __NR_ufulock_unlock	275
+#define __NR_ufulock_consistency	276
+#define __NR_ufuqueue_wait	277
+#define __NR_ufuqueue_wake	278
 
-#define NR_syscalls 274
+#define NR_syscalls 279
 
 /* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
 

  reply	other threads:[~2004-01-14 22:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-14 22:49 [RFC/PATCH] FUSYN Realtime & Robust mutexes for Linux try 2.1 inaky.perez-gonzalez
2004-01-14 22:49 ` [RFC/PATCH] FUSYN 1/10: documentation files inaky.perez-gonzalez
2004-01-14 22:49   ` [RFC/PATCH] FUSYN 2/10: modifications to the core inaky.perez-gonzalez
2004-01-14 22:50     ` inaky.perez-gonzalez [this message]
2004-01-14 22:50       ` [RFC/PATCH] FUSYN 4/10: Support for ia64 inaky.perez-gonzalez
2004-01-14 22:50         ` [RFC/PATCH] FUSYN 5/10: kernel fuqueues inaky.perez-gonzalez
2004-01-14 22:50           ` [RFC/PATCH] FUSYN 6/10: user space/kernel space tracker inaky.perez-gonzalez
2004-01-14 22:50             ` [RFC/PATCH] FUSYN 7/10: user space fuqueues inaky.perez-gonzalez
2004-01-14 22:50               ` [RFC/PATCH] FUSYN 8/10: kernel fulocks inaky.perez-gonzalez
2004-01-14 22:50                 ` [RFC/PATCH] FUSYN 9/10: stub for priority protection inaky.perez-gonzalez
2004-01-14 22:50                   ` [RFC/PATCH] FUSYN 10/10: user space fulocks inaky.perez-gonzalez
2004-01-15  1:12 ` [RFC/PATCH] FUSYN Realtime & Robust mutexes for Linux try 2.1 Bernhard Kuhn
  -- strict thread matches above, loose matches on Subject: below --
2003-12-03  8:51 [RFC/PATCH] FUSYN 2/10: modifications to the core inaky.perez-gonzalez
2003-12-03  8:51 ` [RFC/PATCH] FUSYN 3/10: Support for i386 inaky.perez-gonzalez

Reply instructions:

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

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

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0401141450.RcyaPdRdEcCb6bPcedXbgbQaHdHbcbOc9031@intel.com \
    --to=inaky.perez-gonzalez@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robustmutexes@lists.osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®