Hi Serge,

I love your patch! Yet something to improve:

[auto build test ERROR on v4.15-rc1]
[cannot apply to ntb/ntb-next next-20171201]
[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/Serge-Semin/NTB-ntb_perf-Add-full-multi-port-NTB-API-support/20171204-011126
config: x86_64-randconfig-x017-201749 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   drivers/ntb//test/ntb_perf.c: In function 'perf_msg_cmd_send':
>> drivers/ntb//test/ntb_perf.c:375:3: error: implicit declaration of function 
>> 'ntb_peer_msg_write'; did you mean 'ntb_peer_spad_write'? 
>> [-Werror=implicit-function-declaration]
      ntb_peer_msg_write(perf->ntb, peer->pidx, PERF_MSG_LDATA,
      ^~~~~~~~~~~~~~~~~~
      ntb_peer_spad_write
   drivers/ntb//test/ntb_perf.c: In function 'perf_msg_cmd_recv':
>> drivers/ntb//test/ntb_perf.c:408:32: warning: passing argument 2 of 
>> 'ntb_msg_read' makes integer from pointer without a cast [-Wint-conversion]
     val = ntb_msg_read(perf->ntb, pidx, PERF_MSG_CMD);
                                   ^~~~
   In file included from drivers/ntb//test/ntb_perf.c:89:0:
   include/linux/ntb.h:1473:19: note: expected 'int' but argument is of type 
'int *'
    static inline int ntb_msg_read(struct ntb_dev *ntb, int midx, int *pidx,
                      ^~~~~~~~~~~~
>> drivers/ntb//test/ntb_perf.c:408:8: error: too few arguments to function 
>> 'ntb_msg_read'
     val = ntb_msg_read(perf->ntb, pidx, PERF_MSG_CMD);
           ^~~~~~~~~~~~
   In file included from drivers/ntb//test/ntb_perf.c:89:0:
   include/linux/ntb.h:1473:19: note: declared here
    static inline int ntb_msg_read(struct ntb_dev *ntb, int midx, int *pidx,
                      ^~~~~~~~~~~~
   drivers/ntb//test/ntb_perf.c:411:32: warning: passing argument 2 of 
'ntb_msg_read' makes integer from pointer without a cast [-Wint-conversion]
     val = ntb_msg_read(perf->ntb, pidx, PERF_MSG_LDATA);
                                   ^~~~
   In file included from drivers/ntb//test/ntb_perf.c:89:0:
   include/linux/ntb.h:1473:19: note: expected 'int' but argument is of type 
'int *'
    static inline int ntb_msg_read(struct ntb_dev *ntb, int midx, int *pidx,
                      ^~~~~~~~~~~~
>> drivers/ntb//test/ntb_perf.c:229:25: warning: passing argument 3 of 
>> 'ntb_msg_read' makes pointer from integer without a cast [-Wint-conversion]
    #define PERF_MSG_LDATA  1
                            ^
>> drivers/ntb//test/ntb_perf.c:411:38: note: in expansion of macro 
>> 'PERF_MSG_LDATA'
     val = ntb_msg_read(perf->ntb, pidx, PERF_MSG_LDATA);
                                         ^~~~~~~~~~~~~~
   In file included from drivers/ntb//test/ntb_perf.c:89:0:
   include/linux/ntb.h:1473:19: note: expected 'int *' but argument is of type 
'int'
    static inline int ntb_msg_read(struct ntb_dev *ntb, int midx, int *pidx,
                      ^~~~~~~~~~~~
   drivers/ntb//test/ntb_perf.c:411:8: error: too few arguments to function 
'ntb_msg_read'
     val = ntb_msg_read(perf->ntb, pidx, PERF_MSG_LDATA);
           ^~~~~~~~~~~~
   In file included from drivers/ntb//test/ntb_perf.c:89:0:
   include/linux/ntb.h:1473:19: note: declared here
    static inline int ntb_msg_read(struct ntb_dev *ntb, int midx, int *pidx,
                      ^~~~~~~~~~~~
   drivers/ntb//test/ntb_perf.c:414:32: warning: passing argument 2 of 
'ntb_msg_read' makes integer from pointer without a cast [-Wint-conversion]
     val = ntb_msg_read(perf->ntb, pidx, PERF_MSG_HDATA);
                                   ^~~~
   In file included from drivers/ntb//test/ntb_perf.c:89:0:
   include/linux/ntb.h:1473:19: note: expected 'int' but argument is of type 
'int *'
    static inline int ntb_msg_read(struct ntb_dev *ntb, int midx, int *pidx,
                      ^~~~~~~~~~~~
   drivers/ntb//test/ntb_perf.c:230:25: warning: passing argument 3 of 
'ntb_msg_read' makes pointer from integer without a cast [-Wint-conversion]
    #define PERF_MSG_HDATA  2
                            ^
>> drivers/ntb//test/ntb_perf.c:414:38: note: in expansion of macro 
>> 'PERF_MSG_HDATA'
     val = ntb_msg_read(perf->ntb, pidx, PERF_MSG_HDATA);
                                         ^~~~~~~~~~~~~~
   In file included from drivers/ntb//test/ntb_perf.c:89:0:
   include/linux/ntb.h:1473:19: note: expected 'int *' but argument is of type 
'int'
    static inline int ntb_msg_read(struct ntb_dev *ntb, int midx, int *pidx,
                      ^~~~~~~~~~~~
   drivers/ntb//test/ntb_perf.c:414:8: error: too few arguments to function 
'ntb_msg_read'
     val = ntb_msg_read(perf->ntb, pidx, PERF_MSG_HDATA);
           ^~~~~~~~~~~~
   In file included from drivers/ntb//test/ntb_perf.c:89:0:
   include/linux/ntb.h:1473:19: note: declared here
    static inline int ntb_msg_read(struct ntb_dev *ntb, int midx, int *pidx,
                      ^~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +375 drivers/ntb//test/ntb_perf.c

   209  
   210  /*
   211   * Scratchpads-base commands interface
   212   */
   213  #define PERF_SPAD_CNT(_pcnt) \
   214          (3*((_pcnt) + 1))
   215  #define PERF_SPAD_CMD(_gidx) \
   216          (3*(_gidx))
   217  #define PERF_SPAD_LDATA(_gidx) \
   218          (3*(_gidx) + 1)
   219  #define PERF_SPAD_HDATA(_gidx) \
   220          (3*(_gidx) + 2)
   221  #define PERF_SPAD_NOTIFY(_gidx) \
   222          (BIT_ULL(_gidx))
   223  
   224  /*
   225   * Messages-base commands interface
   226   */
   227  #define PERF_MSG_CNT            3
   228  #define PERF_MSG_CMD            0
 > 229  #define PERF_MSG_LDATA          1
   230  #define PERF_MSG_HDATA          2
   231  
   232  
/*==============================================================================
   233   *                           Static data declarations
   234   
*==============================================================================
   235   */
   236  
   237  static struct dentry *perf_dbgfs_topdir;
   238  
   239  static struct workqueue_struct *perf_wq __read_mostly;
   240  
   241  
/*==============================================================================
   242   *                  NTB cross-link commands execution service
   243   
*==============================================================================
   244   */
   245  
   246  static void perf_terminate_test(struct perf_ctx *perf);
   247  
   248  static inline bool perf_link_is_up(struct perf_peer *peer)
   249  {
   250          u64 link;
   251  
   252          link = ntb_link_is_up(peer->perf->ntb, NULL, NULL);
   253          return !!(link & BIT_ULL_MASK(peer->pidx));
   254  }
   255  
   256  static int perf_spad_cmd_send(struct perf_peer *peer, enum perf_cmd cmd,
   257                                u64 data)
   258  {
   259          struct perf_ctx *perf = peer->perf;
   260          int try;
   261          u32 sts;
   262  
   263          dev_dbg(&perf->ntb->dev, "CMD send: %d 0x%llx\n", cmd, data);
   264  
   265          /*
   266           * Perform predefined number of attempts before give up.
   267           * We are sending the data to the port specific scratchpad, so
   268           * to prevent a multi-port access race-condition. Additionally
   269           * there is no need in local locking since only thread-safe
   270           * service work is using this method.
   271           */
   272          for (try = 0; try < MSG_TRIES; try++) {
   273                  if (!perf_link_is_up(peer))
   274                          return -ENOLINK;
   275  
   276                  sts = ntb_peer_spad_read(perf->ntb, peer->pidx,
   277                                           PERF_SPAD_CMD(perf->gidx));
   278                  if (le32_to_cpu(sts) != PERF_CMD_INVAL) {
   279                          usleep_range(MSG_UDELAY_LOW, MSG_UDELAY_HIGH);
   280                          continue;
   281                  }
   282  
   283                  ntb_peer_spad_write(perf->ntb, peer->pidx,
   284                                      PERF_SPAD_LDATA(perf->gidx),
   285                                      cpu_to_le32(lower_32_bits(data)));
   286                  ntb_peer_spad_write(perf->ntb, peer->pidx,
   287                                      PERF_SPAD_HDATA(perf->gidx),
   288                                      cpu_to_le32(upper_32_bits(data)));
   289                  mmiowb();
   290                  ntb_peer_spad_write(perf->ntb, peer->pidx,
   291                                      PERF_SPAD_CMD(perf->gidx),
   292                                      cpu_to_le32(cmd));
   293                  mmiowb();
   294                  ntb_peer_db_set(perf->ntb, 
PERF_SPAD_NOTIFY(peer->gidx));
   295  
   296                  dev_dbg(&perf->ntb->dev, "DB ring peer %#llx\n",
   297                          PERF_SPAD_NOTIFY(peer->gidx));
   298  
   299                  break;
   300          }
   301  
   302          return try < MSG_TRIES ? 0 : -EAGAIN;
   303  }
   304  
   305  static int perf_spad_cmd_recv(struct perf_ctx *perf, int *pidx,
   306                                enum perf_cmd *cmd, u64 *data)
   307  {
   308          struct perf_peer *peer;
   309          u32 val;
   310  
   311          ntb_db_clear(perf->ntb, PERF_SPAD_NOTIFY(perf->gidx));
   312  
   313          /*
   314           * We start scanning all over, since cleared DB may have been 
set
   315           * by any peer. Yes, it makes peer with smaller index being
   316           * serviced with greater priority, but it's convenient for spad
   317           * and message code unification and simplicity.
   318           */
   319          for (*pidx = 0; *pidx < perf->pcnt; (*pidx)++) {
   320                  peer = &perf->peers[*pidx];
   321  
   322                  if (!perf_link_is_up(peer))
   323                          continue;
   324  
   325                  val = ntb_spad_read(perf->ntb, 
PERF_SPAD_CMD(peer->gidx));
   326                  val = le32_to_cpu(val);
   327                  if (val == PERF_CMD_INVAL)
   328                          continue;
   329  
   330                  *cmd = val;
   331  
   332                  val = ntb_spad_read(perf->ntb, 
PERF_SPAD_LDATA(peer->gidx));
   333                  *data = le32_to_cpu(val);
   334  
   335                  val = ntb_spad_read(perf->ntb, 
PERF_SPAD_HDATA(peer->gidx));
   336                  *data |= (u64)le32_to_cpu(val) << 32;
   337  
   338                  /* Next command can be retrieved from now */
   339                  ntb_spad_write(perf->ntb, PERF_SPAD_CMD(peer->gidx),
   340                                 cpu_to_le32(PERF_CMD_INVAL));
   341  
   342                  dev_dbg(&perf->ntb->dev, "CMD recv: %d 0x%llx\n", *cmd, 
*data);
   343  
   344                  return 0;
   345          }
   346  
   347          return -ENODATA;
   348  }
   349  
   350  static int perf_msg_cmd_send(struct perf_peer *peer, enum perf_cmd cmd,
   351                               u64 data)
   352  {
   353          struct perf_ctx *perf = peer->perf;
   354          int try, ret;
   355          u64 outbits;
   356  
   357          dev_dbg(&perf->ntb->dev, "CMD send: %d 0x%llx\n", cmd, data);
   358  
   359          /*
   360           * Perform predefined number of attempts before give up. Message
   361           * registers are free of race-condition problem when accessed
   362           * from different ports, so we don't need splitting registers
   363           * by global device index. We also won't have local locking,
   364           * since the method is used from service work only.
   365           */
   366          outbits = ntb_msg_outbits(perf->ntb);
   367          for (try = 0; try < MSG_TRIES; try++) {
   368                  if (!perf_link_is_up(peer))
   369                          return -ENOLINK;
   370  
   371                  ret = ntb_msg_clear_sts(perf->ntb, outbits);
   372                  if (ret)
   373                          return ret;
   374  
 > 375                  ntb_peer_msg_write(perf->ntb, peer->pidx, 
 > PERF_MSG_LDATA,
   376                                cpu_to_le32(lower_32_bits(data)));
   377  
   378                  if (ntb_msg_read_sts(perf->ntb) & outbits) {
   379                          usleep_range(MSG_UDELAY_LOW, MSG_UDELAY_HIGH);
   380                          continue;
   381                  }
   382  
   383                  ntb_peer_msg_write(perf->ntb, peer->pidx, 
PERF_MSG_HDATA,
   384                                cpu_to_le32(upper_32_bits(data)));
   385                  mmiowb();
   386  
   387                  /* This call shall trigger peer message event */
   388                  ntb_peer_msg_write(perf->ntb, peer->pidx, PERF_MSG_CMD,
   389                                cpu_to_le32(cmd));
   390  
   391                  break;
   392          }
   393  
   394          return try < MSG_TRIES ? 0 : -EAGAIN;
   395  }
   396  
   397  static int perf_msg_cmd_recv(struct perf_ctx *perf, int *pidx,
   398                               enum perf_cmd *cmd, u64 *data)
   399  {
   400          u64 inbits;
   401          u32 val;
   402  
   403          inbits = ntb_msg_inbits(perf->ntb);
   404  
   405          if (hweight64(ntb_msg_read_sts(perf->ntb) & inbits) < 3)
   406                  return -ENODATA;
   407  
 > 408          val = ntb_msg_read(perf->ntb, pidx, PERF_MSG_CMD);
   409          *cmd = le32_to_cpu(val);
   410  
 > 411          val = ntb_msg_read(perf->ntb, pidx, PERF_MSG_LDATA);
   412          *data = le32_to_cpu(val);
   413  
 > 414          val = ntb_msg_read(perf->ntb, pidx, PERF_MSG_HDATA);
   415          *data |= (u64)le32_to_cpu(val) << 32;
   416  
   417          /* Next command can be retrieved from now */
   418          ntb_msg_clear_sts(perf->ntb, inbits);
   419  
   420          dev_dbg(&perf->ntb->dev, "CMD recv: %d 0x%llx\n", *cmd, *data);
   421  
   422          return 0;
   423  }
   424  

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

Attachment: .config.gz
Description: application/gzip

Reply via email to