linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/vhost/net.c:1010 vhost_net_rx_peek_head_len() error: double unlocked 'sk->sk_receive_queue.lock' (orig line 1002)
@ 2020-08-08  7:37 kernel test robot
  2020-08-10 12:33 ` Michael S. Tsirkin
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2020-08-08  7:37 UTC (permalink / raw)
  To: Jason Wang; +Cc: kbuild-all, linux-kernel, Michael S. Tsirkin

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

Hi Jason,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   449dc8c97089a6e09fb2dac4d92b1b7ac0eb7c1e
commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 vhost: refine vhost and vringh kconfig
date:   4 months ago
config: arm-randconfig-m031-20200808 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

New smatch warnings:
drivers/vhost/net.c:1010 vhost_net_rx_peek_head_len() error: double unlocked 'sk->sk_receive_queue.lock' (orig line 1002)
drivers/vhost/net.c:1010 vhost_net_rx_peek_head_len() error: double unlocked 'sk->sk_receive_queue.lock' (orig line 1002)

Old smatch warnings:
drivers/vhost/net.c:1528 vhost_net_set_backend() warn: passing a valid pointer to 'PTR_ERR'

vim +1010 drivers/vhost/net.c

8dd014adfea6f17 David Stevens   2010-07-27   994  
be294a51adfc1e1 Toshiaki Makita 2018-07-03   995  static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk,
be294a51adfc1e1 Toshiaki Makita 2018-07-03   996  				      bool *busyloop_intr)
030881372460654 Jason Wang      2016-03-04   997  {
28b9b33b983f4de Toshiaki Makita 2018-07-03   998  	struct vhost_net_virtqueue *rnvq = &net->vqs[VHOST_NET_VQ_RX];
28b9b33b983f4de Toshiaki Makita 2018-07-03   999  	struct vhost_net_virtqueue *tnvq = &net->vqs[VHOST_NET_VQ_TX];
6369fec5be0aad4 Toshiaki Makita 2018-07-03  1000  	struct vhost_virtqueue *rvq = &rnvq->vq;
28b9b33b983f4de Toshiaki Makita 2018-07-03  1001  	struct vhost_virtqueue *tvq = &tnvq->vq;
28b9b33b983f4de Toshiaki Makita 2018-07-03 @1002  	int len = peek_head_len(rnvq, sk);
030881372460654 Jason Wang      2016-03-04  1003  
dc151282bbdaed0 Tonghao Zhang   2018-09-25  1004  	if (!len && rvq->busyloop_timeout) {
f5a4941aa6d190e Jason Wang      2018-05-29  1005  		/* Flush batched heads first */
09c3248938c3e3b Jason Wang      2018-07-20  1006  		vhost_net_signal_used(rnvq);
030881372460654 Jason Wang      2016-03-04  1007  		/* Both tx vq and rx socket were polled here */
dc151282bbdaed0 Tonghao Zhang   2018-09-25  1008  		vhost_net_busy_poll(net, rvq, tvq, busyloop_intr, true);
030881372460654 Jason Wang      2016-03-04  1009  
28b9b33b983f4de Toshiaki Makita 2018-07-03 @1010  		len = peek_head_len(rnvq, sk);
030881372460654 Jason Wang      2016-03-04  1011  	}
030881372460654 Jason Wang      2016-03-04  1012  
030881372460654 Jason Wang      2016-03-04  1013  	return len;
030881372460654 Jason Wang      2016-03-04  1014  }
030881372460654 Jason Wang      2016-03-04  1015  

:::::: The code at line 1010 was first introduced by commit
:::::: 28b9b33b983f4de3ce9e660e3efe1e08adabf779 vhost_net: Rename local variables in vhost_net_rx_peek_head_len

:::::: TO: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: drivers/vhost/net.c:1010 vhost_net_rx_peek_head_len() error: double unlocked 'sk->sk_receive_queue.lock' (orig line 1002)
  2020-08-08  7:37 drivers/vhost/net.c:1010 vhost_net_rx_peek_head_len() error: double unlocked 'sk->sk_receive_queue.lock' (orig line 1002) kernel test robot
@ 2020-08-10 12:33 ` Michael S. Tsirkin
  2020-08-11  3:03   ` Jason Wang
  2020-08-18  7:01   ` [kbuild-all] " Xia, Hui
  0 siblings, 2 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2020-08-10 12:33 UTC (permalink / raw)
  To: kernel test robot; +Cc: Jason Wang, kbuild-all, linux-kernel

