Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3788730pxj; Tue, 11 May 2021 11:53:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAMsIi1XdPvjrvLcz8GSMt+8kD7Vk5F83qrSZM6TsT90z1iH6cMexu50ilQ43ZaXn+FXQO X-Received: by 2002:a50:fe04:: with SMTP id f4mr37988161edt.29.1620759192278; Tue, 11 May 2021 11:53:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620759192; cv=none; d=google.com; s=arc-20160816; b=nk6muGiHVmQ+n1ZOa5gBgIg/YkSu/RUeoIyhrF3JG0T7pwy1QfWU853kx7fs/+eoZB zQkl3ADtDD/6CwvaP3gkY8l5y5MZ0qZuwALfxlD9gXr3CmUjLIjZmgAa3OUlejwKipCc d47FlEKvsG7++X+Y6woOQ+hGxRXe0//HOnvM1+ZCnrjDef7BBs8Z2rzu4aGdmbxMe1ct bq/n4KqBaf7rf3TMt9ySl/thRT1hp6Q/5Vj5ybLy1W7WIpBCa++e4VbFvLY8DOfYMEWF yReHQLnLF023zBn9wdCBtEPs9QOB5IZ0v8SyoJ/raBrUnZM2sV0a0jPqvOg3Als7IaVs eUGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=D992vbjQHx6507pkKz07GBRojC3qb4kG7bKEZ05x9do=; b=cnp/bBC3N7FwosWNI8QHH5oD8W/x6pCtzAf0XEtLX/9FXgQ9GD+41CaVJa8uKir3o2 +U8vKtRkN1OtQhN3SgH2MxPVjUhz+nfYCri8/37kBbGY8Xp6Le8VHjit4oBazHqeFp5d /LdqvhVAo2K4KJcC8TWzWqZcujWxM/tl5CvsmSAdD8/XhAcjajE6TDIwb84VjyOnmTEy 49kkC8aBrVMZfmAyZS3A72Ehu5B3Oi8pnmFy4nnXNC9neoTPhXF/0n8eAru3TZDmFSj7 +9bks3gtwyuryVKWrbD9PUKZ2jQaEMMwHuY2BxSb8pBy9/Qjo/Ku4WLWrkg+AQxABtqT cJMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="HD/GXFSo"; 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 hr18si11781887ejc.704.2021.05.11.11.52.48; Tue, 11 May 2021 11:53:12 -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="HD/GXFSo"; 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 S232172AbhEKSwn (ORCPT + 99 others); Tue, 11 May 2021 14:52:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232096AbhEKSwd (ORCPT ); Tue, 11 May 2021 14:52:33 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42642C061574 for ; Tue, 11 May 2021 11:51:26 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id k16so5078842ios.10 for ; Tue, 11 May 2021 11:51:26 -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=D992vbjQHx6507pkKz07GBRojC3qb4kG7bKEZ05x9do=; b=HD/GXFSooFNbTEqtrlLNxCJxchPcIr385FVGf3X/Plk9rqXjc5RLPbR6I+C9c+dLpp 6iHhy5WxZx6PXgVl34SoiJtxjfbmrF1R8AGe/sKGy2XmQUjX6q1el3pXa/mJ2RxHACkn QR95INsZUwonxFhJvv2M1bLRaNqNruGIfOP4ud3Mo5x/gNBMR0W46yi1xcl/F50vMeGZ xwOezAjBWuIMT8X6lhoUDrS1chsFHbfRslaZazA8uFp9XncLnU0fEAeC2zQJkSW18DKq f2twe6qNBOcA7QadZTNqASdKtvTqWz0tjd273L6CiVhdwsZqQYhB7B6/HBXmjDW6gsY0 S9NA== 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=D992vbjQHx6507pkKz07GBRojC3qb4kG7bKEZ05x9do=; b=ViuNGYU8n8nYFgl6d+t39iSE1VA3cp8S7GbQpAHcNAaz9eQHRkdGFzNGfRCU5mX6iM 8eyxMlOt5QAdiPDsG1nXrmX1W0bu470yKGrpL5n3Xkfp6Zl+cQVSA/V/UlCTkEZm0+LV bPcMrg7BmG+HctlSddznuMzhsnTEB8lm60/GpCzkoEqAB0e5Iruekqz1/SkCqVTKO+wG IVtXqKbQzzyCwRfyoJunfRagdlcpzWu2fseEhcaS4gVLkCa1vNUglF6El3d2R19K8Op6 Adzzpry3YOXP3DRQmScX8x0Qe9qr8ag3NnKXAgJCN2yJDo1fEQ/Wj3DumEXL1g4iKIw/ jo4Q== X-Gm-Message-State: AOAM53156Wfl1HbIuZTBPE+sqNn54IRSEQtyjCWv9HFHsE/o9YmsGDLd EhIyEFa9ZbaTuZKPLrTlEN0= X-Received: by 2002:a05:6638:d15:: with SMTP id q21mr972818jaj.83.1620759085793; Tue, 11 May 2021 11:51:25 -0700 (PDT) Received: from frodo.mearth (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id t10sm405096ils.36.2021.05.11.11.51.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 May 2021 11:51:25 -0700 (PDT) From: Jim Cromie To: Jason Baron , linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, Jim Cromie Subject: [RFC PATCH v5 06/28] dyndbg: accept null site in ddebug_match_site Date: Tue, 11 May 2021 12:50:35 -0600 Message-Id: <20210511185057.3815777-7-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210511185057.3815777-1-jim.cromie@gmail.com> References: <20210511185057.3815777-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since all query terms must be satisfied, we can reorder for clarity, moving !!site dependent checks after those on _ddebug itself. 1- move format and line-number check code to the top of the function, since they don't use/check site info. 2- test site pointer: If its null, we return early, skipping 3: If the query tests against missing site info, fail the match. otherwize site matches. 3- rest of function (checking site vs query) is unchanged. ddebug_match_site ignores module, because it's tested already by the caller, where it is known from debug_tables. no functional changes Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index e6e2cb0180e5..47d427b82ae1 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -145,21 +145,7 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) static int ddebug_match_site(const struct ddebug_query *query, const struct _ddebug *dp) { - struct _ddebug_site *dc = dp->site; - - /* match against the source filename */ - if (query->filename && - !match_wildcard(query->filename, dc->filename) && - !match_wildcard(query->filename, - kbasename(dc->filename)) && - !match_wildcard(query->filename, - trim_prefix(dc->filename))) - return false; - - /* match against the function */ - if (query->function && - !match_wildcard(query->function, dc->function)) - return false; + struct _ddebug_site *dc; /* match against the format */ if (query->format) { @@ -181,6 +167,29 @@ static int ddebug_match_site(const struct ddebug_query *query, dp->lineno > query->last_lineno) return false; + dc = dp->site; + if (!dc) { + /* site info has been dropped, so query cannot test these fields */ + if (query->filename || query->function) + return false; + else + return true; + } + + /* match against the source filename */ + if (query->filename && + !match_wildcard(query->filename, dc->filename) && + !match_wildcard(query->filename, + kbasename(dc->filename)) && + !match_wildcard(query->filename, + trim_prefix(dc->filename))) + return false; + + /* match against the function */ + if (query->function && + !match_wildcard(query->function, dc->function)) + return false; + return true; } @@ -210,7 +219,7 @@ static int ddebug_change(const struct ddebug_query *query, for (i = 0; i < dt->num_ddebugs; i++) { struct _ddebug *dp = &dt->ddebugs[i]; - struct _ddebug_site *dc = dp->site; + struct _ddebug_site *dc; if (!ddebug_match_site(query, dp)) continue; -- 2.31.1