public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkstack: use $UTS_MACHINE as target architecture
@ 2014-07-05 11:22 Konstantin Khlebnikov
  2014-07-07 22:05 ` Andrew Morton
  0 siblings, 1 reply; 18+ messages in thread
From: Konstantin Khlebnikov @ 2014-07-05 11:22 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel; +Cc: x86, user-mode-linux-devel, linux-kbuild

This fixes command # make checkstack for i386/x86_64.
Looks like $UTS_MACHINE is exactly what scripts/checkstack.pl needs.

By default $UTS_MACHINE is equal to $ARCH, but some arch/${ARCH}/Makefile
overrides it. This patch updates it also in arch/x86/Makefile.um

broken in ffee0de ("x86: Default to ARCH=x86 to avoid overriding CONFIG_64BIT")

Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
---
 Makefile             |   11 +----------
 arch/x86/Makefile.um |    2 ++
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index b0ee945..50fb690 100644
--- a/Makefile
+++ b/Makefile
@@ -1416,18 +1416,9 @@ endif #ifeq ($(mixed-targets),1)
 
 PHONY += checkstack kernelrelease kernelversion image_name
 
-# UML needs a little special treatment here.  It wants to use the host
-# toolchain, so needs $(SUBARCH) passed to checkstack.pl.  Everyone
-# else wants $(ARCH), including people doing cross-builds, which means
-# that $(SUBARCH) doesn't work here.
-ifeq ($(ARCH), um)
-CHECKSTACK_ARCH := $(SUBARCH)
-else
-CHECKSTACK_ARCH := $(ARCH)
-endif
 checkstack:
 	$(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
-	$(PERL) $(src)/scripts/checkstack.pl $(CHECKSTACK_ARCH)
+	$(PERL) $(src)/scripts/checkstack.pl $(UTS_MACHINE)
 
 kernelrelease:
 	@echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um
index 36b62bc..8fc912b 100644
--- a/arch/x86/Makefile.um
+++ b/arch/x86/Makefile.um
@@ -3,6 +3,7 @@ core-y += arch/x86/crypto/
 ifeq ($(CONFIG_X86_32),y)
 START := 0x8048000
 
+UTS_MACHINE		:= i386
 LDFLAGS			+= -m elf_i386
 ELF_ARCH		:= i386
 ELF_FORMAT 		:= elf32-i386
@@ -47,6 +48,7 @@ KBUILD_AFLAGS += -m64
 LDFLAGS += -m elf_x86_64
 KBUILD_CPPFLAGS += -m64
 
+UTS_MACHINE := x86_64
 ELF_ARCH := i386:x86-64
 ELF_FORMAT := elf64-x86-64
 


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

* Re: [PATCH] checkstack: use $UTS_MACHINE as target architecture
  2014-07-05 11:22 [PATCH] checkstack: use $UTS_MACHINE as target architecture Konstantin Khlebnikov
@ 2014-07-07 22:05 ` Andrew Morton
  2014-07-08  5:48   ` Konstantin Khlebnikov
  0 siblings, 1 reply; 18+ messages in thread
From: Andrew Morton @ 2014-07-07 22:05 UTC (permalink / raw)
  To: Konstantin Khlebnikov
  Cc: linux-kernel, x86, user-mode-linux-devel, linux-kbuild

On Sat, 05 Jul 2014 15:22:38 +0400 Konstantin Khlebnikov <koct9i@gmail.com> wrote:

> This fixes command # make checkstack for i386/x86_64.
> Looks like $UTS_MACHINE is exactly what scripts/checkstack.pl needs.
> 
> By default $UTS_MACHINE is equal to $ARCH, but some arch/${ARCH}/Makefile
> overrides it. This patch updates it also in arch/x86/Makefile.um
> 
> broken in ffee0de ("x86: Default to ARCH=x86 to avoid overriding CONFIG_64BIT")

The changelog doesn't describe the bug which is being fixed.  It should
do so please.  If there are any compiler/make error messages then those
should be included.


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

* Re: [PATCH] checkstack: use $UTS_MACHINE as target architecture
  2014-07-07 22:05 ` Andrew Morton
@ 2014-07-08  5:48   ` Konstantin Khlebnikov
  2014-07-08  8:01     ` [uml-devel] " Richard Weinberger
  2014-07-08 10:31     ` Konstantin Khlebnikov
  0 siblings, 2 replies; 18+ messages in thread
From: Konstantin Khlebnikov @ 2014-07-08  5:48 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel Mailing List, x86, UML devel, linux-kbuild

On Tue, Jul 8, 2014 at 2:05 AM, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Sat, 05 Jul 2014 15:22:38 +0400 Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>
>> This fixes command # make checkstack for i386/x86_64.
>> Looks like $UTS_MACHINE is exactly what scripts/checkstack.pl needs.
>>
>> By default $UTS_MACHINE is equal to $ARCH, but some arch/${ARCH}/Makefile
>> overrides it. This patch updates it also in arch/x86/Makefile.um
>>
>> broken in ffee0de ("x86: Default to ARCH=x86 to avoid overriding CONFIG_64BIT")
>
> The changelog doesn't describe the bug which is being fixed.  It should
> do so please.  If there are any compiler/make error messages then those
> should be included.
>

Oh, ok. checkstalk.pl needs either i386 or x86_64, x86 isn't enough.

$ make checkstack
objdump -d vmlinux $(find . -name '*.ko') | \
perl /home/blind/src/linux-stable/scripts/checkstack.pl x86
wrong or unknown architecture "x86"

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

* Re: [uml-devel] [PATCH] checkstack: use $UTS_MACHINE as target architecture
  2014-07-08  5:48   ` Konstantin Khlebnikov
