çå: çå: [PATCH] arm64/ptrace: add PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP support

From: Haibo Xu (Arm Technology China)
Date: Mon Oct 15 2018 - 22:54:29 EST


On Wed, Sep 05, 2018 at 03:45:51AM +0200, Richard Weinberger wrote:
> Am Dienstag, 4. September 2018, 04:11:07 CEST schrieb Haibo Xu (Arm Technology China):
> > Hi Richard,
> >
> > What do you mean by done it in the core? moving macro definition to include/uapi/linux/ptrace.h?
> >The patch is strictly follow x86's sematic on PTRACE_SYSEMU/SINGLESTEP support.
>
> Well, the feature itself is not really architecture specific.
> Just because x86 does it in arch/x86, it does not mean that this is the best way.
> I guess this is also what Will tried to say.
> If we can, we should implement PTRACE_SYSEMU in the core ptrace code and not per architecture.
>

After re-evaluating the workload to unify the PTRACE_SYSEMU in the core ptrace code on both ARM and x86 architecture,
We think we are not able to work on it recently(we only have 1.5 person work on the Gvisor project).

> > > > I wonder what Haibo Xu want to do with PTRACE_SYSEMU on arm64.
> > > > Are you porting UML or gvisor to arm64?
> > >
> > > That's a good question. Haibo?
> >
> > The story is we are working on a container runtime(Google Gvisor)
> > support on ARM64 platform, and the Gvisor depend on Linux kernel PTRACE_SYSEMU/SINGLESTEP support.
>
> Gvisor also supports a kvm backend which should be *much* faster than PTRACE_SYSEMU.
> Otherwise gvisor suffers from the same performance drawbacks as UML does.
> Pagefaults via SIGSEGV/mmap, syscall gate via ptrace().
>
> Did you check, is PTRACE_SYSEMU really the way to go for gvisor?
> Last time I checked the KVM backend looked promising but still WIP, though.
>

Gvisor do support two platforms, ptrace and kvm. To support ptrace platform on ARM64 is our first step.
From the long run, KVM would be a better choice, and we will work on it after ptrace platform get worked.

Currently, our initial patches for Gvisor ARM64 support are ready for the small "hello-world" container
(please refer to the attachment for the test logs), and we are in the process of upstreaming the code.
Could you help merge this patch to the Linux kernel for the time being? We can reschedule the resource
to unify the overall Ptrace codes in the kernel late.

> I also wonder whether PTRACE_SYSEMU is really the only missing bit to support gvisor on arm64. Did you check how to work around VIPT/VIVT caching issues?
> UML (and gvisor in this context) have lots of implicit x86 dependencies.

As far as we know, PTRACE_SYSEMU is the only missing bit that needed in Linux kernel to support Gvisor ptrace platform on ARM64.

Thanks,

Haibo

-----éäåä-----
åää: Richard Weinberger <richard@xxxxxx>
åéæé: 2018å9æ5æ 3:45
æää: Haibo Xu (Arm Technology China) <Haibo.Xu@xxxxxxx>
æé: Will Deacon <Will.Deacon@xxxxxxx>; Catalin Marinas <Catalin.Marinas@xxxxxxx>; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; nd <nd@xxxxxxx>; jdike@xxxxxxxxxxx
äé: Re: çå: [PATCH] arm64/ptrace: add PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP support

Am Dienstag, 4. September 2018, 04:11:07 CEST schrieb Haibo Xu (Arm Technology China):
> Hi Richard,
>
> What do you mean by done it in the core? moving macro definition to include/uapi/linux/ptrace.h?
> The patch is strictly follow x86's sematic on PTRACE_SYSEMU/SINGLESTEP support.

Well, the feature itself is not really architecture specific.
Just because x86 does it in arch/x86, it does not mean that this is the best way.
I guess this is also what Will tried to say.
If we can, we should implement PTRACE_SYSEMU in the core ptrace code and not per architecture.

> > > I wonder what Haibo Xu want to do with PTRACE_SYSEMU on arm64.
> > > Are you porting UML or gvisor to arm64?
> >
> > That's a good question. Haibo?
>
> The story is we are working on a container runtime(Google Gvisor)
> support on ARM64 platform, and the Gvisor depend on Linux kernel PTRACE_SYSEMU/SINGLESTEP support.

Gvisor also supports a kvm backend which should be *much* faster than PTRACE_SYSEMU.
Otherwise gvisor suffers from the same performance drawbacks as UML does.
Pagefaults via SIGSEGV/mmap, syscall gate via ptrace().

Did you check, is PTRACE_SYSEMU really the way to go for gvisor?
Last time I checked the KVM backend looked promising but still WIP, though.

I also wonder whether PTRACE_SYSEMU is really the only missing bit to support gvisor on arm64. Did you check how to work around VIPT/VIVT caching issues?
UML (and gvisor in this context) have lots of implicit x86 dependencies.

Thanks,
//richard


IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
[?2018/?10/?15 18:15] Bin Lu (Arm Technology China):
root@entos1:/go/src/github.com/google/gvisor# uname -p
aarch64
root@entos1:/go/src/github.com/google/gvisor# docker run --runtime=runsc hello-world
W1010 17:46:16.510561 30359 x:0] Could not parse /proc/cpuinfo, it is empty or does not contain cpu MHz
W1010 17:46:16.537007 30370 x:0] Could not parse /proc/cpuinfo, it is empty or does not contain cpu MHz
W1010 17:46:16.556919 30370 x:0] Could not parse /proc/cpuinfo, it is empty or does not contain cpu MHz

Hello from Docker!
This message shows that your installation appears to be working correctly.