Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1325922ybh; Sun, 19 Jul 2020 16:12:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1bsyr0hPST8z2Px0iyiA0o0eILV1JbSC1eldoDg3NmcUYv5hysB8YMgBDQyfOMdGxudCH X-Received: by 2002:a05:6402:202e:: with SMTP id ay14mr19040245edb.233.1595200370160; Sun, 19 Jul 2020 16:12:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595200370; cv=none; d=google.com; s=arc-20160816; b=0AWxId9BXPqixlC9O9GvD7mP9Klk9jTMHq/ULO54qYxRSda+VoDWFLZddNFfGxE6X2 yI9LvdhDei+F1mUZ4TZtqxA83N03jUO7lOgv7pAB4OkWpAxaKa1nVywbAlS4987BF8+c Yy/8/mUUQaLMhZVm/Tzma9DGZBKCtI2F8hA8z5qKVBbP2IkSJS6SFr3XbeWVNF86F1z1 Cafy1OWyPkNLOkbd5kQcFHUD9SFF5vOnzlr+tzkfUhPqqLPG22JeylTysP1vFvotXZ5p cghpZ9LbpYx5nN4cm4cki9Zm52XbOaUYoYv+hT5ZZfIdNxiMyGLgzqJNhLXIu4XFfRb/ Z+dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4kK1E0vrnaopAH59gFVu/eR8mRLRCxGqAtmR4UyqSQU=; b=htw6eT7uo3GASfEdNy3XyWogzIGR/tck1/1uq2CEIi4F9ty9Z63FC6Wj32iaUieTQC ZjdWGQfOJjFjd/wgbWYnrTceLXQcQT4cwCsNu2ib7PRKFczy9PinQvaXlyRIJ5vKNTdV qi8Vbunm6pZqY0d2PKFDxi6aH7WSkvWgwqhQF8vzf2pBP1y7bWAQ1b3XhQI6YMSeBIs6 TQdiP3d3LW75jhVMRpmzBF+LFHyAx1xYGSeKd3d8WFLGzRUY/pY/Ijecs4g34ypgZRgS uA1C5hUEniks5LreIVpVqjF60QS7rpRu6crW8FAVxvQmI/cuPmjnKbUmGDPKtU8OMe7Z z9wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rH5LHoBG; 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 mf17si9312675ejb.86.2020.07.19.16.12.27; Sun, 19 Jul 2020 16:12:50 -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=rH5LHoBG; 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 S1727774AbgGSXLy (ORCPT + 99 others); Sun, 19 Jul 2020 19:11:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727093AbgGSXLs (ORCPT ); Sun, 19 Jul 2020 19:11:48 -0400 Received: from mail-ot1-x341.google.com (mail-ot1-x341.google.com [IPv6:2607:f8b0:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB704C0619D2 for ; Sun, 19 Jul 2020 16:11:47 -0700 (PDT) Received: by mail-ot1-x341.google.com with SMTP id t18so10816891otq.5 for ; Sun, 19 Jul 2020 16:11:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4kK1E0vrnaopAH59gFVu/eR8mRLRCxGqAtmR4UyqSQU=; b=rH5LHoBGuI+oJg93txp6j617wjh6vHHYT4w4O0ENJbKSjdJXwWGAwMrZfgBgGJcVlm 40D/2FEou/egiLG1XgSI6ZeX0HkNbHR2jjlV7+YppDBlrfdnv8muTL+TX3jZAamUgvOt Mha8ceockeGtHWFDZENDunMXPz4lrV/jSKxTAlelAf2m+kyz8XqKMa6SJbKHeHu68ynA 3uF36AG31LGF7++z6YQEAJPtDBB3k5r4DrnHNeDRoEJgUVVVpbXhpx90hibD0C+Sgoon jlbFlFHtkftGZsWwbbJhImDJEB6/A9XEBL0GJmmwIoYMcCsxlbunsKqgXKupXELXIWce Lbvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4kK1E0vrnaopAH59gFVu/eR8mRLRCxGqAtmR4UyqSQU=; b=G5SNWnHuOcJ32u+tEuvpPAirFmkYJCMszwhSFwsNp6DCXhD3SS72ET9AOGz7+Op3rS W06DJSAt9/Om88uLMpltjMs8cK92M4i406AEdHIfq3N2pcw9hHlfOjbTuH50G28nm049 i4hcWp+4myO2po6B1XLsRpe9RVJtb5TZWciP81y+m7RTdaJ8dRWNc3fJC9FuFF91yeNy 7+INQlmdQ94kmayE2oJxsnQWau+tkmQrG4Eq8dkwuGq+g1FZKIbA0/Grltuu3dt4k/GO 0qe4jmA9JaFepwOl6t3bmKWqje07j1xWyeRd5nCJKR+JTHH8Tfu8aXzd70sVwFdyDU0u Mt3g== X-Gm-Message-State: AOAM531jq9ThnTQum78dm5BlEmUjSQEBHM2SDW/Dm2WV/1LblyNAZLlk Y1jej+kADUaiLsU9oY4Ti5E= X-Received: by 2002:a9d:3f66:: with SMTP id m93mr18465055otc.49.1595200307285; Sun, 19 Jul 2020 16:11:47 -0700 (PDT) Received: from frodo.hsd1.co.comcast.net ([2601:284:8204:6ba0::5e16]) by smtp.googlemail.com with ESMTPSA id q19sm2394680ooi.14.2020.07.19.16.11.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jul 2020 16:11:46 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org, akpm@linuxfoundation.org, gregkh@linuxfoundation.org Cc: linux@rasmusvillemoes.dk, Jim Cromie Subject: [PATCH v5 16/18] dyndbg: allow anchored match on format query term Date: Sun, 19 Jul 2020 17:10:56 -0600 Message-Id: <20200719231058.1586423-17-jim.cromie@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200719231058.1586423-1-jim.cromie@gmail.com> References: <20200719231058.1586423-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This should work: echo module=amd* format=^[IF_TRACE]: +p >/proc/dynamic_debug/control consider drivers/gpu/drm/amd/display/include/logger_types.h: It has 11 defines like: #define DC_LOG_IF_TRACE(...) pr_debug("[IF_TRACE]:"__VA_ARGS__) These defines are used 804 times at recent count; they are a good use case to evaluate existing format-message based classifications of *pr_debug*. Those macros prefix the supplied format with a fixed string, I'd expect most existing message classification schemes to do something similar. Hence we want to be able to anchor our match to the beginning of the format string, allowing easy construction of clear and precise queries, leveraging the existing classification scheme to enable and disable those callsites. Note that unlike other search terms, formats are implicitly floating substring matches, without the need for explicit wildcards. This makes no attempt at wider regex features, just the one we need. TLDR: Using the anchor also means the []s are less helpful for disamiguating the prefix from a random in-message occurrence, allowing shorter prefixes. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index c983049e986d..c72bb4d2eb7e 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -181,9 +181,16 @@ static int ddebug_change(const struct ddebug_query *query, continue; /* match against the format */ - if (query->format && - !strstr(dp->format, query->format)) - continue; + if (query->format) { + if (*query->format == '^') { + char *p; + /* anchored search. match must be at beginning */ + p = strstr(dp->format, query->format+1); + if (p != dp->format) + continue; + } else if (!strstr(dp->format, query->format)) + continue; + } /* match against the line number range */ if (query->first_lineno && -- 2.26.2