[PATCH v2] usb: gadget: f_mass_storage: Move schedule() in sleep_thread()

Patrice CHOTARD patrice.chotard at foss.st.com
Wed Jul 1 08:27:43 CEST 2026



On 6/29/26 23:08, Marek Vasut wrote:
> On 6/29/26 8:24 AM, Patrice CHOTARD wrote:
>>
>>
>> On 6/25/26 14:36, Marek Vasut wrote:
>>> On 6/25/26 10:38 AM, Patrice Chotard wrote:
>>>> On STM32MP157C-DK2, when aborting the command "ums" using CTRL-C
>>>> it may take a while to get the control back on the console,
>>>> sometimes around 1 second.
>>>
>>> Why does that happen ?
>>>
>>> [...]
>>
>> On STM32MP157C-DK2 board, there are 3 cyclics registered which are called by schedule():
>>    _ mmc_cyclic_cd_poll (1 to 2us) every 100 ms
>>    _ watchdog at 5a002000
>>    _ video_idle
>>
>> schedule is called on every loop, whereas ctrlc() (CTRL+C detection) is called every 10 * 20000 loops.
>> That means ctrlc() is called every ~700ms on STM32MP157C-DK2 board,
> 
> What takes 700ms in sleep_thread() , surely not schedule() ?

Hi Marek

On STM32MP157C-dk2, each schedule() execution takes between 2 and 4us depending of the cyclics function to execute.
> 
>> Moving schedule() from main loop to same level that ctrlc(), it allows to call ctrlc() every ~70ms
>> which increase reactivity when user hit CTRL+C.
> Maybe I am too tired, but that does not sound right to me. Why is ctrlc() called every 700ms, where does that massive delay come from?

schedule is called on each loop, ctrlc() is called every 200000 loops, that explain why there is around 700ms between each ctrlc() execution.

Patrice


More information about the U-Boot mailing list