Linux Serial subsystem development
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
Cc: kbuild-all@01.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>, Evan Green <evgreen@chromium.org>,
	Doug Anderson <dianders@chromium.org>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	Stephen Boyd <swboyd@chromium.org>,
	Ryan Case <ryandcase@chromium.org>
Subject: Re: [PATCH v2] tty: serial: qcom_geni_serial: Fix softlock
Date: Thu, 29 Nov 2018 18:17:02 +0800	[thread overview]
Message-ID: <201811291856.ArMgiive%fengguang.wu@intel.com> (raw)
In-Reply-To: <20181128235459.180940-1-ryandcase@chromium.org>

[-- Attachment #1: Type: text/plain, Size: 4327 bytes --]

Hi Ryan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on v4.20-rc4 next-20181129]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ryan-Case/tty-serial-qcom_geni_serial-Fix-softlock/20181129-174407
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=mips 

All warnings (new ones prefixed by >>):

   In file included from include/linux/clk.h:16:0,
                    from drivers/tty/serial/qcom_geni_serial.c:8:
   drivers/tty/serial/qcom_geni_serial.c: In function 'qcom_geni_serial_handle_tx':
   include/linux/kernel.h:845:29: warning: comparison of distinct pointer types lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:859:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:869:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:878:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
   include/linux/kernel.h:893:23: note: in expansion of macro 'min'
    #define min3(x, y, z) min((typeof(x))min(x, y), z)
                          ^~~
>> drivers/tty/serial/qcom_geni_serial.c:746:10: note: in expansion of macro 'min3'
     chunk = min3(avail, pending, (UART_XMIT_SIZE - tail));
             ^~~~

vim +/min3 +746 drivers/tty/serial/qcom_geni_serial.c

   714	
   715	static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done,
   716			bool active)
   717	{
   718		struct qcom_geni_serial_port *port = to_dev_port(uport, uport);
   719		struct circ_buf *xmit = &uport->state->xmit;
   720		size_t avail;
   721		size_t remaining;
   722		size_t pending;
   723		int i;
   724		u32 status;
   725		unsigned int chunk;
   726		int tail;
   727	
   728		status = readl_relaxed(uport->membase + SE_GENI_TX_FIFO_STATUS);
   729	
   730		/* Complete the current tx command before taking newly added data */
   731		if (active)
   732			pending = port->tx_remaining;
   733		else
   734			pending = uart_circ_chars_pending(xmit);
   735	
   736		/* All data has been transmitted and acknowledged as received */
   737		if (!pending && !status && done) {
   738			qcom_geni_serial_stop_tx(uport);
   739			goto out_write_wakeup;
   740		}
   741	
   742		avail = port->tx_fifo_depth - (status & TX_FIFO_WC);
   743		avail *= port->tx_bytes_pw;
   744	
   745		tail = xmit->tail;
 > 746		chunk = min3(avail, pending, (UART_XMIT_SIZE - tail));
   747		if (!chunk)
   748			goto out_write_wakeup;
   749	
   750		if (!port->tx_remaining) {
   751			qcom_geni_serial_setup_tx(uport, pending);
   752			port->tx_remaining = pending;
   753		}
   754	
   755		remaining = chunk;
   756		for (i = 0; i < chunk; ) {
   757			unsigned int tx_bytes;
   758			u8 buf[sizeof(u32)];
   759			int c;
   760	
   761			memset(buf, 0, ARRAY_SIZE(buf));
   762			tx_bytes = min_t(size_t, remaining, port->tx_bytes_pw);
   763			for (c = 0; c < tx_bytes ; c++)
   764				buf[c] = xmit->buf[tail + c];
   765	
   766			iowrite32_rep(uport->membase + SE_GENI_TX_FIFOn, buf, 1);
   767	
   768			i += tx_bytes;
   769			tail += tx_bytes;
   770			uport->icount.tx += tx_bytes;
   771			remaining -= tx_bytes;
   772			port->tx_remaining -= tx_bytes;
   773		}
   774	
   775		xmit->tail = tail & (UART_XMIT_SIZE - 1);
   776	out_write_wakeup:
   777		if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
   778			uart_write_wakeup(uport);
   779	}
   780	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 58323 bytes --]

  reply	other threads:[~2018-11-29 10:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28 23:54 [PATCH v2] tty: serial: qcom_geni_serial: Fix softlock Ryan Case
2018-11-29 10:17 ` kbuild test robot [this message]
2018-11-29 22:12 ` Doug Anderson
2018-11-30  1:51   ` Ryan Case

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201811291856.ArMgiive%fengguang.wu@intel.com \
    --to=lkp@intel.com \
    --cc=dianders@chromium.org \
    --cc=evgreen@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=ryandcase@chromium.org \
    --cc=swboyd@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox