CC: kbuild-...@lists.01.org
CC: Doug Ledford <dledf...@redhat.com>
CC: Jason Gunthorpe <jgg+li...@ziepe.ca>
CC: linux-r...@vger.kernel.org
TO: "Jason, Gunthorpe," <j...@mellanox.com>
CC: Leon Romanovsky <leo...@mellanox.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git 
wip/jgg-for-next
head:   70ae395550333607bda245db5270211b6ef8ab00
commit: e83f195aa45c1ffd73b3a950a887e41c260cf194 [81/231] RDMA/cm: Pull 
duplicated code into cm_queue_work_unlock()
:::::: branch date: 2 hours ago
:::::: commit date: 3 weeks ago
config: microblaze-randconfig-s032-20200601 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-243-gc100a7ab-dirty
        git checkout e83f195aa45c1ffd73b3a950a887e41c260cf194
        # save the attached .config to linux build tree
        make W=1 C=1 ARCH=microblaze CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

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


sparse warnings: (new ones prefixed by >>)

   include/linux/byteorder/big_endian.h:8:2: sparse: sparse: inconsistent 
configuration, needs CONFIG_CPU_BIG_ENDIAN
   drivers/infiniband/core/cm.c:1297:21: sparse: sparse: cast from restricted 
__be32
   drivers/infiniband/core/cm.c:936:24: sparse: sparse: context imbalance in 
'cm_queue_work_unlock' - unexpected unlock
>> drivers/infiniband/core/cm.c:2043:12: sparse: sparse: context imbalance in 
>> 'cm_req_handler' - different lock contexts for basic block
   drivers/infiniband/core/cm.c:2422:12: sparse: sparse: context imbalance in 
'cm_rep_handler' - different lock contexts for basic block
   drivers/infiniband/core/cm.c:2533:12: sparse: sparse: context imbalance in 
'cm_establish_handler' - different lock contexts for basic block
>> drivers/infiniband/core/cm.c:2556:12: sparse: sparse: context imbalance in 
>> 'cm_rtu_handler' - different lock contexts for basic block
   drivers/infiniband/core/cm.c:2770:12: sparse: sparse: context imbalance in 
'cm_dreq_handler' - different lock contexts for basic block
   drivers/infiniband/core/cm.c:2847:12: sparse: sparse: context imbalance in 
'cm_drep_handler' - different lock contexts for basic block
   drivers/infiniband/core/cm.c:2995:12: sparse: sparse: context imbalance in 
'cm_rej_handler' - wrong count at exit
   drivers/infiniband/core/cm.c:3153:12: sparse: sparse: context imbalance in 
'cm_mra_handler' - different lock contexts for basic block
   drivers/infiniband/core/cm.c:3271:12: sparse: sparse: context imbalance in 
'cm_lap_handler' - different lock contexts for basic block
>> drivers/infiniband/core/cm.c:3360:12: sparse: sparse: context imbalance in 
>> 'cm_apr_handler' - different lock contexts for basic block
>> drivers/infiniband/core/cm.c:3405:12: sparse: sparse: context imbalance in 
>> 'cm_timewait_handler' - different lock contexts for basic block

# 
https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/commit/?id=e83f195aa45c1ffd73b3a950a887e41c260cf194
git remote add rdma 
https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git
git remote update rdma
git checkout e83f195aa45c1ffd73b3a950a887e41c260cf194
vim +/cm_req_handler +2043 drivers/infiniband/core/cm.c

