Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4373850rwl; Mon, 10 Apr 2023 10:02:58 -0700 (PDT) X-Google-Smtp-Source: AKy350YnvwAD6Mdt0owuigqtRX6K/xd+cUFnR6Pi/5Gmc7QjQXGPZy61v4PQBQ19tqnSlV0g3rug X-Received: by 2002:a17:906:71cc:b0:94a:57d1:5539 with SMTP id i12-20020a17090671cc00b0094a57d15539mr5607213ejk.5.1681146177865; Mon, 10 Apr 2023 10:02:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681146177; cv=none; d=google.com; s=arc-20160816; b=IdPTdnAej2ElJheRgZ5SXDS1AcRmmGIKx9cNqT/S5VmxuHTZAAEJ0Vursy9FvrtMys 25VOsbUDH1GVog0s2tLLB7Eqto0qH4X813toalRwZdcSw5Aapx23ZRZfaMOhKcNM4ast 9gU954VUQbahrHCi6qFdBF20ljXZpvFV13wIFodi5n+7d/8AOrxd3inSs8sJp7dHs0FM YzyJaz9jMSbRAWtdSFsmkIte2x33y0d6+YK5ubREB+OlshZA438c73S/0ijp5WH/szjd JgevVh2/e38MtXJ7fV80wr5PZNsD8TvZd9c7AU7Cuiq43Fpu28ZJ4ecP1hIPcEF6hlKR gukQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=CDMIxIlzLe6OoM/naJz5POkNQuDzrQhBtMQcvFk0KY8=; b=Ogk007IlPjv/w66M2AYWpM85C5BvNfmIvK5KPPz75cKqUGBuKNK3cwdDQF+oEZBOhk vfTK0mt58cxYR4RwoCsQQ38wvzYIoKPVMlxVjI41EiOlH2GehW+tUR/tYbxziE2FTUgN 8JtBEJGf7JeTz/iSnU0W6vkiUdCMpjP5AjFqY8HJl7IXXS69BDG5Zfnu6ZIITfwy2817 FJkDd69CBjDaq7qAdRN+AaOrG3aA/yLpjH2ZZ/zhZqhmTt5VWzCXeUDcX74JYkFkHIas PVeRULk6NOG22j/r5fHRxJzk5gZt90hejnpLH9lhCoIcnxSRI5PHgFsq6+2kj0QQeZn5 oPzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RU4JTfE+; 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 s7-20020a170906960700b0094928d50a59si8063306ejx.247.2023.04.10.10.02.26; Mon, 10 Apr 2023 10:02:57 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RU4JTfE+; 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 S229939AbjDJRA2 (ORCPT + 99 others); Mon, 10 Apr 2023 13:00:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229669AbjDJRA0 (ORCPT ); Mon, 10 Apr 2023 13:00:26 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D6B81BF0; Mon, 10 Apr 2023 10:00:25 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-514156b4976so594660a12.3; Mon, 10 Apr 2023 10:00:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681146025; x=1683738025; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:sender :from:to:cc:subject:date:message-id:reply-to; bh=CDMIxIlzLe6OoM/naJz5POkNQuDzrQhBtMQcvFk0KY8=; b=RU4JTfE+2r2I/O3lhOHpLJLUNeiNQumTqneN4FMDHyOHkaCNYKnfdy25EpHrHEjP2a MtHpMjqQ7sO9a1Wf/pnJ//nhyDR9+P+GQPeSwRSAX8Km3a7alSCA32fXVe+B3VgkDMbE capCRVmRWK52w5/GdMijjLlKvlU5nICMrB+SB6mHpX9xArmOFJENG+zY5BVF9ZLWOOo3 OFzAGKtrQ7gI6toY1qQ+91NdBTMElQyK+hN+s+Cu2pLzehyTlvgyWLhR9c67TiwgezRh npZ7V9lNjsNxxXq6gWhhkAUm0zerDjhiChFEyCnd7Fh+rCFAcbiolmcTPlGGjOgrtsni ENbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681146025; x=1683738025; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CDMIxIlzLe6OoM/naJz5POkNQuDzrQhBtMQcvFk0KY8=; b=nRpGHdunFZpFrbKNpD3w2gDaFDQUv5NnlM85ZIWcD+y4JOz0UbY5VHJFWylthIMKIx 3fGjbOv3F4JbSGDgMZfxP0gJH3Efw/qOAqLdw400HLZkMNziAAjWMIKRL+oOOy/IM0YF E/gNMg1njIvbdX1h+TQuwPiI6UEa2tYC/1yHz52gXNsxKWYGF/RHXHNvcxmP8bFjIKib AXJOGZpVzsVd6ffdIF+tuPSXph5pjSUdJidcsRQjsBK9z2B+lc7u0ZKt/sqMU6NGqHQB zL/hFK7Nfl/aI/lI0r3eYg5DIOGv6A5DtAm6Dec6+UmgXRaIi8nfExpHafrdjFW6T9AY wivw== X-Gm-Message-State: AAQBX9dimcQjPUtZx1pRSlm6/qtRFYlHHijp7mUknOYRrC1+73KB2CDk Ky45kShdo6zYw0jOZt8oZFM= X-Received: by 2002:aa7:95b1:0:b0:62d:dd8b:f42a with SMTP id a17-20020aa795b1000000b0062ddd8bf42amr11990296pfk.25.1681146024387; Mon, 10 Apr 2023 10:00:24 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id c4-20020aa781c4000000b0062d859a33d1sm8056827pfn.84.2023.04.10.10.00.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 10:00:23 -0700 (PDT) Sender: Guenter Roeck Date: Mon, 10 Apr 2023 10:00:23 -0700 From: Guenter Roeck To: Badhri Jagan Sridharan Cc: Greg KH , heikki.krogerus@linux.intel.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] usb: typec: tcpm: Add kernel config to wrap around tcpm logs Message-ID: References: <20230410073134.488762-1-badhri@google.com> <2023041028-irritate-starless-a42f@gregkh> <2023041004-antarctic-hardiness-524e@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=no 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 On Mon, Apr 10, 2023 at 02:00:08AM -0700, Badhri Jagan Sridharan wrote: > On Mon, Apr 10, 2023 at 1:27 AM Greg KH wrote: > > > > On Mon, Apr 10, 2023 at 01:08:55AM -0700, Badhri Jagan Sridharan wrote: > > > On Mon, Apr 10, 2023 at 12:45 AM Greg KH wrote: > > > > > > > > On Mon, Apr 10, 2023 at 07:31:34AM +0000, Badhri Jagan Sridharan wrote: > > > > > This change adds CONFIG_TCPM_LOG_WRAPAROUND which when set allows the > > > > > logs to be wrapped around. Additionally, when set, does not clear > > > > > the TCPM logs when dumped. > > > > > > > > > > Signed-off-by: Badhri Jagan Sridharan > > > > > --- > > > > > drivers/usb/typec/tcpm/Kconfig | 6 ++++++ > > > > > drivers/usb/typec/tcpm/tcpm.c | 9 +++++++-- > > > > > 2 files changed, 13 insertions(+), 2 deletions(-) > > > > > > > > > > diff --git a/drivers/usb/typec/tcpm/Kconfig b/drivers/usb/typec/tcpm/Kconfig > > > > > index e6b88ca4a4b9..4dd2b594dfc9 100644 > > > > > --- a/drivers/usb/typec/tcpm/Kconfig > > > > > +++ b/drivers/usb/typec/tcpm/Kconfig > > > > > @@ -18,6 +18,12 @@ config TYPEC_TCPCI > > > > > help > > > > > Type-C Port Controller driver for TCPCI-compliant controller. > > > > > > > > > > +config TCPM_LOG_WRAPAROUND > > > > > + bool "Enable TCPM log wraparound" > > > > > + help > > > > > + When set, wraps around TCPM logs and does not clear the logs when dumped. TCPM logs by > > > > > + default gets cleared when dumped and does not wraparound when full. > > > > > > > > Kconfig help text needs to be wrapped at the properly width. > > > > > > I assumed that the width is 100 characters, but it looks like it is > > > 80. Will fix it in the next version. > > > > > > > > And you do not provide any hint here as to why this is not the default > > > > option, or why someone would want this. > > > > > > "TCPM logs by default gets cleared when dumped and does not wraparound > > > when full." was intended > > > to convey why someone would want to set this. Perhaps it's not effective. > > > > > > Does the below look better: > > > "TCPM logs by default gets cleared when dumped and does not wraparound > > > when full. This can be overridden by setting this config. > > > When the config is set, TCPM wraps around logs and does not clear the > > > logs when dumped." > > > > > > Also, I could make this default if that's OK with Guenter. > > > > > > > > > > > So, why is this not just the default operation anyway? Why would you > > > > ever want the logs cleared? > > > > > > I remember Guenter mentioning that he was finding it useful to not > > > wrap around the logs to fix problems > > > during tcpm_register_port (init sequence). IMHO wrapping around the > > > logs helps to triage interoperability > > > issues uncovered during testing. So both approaches have their own advantages. > > > > But as this is a build-time option, what would cause someone to choose > > one over the other, and then when the system is running, they can't > > change them? > > During initial phases of bringup, it makes sense to not wrap around > the logs, but, once bringup is done its most effective to wraparound > so that interop issues reported by the end users can be triaged where > TCPM logs are very effective. Not really, because the problem tends to be the remote device (or at least it used to be), not a driver under development. > Also, without wrapping around, the logbuffer logs are completely stale > after the user goes through a few USB connect and disconnect cycles > till the system is rebooted. Unless they are cleared. Again, the premise is wrong here. The idea was to ensure that the beginning of a problem is caught and available in the log, not its tail. This includes "beginning" as the behavior immediately after boot regarding an already connected device, and the behavior observed when inserting a device into the running system. Again, in both cases it was most important to catch the beginning of a problem, not its tail. > If we don't want to pursue the Kconfig option, we should atleast make > TCPM default to wrapping the logs around when full so we could > maximise the use of the logbuffer contents. > I don't really agree, but then I am not in a position to argue either. Maybe the premise and reasons have changed since I wrote the driver. Guenter > > > > That does not seem good at all. > > > > Why not just use tracing instead of this odd custom log buffer? That's > > a better solution overall, right? > > Tracing is not enabled by default in most systems. End users don't > want to retry and reproduce the failure to collect traces even if they > could reproduce it consistently. > So tracing was not proving handy here. > > Thanks, > Badhri > > > > > thanks, > > > > greg k-h