Petter Reinholdtsen writes:

> [Lluís Vilanova]
>> Hmmmm, with grub2 that's easier to do because it's going to test the
>> bootloader that is the first thing going to start. In our case we'd
>> have to bootstrap a full system and then start it in qemu just to run
>> the test. That doesn't sound feasible to me (time and disk space to
>> run the test), but I might be wrong.

> It is possible to run "foreign" binaries in the current file system
> using qemu.  I have used it with vmdebootstrap to build arm chroots on
> x86.  I tested, and this seem to work when installing qemu-user:

>   qemu-x86_64 /usr/bin/python /usr/bin/coz run --- /bin/ls

> I'm not sure if qemu then start its own kernel or passes through the
> perf syscalls to the underlying kernel.  But I can not test this in
> Jessie:

> # /sbin/sysctl kernel.perf_event_paranoid=3
> kernel.perf_event_paranoid = 3
> # TMPDIR= TEMP= TEMPDIR= TMP= chroot /scratch/chroot-sid su - 
> mesg: ttyname failed: Success
> # qemu-x86_64 /usr/bin/python /usr/bin/coz run --- /bin/ls
> [libcoz.cpp:100] bootstrapping coz
> [libcoz.cpp:128] Including MAIN, which is /bin/ls
> [inspect.cpp:319] Unable to locate debug information for /bin/ls
> [inspect.cpp:325] /lib/x86_64-linux-gnu/ld-2.24.so is not in scope
> [inspect.cpp:325] /usr/lib/coz-profiler/libcoz.so is not in scope
> [inspect.cpp:325] /lib/x86_64-linux-gnu/libselinux.so.1 is not in scope
> [inspect.cpp:325] /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22 is not in 
> scope
> [inspect.cpp:325] /lib/x86_64-linux-gnu/libm-2.24.so is not in scope
> [inspect.cpp:325] /lib/x86_64-linux-gnu/libgcc_s.so.1 is not in scope
> [inspect.cpp:325] /lib/x86_64-linux-gnu/libpthread-2.24.so is not in scope
> [inspect.cpp:325] /lib/x86_64-linux-gnu/libpcre.so.3.13.3 is not in scope
> [inspect.cpp:325] /lib/x86_64-linux-gnu/libdl-2.24.so is not in scope
> [inspect.cpp:325] /lib/x86_64-linux-gnu/librt-2.24.so is not in scope
> [inspect.cpp:325] /usr/lib/x86_64-linux-gnu/libelf++.so.0 is not in scope
> [inspect.cpp:325] /usr/lib/x86_64-linux-gnu/libdwarf++.so.0 is not in scope
> [inspect.cpp:325] /lib/x86_64-linux-gnu/libc-2.24.so is not in scope
> [profiler.cpp:75] Starting profiler thread
> profile.coz
> # /sbin/sysctl kernel.perf_event_paranoid  
> kernel.perf_event_paranoid = 3
> # logout
> #

> At least the value is inherited into qemu.

> But if we can not get this to work before Christmas, we should probably
> rewrite the test to only test if the value of kernel.perf_event_paranoid
> is 2 or lower.

When qemu runs user applications, it simply forwards system calls to the host
kernel (it does a bit more than that, but that's the basic idea). If we want to
be able to control perf's configuration, we have to run a full-blown system in
qemu (i.e., a VM).

Building a VM image every time coz is built is what I do not consider feasible
(although it is perfectly doable).

The poor man's solution is to do as you suggested. If perf's configuration is
insufficient, barf at the user and exit, but do not return any error code.

Reply via email to