[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202007241523.l29BNdUY%lkp@intel.com>
Date: Fri, 24 Jul 2020 15:47:37 +0800
From: kernel test robot <lkp@...el.com>
To: Johan Hovold <johan@...nel.org>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Dmitry Safonov <0x7f454c46@...il.com>
Subject: drivers/tty/serial/msm_serial.c:748:25: sparse: sparse: context
imbalance in 'msm_handle_rx_dm' - unexpected unlock
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f37e99aca03f63aa3f2bd13ceaf769455d12c4b0
commit: 08d5470308ac3598e7709d08b8979ce6e9de8da2 serial: core: fix sysrq overhead regression
date: 4 weeks ago
config: arm64-randconfig-s031-20200723 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-93-g4c6cbe55-dirty
git checkout 08d5470308ac3598e7709d08b8979ce6e9de8da2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/tty/serial/msm_serial.c:748:25: sparse: sparse: context imbalance in 'msm_handle_rx_dm' - unexpected unlock
>> drivers/tty/serial/msm_serial.c:814:28: sparse: sparse: context imbalance in 'msm_handle_rx' - unexpected unlock
vim +/msm_handle_rx_dm +748 drivers/tty/serial/msm_serial.c
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 697
558abdb05fe0c7f drivers/tty/serial/msm_serial.c Ivan T. Ivanov 2015-09-30 698 static void msm_handle_rx_dm(struct uart_port *port, unsigned int misr)
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 699 {
92a19f9cec9a80a drivers/tty/serial/msm_serial.c Jiri Slaby 2013-01-03 700 struct tty_port *tport = &port->state->port;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 701 unsigned int sr;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 702 int count = 0;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 703 struct msm_port *msm_port = UART_TO_MSM(port);
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 704
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 705 if ((msm_read(port, UART_SR) & UART_SR_OVERRUN)) {
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 706 port->icount.overrun++;
92a19f9cec9a80a drivers/tty/serial/msm_serial.c Jiri Slaby 2013-01-03 707 tty_insert_flip_char(tport, 0, TTY_OVERRUN);
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 708 msm_write(port, UART_CR_CMD_RESET_ERR, UART_CR);
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 709 }
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 710
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 711 if (misr & UART_IMR_RXSTALE) {
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 712 count = msm_read(port, UARTDM_RX_TOTAL_SNAP) -
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 713 msm_port->old_snap_state;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 714 msm_port->old_snap_state = 0;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 715 } else {
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 716 count = 4 * (msm_read(port, UART_RFWR));
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 717 msm_port->old_snap_state += count;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 718 }
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 719
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 720 /* TODO: Precise error reporting */
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 721
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 722 port->icount.rx += count;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 723
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 724 while (count > 0) {
68252424a7c757c drivers/tty/serial/msm_serial.c Stephen Boyd 2014-06-30 725 unsigned char buf[4];
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 726 int sysrq, r_count, i;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 727
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 728 sr = msm_read(port, UART_SR);
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 729 if ((sr & UART_SR_RX_READY) == 0) {
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 730 msm_port->old_snap_state -= count;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 731 break;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 732 }
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 733
68252424a7c757c drivers/tty/serial/msm_serial.c Stephen Boyd 2014-06-30 734 ioread32_rep(port->membase + UARTDM_RF, buf, 1);
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 735 r_count = min_t(int, count, sizeof(buf));
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 736
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 737 for (i = 0; i < r_count; i++) {
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 738 char flag = TTY_NORMAL;
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 739
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 740 if (msm_port->break_detected && buf[i] == 0) {
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 741 port->icount.brk++;
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 742 flag = TTY_BREAK;
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 743 msm_port->break_detected = false;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 744 if (uart_handle_break(port))
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 745 continue;
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 746 }
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 747
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 @748 if (!(port->read_status_mask & UART_SR_RX_BREAK))
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 749 flag = TTY_NORMAL;
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 750
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 751 spin_unlock(&port->lock);
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 752 sysrq = uart_handle_sysrq_char(port, buf[i]);
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 753 spin_lock(&port->lock);
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 754 if (!sysrq)
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 755 tty_insert_flip_char(tport, buf[i], flag);
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 756 }
0896d4d4fb16229 drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 757 count -= r_count;
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 758 }
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 759
f77232dab25b8d8 drivers/tty/serial/msm_serial.c Viresh Kumar 2013-08-19 760 spin_unlock(&port->lock);
2e124b4a390ca85 drivers/tty/serial/msm_serial.c Jiri Slaby 2013-01-03 761 tty_flip_buffer_push(tport);
f77232dab25b8d8 drivers/tty/serial/msm_serial.c Viresh Kumar 2013-08-19 762 spin_lock(&port->lock);
f77232dab25b8d8 drivers/tty/serial/msm_serial.c Viresh Kumar 2013-08-19 763
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 764 if (misr & (UART_IMR_RXSTALE))
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 765 msm_write(port, UART_CR_CMD_RESET_STALE_INT, UART_CR);
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 766 msm_write(port, 0xFFFFFF, UARTDM_DMRX);
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 767 msm_write(port, UART_CR_CMD_STALE_EVENT_ENABLE, UART_CR);
99693945013a517 drivers/tty/serial/msm_serial.c Ivan T. Ivanov 2015-09-30 768
99693945013a517 drivers/tty/serial/msm_serial.c Ivan T. Ivanov 2015-09-30 769 /* Try to use DMA */
99693945013a517 drivers/tty/serial/msm_serial.c Ivan T. Ivanov 2015-09-30 770 msm_start_rx_dma(msm_port);
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 771 }
ec8f29e70edceb9 drivers/serial/msm_serial.c Stepan Moskovchenko 2010-12-21 772
558abdb05fe0c7f drivers/tty/serial/msm_serial.c Ivan T. Ivanov 2015-09-30 773 static void msm_handle_rx(struct uart_port *port)
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 774 {
92a19f9cec9a80a drivers/tty/serial/msm_serial.c Jiri Slaby 2013-01-03 775 struct tty_port *tport = &port->state->port;
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 776 unsigned int sr;
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 777
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 778 /*
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 779 * Handle overrun. My understanding of the hardware is that overrun
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 780 * is not tied to the RX buffer, so we handle the case out of band.
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 781 */
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 782 if ((msm_read(port, UART_SR) & UART_SR_OVERRUN)) {
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 783 port->icount.overrun++;
92a19f9cec9a80a drivers/tty/serial/msm_serial.c Jiri Slaby 2013-01-03 784 tty_insert_flip_char(tport, 0, TTY_OVERRUN);
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 785 msm_write(port, UART_CR_CMD_RESET_ERR, UART_CR);
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 786 }
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 787
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 788 /* and now the main RX loop */
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 789 while ((sr = msm_read(port, UART_SR)) & UART_SR_RX_READY) {
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 790 unsigned int c;
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 791 char flag = TTY_NORMAL;
660beb0e94ad81c drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 792 int sysrq;
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 793
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 794 c = msm_read(port, UART_RF);
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 795
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 796 if (sr & UART_SR_RX_BREAK) {
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 797 port->icount.brk++;
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 798 if (uart_handle_break(port))
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 799 continue;
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 800 } else if (sr & UART_SR_PAR_FRAME_ERR) {
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 801 port->icount.frame++;
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 802 } else {
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 803 port->icount.rx++;
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 804 }
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 805
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 806 /* Mask conditions we're ignorning. */
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 807 sr &= port->read_status_mask;
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 808
ddea392e614736a drivers/tty/serial/msm_serial.c Kiran Padwal 2014-08-05 809 if (sr & UART_SR_RX_BREAK)
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 810 flag = TTY_BREAK;
ddea392e614736a drivers/tty/serial/msm_serial.c Kiran Padwal 2014-08-05 811 else if (sr & UART_SR_PAR_FRAME_ERR)
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 812 flag = TTY_FRAME;
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 813
660beb0e94ad81c drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 @814 spin_unlock(&port->lock);
660beb0e94ad81c drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 815 sysrq = uart_handle_sysrq_char(port, c);
660beb0e94ad81c drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 816 spin_lock(&port->lock);
660beb0e94ad81c drivers/tty/serial/msm_serial.c Stephen Boyd 2014-10-29 817 if (!sysrq)
92a19f9cec9a80a drivers/tty/serial/msm_serial.c Jiri Slaby 2013-01-03 818 tty_insert_flip_char(tport, c, flag);
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 819 }
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 820
f77232dab25b8d8 drivers/tty/serial/msm_serial.c Viresh Kumar 2013-08-19 821 spin_unlock(&port->lock);
2e124b4a390ca85 drivers/tty/serial/msm_serial.c Jiri Slaby 2013-01-03 822 tty_flip_buffer_push(tport);
f77232dab25b8d8 drivers/tty/serial/msm_serial.c Viresh Kumar 2013-08-19 823 spin_lock(&port->lock);
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 824 }
04896a77a97b87e drivers/serial/msm_serial.c Robert Love 2009-06-22 825
:::::: The code at line 748 was first introduced by commit
:::::: 0896d4d4fb162297d7199410bae386a96a2e473b tty: serial: msm: Support sysrq on uartDM devices
:::::: TO: Stephen Boyd <sboyd@...eaurora.org>
:::::: CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (36599 bytes)
Powered by blists - more mailing lists