Re: [PATCH] perf tools: session: avoid infinite loop

From: Adrian Hunter
Date: Fri Sep 18 2015 - 02:12:14 EST


On 17/09/15 18:41, Mark Rutland wrote:
> Hi,
>
> On Wed, Sep 16, 2015 at 09:54:54PM +0100, Arnaldo Carvalho de Melo wrote:
>> Em Wed, Sep 16, 2015 at 06:18:49PM +0100, Mark Rutland escreveu:
>>> This has been observed to result in an exit-time hang when counting
>>> rare/unschedulable events with perf record, and can be triggered
>>> artificially with the script below:
>>>
>>> ----
>>> #!/bin/sh
>>> printf "REPRO: launching perf\n";
>>> ./perf record -e software/config=9/ sleep 1 &
>>> PERF_PID=$!;
>>> sleep 0.002;
>>> kill -2 $PERF_PID;
>>> printf "REPRO: waiting for perf (%d) to exit...\n" "$PERF_PID";
>>> wait $PERF_PID;
>>> printf "REPRO: perf exited\n";
>>> ----
>>
>> So, I run it here, without this patch, and get:
>>
>> [root@zoo ~]# time ./repro.sh
>> REPRO: launching perf
>> REPRO: waiting for perf (766) to exit...
>> [ perf record: Woken up 1 times to write data ]
>> [ perf record: Captured and wrote 0.015 MB perf.data ]
>> REPRO: perf exited
>> real 0m1.060s
>> user 0m0.018s
>> sys 0m0.037s
>
> [...]
>
>> What am I doing wrong? Trying to reproduce this before even looking at
>> the patch :-)
>
> I suspect you have a shinier computer than I do! ;)
>

I imagine you would also need to contrive not to write any synthesized MMAP
or COMM events i.e. no access to /proc perhaps?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/