linux-um archives
 help / color / mirror / Atom feed
From: anton.ivanov@cambridgegreys.com
To: linux-um@lists.infradead.org
Cc: richard@nod.at, Anton Ivanov <anton.ivanov@cambridgegreys.com>
Subject: [PATCH] um: "borrow" cmpxchg from x86 tree in UML
Date: Fri, 13 Nov 2020 11:54:37 +0000	[thread overview]
Message-ID: <20201113115437.14325-1-anton.ivanov@cambridgegreys.com> (raw)

From: Anton Ivanov <anton.ivanov@cambridgegreys.com>

UML was falling back to asm-generic cmpxchg which emulates atomic
behaviour by turning irqs on/off. On UML this means turning
on/off signals for each cmpxchg which is expensive.

Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
---
 arch/um/include/asm/cmpxchg-x86.h |  1 +
 arch/um/include/asm/cmpxchg.h     | 13 +++++++++++++
 arch/um/include/asm/cmpxchg_32.h  |  1 +
 arch/um/include/asm/cmpxchg_64.h  |  1 +
 4 files changed, 16 insertions(+)
 create mode 120000 arch/um/include/asm/cmpxchg-x86.h
 create mode 100644 arch/um/include/asm/cmpxchg.h
 create mode 120000 arch/um/include/asm/cmpxchg_32.h
 create mode 120000 arch/um/include/asm/cmpxchg_64.h

diff --git a/arch/um/include/asm/cmpxchg-x86.h b/arch/um/include/asm/cmpxchg-x86.h
new file mode 120000
index 000000000000..a5c607edde88
--- /dev/null
+++ b/arch/um/include/asm/cmpxchg-x86.h
@@ -0,0 +1 @@
+../../../x86/include/asm/cmpxchg.h
\ No newline at end of file
diff --git a/arch/um/include/asm/cmpxchg.h b/arch/um/include/asm/cmpxchg.h
new file mode 100644
index 000000000000..c9367b37d925
--- /dev/null
+++ b/arch/um/include/asm/cmpxchg.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_UM_CMPXCHG_H
+#define _ASM_UM_CMPXCHG_H
+
+#ifdef CONFIG_64BIT
+#undef CONFIG_X86_32
+#else
+#define CONFIG_X86_32 1
+#endif
+
+#include <asm/cmpxchg-x86.h>
+
+#endif
diff --git a/arch/um/include/asm/cmpxchg_32.h b/arch/um/include/asm/cmpxchg_32.h
new file mode 120000
index 000000000000..1f360d0a9fa9
--- /dev/null
+++ b/arch/um/include/asm/cmpxchg_32.h
@@ -0,0 +1 @@
+../../../x86/include/asm/cmpxchg_32.h
\ No newline at end of file
diff --git a/arch/um/include/asm/cmpxchg_64.h b/arch/um/include/asm/cmpxchg_64.h
new file mode 120000
index 000000000000..bc09ae22b0cb
--- /dev/null
+++ b/arch/um/include/asm/cmpxchg_64.h
@@ -0,0 +1 @@
+../../../x86/include/asm/cmpxchg_64.h
\ No newline at end of file
-- 
2.20.1


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


             reply	other threads:[~2020-11-13 11:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13 11:54 anton.ivanov [this message]
2020-11-13 13:48 ` [PATCH] um: "borrow" cmpxchg from x86 tree in UML Anton Ivanov
2020-11-13 15:58   ` Johannes Berg
2020-11-13 17:50     ` Anton Ivanov
2020-11-13 20:21       ` Johannes Berg
2020-11-13 21:41         ` Anton Ivanov
2020-11-16 14:41     ` Anton Ivanov

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=20201113115437.14325-1-anton.ivanov@cambridgegreys.com \
    --to=anton.ivanov@cambridgegreys.com \
    --cc=linux-um@lists.infradead.org \
    --cc=richard@nod.at \
    /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