Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp7396871pxu; Fri, 25 Dec 2020 12:22:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/glJSLRzHD4mYG2+FTKldPYizEwNFfgjbHRON7eHJYY5KBuqpvACXyDs5pvI7LCiwS+Xx X-Received: by 2002:aa7:d5d2:: with SMTP id d18mr34239498eds.126.1608927757335; Fri, 25 Dec 2020 12:22:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608927757; cv=none; d=google.com; s=arc-20160816; b=oGqv0j6vwQ+B0hWl95jaTtrxkThNdC7uHCCjEOL707PbLSlRvKcwWdWHj1WyLEpogR kcBa8tpmTUU6jOGjnkWvojdfcnJAN8ZhaRYSiYodJB7FhhQSWQEb6vy3uKnNnlxvD/2p abs0fSYiTY0n06oGwhOOCJzxszfnJXWqEraOwlRYQaZc6BiKNk2DUV3bsDFErep9Rqx5 Rb+w02h6HWtVxoDjOcxWmc3HJqIv0/j3X23OA0D/FWEbV8A8YMcmfB8egRamvpPCXvSN od9Vmy1kNV7dfLfQ4/ly0OiDvYc57nMYlAYFEa7k6MAOSo/hQK4sHnbwjVt3zg6ugqQX SYaQ== 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=MO7/t3dlktGOY+JeG9dff+wym9XTwOfko8AazjcITNY=; b=e77J/rMASvenfsTYDhSo1OFerr7VXj2zS68Unwf41Zm+ijcwGLMenbNUXR7RjV+8vb H1vY7wB+yLSCaztQBGLs+v9VSe9oPS4fk39+fmF5cyU6/lD9dZNzPReGdlY7KlRDJ42H SFd3+zFKukkCcfHHYDdtdligH9M/vFujD/9eCAx5zEkUxAhohu7Cnd7oL9YxgTPt5zk7 fxvXs8kqOVNbRseIRA2f9Ss0Pl9BBn4VgJpZlhBobj+qhIWdtqwJg2ZW+/IukGAoKqDv F6p4QcwID2/quazAdgyv/rxHPXHfJDjVZwXZEGjrDspZioq2MGGJYyebzB9fbF6OapNv is+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tBD8FN1f; 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 me14si15075367ejb.75.2020.12.25.12.22.15; Fri, 25 Dec 2020 12:22:37 -0800 (PST) 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=tBD8FN1f; 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 S1729353AbgLYUVj (ORCPT + 99 others); Fri, 25 Dec 2020 15:21:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729199AbgLYUVh (ORCPT ); Fri, 25 Dec 2020 15:21:37 -0500 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36770C0617A0 for ; Fri, 25 Dec 2020 12:20:29 -0800 (PST) Received: by mail-il1-x131.google.com with SMTP id v3so4610174ilo.5 for ; Fri, 25 Dec 2020 12:20:29 -0800 (PST) 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=MO7/t3dlktGOY+JeG9dff+wym9XTwOfko8AazjcITNY=; b=tBD8FN1fDZbNc+c2lffI3gp7oZ5RR018wR7ZJucnxVAqK/AKOYF9CJBoPBQ3gIBlZ/ xtpZdBAIA6JvwOGDYy4piKzn+q6Jf3GfKEmzk+mjMbSfc9rr1TR6owN42cx0DsEXniln RaEKUCmFLfSJ6nnRTbwXl8jHZmp6mZYUUYeLCEtOAhr0Zfklptm215kdEuiJwP/7f/+p aoFbzkbyUeNHkf1Tub3/IjFr5LlP1RtrmMNO8h13fqUiZ9x/QezQIYQGE+fa9abvcX8R CGNqVJNlQ8uDiidbAiep62ai+EIHC0fJTT2yLyeAWfegGi9qNjurxwz0RB/pZuhCDbHa Q23Q== 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=MO7/t3dlktGOY+JeG9dff+wym9XTwOfko8AazjcITNY=; b=ozNLsUWH4G2sutoriHXgqRrqi4zEovwmmCJH9YRzcy7075zSEU/fsgU9fdo5IUSdST DqLGlr7znC6LIaOLAEBc0xAy/AHaYYk0Z2Yb3+OoEgHNSZfjz56B7rrLRUgu7x965q8E gYpj5WRaCU9lzPfyYa4kbl6wYPT3Vd3kiATH1TuCohUG1Nz9dERFCcegyrmsALv9Hdpf b+3MvYMXJ7m+kW+Ee/vuIf2i5ocgOkiemlr+Y4WllxfkCCESVWkzqsORjIxBCBBxv6Fa ZRsJVbaVxfDUbyrpYt1YbWZhogevh7kMF5rnYgtsNtbf9CtTWA3d+f9/i/GKiL6shcsA 3c8g== X-Gm-Message-State: AOAM5306uvKsmt4bW6BkmLtgUNG/qk+25CpJnHJTJajzS4CsL0ou2SYQ Ljlrs5a0JrRv/rPFsiqVKJI= X-Received: by 2002:a92:d8c4:: with SMTP id l4mr33510187ilo.38.1608927628623; Fri, 25 Dec 2020 12:20:28 -0800 (PST) Received: from frodo.mearth (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id e1sm28380401iod.17.2020.12.25.12.20.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 12:20:28 -0800 (PST) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: Jim Cromie Subject: [RFC PATCH v2 15/19] dyndbg: add ddebug_site_get/put api with pass-thru impl Date: Fri, 25 Dec 2020 13:19:40 -0700 Message-Id: <20201225201944.3701590-16-jim.cromie@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201225201944.3701590-1-jim.cromie@gmail.com> References: <20201225201944.3701590-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 Now that site info is optional, abstract it so we can manage it more flexibly later. Change all site users to use ddebug_site_get(p) instead, which just returns ->site. ddebug_site_put is called to balance gets, it currently does nothing. no functional changes. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 8ad9be28f38e..25f49515c235 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -144,6 +144,14 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) query->first_lineno, query->last_lineno); } +static struct _ddebug_callsite *ddebug_site_get(struct _ddebug *dp) +{ + return dp->site; +} +static inline void ddebug_site_put(struct _ddebug *dp) +{ +} + static int ddebug_match_site(const struct ddebug_query *query, const struct _ddebug *dp, const struct _ddebug_callsite *dc) @@ -242,13 +250,13 @@ static int ddebug_change(const struct ddebug_query *query, struct _ddebug_callsite *dc = dp->site; if (!ddebug_match_site(query, dp, dc)) - continue; + goto skipsite; nfound++; newflags = (dp->flags & modifiers->mask) | modifiers->flags; if (newflags == dp->flags) - continue; + goto skipsite; ddebug_alter_site(dp, modifiers); @@ -264,6 +272,9 @@ static int ddebug_change(const struct ddebug_query *query, dt->mod_name, dp->lineno, ddebug_describe_flags(dp->flags, &fbuf), dp->format); + + skipsite: + ddebug_site_put(dp); } } mutex_unlock(&ddebug_lock); @@ -633,11 +644,11 @@ static int remaining(int wrote) return 0; } -static char *__dynamic_emit_prefix(const struct _ddebug *dp, char *buf) +static char *__dynamic_emit_prefix(struct _ddebug *dp, char *buf) { int pos_after_tid; int pos = 0; - const struct _ddebug_callsite *desc = dp->site; + const struct _ddebug_callsite *desc; *buf = '\0'; @@ -653,6 +664,7 @@ static char *__dynamic_emit_prefix(const struct _ddebug *dp, char *buf) if (!(dp->flags & _DPRINTK_FLAGS_INCL_ANYSITE)) return buf; + desc = ddebug_site_get(dp); if (desc) { if (dp->flags & _DPRINTK_FLAGS_INCL_MODNAME) pos += snprintf(buf + pos, remaining(pos), "%s:", @@ -670,6 +682,8 @@ static char *__dynamic_emit_prefix(const struct _ddebug *dp, char *buf) if (pos >= PREFIX_SIZE) buf[PREFIX_SIZE - 1] = '\0'; + ddebug_site_put(dp); + return buf; } @@ -952,7 +966,8 @@ static int ddebug_proc_show(struct seq_file *m, void *p) return 0; } - dc = dp->site; + dc = ddebug_site_get(dp); + if (dc) { seq_printf(m, "%s:%u [%s]%s =%s \"", trim_prefix(dc->filename), dp->lineno, @@ -968,6 +983,8 @@ static int ddebug_proc_show(struct seq_file *m, void *p) seq_puts(m, "\"\n"); } + ddebug_site_put(dp); + return 0; } -- 2.29.2