[PATCH] D29954: [PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-write

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 15 10:23:16 PST 2017


ok -- check that profile is not truncated then.

David

On Wed, Feb 15, 2017 at 10:09 AM, Rong Xu <xur at google.com> wrote:

> this is basically the simple tested I described.
>
> but the child process cannot sleep, as if it sleeps, it will be killed
> when the parent process exit. This happens before getting into the profile
> run-time. There would be no chance of merge.
>
> it's hard to control the timing. I can only test that no 0-sized profile
> will be created.
> I cannot guarantee merge will happen.
>
> On Wed, Feb 15, 2017 at 10:03 AM, Xinliang David Li <davidxl at google.com>
> wrote:
>
>> You can write a test that has high chance of failure when this patch is
>> not applied. This can be done by let child process to sleep a few ms before
>> existing. The period of waiting can be controlled by a command line
>> argument.
>>
>> Things to test:
>>
>> 1) make sure the profile data is not zero sized
>> 2) make sure the merged profile from parent and child is created (using
>> llvm-profdata to dump)
>>
>> 3) repeat step 1) and 2) with different waiting parameters (e.g, 3
>> different cases).
>>
>> David
>>
>> On Wed, Feb 15, 2017 at 9:55 AM, Rong Xu <xur at google.com> wrote:
>>
>>> It's not easy to write a test case for this. We need the extended period
>>> of profile write to expose the faulty behavior. This is not easy for small
>>> test programs.
>>> I can register another atexit function that opens and locks the profile
>>> to mimic this.
>>> The flow is like:
>>> main process:  __llvm_profile_write_file, open_profile, lock_profile,
>>> close_profile, _exit
>>> child process:    sleep
>>>  __llvm_profile_write
>>>
>>> But this is not really testing the code directly.
>>> Another thing is since merge is only enabled with %m specifier, i need
>>> to get the string expansion for %m, or I need to read the directory to find
>>> the profile. This is quite cumbersome.
>>>
>>> Or a simple version is just a test that using small profile and let the
>>> race happen.
>>> There are two outcomes: (1) if the main process exits before the child
>>> process voiding the sigkill, we have the profile for the main process only.
>>> (2) if the child process get time to void sigkill, we get merged profile.
>>> The check would assert that 0-size profile should not happen.
>>>
>>> Do you have better idea?
>>>
>>>
>>> On Wed, Feb 15, 2017 at 9:38 AM, Rong Xu <xur at google.com> wrote:
>>>
>>>>
>>>>
>>>> On Tue, Feb 14, 2017 at 1:05 PM, David Li via Phabricator <
>>>> reviews at reviews.llvm.org> wrote:
>>>>
>>>>> davidxl added a comment.
>>>>>
>>>>> Can you create a test case? It can be put under the Linux subdir.
>>>>>
>>>>>
>>>>> https://reviews.llvm.org/D29954
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170215/f6706136/attachment.html>


More information about the llvm-commits mailing list