All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] Linux Kernel Bug #32812 "ARCH=um, SUBARCH=i386: linking failure"
@ 2011-04-16 14:04 Martin Walch
  2011-04-16 15:09 ` richard -rw- weinberger
  2011-04-16 21:56 ` richard -rw- weinberger
  0 siblings, 2 replies; 6+ messages in thread
From: Martin Walch @ 2011-04-16 14:04 UTC (permalink / raw)
  To: user-mode-linux-devel

Hello UML maintainers,

I have run into a problem making a uml kernel for SUBARCH=i386 with support 
for XFS. This looks like a regression. Can you please take a look at

https://bugzilla.kernel.org/show_bug.cgi?id=32812

Thank you.

Martin Walch
-- 

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


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

* Re: [uml-devel] Linux Kernel Bug #32812 "ARCH=um, SUBARCH=i386: linking failure"
  2011-04-16 14:04 [uml-devel] Linux Kernel Bug #32812 "ARCH=um, SUBARCH=i386: linking failure" Martin Walch
@ 2011-04-16 15:09 ` richard -rw- weinberger
  2011-04-16 20:46   ` richard -rw- weinberger
  2011-04-16 21:56 ` richard -rw- weinberger
  1 sibling, 1 reply; 6+ messages in thread
From: richard -rw- weinberger @ 2011-04-16 15:09 UTC (permalink / raw)
  To: Martin Walch; +Cc: user-mode-linux-devel

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

Hi Martin,

On Sat, Apr 16, 2011 at 4:04 PM, Martin Walch <walch.martin@web.de> wrote:
> Hello UML maintainers,
>
> I have run into a problem making a uml kernel for SUBARCH=i386 with support
> for XFS. This looks like a regression. Can you please take a look at
>
> https://bugzilla.kernel.org/show_bug.cgi?id=32812

The cmpxchg8b_emu issue is already known and fixed.
See:
http://git.kernel.org/linus/084189a

For the atomic64_read_386 issue I've attached a patch.
WARING: It's only compile time tested. :)

Please apply both and retry.

Thanks,
//richard

> Thank you.
>
> Martin Walch
> --
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> User-mode-linux-devel mailing list
> User-mode-linux-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
>



-- 
Thanks,
//richard

[-- Attachment #2: disable_X86_CMPXCHG64.patch --]
[-- Type: text/x-patch, Size: 281 bytes --]

diff --git a/arch/um/Kconfig.x86 b/arch/um/Kconfig.x86
index a9da516..229c6f0 100644
--- a/arch/um/Kconfig.x86
+++ b/arch/um/Kconfig.x86
@@ -8,6 +8,10 @@ config CMPXCHG_LOCAL
 	bool
 	default n
 
+config X86_CMPXCHG64
+	bool
+	default n
+
 source "arch/x86/Kconfig.cpu"
 
 endmenu

[-- Attachment #3: Type: text/plain, Size: 438 bytes --]

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev

[-- Attachment #4: Type: text/plain, Size: 194 bytes --]

_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

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

* Re: [uml-devel] Linux Kernel Bug #32812 "ARCH=um, SUBARCH=i386: linking failure"
  2011-04-16 15:09 ` richard -rw- weinberger
@ 2011-04-16 20:46   ` richard -rw- weinberger
  0 siblings, 0 replies; 6+ messages in thread
From: richard -rw- weinberger @ 2011-04-16 20:46 UTC (permalink / raw)
  To: Martin Walch; +Cc: user-mode-linux-devel

On Sat, Apr 16, 2011 at 5:09 PM, richard -rw- weinberger
<richard.weinberger@gmail.com> wrote:
> Hi Martin,
>
> On Sat, Apr 16, 2011 at 4:04 PM, Martin Walch <walch.martin@web.de> wrote:
>> Hello UML maintainers,
>>
>> I have run into a problem making a uml kernel for SUBARCH=i386 with support
>> for XFS. This looks like a regression. Can you please take a look at
>>
>> https://bugzilla.kernel.org/show_bug.cgi?id=32812
>
> The cmpxchg8b_emu issue is already known and fixed.
> See:
> http://git.kernel.org/linus/084189a
>
> For the atomic64_read_386 issue I've attached a patch.
> WARING: It's only compile time tested. :)
>
> Please apply both and retry.

Forget the patch.
We need something better.
I'm working on it.

-- 
Thanks,
//richard

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


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

* Re: [uml-devel] Linux Kernel Bug #32812 "ARCH=um, SUBARCH=i386: linking failure"
  2011-04-16 14:04 [uml-devel] Linux Kernel Bug #32812 "ARCH=um, SUBARCH=i386: linking failure" Martin Walch
  2011-04-16 15:09 ` richard -rw- weinberger
