Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1421977pxj; Sat, 29 May 2021 13:05:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6prQoFYXJpmNws2fQq0KypZWnR4fjZlhxVQ4nGXSqAfCBPxyowjYkjHavuAGtqYavmw6f X-Received: by 2002:a02:3304:: with SMTP id c4mr14238921jae.68.1622318710836; Sat, 29 May 2021 13:05:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622318710; cv=none; d=google.com; s=arc-20160816; b=m11Xfr/hTb2PQEoCEETvx8vAN+0egso/BdWLIqu7qKmacOJf8fVq9e+Tp/xUXBAiO3 X0lfr0zf2eSTc+ipvMq08X8QINJOPpl2acM8P5WUjakKfAH4CYb5i5O5fXGkkYKhLRWc JFO01aatVpl9WxhENcmtJmgxCGhsAgLrrEu1oJjnAs88b17Y1A5xVplC/sWcX2E1ORjX NkaRdzd1mbhEHaRvWY+fkVVoCIFnAgMasFnZTokZMgFKWiNvFsmXJ2ht8LobwPpfvIox hwFER18T32uFHwbhMIEJZGsOEx2etL38gGpZrLUHDaDYSoeAHBMyu4aT2tOBojcaz06i x7cw== 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=lLcoqD8Z5LUtJpDq0UaiguZ2uVOHvR1wGoJHuDbPgRk=; b=kMC1IFWdpLn9gcNB3t9L+sXktEnNxZUiFRGURARcJjxPwlqGqn/vBVjxUNuQZYh5bq /Y/G9fd1FX3VfWmPzCXfgxhJbxo/lAfLhwTPTu8bKpsDpvvv46GqHOWc1gA4970cABzF tgM75arCLlVwJ87/6E42a4SP7PQm66lkPpW4W2Blbl5ionbFeC9s0TaEcWp6bZv5H4EO ElCfpgw4SPTYZvcCT3VRk3Pa0YBa79fj+tWfpsFfONyF648P2JW2OSMxKmg/SxP0eY0p epRvesvSuXPxdYIqhQ5WaT9QS3gKH3XQyn4V32D/+UMfCRJCzFOxFOJ5wZuInGZpfV7Q kYsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="uqkJwl/G"; 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 g9si9152613ild.113.2021.05.29.13.04.58; Sat, 29 May 2021 13:05:10 -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="uqkJwl/G"; 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 S230157AbhE2UFU (ORCPT + 99 others); Sat, 29 May 2021 16:05:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230049AbhE2UEV (ORCPT ); Sat, 29 May 2021 16:04:21 -0400 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16812C061574 for ; Sat, 29 May 2021 13:02:44 -0700 (PDT) Received: by mail-oi1-x236.google.com with SMTP id a13so2554206oid.9 for ; Sat, 29 May 2021 13:02:44 -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=lLcoqD8Z5LUtJpDq0UaiguZ2uVOHvR1wGoJHuDbPgRk=; b=uqkJwl/GwmWcX+OfQkIcr6Ul+myVVOXo6rTnEa5pNtlMo4bVKLk5iQbRl3NCaK2JpV aU25uQsjV1Luy6rOCfwKUtjU637Y0ZXLNfox5XG+Lkg9pfNRQem6lzCJv3Ckr9xedmSd SkocrAiGbG/LjZZcrPmjX/4kxeOF4kEzi+sP06ZlsVC2Ri6JcKbTb2iray53XeSWmtNZ gKccrhXFOHm5gWnfMTCRCSotlctOPSaFMDzXDIDkZi9oECg5CbFZ45UEeCuSseM6eUNi wq4VwIvV6prPJ0W4wnJrPzh1ufO9WT6p38sH0LOOE2JBGquWdJ0V0XXAe3GTjRSnDsez Jntw== 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=lLcoqD8Z5LUtJpDq0UaiguZ2uVOHvR1wGoJHuDbPgRk=; b=EaKR1L5DkknMqMKM4XT+1fgoD0Lt/5JgiL27hYckwYmFMWByJ0i9nvfQOuGVMcK6ea KSFZS6quR+Z6w9rTaaBVUkZ3fgAZT0BnQveTyJ2C0qW4UM4PoYeaPwIthvQPw2fQbRHu Vtbl6jYicTUKDYEcc5RBRmK0WzQjBLMBuIL1ItvER+X1gR8KwZGDpwY+kLpxRc8X+drV SHsRmRlAI9MMr/rt97dcWaoMmf3dd//X1dWHMRYWquP1MKioYhlqGLKvndLIDVkW5z1O G6Lp+FR0vEhDkoURcMq7MqfmkkHfjmlMMtzSk2+kxxHXW5HgWgLwzI7iOK2k4nJ1Sl0M YRDQ== X-Gm-Message-State: AOAM530wCtDzJXpnqe/G+ibCRs/34MqbRCtTw+f98dqACGWNOPJKnjmF 3HSfiO3prJUm/tJSs0UWz5M= X-Received: by 2002:aca:3b07:: with SMTP id i7mr9910181oia.171.1622318563482; Sat, 29 May 2021 13:02:43 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id t39sm1868064ooi.42.2021.05.29.13.02.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 May 2021 13:02:43 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: Jim Cromie Subject: [RFC PATCH v6 29/34] dyndbg: RFC drop _ddebug.site pointer Date: Sat, 29 May 2021 14:00:24 -0600 Message-Id: <20210529200029.205306-30-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210529200029.205306-1-jim.cromie@gmail.com> References: <20210529200029.205306-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 Flip the switch on #define SITE_CHK. This finally removes the _ddebug.site pointer, and almost all uses of it. Due to this, the .site cross-link done by DEFINE_DYNAMIC_DEBUG_METADATA() is lost to the compiler, so suppress the resulting warnings by adding a "__used" to the _ddebug_site records initialized there. In .c, use the union header types introduced in ~HEAD~1, with some casts sprinkled in. This seems to work, but should be cleaner. RFC Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 4 ++-- lib/dynamic_debug.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index c9c568a698a8..b2189ff94fda 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -6,7 +6,7 @@ #include #endif -#define SITE_CHK /* include .site pointer and checks on it */ +// #define SITE_CHK /* include .site pointer and checks on it */ #ifdef SITE_CHK #define SITE_CHK_(...) __VA_ARGS__ @@ -135,7 +135,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, const char *fmt, ...); #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \ - static struct _ddebug_site __aligned(8) \ + static struct _ddebug_site __aligned(8) __used \ __section("__dyndbg_sites") name##_site = { \ .modname = KBUILD_MODNAME, \ .filename = __FILE__, \ diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index f2f6f2b20d01..0e2e082b487b 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -148,9 +148,11 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) static struct _ddebug_site *ddebug_site_get(struct _ddebug *dp) { - struct _ddebug *dh = dp - (dp->_index); + union _ddebug_header *dh = (union _ddebug_header *) (dp - dp->_index); + + if (!is_dyndbg_header_pair(dh, dh->site)) + v3pr_info("get: header fail on %d-%d\n", dp->_index, dp->lineno); - BUG_ON(!is_dyndbg_header_pair(dh, dh->site)); #ifdef SITE_CHK if (dp >= __start___dyndbg && dp < __stop___dyndbg) { @@ -178,7 +180,7 @@ static struct _ddebug_site *ddebug_site_get(struct _ddebug *dp) return dp->site; #else - return &dh->site[dp->_index]; + return (struct _ddebug_site *) &dh->site[dp->_index]; #endif } static inline void ddebug_site_put(struct _ddebug *dp) @@ -1070,16 +1072,14 @@ static int __ddebug_add_module(struct _ddebug *tab, struct _ddebug_site *sites, const char *modname) { struct ddebug_table *dt; + union _ddebug_header *dh = (union _ddebug_header *) &tab[0]; int i; v3pr_info("add-module: %s.%d sites\n", modname, numdbgs); - if (numdbgs && is_dyndbg_header_pair(tab, sites)) { - - v3pr_info(" header: %d %s.%s.%d\n", tab[0]._index, modname, - tab[0].site->function, tab[0].lineno); + if (numdbgs && is_dyndbg_header_pair(dh, sites)) { - SITE_CHK_(BUG_ON(tab[0].site != &sites[0])); + BUG_ON((void *) &dh->site[0] != (void *) &sites[0]); if (numdbgs <= 1) { v3pr_info(" skip header %s\n", modname); -- 2.31.1