Message ID | 20210716151850.28973-4-eajames@linux.ibm.com |
---|---|
State | Superseded, archived |
Headers | show |
Series | OCC: fsi and hwmon: Set sequence number in submit interface | expand |
Hi Eddie, I love your patch! Yet something to improve: [auto build test ERROR on hwmon/hwmon-next] [also build test ERROR on linus/master v5.14-rc2 next-20210716] [cannot apply to linux/master] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Eddie-James/OCC-fsi-and-hwmon-Set-sequence-number-in-submit-interface/20210718-103535 base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next config: csky-randconfig-r014-20210718 (attached as .config) compiler: csky-linux-gcc (GCC) 10.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/2501575bac95640481d86c6d27cd675055987aa8 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Eddie-James/OCC-fsi-and-hwmon-Set-sequence-number-in-submit-interface/20210718-103535 git checkout 2501575bac95640481d86c6d27cd675055987aa8 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=csky If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/fsi/fsi-occ.c: In function 'occ_putsram': >> drivers/fsi/fsi-occ.c:372:3: error: implicit declaration of function 'DEFINE_DYNAMIC_DEBUG_METADATA' [-Werror=implicit-function-declaration] 372 | DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_cmd, "OCC command"); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> drivers/fsi/fsi-occ.c:372:33: error: 'ddm_occ_cmd' undeclared (first use in this function) 372 | DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_cmd, "OCC command"); | ^~~~~~~~~~~ drivers/fsi/fsi-occ.c:372:33: note: each undeclared identifier is reported only once for each function it appears in >> drivers/fsi/fsi-occ.c:374:7: error: implicit declaration of function 'DYNAMIC_DEBUG_BRANCH' [-Werror=implicit-function-declaration] 374 | if (DYNAMIC_DEBUG_BRANCH(ddm_occ_cmd)) { | ^~~~~~~~~~~~~~~~~~~~ drivers/fsi/fsi-occ.c: In function 'fsi_occ_submit': >> drivers/fsi/fsi-occ.c:584:33: error: 'ddm_occ_rsp' undeclared (first use in this function) 584 | DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_rsp, | ^~~~~~~~~~~ >> drivers/fsi/fsi-occ.c:586:33: error: 'ddm_occ_full_rsp' undeclared (first use in this function) 586 | DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_full_rsp, | ^~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors vim +/DEFINE_DYNAMIC_DEBUG_METADATA +372 drivers/fsi/fsi-occ.c 315 316 static int occ_putsram(struct occ *occ, const void *data, ssize_t len, 317 u8 seq_no, u16 checksum) 318 { 319 size_t cmd_len, buf_len, resp_len, resp_data_len; 320 u32 data_len = ((len + 7) / 8) * 8; /* must be multiples of 8 B */ 321 __be32 *buf; 322 u8 *byte_buf; 323 int idx = 0, rc; 324 325 cmd_len = (occ->version == occ_p10) ? 6 : 5; 326 327 /* 328 * We use the same buffer for command and response, make 329 * sure it's big enough 330 */ 331 resp_len = OCC_SBE_STATUS_WORDS; 332 cmd_len += data_len >> 2; 333 buf_len = max(cmd_len, resp_len); 334 buf = kzalloc(buf_len << 2, GFP_KERNEL); 335 if (!buf) 336 return -ENOMEM; 337 338 /* 339 * Magic sequence to do SBE putsram command. SBE will transfer 340 * data to specified SRAM address. 341 */ 342 buf[0] = cpu_to_be32(cmd_len); 343 buf[1] = cpu_to_be32(SBEFIFO_CMD_PUT_OCC_SRAM); 344 345 switch (occ->version) { 346 default: 347 case occ_p9: 348 buf[2] = cpu_to_be32(1); /* Normal mode */ 349 buf[3] = cpu_to_be32(OCC_P9_SRAM_CMD_ADDR); 350 break; 351 case occ_p10: 352 idx = 1; 353 buf[2] = cpu_to_be32(OCC_P10_SRAM_MODE); 354 buf[3] = 0; 355 buf[4] = cpu_to_be32(OCC_P10_SRAM_CMD_ADDR); 356 break; 357 } 358 359 buf[4 + idx] = cpu_to_be32(data_len); 360 memcpy(&buf[5 + idx], data, len); 361 362 byte_buf = (u8 *)&buf[5 + idx]; 363 /* 364 * Overwrite the first byte with our sequence number and the last two 365 * bytes with the checksum. 366 */ 367 byte_buf[0] = seq_no; 368 byte_buf[len - 2] = checksum >> 8; 369 byte_buf[len - 1] = checksum & 0xff; 370 371 { > 372 DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_cmd, "OCC command"); 373 > 374 if (DYNAMIC_DEBUG_BRANCH(ddm_occ_cmd)) { 375 char prefix[64]; 376 377 snprintf(prefix, sizeof(prefix), "%s %s: cmd ", 378 dev_driver_string(occ->dev), 379 dev_name(occ->dev)); 380 print_hex_dump(KERN_DEBUG, prefix, DUMP_PREFIX_OFFSET, 381 16, 4, byte_buf, len, false); 382 } 383 } 384 385 rc = sbefifo_submit(occ->sbefifo, buf, cmd_len, buf, &resp_len); 386 if (rc) 387 goto free; 388 389 rc = sbefifo_parse_status(occ->sbefifo, SBEFIFO_CMD_PUT_OCC_SRAM, 390 buf, resp_len, &resp_len); 391 if (rc) 392 goto free; 393 394 if (resp_len != 1) { 395 dev_err(occ->dev, "SRAM write response length invalid: %zd\n", 396 resp_len); 397 rc = -EBADMSG; 398 } else { 399 resp_data_len = be32_to_cpu(buf[0]); 400 if (resp_data_len != data_len) { 401 dev_err(occ->dev, 402 "SRAM write expected %d bytes got %zd\n", 403 data_len, resp_data_len); 404 rc = -EBADMSG; 405 } 406 } 407 408 free: 409 /* Convert positive SBEI status */ 410 if (rc > 0) { 411 dev_err(occ->dev, "SRAM write returned failure status: %08x\n", 412 rc); 413 rc = -EBADMSG; 414 } 415 416 kfree(buf); 417 return rc; 418 } 419 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Eddie, > Use the dynamic branching capability of the dynamic debug subsystem > to dump the command and response with the correct OCC device name. Would this be better done with a tracepoint? Given it's a fairly well-defined pair of events, and there's data to dump in both cases. We have a couple of existing tracepoionts in the core code if that helps... Cheers, Jeremy
diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c index ecf738411fe2..641a6869b9df 100644 --- a/drivers/fsi/fsi-occ.c +++ b/drivers/fsi/fsi-occ.c @@ -21,6 +21,15 @@ #include <linux/uaccess.h> #include <asm/unaligned.h> +#if !defined(CONFIG_DYNAMIC_DEBUG_CORE) +#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) +#if defined(DEBUG) +#define DYNAMIC_DEBUG_BRANCH(descriptor) true +#else /* DEBUG */ +#define DYNAMIC_DEBUG_BRANCH(descriptor) false +#endif /* DEBUG */ +#endif /* CONFIG_DYNAMIC_DEBUG_CORE */ + #define OCC_SRAM_BYTES 4096 #define OCC_CMD_DATA_BYTES 4090 #define OCC_RESP_DATA_BYTES 4089 @@ -359,6 +368,20 @@ static int occ_putsram(struct occ *occ, const void *data, ssize_t len, byte_buf[len - 2] = checksum >> 8; byte_buf[len - 1] = checksum & 0xff; + { + DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_cmd, "OCC command"); + + if (DYNAMIC_DEBUG_BRANCH(ddm_occ_cmd)) { + char prefix[64]; + + snprintf(prefix, sizeof(prefix), "%s %s: cmd ", + dev_driver_string(occ->dev), + dev_name(occ->dev)); + print_hex_dump(KERN_DEBUG, prefix, DUMP_PREFIX_OFFSET, + 16, 4, byte_buf, len, false); + } + } + rc = sbefifo_submit(occ->sbefifo, buf, cmd_len, buf, &resp_len); if (rc) goto free; @@ -556,6 +579,27 @@ int fsi_occ_submit(struct device *dev, const void *request, size_t req_len, } *resp_len = resp_data_length + 7; + + { + DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_rsp, + "OCC response"); + DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_full_rsp, + "OCC full response"); + + if (DYNAMIC_DEBUG_BRANCH(ddm_occ_full_rsp) || + DYNAMIC_DEBUG_BRANCH(ddm_occ_rsp)) { + char prefix[64]; + size_t l = DYNAMIC_DEBUG_BRANCH(ddm_occ_full_rsp) ? + *resp_len : 16; + + snprintf(prefix, sizeof(prefix), "%s %s: rsp ", + dev_driver_string(occ->dev), + dev_name(occ->dev)); + print_hex_dump(KERN_DEBUG, prefix, DUMP_PREFIX_OFFSET, + 16, 4, resp, l, false); + } + } + rc = occ_verify_checksum(occ, resp, resp_data_length); done:
Use the dynamic branching capability of the dynamic debug subsystem to dump the command and response with the correct OCC device name. Signed-off-by: Eddie James <eajames@linux.ibm.com> --- drivers/fsi/fsi-occ.c | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)