@ 2011-04-16 21:56 ` richard -rw- weinberger
  2011-04-17 17:52   ` Martin Walch
  1 sibling, 1 reply; 6+ messages in thread
From: richard -rw- weinberger @ 2011-04-16 21:56 UTC (permalink / raw)
  To: Martin Walch; +Cc: user-mode-linux-devel

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

Martin,

On Sat, Apr 16, 2011 at 4:04 PM, Martin Walch <walch.martin@web.de> wrote:
> Hello UML maintainers,
>
> I have run into a problem making a uml kernel for SUBARCH=i386 with support
> for XFS. This looks like a regression. Can you please take a look at
>
> https://bugzilla.kernel.org/show_bug.cgi?id=32812
>
> Thank you.

Can you please test the attached patch?
Don't forget to apply http://git.kernel.org/linus/084189a in case you're
not using Linus' tree.

BTW: Please configure your kernel for a CPU newer than i486,
Pentium Pro would be a good choice. :-)

-- 
Thanks,
//richard

[-- Attachment #2: 0001-um-Add-support-for-64-bit-atomic-operations.patch --]
[-- Type: text/x-patch, Size: 4792 bytes --]

From 1eecac7ca6fb3824478c5ceb4929e0892b180115 Mon Sep 17 00:00:00 2001
From: Richard Weinberger <richard@nod.at>
Date: Sat, 16 Apr 2011 23:43:47 +0200
Subject: [PATCH] um: Add support for 64 bit atomic operations

This adds support for 64 bit atomic operations on
32 bit UML systems.

Reported-by: Martin Walch <walch.martin@web.de>
Signed-off-by: Richard Weinberger <richard@nod.at>
---
 arch/um/sys-i386/Makefile          |    2 +-
 arch/um/sys-i386/atomic64_cx8_32.S |  224 ++++++++++++++++++++++++++++++++++++
 2 files changed, 225 insertions(+), 1 deletions(-)
 create mode 100644 arch/um/sys-i386/atomic64_cx8_32.S

diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile
index 804b28d..b1da91c 100644
--- a/arch/um/sys-i386/Makefile
+++ b/arch/um/sys-i386/Makefile
@@ -4,7 +4,7 @@
 
 obj-y = bug.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
 	ptrace_user.o setjmp.o signal.o stub.o stub_segv.o syscalls.o sysrq.o \
-	sys_call_table.o tls.o
+	sys_call_table.o tls.o atomic64_cx8_32.o
 
 obj-$(CONFIG_BINFMT_ELF) += elfcore.o
 
diff --git a/arch/um/sys-i386/atomic64_cx8_32.S b/arch/um/sys-i386/atomic64_cx8_32.S
new file mode 100644
index 0000000..fb0ec26
--- /dev/null
+++ b/arch/um/sys-i386/atomic64_cx8_32.S
@@ -0,0 +1,224 @@
+/*
+ * atomic64_t for 586+
+ *
+ * Copyright © 2010  Luca Barbieri
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Copied from arch/x86/lib/atomic64_cx8_32.S
+ */
+
+#include <linux/linkage.h>
+#include <asm/alternative-asm.h>
+#include <asm/dwarf2.h>
+
+.macro SAVE reg
+	pushl_cfi %\reg
+	CFI_REL_OFFSET \reg, 0
+.endm
+
+.macro RESTORE reg
+	popl_cfi %\reg
+	CFI_RESTORE \reg
+.endm
+
+.macro read64 reg
+	movl %ebx, %eax
+	movl %ecx, %edx
+/* we need LOCK_PREFIX since otherwise cmpxchg8b always does the write */
+	LOCK_PREFIX
+	cmpxchg8b (\reg)
+.endm
+
+ENTRY(atomic64_read_cx8)
+	CFI_STARTPROC
+
+	read64 %ecx
+	ret
+	CFI_ENDPROC
+ENDPROC(atomic64_read_cx8)
+
+ENTRY(atomic64_set_cx8)
+	CFI_STARTPROC
+
+1:
+/* we don't need LOCK_PREFIX since aligned 64-bit writes
+ * are atomic on 586 and newer */
+	cmpxchg8b (%esi)
+	jne 1b
+
+	ret
+	CFI_ENDPROC
+ENDPROC(atomic64_set_cx8)
+
+ENTRY(atomic64_xchg_cx8)
+	CFI_STARTPROC
+
+	movl %ebx, %eax
+	movl %ecx, %edx
+1:
+	LOCK_PREFIX
+	cmpxchg8b (%esi)
+	jne 1b
+
+	ret
+	CFI_ENDPROC
+ENDPROC(atomic64_xchg_cx8)
+
+.macro addsub_return func ins insc
+ENTRY(atomic64_\func\()_return_cx8)
+	CFI_STARTPROC
+	SAVE ebp
+	SAVE ebx
+	SAVE esi
+	SAVE edi
+
+	movl %eax, %esi
+	movl %edx, %edi
+	movl %ecx, %ebp
+
+	read64 %ebp
+1:
+	movl %eax, %ebx
+	movl %edx, %ecx
+	\ins\()l %esi, %ebx
+	\insc\()l %edi, %ecx
+	LOCK_PREFIX
+	cmpxchg8b (%ebp)
+	jne 1b
+
+10:
+	movl %ebx, %eax
+	movl %ecx, %edx
+	RESTORE edi
+	RESTORE esi
+	RESTORE ebx
+	RESTORE ebp
+	ret
+	CFI_ENDPROC
+ENDPROC(atomic64_\func\()_return_cx8)
+.endm
+
+addsub_return add add adc
+addsub_return sub sub sbb
+
+.macro incdec_return func ins insc
+ENTRY(atomic64_\func\()_return_cx8)
+	CFI_STARTPROC
+	SAVE ebx
+
+	read64 %esi
+1:
+	movl %eax, %ebx
+	movl %edx, %ecx
+	\ins\()l $1, %ebx
+	\insc\()l $0, %ecx
+	LOCK_PREFIX
+	cmpxchg8b (%esi)
+	jne 1b
+
+10:
+	movl %ebx, %eax
+	movl %ecx, %edx
+	RESTORE ebx
+	ret
+	CFI_ENDPROC
+ENDPROC(atomic64_\func\()_return_cx8)
+.endm
+
+incdec_return inc add adc
+incdec_return dec sub sbb
+
+ENTRY(atomic64_dec_if_positive_cx8)
+	CFI_STARTPROC
+	SAVE ebx
+
+	read64 %esi
+1:
+	movl %eax, %ebx
+	movl %edx, %ecx
+	subl $1, %ebx
+	sbb $0, %ecx
+	js 2f
+	LOCK_PREFIX
+	cmpxchg8b (%esi)
+	jne 1b
+
+2:
+	movl %ebx, %eax
+	movl %ecx, %edx
+	RESTORE ebx
+	ret
+	CFI_ENDPROC
+ENDPROC(atomic64_dec_if_positive_cx8)
+
+ENTRY(atomic64_add_unless_cx8)
+	CFI_STARTPROC
+	SAVE ebp
+	SAVE ebx
+/* these just push these two parameters on the stack */
+	SAVE edi
+	SAVE esi
+
+	movl %ecx, %ebp
+	movl %eax, %esi
+	movl %edx, %edi
+
+	read64 %ebp
+1:
+	cmpl %eax, 0(%esp)
+	je 4f
+2:
+	movl %eax, %ebx
+	movl %edx, %ecx
+	addl %esi, %ebx
+	adcl %edi, %ecx
+	LOCK_PREFIX
+	cmpxchg8b (%ebp)
+	jne 1b
+
+	movl $1, %eax
+3:
+	addl $8, %esp
+	CFI_ADJUST_CFA_OFFSET -8
+	RESTORE ebx
+	RESTORE ebp
+	ret
+4:
+	cmpl %edx, 4(%esp)
+	jne 2b
+	xorl %eax, %eax
+	jmp 3b
+	CFI_ENDPROC
+ENDPROC(atomic64_add_unless_cx8)
+
+ENTRY(atomic64_inc_not_zero_cx8)
+	CFI_STARTPROC
+	SAVE ebx
+
+	read64 %esi
+1:
+	testl %eax, %eax
+	je 4f
+2:
+	movl %eax, %ebx
+	movl %edx, %ecx
+	addl $1, %ebx
+	adcl $0, %ecx
+	LOCK_PREFIX
+	cmpxchg8b (%esi)
+	jne 1b
+
+	movl $1, %eax
+3:
+	RESTORE ebx
+	ret
+4:
+	testl %edx, %edx
+	jne 2b
+	jmp 3b
+	CFI_ENDPROC
+ENDPROC(atomic64_inc_not_zero_cx8)
-- 
1.6.6.1


[-- Attachment #3: Type: text/plain, Size: 438 bytes --]

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev

[-- Attachment #4: Type: text/plain, Size: 194 bytes --]

_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

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

* Re: [uml-devel] Linux Kernel Bug #32812 "ARCH=um, SUBARCH=i386: linking failure"
  2011-04-16 21:56 ` richard -rw- weinberger
@ 2011-04-17 17:52   ` Martin Walch
  2011-04-17 19:34     ` richard -rw- weinberger
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Walch @ 2011-04-17 17:52 UTC (permalink / raw)
  To: richard -rw- weinberger; +Cc: user-mode-linux-devel

> Can you please test the attached patch?
> Don't forget to apply http://git.kernel.org/linus/084189a in case you're
> not using Linus' tree.

Works fine. At least make successfully creates a uml binary and I can create, 
mount and unmount an xfs file system. Creating and deleting a file also works 
fine.

I did not do any intensive testing as I am not going to use it now anyway, as 
hostfs has become the better choice. (Actually, I had already decided against 
xfs before reporting the bug.)

> BTW: Please configure your kernel for a CPU newer than i486,
> Pentium Pro would be a good choice. :-)

I never intended to actually use an i486 comaptible build. I will be using 
"Opteron/Athlon64/Hammer/K8". However, I wonder if there are any problems 
using i486 besides performance loss. Will this break things?

-- 

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


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

* Re: [uml-devel] Linux Kernel Bug #32812 "ARCH=um, SUBARCH=i386: linking failure"
  2011-04-17 17:52   ` Martin Walch
@ 2011-04-17 19:34     ` richard -rw- weinberger
  0 siblings, 0 replies; 6+ messages in thread
From: richard -rw- weinberger @ 2011-04-17 19:34 UTC (permalink / raw)
  To: Martin Walch; +Cc: user-mode-linux-devel

On Sun, Apr 17, 2011 at 7:52 PM, Martin Walch <walch.martin@web.de> wrote:
>> Can you please test the attached patch?
>> Don't forget to apply http://git.kernel.org/linus/084189a in case you're
>> not using Linus' tree.
>
> Works fine. At least make successfully creates a uml binary and I can create,
> mount and unmount an xfs file system. Creating and deleting a file also works
> fine.

Fine.

> I never intended to actually use an i486 comaptible build. I will be using
> "Opteron/Athlon64/Hammer/K8". However, I wonder if there are any problems
> using i486 besides performance loss. Will this break things?

XFS needs atomic 64 bit operations. To emulate them on 32 bit systems we need
the cmpxchg8b instruction.
Old CPUs don't offer this instruction. So we would have to emulate
cmpxchg8b too.
For now UML does not have a cmpxchg8b emulation because this would be
quite hacky
to realize it in pure user mode.

--
Thanks,
//richard

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


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

end of thread, other threads:[~2011-04-17 19:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-16 14:04 [uml-devel] Linux Kernel Bug #32812 "ARCH=um, SUBARCH=i386: linking failure" Martin Walch
2011-04-16 15:09 ` richard -rw- weinberger
2011-04-16 20:46   ` richard -rw- weinberger
2011-04-16 21:56 ` richard -rw- weinberger
2011-04-17 17:52   ` Martin Walch
2011-04-17 19:34     ` richard -rw- weinberger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.