3971c9f6dbf26f Sean Hefty                  2007-12-10  2042  
a977049dacdef6 Hal Rosenstock              2005-07-27 @2043  static int 
cm_req_handler(struct cm_work *work)
a977049dacdef6 Hal Rosenstock              2005-07-27  2044  {
a977049dacdef6 Hal Rosenstock              2005-07-27  2045     struct 
cm_id_private *cm_id_priv, *listen_cm_id_priv;
a977049dacdef6 Hal Rosenstock              2005-07-27  2046     struct 
cm_req_msg *req_msg;
d8966fcd4c2570 Dasaratharaman Chandramouli 2017-04-29  2047     const struct 
ib_global_route *grh;
a8872d53e9b7fc Parav Pandit                2018-06-19  2048     const struct 
ib_gid_attr *gid_attr;
a977049dacdef6 Hal Rosenstock              2005-07-27  2049     int ret;
a977049dacdef6 Hal Rosenstock              2005-07-27  2050  
a977049dacdef6 Hal Rosenstock              2005-07-27  2051     req_msg = 
(struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad;
a977049dacdef6 Hal Rosenstock              2005-07-27  2052  
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2053     cm_id_priv =
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2054             
cm_alloc_id_priv(work->port->cm_dev->ib_device, NULL, NULL);
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2055     if 
(IS_ERR(cm_id_priv))
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2056             return 
PTR_ERR(cm_id_priv);
a977049dacdef6 Hal Rosenstock              2005-07-27  2057  
91b60a7128d962 Jason Gunthorpe             2020-01-16  2058     
cm_id_priv->id.remote_id =
91b60a7128d962 Jason Gunthorpe             2020-01-16  2059             
cpu_to_be32(IBA_GET(CM_REQ_LOCAL_COMM_ID, req_msg));
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2060     
cm_id_priv->id.service_id =
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2061             
cpu_to_be64(IBA_GET(CM_REQ_SERVICE_ID, req_msg));
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2062     
cm_id_priv->id.service_mask = ~cpu_to_be64(0);
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2063     cm_id_priv->tid 
= req_msg->hdr.tid;
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2064     
cm_id_priv->timeout_ms = cm_convert_to_ms(
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2065             
IBA_GET(CM_REQ_LOCAL_CM_RESPONSE_TIMEOUT, req_msg));
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2066     
cm_id_priv->max_cm_retries = IBA_GET(CM_REQ_MAX_CM_RETRIES, req_msg);
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2067     
cm_id_priv->remote_qpn =
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2068             
cpu_to_be32(IBA_GET(CM_REQ_LOCAL_QPN, req_msg));
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2069     
cm_id_priv->initiator_depth =
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2070             
IBA_GET(CM_REQ_RESPONDER_RESOURCES, req_msg);
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2071     
cm_id_priv->responder_resources =
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2072             
IBA_GET(CM_REQ_INITIATOR_DEPTH, req_msg);
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2073     
cm_id_priv->path_mtu = IBA_GET(CM_REQ_PATH_PACKET_PAYLOAD_MTU, req_msg);
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2074     
cm_id_priv->pkey = cpu_to_be16(IBA_GET(CM_REQ_PARTITION_KEY, req_msg));
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2075     
cm_id_priv->sq_psn = cpu_to_be32(IBA_GET(CM_REQ_STARTING_PSN, req_msg));
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2076     
cm_id_priv->retry_count = IBA_GET(CM_REQ_RETRY_COUNT, req_msg);
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2077     
cm_id_priv->rnr_retry_count = IBA_GET(CM_REQ_RNR_RETRY_COUNT, req_msg);
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2078     
cm_id_priv->qp_type = cm_req_get_qp_type(req_msg);
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2079  
0c4386ec77cfcd Parav Pandit                2017-11-14  2080     ret = 
cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
ca222c6b2c48e1 Sean Hefty                  2006-06-17  2081                     
              work->mad_recv_wc->recv_buf.grh,
a977049dacdef6 Hal Rosenstock              2005-07-27  2082                     
              &cm_id_priv->av);
0c4386ec77cfcd Parav Pandit                2017-11-14  2083     if (ret)
0c4386ec77cfcd Parav Pandit                2017-11-14  2084             goto 
destroy;
a977049dacdef6 Hal Rosenstock              2005-07-27  2085     
cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv->
a977049dacdef6 Hal Rosenstock              2005-07-27  2086                     
                                    id.local_id);