On Sat, Aug 08, 2020 at 03:37:07PM +0800, kernel test robot wrote:
> Hi Jason,
> 
> First bad commit (maybe != root cause):
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   449dc8c97089a6e09fb2dac4d92b1b7ac0eb7c1e
> commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 vhost: refine vhost and vringh kconfig
> date:   4 months ago
> config: arm-randconfig-m031-20200808 (attached as .config)
> compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> New smatch warnings:
> drivers/vhost/net.c:1010 vhost_net_rx_peek_head_len() error: double unlocked 'sk->sk_receive_queue.lock' (orig line 1002)
> drivers/vhost/net.c:1010 vhost_net_rx_peek_head_len() error: double unlocked 'sk->sk_receive_queue.lock' (orig line 1002)

Weird. Can't figure out where the double unlock is ...


> Old smatch warnings:
> drivers/vhost/net.c:1528 vhost_net_set_backend() warn: passing a valid pointer to 'PTR_ERR'

this stumped me too...

> vim +1010 drivers/vhost/net.c
> 
> 8dd014adfea6f17 David Stevens   2010-07-27   994  
> be294a51adfc1e1 Toshiaki Makita 2018-07-03   995  static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk,
> be294a51adfc1e1 Toshiaki Makita 2018-07-03   996  				      bool *busyloop_intr)
> 030881372460654 Jason Wang      2016-03-04   997  {
> 28b9b33b983f4de Toshiaki Makita 2018-07-03   998  	struct vhost_net_virtqueue *rnvq = &net->vqs[VHOST_NET_VQ_RX];
> 28b9b33b983f4de Toshiaki Makita 2018-07-03   999  	struct vhost_net_virtqueue *tnvq = &net->vqs[VHOST_NET_VQ_TX];
> 6369fec5be0aad4 Toshiaki Makita 2018-07-03  1000  	struct vhost_virtqueue *rvq = &rnvq->vq;
> 28b9b33b983f4de Toshiaki Makita 2018-07-03  1001  	struct vhost_virtqueue *tvq = &tnvq->vq;
> 28b9b33b983f4de Toshiaki Makita 2018-07-03 @1002  	int len = peek_head_len(rnvq, sk);
> 030881372460654 Jason Wang      2016-03-04  1003  
> dc151282bbdaed0 Tonghao Zhang   2018-09-25  1004  	if (!len && rvq->busyloop_timeout) {
> f5a4941aa6d190e Jason Wang      2018-05-29  1005  		/* Flush batched heads first */
> 09c3248938c3e3b Jason Wang      2018-07-20  1006  		vhost_net_signal_used(rnvq);
> 030881372460654 Jason Wang      2016-03-04  1007  		/* Both tx vq and rx socket were polled here */
> dc151282bbdaed0 Tonghao Zhang   2018-09-25  1008  		vhost_net_busy_poll(net, rvq, tvq, busyloop_intr, true);
> 030881372460654 Jason Wang      2016-03-04  1009  
> 28b9b33b983f4de Toshiaki Makita 2018-07-03 @1010  		len = peek_head_len(rnvq, sk);
> 030881372460654 Jason Wang      2016-03-04  1011  	}
> 030881372460654 Jason Wang      2016-03-04  1012  
> 030881372460654 Jason Wang      2016-03-04  1013  	return len;
> 030881372460654 Jason Wang      2016-03-04  1014  }
> 030881372460654 Jason Wang      2016-03-04  1015  
> 
> :::::: The code at line 1010 was first introduced by commit
> :::::: 28b9b33b983f4de3ce9e660e3efe1e08adabf779 vhost_net: Rename local variables in vhost_net_rx_peek_head_len
> 
> :::::: TO: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
> :::::: CC: David S. Miller <davem@davemloft.net>
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: drivers/vhost/net.c:1010 vhost_net_rx_peek_head_len() error: double unlocked 'sk->sk_receive_queue.lock' (orig line 1002)
  2020-08-10 12:33 ` Michael S. Tsirkin
@ 2020-08-11  3:03   ` Jason Wang
  2020-08-18  7:01   ` [kbuild-all] " Xia, Hui
  1 sibling, 0 replies; 4+ messages in thread
From: Jason Wang @ 2020-08-11  3:03 UTC (permalink / raw)
  To: Michael S. Tsirkin, kernel test robot; +Cc: kbuild-all, linux-kernel


On 2020/8/10 下午8:33, Michael S. Tsirkin wrote:
> On Sat, Aug 08, 2020 at 03:37:07PM +0800, kernel test robot wrote:
>> Hi Jason,
>>
>> First bad commit (maybe != root cause):
>>
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head:   449dc8c97089a6e09fb2dac4d92b1b7ac0eb7c1e
>> commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 vhost: refine vhost and vringh kconfig
>> date:   4 months ago
>> config: arm-randconfig-m031-20200808 (attached as .config)
>> compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>> New smatch warnings:
>> drivers/vhost/net.c:1010 vhost_net_rx_peek_head_len() error: double unlocked 'sk->sk_receive_queue.lock' (orig line 1002)
>> drivers/vhost/net.c:1010 vhost_net_rx_peek_head_len() error: double unlocked 'sk->sk_receive_queue.lock' (orig line 1002)
> Weird. Can't figure out where the double unlock is ...


Yes, looks like a false positive.

Thanks


>
>
>> Old smatch warnings:
>> drivers/vhost/net.c:1528 vhost_net_set_backend() warn: passing a valid pointer to 'PTR_ERR'
> this stumped me too...
>
>> vim +1010 drivers/vhost/net.c
>>
>> 8dd014adfea6f17 David Stevens   2010-07-27   994
>> be294a51adfc1e1 Toshiaki Makita 2018-07-03   995  static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk,
>> be294a51adfc1e1 Toshiaki Makita 2018-07-03   996  				      bool *busyloop_intr)
>> 030881372460654 Jason Wang      2016-03-04   997  {
>> 28b9b33b983f4de Toshiaki Makita 2018-07-03   998  	struct vhost_net_virtqueue *rnvq = &net->vqs[VHOST_NET_VQ_RX];
>> 28b9b33b983f4de Toshiaki Makita 2018-07-03   999  	struct vhost_net_virtqueue *tnvq = &net->vqs[VHOST_NET_VQ_TX];
>> 6369fec5be0aad4 Toshiaki Makita 2018-07-03  1000  	struct vhost_virtqueue *rvq = &rnvq->vq;
>> 28b9b33b983f4de Toshiaki Makita 2018-07-03  1001  	struct vhost_virtqueue *tvq = &tnvq->vq;
>> 28b9b33b983f4de Toshiaki Makita 2018-07-03 @1002  	int len = peek_head_len(rnvq, sk);
>> 030881372460654 Jason Wang      2016-03-04  1003
>> dc151282bbdaed0 Tonghao Zhang   2018-09-25  1004  	if (!len && rvq->busyloop_timeout) {
>> f5a4941aa6d190e Jason Wang      2018-05-29  1005  		/* Flush batched heads first */
>> 09c3248938c3e3b Jason Wang      2018-07-20  1006  		vhost_net_signal_used(rnvq);
>> 030881372460654 Jason Wang      2016-03-04  1007  		/* Both tx vq and rx socket were polled here */
>> dc151282bbdaed0 Tonghao Zhang   2018-09-25  1008  		vhost_net_busy_poll(net, rvq, tvq, busyloop_intr, true);
>> 030881372460654 Jason Wang      2016-03-04  1009
>> 28b9b33b983f4de Toshiaki Makita 2018-07-03 @1010  		len = peek_head_len(rnvq, sk);
>> 030881372460654 Jason Wang      2016-03-04  1011  	}
>> 030881372460654 Jason Wang      2016-03-04  1012
>> 030881372460654 Jason Wang      2016-03-04  1013  	return len;
>> 030881372460654 Jason Wang      2016-03-04  1014  }
>> 030881372460654 Jason Wang      2016-03-04  1015
>>
>> :::::: The code at line 1010 was first introduced by commit
>> :::::: 28b9b33b983f4de3ce9e660e3efe1e08adabf779 vhost_net: Rename local variables in vhost_net_rx_peek_head_len
>>
>> :::::: TO: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
>> :::::: CC: David S. Miller <davem@davemloft.net>
>>
>> ---
>> 0-DAY CI Kernel Test Service, Intel Corporation
>> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [kbuild-all] Re: drivers/vhost/net.c:1010 vhost_net_rx_peek_head_len() error: double unlocked 'sk->sk_receive_queue.lock' (orig line 1002)
  2020-08-10 12:33 ` Michael S. Tsirkin
  2020-08-11  3:03   ` Jason Wang
@ 2020-08-18  7:01   ` Xia, Hui
  1 sibling, 0 replies; 4+ messages in thread