@ 2014-07-08  8:01     ` Richard Weinberger
  2014-07-08  8:16       ` Konstantin Khlebnikov
  2014-07-08 10:31     ` Konstantin Khlebnikov
  1 sibling, 1 reply; 18+ messages in thread
From: Richard Weinberger @ 2014-07-08  8:01 UTC (permalink / raw)
  To: Konstantin Khlebnikov
  Cc: Andrew Morton, x86@kernel.org, Linux Kernel Mailing List,
	UML devel, linux-kbuild

On Tue, Jul 8, 2014 at 7:48 AM, Konstantin Khlebnikov <koct9i@gmail.com> wrote:
> On Tue, Jul 8, 2014 at 2:05 AM, Andrew Morton <akpm@linux-foundation.org> wrote:
>> On Sat, 05 Jul 2014 15:22:38 +0400 Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>>
>>> This fixes command # make checkstack for i386/x86_64.
>>> Looks like $UTS_MACHINE is exactly what scripts/checkstack.pl needs.
>>>
>>> By default $UTS_MACHINE is equal to $ARCH, but some arch/${ARCH}/Makefile
>>> overrides it. This patch updates it also in arch/x86/Makefile.um
>>>
>>> broken in ffee0de ("x86: Default to ARCH=x86 to avoid overriding CONFIG_64BIT")
>>
>> The changelog doesn't describe the bug which is being fixed.  It should
>> do so please.  If there are any compiler/make error messages then those
>> should be included.
>>
>
> Oh, ok. checkstalk.pl needs either i386 or x86_64, x86 isn't enough.
>
> $ make checkstack
> objdump -d vmlinux $(find . -name '*.ko') | \
> perl /home/blind/src/linux-stable/scripts/checkstack.pl x86
> wrong or unknown architecture "x86"

And now we need ARCH, SUBARCH and UTS_MACHINE on UML? :-(

-- 
Thanks,
//richard

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

* Re: [uml-devel] [PATCH] checkstack: use $UTS_MACHINE as target architecture
  2014-07-08  8:01     ` [uml-devel] " Richard Weinberger
@ 2014-07-08  8:16       ` Konstantin Khlebnikov
  2014-07-08  8:20         ` Richard Weinberger
  0 siblings, 1 reply; 18+ messages in thread
From: Konstantin Khlebnikov @ 2014-07-08  8:16 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Andrew Morton, x86@kernel.org, Linux Kernel Mailing List,
	UML devel, linux-kbuild

