• H
    hvc_console: Fix loop if put_char() returns 0 · 3feebbb5
    Hendrik Brueckner 提交于
    If put_char() routine of a hvc console backend returns 0, then the
    hvc console starts looping in the following scenarios:
    
    1. hvc_console_print()
    	If put_char() returns 0 then the while loop may loop forever.
    	I have added the missing check for 0 to throw away console messages.
    
    2. khvcd may loop:
    	The thread calls hvc_poll() --> hvc_push()... if there are still
    	buffered data then the HVC_POLL_WRITE bit is set and causes the
    	khvcd thread to loop (if yield() returns immediately).
    
    	However, instead of looping, the khvcd thread could sleep for
    	MIN_TIMEOUT (doing the same as for get_chars()).
    	The MIN_TIMEOUT is set if hvc_push() was not able to write
    	data to the backend. If data has been written, the timeout is
    	set to 0 to immediately re-schedule hvc_poll().
    Reviewed-by: NChristian Borntraeger <borntraeger@de.ibm.com>
    Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> (virtio_console)
    Signed-off-by: NHendrik Brueckner <brueckner@linux.vnet.ibm.com>
    Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
    3feebbb5
hvc_console.c 20.3 KB