Description of problem: agetty process consuming nearly 100% CPU after login on ttyS0 Version-Release number of selected component (if applicable): util-linux-2.23.2-52.el7.x86_64 How reproducible: Conditionally Reoccur Steps to Reproduce: 1.In a rhel7.5 vm ,I add "console=ttyS0," in the grub.cfg : # cat /proc/cmdline BOOT_IMAGE=/vmlinuz-3.10.0-862.el7.x86_64 root=/dev/mapper/rhel-root ro crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet LANG=zh_CN.UTF-8 console=ttyS0,115200 2.execute this command: /sbin/agetty -L 115200 ttyS0 vt102 3.On the host, I execute "virsh console [vm-name]" to login on ttyS0 Actual results: After I login in the system on ttyS0 , I find that agetty process consumes nearly 100% CPU always. top - 18:47:08 up 18 min, 1 user, load average: 1.00, 0.96, 0.71 Tasks: 111 total, 2 running, 109 sleeping, 0 stopped, 0 zombie %Cpu(s): 14.9 us, 34.5 sy, 0.0 ni, 50.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.3 st KiB Mem : 1833564 total, 1522712 free, 108552 used, 202300 buff/cache KiB Swap: 2097148 total, 2097148 free, 0 used. 1552444 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1507 root 20 0 110464 1148 984 R 99.3 0.1 13:19.36 agetty 1538 root 20 0 161984 2276 1556 R 0.7 0.1 0:00.05 top 1 root 20 0 127948 6568 4144 S 0.0 0.4 0:01.86 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:00.03 ksoftirqd/0 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H ---In addition,when I strace the process,I find that read() has been called constantly: [root@localhost ~]# ps -ef |grep agetty root 678 1 0 18:28 tty1 00:00:00 /sbin/agetty --noclear tty1 linux root 1507 1480 55 18:33 pts/0 00:00:53 /sbin/agetty -L 115200 ttyS0 vt102 root 1517 1 0 18:34 ttyS0 00:00:00 /sbin/agetty --keep-baud 115200 38400 9600 ttyS0 vt220 root 1523 1480 0 18:34 pts/0 00:00:00 grep --color=auto agetty [root@localhost ~]# strace -f -p 1507 read(0, "", 1) = 0 read(0, "", 1) = 0 read(0, "", 1) = 0 read(0, "", 1) = 0 read(0, "", 1) = 0 read(0, "", 1) = 0 ... read() is called in a very high frequency. Expected results: Process agetty should not consume so much CPU time always Additional info: suse11.4 is OK , It's util-linux version is 2.19.1-6.72.1
> root 1507 1480 55 18:33 pts/0 00:00:53 /sbin/agetty -L 115200 ttyS0 ^^^^ It seems you're running agetty on already established session with another terminal, right? If yes, that it does not make sense. It has to be executed by init against the specified terminal. And note that aggety is only waiting for users log-in. After your log-in it executes login(1) and it executes bash(1). It means after log-in there is no agetty process at all on the terminal. From your example it seems you have regular agetty (executed by init on ttyS0 and used for your log-in) and another agetty executed manually on the same tty.
> It seems you're running agetty on already established session with another terminal, right? If yes, that it does not make sense. It has to be executed by init against the specified terminal. Thank you! I already understand why.