On Tue, Jul 8, 2014 at 12:01 PM, Richard Weinberger
<richard.weinberger@gmail.com> wrote:
> On Tue, Jul 8, 2014 at 7:48 AM, Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>> On Tue, Jul 8, 2014 at 2:05 AM, Andrew Morton <akpm@linux-foundation.org> wrote:
>>> On Sat, 05 Jul 2014 15:22:38 +0400 Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>>>
>>>> This fixes command # make checkstack for i386/x86_64.
>>>> Looks like $UTS_MACHINE is exactly what scripts/checkstack.pl needs.
>>>>
>>>> By default $UTS_MACHINE is equal to $ARCH, but some arch/${ARCH}/Makefile
>>>> overrides it. This patch updates it also in arch/x86/Makefile.um
>>>>
>>>> broken in ffee0de ("x86: Default to ARCH=x86 to avoid overriding CONFIG_64BIT")
>>>
>>> The changelog doesn't describe the bug which is being fixed.  It should
>>> do so please.  If there are any compiler/make error messages then those
>>> should be included.
>>>
>>
>> Oh, ok. checkstalk.pl needs either i386 or x86_64, x86 isn't enough.
>>
>> $ make checkstack
>> objdump -d vmlinux $(find . -name '*.ko') | \
>> perl /home/blind/src/linux-stable/scripts/checkstack.pl x86
>> wrong or unknown architecture "x86"
>
> And now we need ARCH, SUBARCH and UTS_MACHINE on UML? :-(

Nope UTS_MACHINE is autodetected, see hunk Makefile.x86 in my patch.

I thought about cleaning this part of UML.
For example we could move arch/x86/um into arch/um/x86 and use # make
ARCH=um/x86
after collecting this stuff together it woud be easier to get rid of
forever-broken parts.
As I see UML has been designed to work everywhere but SMP seem never worked
as well as any host os except of linux or other arch except x86.

>
> --
> Thanks,
> //richard

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

* Re: [uml-devel] [PATCH] checkstack: use $UTS_MACHINE as target architecture
  2014-07-08  8:16       ` Konstantin Khlebnikov
@ 2014-07-08  8:20         ` Richard Weinberger
  2014-07-08  8:30           ` Konstantin Khlebnikov
  0 siblings, 1 reply; 18+ messages in thread
From: Richard Weinberger @ 2014-07-08  8:20 UTC (permalink / raw)
  To: Konstantin Khlebnikov
  Cc: Andrew Morton, x86@kernel.org, Linux Kernel Mailing List,
	UML devel, linux-kbuild

Am 08.07.2014 10:16, schrieb Konstantin Khlebnikov:
> On Tue, Jul 8, 2014 at 12:01 PM, Richard Weinberger
> <richard.weinberger@gmail.com> wrote:
>> On Tue, Jul 8, 2014 at 7:48 AM, Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>>> On Tue, Jul 8, 2014 at 2:05 AM, Andrew Morton <akpm@linux-foundation.org> wrote:
>>>> On Sat, 05 Jul 2014 15:22:38 +0400 Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>>>>
>>>>> This fixes command # make checkstack for i386/x86_64.
>>>>> Looks like $UTS_MACHINE is exactly what scripts/checkstack.pl needs.
>>>>>
>>>>> By default $UTS_MACHINE is equal to $ARCH, but some arch/${ARCH}/Makefile
>>>>> overrides it. This patch updates it also in arch/x86/Makefile.um
>>>>>
>>>>> broken in ffee0de ("x86: Default to ARCH=x86 to avoid overriding CONFIG_64BIT")
>>>>
>>>> The changelog doesn't describe the bug which is being fixed.  It should
>>>> do so please.  If there are any compiler/make error messages then those
>>>> should be included.
>>>>
>>>
>>> Oh, ok. checkstalk.pl needs either i386 or x86_64, x86 isn't enough.
>>>
>>> $ make checkstack
>>> objdump -d vmlinux $(find . -name '*.ko') | \
>>> perl /home/blind/src/linux-stable/scripts/checkstack.pl x86
>>> wrong or unknown architecture "x86"
>>
>> And now we need ARCH, SUBARCH and UTS_MACHINE on UML? :-(
> 
> Nope UTS_MACHINE is autodetected, see hunk Makefile.x86 in my patch.
> 
> I thought about cleaning this part of UML.
> For example we could move arch/x86/um into arch/um/x86 and use # make
> ARCH=um/x86

No way. We moved the x86 stuff to arch/x86/ a few Years ago by design.

> after collecting this stuff together it woud be easier to get rid of
> forever-broken parts.
> As I see UML has been designed to work everywhere but SMP seem never worked
> as well as any host os except of linux or other arch except x86.

Currently UML runs only on x86_32/64.
Adding/fixing SMP support should be doable.

Thanks,
//richard

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

* Re: [uml-devel] [PATCH] checkstack: use $UTS_MACHINE as target architecture
  2014-07-08  8:20         ` Richard Weinberger
@ 2014-07-08  8:30           ` Konstantin Khlebnikov
  2014-07-08  8:33             ` Richard Weinberger
  0 siblings, 1 reply; 18+ messages in thread
From: Konstantin Khlebnikov @ 2014-07-08  8:30 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Andrew Morton, x86@kernel.org, Linux Kernel Mailing List,
	UML devel, linux-kbuild

On Tue, Jul 8, 2014 at 12:20 PM, Richard Weinberger <richard@nod.at> wrote:
> Am 08.07.2014 10:16, schrieb Konstantin Khlebnikov:
>> On Tue, Jul 8, 2014 at 12:01 PM, Richard Weinberger
>> <richard.weinberger@gmail.com> wrote:
>>> On Tue, Jul 8, 2014 at 7:48 AM, Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>>>> On Tue, Jul 8, 2014 at 2:05 AM, Andrew Morton <akpm@linux-foundation.org> wrote:
>>>>> On Sat, 05 Jul 2014 15:22:38 +0400 Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>>>>>
>>>>>> This fixes command # make checkstack for i386/x86_64.
>>>>>> Looks like $UTS_MACHINE is exactly what scripts/checkstack.pl needs.
>>>>>>
>>>>>> By default $UTS_MACHINE is equal to $ARCH, but some arch/${ARCH}/Makefile
>>>>>> overrides it. This patch updates it also in arch/x86/Makefile.um
>>>>>>
>>>>>> broken in ffee0de ("x86: Default to ARCH=x86 to avoid overriding CONFIG_64BIT")
>>>>>
>>>>> The changelog doesn't describe the bug which is being fixed.  It should
>>>>> do so please.  If there are any compiler/make error messages then those
>>>>> should be included.
>>>>>
>>>>
>>>> Oh, ok. checkstalk.pl needs either i386 or x86_64, x86 isn't enough.
>>>>
>>>> $ make checkstack
>>>> objdump -d vmlinux $(find . -name '*.ko') | \
>>>> perl /home/blind/src/linux-stable/scripts/checkstack.pl x86
>>>> wrong or unknown architecture "x86"
>>>
>>> And now we need ARCH, SUBARCH and UTS_MACHINE on UML? :-(
>>
>> Nope UTS_MACHINE is autodetected, see hunk Makefile.x86 in my patch.
>>
>> I thought about cleaning this part of UML.
>> For example we could move arch/x86/um into arch/um/x86 and use # make
>> ARCH=um/x86
>
> No way. We moved the x86 stuff to arch/x86/ a few Years ago by design.

Ok, fine. We could leave it in arch/x86/um and use make ARCH=x86/um

>
>> after collecting this stuff together it woud be easier to get rid of
>> forever-broken parts.
>> As I see UML has been designed to work everywhere but SMP seem never worked
>> as well as any host os except of linux or other arch except x86.
>
> Currently UML runs only on x86_32/64.
> Adding/fixing SMP support should be doable.

This might be quite difficult on top of current ptrace-based design.
I thought about running userspace in kvm context, this might be much
faster than ptrace but requires indirect uaccess like for 4gb-split.
But it's very unlikely that I'll find time for that.

>
> Thanks,
> //richard

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

* Re: [uml-devel] [PATCH] checkstack: use $UTS_MACHINE as target architecture
  2014-07-08  8:30           ` Konstantin Khlebnikov
@ 2014-07-08  8:33             ` Richard Weinberger
  2014-07-08  8:47               ` Konstantin Khlebnikov
  0 siblings, 1 reply; 18+ messages in thread
From: Richard Weinberger @ 2014-07-08  8:33 UTC (permalink / raw)
  To: Konstantin Khlebnikov
  Cc: Andrew Morton, x86@kernel.org, Linux Kernel Mailing List,
	UML devel, linux-kbuild

Am 08.07.2014 10:30, schrieb Konstantin Khlebnikov:
> On Tue, Jul 8, 2014 at 12:20 PM, Richard Weinberger <richard@nod.at> wrote:
>> Am 08.07.2014 10:16, schrieb Konstantin Khlebnikov:
>>> On Tue, Jul 8, 2014 at 12:01 PM, Richard Weinberger
>>> <richard.weinberger@gmail.com> wrote:
>>>> On Tue, Jul 8, 2014 at 7:48 AM, Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>>>>> On Tue, Jul 8, 2014 at 2:05 AM, Andrew Morton <akpm@linux-foundation.org> wrote:
>>>>>> On Sat, 05 Jul 2014 15:22:38 +0400 Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>>>>>>
>>>>>>> This fixes command # make checkstack for i386/x86_64.
>>>>>>> Looks like $UTS_MACHINE is exactly what scripts/checkstack.pl needs.
>>>>>>>
>>>>>>> By default $UTS_MACHINE is equal to $ARCH, but some arch/${ARCH}/Makefile
>>>>>>> overrides it. This patch updates it also in arch/x86/Makefile.um
>>>>>>>
>>>>>>> broken in ffee0de ("x86: Default to ARCH=x86 to avoid overriding CONFIG_64BIT")
>>>>>>
>>>>>> The changelog doesn't describe the bug which is being fixed.  It should
>>>>>> do so please.  If there are any compiler/make error messages then those
>>>>>> should be included.
>>>>>>
>>>>>
>>>>> Oh, ok. checkstalk.pl needs either i386 or x86_64, x86 isn't enough.
>>>>>
>>>>> $ make checkstack
>>>>> objdump -d vmlinux $(find . -name '*.ko') | \
>>>>> perl /home/blind/src/linux-stable/scripts/checkstack.pl x86
>>>>> wrong or unknown architecture "x86"
>>>>
>>>> And now we need ARCH, SUBARCH and UTS_MACHINE on UML? :-(
>>>
>>> Nope UTS_MACHINE is autodetected, see hunk Makefile.x86 in my patch.
>>>
>>> I thought about cleaning this part of UML.
>>> For example we could move arch/x86/um into arch/um/x86 and use # make
>>> ARCH=um/x86
>>
>> No way. We moved the x86 stuff to arch/x86/ a few Years ago by design.
> 
> Ok, fine. We could leave it in arch/x86/um and use make ARCH=x86/um

I don't like this. Please keep ARCH=um as is.

>>
>>> after collecting this stuff together it woud be easier to get rid of
>>> forever-broken parts.
>>> As I see UML has been designed to work everywhere but SMP seem never worked
>>> as well as any host os except of linux or other arch except x86.
>>
>> Currently UML runs only on x86_32/64.
>> Adding/fixing SMP support should be doable.
> 
> This might be quite difficult on top of current ptrace-based design.
> I thought about running userspace in kvm context, this might be much
> faster than ptrace but requires indirect uaccess like for 4gb-split.
> But it's very unlikely that I'll find time for that.

Erm, UML is a systemcall emulator based on ptrace().
If you make it use any KVM backend there is 0 usecase for UML because we can just use qemu/kvmtool.

Thanks,
//richard

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

* Re: [uml-devel] [PATCH] checkstack: use $UTS_MACHINE as target architecture
  2014-07-08  8:33             ` Richard Weinberger
@ 2014-07-08  8:47               ` Konstantin Khlebnikov
  2014-07-08  8:50                 ` Richard Weinberger
  0 siblings, 1 reply; 18+ messages in thread
From: Konstantin Khlebnikov @ 2014-07-08  8:47 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Andrew Morton, x86@kernel.org, Linux Kernel Mailing List,
	UML devel, linux-kbuild

On Tue, Jul 8, 2014 at 12:33 PM, Richard Weinberger <richard@nod.at> wrote:
> Am 08.07.2014 10:30, schrieb Konstantin Khlebnikov:
>> On Tue, Jul 8, 2014 at 12:20 PM, Richard Weinberger <richard@nod.at> wrote:
>>> Am 08.07.2014 10:16, schrieb Konstantin Khlebnikov:
>>>> On Tue, Jul 8, 2014 at 12:01 PM, Richard Weinberger
>>>> <richard.weinberger@gmail.com> wrote:
>>>>> On Tue, Jul 8, 2014 at 7:48 AM, Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>>>>>> On Tue, Jul 8, 2014 at 2:05 AM, Andrew Morton <akpm@linux-foundation.org> wrote:
>>>>>>> On Sat, 05 Jul 2014 15:22:38 +0400 Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>>>>>>>
>>>>>>>> This fixes command # make checkstack for i386/x86_64.
>>>>>>>> Looks like $UTS_MACHINE is exactly what scripts/checkstack.pl needs.
>>>>>>>>
>>>>>>>> By default $UTS_MACHINE is equal to $ARCH, but some arch/${ARCH}/Makefile
>>>>>>>> overrides it. This patch updates it also in arch/x86/Makefile.um
>>>>>>>>
>>>>>>>> broken in ffee0de ("x86: Default to ARCH=x86 to avoid overriding CONFIG_64BIT")
>>>>>>>
>>>>>>> The changelog doesn't describe the bug which is being fixed.  It should
>>>>>>> do so please.  If there are any compiler/make error messages then those
>>>>>>> should be included.
>>>>>>>
>>>>>>
>>>>>> Oh, ok. checkstalk.pl needs either i386 or x86_64, x86 isn't enough.
>>>>>>
>>>>>> $ make checkstack
>>>>>> objdump -d vmlinux $(find . -name '*.ko') | \
>>>>>> perl /home/blind/src/linux-stable/scripts/checkstack.pl x86
>>>>>> wrong or unknown architecture "x86"
>>>>>
>>>>> And now we need ARCH, SUBARCH and UTS_MACHINE on UML? :-(
>>>>
>>>> Nope UTS_MACHINE is autodetected, see hunk Makefile.x86 in my patch.
>>>>
>>>> I thought about cleaning this part of UML.
>>>> For example we could move arch/x86/um into arch/um/x86 and use # make
>>>> ARCH=um/x86
>>>
>>> No way. We moved the x86 stuff to arch/x86/ a few Years ago by design.
>>
>> Ok, fine. We could leave it in arch/x86/um and use make ARCH=x86/um
>
> I don't like this. Please keep ARCH=um as is.
>
>>>
>>>> after collecting this stuff together it woud be easier to get rid of
>>>> forever-broken parts.
>>>> As I see UML has been designed to work everywhere but SMP seem never worked
>>>> as well as any host os except of linux or other arch except x86.
>>>
>>> Currently UML runs only on x86_32/64.
>>> Adding/fixing SMP support should be doable.
>>
>> This might be quite difficult on top of current ptrace-based design.
>> I thought about running userspace in kvm context, this might be much
>> faster than ptrace but requires indirect uaccess like for 4gb-split.
>> But it's very unlikely that I'll find time for that.
>
> Erm, UML is a systemcall emulator based on ptrace().
> If you make it use any KVM backend there is 0 usecase for UML because we can just use qemu/kvmtool.

But kernel stays in userspace, so it could be easily debugged.
It's like merge kvmtool+linux into one application.

>
> Thanks,
> //richard

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

* Re: [uml-devel] [PATCH] checkstack: use $UTS_MACHINE as target architecture
  2014-07-08  8:47               ` Konstantin Khlebnikov
@ 2014-07-08  8:50                 ` Richard Weinberger
  2014-07-08  9:03                   ` Konstantin Khlebnikov
  0 siblings, 1 reply; 18+ messages in thread
From: Richard Weinberger @ 2014-07-08  8:50 UTC (permalink / raw)
  To: Konstantin Khlebnikov
  Cc: Andrew Morton, x86@kernel.org, Linux Kernel Mailing List,
	UML devel, linux-kbuild

Am 08.07.2014 10:47, schrieb Konstantin Khlebnikov:
> On Tue, Jul 8, 2014 at 12:33 PM, Richard Weinberger <richard@nod.at> wrote:
>> Am 08.07.2014 10:30, schrieb Konstantin Khlebnikov:
>>> On Tue, Jul 8, 2014 at 12:20 PM, Richard Weinberger <richard@nod.at> wrote:
>>>> Am 08.07.2014 10:16, schrieb Konstantin Khlebnikov:
>>>>> On Tue, Jul 8, 2014 at 12:01 PM, Richard Weinberger
>>>>> <richard.weinberger@gmail.com> wrote:
>>>>>> On Tue, Jul 8, 2014 at 7:48 AM, Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>>>>>>> On Tue, Jul 8, 2014 at 2:05 AM, Andrew Morton <akpm@linux-foundation.org> wrote:
>>>>>>>> On Sat, 05 Jul 2014 15:22:38 +0400 Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> This fixes command # make checkstack for i386/x86_64.
>>>>>>>>> Looks like $UTS_MACHINE is exactly what scripts/checkstack.pl needs.
>>>>>>>>>
>>>>>>>>> By default $UTS_MACHINE is equal to $ARCH, but some arch/${ARCH}/Makefile
>>>>>>>>> overrides it. This patch updates it also in arch/x86/Makefile.um
>>>>>>>>>
>>>>>>>>> broken in ffee0de ("x86: Default to ARCH=x86 to avoid overriding CONFIG_64BIT")
>>>>>>>>
>>>>>>>> The changelog doesn't describe the bug which is being fixed.  It should
>>>>>>>> do so please.  If there are any compiler/make error messages then those
>>>>>>>> should be included.
>>>>>>>>
>>>>>>>
>>>>>>> Oh, ok. checkstalk.pl needs either i386 or x86_64, x86 isn't enough.
>>>>>>>
>>>>>>> $ make checkstack
>>>>>>> objdump -d vmlinux $(find . -name '*.ko') | \
>>>>>>> perl /home/blind/src/linux-stable/scripts/checkstack.pl x86
>>>>>>> wrong or unknown architecture "x86"
>>>>>>
>>>>>> And now we need ARCH, SUBARCH and UTS_MACHINE on UML? :-(
>>>>>
>>>>> Nope UTS_MACHINE is autodetected, see hunk Makefile.x86 in my patch.
>>>>>
>>>>> I thought about cleaning this part of UML.
>>>>> For example we could move arch/x86/um into arch/um/x86 and use # make
>>>>> ARCH=um/x86
>>>>
>>>> No way. We moved the x86 stuff to arch/x86/ a few Years ago by design.
>>>
>>> Ok, fine. We could leave it in arch/x86/um and use make ARCH=x86/um
>>
>> I don't like this. Please keep ARCH=um as is.
>>
>>>>
>>>>> after collecting this stuff together it woud be easier to get rid of
>>>>> forever-broken parts.
>>>>> As I see UML has been designed to work everywhere but SMP seem never worked
>>>>> as well as any host os except of linux or other arch except x86.
>>>>
>>>> Currently UML runs only on x86_32/64.
>>>> Adding/fixing SMP support should be doable.
>>>
>>> This might be quite difficult on top of current ptrace-based design.
>>> I thought about running userspace in kvm context, this might be much
>>> faster than ptrace but requires indirect uaccess like for 4gb-split.
>>> But it's very unlikely that I'll find time for that.
>>
>> Erm, UML is a systemcall emulator based on ptrace().
>> If you make it use any KVM backend there is 0 usecase for UML because we can just use qemu/kvmtool.
> 
> But kernel stays in userspace, so it could be easily debugged.
> It's like merge kvmtool+linux into one application.

You can already do this with qemu. It has a -gdb switch.

Thanks,
//richard

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

* Re: [uml-devel] [PATCH] checkstack: use $UTS_MACHINE as target architecture
  2014-07-08  8:50                 ` Richard Weinberger
@ 2014-07-08  9:03                   ` Konstantin Khlebnikov
  2014-07-08  9:06                     ` Richard Weinberger
  0 siblings, 1 reply; 18+ messages in thread
From: Konstantin Khlebnikov @ 2014-07-08  9:03 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Andrew Morton, x86@kernel.org, Linux Kernel Mailing List,
	UML devel, linux-kbuild

On Tue, Jul 8, 2014 at 12:50 PM, Richard Weinberger <richard@nod.at> wrote:
> Am 08.07.2014 10:47, schrieb Konstantin Khlebnikov:
>> On Tue, Jul 8, 2014 at 12:33 PM, Richard Weinberger <richard@nod.at> wrote:
>>> Am 08.07.2014 10:30, schrieb Konstantin Khlebnikov:
>>>> On Tue, Jul 8, 2014 at 12:20 PM, Richard Weinberger <richard@nod.at> wrote:
>>>>> Am 08.07.2014 10:16, schrieb Konstantin Khlebnikov:
>>>>>> On Tue, Jul 8, 2014 at 12:01 PM, Richard Weinberger
>>>>>> <richard.weinberger@gmail.com> wrote:
>>>>>>> On Tue, Jul 8, 2014 at 7:48 AM, Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>>>>>>>> On Tue, Jul 8, 2014 at 2:05 AM, Andrew Morton <akpm@linux-foundation.org> wrote:
>>>>>>>>> On Sat, 05 Jul 2014 15:22:38 +0400 Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> This fixes command # make checkstack for i386/x86_64.
>>>>>>>>>> Looks like $UTS_MACHINE is exactly what scripts/checkstack.pl needs.
>>>>>>>>>>
>>>>>>>>>> By default $UTS_MACHINE is equal to $ARCH, but some arch/${ARCH}/Makefile
>>>>>>>>>> overrides it. This patch updates it also in arch/x86/Makefile.um
>>>>>>>>>>
>>>>>>>>>> broken in ffee0de ("x86: Default to ARCH=x86 to avoid overriding CONFIG_64BIT")
>>>>>>>>>
>>>>>>>>> The changelog doesn't describe the bug which is being fixed.  It should
>>>>>>>>> do so please.  If there are any compiler/make error messages then those
>>>>>>>>> should be included.
>>>>>>>>>
>>>>>>>>
>>>>>>>> Oh, ok. checkstalk.pl needs either i386 or x86_64, x86 isn't enough.
>>>>>>>>
>>>>>>>> $ make checkstack
>>>>>>>> objdump -d vmlinux $(find . -name '*.ko') | \
>>>>>>>> perl /home/blind/src/linux-stable/scripts/checkstack.pl x86
>>>>>>>> wrong or unknown architecture "x86"
>>>>>>>
>>>>>>> And now we need ARCH, SUBARCH and UTS_MACHINE on UML? :-(
>>>>>>
>>>>>> Nope UTS_MACHINE is autodetected, see hunk Makefile.x86 in my patch.
>>>>>>
>>>>>> I thought about cleaning this part of UML.
>>>>>> For example we could move arch/x86/um into arch/um/x86 and use # make
>>>>>> ARCH=um/x86
>>>>>
>>>>> No way. We moved the x86 stuff to arch/x86/ a few Years ago by design.
>>>>
>>>> Ok, fine. We could leave it in arch/x86/um and use make ARCH=x86/um
>>>
>>> I don't like this. Please keep ARCH=um as is.
>>>
>>>>>
>>>>>> after collecting this stuff together it woud be easier to get rid of
>>>>>> forever-broken parts.
>>>>>> As I see UML has been designed to work everywhere but SMP seem never worked
>>>>>> as well as any host os except of linux or other arch except x86.
>>>>>
>>>>> Currently UML runs only on x86_32/64.
>>>>> Adding/fixing SMP support should be doable.
>>>>
>>>> This might be quite difficult on top of current ptrace-based design.
>>>> I thought about running userspace in kvm context, this might be much
>>>> faster than ptrace but requires indirect uaccess like for 4gb-split.
>>>> But it's very unlikely that I'll find time for that.
>>>
>>> Erm, UML is a systemcall emulator based on ptrace().
>>> If you make it use any KVM backend there is 0 usecase for UML because we can just use qemu/kvmtool.
>>
>> But kernel stays in userspace, so it could be easily debugged.
>> It's like merge kvmtool+linux into one application.
>
> You can already do this with qemu. It has a -gdb switch.

I know. But debugging/profiling of kernel code is much easier when it
runs in userspace.
I think this is the last use case where uml might beat normal hardware
accelerated qemu/kvm.
But without SMP and with that high overhead on each syscall and
context/mm switch it's mostly useless.

>
> Thanks,
> //richard

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

* Re: [uml-devel] [PATCH] checkstack: use $UTS_MACHINE as target architecture
  2014-07-08  9:03                   ` Konstantin Khlebnikov
@ 2014-07-08  9:06                     ` Richard Weinberger
  2014-07-08  9:09                       ` Geert Uytterhoeven
  0 siblings, 1 reply; 18+ messages in thread
From: Richard Weinberger @ 2014-07-08  9:06 UTC (permalink / raw)
  To: Konstantin Khlebnikov
  Cc: Andrew Morton, x86@kernel.org, Linux Kernel Mailing List,
	UML devel, linux-kbuild

Am 08.07.2014 11:03, schrieb Konstantin Khlebnikov:
> I know. But debugging/profiling of kernel code is much easier when it
> runs in userspace.
> I think this is the last use case where uml might beat normal hardware
> accelerated qemu/kvm.
> But without SMP and with that high overhead on each syscall and
> context/mm switch it's mostly useless.

The major use case of UML is that you can run it on hardware without
KVM support.
Everyone else is using KVM.

Thanks,
//richard

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

* Re: [uml-devel] [PATCH] checkstack: use $UTS_MACHINE as target architecture
  2014-07-08  9:06                     ` Richard Weinberger
@ 2014-07-08  9:09                       ` Geert Uytterhoeven
  2014-07-08  9:14                         ` Richard Weinberger
  0 siblings, 1 reply; 18+ messages in thread
From: Geert Uytterhoeven @ 2014-07-08  9:09 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Konstantin Khlebnikov, Andrew Morton, x86@kernel.org,
	Linux Kernel Mailing List, UML devel, linux-kbuild

On Tue, Jul 8, 2014 at 11:06 AM, Richard Weinberger <richard@nod.at> wrote:
> Am 08.07.2014 11:03, schrieb Konstantin Khlebnikov:
>> I know. But debugging/profiling of kernel code is much easier when it
>> runs in userspace.
>> I think this is the last use case where uml might beat normal hardware
>> accelerated qemu/kvm.
>> But without SMP and with that high overhead on each syscall and
>> context/mm switch it's mostly useless.
>
> The major use case of UML is that you can run it on hardware without
> KVM support.
> Everyone else is using KVM.

And that you don't need root permissions to run it.
Which is why I'm still interested in an ARM port.
Need... More... Spare... Time...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [uml-devel] [PATCH] checkstack: use $UTS_MACHINE as target architecture
  2014-07-08  9:09                       ` Geert Uytterhoeven
@ 2014-07-08  9:14                         ` Richard Weinberger
  2014-07-08  9:22                           ` Geert Uytterhoeven
  0 siblings, 1 reply; 18+ messages in thread
From: Richard Weinberger @ 2014-07-08  9:14 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Konstantin Khlebnikov, Andrew Morton, x86@kernel.org,
	Linux Kernel Mailing List, UML devel, linux-kbuild

Am 08.07.2014 11:09, schrieb Geert Uytterhoeven:
> On Tue, Jul 8, 2014 at 11:06 AM, Richard Weinberger <richard@nod.at> wrote:
>> Am 08.07.2014 11:03, schrieb Konstantin Khlebnikov:
>>> I know. But debugging/profiling of kernel code is much easier when it
>>> runs in userspace.
>>> I think this is the last use case where uml might beat normal hardware
>>> accelerated qemu/kvm.
>>> But without SMP and with that high overhead on each syscall and
>>> context/mm switch it's mostly useless.
>>
>> The major use case of UML is that you can run it on hardware without
>> KVM support.
>> Everyone else is using KVM.
> 
> And that you don't need root permissions to run it.
> Which is why I'm still interested in an ARM port.
> Need... More... Spare... Time...

You can use KVM also without being root.
It depends on the rights of /dev/kvm.

But yes, an ARM ports would be nice to have. :)

Thanks,
//richard

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

* Re: [uml-devel] [PATCH] checkstack: use $UTS_MACHINE as target architecture
  2014-07-08  9:14                         ` Richard Weinberger
@ 2014-07-08  9:22                           ` Geert Uytterhoeven
  2014-07-08  9:23                             ` Richard Weinberger
  0 siblings, 1 reply; 18+ messages in thread
From: Geert Uytterhoeven @ 2014-07-08  9:22 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Konstantin Khlebnikov, Andrew Morton, x86@kernel.org,
	Linux Kernel Mailing List, UML devel, linux-kbuild

On Tue, Jul 8, 2014 at 11:14 AM, Richard Weinberger <richard@nod.at> wrote:
>> And that you don't need root permissions to run it.
>
> You can use KVM also without being root.
> It depends on the rights of /dev/kvm.

Which are controlled by... root.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [uml-devel] [PATCH] checkstack: use $UTS_MACHINE as target architecture
  2014-07-08  9:22                           ` Geert Uytterhoeven
@ 2014-07-08  9:23                             ` Richard Weinberger
  0 siblings, 0 replies; 18+ messages in thread
From: Richard Weinberger @ 2014-07-08  9:23 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Konstantin Khlebnikov, Andrew Morton, x86@kernel.org,
	Linux Kernel Mailing List, UML devel, linux-kbuild

Am 08.07.2014 11:22, schrieb Geert Uytterhoeven:
> On Tue, Jul 8, 2014 at 11:14 AM, Richard Weinberger <richard@nod.at> wrote:
>>> And that you don't need root permissions to run it.
>>
>> You can use KVM also without being root.
>> It depends on the rights of /dev/kvm.
> 
> Which are controlled by... root.

Okay, you need to run KVM on machines where root does not like you? ;-)

Thanks,
//richard

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

* Re: [PATCH] checkstack: use $UTS_MACHINE as target architecture
  2014-07-08  5:48   ` Konstantin Khlebnikov
  2014-07-08  8:01     ` [uml-devel] " Richard Weinberger
@ 2014-07-08 10:31     ` Konstantin Khlebnikov
  2014-07-08 10:35       ` [PATCH] scripts/checkstack.pl: automatically handle 32-bit and 64-bit mode for ARCH=x86 Konstantin Khlebnikov
  1 sibling, 1 reply; 18+ messages in thread
From: Konstantin Khlebnikov @ 2014-07-08 10:31 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Linux Kernel Mailing List, x86@kernel.org, UML devel,
	linux-kbuild

On Tue, Jul 8, 2014 at 9:48 AM, Konstantin Khlebnikov <koct9i@gmail.com> wrote:
> On Tue, Jul 8, 2014 at 2:05 AM, Andrew Morton <akpm@linux-foundation.org> wrote:
>> On Sat, 05 Jul 2014 15:22:38 +0400 Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>>
>>> This fixes command # make checkstack for i386/x86_64.
>>> Looks like $UTS_MACHINE is exactly what scripts/checkstack.pl needs.
>>>
>>> By default $UTS_MACHINE is equal to $ARCH, but some arch/${ARCH}/Makefile
>>> overrides it. This patch updates it also in arch/x86/Makefile.um
>>>
>>> broken in ffee0de ("x86: Default to ARCH=x86 to avoid overriding CONFIG_64BIT")
>>
>> The changelog doesn't describe the bug which is being fixed.  It should
>> do so please.  If there are any compiler/make error messages then those
>> should be included.
>>
>
> Oh, ok. checkstalk.pl needs either i386 or x86_64, x86 isn't enough.
>
> $ make checkstack
> objdump -d vmlinux $(find . -name '*.ko') | \
> perl /home/blind/src/linux-stable/scripts/checkstack.pl x86
> wrong or unknown architecture "x86"

I guess it still not descriptive enough.

checkstack.pl searches patterns of machine instructions which are
usually used for allocating stack frames. commit ffee0de
("x86: Default to ARCH=x86 to avoid overriding CONFIG_64BIT")
had merged ARCH=i386 and ARCH=x86_64 into one ARCH=x86.
checkstalk.pl needs either i386 or x86_64, x86 isn't enough.

$ make checkstack
objdump -d vmlinux $(find . -name '*.ko') | \
perl linux/scripts/checkstack.pl x86
wrong or unknown architecture "x86"



This also might be fixed in checkstack.pl: i386 and x86_64 differs only
in name of  sp register: %esp/%rsp.

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

* [PATCH] scripts/checkstack.pl: automatically handle 32-bit and 64-bit mode for ARCH=x86
  2014-07-08 10:31     ` Konstantin Khlebnikov
@ 2014-07-08 10:35       ` Konstantin Khlebnikov
  0 siblings, 0 replies; 18+ messages in thread
From: Konstantin Khlebnikov @ 2014-07-08 10:35 UTC (permalink / raw)
  To: Andrew Morton
  Cc: x86@kernel.org, Linux Kernel Mailing List, user-mode-linux-devel,
	linux-kbuild

This patch adds support for ARCH=x86 into checkstack.

commit ffee0de ("x86: Default to ARCH=x86 to avoid overriding CONFIG_64BIT")
had merged ARCH=i386 and ARCH=x86_64 into one ARCH=x86. checkstack.pl searches
patterns of machine instructions which are usually used for allocating stack
frames. checkstalk.pl needs either i386 or x86_64, x86 isn't enough:

$ make checkstack
objdump -d vmlinux $(find . -name '*.ko') | \
perl linux/scripts/checkstack.pl x86
wrong or unknown architecture "x86"

Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
---
 scripts/checkstack.pl |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
index c05d586..899b423 100755
--- a/scripts/checkstack.pl
+++ b/scripts/checkstack.pl
@@ -52,14 +52,12 @@ my (@stack, $re, $dre, $x, $xs, $funcre);
 		#8000008a:       20 1d           sub sp,4
 		#80000ca8:       fa cd 05 b0     sub sp,sp,1456
 		$re = qr/^.*sub.*sp.*,([0-9]{1,8})/o;
-	} elsif ($arch =~ /^i[3456]86$/) {
+	} elsif ($arch =~ /^x86(_64)?$/ || $arch =~ /^i[3456]86$/) {
 		#c0105234:       81 ec ac 05 00 00       sub    $0x5ac,%esp
-		$re = qr/^.*[as][du][db]    \$(0x$x{1,8}),\%esp$/o;
-		$dre = qr/^.*[as][du][db]    (%.*),\%esp$/o;
-	} elsif ($arch eq 'x86_64') {
-		#    2f60:	48 81 ec e8 05 00 00 	sub    $0x5e8,%rsp
-		$re = qr/^.*[as][du][db]    \$(0x$x{1,8}),\%rsp$/o;
-		$dre = qr/^.*[as][du][db]    (\%.*),\%rsp$/o;
+		# or
+		#    2f60:    48 81 ec e8 05 00 00       sub    $0x5e8,%rsp
+		$re = qr/^.*[as][du][db]    \$(0x$x{1,8}),\%(e|r)sp$/o;
+		$dre = qr/^.*[as][du][db]    (%.*),\%(e|r)sp$/o;
 	} elsif ($arch eq 'ia64') {
 		#e0000000044011fc:       01 0f fc 8c     adds r12=-384,r12
 		$re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o;


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

end of thread, other threads:[~2014-07-08 10:36 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-05 11:22 [PATCH] checkstack: use $UTS_MACHINE as target architecture Konstantin Khlebnikov
2014-07-07 22:05 ` Andrew Morton
2014-07-08  5:48   ` Konstantin Khlebnikov
2014-07-08  8:01     ` [uml-devel] " Richard Weinberger
2014-07-08  8:16       ` Konstantin Khlebnikov
2014-07-08  8:20         ` Richard Weinberger
2014-07-08  8:30           ` Konstantin Khlebnikov
2014-07-08  8:33             ` Richard Weinberger
2014-07-08  8:47               ` Konstantin Khlebnikov
2014-07-08  8:50                 ` Richard Weinberger
2014-07-08  9:03                   ` Konstantin Khlebnikov
2014-07-08  9:06                     ` Richard Weinberger
2014-07-08  9:09                       ` Geert Uytterhoeven
2014-07-08  9:14                         ` Richard Weinberger
2014-07-08  9:22                           ` Geert Uytterhoeven
2014-07-08  9:23                             ` Richard Weinberger
2014-07-08 10:31     ` Konstantin Khlebnikov
2014-07-08 10:35       ` [PATCH] scripts/checkstack.pl: automatically handle 32-bit and 64-bit mode for ARCH=x86 Konstantin Khlebnikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox