how to debug... program hangs while downing for write a rwsem

Chan Kim ckim at etri.re.kr
Wed Sep 21 07:02:50 EDT 2022


Hello kernel experts and users,

I'm trying to boot linux-5.10.0-rc5 on our arm64 board (using neoverse-v1
core).
After the shell comes up, when I press enter key at the prompt, it gives me
another prompt.
But when I press enter key again, it stops responding.
After inspecting where the program hangs, I found it hangs in function
tty_set_termios while downing the rwsem.
Please see below where I marked "<===== this line "". (in file
drivers/tty/tty_ioctl.c)

int tty_set_termios(struct tty_struct *tty, struct ktermios *new_termios)
{
    struct ktermios old_termios;
    struct tty_ldisc *ld;

    WARN_ON(tty->driver->type == TTY_DRIVER_TYPE_PTY &&
        tty->driver->subtype == PTY_TYPE_MASTER);
    /*
     *  Perform the actual termios internal changes under lock.
     */


    /* FIXME: we need to decide on some locking/ordering semantics
       for the set_termios notification eventually */
    down_write(&tty->termios_rwsem);                        <====== this
line
    old_termios = tty->termios;
    tty->termios = *new_termios;
    unset_locked_termios(tty, &old_termios);


I have to do some research on tty, line discpline, termios, and rw
semaphores etc. but could anyone give me any suggestion on what can be going
wrong? Or what to check first?
Any suggestion will be really appreciated. 
Thank you!

Chan Kim







More information about the Kernelnewbies mailing list