From: james.morse@arm.com (James Morse)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v1] arm64: allow building with kcov coverage on ARM64
Date: Wed, 13 Apr 2016 17:12:35 +0100 [thread overview]
Message-ID: <570E6FF3.5000104@arm.com> (raw)
In-Reply-To: <CAG_fn=Xe5r3qveX356gUZWmt29Bw0XUrg5KHEbaRdJm=tDYLkw@mail.gmail.com>
Hi Alex,
On 12/04/16 12:17, Alexander Potapenko wrote:
> I also wonder if we can, say, land the change to arch/arm64/Kconfig
> separately from makefile changes that improve the precision or fix
> certain build configurations.
(I'm not sure what you mean by precision)
It depends which build configurations get broken, for example the first build I
tried doesn't boot.
I tested the Kconfig change, and added 'KCOV_INSTRUMENT := n' to kvm's two
Makefiles[0].
defconfig+KCOV boots fine, and I can start a guest, but if I build with
defconfig+KCOV+STACK_TRACER, I get a kernel that fails to boot. It boils down to
a loop between ftrace and kcov, I will send a patch.
It looks like syzkaller is the only user of this data, and it doesn't appear to
support arm64:
> 2016/04/13 15:42:55 failed to create instance: qemu stopped:
> "kvm" accelerator not found.
> No accelerator found!
This happens because syzkaller expects to be able to use 'qemu-system-x86_64':
> [pid 3670] execve("/usr/bin/qemu-system-x86_64", ["qemu-system-x86_64",
> "-hda", "/foo.img", "-snapshot", "-m", "1024", "-net", "nic", "-net",
> "user,host=10.0.2.10,hostfwd=tcp:"..., "-nographic", "-enable-kvm", "-numa",
> "node,nodeid=0,cpus=0-1", "-numa", "node,nodeid=1,cpus=2-3", ...],
qemu-system-x86_64 is installed and works fine, it just doesn't have the
expected hardware acceleration...
My approximation of your qemu command for arm64 may be useful[1], but I'm not
able to hack the go source to fix it!
Thanks,
James
[0]
diff --git a/arch/arm64/kvm/Makefile b/arch/arm64/kvm/Makefile
index 122cff482ac4..7d111f06bbf3 100644
--- a/arch/arm64/kvm/Makefile
+++ b/arch/arm64/kvm/Makefile
@@ -9,6 +9,10 @@ CFLAGS_mmu.o := -I.
KVM=../../../virt/kvm
ARM=../../../arch/arm/kvm
+# Code built here may run at EL2, in which case __sanitizer_cov_trace_pc() will
+# not be callable. For now, disable the instrumentation.
+KCOV_INSTRUMENT := n
+
obj-$(CONFIG_KVM_ARM_HOST) += kvm.o
obj-$(CONFIG_KVM_ARM_HOST) += hyp/
diff --git a/arch/arm64/kvm/hyp/Makefile b/arch/arm64/kvm/hyp/Makefile
index 778d0effa2af..1150f8664c85 100644
--- a/arch/arm64/kvm/hyp/Makefile
+++ b/arch/arm64/kvm/hyp/Makefile
@@ -20,3 +20,4 @@ obj-$(CONFIG_KVM_ARM_HOST) += s2-setup.o
GCOV_PROFILE := n
KASAN_SANITIZE := n
UBSAN_SANITIZE := n
+KCOV_INSTRUMENT := n
[1]
qemu-system-aarch64 -enable-kvm
-cpu host -m 1024 -M virt -nographic
-kernel ./syzkaller/Image
-append "console=ttyAMA0,115200 root=/dev/vda"
-drive format=raw,file=/foo.img,media=disk,if=none,cache=writeback,id=root
-device virtio-blk-device,drive=root
-netdev user,host=10.0.2.10,hostfwd=tcp::23505-:22,id=unet
-device virtio-net-device,netdev=unet
WARNING: multiple messages have this Message-ID (diff)
From: James Morse <james.morse@arm.com>
To: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>,
Mark Rutland <mark.rutland@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Quentin Casasnovas <quentin.casasnovas@oracle.com>,
Will Deacon <will.deacon@arm.com>,
Kostya Serebryany <kcc@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
syzkaller <syzkaller@googlegroups.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-arm-kernel@lists.infradead.org,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
marc.zyngier@arm.com,
Christoffer Dall <christoffer.dall@linaro.org>
Subject: Re: [PATCH v1] arm64: allow building with kcov coverage on ARM64
Date: Wed, 13 Apr 2016 17:12:35 +0100 [thread overview]
Message-ID: <570E6FF3.5000104@arm.com> (raw)
In-Reply-To: <CAG_fn=Xe5r3qveX356gUZWmt29Bw0XUrg5KHEbaRdJm=tDYLkw@mail.gmail.com>
Hi Alex,
On 12/04/16 12:17, Alexander Potapenko wrote:
> I also wonder if we can, say, land the change to arch/arm64/Kconfig
> separately from makefile changes that improve the precision or fix
> certain build configurations.
(I'm not sure what you mean by precision)
It depends which build configurations get broken, for example the first build I
tried doesn't boot.
I tested the Kconfig change, and added 'KCOV_INSTRUMENT := n' to kvm's two
Makefiles[0].
defconfig+KCOV boots fine, and I can start a guest, but if I build with
defconfig+KCOV+STACK_TRACER, I get a kernel that fails to boot. It boils down to
a loop between ftrace and kcov, I will send a patch.
It looks like syzkaller is the only user of this data, and it doesn't appear to
support arm64:
> 2016/04/13 15:42:55 failed to create instance: qemu stopped:
> "kvm" accelerator not found.
> No accelerator found!
This happens because syzkaller expects to be able to use 'qemu-system-x86_64':
> [pid 3670] execve("/usr/bin/qemu-system-x86_64", ["qemu-system-x86_64",
> "-hda", "/foo.img", "-snapshot", "-m", "1024", "-net", "nic", "-net",
> "user,host=10.0.2.10,hostfwd=tcp:"..., "-nographic", "-enable-kvm", "-numa",
> "node,nodeid=0,cpus=0-1", "-numa", "node,nodeid=1,cpus=2-3", ...],
qemu-system-x86_64 is installed and works fine, it just doesn't have the
expected hardware acceleration...
My approximation of your qemu command for arm64 may be useful[1], but I'm not
able to hack the go source to fix it!
Thanks,
James
[0]
diff --git a/arch/arm64/kvm/Makefile b/arch/arm64/kvm/Makefile
index 122cff482ac4..7d111f06bbf3 100644
--- a/arch/arm64/kvm/Makefile
+++ b/arch/arm64/kvm/Makefile
@@ -9,6 +9,10 @@ CFLAGS_mmu.o := -I.
KVM=../../../virt/kvm
ARM=../../../arch/arm/kvm
+# Code built here may run at EL2, in which case __sanitizer_cov_trace_pc() will
+# not be callable. For now, disable the instrumentation.
+KCOV_INSTRUMENT := n
+
obj-$(CONFIG_KVM_ARM_HOST) += kvm.o
obj-$(CONFIG_KVM_ARM_HOST) += hyp/
diff --git a/arch/arm64/kvm/hyp/Makefile b/arch/arm64/kvm/hyp/Makefile
index 778d0effa2af..1150f8664c85 100644
--- a/arch/arm64/kvm/hyp/Makefile
+++ b/arch/arm64/kvm/hyp/Makefile
@@ -20,3 +20,4 @@ obj-$(CONFIG_KVM_ARM_HOST) += s2-setup.o
GCOV_PROFILE := n
KASAN_SANITIZE := n
UBSAN_SANITIZE := n
+KCOV_INSTRUMENT := n
[1]
qemu-system-aarch64 -enable-kvm
-cpu host -m 1024 -M virt -nographic
-kernel ./syzkaller/Image
-append "console=ttyAMA0,115200 root=/dev/vda"
-drive format=raw,file=/foo.img,media=disk,if=none,cache=writeback,id=root
-device virtio-blk-device,drive=root
-netdev user,host=10.0.2.10,hostfwd=tcp::23505-:22,id=unet
-device virtio-net-device,netdev=unet
next prev parent reply other threads:[~2016-04-13 16:12 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-31 13:54 [PATCH v1] arm64: allow building with kcov coverage on ARM64 Alexander Potapenko
2016-03-31 13:54 ` Alexander Potapenko
2016-03-31 14:02 ` Alexander Potapenko
2016-03-31 14:02 ` Alexander Potapenko
2016-03-31 14:29 ` Mark Rutland
2016-03-31 14:29 ` Mark Rutland
2016-03-31 15:09 ` Alexander Potapenko
2016-03-31 15:09 ` Alexander Potapenko
2016-03-31 16:00 ` Mark Rutland
2016-03-31 16:00 ` Mark Rutland
2016-03-31 16:33 ` Alexander Potapenko
2016-03-31 16:33 ` Alexander Potapenko
2016-03-31 16:43 ` Alexander Potapenko
2016-03-31 16:43 ` Alexander Potapenko
2016-03-31 17:14 ` Mark Rutland
2016-03-31 17:14 ` Mark Rutland
2016-03-31 17:18 ` Alexander Potapenko
2016-03-31 17:18 ` Alexander Potapenko
2016-04-04 17:30 ` Dmitry Vyukov
2016-04-04 17:30 ` Dmitry Vyukov
2016-04-12 11:17 ` Alexander Potapenko
2016-04-12 11:17 ` Alexander Potapenko
2016-04-13 16:12 ` James Morse [this message]
2016-04-13 16:12 ` James Morse
2016-04-13 16:35 ` Alexander Potapenko
2016-04-13 16:35 ` Alexander Potapenko
2016-04-13 17:01 ` Mark Rutland
2016-04-13 17:01 ` Mark Rutland
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=570E6FF3.5000104@arm.com \
--to=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.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 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.