Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3286688ybt; Mon, 29 Jun 2020 21:45:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWP1aIguK2jYct9ovx0a8szl+qAfeuMSAdxH+kELFR76OryZdPK3oRoNhSzjXDF0jR02tC X-Received: by 2002:a05:6402:719:: with SMTP id w25mr19230824edx.174.1593492340490; Mon, 29 Jun 2020 21:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593492340; cv=none; d=google.com; s=arc-20160816; b=lppVTYPIvdLeE7nLOyS5J/0jt8tdxvZP+FP+MbemzOGrSriy6CVexpLucJCn5e+N5u BDPRIt/i7ZlAgfuneNwHl5GeWQaScjhuP7bD2WGSYPoMO3+2C4RfVTwsdKRN76sscOtO FY6+3oyL8sr8VcNbpOJz+FbU1fQx2ZJbBx5wA0e7v0n/sfwIfRSi6/MeBisNebpRsdiE p9MsjUUpvRrqheJeMuIrLhJMINwcHXVWmAOtnyRnVAUCGjK6vtmE7g7s+0sBhgMXlApr Xbu/y1Yda+Q6FtEY/PfK+7y3UulMoJOKR92vLTywzZhLsy44Ll6brdjl4bLuz8YMyZfc Rq9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/4EbjWc3OcYBVYlmz6RH6shyF/Bf9W7LIE0MBGcrCAc=; b=xtVI0B/ZOnQMhujz5+JXt58jSQfRGQ8tCYHly/nnbQCPjXTzKO289xJD3pVSEgvfpD tUCTEBTvY9+G8Uc6VIS5KGEowznWUQFdmZKgWdyqQutdtVHJkBewyZuyZcYQ1xIsQ4/U 34cmCFCit0iQoOpph4Ee0PK6jlIwQTVZ+lQvndq07JG4A6nDeGGULeaFOyY0ESDS7Cw4 evR3WlpkmZuDRDWekV8quPdh2NoYDnc1c5ZBvnkRILfO9k7TrP0jy3M8ky/dCN2TKfE2 JwwIVcJXO3R0PkpxFh8qS3mLXmkcMDK0yf+IK9h8tpudRUFMYG/B6GIo8XI/4LQIX5ay Ptng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MzAXhvAo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n9si969913eja.529.2020.06.29.21.45.17; Mon, 29 Jun 2020 21:45:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MzAXhvAo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729359AbgF3El5 (ORCPT + 99 others); Tue, 30 Jun 2020 00:41:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729321AbgF3El5 (ORCPT ); Tue, 30 Jun 2020 00:41:57 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A08FC061755; Mon, 29 Jun 2020 21:41:57 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id u9so4360248pls.13; Mon, 29 Jun 2020 21:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=/4EbjWc3OcYBVYlmz6RH6shyF/Bf9W7LIE0MBGcrCAc=; b=MzAXhvAodARvduNMO3wJCALgHXwOz8vGXAsrWe4j14bZ2ULzrL+S2QmffOpsHzIEMT tn1fyGE5N5lupBTHUVdykDNyFMkcRe4H+JGWXpvAR3qmt7ZMHSrTbn20zTmBrBKkD1Nx PuYFnAKh6fq3w0QOex6KtrSpnSYyVda1XZ6lZQ7ez2K3zQW5lrq6QgDdeDtp0cs6xXUl /Sgrg9Txp5ac4SGiCK5HeMR3qLjs7+GeoMqsk5aZ6bAlCAGEzHY92STFFdZ77DJ7FG/w c1IuS2qkKnZITN74FmVqu3ooHjdQStSUwqqEpODEWSSRp/U5+mM7ksTtPGGxwKLrsf+M POKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=/4EbjWc3OcYBVYlmz6RH6shyF/Bf9W7LIE0MBGcrCAc=; b=DDM1gecGSu9BCERnMqXdMbRNk2fWA98ZGpg+14Z2vlHjJFz4ktuSEXshlYI26RXYv9 M6BrndehrDih/kcuhLCsVF5ov6yoaj6EaCDhavdhrSoX395LZ7ec87Or4KCYsLIqGk7J 51AVBmjbfrNAIwLq+6skuIkqRApj1ak303rtNxD7jVG4QMPDcHo2SIGMND7UFGfVyZFm LL4cFoFC56bgoPSySvxvK8ENwzKz+8J8ndMq3iXPVagNvs5VLTbGCLecrc35ehR7i/Bb UFf8U/s1ud8wpDZyf2OhQZcFEDzwEy4O2tn7DSdYm9FToL2YJaEGqgxgom0j0rTBio0g SReg== X-Gm-Message-State: AOAM533fls6NKS5eE3DmFIrc8SQPu5gHxWPprSuD2K8zCuN6yWD+5FJz g/RB2YDId75iL4jlT0jArCY= X-Received: by 2002:a17:90a:ac05:: with SMTP id o5mr21099604pjq.228.1593492116510; Mon, 29 Jun 2020 21:41:56 -0700 (PDT) Received: from f3 (ae055068.dynamic.ppp.asahi-net.or.jp. [14.3.55.68]) by smtp.gmail.com with ESMTPSA id nv9sm929621pjb.6.2020.06.29.21.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 21:41:55 -0700 (PDT) Date: Tue, 30 Jun 2020 13:41:51 +0900 From: Benjamin Poirier To: Coiby Xu Cc: devel@driverdev.osuosl.org, joe@perches.com, dan.carpenter@oracle.com, gregkh@linuxfoundation.org, Manish Chopra , "supporter:QLOGIC QLGE 10Gb ETHERNET DRIVER" , "open list:QLOGIC QLGE 10Gb ETHERNET DRIVER" , open list Subject: Re: [PATCH v2 4/4] staging: qlge: replace pr_err with netdev_err Message-ID: <20200630044151.GA125790@f3> References: <20200627145857.15926-1-coiby.xu@gmail.com> <20200627145857.15926-5-coiby.xu@gmail.com> <20200629053004.GA6165@f3> <20200629174352.euw4lckze2k7xtbm@Rk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200629174352.euw4lckze2k7xtbm@Rk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-06-30 01:43 +0800, Coiby Xu wrote: > On Mon, Jun 29, 2020 at 02:30:04PM +0900, Benjamin Poirier wrote: > > On 2020-06-27 22:58 +0800, Coiby Xu wrote: > > [...] > > > void ql_dump_qdev(struct ql_adapter *qdev) > > > { > > > @@ -1611,99 +1618,100 @@ void ql_dump_qdev(struct ql_adapter *qdev) > > > #ifdef QL_CB_DUMP > > > void ql_dump_wqicb(struct wqicb *wqicb) > > > { > > > - pr_err("Dumping wqicb stuff...\n"); > > > - pr_err("wqicb->len = 0x%x\n", le16_to_cpu(wqicb->len)); > > > - pr_err("wqicb->flags = %x\n", le16_to_cpu(wqicb->flags)); > > > - pr_err("wqicb->cq_id_rss = %d\n", > > > - le16_to_cpu(wqicb->cq_id_rss)); > > > - pr_err("wqicb->rid = 0x%x\n", le16_to_cpu(wqicb->rid)); > > > - pr_err("wqicb->wq_addr = 0x%llx\n", > > > - (unsigned long long)le64_to_cpu(wqicb->addr)); > > > - pr_err("wqicb->wq_cnsmr_idx_addr = 0x%llx\n", > > > - (unsigned long long)le64_to_cpu(wqicb->cnsmr_idx_addr)); > > > + netdev_err(qdev->ndev, "Dumping wqicb stuff...\n"); > > > > drivers/staging/qlge/qlge_dbg.c:1621:13: error: ‘qdev’ undeclared (first use in this function); did you mean ‘cdev’? > > 1621 | netdev_err(qdev->ndev, "Dumping wqicb stuff...\n"); > > | ^~~~ > > | cdev > > > > [...] > > and many more like that > > > > Anyways, qlge_dbg.h is a dumpster. It has hundreds of lines of code > > bitrotting away in ifdef land. See this comment from David Miller on the > > topic of ifdef'ed debugging code: > > https://lore.kernel.org/netdev/20200303.145916.1506066510928020193.davem@davemloft.net/ > > Thank you for spotting this problem! This issue could be fixed by > passing qdev to ql_dump_wqicb. Or are you suggesting we completely > remove qlge_dbg since it's only for the purpose of debugging the driver > by the developer? At 2000 lines, qlge_dbg.c alone is larger than some entire ethernet drivers. Most of what it does is dump kernel data structures or pci memory mapped registers to dmesg. There are better facilities for that. My thinking is not simply to delete qlge_dbg.c but to replace it, making sure that most of the same information is still available. For data structures, crash or drgn can be used; possibly with a script for the latter which formats the data. For pci registers, they should be included in the ethtool register dump and a patch added to ethtool to pretty print them. That's what other drivers like e1000e do. For the "coredump", devlink health can be used. The qlge_force_coredump module option should also be removed. At the moment, calling the ethtool register dump function with that option enabled does a hexdump of a 176k struct to dmesg. That's shameful. > > Btw, I'm curious how you make this compiling error occur. Do you manually trigger > it via "QL_CB_DUMP=1 make M=drivers/staging/qlge" or use some automate > tools? I just uncommented the defines in qlge.h