Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp465961rdf; Fri, 3 Nov 2023 06:10:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF34tTloGllujvqTpU9wqKrr1pqkxPLJAaRCI1drWivbnF+FUkae2YmlQhguxRHRTZloHg7 X-Received: by 2002:a17:902:f687:b0:1cc:4a23:c5fc with SMTP id l7-20020a170902f68700b001cc4a23c5fcmr15895696plg.2.1699017032609; Fri, 03 Nov 2023 06:10:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699017032; cv=none; d=google.com; s=arc-20160816; b=zPBw/zyiO7O5GI9XwLXbXN4S+h3jmSkl2mZXn38hxEgUeUHF3STEX+vEQUQoRxFT2n G/W8WWkd4hFmQQSr7g70gRNjh0b/2/BQ5X26GeOaJApLedUWE0Ufa8nLcbknkYBhWH7J 7fE0YV5XFRJL2J+fb7VRh95+hiECF1wguv7I4tIeeFUiOWnSNwR/KnmT1XH/VduK2xJw ehyqSP243CaX8xdcbr0KTpN5d1xoDh8m1BdIjZbor3uBwzgtf/GFaCpZAsrW1SaPjve/ m9e27/gXlf5QXUWnRKrdN+sDPKJ3rXZnteEvf/f/ht5JmOfLzyTgPyP92jrgGT2LntzA JdLQ== 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=8zUmexXYrH/NJmdEkqNApaAeDNWEfVHwHcSuDaoz6R8=; fh=Xr9EZaLbYspLudo3lCz3I6iQD6BKril0MIzT5DobTXc=; b=swTPMmNBbX6u1aiQcjvPpEdugSr7EUYxrialHJyqovy3cGdNLUHKXl+7UpAcGI4xfL ZMOVP6LS+YvbedJ/iROorLgPvBEQ26fCt2o2lx2CEZ79+RWNDxFgBUYk9E6fIX6IBsaU ZEJpmfSwoNOVXGbvPAR/+tEKYCdl69lNRLFamlFf6RlccTjP4K4c13Kit6GixvMeAe6Q Ki2DW1p9NPtB01TkttSwOwTIwyZGmuqgBjycNVJ2PD8nLPpcrZSvZLbmSfboBSmSwmyG NDy91gjpbJRr800BIDyRghstHnw7wzIdCCghIuwHUTowaEDaHEGYwH/PywlrTZW/+7H3 +23w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@semihalf.com header.s=google header.b=BOgzkm6k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=semihalf.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id e11-20020a170902744b00b001b86ddfd49bsi1465479plt.6.2023.11.03.06.10.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 06:10:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@semihalf.com header.s=google header.b=BOgzkm6k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=semihalf.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4326680A9190; Fri, 3 Nov 2023 06:10:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376554AbjKCNK0 (ORCPT + 99 others); Fri, 3 Nov 2023 09:10:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233010AbjKCNKY (ORCPT ); Fri, 3 Nov 2023 09:10:24 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22AA2111 for ; Fri, 3 Nov 2023 06:10:18 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-507cd62472dso3363373e87.0 for ; Fri, 03 Nov 2023 06:10:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; t=1699017016; x=1699621816; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8zUmexXYrH/NJmdEkqNApaAeDNWEfVHwHcSuDaoz6R8=; b=BOgzkm6kpxr7ZZyV5UoocE7xui+iogZH/xS2gIhQGdYbZExRi2fW/sZJ1KQ7Lu8ZsB Wh9QrLW2AhLw912h+dBmrjfv9X32dViVJVfMKz6KmWo7AkkHunrP5/5ArCVcDNYwOTLR POZVo3fFZhw91csIyY41A74J71usQ7KjZUqfr6YfHJquKQ8lxmX+ZmW0qAjtSv8g1Xyb siwe5wAF1Ce3Ut8M5xk/fyGT9Up467RtNRQhz4qFj+rxMxvFGLUcERszuNzaJxh2zivS LFSJihXUEfBdxlY+m+4LCleb1/bDT3a5qluGi0rxV4ztqegXHrLarP0i+nKfIkoflO3f 9dcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699017016; x=1699621816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8zUmexXYrH/NJmdEkqNApaAeDNWEfVHwHcSuDaoz6R8=; b=JcPQJ5EfNdkq7xZZ8APh47eoiWqka0ZSgt8X8t8FQK34dcyN1lgmGE5dOSD3TdVCIW 2aReeQJBYiXxk1EvlCmaRpLlTzRLWzwBxcpnPn+XyYe2+64Lz18A6/7714EUqSGo9E3h bvEeETKl81cL6RnJnOBhZaaoaa46tUWCaJqWRdSMcJ4TWoGDG/5XztXDB6SB9GpyxO7x fY1ENMuMdHeBBJcWcaFrhEBQ7tqLRIfiEUwV0xCjlrApN4G5ENLSgtyvwUV13AoQacOV asVDH/pB68rqkPpR3ymCCcmphbvPp/INpnI9ladtf21gp+AV0n4gDMNP3Kc1k9CJ8k3G e97g== X-Gm-Message-State: AOJu0Yyj1ntNTWZqNgKijuNVTJr/luMI4x7cna2gyxVM8L7gC9OxO4h4 j5MnxHh4u/+hcghQY/lCAaJo X-Received: by 2002:ac2:4824:0:b0:504:3499:7c2b with SMTP id 4-20020ac24824000000b0050434997c2bmr973009lft.21.1699017016407; Fri, 03 Nov 2023 06:10:16 -0700 (PDT) Received: from ukaszb-l.wifi.semihalf.net ([83.142.187.85]) by smtp.gmail.com with ESMTPSA id f21-20020ac25335000000b00507a69a4799sm216336lfh.270.2023.11.03.06.10.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 06:10:16 -0700 (PDT) From: =?UTF-8?q?=C5=81ukasz=20Bartosik?= To: Jason Baron , Jim Cromie , Andrew Morton , Kees Cook , Douglas Anderson Cc: Guenter Roeck , Yaniv Tzoreff , Benson Leung , Steven Rostedt , Vincent Whitchurch , Pekka Paalanen , Sean Paul , Daniel Vetter , linux-kernel@vger.kernel.org, upstream@semihalf.com Subject: [PATCH v1 01/12] dyndbg: add _DPRINTK_FLAGS_ENABLED Date: Fri, 3 Nov 2023 14:10:00 +0100 Message-Id: <20231103131011.1316396-2-lb@semihalf.com> X-Mailer: git-send-email 2.38.3 In-Reply-To: <20231103131011.1316396-1-lb@semihalf.com> References: <20231103131011.1316396-1-lb@semihalf.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 03 Nov 2023 06:10:31 -0700 (PDT) From: Jim Cromie Distinguish the condition: _DPRINTK_FLAGS_ENABLED from the bit: _DPRINTK_FLAGS_PRINT, and re-define former in terms of latter, in preparation to add a 2nd bit: _DPRINTK_FLAGS_TRACE Update JUMP_LABEL code block to check _DPRINTK_FLAGS_ENABLED symbol. Also add a 'K' to get new symbol _DPRINTK_FLAGS_PRINTK, in order to break any stale uses. CC: vincent.whitchurch@axis.com Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 10 ++++++---- lib/dynamic_debug.c | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 4fcbf4d4fd0a..7be791af7cf1 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -32,7 +32,7 @@ struct _ddebug { * writes commands to /dynamic_debug/control */ #define _DPRINTK_FLAGS_NONE 0 -#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ +#define _DPRINTK_FLAGS_PRINTK (1 << 0) /* printk() a message using the format */ #define _DPRINTK_FLAGS_INCL_MODNAME (1<<1) #define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2) #define _DPRINTK_FLAGS_INCL_LINENO (1<<3) @@ -44,8 +44,10 @@ struct _ddebug { _DPRINTK_FLAGS_INCL_LINENO | _DPRINTK_FLAGS_INCL_TID |\ _DPRINTK_FLAGS_INCL_SOURCENAME) +#define _DPRINTK_FLAGS_ENABLED _DPRINTK_FLAGS_PRINTK + #if defined DEBUG -#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT +#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINTK #else #define _DPRINTK_FLAGS_DEFAULT 0 #endif @@ -199,10 +201,10 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, #ifdef DEBUG #define DYNAMIC_DEBUG_BRANCH(descriptor) \ - likely(descriptor.flags & _DPRINTK_FLAGS_PRINT) + likely(descriptor.flags & _DPRINTK_FLAGS_ENABLED) #else #define DYNAMIC_DEBUG_BRANCH(descriptor) \ - unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) + unlikely(descriptor.flags & _DPRINTK_FLAGS_ENABLED) #endif #endif /* CONFIG_JUMP_LABEL */ diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 6fba6423cc10..ee0cb37153ef 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -89,7 +89,7 @@ static inline const char *trim_prefix(const char *path) } static const struct { unsigned flag:8; char opt_char; } opt_array[] = { - { _DPRINTK_FLAGS_PRINT, 'p' }, + { _DPRINTK_FLAGS_PRINTK, 'p' }, { _DPRINTK_FLAGS_INCL_MODNAME, 'm' }, { _DPRINTK_FLAGS_INCL_FUNCNAME, 'f' }, { _DPRINTK_FLAGS_INCL_SOURCENAME, 's' }, @@ -247,10 +247,10 @@ static int ddebug_change(const struct ddebug_query *query, if (newflags == dp->flags) continue; #ifdef CONFIG_JUMP_LABEL - if (dp->flags & _DPRINTK_FLAGS_PRINT) { - if (!(newflags & _DPRINTK_FLAGS_PRINT)) + if (dp->flags & _DPRINTK_FLAGS_ENABLED) { + if (!(newflags & _DPRINTK_FLAGS_ENABLED)) static_branch_disable(&dp->key.dd_key_true); - } else if (newflags & _DPRINTK_FLAGS_PRINT) { + } else if (newflags & _DPRINTK_FLAGS_ENABLED) { static_branch_enable(&dp->key.dd_key_true); } #endif -- 2.42.0.869.gea05f2083d-goog