Re: [PATCH v2] timers: Recalculate next timer interrupt only when necessary

From: He Zhe
Date: Fri Jul 09 2021 - 05:25:56 EST




On 7/9/21 4:43 PM, Frederic Weisbecker wrote:
> On Fri, Jul 09, 2021 at 01:37:11PM +0800, He Zhe wrote:
>>
>> On 7/8/21 11:36 PM, Frederic Weisbecker wrote:
>>> On Thu, Jul 08, 2021 at 02:43:01PM +0800, He Zhe wrote:
>>>> Hi,
>>>>
>>>> Ever since this commit merged in, when nohz_full enabled, the counts of arch_timer interrupt on arm64 arches keep increasing on cores that have been isolated. This can be reproduced on several arm64 boards. After reverting the commit, the counts would stop increasing after boot. my .config is attached.
>>>>
>>>> root@qemuarm64:~# uname -a
>>>> Linux qemuarm64 5.13.0 #1 SMP PREEMPT Mon Jul 5 07:11:27 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
>>>> root@qemuarm64:~# cat /proc/cmdline
>>>> root=/dev/vda rw  mem=2048M ip=dhcp console=ttyAMA0 console=hvc0  earlyprintk isolcpus=1-5 nohz_full=1-5 rcu_nocbs=1-5
>>>> root@qemuarm64:~# cat /proc/interrupts
>>> And I'm not observing that on default aarch64 on qemu either.
>>> Are you emulating a specific machine?
>> Here is my qemu configuration.
>>
>> qemu-system-aarch64 --version
>> QEMU emulator version 6.0.0
>> Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers
>>
>> qemu-system-aarch64 -device virtio-net-device,netdev=net0,mac=52:54:00:12:35:02 -netdev user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23,tftp=/qemuarm64 -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 -drive id=disk0,file=/qemuarm64/qemuarm64.rootfs.ext4,if=none,format=raw -device virtio-blk-device,drive=disk0 -device qemu-xhci -device usb-tablet -device usb-kbd  -machine virt -cpu cortex-a57 -smp 4 -m 2048  -smp 6 -m 2048 -serial mon:stdio -serial null -nographic -device VGA,edid=on -kernel /qemuarm64/Image.bin -append 'root=/dev/vda rw  mem=2048M ip=dhcp console=ttyAMA0 console=hvc0 earlyprintk isolcpus=1-5 nohz_full=1-5 rcu_nocbs=1-5'
>>
>>> Can you enable the following trace events and send me the output from
>>> one of the isolated CPU trace, say CPU 3 for example:
>> output_to_send is attached.
>> I can confirm that during the sleep the count of arch_timer increases one on
>> each isolated core.
> Oh that's the trace from CPU 0, precisely the only one I don't need :o)
>
> It's my fault, the last line of the script should have been:
>
> cat $DIR/per_cpu/cpu3/trace > ~/output_to_send
>
> Sorry...

No problem. I didn't notice that either...

Then here is the result of cpu3
root@qemuarm64:~# cat output_to_send
# tracer: nop
#
# entries-in-buffer/entries-written: 19704/19704   #P:6
#
#                                _-----=> irqs-off
#                               / _----=> need-resched
#                              | / _---=> hardirq/softirq
#                              || / _--=> preempt-depth
#                              ||| /     delay
#           TASK-PID     CPU#  ||||   TIMESTAMP  FUNCTION
#              | |         |   ||||      |         |
          <idle>-0       [003] d.h1   346.216802: irq_handler_entry: irq=11 name=arch_timer
          <idle>-0       [003] d.h1   346.216862: irq_handler_exit: irq=11 ret=handled

Zhe