Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'tty-4.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty fixes from Greg KH:
"Here are three small HVC tty driver fixes to resolve a reported
regression from 4.19-rc1.

All of these have been in linux-next for a while with no reported
issues"

* tag 'tty-4.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
tty: hvc: hvc_write() fix break condition
tty: hvc: hvc_poll() fix read loop batching
tty: hvc: hvc_poll() fix read loop hang

+33 -5
+33 -5
drivers/tty/hvc/hvc_console.c
··· 522 522 return -EIO; 523 523 524 524 while (count > 0) { 525 + int ret = 0; 526 + 525 527 spin_lock_irqsave(&hp->lock, flags); 526 528 527 529 rsize = hp->outbuf_size - hp->n_outbuf; ··· 539 537 } 540 538 541 539 if (hp->n_outbuf > 0) 542 - hvc_push(hp); 540 + ret = hvc_push(hp); 543 541 544 542 spin_unlock_irqrestore(&hp->lock, flags); 543 + 544 + if (!ret) 545 + break; 545 546 546 547 if (count) { 547 548 if (hp->n_outbuf > 0) ··· 628 623 #define MAX_TIMEOUT (2000) 629 624 static u32 timeout = MIN_TIMEOUT; 630 625 626 + /* 627 + * Maximum number of bytes to get from the console driver if hvc_poll is 628 + * called from driver (and can't sleep). Any more than this and we break 629 + * and start polling with khvcd. This value was derived from from an OpenBMC 630 + * console with the OPAL driver that results in about 0.25ms interrupts off 631 + * latency. 632 + */ 633 + #define HVC_ATOMIC_READ_MAX 128 634 + 631 635 #define HVC_POLL_READ 0x00000001 632 636 #define HVC_POLL_WRITE 0x00000002 633 637 ··· 683 669 if (!hp->irq_requested) 684 670 poll_mask |= HVC_POLL_READ; 685 671 672 + read_again: 686 673 /* Read data if any */ 687 - 688 674 count = tty_buffer_request_room(&hp->port, N_INBUF); 689 675 690 676 /* If flip is full, just reschedule a later read */ ··· 731 717 #endif /* CONFIG_MAGIC_SYSRQ */ 732 718 tty_insert_flip_char(&hp->port, buf[i], 0); 733 719 } 734 - if (n == count) 735 - poll_mask |= HVC_POLL_READ; 736 - read_total = n; 720 + read_total += n; 721 + 722 + if (may_sleep) { 723 + /* Keep going until the flip is full */ 724 + spin_unlock_irqrestore(&hp->lock, flags); 725 + cond_resched(); 726 + spin_lock_irqsave(&hp->lock, flags); 727 + goto read_again; 728 + } else if (read_total < HVC_ATOMIC_READ_MAX) { 729 + /* Break and defer if it's a large read in atomic */ 730 + goto read_again; 731 + } 732 + 733 + /* 734 + * Latency break, schedule another poll immediately. 735 + */ 736 + poll_mask |= HVC_POLL_READ; 737 737 738 738 out: 739 739 /* Wakeup write queue if necessary */