From: Xia, Hui @ 2020-08-18  7:01 UTC (permalink / raw)
  To: Michael S. Tsirkin, lkp; +Cc: Jason Wang, kbuild-all, linux-kernel



>-----Original Message-----
>From: Michael S. Tsirkin <mst@redhat.com>
>Sent: 2020年8月10日 20:34
>To: kernel test robot <lkp@intel.com>
>Cc: Jason Wang <jasowang@redhat.com>; kbuild-all@lists.01.org; linux-
>kernel@vger.kernel.org
>Subject: [kbuild-all] Re: drivers/vhost/net.c:1010 vhost_net_rx_peek_head_len()
>error: double unlocked 'sk->sk_receive_queue.lock' (orig line 1002)
>
>On Sat, Aug 08, 2020 at 03:37:07PM +0800, kernel test robot wrote:
>> Hi Jason,
>>
>> First bad commit (maybe != root cause):
>>
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head:   449dc8c97089a6e09fb2dac4d92b1b7ac0eb7c1e
>> commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 vhost: refine vhost
>and vringh kconfig
>> date:   4 months ago
>> config: arm-randconfig-m031-20200808 (attached as .config)
>> compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>> New smatch warnings:
>> drivers/vhost/net.c:1010 vhost_net_rx_peek_head_len() error: double
>> unlocked 'sk->sk_receive_queue.lock' (orig line 1002)
>> drivers/vhost/net.c:1010 vhost_net_rx_peek_head_len() error: double
>> unlocked 'sk->sk_receive_queue.lock' (orig line 1002)
>
>Weird. Can't figure out where the double unlock is ...
Please ignore this report. It is a false positive. 
We have changed the rule to avoid send out this warning type directly. Sorry for inconvenient.

