Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp6026874rdb; Mon, 18 Sep 2023 01:27:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH8fpsGKIy5fX8VZxF1cjevsT9QnVZBPP/R3NxXFjW2r/4TTEo7CQIXL0pGuRSWUrtPkPCE X-Received: by 2002:a17:902:ced1:b0:1c1:f27e:a55a with SMTP id d17-20020a170902ced100b001c1f27ea55amr8448568plg.46.1695025669500; Mon, 18 Sep 2023 01:27:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695025669; cv=none; d=google.com; s=arc-20160816; b=cj0aDk/3ltJ4lwsNxIAptpj2E0VJbYTGRLPwHiTR4ZHkwKlPgRN47JHpkFvy542bGu Oc7HXDxn+rlXIFrQgc4CVC0BpKAfvlzpebQC42RLhD02eAQf3nZgvq1Wbp0v6qyy88Ow 6W/1BshYjGwUt7DZXA26bmk8KZ5LHpyRQKLWqG2SoTtwNXoABa6zb+5a4cjRD7R+3e8v Aa/A7YIe6P6b129cRDSitom9Vr2VTO68q4s6l7EJ4rLiUNoHQUqtgXhqAb7Yc0E3bF8a uf9B70Evf/9Y5nrPFgZcNgroQHn7o7z/ga3a5HPAUgWYXbcL65ru8KpNo5qUX7eXopN2 0stQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=oYOkhYBxWVZ+LY5smS6U7evu3bZ7CccBMIczeYjBfLA=; fh=ugRlIMsJKDBCv5Jp89RLgLpCoKMbpc9m7hHawG3FcfE=; b=v42DGAGU/0YaLTdPQ5ArZQAzUfo7gbRBFPkbaVLNRFvLKF2v558C15FtDvJShVkOC4 5hYGiKCDhWPiYJAqsm/ZFbTYb406EG55sfqyccxopk0u7ww1UAKqvFdcrGYnCFiGnUUM PzG/Kobh6LKpLbdDLqSgXeRgX00O1O86Gi0CkUBqi6dYL+Sbx1hovVvaMhJlInCMeiEw XZYSKuj4X6ewqksDF7zVlEDoiFZ1zfXWuCDNEkkCwd4vG1XX/cKjtvUvqQ0N8A288sMJ tV4eYg0ZRpKi60GZiaR2px3ti+O3y3qooz4QEDk+SSKZ6OVH/x2GB93lJzeMFdXgoO1r /41Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@semihalf.com header.s=google header.b=EjH0N1Pg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=semihalf.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id y18-20020a170903011200b001c3a05b0b67si336066plc.566.2023.09.18.01.27.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 01:27:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@semihalf.com header.s=google header.b=EjH0N1Pg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=semihalf.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E15188087F3A; Mon, 18 Sep 2023 00:21:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238565AbjIRHVE (ORCPT + 99 others); Mon, 18 Sep 2023 03:21:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240303AbjIRHU5 (ORCPT ); Mon, 18 Sep 2023 03:20:57 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 517BAAA for ; Mon, 18 Sep 2023 00:20:52 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-52bd9ddb741so5164951a12.0 for ; Mon, 18 Sep 2023 00:20:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; t=1695021651; x=1695626451; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=oYOkhYBxWVZ+LY5smS6U7evu3bZ7CccBMIczeYjBfLA=; b=EjH0N1PgDc1FiETrj44BmUN61ivYqXUiDnhqDbpEAMVe8o8gdRVuLw2TkqOcKPFexF rXraWdcRGc1Kulpxb5DDhSEWt0nV3fYmPk/bhP0aakzvTDpPr5EPCdk8M1m3JAGhw6F6 ZEEX3aAR8GJ5xsPBOMuuhvgjjTMlyfH1WP0HnejsPXE8NHBhLpM1OtQ/MbWpciLQxIL4 eK5Ahq0URI5oNmibmXlBKCYPItOWafJEhznDQWmGwb4w3f+CQGBeLa+Ms8CdPkqjm7m/ gdSMVXKSGW9yMDHgNrayRCZtzGKUwSyGwwsEw2aRAdxHNX+93dfcooWNBRLUtGZcfejt T70Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695021651; x=1695626451; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oYOkhYBxWVZ+LY5smS6U7evu3bZ7CccBMIczeYjBfLA=; b=GAD4P6+no4YDoEIs8O9L1jWpJsAGCnC/d5480O231cLcaFLah5uA79lHZENdf0Ev+u 0yUtoQyWRmdLqu2+h2PtQlbQorbqWbh5E7EMVrSneJaU/S1HLwTTL8nlPZyC7V4s7ywq KOpsxB8NIp+uvzUXAM51KGZ/UaoPjHO4geouHjFBGypmSUz6ajkL7hKdDJtSOiK5uHWq ZD0LFoe5di6LhoNOFK93UdWl8Sj8voHL1pMUr37jwwZTylXOPy3QYutNQ0g6h1exPMCP DJ2ZFESjMWnsatsq+OrbnovqxaqCNLxm9vnqasRt4xC1h7xwiUakPxk5pbNOgbTf6ZT3 HIyw== X-Gm-Message-State: AOJu0YwY89c2x/memAs5Gb4ySK+wLM7GRYzHFp0mKyNM/nmCs79lazzy 2Ks3NNiLGF1YHY4tRDDek6QBp5DBqe6Wcz7Apt88 X-Received: by 2002:aa7:ccc8:0:b0:525:7091:124c with SMTP id y8-20020aa7ccc8000000b005257091124cmr7000653edt.19.1695021650705; Mon, 18 Sep 2023 00:20:50 -0700 (PDT) MIME-Version: 1.0 References: <20230915154856.1896062-1-lb@semihalf.com> In-Reply-To: From: =?UTF-8?Q?=C5=81ukasz_Bartosik?= Date: Mon, 18 Sep 2023 09:20:39 +0200 Message-ID: Subject: Re: [PATCH v1] dynamic_debug: add support for logs destination To: jim.cromie@gmail.com Cc: Jason Baron , Andrew Morton , Kees Cook , Douglas Anderson , Guenter Roeck , Yaniv Tzoreff , Benson Leung , linux-kernel@vger.kernel.org, upstream@semihalf.com, Vincent Whitchurch , Steven Rostedt Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 18 Sep 2023 00:21:37 -0700 (PDT) pt., 15 wrz 2023 o 20:02 napisa=C5=82(a): > > On Fri, Sep 15, 2023 at 9:49=E2=80=AFAM =C5=81ukasz Bartosik wrote: > > > > Add support for selection of dynamic debug logs destination. > > When enabled it allows to configure destination of each callsite > > individually. The option adds a framework (described by struct > > ddebug_dst_ops) which provides flexible means to add a new destination > > for debug logs. On top of the framework support for trace instance as > > destination is added. By default destination of debug logs is syslog. > > Syslog can be set explicitly by using dst keyword or is selected by > > default when dst keyword is omitted, for example: > > A while back, > Cc: Vincent Whitchurch > proposed these patches: > https://lore.kernel.org/lkml/20200825153338.17061-1-vincent.whitchu= rch@axis.com/ > > his approach adds a single flag, +x or (my pref) +T > which sends the pr_debug to tracefs, independent of +p. > Steve Rostedt offered feedback on one of the versions, > and one could read that as provisional acceptance. > > Ive worked his patchset since, it is here: > https://github.com/jimc/linux/tree/dd-trc-11 > (it has some unrelated bits too) > > but it sits atop another patchset: > https://lore.kernel.org/lkml/20230911230838.14461-1-jim.cromie@gmail.com/ > or for git remote add > https://github.com/jimc/linux/tree/dd-fix-5i > I looked through the patches you pointed me to. The solution with +T/+x is elegant and tailored to specific needs. Our rationale to write pr_debug/dev_dbg logs to tracefs is similar to Vincent's to aid us in debugging. Unfortunately the solution with +T/+x does not cover our use case. Our use case is different. We experience issues reported by Chromebook users which are difficult to reproduce that's why we would like to enable debug logs to be written to tracefs on productions systems. When users experiences an issues and sends us a feedback report the debug logs written to tracefs would be attached to the feedback report. We would like to write debug logs to a separate trace instances based on the subsystem/driver. Our initial areas of interest/issues are usbcore and thunderbolt drivers/subsystems. More may come in the future. With my proposal this could be achieved for the thunderbolt subsystem with the following steps: * enable kernel configuration option CONFIG_DYNAMIC_DEBUG_CORE, * enable kernel configuration option DYNAMIC_DEBUG_DST and set its operation mode to Static. * add the option to the thunderbolt's drivers/thunderbolt/Makefile in order to compile in debug logs: CFLAGS_nhi.o :=3D -DDYNAMIC_DEBUG_MODULE * compile the kernel and update it on a target device, * finally append the entry to the kernel boot command line: thunderbolt.dyndbg=3D"dst trace:thunderbolt =3Dp" Both the solutions (I mean +x/+T and mine proposal) have pros and cons. Maybe both could coexist together, +x/+T by default and this patch as configurable option which adds more flexibility ? > > syslog and/or tracefs seems sufficient, do you have a 3rd destination ? > I don't have a use case for the third destination, but for example adding socket destination to my proposal would be relatively fast and easy (that would be for limited use only after a network is up and running). Thanks, Lukasz > thanks