a977049dacdef6 Hal Rosenstock              2005-07-27  2087     if 
(IS_ERR(cm_id_priv->timewait_info)) {
a977049dacdef6 Hal Rosenstock              2005-07-27  2088             ret = 
PTR_ERR(cm_id_priv->timewait_info);
76842405fca5f8 Sean Hefty                  2006-08-28  2089             goto 
destroy;
a977049dacdef6 Hal Rosenstock              2005-07-27  2090     }
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2091     
cm_id_priv->timewait_info->work.remote_id = cm_id_priv->id.remote_id;
91b60a7128d962 Jason Gunthorpe             2020-01-16  2092     
cm_id_priv->timewait_info->remote_ca_guid =
91b60a7128d962 Jason Gunthorpe             2020-01-16  2093             
cpu_to_be64(IBA_GET(CM_REQ_LOCAL_CA_GUID, req_msg));
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2094     
cm_id_priv->timewait_info->remote_qpn = cm_id_priv->remote_qpn;
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2095  
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2096     /*
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2097      * Note that 
the ID pointer is not in the xarray at this point,
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2098      * so this set 
is only visible to the local thread.
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2099      */
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2100     
cm_id_priv->id.state = IB_CM_REQ_RCVD;
a977049dacdef6 Hal Rosenstock              2005-07-27  2101  
a977049dacdef6 Hal Rosenstock              2005-07-27  2102     
listen_cm_id_priv = cm_match_req(work, cm_id_priv);
a977049dacdef6 Hal Rosenstock              2005-07-27  2103     if 
(!listen_cm_id_priv) {
119bf81793ea95 Daniel Jurgens              2017-11-14  2104             
pr_debug("%s: local_id %d, no listen_cm_id_priv\n", __func__,
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2105                     
 be32_to_cpu(cm_id_priv->id.local_id));
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2106             
cm_id_priv->id.state = IB_CM_IDLE;
a977049dacdef6 Hal Rosenstock              2005-07-27  2107             ret = 
-EINVAL;
bede86a39d9dc3 Jason Gunthorpe             2020-03-10  2108             goto 
destroy;
a977049dacdef6 Hal Rosenstock              2005-07-27  2109     }
a977049dacdef6 Hal Rosenstock              2005-07-27  2110  
3971c9f6dbf26f Sean Hefty                  2007-12-10  2111     
cm_process_routed_req(req_msg, work->mad_recv_wc->wc);
dd5f03beb4f76a Matan Barak                 2013-12-12  2112  
9fdca4da4d8c83 Dasaratharaman Chandramouli 2017-04-27  2113     
memset(&work->path[0], 0, sizeof(work->path[0]));
5a3dc32372439e Parav Pandit                2017-10-19  2114     if 
(cm_req_has_alt_path(req_msg))
9fdca4da4d8c83 Dasaratharaman Chandramouli 2017-04-27  2115             
memset(&work->path[1], 0, sizeof(work->path[1]));
d8966fcd4c2570 Dasaratharaman Chandramouli 2017-04-29  2116     grh = 
rdma_ah_read_grh(&cm_id_priv->av.ah_attr);
a8872d53e9b7fc Parav Pandit                2018-06-19  2117     gid_attr = 
grh->sgid_attr;
16c72e402867e9 Parav Pandit                2017-11-14  2118  
8f974860249129 Parav Pandit                2019-05-02  2119     if (gid_attr &&
8f974860249129 Parav Pandit                2019-05-02  2120         
rdma_protocol_roce(work->port->cm_dev->ib_device,
8f974860249129 Parav Pandit                2019-05-02  2121                     
       work->port->port_num)) {
dfa834e1d97e24 Dasaratharaman Chandramouli 2017-04-27  2122             
work->path[0].rec_type =
a8872d53e9b7fc Parav Pandit                2018-06-19  2123                     
sa_conv_gid_to_pathrec_type(gid_attr->gid_type);
dfa834e1d97e24 Dasaratharaman Chandramouli 2017-04-27  2124     } else {
4ca662a30a3c9c Jason Gunthorpe             2020-01-16  2125             
cm_path_set_rec_type(
4ca662a30a3c9c Jason Gunthorpe             2020-01-16  2126                     
work->port->cm_dev->ib_device, work->port->port_num,
6b3c0e6e6d5abf Dasaratharaman Chandramouli 2017-06-08  2127                     
&work->path[0],
4ca662a30a3c9c Jason Gunthorpe             2020-01-16  2128                     
IBA_GET_MEM_PTR(CM_REQ_PRIMARY_LOCAL_PORT_GID,
4ca662a30a3c9c Jason Gunthorpe             2020-01-16  2129                     
                req_msg));
200298326b276d Matan Barak                 2015-12-23  2130     }
6b3c0e6e6d5abf Dasaratharaman Chandramouli 2017-06-08  2131     if 
(cm_req_has_alt_path(req_msg))
9fdca4da4d8c83 Dasaratharaman Chandramouli 2017-04-27  2132             
work->path[1].rec_type = work->path[0].rec_type;
9fdca4da4d8c83 Dasaratharaman Chandramouli 2017-04-27  2133     
cm_format_paths_from_req(req_msg, &work->path[0],
9fdca4da4d8c83 Dasaratharaman Chandramouli 2017-04-27  2134                     
         &work->path[1]);
