diff mbox series

[net-next,09/11] qed: implement devlink dump

Message ID 20200727184310.462-10-irusskikh@marvell.com
State Changes Requested
Delegated to: David Miller
Headers show
Series qed: introduce devlink health support | expand

Commit Message

Igor Russkikh July 27, 2020, 6:43 p.m. UTC
Gather and push out full device dump to devlink.
Device dump is the same as with `ethtool -d`, but now its generated
exactly at the moment bad thing happens.

Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: Alexander Lobakin <alobakin@marvell.com>
Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
---
 drivers/net/ethernet/qlogic/qed/qed_devlink.c | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)

Comments

kernel test robot July 27, 2020, 8:40 p.m. UTC | #1
Hi Igor,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Igor-Russkikh/qed-introduce-devlink-health-support/20200728-024531
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git a57066b1a01977a646145f4ce8dfb4538b08368a
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 9.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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips 

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

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

   drivers/net/ethernet/qlogic/qed/qed_devlink.c: In function 'qed_fw_fatal_reporter_dump':
>> drivers/net/ethernet/qlogic/qed/qed_devlink.c:53:19: error: implicit declaration of function 'vzalloc'; did you mean 'kvzalloc'? [-Werror=implicit-function-declaration]
      53 |  p_dbg_data_buf = vzalloc(dbg_data_buf_size);
         |                   ^~~~~~~
         |                   kvzalloc
>> drivers/net/ethernet/qlogic/qed/qed_devlink.c:53:17: warning: assignment to 'u8 *' {aka 'unsigned char *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
      53 |  p_dbg_data_buf = vzalloc(dbg_data_buf_size);
         |                 ^
>> drivers/net/ethernet/qlogic/qed/qed_devlink.c:63:3: error: implicit declaration of function 'vfree'; did you mean 'kvfree'? [-Werror=implicit-function-declaration]
      63 |   vfree(p_dbg_data_buf);
         |   ^~~~~
         |   kvfree
   cc1: some warnings being treated as errors

vim +53 drivers/net/ethernet/qlogic/qed/qed_devlink.c

    33	
    34	static int
    35	qed_fw_fatal_reporter_dump(struct devlink_health_reporter *reporter,
    36				   struct devlink_fmsg *fmsg, void *priv_ctx,
    37				   struct netlink_ext_ack *extack)
    38	{
    39		struct qed_devlink *qdl = devlink_health_reporter_priv(reporter);
    40		struct qed_fw_fatal_ctx *fw_fatal_ctx = priv_ctx;
    41		struct qed_dev *cdev = qdl->cdev;
    42		u32 dbg_data_buf_size;
    43		u8 *p_dbg_data_buf;
    44		int err;
    45	
    46		/* Having context means that was a dump request after fatal,
    47		 * so we enable extra debugging while gathering the dump,
    48		 * just in case
    49		 */
    50		cdev->print_dbg_data = fw_fatal_ctx ? true : false;
    51	
    52		dbg_data_buf_size = qed_dbg_all_data_size(cdev);
  > 53		p_dbg_data_buf = vzalloc(dbg_data_buf_size);
    54		if (!p_dbg_data_buf) {
    55			DP_NOTICE(cdev,
    56				  "Failed to allocate memory for a debug data buffer\n");
    57			return -ENOMEM;
    58		}
    59	
    60		err = qed_dbg_all_data(cdev, p_dbg_data_buf);
    61		if (err) {
    62			DP_NOTICE(cdev, "Failed to obtain debug data\n");
  > 63			vfree(p_dbg_data_buf);
    64			return err;
    65		}
    66	
    67		err = devlink_fmsg_binary_pair_put(fmsg, "dump_data",
    68						   p_dbg_data_buf, dbg_data_buf_size);
    69	
    70		vfree(p_dbg_data_buf);
    71	
    72		return err;
    73	}
    74	

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

Patch

diff --git a/drivers/net/ethernet/qlogic/qed/qed_devlink.c b/drivers/net/ethernet/qlogic/qed/qed_devlink.c
index b25be68f959c..3a173eb167c2 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_devlink.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_devlink.c
@@ -31,6 +31,47 @@  int qed_report_fatal_error(struct devlink *devlink, enum qed_hw_err_type err_typ
 	return 0;
 }
 
+static int
+qed_fw_fatal_reporter_dump(struct devlink_health_reporter *reporter,
+			   struct devlink_fmsg *fmsg, void *priv_ctx,
+			   struct netlink_ext_ack *extack)
+{
+	struct qed_devlink *qdl = devlink_health_reporter_priv(reporter);
+	struct qed_fw_fatal_ctx *fw_fatal_ctx = priv_ctx;
+	struct qed_dev *cdev = qdl->cdev;
+	u32 dbg_data_buf_size;
+	u8 *p_dbg_data_buf;
+	int err;
+
+	/* Having context means that was a dump request after fatal,
+	 * so we enable extra debugging while gathering the dump,
+	 * just in case
+	 */
+	cdev->print_dbg_data = fw_fatal_ctx ? true : false;
+
+	dbg_data_buf_size = qed_dbg_all_data_size(cdev);
+	p_dbg_data_buf = vzalloc(dbg_data_buf_size);
+	if (!p_dbg_data_buf) {
+		DP_NOTICE(cdev,
+			  "Failed to allocate memory for a debug data buffer\n");
+		return -ENOMEM;
+	}
+
+	err = qed_dbg_all_data(cdev, p_dbg_data_buf);
+	if (err) {
+		DP_NOTICE(cdev, "Failed to obtain debug data\n");
+		vfree(p_dbg_data_buf);
+		return err;
+	}
+
+	err = devlink_fmsg_binary_pair_put(fmsg, "dump_data",
+					   p_dbg_data_buf, dbg_data_buf_size);
+
+	vfree(p_dbg_data_buf);
+
+	return err;
+}
+
 static int
 qed_fw_fatal_reporter_recover(struct devlink_health_reporter *reporter,
 			      void *priv_ctx,
@@ -47,6 +88,7 @@  qed_fw_fatal_reporter_recover(struct devlink_health_reporter *reporter,
 static const struct devlink_health_reporter_ops qed_fw_fatal_reporter_ops = {
 		.name = "fw_fatal",
 		.recover = qed_fw_fatal_reporter_recover,
+		.dump = qed_fw_fatal_reporter_dump,
 };
 
 #define QED_REPORTER_FW_GRACEFUL_PERIOD 1200000