From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D88F9C433E0 for ; Thu, 14 Jan 2021 08:59:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 409D8239EF for ; Thu, 14 Jan 2021 08:59:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 409D8239EF Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6EDB38D00C7; Thu, 14 Jan 2021 03:59:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 69D448D008E; Thu, 14 Jan 2021 03:59:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5B2B88D00C7; Thu, 14 Jan 2021 03:59:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0116.hostedemail.com [216.40.44.116]) by kanga.kvack.org (Postfix) with ESMTP id 420598D008E for ; Thu, 14 Jan 2021 03:59:26 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E9D59181AEF31 for ; Thu, 14 Jan 2021 08:59:25 +0000 (UTC) X-FDA: 77703781890.10.use07_361278c27525 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id CB4F316A4D2 for ; Thu, 14 Jan 2021 08:59:25 +0000 (UTC) X-HE-Tag: use07_361278c27525 X-Filterd-Recvd-Size: 5239 Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Thu, 14 Jan 2021 08:59:25 +0000 (UTC) Received: by mail-ot1-f53.google.com with SMTP id i6so4575970otr.2 for ; Thu, 14 Jan 2021 00:59:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qb9hNQO6OcJCASI04u8t2R6xrNDq5cvZ9kC7Nrcqfts=; b=piQg1o8r4FhEXT0RSbsmO2soNb90nnFIJjC5h++xC3FiKSH2yq5CR+PeWqQq0NFeP0 Fsdmj3vuaswo6Rerq/fqsAm6P3qLfDq8Q7OUL7piPW+RIVpFm4px9WPQXyoznVzP0xfw JiCbvGMylmXTi+qH58eFtxD4e5sh+iel9wJSnoxJaw/KuMFIPlUPmXrT3R4/wLLd8n1X eqQBjzTBIkXsoOtB6wTaY+lsrZblj9jk+k6jrGwvgyE4wGRYQXcJYigq0MyHSsdwJwp4 oxbuxvDE+trK//Kcd9pyS4g0QZsFGtXUj2XZCE947slfKuhIf+HHNrLrU9c6ZdZxRKjg hLog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qb9hNQO6OcJCASI04u8t2R6xrNDq5cvZ9kC7Nrcqfts=; b=nEDJ0Vc6mWazl0E5XHnHl2TyyFL8nAWTEMlp/CHf5UW2vIWTjaRPeP8RI1DwsNgYd3 dpLj+NRLB9GGJYLqUo3iGou70Gka+zJSRcZhAyA4gPc6V4+dIF5T9SUxp9peAIlbva2Z ZaPNIwXZqg6l4hcianQyoyghRDY8tIF4hTPvcYRNDG8tf5JVw1HeCkNNoqSDIKkSXDyp SRXlDvhFYy/RalWEshd+qk+LPVJIZiDNlwX6kxZbGDLHtcWbvY1mrrEHryL+GQAjBREy /XEaSrY5SgwXAT2E0jMNriksHZyBH+sRhC1AJo6lZ85O1MmRjAgO1J0BIfr7lsZuU7ec LssQ== X-Gm-Message-State: AOAM531gRGyMojytxa89qr987Z5KG6ScjSkTmvdqDZScX7w9Rjw3g5e+ ddV7djssSd0PZAngPQaALwaZK+wBvvyV9WHL+Ds7HA== X-Google-Smtp-Source: ABdhPJzoe+c4TcZ0g79ZoNvHvj6bRfYCiY0rcTjlf8D0qLJEA1KuBVL5FJT2zoe5JW0+TDRn1YMTklchb0Tc3Plx1Ic= X-Received: by 2002:a05:6830:2413:: with SMTP id j19mr4126160ots.251.1610614764525; Thu, 14 Jan 2021 00:59:24 -0800 (PST) MIME-Version: 1.0 References: <20210113091657.1456216-1-glider@google.com> <20210113091657.1456216-2-glider@google.com> <20210113161044.43bc1c1a@gandalf.local.home> In-Reply-To: From: Marco Elver Date: Thu, 14 Jan 2021 09:59:13 +0100 Message-ID: Subject: Re: [PATCH 1/4] tracing: add error_report trace points To: Alexander Potapenko Cc: Steven Rostedt , Andrew Morton , LKML , Andrey Konovalov , Dmitry Vyukov , Ingo Molnar , Petr Mladek , Sergey Senozhatsky , Linux Memory Management List Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, 14 Jan 2021 at 08:50, Alexander Potapenko wrote: > > On Wed, Jan 13, 2021 at 10:10 PM Steven Rostedt wrote: > > > > On Wed, 13 Jan 2021 10:16:54 +0100 > > Alexander Potapenko wrote: > > > > > +DECLARE_EVENT_CLASS(error_report_template, > > > + TP_PROTO(const char *error_detector, unsigned long id), > > > > Instead of having a random string, as this should be used by a small finite > > set of subsystems, why not make the above into an enum? > > You're probably right. > I just thought it might be a good idea to minimize the effort needed > from tools' authors to add these tracepoints to the tools (see the > following two patches), and leave room for some extensibility (e.g. > passing bug type together with the tool name etc.) > > > > + TP_ARGS(error_detector, id), > > > + TP_STRUCT__entry(__field(const char *, error_detector) > > > + __field(unsigned long, id)), > > > + TP_fast_assign(__entry->error_detector = error_detector; > > > + __entry->id = id;), > > > + TP_printk("[%s] %lx", __entry->error_detector, > > > > Then the [%s] portion of this could also be just a __print_symbolic(). > > We'll need to explicitly list the enum values once again in > __print_symbolic(), right? E.g.: > > enum debugging_tool { We need to use TRACE_DEFINE_ENUM(). > TOOL_KFENCE, For consistency I would call the enum simply "ERROR_DETECTOR" as well. (Hypothetically, there could also be an "error detector" that is not a "debugging tool".) > TOOL_KASAN, > ... > } > > TP_printk(__print_symbolic(__entry->error_detector, TOOL_KFENCE, > TOOL_KASAN, ...), It takes a list of val -> str. E.g. __print_symbolic(__entry->error_detector, { TOOL_KFENCE, "KFENCE" }, { TOOL_KASAN, "KASAN" }). Looking around the kernel, sometimes this is simplified with macros, but not sure if it's worth it. Typing the same thing 3 times is fine, given this list won't grow really fast. Thanks, -- Marco