>
>
>> Old smatch warnings:
>> drivers/vhost/net.c:1528 vhost_net_set_backend() warn: passing a valid pointer
>to 'PTR_ERR'
>
>this stumped me too...
Ignore this one too. It is old warnings.

Thanks,
Hui
>
>> vim +1010 drivers/vhost/net.c
>>
>> 8dd014adfea6f17 David Stevens   2010-07-27   994
>> be294a51adfc1e1 Toshiaki Makita 2018-07-03   995  static int
>vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk,
>> be294a51adfc1e1 Toshiaki Makita 2018-07-03   996
>	      bool *busyloop_intr)
>> 030881372460654 Jason Wang      2016-03-04   997  {
>> 28b9b33b983f4de Toshiaki Makita 2018-07-03   998  	struct
>vhost_net_virtqueue *rnvq = &net->vqs[VHOST_NET_VQ_RX];
>> 28b9b33b983f4de Toshiaki Makita 2018-07-03   999  	struct
>vhost_net_virtqueue *tnvq = &net->vqs[VHOST_NET_VQ_TX];
>> 6369fec5be0aad4 Toshiaki Makita 2018-07-03  1000  	struct vhost_virtqueue
>*rvq = &rnvq->vq;
>> 28b9b33b983f4de Toshiaki Makita 2018-07-03  1001  	struct vhost_virtqueue
>*tvq = &tnvq->vq;
>> 28b9b33b983f4de Toshiaki Makita 2018-07-03 @1002  	int len =
>peek_head_len(rnvq, sk);
>> 030881372460654 Jason Wang      2016-03-04  1003
>> dc151282bbdaed0 Tonghao Zhang   2018-09-25  1004  	if (!len && rvq-
>>busyloop_timeout) {
>> f5a4941aa6d190e Jason Wang      2018-05-29  1005  		/* Flush
>batched heads first */
>> 09c3248938c3e3b Jason Wang      2018-07-20  1006
>	vhost_net_signal_used(rnvq);
>> 030881372460654 Jason Wang      2016-03-04  1007  		/* Both tx vq
>and rx socket were polled here */
>> dc151282bbdaed0 Tonghao Zhang   2018-09-25  1008
>	vhost_net_busy_poll(net, rvq, tvq, busyloop_intr, true);
>> 030881372460654 Jason Wang      2016-03-04  1009
>> 28b9b33b983f4de Toshiaki Makita 2018-07-03 @1010  		len =
>peek_head_len(rnvq, sk);
>> 030881372460654 Jason Wang      2016-03-04  1011  	}
>> 030881372460654 Jason Wang      2016-03-04  1012
>> 030881372460654 Jason Wang      2016-03-04  1013  	return len;
>> 030881372460654 Jason Wang      2016-03-04  1014  }
>> 030881372460654 Jason Wang      2016-03-04  1015
>>
>> :::::: The code at line 1010 was first introduced by commit
>> :::::: 28b9b33b983f4de3ce9e660e3efe1e08adabf779 vhost_net: Rename
>> local variables in vhost_net_rx_peek_head_len
>>
>> :::::: TO: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
>> :::::: CC: David S. Miller <davem@davemloft.net>
>>
>> ---
>> 0-DAY CI Kernel Test Service, Intel Corporation
>> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>
>_______________________________________________
>kbuild-all mailing list -- kbuild-all@lists.01.org To unsubscribe send an email to
>kbuild-all-leave@lists.01.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-18  7:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-08  7:37 drivers/vhost/net.c:1010 vhost_net_rx_peek_head_len() error: double unlocked 'sk->sk_receive_queue.lock' (orig line 1002) kernel test robot
2020-08-10 12:33 ` Michael S. Tsirkin
2020-08-11  3:03   ` Jason Wang
2020-08-18  7:01   ` [kbuild-all] " Xia, Hui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).