RE: [EXT] Re: [PATCH] wait: don't wake up freezable wait by freezing fake signal

From: Ming Qian
Date: Mon Sep 25 2023 - 22:43:15 EST


>From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
>Sent: 2023年9月25日 18:08
>To: Ming Qian <ming.qian@xxxxxxx>
>Cc: mingo@xxxxxxxxxx; juri.lelli@xxxxxxxxxx; vincent.guittot@xxxxxxxxxx;
>dietmar.eggemann@xxxxxxx; rostedt@xxxxxxxxxxx; bsegall@xxxxxxxxxx;
>mgorman@xxxxxxx; bristot@xxxxxxxxxx; vschneid@xxxxxxxxxx; Eagle Zhou
><eagle.zhou@xxxxxxx>; Tao Jiang <tao.jiang_2@xxxxxxx>; dl-linux-imx
><linux-imx@xxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx; linux-arm-
>kernel@xxxxxxxxxxxxxxxxxxx
>Subject: [EXT] Re: [PATCH] wait: don't wake up freezable wait by freezing fake
>signal
>
>Caution: This is an external email. Please take care when clicking links or
>opening attachments. When in doubt, report the message using the 'Report
>this email' button
>
>
>On Tue, Aug 22, 2023 at 03:45:47PM +0800, Ming Qian wrote:
>> kernel may try to wake up task with fake signal when freezing task, if
>> the task is waiting event using wait_event_freezable, it's better to
>> freeze the wait, instead of breaking it.
>>
>> otherwise the caller may need to retry the wait, maybe like below
>> code:
>>
>> if (rc == -ERESTARTSYS && freezing(current)) {
>> clear_thread_flag(TIF_SIGPENDING);
>> goto again;
>> }
>
>I'm not sure I get it -- is there an actual problem, or are you trying to optimize
>something?

Hi Peter,
We have a driver that needs to interact with the daemon on nxp IMX8MP-EVK, Initially we use wait_event_interruptible to wait for a response from the daemon, but in our suspend test, sometimes we met failure which was caused by the waiting interrupted.
Then we use wait_event_freezable instead, but the problem remains. The above retry code should fix the problem, but we think it may be a common issue.
So we try to improve the wait_event_freezable, then we can pass our suspend test without any rety.

Ming