Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10518200rwp; Thu, 20 Jul 2023 23:54:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlET/do5xwXZ7y85VC67gNSrCZzfJepo/7bnU0NmSNFXtsc1cHT8s95FH+MfpCjkeUoco3+y X-Received: by 2002:a17:903:2306:b0:1b6:783d:9ba7 with SMTP id d6-20020a170903230600b001b6783d9ba7mr1577191plh.27.1689922460949; Thu, 20 Jul 2023 23:54:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689922460; cv=none; d=google.com; s=arc-20160816; b=K8HsAH4xrPthElRDm1JLeK7WfeLV8Na3DkQgUnuQdJl7DSynMwl9BQxUJNLgCZSyLL KKAQvDWvkfSLeiC3mGc94y/8lgU4MbR31rsT/VhNeNFecf5NJv3Ry4LUq1xz4e4QK9Hm EeVwUkqWZ+2NvKPxfwQsrPLX8L672Zn4TS8R2KrBNRh2iHX954810l1SzQrLlgNTI+og KUoR5JjTdE7V9Q9dYzb9RfTZ6rmcIlKgRJ3RHt5N5kroUqbrWO6vCVwAxeG4OfxzOcfQ +wFzZnmdGKN0oRbuqDlcDIRJ3fVeMp0So7ecr16+Y9HRncwGwRVmgQtWwLj3cdCpDhB1 YnOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=ZfmuEXz9mumRtuWoNEjWledsJg4hXhppEJc3H1eqgaw=; fh=q+Xp3Lni5AZDQaeY2VaGF6+/DFngDynIKMbrgklYo2c=; b=Az+KMc+4KJCV/LdOZhhMkpkwfbSRI/DKChfyVTMs+Ky1EyHfFVKb2JyxhDwAMTJ0cG M9zkEI3zDxScsvIo3y8SNmLTrqPJqV0X07VHODVRwdoF3gs29uLcXPn13YaVtjg8Pck0 +9wfznD2sT6fvFbhH8RF+Ufr0B1kYgDKXWueHEXZJz690Gi4eIRAoxVnxRDCsNi08PH3 7B+5pb4TQ56NT44iD8CJt2m6w50xeLG8Ohn9KM3rCSzUy/uuMkAMvy2+ah3RWzxXtkFw 8UZTrlzjypqMmpaivM1GPHihuLYid0DFAIU/QdyiH8onDUHYIvLksymrN/4vp7LegNjh 5PEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f5-20020a170902ce8500b001b9e9edc44bsi2535442plg.474.2023.07.20.23.54.08; Thu, 20 Jul 2023 23:54:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230331AbjGUGcI (ORCPT + 99 others); Fri, 21 Jul 2023 02:32:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230468AbjGUGcC (ORCPT ); Fri, 21 Jul 2023 02:32:02 -0400 Received: from mx3.molgen.mpg.de (mx3.molgen.mpg.de [141.14.17.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 400FB2719; Thu, 20 Jul 2023 23:31:59 -0700 (PDT) Received: from [192.168.0.185] (ip5f5aeeaf.dynamic.kabel-deutschland.de [95.90.238.175]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id 2F75861E5FE03; Fri, 21 Jul 2023 08:30:52 +0200 (CEST) Message-ID: <54fc5f74-d293-e467-709f-5077c03be80c@molgen.mpg.de> Date: Fri, 21 Jul 2023 08:30:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH 2/4] peci: Add peci-npcm controller driver To: Iwona Winiarska Cc: tmaimon77@gmail.com, avifishman70@gmail.com, Benjamin Fair , devicetree@vger.kernel.org, venture@google.com, linux-kernel@vger.kernel.org, warp5tw@gmail.com, conor+dt@kernel.org, openbmc@lists.ozlabs.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org References: <20230719220853.1029316-1-iwona.winiarska@intel.com> <20230719220853.1029316-3-iwona.winiarska@intel.com> <9a6eb22ef6b7a6a686250ed83894e8d37de30baa.camel@intel.com> <2f9858b0-88e2-736a-f16a-f4fbe549e389@molgen.mpg.de> Content-Language: en-US From: Paul Menzel In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear Iwona, Am 20.07.23 um 22:20 schrieb Winiarska, Iwona: > On Thu, 2023-07-20 at 16:47 +0200, Paul Menzel wrote: >> Am 20.07.23 um 10:38 schrieb Winiarska, Iwona: >>> On Thu, 2023-07-20 at 08:20 +0200, Paul Menzel wrote: >> >>>> Am 20.07.23 um 00:08 schrieb Iwona Winiarska: >>>>> From: Tomer Maimon >>>>> >>>>> Add support for Nuvoton NPCM BMC hardware to the Platform Environment >>>>> Control Interface (PECI) subsystem. >>>> >>>> Please elaborate on the implementation, and document the used datasheets. >>> >>> As far as I know, there is no publicly available documentation. >> >> Too bad. Documenting the datasheet name and version is still important, >> so developers could request it, and it can be mapped, once they are made >> public. > > Sorry, unfortunately I can't help with that, I don't have access to any Nuvoton > docs. Perhaps Tomer can provide more information? Hopefully. But I wonder, how can you develop and review the patch then? >>>> Additionally, please document how you tested this. >>> >>> Are you asking to include this information in the commit message? >> >> Yes. >> >>> That would be unusual. >>> But in general - it's a controller driver, it allows PECI subsystem to detect >>> devices behind it and for PECI drivers to bind to those devices. >> >> Having a test line in the commit message is not unusual at. So people >> with systems where it doesn’t work, could replicate the test setup to at >> least verify that it works in that configuration. > > It's unusual as almost none of the commits in Linux kernel contain "how to test > it" description. I saw some commits document on what hardware it was tested. > The explanation body in the commit message should explain *why* the patch was > created, not how to test it. I disagree. It should of course the why, but sometimes also the how (implementation), the used datasheets, and all other details making it easy to review and give reviewers without the hardware confidence, that the patch is good. > And when taken as a series - it's self documenting. There's a Kconfig which > allows to enable/disable the driver, and there are bindings which show what > platform contains the hardware that is compatible with it. I just meant: Tested on server X with BMC Y using Nuvoton Z. Driver registered correctly, and devices A were discovered. >>>>> Signed-off-by: Tomer Maimon >>>>> Signed-off-by: Tyrone Ting >>>>> Co-developed-by: Iwona Winiarska >>>>> Signed-off-by: Iwona Winiarska >>>>> --- >>>>>    drivers/peci/controller/Kconfig     |  16 ++ >>>>>    drivers/peci/controller/Makefile    |   1 + >>>>>    drivers/peci/controller/peci-npcm.c | 298 ++++++++++++++++++++++++++++ >>>>>    3 files changed, 315 insertions(+) >>>>>    create mode 100644 drivers/peci/controller/peci-npcm.c >>>>> >>>>> diff --git a/drivers/peci/controller/Kconfig >>>>> b/drivers/peci/controller/Kconfig >>>>> index 2fc5e2abb74a..4f9c245ad042 100644 >>>>> --- a/drivers/peci/controller/Kconfig >>>>> +++ b/drivers/peci/controller/Kconfig […] >>>>> +#if IS_ENABLED(CONFIG_DYNAMIC_DEBUG) >>>>> +       dev_dbg(priv->dev, "addr : %#02x, tx.len : %#02x, rx.len : %#02x\n", >>>>> +               addr, req->tx.len, req->rx.len); >>>>> +       print_hex_dump_bytes("TX : ", DUMP_PREFIX_NONE, req->tx.buf, req-tx.len); >>>>> +#endif >>>> >>>> The preprocessor guards are not needed, as it’s taken care of in >>>> `include/linux/printk.h`. Also in other parts of the patch. >>> >>> Since this is dumping the raw contents of PECI messages, it's going to be quite >>> verbose. The idea behind preprocessor guard is that we don't ever want this to >>> be converted to regular printk. If there's no dynamic debug available - this >>> won't be printed unconditionally (even with -DDEBUG). >> >> How will it be converted to a regular printk? >> >>      #if defined(CONFIG_DYNAMIC_DEBUG) || \ >>          (defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE)) >>      #define print_hex_dump_debug(prefix_str, prefix_type, rowsize,      \ >>                               groupsize, buf, len, ascii)        \ >>          dynamic_hex_dump(prefix_str, prefix_type, rowsize,      \ >>                           groupsize, buf, len, ascii) >>      #elif defined(DEBUG) >>      #define print_hex_dump_debug(prefix_str, prefix_type, rowsize,      \ >>                               groupsize, buf, len, ascii)                \ >>          print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, rowsize,    \ >>                         groupsize, buf, len, ascii) >>      #else >>      static inline void print_hex_dump_debug(const char *prefix_str, int prefix_type, >>                                          int rowsize, int groupsize, >>                                          const void *buf, size_t len, bool ascii) >>      { >>      } >>      #endif > > Let's consider 3 scenarios > 1) Dynamic debug is available > 2) Dynamic debug is not available, but we're built with -DDEBUG > 3) Dynamic debug is not available, we're built without -DDEBUG > > For 1), print_hex_dump_debug is dynamic - it can be controlled > (enabled/disabled) using dynamic debug knobs (debugfs / dyndbg kernel arg). > For 2), print_hex_dump_debug is using print_hex_dump, which is just using printk > with KERN_DEBUG level under the hood. > For 3), it's compiled out. > > And it's scenario 2) that we would like to avoid, as hex-dumping all PECI > communication into dmesg is likely going to make dmesg output unusable (can > overflow, printing that to terminal is going to be slow, etc). > > The dump can be useful, it's just that in order to be useful it needs the > dynamic debug facilities :) Thank you for the explanation. Currently, this is only used in the PECI subsystem: $ git grep 'if IS_ENABLED(CONFIG_DYNAMIC_DEBUG)' drivers/mtd/nand/raw/nand_base.c:#if IS_ENABLED(CONFIG_DYNAMIC_DEBUG) || defined(DEBUG) drivers/peci/controller/peci-aspeed.c:#if IS_ENABLED(CONFIG_DYNAMIC_DEBUG) drivers/peci/controller/peci-aspeed.c:#if IS_ENABLED(CONFIG_DYNAMIC_DEBUG) include/linux/mtd/rawnand.h:#if IS_ENABLED(CONFIG_DYNAMIC_DEBUG) || defined(DEBUG) I think, it will only cause confusing for users, wondering why it does not show up with `-DDEBUG`. I assume the Linux kernel offers other ways to do what you are trying to achieve. Maybe using a dump_traffic knob or so in `/sys`. Kind regards, Paul