9fdca4da4d8c83 Dasaratharaman Chandramouli 2017-04-27  2135     if 
(cm_id_priv->av.ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE)
9fdca4da4d8c83 Dasaratharaman Chandramouli 2017-04-27  2136             
sa_path_set_dmac(&work->path[0],
9fdca4da4d8c83 Dasaratharaman Chandramouli 2017-04-27  2137                     
         cm_id_priv->av.ah_attr.roce.dmac);
9fdca4da4d8c83 Dasaratharaman Chandramouli 2017-04-27  2138     
work->path[0].hop_limit = grh->hop_limit;
a8872d53e9b7fc Parav Pandit                2018-06-19  2139     ret = 
cm_init_av_by_path(&work->path[0], gid_attr, &cm_id_priv->av,
9db0ff53cb9b43 Mark Bloch                  2016-10-27  2140                     
         cm_id_priv);
76842405fca5f8 Sean Hefty                  2006-08-28  2141     if (ret) {
16c72e402867e9 Parav Pandit                2017-11-14  2142             int err;
16c72e402867e9 Parav Pandit                2017-11-14  2143  
1dfce294577120 Parav Pandit                2018-06-05  2144             err = 
rdma_query_gid(work->port->cm_dev->ib_device,
cb57bb849effca Matan Barak                 2015-12-23  2145                     
             work->port->port_num, 0,
1dfce294577120 Parav Pandit                2018-06-05  2146                     
             &work->path[0].sgid);
16c72e402867e9 Parav Pandit                2017-11-14  2147             if (err)
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2148                     
ib_send_cm_rej(&cm_id_priv->id, IB_CM_REJ_INVALID_GID,
16c72e402867e9 Parav Pandit                2017-11-14  2149                     
               NULL, 0, NULL, 0);
16c72e402867e9 Parav Pandit                2017-11-14  2150             else
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2151                     
ib_send_cm_rej(&cm_id_priv->id, IB_CM_REJ_INVALID_GID,
16c72e402867e9 Parav Pandit                2017-11-14  2152                     
               &work->path[0].sgid,
16c72e402867e9 Parav Pandit                2017-11-14  2153                     
               sizeof(work->path[0].sgid),
76842405fca5f8 Sean Hefty                  2006-08-28  2154                     
               NULL, 0);
76842405fca5f8 Sean Hefty                  2006-08-28  2155             goto 
rejected;
76842405fca5f8 Sean Hefty                  2006-08-28  2156     }
6b3c0e6e6d5abf Dasaratharaman Chandramouli 2017-06-08  2157     if 
(cm_req_has_alt_path(req_msg)) {
398391071f2576 Parav Pandit                2018-06-19  2158             ret = 
cm_init_av_by_path(&work->path[1], NULL,
398391071f2576 Parav Pandit                2018-06-19  2159                     
                 &cm_id_priv->alt_av, cm_id_priv);
76842405fca5f8 Sean Hefty                  2006-08-28  2160             if 
(ret) {
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2161                     
ib_send_cm_rej(&cm_id_priv->id,
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2162                     
               IB_CM_REJ_INVALID_ALT_GID,
76842405fca5f8 Sean Hefty                  2006-08-28  2163                     
               &work->path[0].sgid,
16c72e402867e9 Parav Pandit                2017-11-14  2164                     
               sizeof(work->path[0].sgid), NULL, 0);
76842405fca5f8 Sean Hefty                  2006-08-28  2165                     
goto rejected;
76842405fca5f8 Sean Hefty                  2006-08-28  2166             }
a977049dacdef6 Hal Rosenstock              2005-07-27  2167     }
a977049dacdef6 Hal Rosenstock              2005-07-27  2168  
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2169     
cm_id_priv->id.cm_handler = listen_cm_id_priv->id.cm_handler;
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2170     
cm_id_priv->id.context = listen_cm_id_priv->id.context;
a977049dacdef6 Hal Rosenstock              2005-07-27  2171     
cm_format_req_event(work, cm_id_priv, &listen_cm_id_priv->id);
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2172  
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2173     /* Now MAD 
handlers can see the new ID */
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2174     
spin_lock_irq(&cm_id_priv->lock);
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2175     
cm_finalize_id(cm_id_priv);
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2176  
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2177     /* Refcount 
belongs to the event, pairs with cm_process_work() */
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2178     
refcount_inc(&cm_id_priv->refcount);
e83f195aa45c1f Jason Gunthorpe             2020-05-06  2179     
cm_queue_work_unlock(cm_id_priv, work);
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2180     /*
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2181      * Since this 
ID was just created and was not made visible to other MAD
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2182      * handlers 
until the cm_finalize_id() above we know that the
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2183      * 
cm_process_work() will deliver the event and the listen_cm_id
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2184      * embedded in 
the event can be derefed here.
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2185      */
a977049dacdef6 Hal Rosenstock              2005-07-27  2186     
cm_deref_id(listen_cm_id_priv);
a977049dacdef6 Hal Rosenstock              2005-07-27  2187     return 0;
a977049dacdef6 Hal Rosenstock              2005-07-27  2188  
76842405fca5f8 Sean Hefty                  2006-08-28  2189  rejected:
a977049dacdef6 Hal Rosenstock              2005-07-27  2190     
cm_deref_id(listen_cm_id_priv);
76842405fca5f8 Sean Hefty                  2006-08-28  2191  destroy:
c206f8bad15d30 Jason Gunthorpe             2020-03-10  2192     
ib_destroy_cm_id(&cm_id_priv->id);
a977049dacdef6 Hal Rosenstock              2005-07-27  2193     return ret;
a977049dacdef6 Hal Rosenstock              2005-07-27  2194  }
a977049dacdef6 Hal Rosenstock              2005-07-27  2195  

:::::: The code at line 2043 was first introduced by commit
:::::: a977049dacdef6a9e69fb4872b42a68e93a69956 [PATCH] IB: Add the kernel CM 
implementation

:::::: TO: Hal Rosenstock <h...@voltaire.com>
:::::: CC: Linus Torvalds <torva...@g5.osdl.org>

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

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org

Reply via email to