From nobody Fri Apr 4 11:43:54 2025 Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89B271C5F07 for ; Wed, 2 Apr 2025 17:42:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615733; cv=none; b=UNJmnKVBw3E19/N0q6hAwManWJetcRRU974XHeayC3IkSUtEV5LJ/eSUL8H3pLVYeESK9xpbehPDm1mxKc6EjCSLcA7E4sC3w7rlR+QM2Mlmh+lfbA62EURcHPqwXlanJhHivRlue10aUfyxOj8CzewAyYuyObQLjkL6oK4oqzg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615733; c=relaxed/simple; bh=4AJQ9/fTZnBfTNmr54vZ5hCXDEoIiB04E+EP8sWh27c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lEm6rZMgs1QlKSu3pQSwxbA7Tl9Gk9QfIzxYZoqcMtZ4ZKLeawgFoYZ/Qs5zYQ2ZZvFoPGGtnfGLA69pXc3419k1eNi0r0NksExym3KaqvEdu2g3TGitS4H0egJ1ri0gabrSHDK46nNTBq1PauhLm4zjLn89b9z3+EVFkHbhVew= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VmHcxBcr; arc=none smtp.client-ip=209.85.166.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VmHcxBcr" Received: by mail-io1-f44.google.com with SMTP id ca18e2360f4ac-854a68f5a9cso2501639f.0 for ; Wed, 02 Apr 2025 10:42:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615730; x=1744220530; 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=GcpeXIgBKTB5NFbofa9/asJwSsA0oVZhqq9QNH8OPg4=; b=VmHcxBcr2hZ01NnTR9xBZIntoO3yIRGKdmyRXhAMjUpxTOTlMC1Q0SaCYwE/ulz4aq IEsIbctePD1/UUxjqpFsEAZhvaJYyQYJiDg39V4/kVUnESvv1VSL202iYbt6xAKXQtlL KrgiluG7sRFGY2cABh6LKiZloecwiNtOSPRYc/D3sEwvjVB4arWhKSh7R6vBrRE8EqZU suegwG9z/Z9dJ7+VNGkeK3ie4p3pyq9931Ys7coBHbAKWPUcOwr6Pb3EgC7YOMZ3sWXN 5EYA8ncLUuLG3Utyc3Q3wb5bxTXlX53Nyedjqslt9EIH/lheF8F5q6MguSHSOCcZrDhp 6KZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615730; x=1744220530; 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=GcpeXIgBKTB5NFbofa9/asJwSsA0oVZhqq9QNH8OPg4=; b=E0KlpH8uqyZA0Y2SA2x8KGmDhJE2FQ7wNuhsaMDJjrJqZXIlyeeiVjvMbxxq3Ky18q CBRjLpf7/n+D4vrzMKBWaYE5eHDAa3/ckBXgBgxAi6JFhlwJAKIWETopXLovxbeMSZj5 /RGCwAGPP5Fl0FMICqdxNhqPPYGYwL13bcfMs0v0iZB1D8iHaMVx37nplG1MKZCcQXL6 MQxKa5psF3ASmTsgPpUSi5i0ryZLu1zYQT0cAWeX7x8xRtzYS8Ubh7JU9fudcJMTpPZ+ EmWlxeZlssiOvTuEVQSl95EfxOuifCkNyVxenQYEgxtMH+Tv9cE6n3WfRtkGvmgMAOls yrxQ== X-Forwarded-Encrypted: i=1; AJvYcCU3TnaqVrnsX3Rnd8lxTLEhzJyiKcwEYoiodzx7etu+vOkeJQB/qogwtZGjYBx5Nrl3LIjFThqYt+V5VAo=@vger.kernel.org X-Gm-Message-State: AOJu0Yzj32wiiko4bpq6dwbz6njoZepxYd6nyeAYBWZZLDPRsk6grQ0x Pn5bujBqRnmurwb3R4UvHe8kVI2ASSK1TytWL0szvjmokvLtODI7 X-Gm-Gg: ASbGncuTW6mszbYfowo2qrwuAOKOvd4AfSwhh2cx05ZPTawv382oDI4ajR+ICmhJnYx pdZ8wnvHlV1zwxSH+EwT/iLQmXK7g18vJTWjtRsxq5UNpakulVP+CNHocdog+qYY04bkE5oBnEC bOogKKvx9I33qexvkq+7y+br9CSbRlDAfjikt1XISWPCh0Dfg8m1gpCMTteOxbVBiMxobzrMlHR u70/xggTryCe58BFG1pe+Lh6o9S14pOcUtf34jjeH423Kt+dLP5sOvH42Zrl4bh4PJSHgTYuu6y Oz0+CasFd6g7gPXzpQpfXlgHC+AThzlkMnDq6H60AMRQLTgSgK2fAEbWYCP3Yywn96Y8ZZrleiD BFw== X-Google-Smtp-Source: AGHT+IG7YC+Vg8rHRD/pZ45k6AmgmMsM50hI2xsY+GPn38wgc2sLRnIWJcTpkNONdPZL6YQH7t5jCQ== X-Received: by 2002:a05:6e02:3006:b0:3d0:4c9c:965f with SMTP id e9e14a558f8ab-3d6d55761b0mr45283835ab.20.1743615730610; Wed, 02 Apr 2025 10:42:10 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:10 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 01/54] vmlinux.lds.h: fixup HEADERED_SECTION{,_BY} macros Date: Wed, 2 Apr 2025 11:41:03 -0600 Message-ID: <20250402174156.1246171-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" commit 1d926e259d8f ("vmlinux.lds.h: add HEADERED_SECTION_* macros") I flubbed the defn of the outer 2 macros; they missed the extra arg needed: _front/_hdr. Fix it now, before anyone notices. Signed-off-by: Jim Cromie --- include/asm-generic/vmlinux.lds.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinu= x.lds.h index 0d5b186abee8..c9c66089ea2f 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -219,10 +219,11 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPE= LLER_CLANG) KEEP(*(.gnu.linkonce.##_sec_)) \ BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_) =20 -#define HEADERED_SECTION_BY(_sec_, _label_) \ - HEADERED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop) +#define HEADERED_SECTION_BY(_sec_, _label_, _front) \ + HEADERED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop, _front) =20 -#define HEADERED_SECTION(_sec) HEADERED_SECTION_BY(_sec, _sec) +#define HEADERED_SECTION(_sec, _front) \ + HEADERED_SECTION_BY(_sec, _sec, _front) =20 #ifdef CONFIG_TRACE_BRANCH_PROFILING #define LIKELY_PROFILE() \ --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f169.google.com (mail-il1-f169.google.com [209.85.166.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC8151B21BD for ; Wed, 2 Apr 2025 17:42:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615738; cv=none; b=a1Nf5zSYE4eNfYDDb9m0cqk+L+fdxzt+nWDjopcS+kN9TawPIOYoasBv/X0inYYl20o/12CSNM+tuJzHCLS/1G2515UzD+SDOlb/0OL5Ze8X0jJjttYVuQdWWMxJUOplFQAFtLXvavyBue8buC4n63SvtgvO2VFDI9vwY8YC1RM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615738; c=relaxed/simple; bh=w+l1IxbKwn5+Odqn0uWbE42u8ngJlWpn+SjVKSxHY6M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qoJTLoySehjnKhQgDIgf9PbXYEn5DV1PE7tnpg8Ppxjw7V21HuU1RAr8P80Aw/xElg92pcsx5Ba03emAq4AuYuZ9YoT7eICm8nNJl24OYz06pfJ/KY7uq6TKaNHrhN8blMW6528ceG97yo8yvWJrS/gZwG5yEZY6hSDml0j0CsY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iSkVZBjz; arc=none smtp.client-ip=209.85.166.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iSkVZBjz" Received: by mail-il1-f169.google.com with SMTP id e9e14a558f8ab-3cf82bd380bso910485ab.0 for ; Wed, 02 Apr 2025 10:42:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615735; x=1744220535; 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=d8krvmT3hXiuiccuxDpOYGdDtTsrrIwxKLxWjX0uKEg=; b=iSkVZBjzb1QE2tuXv9Z+3zgKk5AAkxlVuzx+OZ5Wrxllh999UmJu7nK5RJe78ULCem lb5TU+R4o5dFefgP8w10gRwdOrw58wBmqIKtLdjTYopHsHSb6KnEoOFYqphE6MaNkyGd 4QL5GpO6tq4VKwqh68WX9A1It1mwALwcPLRnwnlec6O4fbXNcoUO/snWrE8wPHxvqXcA TM2k+g2T7etOIRtW08+ugXHyHspIVLgpvs0FWvHTNofwEBygsKrPP6s6g1dYakzC/qSh jcDCVNFEdlCZvlhW3+9kQJlGlpPIIIyQQzYqDVtb109WehEECpBkUf9l+VUaJjb2juXf Cu5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615735; x=1744220535; 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=d8krvmT3hXiuiccuxDpOYGdDtTsrrIwxKLxWjX0uKEg=; b=QFFjGq5UbrDG0AbZVmmJHzTdrpBvcH2o/1kpSczCMHj+TFxR9ZsDE1dGzrQZ49nhsJ K+pEdSFm/qIVmh/qaXCFo5eElzBXNnBGwgYgzyBD0YijgFYMs/FgNeF9NbCPIxYhbM7m nZ/wa62NubNx3zfFtcejNHhvCKkyHMjQK3ZUs5jpOW6yJQHfiu610Ml5mbeSmiuZeqge U7PBM++edJ2Pb5lcRnFNq08zOttjm9wRsGqHOeC+T3NinHH6VMyWBVtriwIXKAAdlDrJ 5zPVO9FnNx5soigroFP9PAk1RWMlKQcKzkcSKojKol4+jX5StSBpbC+xhlOQGnN6Qxus EIbw== X-Forwarded-Encrypted: i=1; AJvYcCX9erTYk4G4lDnAxQvmIoH0ZmBCk0QGb8Bh/Jp0Bf8eW++G3n2sw+3rIqQFtNFtbDuUm1IRkZJoy0ROIU0=@vger.kernel.org X-Gm-Message-State: AOJu0YyaPa807XxVFZVDOjEaDQ2ko5Op2BMmT5TFj+KTJVH0TEio/p4V tDwdW2uzxaFTI254r74vYrVFju25XQ9t3OipUPcoP6Asxhh/RuEH X-Gm-Gg: ASbGncsKGl+kq76OmvjhxoSdkr0uNGoP/kjUY7Rjxr87MhPS8MieTHSTgzFGIRgzqwG Vaf8CvLdNPPsevurPxJqqt4n9RLoWo2ksEvMAccKBmp/2invrvZ8dS08ag+JeJcOqZ6NPXba2yC 2YHzyLlc7pjlZSXBHPnuX/l5pAe6fZd6GpN/IaKnnIF9NiXpp1yckYkrefHHMLDM/DncdTi9z+C WgEm23w9IjTfL9hiEa1wLNuIfSe0TeStL9lnKRXtXyAe7YxS2TH37v8XLd/R65RLN9hq0CWW/rL sbWH4tHcHJIl3Pf/8V8LP7ulevM+uZIYPpUVAZyB2tN/x/aAS3J2eV7ZVxFKmKUOkYGW8N32QsG ON5vmvdylPASM X-Google-Smtp-Source: AGHT+IFfosceATDKvJJ46yRHWVuAnvPMdP3MQ3uyX0/XQ3xbrKDap7g3FuGUZOEfht1KRhM3yUM73Q== X-Received: by 2002:a05:6e02:1a09:b0:3d4:3c21:ba71 with SMTP id e9e14a558f8ab-3d6d5543888mr41235455ab.18.1743615734827; Wed, 02 Apr 2025 10:42:14 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:14 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 02/54] docs/dyndbg: update examples \012 to \n Date: Wed, 2 Apr 2025 11:41:04 -0600 Message-ID: <20250402174156.1246171-3-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" commit 47ea6f99d06e ("dyndbg: use ESCAPE_SPACE for cat control") changed the control-file to display format strings with "\n" rather than "\012". Update the docs to match the new reality. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet Tested-by: Louis Chauvet --- -v2 fix missed \012's --- .../admin-guide/dynamic-debug-howto.rst | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentat= ion/admin-guide/dynamic-debug-howto.rst index 7c036590cd07..4ac18c0a1d95 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -38,12 +38,12 @@ You can view the currently configured behaviour in the = *prdbg* catalog:: =20 :#> head -n7 /proc/dynamic_debug/control # filename:lineno [module]function flags format - init/main.c:1179 [main]initcall_blacklist =3D_ "blacklisting initcall %s= \012 - init/main.c:1218 [main]initcall_blacklisted =3D_ "initcall %s blackliste= d\012" - init/main.c:1424 [main]run_init_process =3D_ " with arguments:\012" - init/main.c:1426 [main]run_init_process =3D_ " %s\012" - init/main.c:1427 [main]run_init_process =3D_ " with environment:\012" - init/main.c:1429 [main]run_init_process =3D_ " %s\012" + init/main.c:1179 [main]initcall_blacklist =3D_ "blacklisting initcall %s= \n" + init/main.c:1218 [main]initcall_blacklisted =3D_ "initcall %s blackliste= d\n" + init/main.c:1424 [main]run_init_process =3D_ " with arguments:\n" + init/main.c:1426 [main]run_init_process =3D_ " %s\n" + init/main.c:1427 [main]run_init_process =3D_ " with environment:\n" + init/main.c:1429 [main]run_init_process =3D_ " %s\n" =20 The 3rd space-delimited column shows the current flags, preceded by a ``=3D`` for easy use with grep/cut. ``=3Dp`` shows enabled callsites. @@ -59,10 +59,10 @@ query/commands to the control file. Example:: =20 :#> ddcmd '-p; module main func run* +p' :#> grep =3Dp /proc/dynamic_debug/control - init/main.c:1424 [main]run_init_process =3Dp " with arguments:\012" - init/main.c:1426 [main]run_init_process =3Dp " %s\012" - init/main.c:1427 [main]run_init_process =3Dp " with environment:\012" - init/main.c:1429 [main]run_init_process =3Dp " %s\012" + init/main.c:1424 [main]run_init_process =3Dp " with arguments:\n" + init/main.c:1426 [main]run_init_process =3Dp " %s\n" + init/main.c:1427 [main]run_init_process =3Dp " with environment:\n" + init/main.c:1429 [main]run_init_process =3Dp " %s\n" =20 Error messages go to console/syslog:: =20 --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAC9E1A5BBF; Wed, 2 Apr 2025 17:42:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615738; cv=none; b=E+JWIvCnqWPoaXW5UsbBbbE5NSbjfpZkJk7Tuky2Ojfkdri1rjCEfOd8Gp6XEoNg2XTfbaPAQaMshwcYUbbS4kiyxBBZxAIY9yq87f/arNWmOTBfp1lkriUDD04CKtkz4H9eS4ISSFtQwsOSOx5yWElX7bsjUrdtC3RCTruLNFw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615738; c=relaxed/simple; bh=sk4ZuN0yqr+ELUK/hlV5OrzP5ge9kdc23DiSTcL49RE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qkvQvUmQRx3LymwsVNPsa1NBC8mKUCiJIfD2sPz+6c2q14dnOh8qEo2hVxYz+wwlr8CKoxzhd70V8rRs9Lyga9/Bi1gbp2pGSnelq7zsF3wRlbcBuGAJzelvgP/+8UW2+YIKrgt/FZGwUxHvGC6j99zFp1ny4RMvDme/GdgTc/0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JLTm4Qce; arc=none smtp.client-ip=209.85.166.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JLTm4Qce" Received: by mail-il1-f174.google.com with SMTP id e9e14a558f8ab-3d439dc0548so503175ab.3; Wed, 02 Apr 2025 10:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615736; x=1744220536; 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=td1hbocEroQ+eFWd3dryN89mziTxSjQWv4lhLkRyiDg=; b=JLTm4QceOpZt3uSkjSFNg9AKKm+cD7Yoranu+1QRWtmAgQyM3Xl/vRKsoeoEjmgmBI C3MUbtvOoThYKLl8YGX0cPV9lD/XfWT2+Xs6ngjiHvmIl/sNsaY1P8Mm3yBxTEetrrSt 5010A0jwyskn+zOwuK6nGQGqSV0yAe993+K0DPaFz56wo05hjNEbvqWm2VTmCZE+JNiD sqpS/V+kZSmmtIu9y//j/DyFgyrDHD6tNFDS9VQ2Q/XGc+zGwomFWqvsNhb0C82yFtP5 Bn8+uvsS1aImQA5i0vPP3UZQWY5nddYhTpRuWx2fjZCW+iyIzdk3jQBksRJLAyn6wF9c 4V9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615736; x=1744220536; 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=td1hbocEroQ+eFWd3dryN89mziTxSjQWv4lhLkRyiDg=; b=J5TZgkoz4TtyzUre+Bh/V/TzHgFzdh9On5TqBpNb5MBbWP+K+uonZJOKN/n0OQvCT1 35qz3KgXorsopX28qfTaJl+6/Cgk+DkDlM48mQJFD1VAWG5HAcEcxX4SOegFZlbIL1Zo 4Zkp9+w+meBFRRqVAYBBQ3h5cChNl/tb8i0NlgFmqLiKYRgOm/TEEaQTxgZld8nk4EZ5 AB2JoITBOshzWxWOPcNReeV+8dJ/MWoWNniCcebal3Rjkphe7rMT8aPpd8s/6Uq7zY/l zZBhFEgZGByrFOqlTcBrd4GhHrbk6IKTqYntGvdzjs4vCBA+TYb+Jj/0eJC81fg4Kvif ObVw== X-Forwarded-Encrypted: i=1; AJvYcCUM+vKfvaRTXcKNDLgCJvpls7Me2I82PCN2wqacRqG8XPyl6YZbSeYPJOe7+urvx72Q8jp1Loi64mt+iFBb@vger.kernel.org, AJvYcCW8VEt0evZ5ZQypLy9mKRPqi5xaP36NBQwkiCZaQXE6eizdL1RsN+QBt8ZU8k4KOdPH9rO4sEEzmwg=@vger.kernel.org X-Gm-Message-State: AOJu0YxfLpMgOPJRsP8MrD4yL19hNKqFvC7OYddjxzi6aU/+7kU+xVqA Enmno2FkQBosZX3SqHjydT876Oz6SQjnnvexKMCSkLoB8hlxzJyD X-Gm-Gg: ASbGnculxGZc5hp1FJtRVqWYWE6xkYlTd3P6kJfiZsHYKnKeCWDu06cOxPnBX/wzHeK HQ9ly+NklN3Z/483P9qRKWeLcjO6orUS+21qMDG9mjPs2Kwi847PbijCRrqBBeJYarVX1FSQ4pt 1bV4MaJadG8BaVeM4mYvIOzQEnRQdqJQLkmB85WJkO4PpRbDdqRVY0tU/9locsrHNw62h2Xapks H8xDv+hTz8d8FnlGMe2qe6pzwzIEyc/NG9snqmGvDUKc1ul8QSGQ6/arSLRiLsYYyEIqPJS+/wl YOAZeFPAqjPQtooNj0xMva67xDCNXzch8+1nMmyfCAlyU17cixVcsFFd9sg/gSoxDx83XV74RmG Ualsugk7hMHJL X-Google-Smtp-Source: AGHT+IFoghihjH4MYpOsA0qp+LY0KBRJDcJg5fZDrmZZoUA3dpTLzhFFCuTnSVLmEdCyPs5O9yahhg== X-Received: by 2002:a05:6e02:378c:b0:3d4:276:9a1b with SMTP id e9e14a558f8ab-3d5e09cda1bmr184969825ab.16.1743615735764; Wed, 02 Apr 2025 10:42:15 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:15 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie , linux-doc@vger.kernel.org Subject: [PATCH v3 03/54] docs/dyndbg: explain flags parse 1st Date: Wed, 2 Apr 2025 11:41:05 -0600 Message-ID: <20250402174156.1246171-4-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When writing queries to >control, flags are parsed 1st, since they are the only required field, and they require specific compositions. So if the flags draw an error (on those specifics), then keyword errors aren't reported. This can be mildly confusing/annoying, so explain it instead. cc: linux-doc@vger.kernel.org Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- Documentation/admin-guide/dynamic-debug-howto.rst | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentat= ion/admin-guide/dynamic-debug-howto.rst index 4ac18c0a1d95..63a511f2337b 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -109,9 +109,18 @@ The match-spec's select *prdbgs* from the catalog, upo= n which to apply the flags-spec, all constraints are ANDed together. An absent keyword is the same as keyword "*". =20 - -A match specification is a keyword, which selects the attribute of -the callsite to be compared, and a value to compare against. Possible +Note: because the match-spec can be empty, the flags are checked 1st, +then the pairs of keyword values. Flag errs will hide keyword errs: + + bash-5.2# ddcmd mod bar +foo + dyndbg: read 13 bytes from userspace + dyndbg: query 0: "mod bar +foo" mod:* + dyndbg: unknown flag 'o' + dyndbg: flags parse failed + dyndbg: processed 1 queries, with 0 matches, 1 errs + +So a match-spec is a keyword, which selects the attribute of the +callsite to be compared, and a value to compare against. Possible keywords are::: =20 match-spec ::=3D 'func' string | --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B996A1BD9F0 for ; Wed, 2 Apr 2025 17:42:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615739; cv=none; b=sQwJDl9hCtISz3X/Zac2OpHdwF3JjiYqqKAkdUMh6G/BBO93NwRn/K8ChnaH9b0XKL7bdCXfckVT6wrj+76aIKcg9XfRhcbO4gtYlphWJf4epQlUWaWVM064wTw1C3h10qoIJyV/ILPx+sbfGITWd/MZsBLJa35Uc/rYRshuvoc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615739; c=relaxed/simple; bh=zHwD8qJIhMBYJsra/FIeWdTmZLdVjzCQ82XUZP2dzho=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mLtbdZV4daCtFam2r8uCvv9sfVzwLb3wovpz2tYXR+5VKZ27nT/n0+/aE4IcPBEJdqheClmiu7v7nQFjVaRdbiQHafGBw4P69IyWYZhbtXM5XTohsophtOQqShPI6XQDPt/+Sbrcp8Kl0CBe2DAGNwskBWWMO1+Zlk4LF2xxykY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=H069XsLy; arc=none smtp.client-ip=209.85.166.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H069XsLy" Received: by mail-io1-f50.google.com with SMTP id ca18e2360f4ac-85db3475637so36356339f.1 for ; Wed, 02 Apr 2025 10:42:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615737; x=1744220537; 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=H1TeeGBRsVeJpwNeUJAZV2+uEOIfDic0oDGxOSg3WSs=; b=H069XsLyEf4BinbpRa8m9JUv901Q3LzhGkJEFPaVeyzU4I1u93TeELIpKMgOlALcfc 4SGbOMEAf2XPnOj814yQOyWu089Bw/+zLGlqOz6wItjr3QZtCZI5s5Mxj0gQjJ6e0p5z Jdq0schn+USpbRk6HLiyDBhKbE/Rd7yLOeyus3OkhY3o4UgfgnkLqq/lTHtYUsmaMts/ i7UeBYKpDbQpO0AVQnDU6o6hmxyFTcpf6O/6pEX59BTaMI1eZHEm+5qQfB25ICXQb10d WFva5H+bHqXlxUdePR3YumC+v2jLVy64ZAaeub33xoAruQHqE2BS4RKb7IFgMS8cRYG5 nrDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615737; x=1744220537; 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=H1TeeGBRsVeJpwNeUJAZV2+uEOIfDic0oDGxOSg3WSs=; b=MRFn14dw7/97tMyeD9OsEFxf2gf84FDegfklXYCtd9ILlb9gtg2reNzXyv7zOlxCbF Dgc9ONjJaQ67LqL9IpdhzzdjlSv9BCQdima2eyIKF3earb5Otjh83VT6J3q0d9/avypX nIQs7dliw0iIF3Mcank3MudfKWZYH2dvqMVA5uM3RSXMpNh92IayJlkFyURgJZibcBKK 7jqPf4AfqeuYvgty4yRZ4G97L1yc+FWhUw2rqL2poN/Gh+Z5zrI3+D1WZtvH8W4Dkfwv cy+gSowv3mPDTHHTLS4eRYPCygdAw+P9kXd49euK1Pm6S9gO8emvbDNqvZV3SbmIfUgv ENwQ== X-Forwarded-Encrypted: i=1; AJvYcCXSSKtdz9N5Bujlim2irBROTAoYOUu9iVTTCdOohF1Za6xAMvfvhoe6fYalrYNXiUC6fFDE4ab6r0KnVrs=@vger.kernel.org X-Gm-Message-State: AOJu0YwSDWsb5MzmHzzj0UoHCVNzEqV/d/QdEBUtBPFpZKfKNPBw2mnK JmaerhFpJbjGOpPOW2favHYPGu8kBY1tHebINg0KDeNgWVXYjiFv X-Gm-Gg: ASbGncu7oZj+xCP/ZgaMpQx7fWOSAxqIOj5+PJG/QN6Jw7gz0BKg597imv4Ea2gt0Dw 3ZlWREOBQDNiRmH6PZLGFDxVcUQQhgeB4uxuEo0fjLNlMl/lp/NSnVt40RLRTUgZyVs4LCH0s6B en+Qhhw3hasX7qymhIh7TpIbzIxUoZE8oNCzvusV+HzjigL/tJfVhm2tiVv7Ae9VdgoiZMGE+z9 85/uo9a7L5RZXoi3PIKdZWYV+1jFG+aPa1p9oPsh3m65rAFNjNgjizMmQqukfwdcK3qn3eDhdHo Oaqv1CiaALjo2i97zpQBz0OhKaXf2GV30P/b/ynPXl/YDLusLNg524WFUfiWV1CwqWhu35jWTB9 voA== X-Google-Smtp-Source: AGHT+IHivBONAricuMwjJKELjLZ3cw6bOgdRVYxu5GWLbo1Ajc6qDwx3gLg2XMoo3ny+fW96GOp9Jg== X-Received: by 2002:a05:6e02:1d9d:b0:3d4:2acc:81fa with SMTP id e9e14a558f8ab-3d6dcb49685mr7330155ab.2.1743615736716; Wed, 02 Apr 2025 10:42:16 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:16 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 04/54] test-dyndbg: fixup CLASSMAP usage error Date: Wed, 2 Apr 2025 11:41:06 -0600 Message-ID: <20250402174156.1246171-5-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" commit 6ea3bf466ac6 ("dyndbg: test DECLARE_DYNDBG_CLASSMAP, sysfs nodes") A closer look at test_dynamic_debug.ko logging output reveals a macro usage error: lib/test_dynamic_debug.c:105 [test_dynamic_debug]do_cats =3Dp "LOW msg\n" c= lass:MID lib/test_dynamic_debug.c:106 [test_dynamic_debug]do_cats =3Dp "MID msg\n" c= lass:HI lib/test_dynamic_debug.c:107 [test_dynamic_debug]do_cats =3D_ "HI msg\n" cl= ass unknown, _id:13 107 says: HI is unknown, and 105,106 have a LOW/MID and MID/HI skew. DECLARE_DYNDBG_CLASSMAP() _base arg must equal the enum's 1st value, in this case it was _base + 1. This leaves HI class un-selectable. NB: the macro could better validate its arguments. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet Tested-by: Louis Chauvet --- lib/test_dynamic_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 77c2a669b6af..396144cf351b 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -75,7 +75,7 @@ DD_SYS_WRAP(disjoint_bits, p); DD_SYS_WRAP(disjoint_bits, T); =20 /* symbolic input, independent bits */ -enum cat_disjoint_names { LOW =3D 11, MID, HI }; +enum cat_disjoint_names { LOW =3D 10, MID, HI }; DECLARE_DYNDBG_CLASSMAP(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, = 10, "LOW", "MID", "HI"); DD_SYS_WRAP(disjoint_names, p); --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f169.google.com (mail-il1-f169.google.com [209.85.166.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15D991DB15F for ; Wed, 2 Apr 2025 17:42:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615740; cv=none; b=IU0D5uxC8Prsj8e8RcqxikPT+RgQ+R2/rueZwG9iMclsiy0yKnqigSR/ha29/NXnCRvhKC7QHsqlcbPalpEdBSNMNFXITyf7M8GUCMbLpL61jJWXaIiiiuUzE5yn8mxmTzqoAvf1xl9icaltCxlffZS2pQfR7QwXNp63Zyeeeaw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615740; c=relaxed/simple; bh=WoRYA2tpLgnZuGnp9hThjLb61379Aly6hCsea4BFktM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V5/0rA0msPHL/s51AMTQnzE58Vz6g2Zo35ew68GKhahrlCTy4+PbnkbnK7saZZoS2NXo4ecmy1tHpodxoQVhtCTZ97oWKwb+UnSFrVSv1qSeVf3NSVcnJqYDDmE33JELGPMYnGT25OKFNarYR1BPVIa+bWeyvIQLiMubic+Rzxw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d+a5rcEe; arc=none smtp.client-ip=209.85.166.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d+a5rcEe" Received: by mail-il1-f169.google.com with SMTP id e9e14a558f8ab-3d5e43e4725so474645ab.1 for ; Wed, 02 Apr 2025 10:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615738; x=1744220538; 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=MlpyI1Cbu0G4E1iYQnKaYcyXlhpWchDiOL6/URF3toQ=; b=d+a5rcEeahd3l0OK+gwzfi6yW3yYGjNwoNTwwDoCZmSu4fHj6umJjPpe9xQeGagiiO d6uwEtTxF3ISB2/VjoSAghtQWheuc81ZrGhtmZz6WvedHLP6jyMDmq0lLX3tOlXA5eJT 8KqfI0Ukpci6vjU8iiINoaafHtL3GtN+uMCqEa+dfXfc2D0aMM/Nrocj42u5q0Xm52FF rfS/QdMci6ZKEJnKduOr1Jt3Zabi6X8I/Cv9ZnjVBmeB9IErouqchuehA4zrz8QopcIe WWd/X/uyb3POnDhgiADzySYS945STiS9mSuI7MqhG8avndMFdWyzMR55MZZlt8h9eBbB 6CBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615738; x=1744220538; 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=MlpyI1Cbu0G4E1iYQnKaYcyXlhpWchDiOL6/URF3toQ=; b=MaDW8yt6XF/oWp6otFVEXIGp7iNjhKroxWqRCiAeXWYh82misRmF+wQ12ETZeNVZC6 XFrS2RfMCGBK/XEQEQeTGxkCqoIf5RAamGXhPAPsYLYCo7WCHc8+jMtOPgLdmYGvOG31 pBnrfqnNuxUPITW2mQ+PMH+/gZXbZWfoCGUq9HKf3EvzjhZmyMCk6TZR2vWtntsXJClA 8SDK6VdLVXoEAeWCPEdOSMRaqHLZz/BLbvSB9Q6bbARvQcoZm3YolUf1jCVlcgb83DnZ YMLnFuOE/IZZ5w14rpTJXdK1ZeoBzKkNaKA2pd020HnP7+NwXAbGT5l09mTDrIA1u7I2 cNxQ== X-Forwarded-Encrypted: i=1; AJvYcCWKRle+ajLZ+xoraYTIj1Ja5UnmhUEgD1o/Vczp9nKpsR94X6ak04wr19pTdE4g0BOvTge3pN4k2PVqEkM=@vger.kernel.org X-Gm-Message-State: AOJu0Yz48NUVv/JzQMGvLMYJzx1SbG9gZ0v8lMQuNkeCaSldA2S6ixW/ kRzIPah2v8GmlgS3YBAlhXz8bNoBhuKUc/hJ+NxMVmD9HgZchR8/ X-Gm-Gg: ASbGncsqbY1UQA/WwjiUEIwhOotxfqTjxKfdTDbIZhSz3UXiu4g2dACGaFBbrHs+C1G fzECWmrSkASC3MPz04yLKM43YAcOBzxU81klCbzM8shOB3wROU6s+17oVnVr65/og99wvolaykn IfhMMRdli5G5iVL6Y2AgLIjqCiQ7GWLYFSsFjnWiP0qpA8158fiyoDbRdR1GQ2yu9Z3GCGOCdYD b8lE6E4rK+hCsX99tkAiLoTM5IlWocp0K4TVR+RuXv2b3EfnahmWPS7no2YVdZXjDLyVDrdhsi5 YukeaqPIPG5fDbxUtmrqyoRtaiEeLkoP6uV81GmFG0lRj+b5b+NkTaEjqe+UIhVfzNReiGxGPBp ZWGh+7+aQkySG X-Google-Smtp-Source: AGHT+IHHjhRDu+SE+n8jz0Z3ClAuEczfqEXMN4CVftbZdgfRPuFKsZB0dnMkVBgAMrRiDsGR5bLubQ== X-Received: by 2002:a05:6e02:2703:b0:3d5:d743:8089 with SMTP id e9e14a558f8ab-3d6d548b160mr32428905ab.7.1743615738025; Wed, 02 Apr 2025 10:42:18 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:17 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 05/54] dyndbg: reword "class unknown," to "class:_UNKNOWN_" Date: Wed, 2 Apr 2025 11:41:07 -0600 Message-ID: <20250402174156.1246171-6-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When a dyndbg classname is unknown to a kernel module (as before previous patch), the callsite is un-addressable via >control queries. The control-file displays this condition as "class unknown," currently. That spelling is sub-optimal/too-generic, so change it to "class:_UNKNOWN_" to loudly announce the erroneous situation, and to make it uniquely greppable. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- lib/dynamic_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 5a007952f7f2..147540c57154 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1154,7 +1154,7 @@ static int ddebug_proc_show(struct seq_file *m, void = *p) if (class) seq_printf(m, " class:%s", class); else - seq_printf(m, " class unknown, _id:%d", dp->class_id); + seq_printf(m, " class:_UNKNOWN_ _id:%d", dp->class_id); } seq_putc(m, '\n'); =20 --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f171.google.com (mail-il1-f171.google.com [209.85.166.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B1D51DE2DB for ; Wed, 2 Apr 2025 17:42:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615741; cv=none; b=CRzK4zpy+q/9AQbGQjU1ZsS/Er3rvGzxuXjuuHbpbyyq/lMiCnMrdP/9hx4RZjpuG27Z726IR1uaq4o0i3mp7SZ+Qsz4KLDJZgspuelMVBiWZKWQO4HmaudcLRZs1X2w4lDc7aZgzbVJQCdMhPv9wM7/ksKl3fA5OcyfOi0h5oQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615741; c=relaxed/simple; bh=owZYpNR2pwuDCcONhl7AIBARkXlaRrZAKNrUgbc8WNU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=stPXhLYQvnNSqIP0M3DdIqXPhGQBHfjB5PfT+fpW4KCNLnZW5ZWpQo7McrxyM30poQHd2LxiDaIw4vzmSXyyiS11QYvmLMTmKA8PK0gE7O+SbK3I3NbB5+YxvphwPWiWtJzIqMpBJ1kydsWam5m/Z0lTKc1kLEU7Krm74LiNPbE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EvGt603w; arc=none smtp.client-ip=209.85.166.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EvGt603w" Received: by mail-il1-f171.google.com with SMTP id e9e14a558f8ab-3d5e43e4725so474695ab.1 for ; Wed, 02 Apr 2025 10:42:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615739; x=1744220539; 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=F1MDFYF/EJ2a7UGqvWTU6dzs01F9Q8UeZTgbtP6X+58=; b=EvGt603wwSw3iDJ54DeckZkTN6fEB/P/J2k6UtILVW9p2O59g+ywnF7eYg4ks7VeKC lROHscyqFg0e3XY9BXePVroCjsjT51fw9EMd2Myp5b7dc4n2DvHXehkcxMcazCJEv2Z5 ri/fndm5GM1Jpd3dySHvc1HVBlkOkeXHeDAeXJ2BsTDBBsY3PXuuIA6vBR6MEAVEt+Hw g0r9ZXAm1i8GeQ1KMm4MhDu1uF7i70zEaxWiezLtkjMw2els9MGcryWYSKPbqlLk9QwV 0tbKC5nMEr7MgyiLeRt69pOHO0JCgWBFCkkiY+V8CuRVmEvuS1Kyt6miEpBauKc/Khqw 0Aeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615739; x=1744220539; 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=F1MDFYF/EJ2a7UGqvWTU6dzs01F9Q8UeZTgbtP6X+58=; b=jLpz4iQwluKd8m9qx111RxDAirc2xMbOlVOfjGn5Ig8kXLSjeJJE1gCPHfAM01EwRm 9fUcUFQVXZuEKRQPl4RjnIgFvQ8DJM9lzOtu1tUGhnhVsV24DC9Xq721FEWyxageCxKY emADRjPXPchtcDTSpVqCD7Ref9KLo5Qds7tHu6pTpDKdWCZNYuoWc73dImzZxLnpqOnS 7p4Kb7lJQ1UD/vtc5LrocFBh0rH2U//qC1rPEhWMxMbb/d9E5pbAtK0GcBFCzTBgXS/A tnDfsWo1Lr/292J2Jy6SOcKlaDgAhL2dR2dbWH2DeiZumZ9AKi3w82GvjCCPAIzQIdeU 4w1w== X-Forwarded-Encrypted: i=1; AJvYcCUSomvDdV0DhRsC/G4qZ4Zll5MCgekCtMva5y3GutH/w/Ab9IkCB0pMyvF5Qb+rkpmrLafqHuDmPHXZiw4=@vger.kernel.org X-Gm-Message-State: AOJu0YyLFB3XDTj1L3T/+kcFHFMsnWmsc4/IPXTHzD4I3Qfl0igCyXSX gQHlAOvA3cEGQod9+EeXR5t2o695pslSgFt86nmK4PpVwiBlWLKvPuObDhBg X-Gm-Gg: ASbGncvS9rEr4Gd/z778llsYXvTm0yVQU0EunHHOtWFpJ1P1Ks2IOgdMmAL+yOfmmrF +SQajv5ihQ5fK1UFClnd0AstLWabE8lg8DdmEtugP3w+rzDQL5Sez76lg9DchrqKBbrOxfec99N Y7e57mZJ4Jl6GpYkp+goJr08ezVkIZtX9ql4VxTGBm3ulsZie6T87uy4mtu5jjwd8bUWt7IbP78 zudZPVgxLXgtdBJXbSBuSHu0SjtVgVKC3sypw6f6efxOSJcCfC2cMdpRd3In8E/f+paVEeJEbgE rW2O/5WGyCkVg7Wud0+L+J+IT6l6xeXlTPa6UxnPPlhgdjpgcLTtx3gn8Lphwun54u24rRC77z9 9aw== X-Google-Smtp-Source: AGHT+IFVWQtukqjbox+/BI8jH/gu5QsbtgxbaxR6JpDzTl89/ZDWJ5DbXCocb+GVCPq2mu6sIVRlLQ== X-Received: by 2002:a05:6e02:1c26:b0:3d4:414c:6073 with SMTP id e9e14a558f8ab-3d6d548b68cmr40322985ab.8.1743615739132; Wed, 02 Apr 2025 10:42:19 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:18 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 06/54] dyndbg: make ddebug_class_param union members same size Date: Wed, 2 Apr 2025 11:41:08 -0600 Message-ID: <20250402174156.1246171-7-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" struct ddebug_class_param keeps a ref to the state-storage of the param; make both class-types use the same unsigned long storage type. ISTM this is simpler and safer; it avoids an irrelevant difference, and if 2 users somehow get class-type mixed up (or refer to the wrong union member), at least they will both see the same value. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- include/linux/dynamic_debug.h | 2 +- lib/dynamic_debug.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index ff44ec346162..b9afc7731b7c 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -124,7 +124,7 @@ struct _ddebug_info { struct ddebug_class_param { union { unsigned long *bits; - unsigned int *lvl; + unsigned long *lvl; }; char flags[8]; const struct ddebug_class_map *map; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 147540c57154..55df35df093b 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -799,7 +799,7 @@ int param_get_dyndbg_classes(char *buffer, const struct= kernel_param *kp) =20 case DD_CLASS_TYPE_LEVEL_NAMES: case DD_CLASS_TYPE_LEVEL_NUM: - return scnprintf(buffer, PAGE_SIZE, "%d\n", *dcp->lvl); + return scnprintf(buffer, PAGE_SIZE, "%ld\n", *dcp->lvl); default: return -1; } --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f171.google.com (mail-il1-f171.google.com [209.85.166.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFE001E5B78 for ; Wed, 2 Apr 2025 17:42:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615743; cv=none; b=Zp5SL2HsAUXRFWqESrgv9jZyWhMJeHr03CSrLJlAZYBkIYicjWbBzDuX6qGtJezCC1mv2FGL86V7ibQf8DvFHls1HYQnGCfTuQxbF0yq7Ar3YCPhhtWQALKLAvrj1VYTDhsPjfse0ekIOMvZjcCQ6ateJvOCu1PMmnQjS1Wgn34= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615743; c=relaxed/simple; bh=gFCzRxNPecs9k7iS1AinJ3zcerrYQfViU7GYvlDAdnk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TJQMHlTARi+hrXMmttMctEMVsWeY5TIfMm+Jaa/0Ysi2ZRQteo8I5DIGLXDD6Ui7qy7DxLzWC+okk2KJhJIrorZm0I5P41shv/A3NbAN0kfylIV4MerOeaFDgKNkEDaoOvnZutYmvwQ43a6G/gh0aTVpgRUA1d9cehIsTjahwu0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WeXVUAf7; arc=none smtp.client-ip=209.85.166.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WeXVUAf7" Received: by mail-il1-f171.google.com with SMTP id e9e14a558f8ab-3d58908c43fso505145ab.0 for ; Wed, 02 Apr 2025 10:42:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615741; x=1744220541; 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=+AN9v4KQ0PiEc7jM3vE8QrHxAiVUi2zmd1sx7ARoRMg=; b=WeXVUAf7/3VBCkKZyxX5V88OVVUpjfpHdHpQKMwm0FuO78NW19YQf/kT0Yr8GxzwSw np/kEwuYybdb34Z79+IRfI1nKuvzTO910QkPrSzU6WMFk18X6eHpXQ5ABAOkTtTfzqzz ck1D5kb+54o8uXE3ciiph/Vt2W5/AmO9GAEMSj3IOWL/Ja8XqTexbhx9PTlRWoQi0VKn z74dAqEm3xpFLZDNU5F19Y2HOLHcDPQymWYbLxCeZTJ9D+gHZ8pLP31ZaJxyldQ+KMxZ nox3eRKf1QuWqoN/4C7kVq+u4UmM45MLYaIZ0wTsden0LHpCsjaFudTjmBpj0DK1L8eN Ywgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615741; x=1744220541; 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=+AN9v4KQ0PiEc7jM3vE8QrHxAiVUi2zmd1sx7ARoRMg=; b=kUTzM06plhnOmXsBTCg+MVcRuOP9LULoRrzNQ8Sx0JmGElFXpTfaztzKhGeD0KS0g7 FOlsFEGviGjR4SIVQdyLRhcDABaY8sZOzzoSWfbRCAgTyj0fB88oW+CUuxYcLqXCe8fo qFEBw7zHSlYXTAU1GBOgz1aZEDqw0ZRVnUMz7Btbp+4yex4rESkFf1C9QQ8vmVhL0khS CMY8gRYXd/KhAjlGmURx0WHkNaoAL4Zcmu/3CUoU9U0ArmKA4ZzMdO762SpzXvY5ogih J1ppqKUG2yEpTs6mMw7a6OoClPrauD4p6iBmN8u3OFjhpukoIOCvt8NjZQadyKa4ITZI ofgg== X-Forwarded-Encrypted: i=1; AJvYcCUo7wiUy/j1kLzmWuCl19zS/ARJ5JCPAvt4bvF25J9dR4MKbh/1LcVC58kr7hdV9XufKhWsTp5VJZnUGrA=@vger.kernel.org X-Gm-Message-State: AOJu0Yw7Fg2stN4pf1x0JHuQ4cyjrfTw8JbGfDWOcd8hFlgv3uIrPY2H n2ohTr3dzdw92/auZy4kurM0TgXIjFZw7XVnWRVFufnVy57LwpTV X-Gm-Gg: ASbGncuJf3qvBy8CLFS4p2N5L7WNEwj1iFdQp6J8BAUe1NVxrTiWe7pqD7AHh5kQUEW yi3Tttaab5lE4utY9WOc3C+3njVqoTLMXpXNdJ+ggDVmm72pWDjuM196caJwP4VU43JmzvU63S9 bSIjf7d/cis3Hhqx3bDouKCnx6piCwsruHbhfVNFueluDHmJneaXa3MTPySE25nEmUfyA8B35j1 25lk4FokfrUVvPO7bWdEIYytJVcFet+X9jOhp/AacxPfzgnUPj02eb6cgaXl1gNKGv6j59qppma /qbrsnOlc5Wkp8g87werUBh0p/R0anASlR6bvH3MZYlx7c6Pbkd0xJYeRnIyU9T2TesSZ5tud/t gBw== X-Google-Smtp-Source: AGHT+IH4Y0UWSmgU+NCi7WHRrVlXFXoekgCq0dMBYgztyw3Hpw5BNtpfhLC0O0dU/4LF+BFX2wTffA== X-Received: by 2002:a05:6e02:152d:b0:3d3:f64a:38b9 with SMTP id e9e14a558f8ab-3d5e09e4828mr192342365ab.15.1743615740615; Wed, 02 Apr 2025 10:42:20 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:19 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 07/54] dyndbg: drop NUM_TYPE_ARRAY Date: Wed, 2 Apr 2025 11:41:09 -0600 Message-ID: <20250402174156.1246171-8-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ARRAY_SIZE works here, since array decl is complete. no functional change Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- include/linux/dynamic_debug.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index b9afc7731b7c..ac199293d203 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -107,11 +107,9 @@ struct ddebug_class_map { .mod_name =3D KBUILD_MODNAME, \ .base =3D _base, \ .map_type =3D _maptype, \ - .length =3D NUM_TYPE_ARGS(char*, __VA_ARGS__), \ + .length =3D ARRAY_SIZE(_var##_classnames), \ .class_names =3D _var##_classnames, \ } -#define NUM_TYPE_ARGS(eltype, ...) \ - (sizeof((eltype[]){__VA_ARGS__}) / sizeof(eltype)) =20 /* encapsulate linker provided built-in (or module) dyndbg data */ struct _ddebug_info { --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f182.google.com (mail-il1-f182.google.com [209.85.166.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E9BB1E9B28 for ; Wed, 2 Apr 2025 17:42:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615744; cv=none; b=N5EOXtR6HcDYNJMeNODXBOHEQHRZyhZpeaCN7rtMawiB5GXfXveWG3gNbgsPenGL5v8mWro4d5bWG5MawJINYDid6FRAB3ZmFQWrzETg+QyplpcRexuztXzdZqWT0wxEp7w1Pd4NU7+SxtG4pPKyOS2bzHMdQRNx4J1M/mFKb+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615744; c=relaxed/simple; bh=zTzu1lwT/yPrwrMLE6P5y0xJGhOKXxeyMkk94mm8q0o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WydyOo7VRBwb/j7MBP0xE5l9BrLt/r/B483AnWML27wGxFFAecVezobhK7mskOSz+1eD/ukNqo0Tsy/eyXd5zWe9ky+Sws/qrgBNNkYeQd5HLdCv/dP4YN4vhLFbWPRgfg+qODFtvnaxQGAvy+B4TR6KEO7SpB6u0FYKzY5QQ6g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=E/OYQ03p; arc=none smtp.client-ip=209.85.166.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E/OYQ03p" Received: by mail-il1-f182.google.com with SMTP id e9e14a558f8ab-3d442a77a03so428115ab.1 for ; Wed, 02 Apr 2025 10:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615741; x=1744220541; 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=0gFevukveSt7PbWkbUevQGA0uvSXu+LT7vaKBaZctmY=; b=E/OYQ03pVDbebdL0NcKdz8VLxw1a6CfER/8kYpc2UwXFC53UPqp8HYtF+vfdCBG5sY /moDQTYS6M39gaWe6+B5eOCpdqidLP4+iOgas3pR/JEixbOWcmVzuQuPZ2SwalhAqFsD XQZYeldKvQ8I6LSKSpS1/amlFX9aoOJKr/ScQIxZ2PZWdjr+cF/kvYos1Jb7YHvaG25C BKsEQrROva5PRYf1MoPnemHfZhReye4NEVUp5YrALwPMH4DjsdWXxVqbWTypTuQcEf32 70M3vnnfq9NMX+QVTNE/oCfS/Zd6sFza4kXfFSBdQh5krr9l9aCwAX8BE8t0bAe6DlgL VGVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615741; x=1744220541; 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=0gFevukveSt7PbWkbUevQGA0uvSXu+LT7vaKBaZctmY=; b=kza09svRYGoKg/ubKq9j3HNcF1wZU0ggpwYZZezlr22hU//x9lqMg/r/h6zNpLKawv 43aLPcVAjOV7dZ5oagJDBmCrhLS/GLKEjqkFl+o3XxiE5WIAn32jbuDPIj6Bp5gbHDXC uXNRrvOTAalSWehHWsQpDaF5ycQ0VviBAIqi97g5oZriOTqbCorrpC8az2h+AvfwrBm/ JMg5zU37n0Sw4xSek+P05Vhy2B62nnY/xkrUNJmzGxgsZmOA2acssOSDxBnaVKxfY+Kr xDjYT79VyiZ9uWBKgWPlqOpzm9xJL+5oKJWo+2Wlu/KuFaq/4TKs90y82GGUFgCYHlg3 6NEw== X-Forwarded-Encrypted: i=1; AJvYcCUcL0Dtbqo4Szj/CsNg+Q0VODhZ9+SPwG+VEDFqlzU6yuPhaN2GjXeykh5NFplSee+KeY8Y05AUHZJaQdk=@vger.kernel.org X-Gm-Message-State: AOJu0YxCxVNoh/zAthScSkmZd788VpqfWuHZuqXsRzHz4YKCilVW3B1+ VTc5yUnUdnvKDC0C9XvarmZahtDK3D4RL9cxRV1oUWivFIZLOtLP X-Gm-Gg: ASbGncuWLIrjf+cQkSsXO3fS+TG5zb9jwsX6oVRzEMVBAVO04uOoPhSweiVTiT/Tllf bKc7cH3EvNtSmZcF6ax1YjO2R/3aM3R4A9ZrURrRsb8TuVuEOjhVdYc+nKTKzNo8/ph791yFqwV OkaXCURoahEFTv7I/3rusK0r7rgPsW3wl317S7zqfaJrEqb4DSAhIi4RbYpiRMztgEj4OX1c7/W w0Or9rYXiGipBQ4gsQuG7no5HrldRR7NxP3c6XxX+oNs68TRorsniqV2gYYXM11qYegvtWJJGvU DqOVjvUfh506onL8oA3uoShKxohC5yppBDjrMGmgQ1BSFXXkxa83VMC7r21l7VoeC44lWSaIyR6 QtA== X-Google-Smtp-Source: AGHT+IEV2XIR0LN/wAE2n62Y1VoOctpEVbSfU4OWKQUPEpcCeuWBTEhGGJZ77uLyoEnBh82Q9kZt3g== X-Received: by 2002:a05:6e02:3c85:b0:3d3:d994:e92e with SMTP id e9e14a558f8ab-3d5e09db5d3mr173946165ab.17.1743615741560; Wed, 02 Apr 2025 10:42:21 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:21 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 08/54] dyndbg: reduce verbose/debug clutter Date: Wed, 2 Apr 2025 11:41:10 -0600 Message-ID: <20250402174156.1246171-9-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" currently, for verbose=3D3, these are logged (blank lines for clarity): dyndbg: query 0: "class DRM_UT_CORE +p" mod:* dyndbg: split into words: "class" "DRM_UT_CORE" "+p" dyndbg: op=3D'+' dyndbg: flags=3D0x1 dyndbg: *flagsp=3D0x1 *maskp=3D0xffffffff dyndbg: parsed: func=3D"" file=3D"" module=3D"" format=3D"" lineno=3D0-0 c= lass=3D... dyndbg: no matches for query dyndbg: no-match: func=3D"" file=3D"" module=3D"" format=3D"" lineno=3D0-0= class=3D... dyndbg: processed 1 queries, with 0 matches, 0 errs That is excessive, so this patch: - shrinks 3 lines of 2nd stanza to single line - drops 1st 2 lines of 3rd stanza 3rd line is like 1st, with result, not procedure. 2nd line is just status, retold in 4th, with more info. New output: dyndbg: query 0: "class DRM_UT_CORE +p" mod:* dyndbg: split into words: "class" "DRM_UT_CORE" "+p" dyndbg: op=3D'+' flags=3D0x1 *flagsp=3D0x1 *maskp=3D0xffffffff dyndbg: no-match: func=3D"" file=3D"" module=3D"" format=3D"" lineno=3D0-0= class=3D... dyndbg: processed 1 queries, with 0 matches, 0 errs Also reduce verbose=3D3 messages in ddebug_add_module When modprobing a module, dyndbg currently logs/says "add-module", and then "skipping" if the module has no prdbgs. Instead just check 1st and return quietly. no functional change Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- -v2 squash several verbose cleanups together --- lib/dynamic_debug.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 55df35df093b..c609ff873224 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -264,9 +264,6 @@ static int ddebug_change(const struct ddebug_query *que= ry, } mutex_unlock(&ddebug_lock); =20 - if (!nfound && verbose) - pr_info("no matches for query\n"); - return nfound; } =20 @@ -499,7 +496,6 @@ static int ddebug_parse_flags(const char *str, struct f= lag_settings *modifiers) pr_err("bad flag-op %c, at start of %s\n", *str, str); return -EINVAL; } - v3pr_info("op=3D'%c'\n", op); =20 for (; *str ; ++str) { for (i =3D ARRAY_SIZE(opt_array) - 1; i >=3D 0; i--) { @@ -513,7 +509,6 @@ static int ddebug_parse_flags(const char *str, struct f= lag_settings *modifiers) return -EINVAL; } } - v3pr_info("flags=3D0x%x\n", modifiers->flags); =20 /* calculate final flags, mask based upon op */ switch (op) { @@ -529,7 +524,7 @@ static int ddebug_parse_flags(const char *str, struct f= lag_settings *modifiers) modifiers->flags =3D 0; break; } - v3pr_info("*flagsp=3D0x%x *maskp=3D0x%x\n", modifiers->flags, modifiers->= mask); + v3pr_info("op=3D'%c' flags=3D0x%x maskp=3D0x%x\n", op, modifiers->flags, = modifiers->mask); =20 return 0; } @@ -539,7 +534,7 @@ static int ddebug_exec_query(char *query_string, const = char *modname) struct flag_settings modifiers =3D {}; struct ddebug_query query =3D {}; #define MAXWORDS 9 - int nwords, nfound; + int nwords; char *words[MAXWORDS]; =20 nwords =3D ddebug_tokenize(query_string, words, MAXWORDS); @@ -557,10 +552,7 @@ static int ddebug_exec_query(char *query_string, const= char *modname) return -EINVAL; } /* actually go and implement the change */ - nfound =3D ddebug_change(&query, &modifiers); - vpr_info_dq(&query, nfound ? "applied" : "no-match"); - - return nfound; + return ddebug_change(&query, &modifiers); } =20 /* handle multiple queries in query string, continue on error, return @@ -1234,11 +1226,10 @@ static int ddebug_add_module(struct _ddebug_info *d= i, const char *modname) { struct ddebug_table *dt; =20 - v3pr_info("add-module: %s.%d sites\n", modname, di->num_descs); - if (!di->num_descs) { - v3pr_info(" skip %s\n", modname); + if (!di->num_descs) return 0; - } + + v3pr_info("add-module: %s %d sites\n", modname, di->num_descs); =20 dt =3D kzalloc(sizeof(*dt), GFP_KERNEL); if (dt =3D=3D NULL) { --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B3E11EB182 for ; Wed, 2 Apr 2025 17:42:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615745; cv=none; b=hqGt23hx/Zk/th1loKI2W2nnU420lkTdiojAuwell+Q5OFB0NWYlxImlW3yHl0ibm2SacAOYpzK5btY6WbJIj5y1/hPPbLg7VH8kMbaFtQ4Zc+ZjuiNDOG2U4CvtzTGBRD/tncQHxFCxbOwTbR2jrYupfwNC46Mm/7BxjPYXvLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615745; c=relaxed/simple; bh=Mg4sgky6TIcj8q0mQMDknRACjH0yuXBrzolkI8PnkNQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D1Pr5zccmfqC6gOIUisJsdlP8FlNsDU73/TZpVMHv/BVCAA46oFcaFeRADkUP1s1gp9oukEfGWFQdOlS9AKbahKLN2BzlzPoD1m15EBesPcCsZSxH9qpJQbRAusBJ/JvyRQCGrQkDgLapdux1mHinRHfRJzWsmrRwwyYv3yiQ5w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fh2Fz+VV; arc=none smtp.client-ip=209.85.166.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fh2Fz+VV" Received: by mail-il1-f177.google.com with SMTP id e9e14a558f8ab-3ce886a2d5bso1034295ab.1 for ; Wed, 02 Apr 2025 10:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615742; x=1744220542; 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=M14gZKfhH3KugOXUlz//RUWXY3n2mU5NyLnRML1fEas=; b=fh2Fz+VVmp7oZJXN7IqziPDjlNnEWpJYAen9rCsdJvw9coqOMLuPEUUpTEGWejqstz nDRAmIJeQ3FrjKr/vXYBAngNTehJZkxeDIHFJObZD7B3R8RLTRufd4gkafqeYu46bLak UxR1usiiKyR+4ltu/tYzFKeDVhnzbcollraE/9Xn7gfgbQhG7jcEMNLyGI+PeoEjRKxO ygZn0vPHAP7I7X+N+r9JjGCxyW0qYvGzEU6XaH2Z5nlGZa85xP5CTYqsos7QgyVW0ZgK ocJuVhYRihUXp5zMNVXcKrkOrvQuYtY5XndwB5VUouFsz55QZiIIAu2B8Whj6WwFRATl 4hJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615742; x=1744220542; 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=M14gZKfhH3KugOXUlz//RUWXY3n2mU5NyLnRML1fEas=; b=tF+oX0n3HLjcNU2UBu9A5R0R3U6jSoWkYzFJ6VJpTXOTrxUg+UP4P4zYSvYzw+mRSF uRb6YJ2oKTdte40uZjaRLuNaLz2AKL4CYIGOON53TcWGWG9fuQIr+vc0pPIw5ZDZrJuN q4D1TFh/tkkHsYB41AccT1N1Ik3QXcTEOn3xM5Z+HCD6BzvO9cq1yIYoov/nkQLxyCGN ZAk/SBJ+K2/aHEgTR+wyow3WN5YezwRp+YfYAR78Lnx4PqISlmp9L4090OoMgCZhkpzk jyh5g4c7CeYLidnXI2KsZtds2NP9RFe0qLJXkxJtfGLIWhHnH0HFIm4TeBwl6z8CctXK phfQ== X-Forwarded-Encrypted: i=1; AJvYcCV/pG1m11v81jy7FAnWdC71PU2OvsWuPU9EpKoN1JDaaSnyXOc3saSZA7Lu7m0+MfJTyiBqiGC1XHOeVNU=@vger.kernel.org X-Gm-Message-State: AOJu0Ywt7cZwqhx4yUvEpQOLWX6PzMMVdkMbP0fUINkfcOclv3ht8T9p ZI+NSBhL04LfglTFUq+jsQb3vkKOTSbXbp+l6p6W3VOSL4Yi/RII X-Gm-Gg: ASbGncvUGti43jfc1Z062vvOJflFv7YxEcuumuanMV/vCwLdAvwVtnHf3jBy9adKrAJ 5fpDxC/b4I5u54vqQBtJHwwQ2IHWNGPj/o5B6pW1TL86ejbDcwFyC0q23REYolEqYUgLTUUfVvD xQ+DVbWoEriZsW+XW1qJ0Uz/8Rv1opQ905cR8YEWnVGXx6cSA0p1HVcLSjzCuvw/FobF4r3x98s BjzToLjSuxFpSSQCZPzdktIJfIgoK8r7xLP4rx6WBKWX0iiOX0GcylqrGRGTDRWYKrjQamZ5ADQ n8sNpXGASn2hGYuDl8IZYjTOHLTM+oASX2CXEpSjYPcbRN+s2CVeSIFVJKTTauVHmSGecG8Sqve axg== X-Google-Smtp-Source: AGHT+IEHyX3rih30b1ivp2/YdoiUvkQ7tiETAKcxWC1uHIaX7eknjSc/IG5d+B4mXjukEeK8ZBu1iA== X-Received: by 2002:a05:6e02:98c:b0:3d6:d3f7:8827 with SMTP id e9e14a558f8ab-3d6d3f7c864mr38169645ab.22.1743615742512; Wed, 02 Apr 2025 10:42:22 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:22 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 09/54] dyndbg: refactor param_set_dyndbg_classes and below Date: Wed, 2 Apr 2025 11:41:11 -0600 Message-ID: <20250402174156.1246171-10-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Refactor callchain below param_set_dyndbg_classes(1) to allow mod-name specific settings. Split (1) into upper/lower fns, adding modname param to lower, and passing NULL in from upper. Below that, add the same param to ddebug_apply_class_bitmap(), and pass it thru to _ddebug_queries(), replacing NULL with the param. This allows the callchain to update the classmap in just one module, vs just all as currently done. While the sysfs param is unlikely to ever update just one module, the callchain will be used for modprobe handling, which should update only that just-probed module. In ddebug_apply_class_bitmap(), also check for actual changes to the bits before announcing them, to declutter logs. No functional change. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- v3 s/modnm/mod_name/g --- lib/dynamic_debug.c | 65 ++++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index c609ff873224..3ad2e38c9ae2 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -593,9 +593,10 @@ static int ddebug_exec_queries(char *query, const char= *modname) return nfound; } =20 -/* apply a new bitmap to the sys-knob's current bit-state */ +/* apply a new class-param setting */ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, - unsigned long *new_bits, unsigned long *old_bits) + unsigned long *new_bits, unsigned long *old_bits, + const char *query_modname) { #define QUERY_SIZE 128 char query[QUERY_SIZE]; @@ -603,7 +604,9 @@ static int ddebug_apply_class_bitmap(const struct ddebu= g_class_param *dcp, int matches =3D 0; int bi, ct; =20 - v2pr_info("apply: 0x%lx to: 0x%lx\n", *new_bits, *old_bits); + if (*new_bits !=3D *old_bits) + v2pr_info("apply bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, + *old_bits, query_modname ?: "'*'"); =20 for (bi =3D 0; bi < map->length; bi++) { if (test_bit(bi, new_bits) =3D=3D test_bit(bi, old_bits)) @@ -612,12 +615,16 @@ static int ddebug_apply_class_bitmap(const struct dde= bug_class_param *dcp, snprintf(query, QUERY_SIZE, "class %s %c%s", map->class_names[bi], test_bit(bi, new_bits) ? '+' : '-', dcp->flags); =20 - ct =3D ddebug_exec_queries(query, NULL); + ct =3D ddebug_exec_queries(query, query_modname); matches +=3D ct; =20 v2pr_info("bit_%d: %d matches on class: %s -> 0x%lx\n", bi, ct, map->class_names[bi], *new_bits); } + if (*new_bits !=3D *old_bits) + v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, + *old_bits, query_modname ?: "'*'"); + return matches; } =20 @@ -672,7 +679,7 @@ static int param_set_dyndbg_classnames(const char *inst= r, const struct kernel_pa continue; } curr_bits ^=3D BIT(cls_id); - totct +=3D ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits); + totct +=3D ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits, NULL); *dcp->bits =3D curr_bits; v2pr_info("%s: changed bit %d:%s\n", KP_NAME(kp), cls_id, map->class_names[cls_id]); @@ -682,7 +689,7 @@ static int param_set_dyndbg_classnames(const char *inst= r, const struct kernel_pa old_bits =3D CLASSMAP_BITMASK(*dcp->lvl); curr_bits =3D CLASSMAP_BITMASK(cls_id + (wanted ? 1 : 0 )); =20 - totct +=3D ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits); + totct +=3D ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits, NULL); *dcp->lvl =3D (cls_id + (wanted ? 1 : 0)); v2pr_info("%s: changed bit-%d: \"%s\" %lx->%lx\n", KP_NAME(kp), cls_id, map->class_names[cls_id], old_bits, curr_bits); @@ -696,18 +703,9 @@ static int param_set_dyndbg_classnames(const char *ins= tr, const struct kernel_pa return 0; } =20 -/** - * param_set_dyndbg_classes - class FOO >control - * @instr: string echo>d to sysfs, input depends on map_type - * @kp: kp->arg has state: bits/lvl, map, map_type - * - * Enable/disable prdbgs by their class, as given in the arguments to - * DECLARE_DYNDBG_CLASSMAP. For LEVEL map-types, enforce relative - * levels by bitpos. - * - * Returns: 0 or <0 if error. - */ -int param_set_dyndbg_classes(const char *instr, const struct kernel_param = *kp) +static int param_set_dyndbg_module_classes(const char *instr, + const struct kernel_param *kp, + const char *mod_name) { const struct ddebug_class_param *dcp =3D kp->arg; const struct ddebug_class_map *map =3D dcp->map; @@ -744,8 +742,8 @@ int param_set_dyndbg_classes(const char *instr, const s= truct kernel_param *kp) KP_NAME(kp), inrep, CLASSMAP_BITMASK(map->length)); inrep &=3D CLASSMAP_BITMASK(map->length); } - v2pr_info("bits:%lx > %s\n", inrep, KP_NAME(kp)); - totct +=3D ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits); + v2pr_info("bits:0x%lx > %s.%s\n", inrep, mod_name ?: "*", KP_NAME(kp)); + totct +=3D ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, mod_name); *dcp->bits =3D inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -758,7 +756,7 @@ int param_set_dyndbg_classes(const char *instr, const s= truct kernel_param *kp) old_bits =3D CLASSMAP_BITMASK(*dcp->lvl); new_bits =3D CLASSMAP_BITMASK(inrep); v2pr_info("lvl:%ld bits:0x%lx > %s\n", inrep, new_bits, KP_NAME(kp)); - totct +=3D ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits); + totct +=3D ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, mod_name= ); *dcp->lvl =3D inrep; break; default: @@ -767,16 +765,33 @@ int param_set_dyndbg_classes(const char *instr, const= struct kernel_param *kp) vpr_info("%s: total matches: %d\n", KP_NAME(kp), totct); return 0; } + +/** + * param_set_dyndbg_classes - classmap kparam setter + * @instr: string echo>d to sysfs, input depends on map_type + * @kp: kp->arg has state: bits/lvl, map, map_type + * + * enable/disable all class'd pr_debugs in the classmap. For LEVEL + * map-types, enforce * relative levels by bitpos. + * + * Returns: 0 or <0 if error. + */ +int param_set_dyndbg_classes(const char *instr, const struct kernel_param = *kp) +{ + return param_set_dyndbg_module_classes(instr, kp, NULL); +} EXPORT_SYMBOL(param_set_dyndbg_classes); =20 /** - * param_get_dyndbg_classes - classes reader + * param_get_dyndbg_classes - classmap kparam getter * @buffer: string description of controlled bits -> classes * @kp: kp->arg has state: bits, map * - * Reads last written state, underlying prdbg state may have been - * altered by direct >control. Displays 0x for DISJOINT, 0-N for - * LEVEL Returns: #chars written or <0 on error + * Reads last written state, underlying pr_debug states may have been + * altered by direct >control. Displays 0x for DISJOINT classmap + * types, 0-N for LEVEL types. + * + * Returns: ct of chars written or <0 on error */ int param_get_dyndbg_classes(char *buffer, const struct kernel_param *kp) { --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 787431EBA07 for ; Wed, 2 Apr 2025 17:42:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615746; cv=none; b=m6UfWHtoj+LJ8Jp89T4wzh7OWQFPoLtrNMgBZjs+0wHTDcOwIc/ofZrRH/iUZO6R8AauC+xorumtqu+AxVJuB0r53M57GvgoAMJQslXZFMQaMSe/vAEKuL7965QtycJ6Ps6e8SZW1Td8SBe6uMzkz6E5bNGVu7y/qIHGEitWIKQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615746; c=relaxed/simple; bh=0iDZDFcFxJGYvKq3+HBGQfkJx820bwme1JTm7/klx/Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OrzoTBpCBSDOngd7NinmiDeql6sLxxGZ+Khj6Etp/Sg9hnwIt5DLpZbPW8oImPsyYHYUEvwbZLFcmAqiHiO/7PAJrismwwqNe+5kknQYyhuXXs99+x2iKPCy6cG/18EiWquGlyNNGOZs+4dx2G74FNWZEdWVw8yjU/t+d6tvsLQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AZQ3NrBp; arc=none smtp.client-ip=209.85.166.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AZQ3NrBp" Received: by mail-io1-f44.google.com with SMTP id ca18e2360f4ac-85de3e8d0adso680639f.1 for ; Wed, 02 Apr 2025 10:42:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615743; x=1744220543; 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=TvjbELtWnV/6RRAeJjKQ44+/OjVwNVd4yFNXgDDBNwA=; b=AZQ3NrBpvGHxV0KfJDoH2lrWQ81Vw2A8JjyrJNN/kIvSXQ90gUYTvWGq5pCtSKoqkm 5hx7xDKq3RGD3j2Mvh0f6MmUlfeYLboIFONWQ1FCApLgzEzOvI2VzVwl0HTs1mtDwZf+ vsb/EhTaJbjimK9ASMqFeVNv/PzrWhmBi6D3290oHDgiuXVX6YXzyxsqPDLbQVf3GLtG rxlq0WDnEM8fPOSOo5UUh1k6Bi9/B74n1dG6PD3nx7mZ+F/aUYtr5jFJWa9DrgffhkiS FKYlO3O3LXisqEyfLWNv48g4ImlMYKjwIGg5GxqGYS22P5tCe2kyI7FzRIOdxpMhvnxb CZRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615743; x=1744220543; 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=TvjbELtWnV/6RRAeJjKQ44+/OjVwNVd4yFNXgDDBNwA=; b=szVueMGNW9EsrYQvZnj5YA/trW1iQEUAvMAx5X7oR3y7S0N6L6BUCrC58LF6YV2xJc B7uDuouThm/g0a+YgGE/p/TEDGfrL8+SL3PvSg825diBM6kadVAeXbmINtr0Ju2TDaYz qWTWZqY7Z93kcchgGO/A+xjgQyIr7V7RL/aDhhZ+XFAarTGaL37BDWMfHYSOeeuVdmQS 60iOGaUQvvOh9tVtEoxDxLLGsxZDjLcVbv0hK8vmff9O5ANi/AqqI9zN7b9g7ien49KU 9JNIXfaFe6QlEOSARMNLklD3OQG1bTH8iSeb3/jEKXpfZJl3qx6docZzFsiKBjNnn2w7 Qk7A== X-Forwarded-Encrypted: i=1; AJvYcCWOX1Ri+ArZXrqPoXTUrWHFPt/5A/1+QTXdQrR8P7jRwctdqX1OBSz8JH2ek6Ivth5A6S1Y1kIHCwg0pJ4=@vger.kernel.org X-Gm-Message-State: AOJu0Yx4tQ8LbNMhMSs3Dn+Nk70G71GHXiqQpfr0SNjPtftwJ36agmqB ICf8jHQzyrpxM3Zomoxk/yZQtzBnF+4XVm8BMLUDthpTBmZFlXtC X-Gm-Gg: ASbGnct6jGhln1QVr5TvCsgB/eeRpPF+2hkRq+JCh/ZZgS4Rilp/dsGQ46eH+W1WoTJ m5/PhEOt1FKiHR8+InR2AUSIAKL/2OdQdQIt0vuEGbhi1AXoZ++toXIJ9pCWRIYFaIFgZRirV1M 7bfkBRg4iNw9Sjr2cFNvlHbnIB9RwEamF3iqO7lz8wrM12Rxm0mwMj6ijBy/TE9Xk0+GKRiNFmx m3CNizk8ny/+0hW/uQAGTQRXIVgfa0nHREhWRoUPlYiCUQp7waI1kQmJwb/UR3nOyNEhkcLKYuj lqVApz43dJP0cM0wtiQbbulCZA4V7DGt1AeUjcv3DfIWNSNswvDKVFHxUW250HtSp8fR3TDr26l u2Q== X-Google-Smtp-Source: AGHT+IGs85dZsLuENhKJMhd+4RgG2Mp0KjLcFlPdCM0oKKyQhvn0ta0pOjzD/VWsfZGf5qORX7r3hg== X-Received: by 2002:a05:6e02:1b0c:b0:3d6:d3f7:8826 with SMTP id e9e14a558f8ab-3d6d3f7c548mr56059025ab.20.1743615743459; Wed, 02 Apr 2025 10:42:23 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:23 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 10/54] dyndbg: tighten fn-sig of ddebug_apply_class_bitmap Date: Wed, 2 Apr 2025 11:41:12 -0600 Message-ID: <20250402174156.1246171-11-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" old_bits arg is currently a pointer to the input bits, but this could allow inadvertent changes to the input by the fn. Disallow this. And constify new_bits while here. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- lib/dynamic_debug.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 3ad2e38c9ae2..621e04b1f28c 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -595,7 +595,8 @@ static int ddebug_exec_queries(char *query, const char = *modname) =20 /* apply a new class-param setting */ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, - unsigned long *new_bits, unsigned long *old_bits, + const unsigned long *new_bits, + const unsigned long old_bits, const char *query_modname) { #define QUERY_SIZE 128 @@ -604,12 +605,12 @@ static int ddebug_apply_class_bitmap(const struct dde= bug_class_param *dcp, int matches =3D 0; int bi, ct; =20 - if (*new_bits !=3D *old_bits) + if (*new_bits !=3D old_bits) v2pr_info("apply bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, - *old_bits, query_modname ?: "'*'"); + old_bits, query_modname ?: "'*'"); =20 for (bi =3D 0; bi < map->length; bi++) { - if (test_bit(bi, new_bits) =3D=3D test_bit(bi, old_bits)) + if (test_bit(bi, new_bits) =3D=3D test_bit(bi, &old_bits)) continue; =20 snprintf(query, QUERY_SIZE, "class %s %c%s", map->class_names[bi], @@ -621,9 +622,9 @@ static int ddebug_apply_class_bitmap(const struct ddebu= g_class_param *dcp, v2pr_info("bit_%d: %d matches on class: %s -> 0x%lx\n", bi, ct, map->class_names[bi], *new_bits); } - if (*new_bits !=3D *old_bits) + if (*new_bits !=3D old_bits) v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, - *old_bits, query_modname ?: "'*'"); + old_bits, query_modname ?: "'*'"); =20 return matches; } @@ -679,7 +680,7 @@ static int param_set_dyndbg_classnames(const char *inst= r, const struct kernel_pa continue; } curr_bits ^=3D BIT(cls_id); - totct +=3D ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits, NULL); + totct +=3D ddebug_apply_class_bitmap(dcp, &curr_bits, *dcp->bits, NULL); *dcp->bits =3D curr_bits; v2pr_info("%s: changed bit %d:%s\n", KP_NAME(kp), cls_id, map->class_names[cls_id]); @@ -689,7 +690,7 @@ static int param_set_dyndbg_classnames(const char *inst= r, const struct kernel_pa old_bits =3D CLASSMAP_BITMASK(*dcp->lvl); curr_bits =3D CLASSMAP_BITMASK(cls_id + (wanted ? 1 : 0 )); =20 - totct +=3D ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits, NULL); + totct +=3D ddebug_apply_class_bitmap(dcp, &curr_bits, old_bits, NULL); *dcp->lvl =3D (cls_id + (wanted ? 1 : 0)); v2pr_info("%s: changed bit-%d: \"%s\" %lx->%lx\n", KP_NAME(kp), cls_id, map->class_names[cls_id], old_bits, curr_bits); @@ -743,7 +744,7 @@ static int param_set_dyndbg_module_classes(const char *= instr, inrep &=3D CLASSMAP_BITMASK(map->length); } v2pr_info("bits:0x%lx > %s.%s\n", inrep, mod_name ?: "*", KP_NAME(kp)); - totct +=3D ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, mod_name); + totct +=3D ddebug_apply_class_bitmap(dcp, &inrep, *dcp->bits, mod_name); *dcp->bits =3D inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -756,7 +757,7 @@ static int param_set_dyndbg_module_classes(const char *= instr, old_bits =3D CLASSMAP_BITMASK(*dcp->lvl); new_bits =3D CLASSMAP_BITMASK(inrep); v2pr_info("lvl:%ld bits:0x%lx > %s\n", inrep, new_bits, KP_NAME(kp)); - totct +=3D ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, mod_name= ); + totct +=3D ddebug_apply_class_bitmap(dcp, &new_bits, old_bits, mod_name); *dcp->lvl =3D inrep; break; default: --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F8B11EE7C0 for ; Wed, 2 Apr 2025 17:42:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615747; cv=none; b=dVoQ/fiBfMjHWEzS3MFYg7fePmSqxYVhACZ5mJyf+NHviyyDAVL2/misIPrHeJvQrQ/bCYFcQxAWUZqN/KXbi0zRBsW8WHdqT3nJF/XCP+V2poRt6Npu8mWeeIXx9JBr+S7ci+KrEaVFQU/eMf6FhaW9VzmTW+fvGvz0mUBjkwI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615747; c=relaxed/simple; bh=NYkyWk6dAvg8GlO3EbdOfZzM5R5WKGYPLSbB6Gfk2UQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b4CuBJqZmADkLXqAC3DV/cQcExB1jda/2S3FSeubyAn3otpT/p7ajChZV8ua8u1dbzESYC0FwG2N5uD3NOayaNOZaALbFKd84RbZ6a6jgg2xdIjtJNHIUZGupmcIVs/D7GubXg+x05UGyQFlncLP9+0XHjLn86rSb9y//Zeuc9U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YUSLs23N; arc=none smtp.client-ip=209.85.166.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YUSLs23N" Received: by mail-il1-f174.google.com with SMTP id e9e14a558f8ab-3d43c972616so330725ab.0 for ; Wed, 02 Apr 2025 10:42:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615744; x=1744220544; 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=d71I99XtVy4797+iIGr5U+qSA7ZenkLyXc4Q7GcfPmk=; b=YUSLs23NHqoa6IEhSPZR3OEvtaOIs3ATyv0euAP4e/jyVGGZFab0FLAlidu6o728by x0wWYVXpgWVAUYWkAFrANlIvZ2oTkqbn2mDSqfgzB59rjRoysQyNb/Th7Fuur555Zjww SHsUwlpIOd/k++D4krGF8sInIVyDW7/4vyRobNQ4Xi9zvj+qwjrQb6LtITSJKn502nbz W3nAFVrZZMpMsCQ5F6pxjdJT9iE/esUQlkFW0lX7A8yYxu3B4fPqFr3I+D2s63flSc93 d989u+QLoOJjbytdpcRV6vA6yyksAkFpUQk6FDkKsleCwM7if+2aNG2mlhA2ZLVbwahq GO4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615744; x=1744220544; 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=d71I99XtVy4797+iIGr5U+qSA7ZenkLyXc4Q7GcfPmk=; b=XSIM3c2t6nH+mYj+70veIVj7zxLWIFZLKj00DIeKWRuKLuaDTCEsYulW4xK2OLEtSU l3cPJSBn5rJq8t24lcG0V9sKTW97HN5er8a+m3lFKJyHK1hYMQO8ZjGEY23+XMJQNvgH ufZlRjQCQaS9CwgVzPR1edJztv3EVc45ST1Zsu/+ye1zhhB3ugUgYCz1bCQidwu1mThf AIvXE0RZ1x9hG+FfiRXcUEMrCm3yZNq3qicPxKGsGeH2ZvM5J4EixE25wreQRJ/Yp846 SSVNiPNqDljvRk78LLC4lRhgt80aGz7P+ewF8KSWzk/dZvz9d7w/b1eu2KLW1H/pXqr1 qyGA== X-Forwarded-Encrypted: i=1; AJvYcCXR0URMvSKCQHuTX/7st+lJWZjlDsgXqrsn9GeQixXm+EKneJb5VznFkRagsJtMxFtizsHDw/2n/TEzl2w=@vger.kernel.org X-Gm-Message-State: AOJu0YyW5e+32dv6QrZVm2XCBgdl8c0WUjV/Ig4GAII+UZnA8w8/uMUb kOFYLbfSd558R2QSrje7BuDUK8z8lv4daqkZIj211ImI7JbXGuAN X-Gm-Gg: ASbGncsB0a7vwxAaCFXyjzzRGx25HIIdJPqeyYrQfI4q6YFGRDXbnl1CZ7mXZeFCkm2 50uHJWqI5pFu+JgVgUcodDszi5hltDqFfeyxzgaQDeq2IYfJyHx0fL3zI4bBUVa3yUr6DhkhjBa 7DuM8AqFlU6GoOJhHMO+JMrC3EIf30v2NF+PUwHoCFzrWXM8nnvl7jjTDz9n5FIzcnu4cxck3QB A50bxB/3baq+EKXjVsfI86btoEo2RRVK2Y0/YWWs94l+LecpzbHRcPgKZyAOxGmKmTXkiU33yjw YpGN4gSsAnLJJAJF/HLwCP9EKsseY5o2cNEcm6ttYZCgoYnCrue1TAwu4+01vUXYQZaURcAghTK 6Hg== X-Google-Smtp-Source: AGHT+IG+gSa1soX7/vjnYhv/X0CCHTfdsDvGdVc4Ac6El3VHxHpzKXqSuveJpX56mj/w47JbZdEjVQ== X-Received: by 2002:a05:6e02:2148:b0:3d3:f15e:8e23 with SMTP id e9e14a558f8ab-3d6dcbc59d4mr6812745ab.10.1743615744434; Wed, 02 Apr 2025 10:42:24 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:24 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 11/54] dyndbg: replace classmap list with a vector Date: Wed, 2 Apr 2025 11:41:13 -0600 Message-ID: <20250402174156.1246171-12-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Classmaps are stored in an elf section/array, but currently are individually list-linked onto dyndbg's per-module ddebug_table for operation. This is unnecessary. Just like dyndbg's descriptors, classes are packed in compile order; so even with many builtin modules employing multiple classmaps, each modules' maps are packed contiguously, and can be treated as a array-start-address & array-length. So this drops the whole list building operation done in ddebug_attach_module_classes(), and removes the list-head members. The "select-by-modname" condition is reused to find the start,end of the subrange. NOTE: This "filter-by-modname" on classmaps should really be done in ddebug_add_module(1); ie at least one step closer to ddebug_init(2), which already splits up pr-debug descriptors into subranges by modname, then calls (1) on each. (2) knows nothing of classmaps currently, and doesn't need to. For now, just add comment. Signed-off-by: Jim Cromie --- v3- drop __outvar as promising magic it doesnt have --- include/linux/dynamic_debug.h | 1 - lib/dynamic_debug.c | 62 ++++++++++++++++++----------------- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index ac199293d203..e458d4b838ac 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -83,7 +83,6 @@ enum class_map_type { }; =20 struct ddebug_class_map { - struct list_head link; struct module *mod; const char *mod_name; /* needed for builtins */ const char **class_names; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 621e04b1f28c..85b8d32742ec 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -45,10 +45,11 @@ extern struct ddebug_class_map __start___dyndbg_classes= []; extern struct ddebug_class_map __stop___dyndbg_classes[]; =20 struct ddebug_table { - struct list_head link, maps; + struct list_head link; const char *mod_name; - unsigned int num_ddebugs; struct _ddebug *ddebugs; + struct ddebug_class_map *classes; + unsigned int num_ddebugs, num_classes; }; =20 struct ddebug_query { @@ -148,12 +149,13 @@ static void vpr_info_dq(const struct ddebug_query *qu= ery, const char *msg) } =20 static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_tabl= e const *dt, - const char *class_string, int *class_id) + const char *class_string, + int *class_id) { struct ddebug_class_map *map; - int idx; + int i, idx; =20 - list_for_each_entry(map, &dt->maps, link) { + for (map =3D dt->classes, i =3D 0; i < dt->num_classes; i++, map++) { idx =3D match_string(map->class_names, map->length, class_string); if (idx >=3D 0) { *class_id =3D idx + map->base; @@ -164,7 +166,6 @@ static struct ddebug_class_map *ddebug_find_valid_class= (struct ddebug_table cons return NULL; } =20 -#define __outvar /* filled by callee */ /* * Search the tables for _ddebug's which match the given `query' and * apply the `flags' and `mask' to them. Returns number of matching @@ -180,7 +181,7 @@ static int ddebug_change(const struct ddebug_query *que= ry, unsigned int nfound =3D 0; struct flagsbuf fbuf, nbuf; struct ddebug_class_map *map =3D NULL; - int __outvar valid_class; + int valid_class; =20 /* search for matching ddebugs */ mutex_lock(&ddebug_lock); @@ -1122,9 +1123,10 @@ static void *ddebug_proc_next(struct seq_file *m, vo= id *p, loff_t *pos) =20 static const char *ddebug_class_name(struct ddebug_iter *iter, struct _dde= bug *dp) { - struct ddebug_class_map *map; + struct ddebug_class_map *map =3D iter->table->classes; + int i, nc =3D iter->table->num_classes; =20 - list_for_each_entry(map, &iter->table->maps, link) + for (i =3D 0; i < nc; i++, map++) if (class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; =20 @@ -1208,30 +1210,31 @@ static const struct proc_ops proc_fops =3D { .proc_write =3D ddebug_proc_write }; =20 -static void ddebug_attach_module_classes(struct ddebug_table *dt, - struct ddebug_class_map *classes, - int num_classes) +static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _= ddebug_info *di) { struct ddebug_class_map *cm; - int i, j, ct =3D 0; + int i, nc =3D 0; =20 - for (cm =3D classes, i =3D 0; i < num_classes; i++, cm++) { + /* + * Find this module's classmaps in a subrange/wholerange of + * the builtin/modular classmap vector/section. Save the start + * and length of the subrange at its edges. + */ + for (cm =3D di->classes, i =3D 0; i < di->num_classes; i++, cm++) { =20 if (!strcmp(cm->mod_name, dt->mod_name)) { - - v2pr_info("class[%d]: module:%s base:%d len:%d ty:%d\n", i, - cm->mod_name, cm->base, cm->length, cm->map_type); - - for (j =3D 0; j < cm->length; j++) - v3pr_info(" %d: %d %s\n", j + cm->base, j, - cm->class_names[j]); - - list_add(&cm->link, &dt->maps); - ct++; + if (!nc) { + v2pr_info("start subrange, class[%d]: module:%s base:%d len:%d ty:%d\n= ", + i, cm->mod_name, cm->base, cm->length, cm->map_type); + dt->classes =3D cm; + } + nc++; } } - if (ct) - vpr_info("module:%s attached %d classes\n", dt->mod_name, ct); + if (nc) { + dt->num_classes =3D nc; + vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); + } } =20 /* @@ -1263,10 +1266,9 @@ static int ddebug_add_module(struct _ddebug_info *di= , const char *modname) dt->num_ddebugs =3D di->num_descs; =20 INIT_LIST_HEAD(&dt->link); - INIT_LIST_HEAD(&dt->maps); =20 if (di->classes && di->num_classes) - ddebug_attach_module_classes(dt, di->classes, di->num_classes); + ddebug_attach_module_classes(dt, di); =20 mutex_lock(&ddebug_lock); list_add_tail(&dt->link, &ddebug_tables); @@ -1379,8 +1381,8 @@ static void ddebug_remove_all_tables(void) mutex_lock(&ddebug_lock); while (!list_empty(&ddebug_tables)) { struct ddebug_table *dt =3D list_entry(ddebug_tables.next, - struct ddebug_table, - link); + struct ddebug_table, + link); ddebug_table_free(dt); } mutex_unlock(&ddebug_lock); --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f169.google.com (mail-il1-f169.google.com [209.85.166.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3495A1EF0AC for ; Wed, 2 Apr 2025 17:42:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615747; cv=none; b=H4DPInpY9KLTlqx1J2SXyWESkN8xy+el0YMNHN/CM6bglwYofsjCGFcrRsP/J2sxRT0VC5fJTKciaaL1O04nCDe/vARmSkxHIlmqPZw85RzDO3PbUbkUGBzUIn6UVBwvSKnDlnu8yHiA8vDR3w5Tegjj9G+R1tjnZNzCLGAfjlk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615747; c=relaxed/simple; bh=7mdbeKopbxbrAVT5CV5/juuXEpASgLSbngk3hy14W7Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FKx4TrXu0Fu7XwYJeLzJ8neVzfmwp08LRMYrX01SfVxT9VAIOf+oE2V1V92AOovkLKP07f3QrE7oSoR5IQuByEvc2enucf++atPrYcXzjyGvLQ+nqBO1i9Ix4tLjWivN+P2x0RJDusyOgtGDoWs1bBOjfgHkSbZwrlN8evoLAEI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hhNNtI6W; arc=none smtp.client-ip=209.85.166.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hhNNtI6W" Received: by mail-il1-f169.google.com with SMTP id e9e14a558f8ab-3d5e43e4725so474905ab.1 for ; Wed, 02 Apr 2025 10:42:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615745; x=1744220545; 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=c83dBzoIbcIM0DNfA5gVIyrKxy+OBEXIBjZPEG9Pdjo=; b=hhNNtI6WkpTIEuhejFDZgrG7WI6+WEpt5h7EatMNc3SrL60fttD7yg6Ddk9Nmk7cva DHRPW9vfii7F33itI+FQ2l3BGud3OMxtlSqN0beDZia9xmkEIDGGHDlAUC8Htcc5MJLF VSYTJojE5AH9H46kJBzMUulkQHRzxsKCHafcooBYGk2mjEvLXkxDdKVtXDnHuwR8uJVW gEJ6XEpy3LDdnqCFqx3rDv3037IQrGqBlHUKyAzke156LZC+EXjrJiBoQQmt7tfv90qw iRHzUripQ94959I73fqgkbNfn7gyo2Smz4wSY00UM0pCfgV6WasI19fAZVtlSLRTT963 jAmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615745; x=1744220545; 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=c83dBzoIbcIM0DNfA5gVIyrKxy+OBEXIBjZPEG9Pdjo=; b=PmzzhiYw7D5HY2MQ+wcaBb9u0dhI3APRexKh+FCdxpVJ/zoBgW8M0vzlTiZFoC3mtN h0vlpDNt5eM2P2FH5TQWzjEkmlzIysLKbi2u66Q8b43y6ZOXacqTYvVoU8mdtGZxqxWH 10lOR1yIPrIP57cJGukHFjE+vsHcBgpgF1fFRVxRPsjlUbsG15TOfgT+lyI4LTet/SWX jPYPZeTX+s8UvF+4hgX72avniK3krv2fJOQ7rUnHQFDLxmZB7Egcl/paTux2iIIUN0Ct y/jrJqJcvrzsiakh3Qdf0252G0II9lDxCGt5kvfH5U2DV6uJagzbJ4RIvcB7ls7eEENF lWcQ== X-Forwarded-Encrypted: i=1; AJvYcCWwRtZLdUy5AHlpkkQsS3OAWKkCOWC7V1inWR9J24Pb9Dsv3OA8C/hg7n2e9OUlKho2b2gyFWFJ9hgL8UM=@vger.kernel.org X-Gm-Message-State: AOJu0YznPEsuSVxc0A33Zpge00r+HUlrU/nvCA0WLSTmvSvEuhX7Gqyt VpyRKJP+YHJxwlBvG8FnGpcetdXvc1xqubbbRMzaV/DwZejh00Kz X-Gm-Gg: ASbGncvxy8cfeR0GlYVUqihbPSUYYR+NSz7G6c5gcXUq+x18fEw9LnjXdSlCtIqvhM1 w/l6zKifKNvGF2VIDWLsf61Y47Ubd03W/Bv/IE/IPg4GVKnIaMQ97Wt50i0ezhnTk5KWlkyjMTG vx3SyTz8Ccm+CZuST8BPF5oc/8D81ftEsIaBhnOeGxNOvZ22o+xRaEHIlYBf3Hs6Mnms0I0nRLl HGGjsmZExbFSNkFpwmZVoSqRoD3O/BXXJAL1pNDPkl1+w4TIO1WPHrr6aMDuf7vlcxuTTHDSrj+ hcjESJ5MwRbYcRS07unwxIxg2DLDxSIqsRpP1PVdVQZD1TROc23NskjinV4HawFwYfg2crCUq/D u3A== X-Google-Smtp-Source: AGHT+IG4VkEFZ5GxM5DWtdCptwmL6vD+yFvCbb5TkjAwVoCHsiKcA6mXmOduxT46XIJtI0tZSFL2lA== X-Received: by 2002:a05:6e02:1848:b0:3d0:443d:a5c3 with SMTP id e9e14a558f8ab-3d6d546a3e6mr38861015ab.3.1743615745299; Wed, 02 Apr 2025 10:42:25 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:24 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 12/54] dyndbg: macrofy a 2-index for-loop pattern Date: Wed, 2 Apr 2025 11:41:14 -0600 Message-ID: <20250402174156.1246171-13-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" dynamic-debug has several __sections, each with , num_, and it iterates over these with a 2-index for-loop. These loops are fiddly with the 2 names. We have only 2 such loops now, but are getting more soon; lets embed/abstract the fiddlyness in the for_subvec() macro, and avoid repeating it going forward. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- lib/dynamic_debug.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 85b8d32742ec..253eaf0a9bd6 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -128,6 +128,21 @@ do { \ #define v3pr_info(fmt, ...) vnpr_info(3, fmt, ##__VA_ARGS__) #define v4pr_info(fmt, ...) vnpr_info(4, fmt, ##__VA_ARGS__) =20 + +/* + * simplify a repeated for-loop pattern walking N steps in a T _vec + * member inside a struct _box. It expects int i and T *_sp to be + * declared in the caller. + * @_i: caller provided counter. + * @_sp: cursor into _vec, to examine each item. + * @_box: ptr to a struct containing @_vec member + * @_vec: name of a sub-struct member in _box, with array-ref and length + */ +#define for_subvec(_i, _sp, _box, _vec) \ + for ((_i) =3D 0, (_sp) =3D (_box)->_vec; \ + (_i) < (_box)->num_##_vec; \ + (_i)++, (_sp)++) + static void vpr_info_dq(const struct ddebug_query *query, const char *msg) { /* trim any trailing newlines */ @@ -155,7 +170,7 @@ static struct ddebug_class_map *ddebug_find_valid_class= (struct ddebug_table cons struct ddebug_class_map *map; int i, idx; =20 - for (map =3D dt->classes, i =3D 0; i < dt->num_classes; i++, map++) { + for_subvec(i, map, dt, classes) { idx =3D match_string(map->class_names, map->length, class_string); if (idx >=3D 0) { *class_id =3D idx + map->base; @@ -1220,8 +1235,7 @@ static void ddebug_attach_module_classes(struct ddebu= g_table *dt, struct _ddebug * the builtin/modular classmap vector/section. Save the start * and length of the subrange at its edges. */ - for (cm =3D di->classes, i =3D 0; i < di->num_classes; i++, cm++) { - + for_subvec(i, cm, di, classes) { if (!strcmp(cm->mod_name, dt->mod_name)) { if (!nc) { v2pr_info("start subrange, class[%d]: module:%s base:%d len:%d ty:%d\n= ", --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E29C1C863B for ; Wed, 2 Apr 2025 17:42:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615749; cv=none; b=f8xDSd4w6N7fu9S1VIbMvyt8fxb/zrcUDO63NbZ/STjDjNNpe0Uqo0ByurOM0gOPLn0Cvr6EYdWQNTPiN7RqemvGnT7Hdz5zt+2qK0SY5mzhRiMqhwjDjSAV/UbNlXHC6FFJ2eNEZnlE78Oh6JO4DmEWIGQzxHN4vXEjW2TDzT0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615749; c=relaxed/simple; bh=jelpVQv/kEprQK6zQjhTupFHtA4MaaC7rxouROujaM8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=coHXEJvs7nbhARTHe1300rO92SYBoI9Q/PS2EadZOrwG6OMm+j2UNVEdC9Lc+qEBoyFL6e8FjSnU40r9z3i/1c1YH8y8X/+C/HeKYI5I1z3vS7GUMf4y6mCDt/WeQ0d4pK6JD0osKJyZVOsUUGqn1CRRfE30onx0hwbrD3FgR58= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HUK65NvO; arc=none smtp.client-ip=209.85.166.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HUK65NvO" Received: by mail-il1-f174.google.com with SMTP id e9e14a558f8ab-3cfc8772469so412725ab.3 for ; Wed, 02 Apr 2025 10:42:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615746; x=1744220546; 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=iMdCRBeIUaLomxj7l8ds1vlIX+t+0425kepvKlXHPa4=; b=HUK65NvOWSyfHdCFSMyx2ipjZpApkepaEs5RLSQBVv4LobziTi7xeMqfiKXixXenjX 3JyWxOfRYl/7Pvq6P3KLVNtVi8T6SkIA2y00/NJEno/S+o9GoC/3Im1x4IUA+szG6bvF aW0FerMELhcop9ww33YK7JzytzQj24t1LTCyRLcmtzpCzzcjKAKeuGf0f05zBJjmVhs1 32ha+ljIs8g0krC5y2AAcIz6sej4TgLJdHyIBgLYnUOet2FC0oyXs7C6lOz3cP8Xf/3N BZwleGM3y31V6rCk74X6pLw6liqI8lWTKdIrOGhZnF3yN0RuYBNLvJN3hEHK5Ad4dIiX 6ITw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615746; x=1744220546; 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=iMdCRBeIUaLomxj7l8ds1vlIX+t+0425kepvKlXHPa4=; b=UFJO1U696JPQHa5vpvmIpE14s4BElT0JayOwjBRH+pmeyOgk+vesnTg8Pvfk52E+eI /DLgtKw8V2RGf3ROrjCJCCp0jQGOrtZLnQEc8RRuI0N0BJnqZc8zbFRglT9HTsBpGZiA I0zk9dPEWbtoNmsPkRGSDNVr0MScJkkam/cPFbv3Qt5j1E+XBcbztQnzNq5B0W0G8UH6 YTxw5aAykObgiko8/zwHIjCdnuH6x0Y/g+0/uVAJenU925Al7lrmLCllc/MMuSgAVR7f 1pKoTANu3XkS2LmRgBv+w98yupOTYE2qlf+xghoHjqY8OoJ0bJWhpW283eVXehtCyBhS dWnQ== X-Forwarded-Encrypted: i=1; AJvYcCWC1HmIFAAnof+sx449XgOm0pFu6mioLWIsGGLx0YKjAVXvrvK8QOVRfWSSj7QxMQ8vvfohg+1uhBd05xY=@vger.kernel.org X-Gm-Message-State: AOJu0YzXcI/w+hqPs4q9lEXVcurAh0Qhq8xs+06CDUCC7x6UPQWYdn4n KooEfUvsN56ak04Rk0CCZv4E/yloNIEFroF018PoxUTTLAU9WJMc X-Gm-Gg: ASbGncv9zxrA+yA7JYCYIAuJPT0f9dW7vPp0//V8ue6uAZjB5cze4eQW6NeI/Ovt/QK p0Wh2SbVLcowvcPENOZNdLtViAvqwXwqneL7SSgSMMS1GZKmbfG8fIKMETrOb+MnCIxkXIOSh6Z 4sQgmyrMaG1EQ6Hwlan1l9i4hjtbKCWvUbZdV6/x3cCxg8roRnOicFj1jkUjJqXmgQkuA+eT6E4 amkN16qG3uqkiwHCFBjVXehoq8tya3Scd9fuy1GcEZny8Qi21Vy3PPZWKWUWl5fF3qi0O2jTV67 cI1bNxxypqQU7qUeb7RwyPqNgSZ7XUiV4yi+Ol8bM6eFetKIOZSMRtPIRbGn/o0bwSSLHNejl/P +Og== X-Google-Smtp-Source: AGHT+IHUY9S3HF46t+ndEfA8P1+IRpDjHWzuWWnXUC+mhYdnqetWUUFeVMyyGMwbn03VeqZ1Z8+QOQ== X-Received: by 2002:a05:6e02:12cf:b0:3d5:8937:f419 with SMTP id e9e14a558f8ab-3d5e093c0e0mr170498575ab.13.1743615746299; Wed, 02 Apr 2025 10:42:26 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:25 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 13/54] dyndbg,module: make proper substructs in _ddebug_info Date: Wed, 2 Apr 2025 11:41:15 -0600 Message-ID: <20250402174156.1246171-14-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" recompose struct _ddebug_info, inserting proper sub-structs. The struct currently has 2 pairs of fields: descs, num_descs and classes, num_classes. Several for-loops operate on these field pairs, soon many more will be added. Looping over these blocks by respective field-pairs is repetitive and fiddly, differing only by the field-names. Before adding a 3rd section and compounding the fiddly details problem, make proper substructs of each section, with the same named fields. So this patch does: Adds 3 "vector" structs, each with { *start, int len; } components, for _ddebug_descriptors, _ddebug_class_maps, and _ddebug_class_users respectively. Invariant: These vectors ref a contiguous subrange of __section memory in builtin/DATA or in loadable modules via mod->dyndbg_info; with guaranteed life-time for us. Bundles these 3 vectors (subrange-refs) struct (reformed) _ddebug_info, where they're __packed to close the paholes introduced otherwise. The common fields allow improving the for_subvec() macro by dropping the ugly num_## paste-up. Also recompose struct ddebug_table to contain a _ddebug_info. This reinforces its use as a cursor into relevant data for a builtin module, and access to the full _ddebug state for modules. NOTES: Fixup names: section names improved, struct names normalized to _ddebug_* struct module contains a _ddebug_info field and module/main.c sets it up, so that gets adjusted. The __packed attribute on _ddebug_info and the 3 contained structs closes the holes otherwise created by the structification (which was my excuse for not doing it originally). Signed-off-by: Jim Cromie --- -v2 rework towards front of series --- include/asm-generic/vmlinux.lds.h | 4 +- include/linux/dynamic_debug.h | 42 +++++++----- kernel/module/main.c | 12 ++-- lib/dynamic_debug.c | 108 ++++++++++++++---------------- lib/test_dynamic_debug.c | 2 +- 5 files changed, 88 insertions(+), 80 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinu= x.lds.h index c9c66089ea2f..f834ad1fb8c4 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -366,8 +366,8 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELL= ER_CLANG) *(__tracepoints) \ /* implement dynamic printk debug */ \ . =3D ALIGN(8); \ - BOUNDED_SECTION_BY(__dyndbg_classes, ___dyndbg_classes) \ - BOUNDED_SECTION_BY(__dyndbg, ___dyndbg) \ + BOUNDED_SECTION_BY(__dyndbg_class_maps, ___dyndbg_class_maps) \ + BOUNDED_SECTION_BY(__dyndbg_descriptors, ___dyndbg_descs) \ CODETAG_SECTIONS() \ LIKELY_PROFILE() \ BRANCH_PROFILE() \ diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index e458d4b838ac..9d282e2444e1 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -82,7 +82,7 @@ enum class_map_type { */ }; =20 -struct ddebug_class_map { +struct _ddebug_class_map { struct module *mod; const char *mod_name; /* needed for builtins */ const char **class_names; @@ -93,15 +93,15 @@ struct ddebug_class_map { =20 /** * DECLARE_DYNDBG_CLASSMAP - declare classnames known by a module - * @_var: a struct ddebug_class_map, passed to module_param_cb + * @_var: a struct _ddebug_class_map, passed to module_param_cb * @_type: enum class_map_type, chooses bits/verbose, numeric/symbolic * @_base: offset of 1st class-name. splits .class_id space * @classes: class-names used to control class'd prdbgs */ #define DECLARE_DYNDBG_CLASSMAP(_var, _maptype, _base, ...) \ static const char *_var##_classnames[] =3D { __VA_ARGS__ }; \ - static struct ddebug_class_map __aligned(8) __used \ - __section("__dyndbg_classes") _var =3D { \ + static struct _ddebug_class_map __aligned(8) __used \ + __section("__dyndbg_class_maps") _var =3D { \ .mod =3D THIS_MODULE, \ .mod_name =3D KBUILD_MODNAME, \ .base =3D _base, \ @@ -110,21 +110,33 @@ struct ddebug_class_map { .class_names =3D _var##_classnames, \ } =20 -/* encapsulate linker provided built-in (or module) dyndbg data */ +/* + * @_ddebug_info: gathers module/builtin dyndbg_* __sections together. + * For builtins, it is used as a cursor, with the inner structs + * marking sub-vectors of the builtin __sections in DATA. + */ +struct _ddebug_descs { + struct _ddebug *start; + int len; +} __packed; + +struct _ddebug_class_maps { + struct _ddebug_class_map *start; + int len; +} __packed; + struct _ddebug_info { - struct _ddebug *descs; - struct ddebug_class_map *classes; - unsigned int num_descs; - unsigned int num_classes; -}; + struct _ddebug_descs descs; + struct _ddebug_class_maps maps; +} __packed; =20 -struct ddebug_class_param { +struct _ddebug_class_param { union { unsigned long *bits; unsigned long *lvl; }; char flags[8]; - const struct ddebug_class_map *map; + const struct _ddebug_class_map *map; }; =20 /* @@ -159,7 +171,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, =20 #define DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, cls, fmt) \ static struct _ddebug __aligned(8) \ - __section("__dyndbg") name =3D { \ + __section("__dyndbg_descriptors") name =3D { \ .modname =3D KBUILD_MODNAME, \ .function =3D __func__, \ .filename =3D __FILE__, \ @@ -242,7 +254,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, * macro. */ #define _dynamic_func_call_cls(cls, fmt, func, ...) \ - __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS_= _) + __dynamic_func_call_cls(__UNIQUE_ID(_ddebug), cls, fmt, func, ##__VA_ARGS= __) #define _dynamic_func_call(fmt, func, ...) \ _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__) =20 @@ -252,7 +264,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, * with precisely the macro's varargs. */ #define _dynamic_func_call_cls_no_desc(cls, fmt, func, ...) \ - __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \ + __dynamic_func_call_cls_no_desc(__UNIQUE_ID(_ddebug), cls, fmt, \ func, ##__VA_ARGS__) #define _dynamic_func_call_no_desc(fmt, func, ...) \ _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \ diff --git a/kernel/module/main.c b/kernel/module/main.c index 1fb9ad289a6f..b60f728e36ac 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2621,12 +2621,12 @@ static int find_module_sections(struct module *mod,= struct load_info *info) pr_warn("%s: Ignoring obsolete parameters\n", mod->name); =20 #ifdef CONFIG_DYNAMIC_DEBUG_CORE - mod->dyndbg_info.descs =3D section_objs(info, "__dyndbg", - sizeof(*mod->dyndbg_info.descs), - &mod->dyndbg_info.num_descs); - mod->dyndbg_info.classes =3D section_objs(info, "__dyndbg_classes", - sizeof(*mod->dyndbg_info.classes), - &mod->dyndbg_info.num_classes); + mod->dyndbg_info.descs.start =3D section_objs(info, "__dyndbg_descriptors= ", + sizeof(*mod->dyndbg_info.descs.start), + &mod->dyndbg_info.descs.len); + mod->dyndbg_info.maps.start =3D section_objs(info, "__dyndbg_class_maps", + sizeof(*mod->dyndbg_info.maps.start), + &mod->dyndbg_info.maps.len); #endif =20 return 0; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 253eaf0a9bd6..104cf8abdf33 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -39,17 +39,15 @@ =20 #include =20 -extern struct _ddebug __start___dyndbg[]; -extern struct _ddebug __stop___dyndbg[]; -extern struct ddebug_class_map __start___dyndbg_classes[]; -extern struct ddebug_class_map __stop___dyndbg_classes[]; +extern struct _ddebug __start___dyndbg_descs[]; +extern struct _ddebug __stop___dyndbg_descs[]; +extern struct _ddebug_class_map __start___dyndbg_class_maps[]; +extern struct _ddebug_class_map __stop___dyndbg_class_maps[]; =20 struct ddebug_table { struct list_head link; const char *mod_name; - struct _ddebug *ddebugs; - struct ddebug_class_map *classes; - unsigned int num_ddebugs, num_classes; + struct _ddebug_info info; }; =20 struct ddebug_query { @@ -128,7 +126,6 @@ do { \ #define v3pr_info(fmt, ...) vnpr_info(3, fmt, ##__VA_ARGS__) #define v4pr_info(fmt, ...) vnpr_info(4, fmt, ##__VA_ARGS__) =20 - /* * simplify a repeated for-loop pattern walking N steps in a T _vec * member inside a struct _box. It expects int i and T *_sp to be @@ -139,8 +136,8 @@ do { \ * @_vec: name of a sub-struct member in _box, with array-ref and length */ #define for_subvec(_i, _sp, _box, _vec) \ - for ((_i) =3D 0, (_sp) =3D (_box)->_vec; \ - (_i) < (_box)->num_##_vec; \ + for ((_i) =3D 0, (_sp) =3D (_box)->_vec.start; \ + (_i) < (_box)->_vec.len; \ (_i)++, (_sp)++) =20 static void vpr_info_dq(const struct ddebug_query *query, const char *msg) @@ -163,14 +160,14 @@ static void vpr_info_dq(const struct ddebug_query *qu= ery, const char *msg) query->first_lineno, query->last_lineno, query->class_string); } =20 -static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_tabl= e const *dt, +static struct _ddebug_class_map *ddebug_find_valid_class(struct ddebug_tab= le const *dt, const char *class_string, int *class_id) { - struct ddebug_class_map *map; + struct _ddebug_class_map *map; int i, idx; =20 - for_subvec(i, map, dt, classes) { + for_subvec(i, map, &dt->info, maps) { idx =3D match_string(map->class_names, map->length, class_string); if (idx >=3D 0) { *class_id =3D idx + map->base; @@ -195,7 +192,7 @@ static int ddebug_change(const struct ddebug_query *que= ry, unsigned int newflags; unsigned int nfound =3D 0; struct flagsbuf fbuf, nbuf; - struct ddebug_class_map *map =3D NULL; + struct _ddebug_class_map *map =3D NULL; int valid_class; =20 /* search for matching ddebugs */ @@ -216,8 +213,8 @@ static int ddebug_change(const struct ddebug_query *que= ry, valid_class =3D _DPRINTK_CLASS_DFLT; } =20 - for (i =3D 0; i < dt->num_ddebugs; i++) { - struct _ddebug *dp =3D &dt->ddebugs[i]; + for (i =3D 0; i < dt->info.descs.len; i++) { + struct _ddebug *dp =3D &dt->info.descs.start[i]; =20 /* match site against query-class */ if (dp->class_id !=3D valid_class) @@ -610,14 +607,14 @@ static int ddebug_exec_queries(char *query, const cha= r *modname) } =20 /* apply a new class-param setting */ -static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, +static int ddebug_apply_class_bitmap(const struct _ddebug_class_param *dcp, const unsigned long *new_bits, const unsigned long old_bits, const char *query_modname) { #define QUERY_SIZE 128 char query[QUERY_SIZE]; - const struct ddebug_class_map *map =3D dcp->map; + const struct _ddebug_class_map *map =3D dcp->map; int matches =3D 0; int bi, ct; =20 @@ -653,8 +650,8 @@ static int ddebug_apply_class_bitmap(const struct ddebu= g_class_param *dcp, /* accept comma-separated-list of [+-] classnames */ static int param_set_dyndbg_classnames(const char *instr, const struct ker= nel_param *kp) { - const struct ddebug_class_param *dcp =3D kp->arg; - const struct ddebug_class_map *map =3D dcp->map; + const struct _ddebug_class_param *dcp =3D kp->arg; + const struct _ddebug_class_map *map =3D dcp->map; unsigned long curr_bits, old_bits; char *cl_str, *p, *tmp; int cls_id, totct =3D 0; @@ -724,8 +721,8 @@ static int param_set_dyndbg_module_classes(const char *= instr, const struct kernel_param *kp, const char *mod_name) { - const struct ddebug_class_param *dcp =3D kp->arg; - const struct ddebug_class_map *map =3D dcp->map; + const struct _ddebug_class_param *dcp =3D kp->arg; + const struct _ddebug_class_map *map =3D dcp->map; unsigned long inrep, new_bits, old_bits; int rc, totct =3D 0; =20 @@ -812,8 +809,8 @@ EXPORT_SYMBOL(param_set_dyndbg_classes); */ int param_get_dyndbg_classes(char *buffer, const struct kernel_param *kp) { - const struct ddebug_class_param *dcp =3D kp->arg; - const struct ddebug_class_map *map =3D dcp->map; + const struct _ddebug_class_param *dcp =3D kp->arg; + const struct _ddebug_class_map *map =3D dcp->map; =20 switch (map->map_type) { =20 @@ -1064,8 +1061,8 @@ static struct _ddebug *ddebug_iter_first(struct ddebu= g_iter *iter) } iter->table =3D list_entry(ddebug_tables.next, struct ddebug_table, link); - iter->idx =3D iter->table->num_ddebugs; - return &iter->table->ddebugs[--iter->idx]; + iter->idx =3D iter->table->info.descs.len; + return &iter->table->info.descs.start[--iter->idx]; } =20 /* @@ -1086,10 +1083,10 @@ static struct _ddebug *ddebug_iter_next(struct ddeb= ug_iter *iter) } iter->table =3D list_entry(iter->table->link.next, struct ddebug_table, link); - iter->idx =3D iter->table->num_ddebugs; + iter->idx =3D iter->table->info.descs.len; --iter->idx; } - return &iter->table->ddebugs[iter->idx]; + return &iter->table->info.descs.start[iter->idx]; } =20 /* @@ -1136,12 +1133,12 @@ static void *ddebug_proc_next(struct seq_file *m, v= oid *p, loff_t *pos) #define class_in_range(class_id, map) \ (class_id >=3D map->base && class_id < map->base + map->length) =20 -static const char *ddebug_class_name(struct ddebug_iter *iter, struct _dde= bug *dp) +static const char *ddebug_class_name(struct ddebug_table *dt, struct _ddeb= ug *dp) { - struct ddebug_class_map *map =3D iter->table->classes; - int i, nc =3D iter->table->num_classes; + struct _ddebug_class_map *map; + int i; =20 - for (i =3D 0; i < nc; i++, map++) + for_subvec(i, map, &dt->info, maps) if (class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; =20 @@ -1175,7 +1172,7 @@ static int ddebug_proc_show(struct seq_file *m, void = *p) seq_putc(m, '"'); =20 if (dp->class_id !=3D _DPRINTK_CLASS_DFLT) { - class =3D ddebug_class_name(iter, dp); + class =3D ddebug_class_name(iter->table, dp); if (class) seq_printf(m, " class:%s", class); else @@ -1227,7 +1224,7 @@ static const struct proc_ops proc_fops =3D { =20 static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _= ddebug_info *di) { - struct ddebug_class_map *cm; + struct _ddebug_class_map *cm; int i, nc =3D 0; =20 /* @@ -1235,18 +1232,18 @@ static void ddebug_attach_module_classes(struct dde= bug_table *dt, struct _ddebug * the builtin/modular classmap vector/section. Save the start * and length of the subrange at its edges. */ - for_subvec(i, cm, di, classes) { + for_subvec(i, cm, di, maps) { if (!strcmp(cm->mod_name, dt->mod_name)) { if (!nc) { v2pr_info("start subrange, class[%d]: module:%s base:%d len:%d ty:%d\n= ", i, cm->mod_name, cm->base, cm->length, cm->map_type); - dt->classes =3D cm; + dt->info.maps.start =3D cm; } nc++; } } if (nc) { - dt->num_classes =3D nc; + dt->info.maps.len =3D nc; vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); } } @@ -1259,10 +1256,10 @@ static int ddebug_add_module(struct _ddebug_info *d= i, const char *modname) { struct ddebug_table *dt; =20 - if (!di->num_descs) + if (!di->descs.len) return 0; =20 - v3pr_info("add-module: %s %d sites\n", modname, di->num_descs); + v3pr_info("add-module: %s %d sites\n", modname, di->descs.len); =20 dt =3D kzalloc(sizeof(*dt), GFP_KERNEL); if (dt =3D=3D NULL) { @@ -1276,19 +1273,18 @@ static int ddebug_add_module(struct _ddebug_info *d= i, const char *modname) * this struct ddebug_table. */ dt->mod_name =3D modname; - dt->ddebugs =3D di->descs; - dt->num_ddebugs =3D di->num_descs; + dt->info =3D *di; =20 INIT_LIST_HEAD(&dt->link); =20 - if (di->classes && di->num_classes) + if (di->maps.len) ddebug_attach_module_classes(dt, di); =20 mutex_lock(&ddebug_lock); list_add_tail(&dt->link, &ddebug_tables); mutex_unlock(&ddebug_lock); =20 - vpr_info("%3u debug prints in module %s\n", di->num_descs, modname); + vpr_info("%3u debug prints in module %s\n", di->descs.len, modname); return 0; } =20 @@ -1435,10 +1431,10 @@ static int __init dynamic_debug_init(void) char *cmdline; =20 struct _ddebug_info di =3D { - .descs =3D __start___dyndbg, - .classes =3D __start___dyndbg_classes, - .num_descs =3D __stop___dyndbg - __start___dyndbg, - .num_classes =3D __stop___dyndbg_classes - __start___dyndbg_classes, + .descs.start =3D __start___dyndbg_descs, + .maps.start =3D __start___dyndbg_class_maps, + .descs.len =3D __stop___dyndbg_descs - __start___dyndbg_descs, + .maps.len =3D __stop___dyndbg_class_maps - __start___dyndbg_class_maps, }; =20 #ifdef CONFIG_MODULES @@ -1449,7 +1445,7 @@ static int __init dynamic_debug_init(void) } #endif /* CONFIG_MODULES */ =20 - if (&__start___dyndbg =3D=3D &__stop___dyndbg) { + if (&__start___dyndbg_descs =3D=3D &__stop___dyndbg_descs) { if (IS_ENABLED(CONFIG_DYNAMIC_DEBUG)) { pr_warn("_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build\n"); return 1; @@ -1459,16 +1455,16 @@ static int __init dynamic_debug_init(void) return 0; } =20 - iter =3D iter_mod_start =3D __start___dyndbg; + iter =3D iter_mod_start =3D __start___dyndbg_descs; modname =3D iter->modname; i =3D mod_sites =3D mod_ct =3D 0; =20 - for (; iter < __stop___dyndbg; iter++, i++, mod_sites++) { + for (; iter < __stop___dyndbg_descs; iter++, i++, mod_sites++) { =20 if (strcmp(modname, iter->modname)) { mod_ct++; - di.num_descs =3D mod_sites; - di.descs =3D iter_mod_start; + di.descs.len =3D mod_sites; + di.descs.start =3D iter_mod_start; ret =3D ddebug_add_module(&di, modname); if (ret) goto out_err; @@ -1478,8 +1474,8 @@ static int __init dynamic_debug_init(void) iter_mod_start =3D iter; } } - di.num_descs =3D mod_sites; - di.descs =3D iter_mod_start; + di.descs.len =3D mod_sites; + di.descs.start =3D iter_mod_start; ret =3D ddebug_add_module(&di, modname); if (ret) goto out_err; @@ -1489,8 +1485,8 @@ static int __init dynamic_debug_init(void) i, mod_ct, (int)((mod_ct * sizeof(struct ddebug_table)) >> 10), (int)((i * sizeof(struct _ddebug)) >> 10)); =20 - if (di.num_classes) - v2pr_info(" %d builtin ddebug class-maps\n", di.num_classes); + if (di.maps.len) + v2pr_info(" %d builtin ddebug class-maps\n", di.maps.len); =20 /* now that ddebug tables are loaded, process all boot args * again to find and activate queries given in dyndbg params. diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 396144cf351b..8434f70b51bb 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -41,7 +41,7 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 06= 00); */ #define DD_SYS_WRAP(_model, _flags) \ static unsigned long bits_##_model; \ - static struct ddebug_class_param _flags##_model =3D { \ + static struct _ddebug_class_param _flags##_model =3D { \ .bits =3D &bits_##_model, \ .flags =3D #_flags, \ .map =3D &map_##_model, \ --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f175.google.com (mail-il1-f175.google.com [209.85.166.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D4121F0E36 for ; Wed, 2 Apr 2025 17:42:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615750; cv=none; b=NLdt3RrHwyXx7uc7/8WGXTUzQIIxKSvg6/Ctetu9ilhnGJc2BleZS5LWPVPs08gE1TdlRteT4rvHXdtIL3ZLNtxLDPDz2EK76MoX51brrWj012ESfZ8tgAJpYn9/cQ1MAYlC+pA97sNnTqRKtZM1BVF8/EaQrh8odCaVj38Vsp0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615750; c=relaxed/simple; bh=GlDskdVm12jjjIQZLhKuKLleuMoQsfmoF9yvGO7BVAU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hRG3CgQuSBSqlbQ/42vp+K1x1ZIRuoUDkzrMj1yksq72Dug95HxFPkbWT6XgEd23mvSzNnEbaJilvJhncVyCL1EyYBv6Bn1gC1m0MqnP366OGNA/RQF38yEMcLc07JKO+hDxVqidxwSTQdoOwYlvwx+swiHG/VI1y/DBXUcBT08= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aUKBYhJ7; arc=none smtp.client-ip=209.85.166.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aUKBYhJ7" Received: by mail-il1-f175.google.com with SMTP id e9e14a558f8ab-3d58908c43fso505435ab.0 for ; Wed, 02 Apr 2025 10:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615747; x=1744220547; 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=1HVCxpeKRFzeSI1AhmlyvBuPBqCCJEuta9afFF5qwQI=; b=aUKBYhJ75QO/48n+wjqSRBKLsHwQ3wOYqUI1V7taSHW9eZscHHw40iqNBttigxXGkH /zUSPh7nSywoyu/NEtgersIUvO24RenSFiSuXZUs8WicgnEkps1ZT5nOJRMIHIu2scRx zjZWAH+J5NqvbIFqvsG/6bZaB0/ws9HVZa1EJVe7AeXpHm+Ekw7anWM67FsaEYZNv0/a Lk3rAP/8RoJ0LRqUkKiLnCDDQLUPsg+Mx0U9iil1rjQEf+4oxsJxCy2t6x9O/yAu64Wt xHjqULVSfy0dO1jsRk6xPkZxHFgQsja/lIKuIxZt7OPHtD9lcAiQIWJ+SX7D1PIJJ70k wCtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615747; x=1744220547; 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=1HVCxpeKRFzeSI1AhmlyvBuPBqCCJEuta9afFF5qwQI=; b=bDUh8CqCZKAUlRcVUk7r2rLP3XXq0X7NLCLaaRjNmAv7rsTgG3O9B+srHEkOJBHABY UOUoM8IAISG+8gnKZpW1q5x8rSr0ubVQFqqEaVUVZoCPp0Bk0sDazQCj4VPpE73W3mAT uceumAzmJwwhuHaRUybm9fVWDG6R+wT84IBi6TSgfoDs7GbURQQUKn+MPH2H1DMymmHb 99NoARuIs4/Cr8AQb1ANDVf3zKQHO+cBCkMr4wbd7tOCWCB56munXzXLfDNff+ZsaWxC 8JfL/sx+DZ+EKnfFI1H8D4EWRyivpVs2wXZu0lQWGa0I8fqoLBamr/uvwVB2fD4hn4SB amLg== X-Forwarded-Encrypted: i=1; AJvYcCUXXktpGHLjD4HEaWVPa51ppUe9IMamLkJLMbR59USTmjqO4gaINBzTCWoD76vWbdWBtSWXlnrqFmHDfP0=@vger.kernel.org X-Gm-Message-State: AOJu0YxR1Gatn5fDDbYHicS1nAgyUvPFQrG48XgsXFyeREDoDVpR+PPJ bjhhc6BXogM4lJe6+2dkZzgLYOXNt8ZjLGnq7pIdL8F8z5zxt+Zz X-Gm-Gg: ASbGncvCmgKdrCssevFqOuIju5M7QbVG3nqHkgaEL4bxmLDoEOmpSYlnk0VsmTM2CNy MCUlki0NzE8Asff4By/3SozW9FEiTdZeeQRgzQEshNl+ULiO2210Tp7b31/F8DiCnZtSD7wOO5B i9hFQq3WIAkxh8hPHWTh2HEyJnH2MLgXIfFCK8iF+8FV68uRlPb2UMYc46HHfo99PJHuLOk/J9e f3sEXxp4dNGN0zfU1NDFO9xooZu+2PqbWStqJUi7Xwi/D0svzYRSfXdi7Vo4sPMAIm2verHkXYg VkmkVTs1kIQFOpc+Ay5mRE3NPoxftcz/7JQ2ZclsWTTSrOEL4webv09mfOS8MGY8I0fyNafbFcJ Skw== X-Google-Smtp-Source: AGHT+IGlzPv/lWLR6oQjYV5JPNtW8nNh4plsjoqpQBkDo3jtIwkHZqjbr7e+0JVOkoajzQcuo3mWrg== X-Received: by 2002:a05:6e02:3c85:b0:3d3:d994:e92e with SMTP id e9e14a558f8ab-3d5e09db5d3mr173949595ab.17.1743615747396; Wed, 02 Apr 2025 10:42:27 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:26 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 14/54] dyndbg: hoist classmap-filter-by-modname up to ddebug_add_module Date: Wed, 2 Apr 2025 11:41:16 -0600 Message-ID: <20250402174156.1246171-15-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The body of ddebug_attach_module_classes() is dominated by a code-block that finds the contiguous subrange of classmaps matching on modname, and saves it into the ddebug_table's info record. Implement this block in a macro to accommodate different component vectors in the "box" (as named in the for_subvec macro). And hoist its invocation out of ddebug_attach_module_classes() up into ddebug_add_module(). This moves the filtering step up closer to dynamic_debug_init(), which effectively does the same for builtin pr_debug descriptors; segmenting them into subranges by modname. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 56 ++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 104cf8abdf33..046c4ffb38f8 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -161,8 +161,8 @@ static void vpr_info_dq(const struct ddebug_query *quer= y, const char *msg) } =20 static struct _ddebug_class_map *ddebug_find_valid_class(struct ddebug_tab= le const *dt, - const char *class_string, - int *class_id) + const char *class_string, + int *class_id) { struct _ddebug_class_map *map; int i, idx; @@ -1224,30 +1224,34 @@ static const struct proc_ops proc_fops =3D { =20 static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _= ddebug_info *di) { - struct _ddebug_class_map *cm; - int i, nc =3D 0; - - /* - * Find this module's classmaps in a subrange/wholerange of - * the builtin/modular classmap vector/section. Save the start - * and length of the subrange at its edges. - */ - for_subvec(i, cm, di, maps) { - if (!strcmp(cm->mod_name, dt->mod_name)) { - if (!nc) { - v2pr_info("start subrange, class[%d]: module:%s base:%d len:%d ty:%d\n= ", - i, cm->mod_name, cm->base, cm->length, cm->map_type); - dt->info.maps.start =3D cm; - } - nc++; - } - } - if (nc) { - dt->info.maps.len =3D nc; - vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); - } + vpr_info("module:%s attached %d classes\n", dt->mod_name, dt->info.maps.l= en); } =20 +/* + * Walk the @_box->@_vec member, over @_vec.start[0..len], and find + * the contiguous subrange of elements matching on ->mod_name. Copy + * the subrange into @_dst. This depends on vars defd by caller. + * + * @_i: caller provided counter var, init'd by macro + * @_sp: cursor into @_vec. + * @_box: contains member named @_vec + * @_vec: an array-ref, with: .start .len fields. + * @_dst: an array-ref: to remember the module's subrange + */ +#define dd_mark_vector_subrange(_i, _dst, _sp, _box, _vec) ({ \ + int nc =3D 0; \ + for_subvec(_i, _sp, _box, _vec) { \ + if (!strcmp((_sp)->mod_name, (_dst)->mod_name)) { \ + if (!nc++) \ + (_dst)->info._vec.start =3D (_sp); \ + } else { \ + if (nc) \ + break; /* end of consecutive matches */ \ + } \ + } \ + (_dst)->info._vec.len =3D nc; \ +}) + /* * Allocate a new ddebug_table for the given module * and add it to the global list. @@ -1255,6 +1259,8 @@ static void ddebug_attach_module_classes(struct ddebu= g_table *dt, struct _ddebug static int ddebug_add_module(struct _ddebug_info *di, const char *modname) { struct ddebug_table *dt; + struct _ddebug_class_map *cm; + int i; =20 if (!di->descs.len) return 0; @@ -1277,6 +1283,8 @@ static int ddebug_add_module(struct _ddebug_info *di,= const char *modname) =20 INIT_LIST_HEAD(&dt->link); =20 + dd_mark_vector_subrange(i, dt, cm, di, maps); + if (di->maps.len) ddebug_attach_module_classes(dt, di); =20 --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B6CF1917C2 for ; Wed, 2 Apr 2025 17:42:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615751; cv=none; b=NypfvqIxaJMi5WUaSNDrMJ3V6ox2d12j4/3YQKnDl2v3FjMPdH4jfZfOqLfGwxgWsk6nyG7xXso1+ce651wNftqrGoYXT+FKOqkHYQ0ndQ+ZyaHevlY0E5YYLROOzkoNWGnYcbN4/mp7ixaYoU2GKPLTWsy16kNluM6Y9Ac5gK4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615751; c=relaxed/simple; bh=4woGSZYOrznBRvkilPFccYpLgJPqYRQwY1WKYsAheYA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MaRdYlDm/Udb5HlyQgx/Kd05IPmWxwXrrMuf/VImJkr+P+Tv0Xvar5Jsth3K5ym5abjKzMrgf1RM0Y8Gc87T9v0QIhdfra2qV+XryVHG3lRu/knXs70xh1ivVIfnnJXImhRqArcTSOatjaLmZZBlL3v/I2yNfCSPc8MQ1FHUzAo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=C/FUjnPy; arc=none smtp.client-ip=209.85.166.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="C/FUjnPy" Received: by mail-io1-f51.google.com with SMTP id ca18e2360f4ac-85b44094782so356939f.3 for ; Wed, 02 Apr 2025 10:42:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615748; x=1744220548; 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=zBPCp4iUxXvE3TA/4gPCbhy4jLrWUE5M6DM69pi7RG8=; b=C/FUjnPyFdGosJitdjtK0xNLkOmWYPo2epN05Y9pjeLm5P2b8HmaS+PkjRK9v71R+F cUtioHRxnK4rUv2QU79DZiJCepNWygmhAcHPq0a58dOpIzXH82CXL8EF7kE7ZMcABqTc 75x5jZoSabBx3RnAlQePvZhbRS14BNr4D3AgsDxZxj2SDRb7kyUbtkgSt0uGvhSO4mMB d2Zl9z41xb+4GtWt5N1f2lgO49CBL+HG5cckLbXxpwBTVaWl2Fb38R1wcWoRrgM+0vGz 9SyRGdhq1s/RTL8ZMUhfUpro6+MoL0n3VBxdnnX+JFl3vQJ9NGCSthRvYhPyoF54IEQg W1Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615748; x=1744220548; 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=zBPCp4iUxXvE3TA/4gPCbhy4jLrWUE5M6DM69pi7RG8=; b=MFgTlaM+/TrE1v+0yVKD7JPf3tv/X7jL9ziREEy+q64kdHr+wE/4AAlG6C/Z6vMsbZ bAY0u9zHGfdEmCE3wRyUc6eMluNXatmjs5GodBqTaba3q+wGm23xjs7B7Cpaxxx5YQB/ tjitsxn8oiFzPlkFXZ+oajHLu4UaNMNwVMgEbcm8ovXY+u3XRVyhbLE2WuBkqQclMVDD 4IuE/5Bpqo9BT7fmYNbJy9DBuG1HVXyWXvbYee/MgOJKYyvFdUvTD7Z+lWYXqd6Vt3ZF yMH2hkIWpIhS3Sk/+XTu1kvzoLqaA7+81agQIUDYmx77SDgXuq/39K+e0pezOqPmi/qU 5WGA== X-Forwarded-Encrypted: i=1; AJvYcCViGaf3MCImgE3d3MaGEw/+oIsW9Ha/3HzLSDYz+6J/ERwXq1wg/kdXab4vfVNKdAgtCfDVpriYVxiLvoQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzZgVedLJY7MMWL7iEyXKYVEL2qfm9K0wypux4iPL/sWtc00uJA 4D33r6zkXbUu3cLs5KI7Bt6O2x5jZc+ys6cb2IYdVqZAmauZjyCr X-Gm-Gg: ASbGncu9eJvbaUXqdK5KaPk4CTdvDxfjQuV7Q58gLuxeFZ9epfO1J1BzNu7ZP/v27M9 diybffpqQ9ioY+rtrsbmWwpsCyuG2/QnPCJIuhYhrI2mY+gHtvwROFYmFzudrSLnSeABKgKDqFq lh9yr8FRRv+TPExgNiL0DjS212VF796gRuhBYQIhV9vqhTM/m2IgSLKDiam42DAnO+qtcx/Bya6 fgV8yHF8qES0r/N+XAkkFi+OCv/jrC/EFzIj9L1WBIr2pIcEdsrEdWLVtuNqh5zpmZ8x1iBHt+y SEPHimNZasjFfBKowawm70EPF9otV8JuzZdwsaLXQxKuAWLUeBIynDodn4SZfPCI5BdOHR9Owyv T4w== X-Google-Smtp-Source: AGHT+IFHChRxUe/CFyGHCRhXSPTcNQNWMaUOrrxlaidGh2Iwl93M3Pr4TEsfbA6/T4Q/FDzWSFKJ3g== X-Received: by 2002:a05:6e02:1a67:b0:3d0:21aa:a752 with SMTP id e9e14a558f8ab-3d5e08eaf0emr82482825ab.2.1743615748358; Wed, 02 Apr 2025 10:42:28 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:28 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 15/54] dyndbg: ddebug_table.mod_name down to _ddebug_info Date: Wed, 2 Apr 2025 11:41:17 -0600 Message-ID: <20250402174156.1246171-16-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" struct _ddebug_info already has most of dyndbg's info for a module; push debug_table.mod_name down into it, finishing the encapsulation. This allows refactoring several callchains, passing &_ddebug_info instead of &ddebug_table, and hoisting the "&dt->info" deref up. ddebug_table contains a _ddebug_info member, so its users keep access to mod_name, just now with "->info." added in. In static ddebug_add_module(&di), reinforce the cursor-model by dropping the modname arg, and setting di->mod_name at each caller. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- -v3 more s/dt/di/ internal interface changes --- include/linux/dynamic_debug.h | 1 + lib/dynamic_debug.c | 45 ++++++++++++++++++----------------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 9d282e2444e1..f4d1d08cd5a7 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -126,6 +126,7 @@ struct _ddebug_class_maps { } __packed; =20 struct _ddebug_info { + const char *mod_name; struct _ddebug_descs descs; struct _ddebug_class_maps maps; } __packed; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 046c4ffb38f8..aff254d39c36 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -46,7 +46,6 @@ extern struct _ddebug_class_map __stop___dyndbg_class_map= s[]; =20 struct ddebug_table { struct list_head link; - const char *mod_name; struct _ddebug_info info; }; =20 @@ -201,7 +200,7 @@ static int ddebug_change(const struct ddebug_query *que= ry, =20 /* match against the module name */ if (query->module && - !match_wildcard(query->module, dt->mod_name)) + !match_wildcard(query->module, dt->info.mod_name)) continue; =20 if (query->class_string) { @@ -269,7 +268,7 @@ static int ddebug_change(const struct ddebug_query *que= ry, #endif v4pr_info("changed %s:%d [%s]%s %s =3D> %s\n", trim_prefix(dp->filename), dp->lineno, - dt->mod_name, dp->function, + dt->info.mod_name, dp->function, ddebug_describe_flags(dp->flags, &fbuf), ddebug_describe_flags(newflags, &nbuf)); dp->flags =3D newflags; @@ -1133,12 +1132,12 @@ static void *ddebug_proc_next(struct seq_file *m, v= oid *p, loff_t *pos) #define class_in_range(class_id, map) \ (class_id >=3D map->base && class_id < map->base + map->length) =20 -static const char *ddebug_class_name(struct ddebug_table *dt, struct _ddeb= ug *dp) +static const char *ddebug_class_name(struct _ddebug_info *di, struct _ddeb= ug *dp) { struct _ddebug_class_map *map; int i; =20 - for_subvec(i, map, &dt->info, maps) + for_subvec(i, map, di, maps) if (class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; =20 @@ -1166,13 +1165,13 @@ static int ddebug_proc_show(struct seq_file *m, voi= d *p) =20 seq_printf(m, "%s:%u [%s]%s =3D%s \"", trim_prefix(dp->filename), dp->lineno, - iter->table->mod_name, dp->function, + iter->table->info.mod_name, dp->function, ddebug_describe_flags(dp->flags, &flags)); seq_escape_str(m, dp->format, ESCAPE_SPACE, "\t\r\n\""); seq_putc(m, '"'); =20 if (dp->class_id !=3D _DPRINTK_CLASS_DFLT) { - class =3D ddebug_class_name(iter->table, dp); + class =3D ddebug_class_name(&iter->table->info, dp); if (class) seq_printf(m, " class:%s", class); else @@ -1224,7 +1223,7 @@ static const struct proc_ops proc_fops =3D { =20 static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _= ddebug_info *di) { - vpr_info("module:%s attached %d classes\n", dt->mod_name, dt->info.maps.l= en); + vpr_info("module:%s attached %d classes\n", dt->info.mod_name, dt->info.m= aps.len); } =20 /* @@ -1241,7 +1240,7 @@ static void ddebug_attach_module_classes(struct ddebu= g_table *dt, struct _ddebug #define dd_mark_vector_subrange(_i, _dst, _sp, _box, _vec) ({ \ int nc =3D 0; \ for_subvec(_i, _sp, _box, _vec) { \ - if (!strcmp((_sp)->mod_name, (_dst)->mod_name)) { \ + if (!strcmp((_sp)->mod_name, (_dst)->info.mod_name)) { \ if (!nc++) \ (_dst)->info._vec.start =3D (_sp); \ } else { \ @@ -1256,7 +1255,7 @@ static void ddebug_attach_module_classes(struct ddebu= g_table *dt, struct _ddebug * Allocate a new ddebug_table for the given module * and add it to the global list. */ -static int ddebug_add_module(struct _ddebug_info *di, const char *modname) +static int ddebug_add_module(struct _ddebug_info *di) { struct ddebug_table *dt; struct _ddebug_class_map *cm; @@ -1265,20 +1264,19 @@ static int ddebug_add_module(struct _ddebug_info *d= i, const char *modname) if (!di->descs.len) return 0; =20 - v3pr_info("add-module: %s %d sites\n", modname, di->descs.len); + v3pr_info("add-module: %s %d sites\n", di->mod_name, di->descs.len); =20 dt =3D kzalloc(sizeof(*dt), GFP_KERNEL); if (dt =3D=3D NULL) { - pr_err("error adding module: %s\n", modname); + pr_err("error adding module: %s\n", di->mod_name); return -ENOMEM; } /* - * For built-in modules, name lives in .rodata and is - * immortal. For loaded modules, name points at the name[] - * member of struct module, which lives at least as long as - * this struct ddebug_table. + * For built-in modules, name (as supplied in di by its + * callers) lives in .rodata and is immortal. For loaded + * modules, name points at the name[] member of struct module, + * which lives at least as long as this struct ddebug_table. */ - dt->mod_name =3D modname; dt->info =3D *di; =20 INIT_LIST_HEAD(&dt->link); @@ -1292,7 +1290,7 @@ static int ddebug_add_module(struct _ddebug_info *di,= const char *modname) list_add_tail(&dt->link, &ddebug_tables); mutex_unlock(&ddebug_lock); =20 - vpr_info("%3u debug prints in module %s\n", di->descs.len, modname); + vpr_info("%3u debug prints in module %s\n", di->descs.len, di->mod_name); return 0; } =20 @@ -1355,7 +1353,7 @@ static int ddebug_remove_module(const char *mod_name) =20 mutex_lock(&ddebug_lock); list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) { - if (dt->mod_name =3D=3D mod_name) { + if (dt->info.mod_name =3D=3D mod_name) { ddebug_table_free(dt); ret =3D 0; break; @@ -1375,7 +1373,8 @@ static int ddebug_module_notify(struct notifier_block= *self, unsigned long val, =20 switch (val) { case MODULE_STATE_COMING: - ret =3D ddebug_add_module(&mod->dyndbg_info, mod->name); + mod->dyndbg_info.mod_name =3D mod->name; + ret =3D ddebug_add_module(&mod->dyndbg_info); if (ret) WARN(1, "Failed to allocate memory: dyndbg may not work properly.\n"); break; @@ -1473,7 +1472,8 @@ static int __init dynamic_debug_init(void) mod_ct++; di.descs.len =3D mod_sites; di.descs.start =3D iter_mod_start; - ret =3D ddebug_add_module(&di, modname); + di.mod_name =3D modname; + ret =3D ddebug_add_module(&di); if (ret) goto out_err; =20 @@ -1484,7 +1484,8 @@ static int __init dynamic_debug_init(void) } di.descs.len =3D mod_sites; di.descs.start =3D iter_mod_start; - ret =3D ddebug_add_module(&di, modname); + di.mod_name =3D modname; + ret =3D ddebug_add_module(&di); if (ret) goto out_err; =20 --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAACB1F4706 for ; Wed, 2 Apr 2025 17:42:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615763; cv=none; b=Jr2lOSoW52Ov7aEQPGMBohIcOWmpOo9dia5LdgrLSBzMPd4HIDiCBdb1l5nuWT3O32X/xlvsHlqCAu8pa4IoBQPja0Cy7fhgx7MYaQCNmkLVwFtsMz9VJl8l4Y5RBTXWg5UAaBEexojW2XnAVL6ad1ELKB2LfsG4m1PteDkKWBM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615763; c=relaxed/simple; bh=BJj8DhMcosz2MOECicqeQ029oDlmigqSYOHiz7IJVZk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G/1GVQUxUhz+xKwlS6BntE62G5qB/bpMtO5cZdzT4wDimyngae6p445zWIIKgJd/8g4iLTeaYiXR0ZC5YJ/8lfOg00RaR0E2hHH0WHRCgP5RbR8cfnTvApcAbaXqgIFppg4Y1/fKajMH9i1WkyiowRqj6EYvWmqIKjHmD9dLWsw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JKDPur06; arc=none smtp.client-ip=209.85.222.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JKDPur06" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-7c5568355ffso1545285a.0 for ; Wed, 02 Apr 2025 10:42:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615759; x=1744220559; 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=R3MHjWRzkrQ/A+DOE1tFjDQAS2Rp32FGDBMVfKoq9dk=; b=JKDPur06jqtHtrioUM9WSDPe33tK/bkRGf7YjHn9AtYgB7RdlG2ckVYBro/lrpX6+Y 7QaktoR2pm4EHyp5i957iijxnPDLh/4EIeSnHODc9fx6ui3G9pe3dxVURRKRJlALNXbN cRkOQ4nNoW/codU8+0dt6eq2DQL6UlojEhrvGcEAs0NVJnOW0lxrwylvoC75Obw+SwMI kHoow928k1Ox9xJHF5h5S++2rt7d0kS8BjDim6bHxeWJA9DjGJt5T9WErNBFN38lu/bx PDDdqxP9N0DtNeJXQ2eGmsX/r1tgunm/CPxtE1sVnAen9BK+LEZ8es/3fbBsGqVwt03W Fw5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615760; x=1744220560; 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=R3MHjWRzkrQ/A+DOE1tFjDQAS2Rp32FGDBMVfKoq9dk=; b=rGDdrEv1upHj9y6YoNFJYDVDnxOfxFnnsC69GA9CIIkAhWz2SlGwZSLIhgTxv3heLg TgDaOzXCPTjw+JJt0ysx5tiEbErmhrbax5ha8Zm0RdhODLFN3nx/9MwZf3fr16e0jCJD 4DtHZ4m4nk1FL2gXFao1ztmo4pC8LSL0VKN/YpzN8Hd+SCPfD3PAMqwKhOCKYsU3Rguo nC4IoBwuhkFtgGBlhMS6npCYgDOPZ3qm9Sz7pzmWVCBzW/SJeCLTN4XU7KZCdtk1QPHn zh086eqQw7AADNr2Ei/jm4eZdyKvpkZj5aZG2b3bKdHZ5dLX62o5u5TEkHnnyJqDl1gu 1daA== X-Forwarded-Encrypted: i=1; AJvYcCUQLb27cZm2+/TMyi1XM4PqWuo354Rb/ASpiop/Z53taU8gLuuE08ea0eN+adWX7yAgBh7tvpapgE3Ppr4=@vger.kernel.org X-Gm-Message-State: AOJu0YyUTBBaV3eE/T27ntRZi8w6QAWpWSCM24fAUqVPSEA8qVUgsmR5 Xw1EA1pXGvS1303f/XYp37yyzizRhQe257Umtqc2w3m3qvMZBrBOiiYeBGnl X-Gm-Gg: ASbGnctlAJvcT2emzSOwpkIx5vefgG/58m78mWxM9WFqMCJkaO8k4QYlakeShwwUg7l udcGiY9J6LVOWELyGx3m/vC0ckK3l/V2bOHnOMHvU4DoTNwrRM7pPiS/s6S2+4biiWqjRO6OCSp zoP2nQlNCzORy3eLsZC0r//i8s5KxW7TkW+pOzrvvffodcUyd7PnaOkZcdLsyCvc1VZRC1W7iON vcMPgV526j1oFJtWpxs7XCZKT3fJL9suJU6d4XQa0jt619l22NHJNpUs3i5axV7u4v/WXDpal4A fZrqk0dDdAt7ePHTPkO9UC5R4zXrPv2AqGQWP7G7CtG3u5B+lm3IPavixHhFB3o7Pb+CsVw46s4 adLHzbbp3QZu3 X-Google-Smtp-Source: AGHT+IEj53zMTFLLxkXC52KmI6AGH86T4ZHdqCZQEtgg/JAmk4tO1QeXLUin+LF2UhNQvjKH7/sXoQ== X-Received: by 2002:a05:6e02:2703:b0:3d3:d28e:eae9 with SMTP id e9e14a558f8ab-3d6ca5d16efmr104709935ab.7.1743615749446; Wed, 02 Apr 2025 10:42:29 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:29 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 16/54] dyndbg-API: remove DD_CLASS_TYPE_(DISJOINT|LEVEL)_NAMES and code Date: Wed, 2 Apr 2025 11:41:18 -0600 Message-ID: <20250402174156.1246171-17-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Remove the DD_CLASS_TYPE_*_NAMES classmap types and code. These 2 classmap types accept class names at the PARAM interface, for example: echo +DRM_UT_CORE,-DRM_UT_KMS > /sys/module/drm/parameters/debug_names The code works, but its only used by test-dynamic-debug, and wasn't asked for by anyone else, so reduce LOC & test-surface; simplify things. Also rename enum class_map_type to enum ddebug_class_map_type. Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 23 ++------ lib/dynamic_debug.c | 102 +++------------------------------- lib/test_dynamic_debug.c | 26 --------- 3 files changed, 14 insertions(+), 137 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index f4d1d08cd5a7..769f02456c8e 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -58,27 +58,16 @@ struct _ddebug { #endif } __attribute__((aligned(8))); =20 -enum class_map_type { +enum ddebug_class_map_type { DD_CLASS_TYPE_DISJOINT_BITS, /** - * DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, one per bit. - * expecting hex input. Built for drm.debug, basis for other types. + * DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, mapped to bits[0= ..N]. + * Expects hex input. Built for drm.debug, basis for other types. */ DD_CLASS_TYPE_LEVEL_NUM, /** - * DD_CLASS_TYPE_LEVEL_NUM: input is numeric level, 0-N. - * N turns on just bits N-1 .. 0, so N=3D0 turns all bits off. - */ - DD_CLASS_TYPE_DISJOINT_NAMES, - /** - * DD_CLASS_TYPE_DISJOINT_NAMES: input is a CSV of [+-]CLASS_NAMES, - * classes are independent, like _DISJOINT_BITS. - */ - DD_CLASS_TYPE_LEVEL_NAMES, - /** - * DD_CLASS_TYPE_LEVEL_NAMES: input is a CSV of [+-]CLASS_NAMES, - * intended for names like: INFO,DEBUG,TRACE, with a module prefix - * avoid EMERG,ALERT,CRIT,ERR,WARNING: they're not debug + * DD_CLASS_TYPE_LEVEL_NUM: input is numeric level, 0..N. + * Input N turns on bits 0..N-1 */ }; =20 @@ -88,7 +77,7 @@ struct _ddebug_class_map { const char **class_names; const int length; const int base; /* index of 1st .class_id, allows split/shared space */ - enum class_map_type map_type; + enum ddebug_class_map_type map_type; }; =20 /** diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index aff254d39c36..a7e1dbb6ead0 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -646,76 +646,6 @@ static int ddebug_apply_class_bitmap(const struct _dde= bug_class_param *dcp, =20 #define CLASSMAP_BITMASK(width) ((1UL << (width)) - 1) =20 -/* accept comma-separated-list of [+-] classnames */ -static int param_set_dyndbg_classnames(const char *instr, const struct ker= nel_param *kp) -{ - const struct _ddebug_class_param *dcp =3D kp->arg; - const struct _ddebug_class_map *map =3D dcp->map; - unsigned long curr_bits, old_bits; - char *cl_str, *p, *tmp; - int cls_id, totct =3D 0; - bool wanted; - - cl_str =3D tmp =3D kstrdup_and_replace(instr, '\n', '\0', GFP_KERNEL); - if (!tmp) - return -ENOMEM; - - /* start with previously set state-bits, then modify */ - curr_bits =3D old_bits =3D *dcp->bits; - vpr_info("\"%s\" > %s:0x%lx\n", cl_str, KP_NAME(kp), curr_bits); - - for (; cl_str; cl_str =3D p) { - p =3D strchr(cl_str, ','); - if (p) - *p++ =3D '\0'; - - if (*cl_str =3D=3D '-') { - wanted =3D false; - cl_str++; - } else { - wanted =3D true; - if (*cl_str =3D=3D '+') - cl_str++; - } - cls_id =3D match_string(map->class_names, map->length, cl_str); - if (cls_id < 0) { - pr_err("%s unknown to %s\n", cl_str, KP_NAME(kp)); - continue; - } - - /* have one or more valid class_ids of one *_NAMES type */ - switch (map->map_type) { - case DD_CLASS_TYPE_DISJOINT_NAMES: - /* the +/- pertains to a single bit */ - if (test_bit(cls_id, &curr_bits) =3D=3D wanted) { - v3pr_info("no change on %s\n", cl_str); - continue; - } - curr_bits ^=3D BIT(cls_id); - totct +=3D ddebug_apply_class_bitmap(dcp, &curr_bits, *dcp->bits, NULL); - *dcp->bits =3D curr_bits; - v2pr_info("%s: changed bit %d:%s\n", KP_NAME(kp), cls_id, - map->class_names[cls_id]); - break; - case DD_CLASS_TYPE_LEVEL_NAMES: - /* cls_id =3D N in 0..max. wanted +/- determines N or N-1 */ - old_bits =3D CLASSMAP_BITMASK(*dcp->lvl); - curr_bits =3D CLASSMAP_BITMASK(cls_id + (wanted ? 1 : 0 )); - - totct +=3D ddebug_apply_class_bitmap(dcp, &curr_bits, old_bits, NULL); - *dcp->lvl =3D (cls_id + (wanted ? 1 : 0)); - v2pr_info("%s: changed bit-%d: \"%s\" %lx->%lx\n", KP_NAME(kp), cls_id, - map->class_names[cls_id], old_bits, curr_bits); - break; - default: - pr_err("illegal map-type value %d\n", map->map_type); - } - } - kfree(tmp); - vpr_info("total matches: %d\n", totct); - return 0; -} - static int param_set_dyndbg_module_classes(const char *instr, const struct kernel_param *kp, const char *mod_name) @@ -724,29 +654,17 @@ static int param_set_dyndbg_module_classes(const char= *instr, const struct _ddebug_class_map *map =3D dcp->map; unsigned long inrep, new_bits, old_bits; int rc, totct =3D 0; - - switch (map->map_type) { - - case DD_CLASS_TYPE_DISJOINT_NAMES: - case DD_CLASS_TYPE_LEVEL_NAMES: - /* handle [+-]classnames list separately, we are done here */ - return param_set_dyndbg_classnames(instr, kp); - - case DD_CLASS_TYPE_DISJOINT_BITS: - case DD_CLASS_TYPE_LEVEL_NUM: - /* numeric input, accept and fall-thru */ - rc =3D kstrtoul(instr, 0, &inrep); - if (rc) { - pr_err("expecting numeric input: %s > %s\n", instr, KP_NAME(kp)); - return -EINVAL; - } - break; - default: - pr_err("%s: bad map type: %d\n", KP_NAME(kp), map->map_type); + char *nl; + + rc =3D kstrtoul(instr, 0, &inrep); + if (rc) { + nl =3D strchr(instr, '\n'); + if (nl) + *nl =3D '\0'; + pr_err("expecting numeric input, not: %s > %s\n", instr, KP_NAME(kp)); return -EINVAL; } =20 - /* only _BITS,_NUM (numeric) map-types get here */ switch (map->map_type) { case DD_CLASS_TYPE_DISJOINT_BITS: /* expect bits. mask and warn if too many */ @@ -812,12 +730,8 @@ int param_get_dyndbg_classes(char *buffer, const struc= t kernel_param *kp) const struct _ddebug_class_map *map =3D dcp->map; =20 switch (map->map_type) { - - case DD_CLASS_TYPE_DISJOINT_NAMES: case DD_CLASS_TYPE_DISJOINT_BITS: return scnprintf(buffer, PAGE_SIZE, "0x%lx\n", *dcp->bits); - - case DD_CLASS_TYPE_LEVEL_NAMES: case DD_CLASS_TYPE_LEVEL_NUM: return scnprintf(buffer, PAGE_SIZE, "%ld\n", *dcp->lvl); default: diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 8434f70b51bb..9c3e53cd26bd 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -74,13 +74,6 @@ DECLARE_DYNDBG_CLASSMAP(map_disjoint_bits, DD_CLASS_TYPE= _DISJOINT_BITS, 0, DD_SYS_WRAP(disjoint_bits, p); DD_SYS_WRAP(disjoint_bits, T); =20 -/* symbolic input, independent bits */ -enum cat_disjoint_names { LOW =3D 10, MID, HI }; -DECLARE_DYNDBG_CLASSMAP(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, = 10, - "LOW", "MID", "HI"); -DD_SYS_WRAP(disjoint_names, p); -DD_SYS_WRAP(disjoint_names, T); - /* numeric verbosity, V2 > V1 related */ enum cat_level_num { V0 =3D 14, V1, V2, V3, V4, V5, V6, V7 }; DECLARE_DYNDBG_CLASSMAP(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, 14, @@ -88,13 +81,6 @@ DECLARE_DYNDBG_CLASSMAP(map_level_num, DD_CLASS_TYPE_LEV= EL_NUM, 14, DD_SYS_WRAP(level_num, p); DD_SYS_WRAP(level_num, T); =20 -/* symbolic verbosity */ -enum cat_level_names { L0 =3D 22, L1, L2, L3, L4, L5, L6, L7 }; -DECLARE_DYNDBG_CLASSMAP(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, 22, - "L0", "L1", "L2", "L3", "L4", "L5", "L6", "L7"); -DD_SYS_WRAP(level_names, p); -DD_SYS_WRAP(level_names, T); - /* stand-in for all pr_debug etc */ #define prdbg(SYM) __pr_debug_cls(SYM, #SYM " msg\n") =20 @@ -102,10 +88,6 @@ static void do_cats(void) { pr_debug("doing categories\n"); =20 - prdbg(LOW); - prdbg(MID); - prdbg(HI); - prdbg(D2_CORE); prdbg(D2_DRIVER); prdbg(D2_KMS); @@ -129,14 +111,6 @@ static void do_levels(void) prdbg(V5); prdbg(V6); prdbg(V7); - - prdbg(L1); - prdbg(L2); - prdbg(L3); - prdbg(L4); - prdbg(L5); - prdbg(L6); - prdbg(L7); } =20 static void do_prints(void) --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01C661F3BAF; Wed, 2 Apr 2025 17:42:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615756; cv=none; b=sjho9YFx5GjZ6zbNBISWob3IzJ5xuDLbuZ/s87qkB+An1PiDDjI93h5rDgvDssKMqhelDaG3FR+DtwjLEzIYQjgMbamBX6Kh0BEZAr9SV1M3Mbj/r28KTi6tW7ivXO/Vo3ctCY1XRyuwYWCp3B3p9XAZ46lCSZI7zl8nUh/0UHk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615756; c=relaxed/simple; bh=uGSKyzfe/s9RYOPQfPSPTn/akPUs+VYEuhdYNjGrPJE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JNjXW1ygtcQourC5YDoVOXZ0tBa58eoL0F1d/k8MPuCWgvDTmtpFf+r940KtfFo1TgfkcCppb9f2d0XZ3fp+HhA73kGN2l5Pn9VxUFL945fr/vIw8A2xZgWAOqlxk4Z/SrO0YXJ+jGLjw2oqkS8RVP36Kn7Af64gHL/IIwJZzc0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Q6z5ATWo; arc=none smtp.client-ip=209.85.166.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Q6z5ATWo" Received: by mail-io1-f50.google.com with SMTP id ca18e2360f4ac-85e751cffbeso2911639f.0; Wed, 02 Apr 2025 10:42:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615751; x=1744220551; 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=4tJY1DDUkQNjkUwg1wD9+v+fTMYBZ/tdDYVV/Hca3Y0=; b=Q6z5ATWoprFWdnjqeC9rsSrYQ6nd157qFnLlK5yKZPbz1wIbf1tPkZbV7mT2bzk+o0 TBZG/uF79HPK+nz2cUOakgqZ3ktbPcj+njw26DJ8O8Eab9dJCW/wcoeyFWKpdUbpWghl XjfeOfnqRBrXWlDDLNXyVQAp8rSNFZwc30hP9BlOxKI624BTYhx2k77A9NXuupRyEpmr t3pk/ZKwxPIZfh/9PshxFrG6LqCvfp55v/Wl2IVojwZTon61WIwR6lgHLrVnDFUMbppj lFEPrWkcv9GAi0fobHVJyrjzjZ59sk/G/UFfOt9vTbxeA7RMgYBWrnv4kagz3XG+xRsW pWmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615751; x=1744220551; 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=4tJY1DDUkQNjkUwg1wD9+v+fTMYBZ/tdDYVV/Hca3Y0=; b=ZoCog1JfAvzoVZjZGswpzh1oXMz3JttsjjlG65CRfaMyAL1B1hNUHbu3NW42+NnwiM ut/MBEjhllDvhNaTs9r3RGHm8bo08J/KeqZlrpmRqAVVW5fdhyNIofFh3i5B3DABcNeb HDZ87LFjebLAtrCXcPfZhjfE0RAB54mAmmdlZ8SYnHxQ4GAu9kpnQjdoeKEKNYZEUUEG WNfZKCj2/0njqm76hxPE3Off18/D8c8wQoFY/RJfqCfpAWzo+wRzeXVxx6IMZvWVKZ4t oD8uN3wNAAIZ5b5H3flJkXHA9hq7wDT9D51l2b6SYnMcylGm8degtxFN1nZgUx9GrFQk A0Pw== X-Forwarded-Encrypted: i=1; AJvYcCWT/kH8vsFdZf0lwLzbiBlre6UXQbYnJf810kigb+1SO17qbISD0nQtZh9uFwuOxJshjNS4CHq7zcM=@vger.kernel.org, AJvYcCX4Fefo0qbLLNRjKORlFAbmz1zaqCCHTg0vTqCD+uwQVNNWCjWCZ+hFRgip8F2nkyaKD8zJ+O4uDzz7H20I@vger.kernel.org X-Gm-Message-State: AOJu0YzSlIucy8lmSghnWBnsJ4RLNhb3/V7rQD0/iSldAasxGrsNLb+U cdnQpIpmJNWYzI9Jwkt1Ze93vw1O7ou5t32NMKj46OwjxzfUBtIk X-Gm-Gg: ASbGncsER7qLbJx9wlNK0AtOCyIeM+0aRBdYgAjX8hj/p90PG1mhcSuDzRUkY0sPfh5 GwOzf+eDACzKNV0cddZCz21uXOWEgUZ4/W6C9rRCiFbdECubB6KCUBqkI0sfiKvONFBBF4Dmmw0 ZzRoNSiJyRhJSbHVVmKcf8hZRQgD7eQunIcH/SZEP9OssqpyRG1RWJLDkpwIeTfyHojAYGlwv5U CBpv7gdGm4AGFu2m4aieiXX5kF0QGkvGkTxHAalVyyjfbhTr+gOTwj4leOWHhKHGoXo/RqapHyR L861o3PjlvlvZKIoG8d6GCysS2WrQVcEI2hkG+gHWaS4RLOwdRgtd0xrF2AwNbZFz8XATPvSoyM EYw== X-Google-Smtp-Source: AGHT+IHo/6HCB0U6tQ+mr8AHNrH1ynuf7YdCl4CRrifZBjkKnXYVRImavR2toyBOykynzBDVV7DFIg== X-Received: by 2002:a05:6e02:3304:b0:3d3:dfc2:912f with SMTP id e9e14a558f8ab-3d5e0908ffemr200276395ab.7.1743615750631; Wed, 02 Apr 2025 10:42:30 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:30 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie , linux-doc@vger.kernel.org Subject: [PATCH v3 17/54] dyndbg-API: replace DECLARE_DYNDBG_CLASSMAP Date: Wed, 2 Apr 2025 11:41:19 -0600 Message-ID: <20250402174156.1246171-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" DECLARE_DYNDBG_CLASSMAP() has a design error; its usage fails a basic K&R rule: "define once, refer many times". When DRM_USE_DYNAMIC_DEBUG=3Dy, it is used across DRM core & drivers; each invocation allocates/inits the classmap understood by that module. All must match for the modules to respond together when DRM.debug categories are enabled. This is brittle; a maintenance foot-gun. Further, its culpable in the CONFIG_DRM_USE_DYNAMIC_DEBUG=3DY regression; its use in both core & drivers obfuscates the 2 roles, that caused incomplete initialization when modprobing drivers: 1st drm.ko loads, and dyndbg initializes its DRM.debug callsites, then a drm-driver loads, but too late for the DRM.debug enablement. So retire it, replace with 2 macros: DYNAMIC_DEBUG_CLASSMAP_DEFINE - invoked once from core - drm.ko DYNAMIC_DEBUG_CLASSMAP_USE - from all drm drivers and helpers. DYNAMIC_DEBUG_CLASSMAP_DEFINE: this reworks DECLARE_DYNDBG_CLASSMAP, by dropping the static qualifier on the classmap, and exporting it instead. DYNAMIC_DEBUG_CLASSMAP_USE: then refers to the exported var by name: used from drivers, helper-mods lets us drop the repetitive "classname" declarations fixes 2nd-defn problem creates a ddebug_class_user record in new __dyndbg_class_users section new section is scanned "differently" DECLARE_DYNDBG_CLASSMAP is preserved temporarily, to decouple DRM adaptation work and avoid compile-errs before its done. IOW, DRM gets these fixes when they commit the adopt-new-api patches. The DEFINE,USE distinction, and the separate classmap-use record, allows dyndbg to initialize the driver's & helper's DRM.debug callsites separately after each is modprobed. Basically, the classmap init-scan is repeated for classmap-users. To review, dyndbg's existing __dyndbg_classes[] section does: . catalogs the module's classmaps . tells dyndbg about them, allowing >control . DYNAMIC_DEBUG_CLASSMAP_DEFINE creates section records. . we rename it to: __dyndbg_class_maps[] Then this patch adds __dyndbg_class_users[] section: . catalogs users of classmap definitions elsewhere . authorizes dyndbg to >control user's class'd prdbgs . DYNAMIC_DEBUG_CLASSMAP_USE() creates section records. Now ddebug_add_module(etal) can handle classmap-uses similar to (and after) classmaps; when a dependent module is loaded, if it has classmap-uses (to a classmap-def in another module), that module's kernel params are scanned to find if it has a kparam that is wired to dyndbg's param-ops, and whose classmap is the one being ref'd. To support this, theres a few data/header changes: new struct ddebug_class_user contains: user-module-name, &classmap-defn it records drm-driver's use of a classmap in the section, allowing lookup struct ddebug_info gets 2 new fields for the new sections: class_users, num_class_users. set by dynamic_debug_init() for builtins. or by kernel/module/main:load_info() for loadable modules. vmlinux.lds.h: new BOUNDED_SECTION for __dyndbg_class_users dynamic_debug.c has 2 changes in ddebug_add_module(), ddebug_change(): ddebug_add_module() called ddebug_attach_module_classes() now calls ddebug_apply_class_maps() & ddebug_apply_class_users() these both call ddebug_apply_params(). ddebug_apply_params(new fn): It scans module's/builtin kernel-params, calls ddebug_match_apply_kparam for each to find any params/sysfs-nodes which may be wired to a classmap. ddebug_match_apply_kparam(new fn): 1st, it tests the kernel-param.ops is dyndbg's; this guarantees that the attached arg is a struct ddebug_class_param, which has a ref to the param's state, and to the classmap defining the param's handling. 2nd, it requires that the classmap ref'd by the kparam is the one we're called for; modules can use many separate classmaps (as test_dynamic_debug does). Then apply the "parent" kparam's setting to the dependent module, using ddebug_apply_class_bitmap(). ddebug_change(and callees) also gets adjustments: ddebug_find_valid_class(): This does a search over the module's classmaps, looking for the class FOO echo'd to >control. So now it searches over __dyndbg_class_users[] after __dyndbg_classes[]. ddebug_class_name(): return class-names for defined AND used classes. test_dynamic_debug.c, test_dynamic_debug_submod.c: This demonstrates the 2 types of classmaps & sysfs-params, following the 4-part recipe: 1. define an enum for the classmap: DRM.debug has DRM_UT_{CORE,KMS,...} multiple classes must share 0-62 classid space. 2. DYNAMIC_DEBUG_CLASSMAP_DEFINE(.. DRM_UT_{CORE,KMS,...}) 3. DYNAMIC_DEBUG_CLASSMAP_PARAM* (classmap) 4. DYNAMIC_DEBUG_CLASSMAP_USE() by _submod only, skipping 2,3 Move all the enum declarations together, to better explain how they share the 0..62 class-id space available to a module (non-overlapping subranges). reorg macros 2,3 by name. This gives a tabular format, making it easy to see the pattern of repetition, and the points of change. And extend the test to replicate the 2-module (parent & dependent) scenario which caused the CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy regression seen in drm & drivers. The _submod.c is a 2-line file: #define _SUBMOD, #include parent. This gives identical complements of prdbgs in parent & _submod, and thus identical print behavior when all of: >control, >params, and parent->_submod propagation are working correctly. It also puts all the parent/_submod declarations together in the same source, with the new ifdef _SUBMOD block invoking DYNAMIC_DEBUG_CLASSMAP_USE for the 2 test-interfaces. I think this is clearer. These 2 modules are both tristate, allowing 3 super/sub combos: Y/Y, Y/M, M/M (not N/Y, since this is disallowed by dependence). Y/Y testing exposed a missing __align(8) in the _METADATA macro, which M/M didn't see because the module-loader memory placement constrains it instead. Fixes: aad0214f3026 ("dyndbg: add DECLARE_DYNDBG_CLASSMAP macro") cc: linux-doc@vger.kernel.org Signed-off-by: Jim Cromie --- v3- undo 1.9 simplification of ddebug_find_valid_class() ddebug_change needs map to see its controlling param change internal callchains to pass di, not dt v2 a. building 2 .ko's from 1 source file is weird; add a clear comment at the top to justify it (basically cloning) ln 138+ in commit-msg is insufficient. b. retire "DYNDBG_" name shortening b4 adding _CLASSMAP_* macros. c. s/dd_class/_ddebug_class/ d. s/\bddebug\b/_$1/g in header: chgs 1 struct and UNIQUE_ID bases v1.9 - commit-msg tweaks DRM:CHECK warnings on macros: add parens extern DEFINEd _var, static classnames change ddebug_class_user.user_mod_name to .mod_name simplify ddebug_find_valid_class return val improve vpr_cm_info msg format wrap (base) in macro body move __DYNDBG_CLASSMAP_CHECK above kdoc for DYNDBG_CLASSMAP_DEFINE v1.8 - split drm parts to separate commits. preserve DECLARE_DYNDBG_CLASSMAP to decouple DRM, no flag day. fixup block comment v1.7 - previous submission-blocking bug: missing __align(8) in DYNAMIC_DEBUG_DECLARE_METADATA on ddebug_class_user caused corrupt records, but only for builtin modules; module loader code probably pinned allocations to the right alignment naturally, hiding the bug for typical builds. v6- get rid of WARN_ON_ONCE v?- fix _var expanded 2x in macro dyndbg: This fn formerly returned the map which contained the class (thus validating it), and as a side-effect set the class-id in an outvar. But the caller didn't use the map (after checking its not null), only the valid class-id. So simplify the fn to return the class-id of the validated classname, or -ENOENT when the queried classname is not found. Convey more useful info in the debug-msg: print class-names[0,last], and [base,+len] instead of the class-type printout, which is almost always "type:DISJOINT_BITS". And drop ddebug_classmap_typenames, which is now unused. [root@v6 b0-dd]# modprobe test_dynamic_debug_submod [ 18.864962] dyndbg: loaded classmap: test_dynamic_debug [16..24] V0..V7 [ 18.865046] dyndbg: found kp:p_level_num =3D0x0 [ 18.865048] dyndbg: mapped to: test_dynamic_debug [16..24] V0..V7 [ 18.865164] dyndbg: p_level_num: lvl:0 bits:0x0 [ 18.865217] dyndbg: loaded classmap: test_dynamic_debug [0..10] D2_CORE.= .D2_DRMRES [ 18.865297] dyndbg: found kp:p_disjoint_bits =3D0x0 [ 18.865298] dyndbg: mapped to: test_dynamic_debug [0..10] D2_CORE..D2_= DRMRES [ 18.865424] dyndbg: p_disjoint_bits: classbits: 0x0 [ 18.865472] dyndbg: module:test_dynamic_debug attached 2 classmaps [ 18.865533] dyndbg: 23 debug prints in module test_dynamic_debug [ 18.866558] dyndbg: loaded classmap: test_dynamic_debug_submod [16..24] = V0..V7 [ 18.866698] dyndbg: found kp:p_level_num =3D0x0 [ 18.866699] dyndbg: mapped to: test_dynamic_debug_submod [16..24] V0..= V7 [ 18.866865] dyndbg: p_level_num: lvl:0 bits:0x0 [ 18.866926] dyndbg: loaded classmap: test_dynamic_debug_submod [0..10] D= 2_CORE..D2_DRMRES [ 18.867026] dyndbg: found kp:p_disjoint_bits =3D0x0 [ 18.867027] dyndbg: mapped to: test_dynamic_debug_submod [0..10] D2_CO= RE..D2_DRMRES [ 18.867193] dyndbg: p_disjoint_bits: classbits: 0x0 [ 18.867255] dyndbg: module:test_dynamic_debug_submod attached 2 classmap= uses [ 18.867351] dyndbg: 23 debug prints in module test_dynamic_debug_submod fixup-test-submod fixup-test Signed-off-by: Jim Cromie --- MAINTAINERS | 2 +- include/asm-generic/vmlinux.lds.h | 1 + include/linux/dynamic_debug.h | 93 +++++++++++++++++--- kernel/module/main.c | 3 + lib/Kconfig.debug | 24 ++++-- lib/Makefile | 3 + lib/dynamic_debug.c | 137 +++++++++++++++++++++++++++--- lib/test_dynamic_debug.c | 132 ++++++++++++++++++++-------- lib/test_dynamic_debug_submod.c | 14 +++ 9 files changed, 343 insertions(+), 66 deletions(-) create mode 100644 lib/test_dynamic_debug_submod.c diff --git a/MAINTAINERS b/MAINTAINERS index 00e94bec401e..1c5fcbd9e408 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8139,7 +8139,7 @@ M: Jim Cromie S: Maintained F: include/linux/dynamic_debug.h F: lib/dynamic_debug.c -F: lib/test_dynamic_debug.c +F: lib/test_dynamic_debug*.c =20 DYNAMIC INTERRUPT MODERATION M: Tal Gilboa diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinu= x.lds.h index f834ad1fb8c4..fa382caf2ae2 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -367,6 +367,7 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELL= ER_CLANG) /* implement dynamic printk debug */ \ . =3D ALIGN(8); \ BOUNDED_SECTION_BY(__dyndbg_class_maps, ___dyndbg_class_maps) \ + BOUNDED_SECTION_BY(__dyndbg_class_users, ___dyndbg_class_users) \ BOUNDED_SECTION_BY(__dyndbg_descriptors, ___dyndbg_descs) \ CODETAG_SECTIONS() \ LIKELY_PROFILE() \ diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 769f02456c8e..9af825c84e70 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -71,9 +71,28 @@ enum ddebug_class_map_type { */ }; =20 +/* + * dyndbg-classmaps are devised to support DRM.debug directly: + * 10 enum-vals: DRM_UT_* define the categories + * ~23 categorized *_dbg() macros, each passing a DRM_UT_* val as 1st arg + * 2 macros below them: drm_dev_dbg, __drm_dbg + * ~5000 calls to the categorized macros, across all of drivers/gpu/drm/ + * + * When CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy, the 2 low macros are redefined + * to invoke _dynamic_func_call_cls(). This compiles the category + * into each callsite's class_id field, where dyndbg can select on it + * and alter a callsite's patch-state, avoiding repeated __drm_debug + * checks. + * + * To make the callsites manageable from the >control file, authors + * provide a "classmap" of names to class_ids in use by the module(s), + * usually by stringifying the enum-vals. Modules with multiple + * classmaps must arrange to share the 0..62 class_id space. + */ + struct _ddebug_class_map { - struct module *mod; - const char *mod_name; /* needed for builtins */ + const struct module *mod; /* NULL for builtins */ + const char *mod_name; const char **class_names; const int length; const int base; /* index of 1st .class_id, allows split/shared space */ @@ -81,11 +100,34 @@ struct _ddebug_class_map { }; =20 /** - * DECLARE_DYNDBG_CLASSMAP - declare classnames known by a module - * @_var: a struct _ddebug_class_map, passed to module_param_cb - * @_type: enum class_map_type, chooses bits/verbose, numeric/symbolic - * @_base: offset of 1st class-name. splits .class_id space - * @classes: class-names used to control class'd prdbgs + * DYNAMIC_DEBUG_CLASSMAP_DEFINE - define debug classes used by a module. + * @_var: name of the classmap, exported for other modules coordinated u= se. + * @_mapty: enum ddebug_class_map_type: 0:DISJOINT - independent, 1:LEVEL = - v2>v1 + * @_base: reserve N classids starting at _base, to split 0..62 classid s= pace + * @classes: names of the N classes. + * + * This tells dyndbg what class_ids the module is using: _base..+N, by + * mapping names onto them. This qualifies "class NAME" >controls on + * the defining module, ignoring unknown names. + */ +#define DYNAMIC_DEBUG_CLASSMAP_DEFINE(_var, _mapty, _base, ...) \ + static const char *_var##_classnames[] =3D { __VA_ARGS__ }; \ + extern struct _ddebug_class_map _var; \ + struct _ddebug_class_map __aligned(8) __used \ + __section("__dyndbg_class_maps") _var =3D { \ + .mod =3D THIS_MODULE, \ + .mod_name =3D KBUILD_MODNAME, \ + .base =3D (_base), \ + .map_type =3D (_mapty), \ + .length =3D ARRAY_SIZE(_var##_classnames), \ + .class_names =3D _var##_classnames, \ + }; \ + EXPORT_SYMBOL(_var) + +/* + * XXX: keep this until DRM adapts to use the DEFINE/USE api, it + * differs from DYNAMIC_DEBUG_CLASSMAP_DEFINE by the lack of the + * extern/EXPORT on the struct init, and cascading thinkos. */ #define DECLARE_DYNDBG_CLASSMAP(_var, _maptype, _base, ...) \ static const char *_var##_classnames[] =3D { __VA_ARGS__ }; \ @@ -99,10 +141,35 @@ struct _ddebug_class_map { .class_names =3D _var##_classnames, \ } =20 +struct _ddebug_class_user { + char *mod_name; + struct _ddebug_class_map *map; +}; + +/** + * DYNAMIC_DEBUG_CLASSMAP_USE - refer to a classmap, DEFINEd elsewhere. + * @_var: name of the exported classmap var + * + * This tells dyndbg that the module has prdbgs with classids defined + * in the named classmap. This qualifies "class NAME" >controls on + * the user module, ignoring unknown names. + */ +#define DYNAMIC_DEBUG_CLASSMAP_USE(_var) \ + DYNAMIC_DEBUG_CLASSMAP_USE_(_var, __UNIQUE_ID(_ddebug_class_user)) +#define DYNAMIC_DEBUG_CLASSMAP_USE_(_var, _uname) \ + extern struct _ddebug_class_map _var; \ + static struct _ddebug_class_user __aligned(8) __used \ + __section("__dyndbg_class_users") _uname =3D { \ + .mod_name =3D KBUILD_MODNAME, \ + .map =3D &(_var), \ + } + /* - * @_ddebug_info: gathers module/builtin dyndbg_* __sections together. + * @_ddebug_info: gathers module/builtin __dyndbg_ __sections + * together, each is a vector: a struct { *addr, int len }. + * * For builtins, it is used as a cursor, with the inner structs - * marking sub-vectors of the builtin __sections in DATA. + * marking sub-vectors of the builtin __sections in DATA_DATA */ struct _ddebug_descs { struct _ddebug *start; @@ -114,10 +181,16 @@ struct _ddebug_class_maps { int len; } __packed; =20 +struct _ddebug_class_users { + struct _ddebug_class_user *start; + int len; +} __packed; + struct _ddebug_info { const char *mod_name; struct _ddebug_descs descs; struct _ddebug_class_maps maps; + struct _ddebug_class_users users; } __packed; =20 struct _ddebug_class_param { @@ -218,7 +291,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, * (|_no_desc): former gets callsite descriptor as 1st arg (for prdbgs) */ #define __dynamic_func_call_cls(id, cls, fmt, func, ...) do { \ - DEFINE_DYNAMIC_DEBUG_METADATA_CLS(id, cls, fmt); \ + DEFINE_DYNAMIC_DEBUG_METADATA_CLS((id), cls, fmt); \ if (DYNAMIC_DEBUG_BRANCH(id)) \ func(&id, ##__VA_ARGS__); \ } while (0) diff --git a/kernel/module/main.c b/kernel/module/main.c index b60f728e36ac..c203b0694f7e 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2627,6 +2627,9 @@ static int find_module_sections(struct module *mod, s= truct load_info *info) mod->dyndbg_info.maps.start =3D section_objs(info, "__dyndbg_class_maps", sizeof(*mod->dyndbg_info.maps.start), &mod->dyndbg_info.maps.len); + mod->dyndbg_info.users.start =3D section_objs(info, "__dyndbg_class_users= ", + sizeof(*mod->dyndbg_info.users.start), + &mod->dyndbg_info.users.len); #endif =20 return 0; diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 35796c290ca3..91a75f724c1a 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2905,12 +2905,26 @@ config TEST_STATIC_KEYS If unsure, say N. =20 config TEST_DYNAMIC_DEBUG - tristate "Test DYNAMIC_DEBUG" - depends on DYNAMIC_DEBUG + tristate "Build test-dynamic-debug module" + depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE help - This module registers a tracer callback to count enabled - pr_debugs in a 'do_debugging' function, then alters their - enablements, calls the function, and compares counts. + This module exercises/demonstrates dyndbg's classmap API, by + creating 2 classes: a DISJOINT classmap (supporting DRM.debug) + and a LEVELS/VERBOSE classmap (like verbose2 > verbose1). + + If unsure, say N. + +config TEST_DYNAMIC_DEBUG_SUBMOD + tristate "Build test-dynamic-debug submodule" + default m + depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE + depends on TEST_DYNAMIC_DEBUG + help + This sub-module uses a classmap defined and exported by the + parent module, recapitulating drm & driver's shared use of + drm.debug to control enabled debug-categories. + It is tristate, independent of parent, to allow testing all + proper combinations of parent=3Dy/m submod=3Dy/m. =20 If unsure, say N. =20 diff --git a/lib/Makefile b/lib/Makefile index d5cfc7afbbb8..2c344138d990 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -84,6 +84,7 @@ obj-$(CONFIG_TEST_SORT) +=3D test_sort.o obj-$(CONFIG_TEST_STATIC_KEYS) +=3D test_static_keys.o obj-$(CONFIG_TEST_STATIC_KEYS) +=3D test_static_key_base.o obj-$(CONFIG_TEST_DYNAMIC_DEBUG) +=3D test_dynamic_debug.o +obj-$(CONFIG_TEST_DYNAMIC_DEBUG_SUBMOD) +=3D test_dynamic_debug_submod.o obj-$(CONFIG_TEST_PRINTF) +=3D test_printf.o obj-$(CONFIG_TEST_SCANF) +=3D test_scanf.o =20 @@ -226,6 +227,8 @@ obj-$(CONFIG_ARCH_NEED_CMPXCHG_1_EMU) +=3D cmpxchg-emu.o obj-$(CONFIG_DYNAMIC_DEBUG_CORE) +=3D dynamic_debug.o #ensure exported functions have prototypes CFLAGS_dynamic_debug.o :=3D -DDYNAMIC_DEBUG_MODULE +CFLAGS_test_dynamic_debug.o :=3D -DDYNAMIC_DEBUG_MODULE +CFLAGS_test_dynamic_debug_submod.o :=3D -DDYNAMIC_DEBUG_MODULE =20 obj-$(CONFIG_SYMBOLIC_ERRNAME) +=3D errname.o =20 diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index a7e1dbb6ead0..53e261dbf81e 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -29,6 +29,7 @@ #include #include #include + #include #include #include @@ -43,6 +44,8 @@ extern struct _ddebug __start___dyndbg_descs[]; extern struct _ddebug __stop___dyndbg_descs[]; extern struct _ddebug_class_map __start___dyndbg_class_maps[]; extern struct _ddebug_class_map __stop___dyndbg_class_maps[]; +extern struct _ddebug_class_user __start___dyndbg_class_users[]; +extern struct _ddebug_class_user __stop___dyndbg_class_users[]; =20 struct ddebug_table { struct list_head link; @@ -159,20 +162,37 @@ static void vpr_info_dq(const struct ddebug_query *qu= ery, const char *msg) query->first_lineno, query->last_lineno, query->class_string); } =20 -static struct _ddebug_class_map *ddebug_find_valid_class(struct ddebug_tab= le const *dt, - const char *class_string, - int *class_id) +#define vpr_di_info(di_p, msg_p, ...) ({ \ + struct _ddebug_info const *_di =3D di_p; \ + v2pr_info(msg_p " module:%s nd:%d nc:%d nu:%d\n", ##__VA_ARGS__, \ + _di->mod_name, _di->descs.len, _di->maps.len, \ + _di->users.len); \ + }) + +static struct _ddebug_class_map * +ddebug_find_valid_class(struct _ddebug_info const *di, const char *query_c= lass, int *class_id) { struct _ddebug_class_map *map; + struct _ddebug_class_user *cli; int i, idx; =20 - for_subvec(i, map, &dt->info, maps) { - idx =3D match_string(map->class_names, map->length, class_string); + for_subvec(i, map, di, maps) { + idx =3D match_string(map->class_names, map->length, query_class); if (idx >=3D 0) { + vpr_di_info(di, "good-class: %s.%s ", map->mod_name, query_class); *class_id =3D idx + map->base; return map; } } + for_subvec(i, cli, di, users) { + idx =3D match_string(cli->map->class_names, cli->map->length, query_clas= s); + if (idx >=3D 0) { + vpr_di_info(di, "class-ref: %s -> %s.%s ", + cli->mod_name, cli->map->mod_name, query_class); + *class_id =3D idx + cli->map->base; + return cli->map; + } + } *class_id =3D -ENOENT; return NULL; } @@ -183,8 +203,7 @@ static struct _ddebug_class_map *ddebug_find_valid_clas= s(struct ddebug_table con * callsites, normally the same as number of changes. If verbose, * logs the changes. Takes ddebug_lock. */ -static int ddebug_change(const struct ddebug_query *query, - struct flag_settings *modifiers) +static int ddebug_change(const struct ddebug_query *query, struct flag_set= tings *modifiers) { int i; struct ddebug_table *dt; @@ -204,7 +223,8 @@ static int ddebug_change(const struct ddebug_query *que= ry, continue; =20 if (query->class_string) { - map =3D ddebug_find_valid_class(dt, query->class_string, &valid_class); + map =3D ddebug_find_valid_class(&dt->info, query->class_string, + &valid_class); if (!map) continue; } else { @@ -569,7 +589,7 @@ static int ddebug_exec_query(char *query_string, const = char *modname) =20 /* handle multiple queries in query string, continue on error, return last error or number of matching callsites. Module name is either - in param (for boot arg) or perhaps in query string. + in the modname arg (for boot args) or perhaps in query string. */ static int ddebug_exec_queries(char *query, const char *modname) { @@ -700,7 +720,7 @@ static int param_set_dyndbg_module_classes(const char *= instr, /** * param_set_dyndbg_classes - classmap kparam setter * @instr: string echo>d to sysfs, input depends on map_type - * @kp: kp->arg has state: bits/lvl, map, map_type + * @kp: kp->arg has state: bits/lvl, classmap, map_type * * enable/disable all class'd pr_debugs in the classmap. For LEVEL * map-types, enforce * relative levels by bitpos. @@ -737,6 +757,7 @@ int param_get_dyndbg_classes(char *buffer, const struct= kernel_param *kp) default: return -1; } + return 0; } EXPORT_SYMBOL(param_get_dyndbg_classes); =20 @@ -1049,12 +1070,17 @@ static void *ddebug_proc_next(struct seq_file *m, v= oid *p, loff_t *pos) static const char *ddebug_class_name(struct _ddebug_info *di, struct _ddeb= ug *dp) { struct _ddebug_class_map *map; + struct _ddebug_class_user *cli; int i; =20 for_subvec(i, map, di, maps) if (class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; =20 + for_subvec(i, cli, di, users) + if (class_in_range(dp->class_id, cli->map)) + return cli->map->class_names[dp->class_id - cli->map->base]; + return NULL; } =20 @@ -1135,9 +1161,85 @@ static const struct proc_ops proc_fops =3D { .proc_write =3D ddebug_proc_write }; =20 -static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _= ddebug_info *di) +#define vpr_cm_info(cm_p, msg_fmt, ...) ({ \ + struct _ddebug_class_map const *_cm =3D cm_p; \ + v2pr_info(msg_fmt " %s [%d..%d] %s..%s\n", ##__VA_ARGS__, \ + _cm->mod_name, _cm->base, _cm->base + _cm->length, \ + _cm->class_names[0], _cm->class_names[_cm->length - 1]); \ + }) + +static void ddebug_sync_classbits(const struct kernel_param *kp, const cha= r *modname) +{ + const struct _ddebug_class_param *dcp =3D kp->arg; + + /* clamp initial bitvec, mask off hi-bits */ + if (*dcp->bits & ~CLASSMAP_BITMASK(dcp->map->length)) { + *dcp->bits &=3D CLASSMAP_BITMASK(dcp->map->length); + v2pr_info("preset classbits: %lx\n", *dcp->bits); + } + /* force class'd prdbgs (in USEr module) to match (DEFINEr module) class-= param */ + ddebug_apply_class_bitmap(dcp, dcp->bits, ~0, modname); + ddebug_apply_class_bitmap(dcp, dcp->bits, 0, modname); +} + +static void ddebug_match_apply_kparam(const struct kernel_param *kp, + const struct _ddebug_class_map *map, + const char *mod_name) +{ + struct _ddebug_class_param *dcp; + + if (kp->ops !=3D ¶m_ops_dyndbg_classes) + return; + + dcp =3D (struct _ddebug_class_param *)kp->arg; + + if (map =3D=3D dcp->map) { + v2pr_info(" kp:%s.%s =3D0x%lx", mod_name, kp->name, *dcp->bits); + vpr_cm_info(map, " %s mapped to: ", mod_name); + ddebug_sync_classbits(kp, mod_name); + } +} + +static void ddebug_apply_params(const struct _ddebug_class_map *cm, const = char *mod_name) +{ + const struct kernel_param *kp; +#if IS_ENABLED(CONFIG_MODULES) + int i; + + if (cm->mod) { + vpr_cm_info(cm, "loaded classmap: %s", mod_name); + /* ifdef protects the cm->mod->kp deref */ + for (i =3D 0, kp =3D cm->mod->kp; i < cm->mod->num_kp; i++, kp++) + ddebug_match_apply_kparam(kp, cm, mod_name); + } +#endif + if (!cm->mod) { + vpr_cm_info(cm, "builtin classmap: %s", mod_name); + for (kp =3D __start___param; kp < __stop___param; kp++) + ddebug_match_apply_kparam(kp, cm, mod_name); + } +} + +static void ddebug_apply_class_maps(const struct _ddebug_info *di) +{ + struct _ddebug_class_map *cm; + int i; + + for_subvec(i, cm, di, maps) + ddebug_apply_params(cm, cm->mod_name); + + vpr_di_info(di, "attached %d classmaps to module: %s ", i, cm->mod_name); +} + +static void ddebug_apply_class_users(const struct _ddebug_info *di) { - vpr_info("module:%s attached %d classes\n", dt->info.mod_name, dt->info.m= aps.len); + struct _ddebug_class_user *cli; + int i; + + for_subvec(i, cli, di, users) + ddebug_apply_params(cli->map, cli->mod_name); + + vpr_di_info(di, "attached %d class-users to module: %s ", i, cli->mod_nam= e); } =20 /* @@ -1173,6 +1275,7 @@ static int ddebug_add_module(struct _ddebug_info *di) { struct ddebug_table *dt; struct _ddebug_class_map *cm; + struct _ddebug_class_user *cli; int i; =20 if (!di->descs.len) @@ -1196,14 +1299,18 @@ static int ddebug_add_module(struct _ddebug_info *d= i) INIT_LIST_HEAD(&dt->link); =20 dd_mark_vector_subrange(i, dt, cm, di, maps); + dd_mark_vector_subrange(i, dt, cli, di, users); =20 - if (di->maps.len) - ddebug_attach_module_classes(dt, di); + if (dt->info.maps.len) + ddebug_apply_class_maps(&dt->info); =20 mutex_lock(&ddebug_lock); list_add_tail(&dt->link, &ddebug_tables); mutex_unlock(&ddebug_lock); =20 + if (dt->info.users.len) + ddebug_apply_class_users(&dt->info); + vpr_info("%3u debug prints in module %s\n", di->descs.len, di->mod_name); return 0; } @@ -1354,8 +1461,10 @@ static int __init dynamic_debug_init(void) struct _ddebug_info di =3D { .descs.start =3D __start___dyndbg_descs, .maps.start =3D __start___dyndbg_class_maps, + .users.start =3D __start___dyndbg_class_users, .descs.len =3D __stop___dyndbg_descs - __start___dyndbg_descs, .maps.len =3D __stop___dyndbg_class_maps - __start___dyndbg_class_maps, + .users.len =3D __stop___dyndbg_class_users - __start___dyndbg_class_user= s, }; =20 #ifdef CONFIG_MODULES diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 9c3e53cd26bd..1070107f74f1 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -6,11 +6,30 @@ * Jim Cromie */ =20 -#define pr_fmt(fmt) "test_dd: " fmt +/* + * This file is built 2x, also making test_dynamic_debug_submod.ko, + * whose 2-line src file #includes this file. This gives us a _submod + * clone with identical pr_debugs, without further maintenance. + * + * If things are working properly, they should operate identically + * when printed or adjusted by >control. This eases visual perusal of + * the logs, and simplifies testing, by easing the proper accounting + * of expectations. + * + * It also puts both halves of the subsystem _DEFINE & _USE use case + * together, and integrates the common ENUM providing both class_ids + * and class-names to both _DEFINErs and _USERs. I think this makes + * the usage clearer. + */ +#if defined(TEST_DYNAMIC_DEBUG_SUBMOD) + #define pr_fmt(fmt) "test_dd_submod: " fmt +#else + #define pr_fmt(fmt) "test_dd: " fmt +#endif =20 #include =20 -/* run tests by reading or writing sysfs node: do_prints */ +/* re-gen output by reading or writing sysfs node: do_prints */ =20 static void do_prints(void); /* device under test */ static int param_set_do_prints(const char *instr, const struct kernel_para= m *kp) @@ -29,24 +48,39 @@ static const struct kernel_param_ops param_ops_do_print= s =3D { }; module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 0600); =20 -/* - * Using the CLASSMAP api: - * - classmaps must have corresponding enum - * - enum symbols must match/correlate with class-name strings in the map. - * - base must equal enum's 1st value - * - multiple maps must set their base to share the 0-30 class_id space !! - * (build-bug-on tips welcome) - * Additionally, here: - * - tie together sysname, mapname, bitsname, flagsname - */ -#define DD_SYS_WRAP(_model, _flags) \ - static unsigned long bits_##_model; \ - static struct _ddebug_class_param _flags##_model =3D { \ +#define CLASSMAP_BITMASK(width, base) (((1UL << (width)) - 1) << (base)) + +/* sysfs param wrapper, proto-API */ +#define DYNAMIC_DEBUG_CLASSMAP_PARAM_(_model, _flags, _init) \ + static unsigned long bits_##_model =3D _init; \ + static struct _ddebug_class_param _flags##_##_model =3D { \ .bits =3D &bits_##_model, \ .flags =3D #_flags, \ .map =3D &map_##_model, \ }; \ - module_param_cb(_flags##_##_model, ¶m_ops_dyndbg_classes, &_flags##_m= odel, 0600) + module_param_cb(_flags##_##_model, ¶m_ops_dyndbg_classes, \ + &_flags##_##_model, 0600) +#ifdef DEBUG +#define DYNAMIC_DEBUG_CLASSMAP_PARAM(_model, _flags) \ + DYNAMIC_DEBUG_CLASSMAP_PARAM_(_model, _flags, ~0) +#else +#define DYNAMIC_DEBUG_CLASSMAP_PARAM(_model, _flags) \ + DYNAMIC_DEBUG_CLASSMAP_PARAM_(_model, _flags, 0) +#endif + +/* + * Demonstrate/test DISJOINT & LEVEL typed classmaps with a sys-param. + * + * To comport with DRM debug-category (an int), classmaps map names to + * ids (also an int). So a classmap starts with an enum; DRM has enum + * debug_category: with DRM_UT_. We use the enum + * values as class-ids, and stringified enum-symbols as classnames. + * + * Modules with multiple CLASSMAPS must have enums with distinct + * value-ranges, as arranged below with explicit enum_sym =3D X inits. + * To clarify this sharing, declare the 2 enums now, for the 2 + * different classmap types + */ =20 /* numeric input, independent bits */ enum cat_disjoint_bits { @@ -60,26 +94,51 @@ enum cat_disjoint_bits { D2_LEASE, D2_DP, D2_DRMRES }; -DECLARE_DYNDBG_CLASSMAP(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "D2_CORE", - "D2_DRIVER", - "D2_KMS", - "D2_PRIME", - "D2_ATOMIC", - "D2_VBL", - "D2_STATE", - "D2_LEASE", - "D2_DP", - "D2_DRMRES"); -DD_SYS_WRAP(disjoint_bits, p); -DD_SYS_WRAP(disjoint_bits, T); - -/* numeric verbosity, V2 > V1 related */ -enum cat_level_num { V0 =3D 14, V1, V2, V3, V4, V5, V6, V7 }; -DECLARE_DYNDBG_CLASSMAP(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, 14, - "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7"); -DD_SYS_WRAP(level_num, p); -DD_SYS_WRAP(level_num, T); + +/* numeric verbosity, V2 > V1 related. V0 is > D2_DRM_RES */ +enum cat_level_num { V0 =3D 16, V1, V2, V3, V4, V5, V6, V7 }; + +/* recapitulate DRM's multi-classmap setup */ +#if !defined(TEST_DYNAMIC_DEBUG_SUBMOD) +/* + * In single user, or parent / coordinator (drm.ko) modules, define + * classmaps on the client enums above, and then declares the PARAMS + * ref'g the classmaps. Each is exported. + */ +DYNAMIC_DEBUG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BI= TS, + D2_CORE, + "D2_CORE", + "D2_DRIVER", + "D2_KMS", + "D2_PRIME", + "D2_ATOMIC", + "D2_VBL", + "D2_STATE", + "D2_LEASE", + "D2_DP", + "D2_DRMRES"); + +DYNAMIC_DEBUG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, + V0, "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7"); + +/* + * now add the sysfs-params + */ + +DYNAMIC_DEBUG_CLASSMAP_PARAM(disjoint_bits, p); +DYNAMIC_DEBUG_CLASSMAP_PARAM(level_num, p); + +#else /* TEST_DYNAMIC_DEBUG_SUBMOD */ + +/* + * in submod/drm-drivers, use the classmaps defined in top/parent + * module above. + */ + +DYNAMIC_DEBUG_CLASSMAP_USE(map_disjoint_bits); +DYNAMIC_DEBUG_CLASSMAP_USE(map_level_num); + +#endif =20 /* stand-in for all pr_debug etc */ #define prdbg(SYM) __pr_debug_cls(SYM, #SYM " msg\n") @@ -115,6 +174,7 @@ static void do_levels(void) =20 static void do_prints(void) { + pr_debug("do_prints:\n"); do_cats(); do_levels(); } diff --git a/lib/test_dynamic_debug_submod.c b/lib/test_dynamic_debug_submo= d.c new file mode 100644 index 000000000000..672aabf40160 --- /dev/null +++ b/lib/test_dynamic_debug_submod.c @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Kernel module for testing dynamic_debug + * + * Authors: + * Jim Cromie + */ + +/* + * clone the parent, inherit all the properties, for consistency and + * simpler accounting in test expectations. + */ +#define TEST_DYNAMIC_DEBUG_SUBMOD +#include "test_dynamic_debug.c" --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 034441F3BB0 for ; Wed, 2 Apr 2025 17:42:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615755; cv=none; b=Z+0zD+9upM9agypKaFvVT9+8i9rFvgzssdHKYVOfB3yvgfY1g1bTEJF4mdrLOjpIyaYtm5223Xi80kj6JaP8R7/4Glkw58wnh6vwpC2M6cHQfN1i2KQrcd2hjZrgkoOXWNaLI49GWiIWAZpDtHiPggLnTn1SQwWgDw1oxMf+55w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615755; c=relaxed/simple; bh=tbmzOu8oc31PGBNDZFXnFrX42d1QUV8nhlMeNuluIgw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LN4Ydfa6+ayY6+Hm3MyNacRW5f8vGFKBltLNwHMavrgDD1pDyhsNYDSpUIi9cgnIbSve0eb4UwMYH9zBqcWTjekEbypIvAyUpdxNUSH0W0/n1KOmY6Q/JsiDORLa1oq+uReX/T1JEmeKUqe0Zpifd/5Q3M4D5oA3nCNALrgM2iQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d6qegvJ4; arc=none smtp.client-ip=209.85.166.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d6qegvJ4" Received: by mail-io1-f45.google.com with SMTP id ca18e2360f4ac-85b41281b50so327439f.3 for ; Wed, 02 Apr 2025 10:42:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615752; x=1744220552; 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=YCIt9tYIDEGpxvCFrjrEJ4lAt8KNuZmfjyIc/WC7B0Q=; b=d6qegvJ42HY/qFZgiLKTCUGvcFKSOIYt19VKJB9NyUYRlXfGRlFaLgidO+CZqJklYn OdHekpBk+1LtVjkhdXz8gpbsDm+kK1+c0LbOhiqdkWjgv7yvI/K5fqlSgRxJPU3FKwKg K9NA3INL1TBkVqy++D/v31yi5kOGVQekKWogmOtbTN7ckKTuYrw96laTeEhrAxoyRRg8 9aq6jy2m0L7oHn0c8NODKboln2bF9ol08ks6uRqfyNwE2s9VNgThCTVVToCnFuisP2uJ StfhCAbIruFiwM967+/zu5Nc/55ctAs/elHKM0eOaE9oFsAh8/oGsgweEO8yHoHDWFDo LwtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615752; x=1744220552; 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=YCIt9tYIDEGpxvCFrjrEJ4lAt8KNuZmfjyIc/WC7B0Q=; b=TZwthMStc1K80/jNlxpZmfaq+Nz6db1o5WlUmnGvPZ7OoVZwusL3zUkO+lVXaxlQ2n lRPcrCyi1pp4HwI6dwLy+kPXLeQ0ItXaOzUF0geP9y8n6/nlmkmsR0Iu1K9z1ewLPmlA qYsYxB8gr6i6zyPhOgf/763GhMFs84xKSTCyIT/dkdpXCF9C4CDNANUCz2gZZgbR2Qqt ZHqXZix7oH+4Ex5T28jWRSUQB2KFKo+YUz6yf7mLpT9k7EHfwytJcCiKNL73i0KzV5jU /Q+vKMNGEDE8hhhpC8BIIzZ3AObcw9QrNT9Lyrf2WL1xv0aNVlYaBj7XzGnCdeqzLLLe ehOQ== X-Forwarded-Encrypted: i=1; AJvYcCXJNAchsjta22KIsNm9uOI0DGmHR+56mWQuhs7/f/5iR6xSJjaljX+c1L99hwkl470IIzNKNCPJXmL+LHM=@vger.kernel.org X-Gm-Message-State: AOJu0Yxd9I/PHmzte2K1cTV40AMnnp32ZliFmxY2SCdHAm0KW+qqZvn5 6cL7Fk57aEFE2ElxFc77Z+6pgxVR2JjlONzo9V+yavMquA+xDQJD X-Gm-Gg: ASbGncsY3Hz4MYBwboER+ELrlQGwC8A+V6AarlW0uIVzI6A+8ywMyGL+cSnQucnpXv/ YCYcP3HXhrLuzNoNk+hMR4UywLmov9mn4bXfJFtqYwuEI8fjtth9KEnDpTUIYjpwvMXbw5kwQgU wo3JvKa/AeBx2TPgsQNzvS74aiEvK1XR99DRyO3j4R1mmX6yEcRtYFiLZRXHITit7rpouNEm2T0 DyrgxnJOskHLODIpyXrdoHpwJbnNEnazbtP2/SrlruszAp+2J8n6G1aEb5Aasm1ws5DpNSKIjvr 2oj73dUFrdOPnVkFmFWUo/jAxPIkw3E8MeHjbUTukBYT4EkD0TYvphbNLOLCiQ1WkgATU0xhs4D g+7ai4hJuoE1x X-Google-Smtp-Source: AGHT+IFfGtZPni22y+0xW+8U0Khw+cTygsnRaXQqfaDRuRmQ1klihTpldlBe8ndlWy3frQCWeXYYiQ== X-Received: by 2002:a05:6e02:3713:b0:3d5:8922:77a0 with SMTP id e9e14a558f8ab-3d5e09c89a5mr234397865ab.18.1743615751996; Wed, 02 Apr 2025 10:42:31 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:31 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 18/54] selftests-dyndbg: add tools/testing/selftests/dynamic_debug/* Date: Wed, 2 Apr 2025 11:41:20 -0600 Message-ID: <20250402174156.1246171-19-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Add a selftest script for dynamic-debug. The config requires CONFIG_TEST_DYNAMIC_DEBUG=3Dm and CONFIG_TEST_DYNAMIC_DEBUG_SUBMOD=3Dm, which tacitly requires either CONFIG_DYNAMIC_DEBUG=3Dy or CONFIG_DYNAMIC_DEBUG_CORE=3Dy ATM this has just basic_tests(), which modify pr_debug() flags in the builtin params module. This means they're available to manipulate and observe the effects in "cat control". This is backported from another feature branch; the support-fns (thx Lukas) have unused features at the moment, they'll get used shortly. The script enables simple virtme-ng testing: [jimc@gandalf b0-ftrace]$ vrun_t virtme-ng 1.32+115.g07b109d doing: vng --name v6.14-rc4-60-gd5f48427de0c \ --user root -v -p 4 -a dynamic_debug.verbose=3D3 V=3D1 \ -- ../tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh virtme: waiting for virtiofsd to start .. And add dynamic_debug to TARGETS, so `make run_tests` sees it properly For the impatient, set TARGETS explicitly: bash-5.2# make TARGETS=3Ddynamic_debug run_tests make[1]: ... TAP version 13 1..1 [ 35.552922] dyndbg: read 3 bytes from userspace [ 35.553099] dyndbg: query 0: "=3D_" mod:* [ 35.553544] dyndbg: processed 1 queries, with 1778 matches, 0 errs Signed-off-by: Jim Cromie Co-developed-by: =C5=81ukasz Bartosik Signed-off-by: =C5=81ukasz Bartosik --- -r3 turn off green at end drop config dep on TEST_DYNAMIC_DEBUG, since basic-test uses builtin params - check KCONFIG_CONFIG to avoid silly fails Several tests are dependent upon config choices. Lets avoid failing where that is noise. The KCONFIG_CONFIG var exists to convey the config-file around. If the var names a file, read it and extract the relevant CONFIG items, and use them to skip the dependent tests, thus avoiding the fails that would follow, and the disruption to whatever CI is running these selftests. If the envar doesn't name a config-file, ".config" is assumed. CONFIG_DYNAMIC_DEBUG=3Dy: basic-tests() and comma-terminator-tests() test for the presence of the builtin pr_debugs in module/main.c, which I deemed stable and therefore safe to count. That said, the test fails if only CONFIG_DYNAMIC_DEBUG_CORE=3Dy is set. It could be rewritten to test against test-dynamic-debug.ko, but that just trades one config dependence for another. CONFIG_TEST_DYNAMIC_DEBUG=3Dm As written, test_percent_splitting() modprobes test_dynamic_debug, enables several classes, and count them. It could be re-written to work for the builtin module also, but builtin test modules are not a common or desirable build/config. CONFIG_TEST_DYNAMIC_DEBUG=3Dm && CONFIG_TEST_DYNAMIC_DEBUG_SUBMOD=3Dm test_mod_submod() recaps the bug found in DRM-CI where drivers werent enabled by drm.debug=3D. It modprobes both test_dynamic_debug & test_dynamic_debug_submod, so it depends on a loadable modules config. It could be rewritten to work in a builtin parent config; DRM=3Dy is common enough to be pertinent, but testing that config also wouldn't really test anything more fully than all-loadable modules, since they default together. generalize-test-env --- MAINTAINERS | 1 + tools/testing/selftests/Makefile | 1 + .../testing/selftests/dynamic_debug/Makefile | 9 + tools/testing/selftests/dynamic_debug/config | 7 + .../dynamic_debug/dyndbg_selftest.sh | 257 ++++++++++++++++++ 5 files changed, 275 insertions(+) create mode 100644 tools/testing/selftests/dynamic_debug/Makefile create mode 100644 tools/testing/selftests/dynamic_debug/config create mode 100755 tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh diff --git a/MAINTAINERS b/MAINTAINERS index 1c5fcbd9e408..1192ad6c65c1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8140,6 +8140,7 @@ S: Maintained F: include/linux/dynamic_debug.h F: lib/dynamic_debug.c F: lib/test_dynamic_debug*.c +F: tools/testing/selftests/dynamic_debug/* =20 DYNAMIC INTERRUPT MODERATION M: Tal Gilboa diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Mak= efile index 8daac70c2f9d..b6a323c7f986 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -26,6 +26,7 @@ TARGETS +=3D drivers/net/team TARGETS +=3D drivers/net/virtio_net TARGETS +=3D drivers/platform/x86/intel/ifs TARGETS +=3D dt +TARGETS +=3D dynamic_debug TARGETS +=3D efivarfs TARGETS +=3D exec TARGETS +=3D fchmodat2 diff --git a/tools/testing/selftests/dynamic_debug/Makefile b/tools/testing= /selftests/dynamic_debug/Makefile new file mode 100644 index 000000000000..6d06fa7f1040 --- /dev/null +++ b/tools/testing/selftests/dynamic_debug/Makefile @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-only +# borrowed from Makefile for user memory selftests + +# No binaries, but make sure arg-less "make" doesn't trigger "run_tests" +all: + +TEST_PROGS :=3D dyndbg_selftest.sh + +include ../lib.mk diff --git a/tools/testing/selftests/dynamic_debug/config b/tools/testing/s= elftests/dynamic_debug/config new file mode 100644 index 000000000000..0f906ff53908 --- /dev/null +++ b/tools/testing/selftests/dynamic_debug/config @@ -0,0 +1,7 @@ + +# basic tests ref the builtin params module +CONFIG_DYNAMIC_DEBUG=3Dm + +# more testing is possible with these +# CONFIG_TEST_DYNAMIC_DEBUG=3Dm +# CONFIG_TEST_DYNAMIC_DEBUG_SUBMOD=3Dm diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/too= ls/testing/selftests/dynamic_debug/dyndbg_selftest.sh new file mode 100755 index 000000000000..465fad3f392c --- /dev/null +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh @@ -0,0 +1,257 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0-only + +V=3D${V:=3D0} # invoke as V=3D1 $0 for global verbose +RED=3D"\033[0;31m" +GREEN=3D"\033[0;32m" +YELLOW=3D"\033[0;33m" +BLUE=3D"\033[0;34m" +MAGENTA=3D"\033[0;35m" +CYAN=3D"\033[0;36m" +NC=3D"\033[0;0m" +error_msg=3D"" + +[ -e /proc/dynamic_debug/control ] || { + echo -e "${RED}: this test requires CONFIG_DYNAMIC_DEBUG=3Dy ${NC}" + exit 0 # nothing to test here, no good reason to fail. +} + +# need info to avoid failures due to untestable configs + +[ -f "$KCONFIG_CONFIG" ] || KCONFIG_CONFIG=3D".config" +if [ -f "$KCONFIG_CONFIG" ]; then + echo "# consulting KCONFIG_CONFIG: $KCONFIG_CONFIG" + grep -q "CONFIG_DYNAMIC_DEBUG=3Dy" $KCONFIG_CONFIG ; LACK_DD_BUILTIN= =3D$? + grep -q "CONFIG_TEST_DYNAMIC_DEBUG=3Dm" $KCONFIG_CONFIG ; LACK_TMOD=3D= $? + grep -q "CONFIG_TEST_DYNAMIC_DEBUG_SUBMOD=3Dm" $KCONFIG_CONFIG ; LACK_= TMOD_SUBMOD=3D$? + if [ $V -eq 1 ]; then + echo LACK_DD_BUILTIN: $LACK_DD_BUILTIN + echo LACK_TMOD: $LACK_TMOD + echo LACK_TMOD_SUBMOD: $LACK_TMOD_SUBMOD + fi +else + LACK_DD_BUILTIN=3D0 + LACK_TMOD=3D0 + LACK_TMOD_SUBMOD=3D0 +fi + +function vx () { + echo $1 > /sys/module/dynamic_debug/parameters/verbose +} + +function ddgrep () { + grep $1 /proc/dynamic_debug/control +} + +function doprints () { + cat /sys/module/test_dynamic_debug/parameters/do_prints +} + +function ddcmd () { + exp_exit_code=3D0 + num_args=3D$# + if [ "${@:$#}" =3D "pass" ]; then + num_args=3D$#-1 + elif [ "${@:$#}" =3D "fail" ]; then + num_args=3D$#-1 + exp_exit_code=3D1 + fi + args=3D${@:1:$num_args} + output=3D$((echo "$args" > /proc/dynamic_debug/control) 2>&1) + exit_code=3D$? + error_msg=3D$(echo $output | cut -d ":" -f 5 | sed -e 's/^[[:space:]]*= //') + handle_exit_code $BASH_LINENO $FUNCNAME $exit_code $exp_exit_code +} + +function handle_exit_code() { + local exp_exit_code=3D0 + [ $# =3D=3D 4 ] && exp_exit_code=3D$4 + if [ $3 -ne $exp_exit_code ]; then + echo -e "${RED}: $BASH_SOURCE:$1 $2() expected to exit with code $= exp_exit_code" + [ $3 =3D=3D 1 ] && echo "Error: '$error_msg'" + exit + fi +} + +# $1 - pattern to match, pattern in $1 is enclosed by spaces for a match "= "\s$1\s" +# $2 - number of times the pattern passed in $1 is expected to match +# $3 - optional can be set either to "-r" or "-v" +# "-r" means relaxed matching in this case pattern provided in $1 is= passed +# as is without enclosing it with spaces +# "-v" prints matching lines +# $4 - optional when $3 is set to "-r" then $4 can be used to pass "-v" +function check_match_ct { + pattern=3D"\s$1\s" + exp_cnt=3D0 + + [ "$3" =3D=3D "-r" ] && pattern=3D"$1" + let cnt=3D$(ddgrep "$pattern" | wc -l) + if [ $V -eq 1 ] || [ "$3" =3D=3D "-v" ] || [ "$4" =3D=3D "-v" ]; then + echo -ne "${BLUE}" && ddgrep $pattern && echo -ne "${NC}" + fi + [ $# -gt 1 ] && exp_cnt=3D$2 + if [ $cnt -ne $exp_cnt ]; then + echo -e "${RED}: $BASH_SOURCE:$BASH_LINENO check failed expected $= exp_cnt on $1, got $cnt" + exit + else + echo ": $cnt matches on $1" + fi +} + +# $1 - trace instance name +# #2 - if > 0 then directory is expected to exist, if <=3D 0 then otherwise +# $3 - "-v" for verbose +function check_trace_instance_dir { + if [ -e /sys/kernel/tracing/instances/$1 ]; then + if [ "$3" =3D=3D "-v" ] ; then + echo "ls -l /sys/kernel/tracing/instances/$1: " + ls -l /sys/kernel/tracing/instances/$1 + fi + if [ $2 -le 0 ]; then + echo -e "${RED}: $BASH_SOURCE:$BASH_LINENO error trace instanc= e \ + '/sys/kernel/tracing/instances/$1' does exist" + exit + fi + else + if [ $2 -gt 0 ]; then + echo -e "${RED}: $BASH_SOURCE:$BASH_LINENO error trace instanc= e \ + '/sys/kernel/tracing/instances/$1' does not exist" + exit + fi + fi +} + +function tmark { + echo $* > /sys/kernel/tracing/trace_marker +} + +# $1 - trace instance name +# $2 - line number +# $3 - if > 0 then the instance is expected to be opened, otherwise +# the instance is expected to be closed +function check_trace_instance { + output=3D$(tail -n9 /proc/dynamic_debug/control | grep ": Opened trace= instances" \ + | xargs -n1 | grep $1) + if [ "$output" !=3D $1 ] && [ $3 -gt 0 ]; then + echo -e "${RED}: $BASH_SOURCE:$2 trace instance $1 is not opened" + exit + fi + if [ "$output" =3D=3D $1 ] && [ $3 -le 0 ]; then + echo -e "${RED}: $BASH_SOURCE:$2 trace instance $1 is not closed" + exit + fi +} + +function is_trace_instance_opened { + check_trace_instance $1 $BASH_LINENO 1 +} + +function is_trace_instance_closed { + check_trace_instance $1 $BASH_LINENO 0 +} + +# $1 - trace instance directory to delete +# $2 - if > 0 then directory is expected to be deleted successfully, if <= =3D 0 then otherwise +function del_trace_instance_dir() { + exp_exit_code=3D1 + [ $2 -gt 0 ] && exp_exit_code=3D0 + output=3D$((rmdir /sys/kernel/debug/tracing/instances/$1) 2>&1) + exit_code=3D$? + error_msg=3D$(echo $output | cut -d ":" -f 3 | sed -e 's/^[[:space:]]*= //') + handle_exit_code $BASH_LINENO $FUNCNAME $exit_code $exp_exit_code +} + +function error_log_ref { + # to show what I got + : echo "# error-log-ref: $1" + : echo cat \$2 +} + +function ifrmmod { + lsmod | grep $1 2>&1>/dev/null && rmmod $1 +} + +# $1 - text to search for +function search_trace() { + search_trace_name 0 1 $1 +} + +# $1 - trace instance name, 0 for global event trace +# $2 - line number counting from the bottom +# $3 - text to search for +function search_trace_name() { + if [ "$1" =3D "0" ]; then + buf=3D$(cat /sys/kernel/debug/tracing/trace) + line=3D$(tail -$2 /sys/kernel/debug/tracing/trace | head -1 | sed -e = 's/^[[:space:]]*//') + else + buf=3D$(cat /sys/kernel/debug/tracing/instances/$1/trace) + line=3D$(tail -$2 /sys/kernel/debug/tracing/instances/$1/trace | head= -1 | \ + sed -e 's/^[[:space:]]*//') + fi + if [ $2 =3D 0 ]; then + # whole-buf check + output=3D$(echo $buf | grep "$3") + else + output=3D$(echo $line | grep "$3") + fi + if [ "$output" =3D "" ]; then + echo -e "${RED}: $BASH_SOURCE:$BASH_LINENO search for '$3' fai= led \ + in line '$line' or '$buf'" + exit + fi + if [ $V =3D 1 ]; then + echo -e "${MAGENTA}: search_trace_name in $1 found: \n$output \nin:${= BLUE} $buf ${NC}" + fi +} + +# $1 - error message to check +function check_err_msg() { + if [ "$error_msg" !=3D "$1" ]; then + echo -e "${RED}: $BASH_SOURCE:$BASH_LINENO error message '$error_m= sg' \ + does not match with '$1'" + exit + fi +} + +function basic_tests { + echo -e "${GREEN}# BASIC_TESTS ${NC}" + if [ $LACK_DD_BUILTIN -eq 1 ]; then + echo "SKIP" + return + fi + ddcmd =3D_ # zero everything + check_match_ct =3Dp 0 + + # module params are builtin to handle boot args + check_match_ct '\[params\]' 4 -r + ddcmd module params +mpf + check_match_ct =3Dpmf 4 + + # multi-cmd input, newline separated, with embedded comments + cat <<"EOF" > /proc/dynamic_debug/control + module params =3D_ # clear params + module params +mf # set flags + module params func parse_args +sl # other flags +EOF + check_match_ct =3Dmf 3 + check_match_ct =3Dmfsl 1 + ddcmd =3D_ +} + +tests_list=3D( + basic_tests +) + +# Run tests + +ifrmmod test_dynamic_debug_submod +ifrmmod test_dynamic_debug + +for test in "${tests_list[@]}" +do + $test + echo "" +done +echo -en "${GREEN}# Done on: " +date +echo -en "${NC}" --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f178.google.com (mail-il1-f178.google.com [209.85.166.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DE4F1F3FC8 for ; Wed, 2 Apr 2025 17:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615755; cv=none; b=HkzE7V2NWcv9vzfUobXn4T2qeI3Y1qgvF2/vqASB58+4WZSqHpbP4Zvwiz1cwWKIRqyDvXUlIdQRfEbZMbIcOUXdavQXp0oM5nynmMAK6GIGmgyjzEOBwp0WtM/pGHzpGyYUKCQewP1c3iRmFMpQgsiKmcFTAUsO7/66XuuSyTg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615755; c=relaxed/simple; bh=H+/2ithY6j2ZBPMixJhFYAc5PzZpu1sLtiZj7dmdhNk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nQTVB6NnYmWfQse7NNMtf8Kde7W4rHiCIhRZOkA2sdS9ZsNYVETyrDe9Q4YPqJMlsf+EqXNdnP1T7UUbTWHyofzhrWDIajcoOhly9AAHrLujXebrw48XK1PRD2y4pDweRGXzQCPzyGKhNr/wPHPlkOc+kHrnvPspJd1q2gcq+Wc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=N9qYAoFn; arc=none smtp.client-ip=209.85.166.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N9qYAoFn" Received: by mail-il1-f178.google.com with SMTP id e9e14a558f8ab-3d445a722b9so627405ab.3 for ; Wed, 02 Apr 2025 10:42:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615753; x=1744220553; 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=KeKTBGUd8WybmXrxvv7lQQBEsMgzjZkVTc12353wK+U=; b=N9qYAoFnAd7NOKfX0MNN8HIu8c4/hziGqCrCDCdJ8B8I90J71/nYW1yG8aklQIkmt3 BfHxoB0x56EqXuJLo2AmTjmWj+htSzTPvWRSGP4HF2I1z1uzmqZrxgi9j3g7qEZEZSlv 0FsLtLDfwV5c0s41dwB/wK67YI93cAZjujXkHbq2MO09MNoh7JbTgm0SOun0Sf5QVFub g0q+UmvWlGRu0NPbvIFe5rWHsba/jIjNSMs7yLiLOIisVaMEtTLj8HmhqqUw+bxj/AJp Qs2ImW9yAAOoeNKEMvYGC36UiHjL3dalY5z9POzG0nqsF6Fpg6P1qWhJVGKao3bw+BUb N9FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615753; x=1744220553; 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=KeKTBGUd8WybmXrxvv7lQQBEsMgzjZkVTc12353wK+U=; b=NpikjD2FaqSfpYoLjgu1+dqcFoKQlYZ/ZJiPQ5gRwJgg/X6MVdAyO9YQFBIthb8kFs D+GFE9vTsB95JwX0Jmufi0zICFw56EDYofolIXhPJ3FK43mvcH60IcuNUMop8/7AEk/L PhRwJHgpmwFCQt8M6S2qKCNTTcBU8jACQlUYVTr7kkm10B6sggEtFy1l/FKBsW8tcu6C VGbPSiHJYJuuyHpWbji0MCOEVGBq5k/yHKKRat0oSCSFE1eDp3KtX3Iyhv9tbNLkXdbg HK5mAZbyKXWBnrDnBBUEUUuu4+KI1vIIn93jqSHR/62yO1qPf0egqmxQe8XmQ8LBF3Zs G74A== X-Forwarded-Encrypted: i=1; AJvYcCVdj48vLJt9rEu0zDyrtluIUZAaKYo+PkgOR4UKynozLcNbMEH3sOv29TpFH7BjoalfcqNC0hRU4cAW5AA=@vger.kernel.org X-Gm-Message-State: AOJu0YzUN5+yJekKAR1AHRp/Od77xFuJ+KLzvxtjeql7fJ0hahPvRGiF ecSrxa5P0yg3z6IkUn2A7bR0iHhGl1zm9eMn4Ox49EoeAGEjLmGw X-Gm-Gg: ASbGncvTxEy0ZFBSAfKLrPUzL+2JdTerGjr9QkbxKktl1ph0/TV5RXQNuixNx6YikTr Y5nDCG/fLXMiZJqwN6s9lMUMjIfG2P3Z3jTxNlce8m8N6F9zkl3lRQp61780czjjOl1rL1I0CW7 c2n37pfCTIN0KD0SIAMiYppc2updWCN8sUOVLyx24FabVm2DgoKDDYwYEJAHwBIGkAZb65cExnI HcFIUyoJ/7snvL43ny87W4XDWLlOtEg685ddRGd1Y/wW9F22yLMZivLfqN+tXNzSKdweSc1I663 zW070swK48Tu3dprNEU9H8ujt5baKestNVtXXpS4Zzq/+vau9KFUFvuzhr2lwjF9gUkoeTrZjGR hxg== X-Google-Smtp-Source: AGHT+IFaC1YYyq2aq/rDOr7nftMb5mtnPTvXusfBx4cINuze69wt5nZYDtolFZPQAPv6upZ4KaK1zw== X-Received: by 2002:a05:6e02:3c82:b0:3cf:c7d3:e4b with SMTP id e9e14a558f8ab-3d5e0a09a11mr204507425ab.21.1743615753003; Wed, 02 Apr 2025 10:42:33 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:32 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 19/54] dyndbg: detect class_id reservation conflicts Date: Wed, 2 Apr 2025 11:41:21 -0600 Message-ID: <20250402174156.1246171-20-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" If a module _DEFINEs + _USEs 2 or more classmaps, it must devise them to share the per-module 0..62 class-id space; ie their respective base,+length reservations cannot overlap. To detect conflicts at modprobe, add ddebug_class_range_overlap(), call it from ddebug_add_module(), and WARN and return -EINVAL when they're detected. test_dynamic_debug.c: If built with -DFORCE_CLASSID_CONFLICT, the test-modules get 2 bad DYNDBG_CLASS_DEFINE declarations, into parent and the _submod. These conflict with one of the good ones in the parent (D2_CORE..etc), causing the modprobe(s) to warn Signed-off-by: Jim Cromie --- --- lib/dynamic_debug.c | 29 +++++++++++++++++++++++++++++ lib/test_dynamic_debug.c | 8 ++++++++ 2 files changed, 37 insertions(+) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 53e261dbf81e..56b503af0b31 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1267,6 +1267,22 @@ static void ddebug_apply_class_users(const struct _d= debug_info *di) (_dst)->info._vec.len =3D nc; \ }) =20 +static int __maybe_unused +ddebug_class_range_overlap(struct _ddebug_class_map *cm, + u64 *reserved_ids) +{ + u64 range =3D (((1ULL << cm->length) - 1) << cm->base); + + if (range & *reserved_ids) { + pr_err("[%d..%d] on %s conflicts with %llx\n", cm->base, + cm->base + cm->length - 1, cm->class_names[0], + *reserved_ids); + return -EINVAL; + } + *reserved_ids |=3D range; + return 0; +} + /* * Allocate a new ddebug_table for the given module * and add it to the global list. @@ -1276,6 +1292,7 @@ static int ddebug_add_module(struct _ddebug_info *di) struct ddebug_table *dt; struct _ddebug_class_map *cm; struct _ddebug_class_user *cli; + u64 reserved_ids =3D 0; int i; =20 if (!di->descs.len) @@ -1301,6 +1318,13 @@ static int ddebug_add_module(struct _ddebug_info *di) dd_mark_vector_subrange(i, dt, cm, di, maps); dd_mark_vector_subrange(i, dt, cli, di, users); =20 + for_subvec(i, cm, &dt->info, maps) + if (ddebug_class_range_overlap(cm, &reserved_ids)) + goto cleanup; + for_subvec(i, cli, &dt->info, users) + if (ddebug_class_range_overlap(cli->map, &reserved_ids)) + goto cleanup; + if (dt->info.maps.len) ddebug_apply_class_maps(&dt->info); =20 @@ -1313,6 +1337,11 @@ static int ddebug_add_module(struct _ddebug_info *di) =20 vpr_info("%3u debug prints in module %s\n", di->descs.len, di->mod_name); return 0; +cleanup: + WARN_ONCE("dyndbg multi-classmap conflict in %s\n", di->mod_name); + kfree(dt); + return -EINVAL; + } =20 /* helper for ddebug_dyndbg_(boot|module)_param_cb */ diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 1070107f74f1..e42916b08fd4 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -128,6 +128,14 @@ DYNAMIC_DEBUG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_= TYPE_LEVEL_NUM, DYNAMIC_DEBUG_CLASSMAP_PARAM(disjoint_bits, p); DYNAMIC_DEBUG_CLASSMAP_PARAM(level_num, p); =20 +#ifdef FORCE_CLASSID_CONFLICT +/* + * Enable with -Dflag on compile to test overlapping class-id range + * detection. This should warn on modprobes. + */ +DYNDBG_CLASSMAP_DEFINE(classid_range_conflict, 0, D2_CORE + 1, "D3_CORE"); +#endif + #else /* TEST_DYNAMIC_DEBUG_SUBMOD */ =20 /* --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C3A81F4162 for ; Wed, 2 Apr 2025 17:42:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615756; cv=none; b=jzYs0WOp9y5NDpBGRtZdHl4qJ3wuAu2yit9g1MRHO/ZoADPZ/KFe9QeChPKI0VMSS1Ew5pPd/q4QSLlhv2ZdfMPqKM1ZqFqNpQzN0LlUqC5ducMjU7nkxCYtD8yErFe4Kc3NjNUwv7Cnteq3JlpyftQ7gxLQTNKh+m5SuUtAwY0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615756; c=relaxed/simple; bh=4x0AmnugP2XdYTP9rmlwEA8OspxOy380YjN5Bs+XZ+U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GZEkB6FexpOdwfXoVHU1vGoCuLqWB10EMFcqdbaxlH1cVf4csTYxcgE19X/r9i/7C7E5ADnuQtdiq9YX9YCxcdrlL7GnPmlsCiOVbDbq3My45z85KTuOZcw5fkj0ssbUj/9/Ig2cOhkWhV5rWWWldldMMxyypQNZZlkkpEm0jyc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gPXG5sGP; arc=none smtp.client-ip=209.85.166.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gPXG5sGP" Received: by mail-io1-f52.google.com with SMTP id ca18e2360f4ac-854a68f5a9cso2531639f.0 for ; Wed, 02 Apr 2025 10:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615754; x=1744220554; 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=hYc+j5mBJIrHD3rqV3hAaVU76cL8/yuTOYYx1NhhgTg=; b=gPXG5sGPyq8XawuujOn2Kg1HhezKPbAGtsxlpN/TqK1u4ryYv/rTYmaBGYq93N3eaC eaunXIB8vjYZSHusgvWT6JAMgXl7KfixlB/59xyK/pmxjGEseLD/N3ZH/n5nbejMdxKf WquFMpvdiXcqMvTX3w3EYT61OuLJHThc2fbColiIVnuS/SHhthT+4JGoOt7vjXFmm255 /oKroKyl2kkxudsmVUJcsKjc+k+dJO5hSqlrCcMsNQqFIBUjToaXucCjBkVWI9S4XNjn EKzU0vBDlP6q9w1XO5q63VgVloHEcbnf5ET8CmLGxExCoeU5YuJpxiQDROAnrZIRSiJg qFPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615754; x=1744220554; 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=hYc+j5mBJIrHD3rqV3hAaVU76cL8/yuTOYYx1NhhgTg=; b=o0tuIE3Vzy9/hmkLFnc+q4NF3q6nSXhQ7VkJhI0ThSXYMCSmXOcGkasmHmi3S6geWy 5ThWs6fffm3qHJmAbRbA3JzkfGYwmM6/NlgvRXKOLE77pNcg5OaD+hz+dob0ZFRCgZeG Iuzjevbl+GLZAQBjdO3J+nVflupxzAY3gEaP6qfhZBs2cG7r02bFqY+Ue5GGVxeUAtLY VLK1O+rrc+CQKoon9HKErDiiIkcNxeOsIuLfYw4bAeAIkDIASgJSRgVoSLQ0YdZ50H50 OsK3Mb81bNHk3dYzc6EQeiEyiR4BqiSWLBorKDW7wBRkNqojKQw1mjiI+e8e2QGARy/H 5Dfw== X-Forwarded-Encrypted: i=1; AJvYcCX0EUFlmfGvis/76y1o7TMnOtKEv9IhLqnEG6IXui/8Dlxba6Msx4LBd/y0rdDa0bOnX3d5syPDYPu9Xqw=@vger.kernel.org X-Gm-Message-State: AOJu0Ywde3dh+FDa3c+ZwriVNdLWpFcXhi2rrzc5wVPKFbY10qryqxQ8 RJBB4BXrSoBa38ThfSrB51YMFfz9YPRlVCgqyxsETuuZKEUU1F1O X-Gm-Gg: ASbGnctLNnwJm/fK1qOhsoK5VcZleJr4s2re/rCXansjlmykFGlmc3j3uYt0qwme7mz o7kxBE03QuGZVEOtF5PwHnvSbJYgia9tDIo/MqKQltXmCtb/Is0DKHvQSwEeAcIFCe6CsrD5KLt TaCLWVlnZ6B+wNNa/Vcn4tGAF4yyRV9wqInnqETH6WM+Xh5TbUlzMYcP/3Wg8VT3CjgdVC4Bwdm 7juUzhxMTOz/dQuMN53dgjIBug95esKxi09rHx28Pnzn7PSD6C+RNOegur1ekQEta53Kq0XoLLc 9/KUVluVXy4ORSmMXNrCtsMjz1HxrIFupz+hfzlTWwnLZJf/sTyp+DKcji/A/Op7/ARjgm79XZg fPNWHnAek6mQZ X-Google-Smtp-Source: AGHT+IEVAbHMnIO9dfNIpvtNs8ZLp2t2qagN4qTEja9BzZoYvl4a7Bc0A3a/xIEdjKgwP/E1I/zqhA== X-Received: by 2002:a05:6e02:2606:b0:3d4:6e2f:b493 with SMTP id e9e14a558f8ab-3d6d54cde77mr38291795ab.11.1743615753974; Wed, 02 Apr 2025 10:42:33 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:33 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 20/54] dyndbg: check DYNAMIC_DEBUG_CLASSMAP_DEFINE args at compile-time Date: Wed, 2 Apr 2025 11:41:22 -0600 Message-ID: <20250402174156.1246171-21-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add __DYNAMIC_DEBUG_CLASSMAP_CHECK to implement the following arg-checks at compile-time: 0 <=3D _base < 63 class_names is not empty class_names[0] is a string (class_names.length + _base) < 63 These compile-time checks will prevent several misuses; 4 such examples are added to test_dynamic_debug_submod.ko, and will fail compilation if -DDD_MACRO_ARGCHECK is added to cflags. This wouldn't be a useful CONFIG_ item, since it breaks the build. Signed-off-by: Jim Cromie --- v3- $macro_name =3D~ s/DYNDBG/DYNAMIC_DEBUG/ prev- - split static-asserts to __DYNDBG_CLASSMAP_CHECK - move __DYNDBG_CLASSMAP_CHECK above kdoc for DYNDBG_CLASSMAP_DEFINE silences kernel-doc warnings --- include/linux/dynamic_debug.h | 9 +++++++++ lib/test_dynamic_debug.c | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 9af825c84e70..4941ef2adb46 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -99,6 +99,14 @@ struct _ddebug_class_map { enum ddebug_class_map_type map_type; }; =20 +#define __DYNAMIC_DEBUG_CLASSMAP_CHECK(_clnames, _base) \ + static_assert(((_base) >=3D 0 && (_base) < _DPRINTK_CLASS_DFLT), \ + "_base must be in 0..62"); \ + static_assert(ARRAY_SIZE(_clnames) > 0, \ + "classnames array size must be > 0"); \ + static_assert((ARRAY_SIZE(_clnames) + (_base)) < _DPRINTK_CLASS_DFLT, \ + "_base + classnames.length exceeds range") + /** * DYNAMIC_DEBUG_CLASSMAP_DEFINE - define debug classes used by a module. * @_var: name of the classmap, exported for other modules coordinated u= se. @@ -112,6 +120,7 @@ struct _ddebug_class_map { */ #define DYNAMIC_DEBUG_CLASSMAP_DEFINE(_var, _mapty, _base, ...) \ static const char *_var##_classnames[] =3D { __VA_ARGS__ }; \ + __DYNAMIC_DEBUG_CLASSMAP_CHECK(_var##_classnames, (_base)); \ extern struct _ddebug_class_map _var; \ struct _ddebug_class_map __aligned(8) __used \ __section("__dyndbg_class_maps") _var =3D { \ diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index e42916b08fd4..9f9e3fddd7e6 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -146,8 +146,19 @@ DYNDBG_CLASSMAP_DEFINE(classid_range_conflict, 0, D2_C= ORE + 1, "D3_CORE"); DYNAMIC_DEBUG_CLASSMAP_USE(map_disjoint_bits); DYNAMIC_DEBUG_CLASSMAP_USE(map_level_num); =20 +#if defined(DD_MACRO_ARGCHECK) +/* + * Exersize compile-time arg-checks in DYNDBG_CLASSMAP_DEFINE. + * These will break compilation. + */ +DYNDBG_CLASSMAP_DEFINE(fail_base_neg, 0, -1, "NEGATIVE_BASE_ARG"); +DYNDBG_CLASSMAP_DEFINE(fail_base_big, 0, 100, "TOOBIG_BASE_ARG"); +DYNDBG_CLASSMAP_DEFINE(fail_str_type, 0, 0, 1 /* not a string */); +DYNDBG_CLASSMAP_DEFINE(fail_emptyclass, 0, 0 /* ,empty */); #endif =20 +#endif /* TEST_DYNAMIC_DEBUG_SUBMOD */ + /* stand-in for all pr_debug etc */ #define prdbg(SYM) __pr_debug_cls(SYM, #SYM " msg\n") =20 --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f172.google.com (mail-il1-f172.google.com [209.85.166.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0237B1F418E for ; Wed, 2 Apr 2025 17:42:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615758; cv=none; b=SBWDp4iCvdJ/qVCqetevBcSxgObFEeV8J1aOFdQ6Z8wNfecgxj/jkvj8xmV/iTAqXNkY+SutRUHBz1axp2rg7HbztxTbzAHn/lnzt3J3lCPkrif2xWvUEdzcgxwIOcXtNfzsMPsn77yqqaAYQDFTXfwjCRhHxIfrw4t4P4Q4Z9Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615758; c=relaxed/simple; bh=qFRH4iZ1oCB5ctC6Y8JGf9ZepD1vxhdEIeSFsngeOBs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ipKQW4uo18D2Pa2XILEW1bSVrEkmGHbKvwLFz8W2HZEWMRaAp43Z9bHhCob0yISxcXnqboCMpwhouHHldktqvq7c9CmqI/bJpBa4p9Cmz3nPH5HDEbixvGAN9LVsqsdyG9ejfsUt9l321FOPCo4dCHe8Lk+B68AKBGPPg2hiM8c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VG60RjIY; arc=none smtp.client-ip=209.85.166.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VG60RjIY" Received: by mail-il1-f172.google.com with SMTP id e9e14a558f8ab-3d43c972616so331105ab.0 for ; Wed, 02 Apr 2025 10:42:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615755; x=1744220555; 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=9crVnbk3XjpJrHsY0dIqQRNI8E7oyjJ17chOf0dhmBE=; b=VG60RjIYSKsVOqEYmy1lx9w52jdd9FtKlAb4YaH2zE5Ywp76NzyZWvV890OMfASTa2 AqCpUicU+yfgkLQnT27a6IVk42JpAGg4HWICLVLbCOsyYEKhEA2sR/nwJBKjaZVIV27c S3rkrTyxjAk4tNlywEIw43L5gh38gGEiZYTMBUm/czmaQCXFhUFVnRZStKQ1JbKFZUja i4kWQ8YQKQkw/yHEz1w76nxSFDSe2qxUBjvudAEQQm/AG1Z3OELMyN84VhE4ylwJaOD5 i8MxrtQrFx3fB5ZRXYc1q7wZBF+3M7i0a3tMRzPZm2xir13zvsbuAwrMJKv5r9e4ufqk zGjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615755; x=1744220555; 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=9crVnbk3XjpJrHsY0dIqQRNI8E7oyjJ17chOf0dhmBE=; b=QT+iwesMNDIc5k1Rh4t1pQbEgvDCvWFjb0mQ/wJujTFilUTsq8tw3+EoRaEehpYqRZ Q7aWQPH7H55/+fCMar6vuRazx6dCnpx8jDqrLChoX0oXcbwIKHDsmvGm9ct63u8+t62q Mm6719N/nk0ExAlJ/DlMVmDt4y2zWEvpwuMnX/9YzOlo5TN09IrdMwXhMfVDXbQXnhxs eh4QsXiyLtUNv98P/C2h2Q8bhYeru0vwfUAvbdG4RXgMrwPqmy3UMpzwsPqmOdoAspwe gqHMyPiFAzbn5ocHK3o6n/4v3/cTb/pBd4B5nI8SpvyVF13xgHlKX6kezy4XS0mp8dLv n29Q== X-Forwarded-Encrypted: i=1; AJvYcCWxt4ceTBtAKRquFh2Z8QYlT30ZZveLixEjJXQoXqiHk0f38Z0k6/ElHfaFEpyo1QLEmzM1CE0ZpuCg4xU=@vger.kernel.org X-Gm-Message-State: AOJu0YzhNK5tGt1FGXnQXM+L+g2zDJTecb8pbwxu7t1ZmN/nakXwu2Zf 4AT1hspd013vSYUrDYksQXoO7H4HDWcjc8BcO73IjdfLOlDZUcn3 X-Gm-Gg: ASbGncvoPYc5KOvv5+gXFUIACj01f7XROYwji+mwzpVpZBW0+2IwVMwwTRQuubsYJCv /RFrYLbLNok2bampPw3QuZqic0orlnESaifBv/43NrN2M9xZGtCA/BNrXV0YGSqohWzyrJotS2f efuChrzwJ9xHCiJRygKawJbfeUh4tLBrrogx/3M9G4OkZIHBvwT1Vm8KlPNIr2HthdVAfs7rNRa w8izZPDLvgatLAybEB/i/udHazomp0JluiCOX7K6KctccBFaS9mx6ZejzO/E3qKjUr68LXfim0E SqmpMk5mDZOFjk9JdBtEYKGsWogK8Xjeefg2r8tnpzsaIFZzQKYA/qT04OcP0W83y04HXJ4GG1H zcw== X-Google-Smtp-Source: AGHT+IExGVMuJtN5hKLJ003ECDmgVw47CrV9YfzVs9KN7730OBh4HexWxFYIN3TSQJH5oTzEZWr1LA== X-Received: by 2002:a05:6e02:4406:10b0:3d3:de5f:af25 with SMTP id e9e14a558f8ab-3d6dca86dfemr5222605ab.0.1743615755159; Wed, 02 Apr 2025 10:42:35 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:34 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 21/54] dyndbg-test: change do_prints testpoint to accept a loopct Date: Wed, 2 Apr 2025 11:41:23 -0600 Message-ID: <20250402174156.1246171-22-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" echo 1000 > /sys/module/test_dynamic_debug/parameters/do_prints This allows its use as a scriptable load generator, to generate dynamic-prefix-emits for flag combinations vs undecorated messages. This will make it easy to assess the cost of the prefixing. Reading the ./do_prints node also prints messages (once) to the-log. NB: the count is clamped to 10000, chosen to be notice able, but not annoying, and not enough to accidentally flood the logs. Signed-off-by: Jim Cromie --- lib/test_dynamic_debug.c | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 9f9e3fddd7e6..4a3d2612ef60 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -29,18 +29,30 @@ =20 #include =20 -/* re-gen output by reading or writing sysfs node: do_prints */ - -static void do_prints(void); /* device under test */ +/* re-trigger debug output by reading or writing sysfs node: do_prints */ +#define PRINT_CLAMP 10000 +static void do_prints(unsigned int); /* device under test */ static int param_set_do_prints(const char *instr, const struct kernel_para= m *kp) { - do_prints(); + int rc; + unsigned int ct; + + rc =3D kstrtouint(instr, 0, &ct); + if (rc) { + pr_err("expecting numeric input, using 1 instead\n"); + ct =3D 1; + } + if (ct > PRINT_CLAMP) { + ct =3D PRINT_CLAMP; + pr_info("clamping print-count to %d\n", ct); + } + do_prints(ct); return 0; } static int param_get_do_prints(char *buffer, const struct kernel_param *kp) { - do_prints(); - return scnprintf(buffer, PAGE_SIZE, "did do_prints\n"); + do_prints(1); + return scnprintf(buffer, PAGE_SIZE, "did 1 do_prints\n"); } static const struct kernel_param_ops param_ops_do_prints =3D { .set =3D param_set_do_prints, @@ -191,17 +203,20 @@ static void do_levels(void) prdbg(V7); } =20 -static void do_prints(void) +static void do_prints(unsigned int ct) { - pr_debug("do_prints:\n"); - do_cats(); - do_levels(); + /* maybe clamp this */ + pr_debug("do-prints %d times:\n", ct); + for (; ct; ct--) { + do_cats(); + do_levels(); + } } =20 static int __init test_dynamic_debug_init(void) { pr_debug("init start\n"); - do_prints(); + do_prints(1); pr_debug("init done\n"); return 0; } --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1624D1F4616; Wed, 2 Apr 2025 17:42:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615759; cv=none; b=Ih2rqe1qkVoS3rE1aMK85pTMIDxN8SzYRsSAoyOAxuTYcAqALSv0h9O6nHRamxtaIx0SA0+HtpwkY8+bR39awhuX56Omt1z0Mo5vbY5zMl9+46bU42kEOmuR11gp06f2JEy0Sp/PUkdzM9UAczC47vt0gZFpDkoZXrGAkHijksU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615759; c=relaxed/simple; bh=G0DkUw2t0sb7ZGmbX1UWQ4E666F0Fx2idAvGhbKi5Eo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BMx66c037/4FgNvMVT+5fJZqOULJ1/NXzrK8tWQ08zW+towS/qnJvj52ewgx9GyIiV0FdsrytTAVAcCe1CVCJuf+3focMjY+GxSCIqNN5TvjTSidxA+Isse+BqOlnjgBeZnmtm4SEjNr7C/eTPw2s/UikAFqNv2eoGUEXrfnu3s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZkJPzNV1; arc=none smtp.client-ip=209.85.166.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZkJPzNV1" Received: by mail-io1-f50.google.com with SMTP id ca18e2360f4ac-854a682d2b6so2272739f.0; Wed, 02 Apr 2025 10:42:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615756; x=1744220556; 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=UQGLHVjI88a07yAcVp1fF8AgBymHOsN5Q+DW04b0Y4E=; b=ZkJPzNV1ZvkJbaw9W1rkCTnQDVolQLzA1zaIVCbmKkVelIMGYrpEBiw5ZGHxSd1zCT O8n0RVVj58b3S8XpWllz9OeA8avpPrJ5X6N92ubMEV5Vrw+Cjl+Vs92KvjGdnivI5cUa rfEm/+zz+gAArUA7aBijc3GGHaHTGg5chwuANrmBafkBRajrz2Uujj6y9yjA2viDGXFA WNNpKKSMTcvEnVsvxqIZtasptKhYbut83yRZAHYivHw0JQCp4WLdhCw6A7hSCcUHO5Ra Jo55dRaK5Vm327UUYn3l16VYx89Dh5LgyEwcOtyvIRAC5EyMh41FbZr+O7qT+efUBH38 3Y7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615756; x=1744220556; 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=UQGLHVjI88a07yAcVp1fF8AgBymHOsN5Q+DW04b0Y4E=; b=VzvDqEVE99ilwcxXbSmnRRDhmPcUB6tSt1PmW3DPYW8ZwaGBnxz4A0qr7rB0tR/R55 2e2WXcZK5nG+sjdSjtFgtMPgsdMXkdW8WfPoAC9y5gXVCsDMiNlG+sxK/3XWDi0bODoS lvvNvb/fsbNWm3PVhNznKpFHPIsfmSYYSv52VdghipXpobDNKefibJM+WfIM0IUoEXiI IkQwQU4Vfdb9r96E005qoFXqDuzmks+NTMI/J+jN/MeA0SionczHObGYiGP3lZYvfnRG b32SVXew3DfguId7zjUuThSFfZrGeG4aYLiYqcWnAiHu4QDXuxU4UxASoUqRhPKXfIyq 9Tgw== X-Forwarded-Encrypted: i=1; AJvYcCV47p7Q++Gy2YuPCH8tc1btOYL5Y0ati/YeSIsPFbXS2ajQz43bH/iBg0io9o0ZiA7EhkxUrbylXh0=@vger.kernel.org, AJvYcCXbi9pFusFifLW+iiHigkrT0Ic8TAjRGkQngae4vMIgdk18Yvpz9Ycjl7xzp6yK9qFRvyszTXJgCZOB5Zpp@vger.kernel.org X-Gm-Message-State: AOJu0YyqGZpSEhjYMHlwZCGIljtJbc1dH9Xq3BshzsM3/VIU5meb0Sa2 N021mjSyCSwCT/omtVazKP/NPAwf15wq3QZGPqf4MBA5ru0oCsZ/ X-Gm-Gg: ASbGnctkGhBQgif1SlBrrHAara3ZG2gbr6soWnVxXALNG9zh7hAuTOwY0ONpQ6szckl NHCO8ZUA1IPMWUKU3OtTDKxUC+ajTnvL+f8seb8FzIJ31h02RUhbpI73+f9UIEErDJmAzJfHSn0 m7HvXVMfsKw5pI5fil0g1o/5PLrrqkmSgCRyA1HZ5Yc/TH76eUv3JZoq4BFO6BnxpGAoD7v1E/7 nOhiJJFCh3l/cTFXC9QaoeAJ4ycmbtr9CmotYUZnmYYoTooZNmWTNeWAR3PKHOwIgXBfiD/f4LT TTjSSqBnWljjvm6/4MJsV8CDaBQ3N5wX9saFOG0gG1jdYz3YXpQ6eyydM2ZxyVgyB/ydRIClke3 6cw== X-Google-Smtp-Source: AGHT+IGg2nO72mRBabW+fR6wte152C7ysM+DnzAttS5d7C7TncYYuHpSkTrIvw9MuJ6wmrNNEvVwNQ== X-Received: by 2002:a05:6e02:1f0c:b0:3d4:e6:d872 with SMTP id e9e14a558f8ab-3d5e0908ce4mr198618635ab.9.1743615756093; Wed, 02 Apr 2025 10:42:36 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:35 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie , linux-doc@vger.kernel.org Subject: [PATCH v3 22/54] dyndbg-API: promote DYNAMIC_DEBUG_CLASSMAP_PARAM to API Date: Wed, 2 Apr 2025 11:41:24 -0600 Message-ID: <20250402174156.1246171-23-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" move the DYNAMIC_DEBUG_CLASSMAP_PARAM macro from test-dynamic-debug.c into the header, and refine it, by distinguishing the 2 use cases: 1.DYNAMIC_DEBUG_CLASSMAP_PARAM_REF for DRM, to pass in extern __drm_debug by name. dyndbg keeps bits in it, so drm can still use it as before 2.DYNAMIC_DEBUG_CLASSMAP_PARAM new user (test_dynamic_debug) doesn't need to share state, decls a static long unsigned int to store the bitvec. __DYNAMIC_DEBUG_CLASSMAP_PARAM bottom layer - allocate,init a ddebug-class-param, module-param-cb. Modify ddebug_sync_classbits() argtype deref inside the fn, to give access to all kp members. Also clean up and improve comments in test-code, and add MODULE_DESCRIPTIONs. cc: linux-doc@vger.kernel.org Signed-off-by: Jim Cromie --- -v9 - fixup drm-print.h add PARAM_REF forwarding macros with DYNAMIC_DEBUG_CLASSMAP_PARAM_REF in the API, add DRM_ variant --- include/linux/dynamic_debug.h | 38 +++++++++++++++++++++ lib/dynamic_debug.c | 60 ++++++++++++++++++++++----------- lib/test_dynamic_debug.c | 47 ++++++++++---------------- lib/test_dynamic_debug_submod.c | 9 ++++- 4 files changed, 104 insertions(+), 50 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 4941ef2adb46..ce221a702f84 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -211,6 +211,44 @@ struct _ddebug_class_param { const struct _ddebug_class_map *map; }; =20 +/** + * DYNAMIC_DEBUG_CLASSMAP_PARAM - control a ddebug-classmap from a sys-par= am + * @_name: sysfs node name + * @_var: name of the classmap var defining the controlled classes/bits + * @_flags: flags to be toggled, typically just 'p' + * + * Creates a sysfs-param to control the classes defined by the + * exported classmap, with bits 0..N-1 mapped to the classes named. + * This version keeps class-state in a private long int. + */ +#define DYNAMIC_DEBUG_CLASSMAP_PARAM(_name, _var, _flags) \ + static unsigned long _name##_bvec; \ + __DYNAMIC_DEBUG_CLASSMAP_PARAM(_name, _name##_bvec, _var, _flags) + +/** + * DYNAMIC_DEBUG_CLASSMAP_PARAM_REF - wrap a classmap with a controlling s= ys-param + * @_name: sysfs node name + * @_bits: name of the module's unsigned long bit-vector, ex: __drm_debug + * @_var: name of the (exported) classmap var defining the classes/bits + * @_flags: flags to be toggled, typically just 'p' + * + * Creates a sysfs-param to control the classes defined by the + * exported clasmap, with bits 0..N-1 mapped to the classes named. + * This version keeps class-state in user @_bits. This lets drm check + * __drm_debug elsewhere too. + */ +#define DYNAMIC_DEBUG_CLASSMAP_PARAM_REF(_name, _bits, _var, _flags) \ + __DYNAMIC_DEBUG_CLASSMAP_PARAM(_name, _bits, _var, _flags) + +#define __DYNAMIC_DEBUG_CLASSMAP_PARAM(_name, _bits, _var, _flags) \ + static struct _ddebug_class_param _name##_##_flags =3D { \ + .bits =3D &(_bits), \ + .flags =3D #_flags, \ + .map =3D &(_var), \ + }; \ + module_param_cb(_name, ¶m_ops_dyndbg_classes, \ + &_name##_##_flags, 0600) + /* * pr_debug() and friends are globally enabled or modules have selectively * enabled them. diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 56b503af0b31..0d603caadef8 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -666,6 +666,30 @@ static int ddebug_apply_class_bitmap(const struct _dde= bug_class_param *dcp, =20 #define CLASSMAP_BITMASK(width) ((1UL << (width)) - 1) =20 +static void ddebug_class_param_clamp_input(unsigned long *inrep, const str= uct kernel_param *kp) +{ + const struct _ddebug_class_param *dcp =3D kp->arg; + const struct _ddebug_class_map *map =3D dcp->map; + + switch (map->map_type) { + case DD_CLASS_TYPE_DISJOINT_BITS: + /* expect bits. mask and warn if too many */ + if (*inrep & ~CLASSMAP_BITMASK(map->length)) { + pr_warn("%s: input: 0x%lx exceeds mask: 0x%lx, masking\n", + KP_NAME(kp), *inrep, CLASSMAP_BITMASK(map->length)); + *inrep &=3D CLASSMAP_BITMASK(map->length); + } + break; + case DD_CLASS_TYPE_LEVEL_NUM: + /* input is bitpos, of highest verbosity to be enabled */ + if (*inrep > map->length) { + pr_warn("%s: level:%ld exceeds max:%d, clamping\n", + KP_NAME(kp), *inrep, map->length); + *inrep =3D map->length; + } + break; + } +} static int param_set_dyndbg_module_classes(const char *instr, const struct kernel_param *kp, const char *mod_name) @@ -684,26 +708,15 @@ static int param_set_dyndbg_module_classes(const char= *instr, pr_err("expecting numeric input, not: %s > %s\n", instr, KP_NAME(kp)); return -EINVAL; } + ddebug_class_param_clamp_input(&inrep, kp); =20 switch (map->map_type) { case DD_CLASS_TYPE_DISJOINT_BITS: - /* expect bits. mask and warn if too many */ - if (inrep & ~CLASSMAP_BITMASK(map->length)) { - pr_warn("%s: input: 0x%lx exceeds mask: 0x%lx, masking\n", - KP_NAME(kp), inrep, CLASSMAP_BITMASK(map->length)); - inrep &=3D CLASSMAP_BITMASK(map->length); - } v2pr_info("bits:0x%lx > %s.%s\n", inrep, mod_name ?: "*", KP_NAME(kp)); totct +=3D ddebug_apply_class_bitmap(dcp, &inrep, *dcp->bits, mod_name); *dcp->bits =3D inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: - /* input is bitpos, of highest verbosity to be enabled */ - if (inrep > map->length) { - pr_warn("%s: level:%ld exceeds max:%d, clamping\n", - KP_NAME(kp), inrep, map->length); - inrep =3D map->length; - } old_bits =3D CLASSMAP_BITMASK(*dcp->lvl); new_bits =3D CLASSMAP_BITMASK(inrep); v2pr_info("lvl:%ld bits:0x%lx > %s\n", inrep, new_bits, KP_NAME(kp)); @@ -1171,15 +1184,24 @@ static const struct proc_ops proc_fops =3D { static void ddebug_sync_classbits(const struct kernel_param *kp, const cha= r *modname) { const struct _ddebug_class_param *dcp =3D kp->arg; + unsigned long new_bits; =20 - /* clamp initial bitvec, mask off hi-bits */ - if (*dcp->bits & ~CLASSMAP_BITMASK(dcp->map->length)) { - *dcp->bits &=3D CLASSMAP_BITMASK(dcp->map->length); - v2pr_info("preset classbits: %lx\n", *dcp->bits); + ddebug_class_param_clamp_input(dcp->bits, kp); + + switch (dcp->map->map_type) { + case DD_CLASS_TYPE_DISJOINT_BITS: + v2pr_info(" %s: classbits: 0x%lx\n", KP_NAME(kp), *dcp->bits); + ddebug_apply_class_bitmap(dcp, dcp->bits, 0UL, modname); + break; + case DD_CLASS_TYPE_LEVEL_NUM: + new_bits =3D CLASSMAP_BITMASK(*dcp->lvl); + v2pr_info(" %s: lvl:%ld bits:0x%lx\n", KP_NAME(kp), *dcp->lvl, new_bits= ); + ddebug_apply_class_bitmap(dcp, &new_bits, 0UL, modname); + break; + default: + pr_err("bad map type %d\n", dcp->map->map_type); + return; } - /* force class'd prdbgs (in USEr module) to match (DEFINEr module) class-= param */ - ddebug_apply_class_bitmap(dcp, dcp->bits, ~0, modname); - ddebug_apply_class_bitmap(dcp, dcp->bits, 0, modname); } =20 static void ddebug_match_apply_kparam(const struct kernel_param *kp, diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 4a3d2612ef60..78cf5420770a 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Kernel module for testing dynamic_debug + * Kernel module to test/demonstrate dynamic_debug features, + * particularly classmaps and their support for subsystems like DRM. * * Authors: * Jim Cromie @@ -62,24 +63,6 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 0= 600); =20 #define CLASSMAP_BITMASK(width, base) (((1UL << (width)) - 1) << (base)) =20 -/* sysfs param wrapper, proto-API */ -#define DYNAMIC_DEBUG_CLASSMAP_PARAM_(_model, _flags, _init) \ - static unsigned long bits_##_model =3D _init; \ - static struct _ddebug_class_param _flags##_##_model =3D { \ - .bits =3D &bits_##_model, \ - .flags =3D #_flags, \ - .map =3D &map_##_model, \ - }; \ - module_param_cb(_flags##_##_model, ¶m_ops_dyndbg_classes, \ - &_flags##_##_model, 0600) -#ifdef DEBUG -#define DYNAMIC_DEBUG_CLASSMAP_PARAM(_model, _flags) \ - DYNAMIC_DEBUG_CLASSMAP_PARAM_(_model, _flags, ~0) -#else -#define DYNAMIC_DEBUG_CLASSMAP_PARAM(_model, _flags) \ - DYNAMIC_DEBUG_CLASSMAP_PARAM_(_model, _flags, 0) -#endif - /* * Demonstrate/test DISJOINT & LEVEL typed classmaps with a sys-param. * @@ -110,12 +93,15 @@ enum cat_disjoint_bits { /* numeric verbosity, V2 > V1 related. V0 is > D2_DRM_RES */ enum cat_level_num { V0 =3D 16, V1, V2, V3, V4, V5, V6, V7 }; =20 -/* recapitulate DRM's multi-classmap setup */ +/* + * use/demonstrate multi-module-group classmaps, as for DRM + */ #if !defined(TEST_DYNAMIC_DEBUG_SUBMOD) /* - * In single user, or parent / coordinator (drm.ko) modules, define - * classmaps on the client enums above, and then declares the PARAMS - * ref'g the classmaps. Each is exported. + * For module-groups of 1+, define classmaps with names (stringified + * enum-symbols) copied from above. 1-to-1 mapping is recommended. + * The classmap is exported, so that other modules in the group can + * link to it and control their prdbgs. */ DYNAMIC_DEBUG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BI= TS, D2_CORE, @@ -134,11 +120,13 @@ DYNAMIC_DEBUG_CLASSMAP_DEFINE(map_level_num, DD_CLASS= _TYPE_LEVEL_NUM, V0, "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7"); =20 /* - * now add the sysfs-params + * for use-cases that want it, provide a sysfs-param to set the + * classes in the classmap. It is at this interface where the + * "v3>v2" property is applied to DD_CLASS_TYPE_LEVEL_NUM inputs. */ =20 -DYNAMIC_DEBUG_CLASSMAP_PARAM(disjoint_bits, p); -DYNAMIC_DEBUG_CLASSMAP_PARAM(level_num, p); +DYNAMIC_DEBUG_CLASSMAP_PARAM(p_disjoint_bits, map_disjoint_bits, p); +DYNAMIC_DEBUG_CLASSMAP_PARAM(p_level_num, map_level_num, p); =20 #ifdef FORCE_CLASSID_CONFLICT /* @@ -149,12 +137,10 @@ DYNDBG_CLASSMAP_DEFINE(classid_range_conflict, 0, D2_= CORE + 1, "D3_CORE"); #endif =20 #else /* TEST_DYNAMIC_DEBUG_SUBMOD */ - /* - * in submod/drm-drivers, use the classmaps defined in top/parent - * module above. + * the +1 members of a multi-module group refer to the classmap + * DEFINEd (and exported) above. */ - DYNAMIC_DEBUG_CLASSMAP_USE(map_disjoint_bits); DYNAMIC_DEBUG_CLASSMAP_USE(map_level_num); =20 @@ -229,6 +215,7 @@ static void __exit test_dynamic_debug_exit(void) module_init(test_dynamic_debug_init); module_exit(test_dynamic_debug_exit); =20 +MODULE_DESCRIPTION("test/demonstrate dynamic-debug features"); MODULE_AUTHOR("Jim Cromie "); MODULE_DESCRIPTION("Kernel module for testing dynamic_debug"); MODULE_LICENSE("GPL"); diff --git a/lib/test_dynamic_debug_submod.c b/lib/test_dynamic_debug_submo= d.c index 672aabf40160..3adf3925fb86 100644 --- a/lib/test_dynamic_debug_submod.c +++ b/lib/test_dynamic_debug_submod.c @@ -1,6 +1,9 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Kernel module for testing dynamic_debug + * Kernel module to test/demonstrate dynamic_debug features, + * particularly classmaps and their support for subsystems, like DRM, + * which defines its drm_debug classmap in drm module, and uses it in + * helpers & drivers. * * Authors: * Jim Cromie @@ -12,3 +15,7 @@ */ #define TEST_DYNAMIC_DEBUG_SUBMOD #include "test_dynamic_debug.c" + +MODULE_DESCRIPTION("test/demonstrate dynamic-debug subsystem support"); +MODULE_AUTHOR("Jim Cromie "); +MODULE_LICENSE("GPL"); --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f171.google.com (mail-il1-f171.google.com [209.85.166.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE8E61F417E for ; Wed, 2 Apr 2025 17:42:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615759; cv=none; b=GwD74TmXhaucgnYvf8WqbDxBKSQLwVOTZW09xrhXLp1nX1olCup1LqtMYlwEcvj/7GlG2SwtiAWFI/nATKFvtaqEJigksZuixS7CmPuFHVBFZ9vZwJXmAzBxK/WG/akdBBEVqVepXAgEmoLzXJpeHuGMRgRCuLDtpQRKdjeVzME= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615759; c=relaxed/simple; bh=0VhOah8KNQkjy9u5bqPxuxp4A0NYVfoyW8pjJzUH2xU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uO4R0iln0ud7cIbzL1Ka/0CjvmM6iSkxcS00qZH/Ag+aXWCTGJrAZ2dbUvFvuICcMe34JpHayD7yolHfqN7G3FMilDGs2VGppioRUcWVDd/evyijwi63lqe6rxmo0IPhOMMvWGndxKOsauEWE/aBP10nM3uubI/sK0L5s9/0FLI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KZbpS34R; arc=none smtp.client-ip=209.85.166.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KZbpS34R" Received: by mail-il1-f171.google.com with SMTP id e9e14a558f8ab-3ce87d31480so492425ab.2 for ; Wed, 02 Apr 2025 10:42:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615757; x=1744220557; 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=eURkwPwKw4vTaVpJGMjl6Mz91xCr+xlab1qXSWsbeFY=; b=KZbpS34RuQPWFnSzZsDGohUPDzIJzwaNRMUFnOTVv1pFTidLkXKzss8WDwQb1Va1Mf 5wYSwTYWVuhvcAcQQ5d7dPDSjalCwx4XKfK27Sn6b0pPBsjWHhLLL7daqTypuX2EqWx0 mOp7DFqjLw8E2UmVbSYXnSJ87nr9je2wTIe9CQsL2LCIKSk+azj210H8MN2ij6wlmcrN SbwRJ19wIYVNLSwxlySVbic49j7w+I1aQ2F/qtYU8cutYwMTZm9Z1eFmkAx/GJHPtHer RtXku2zxx4aV2+NdTxiTrztHvyE1hB2ji0miqii+zu+3iwIifBc8okSGZ8ndlbzbF4cH SqrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615757; x=1744220557; 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=eURkwPwKw4vTaVpJGMjl6Mz91xCr+xlab1qXSWsbeFY=; b=TJLWeL5VI79eKAVreOTGMDsDqbHg9aDa/j5O8pIkZze2KSrrqljUk0/HH9j8600zOc A3sMm7QRfsH4EvBkQsmgrlEr8o4WnEMusANF26MwcdFOoQ7wpJ8ql4VgmfZjaS6xwP0X qT1ZYKXimeRzY6VqcdZfcvdDLc0GX0pYtj9ShDrYUM0iO7v9qsb7wk7/roBkfwNT47KE ERFJeUJmt0qA3rWEgfnzobh9W1qvJSGVNBdToC7UIf9t0wffbKlzux/+MkucR2jFe56N fxAoiNwUj9TFlTAbUw30+RvDkFONCZ5DzPeqMYWmtcsFUeT/82IS9TZBJmlPBKIY7Eva LMPw== X-Forwarded-Encrypted: i=1; AJvYcCXJyWfPy0c9Q97YrUlPHgW6nVdZI0ybC7R/U1dqAcLDk+rPdHzw11PNlXn1HZ9/jc01MDr3W7Id/72c2/o=@vger.kernel.org X-Gm-Message-State: AOJu0Yw85fmdI6AMlf3iq6J+oi63UdKuq3pcLhMkfRdgRyBrCuy9q+R1 Ndnr83i9zFToGDWeeP5jAB8dp+IelOKZ6euyFMiElb6E/0/RxQaw X-Gm-Gg: ASbGncvN3l9xGz1a7/wYblQfxW+2v863GQ2kH4kcUzWPvoO5V3MGBTUSpMb5m0ltdnW J1DAO1i1o7cNZydLaNvDa05V1yXfAGVTqIIijV8cjdute75eteyg1BOomqFvqdm72HfwGCONW69 1K1qFmzMuQTlS6900M7exJtBYNnWz5hwvBsbM/0OAclHmMEEASnEGyA/Z/n8lEE4Egz6xfZRaP7 AgXyF5mxbl9Sz6tbnHDd5zas7Nj4mbCKNPFFuCSAjM895zpVJKLzkyhY4szEefGbnhB+aQaEGqN aAU/Z4KjOW5ZljbPnP5Ic7lv0TVHI1rDsc7Iv1kFMpqTBhEm/vmx9K89fBtQ16tJeuQFvclZL90 NvA== X-Google-Smtp-Source: AGHT+IFOwJqxt3+Bc5BjTaI4wehPC3f7tDSqG024LF0DEkHz1iw3TJJMpnglnawcz+3wXnO3Ge6iQQ== X-Received: by 2002:a05:6e02:c:b0:3d1:a34b:4d01 with SMTP id e9e14a558f8ab-3d5e09090famr201375295ab.8.1743615757146; Wed, 02 Apr 2025 10:42:37 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:36 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 23/54] dyndbg: treat comma as a token separator Date: Wed, 2 Apr 2025 11:41:25 -0600 Message-ID: <20250402174156.1246171-24-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Treat comma as a token terminator, just like a space. This allows a user to avoid quoting hassles when spaces are otherwise needed: :#> modprobe drm dyndbg=3Dclass,DRM_UT_CORE,+p\;class,DRM_UT_KMS,+p or as a boot arg: drm.dyndbg=3Dclass,DRM_UT_CORE,+p # todo: support multi-query here Given the many ways a boot-line +args can be assembled and then passed in/down/around shell based tools, this may allow side-stepping all sorts of quoting hassles thru those layers. existing query format: modprobe test_dynamic_debug dyndbg=3D"class D2_CORE +p" new format: modprobe test_dynamic_debug dyndbg=3Dclass,D2_CORE,+p ALSO selftests-dyndbg: add comma_terminator_tests New fn validates parsing and effect of queries using combinations of commas and spaces to delimit the tokens. It manipulates pr-debugs in builtin module/params, so might have deps I havent foreseen on odd configurations. Signed-off-by: Jim Cromie Co-developed-by: =C5=81ukasz Bartosik Signed-off-by: =C5=81ukasz Bartosik --- - skip comma tests if no builtins -v3 squash in tests and doc --- .../admin-guide/dynamic-debug-howto.rst | 9 +++++--- lib/dynamic_debug.c | 17 +++++++++++---- .../dynamic_debug/dyndbg_selftest.sh | 21 ++++++++++++++++++- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentat= ion/admin-guide/dynamic-debug-howto.rst index 63a511f2337b..e2dbb5d9b314 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -78,11 +78,12 @@ Command Language Reference =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D =20 At the basic lexical level, a command is a sequence of words separated -by spaces or tabs. So these are all equivalent:: +by spaces, tabs, or commas. So these are all equivalent:: =20 :#> ddcmd file svcsock.c line 1603 +p :#> ddcmd "file svcsock.c line 1603 +p" :#> ddcmd ' file svcsock.c line 1603 +p ' + :#> ddcmd file,svcsock.c,line,1603,+p =20 Command submissions are bounded by a write() system call. Multiple commands can be written together, separated by ``;`` or ``\n``:: @@ -167,9 +168,11 @@ module The given string is compared against the module name of each callsite. The module name is the string as seen in ``lsmod``, i.e. without the directory or the ``.ko`` - suffix and with ``-`` changed to ``_``. Examples:: + suffix and with ``-`` changed to ``_``. =20 - module sunrpc + Examples:: + + module,sunrpc # with ',' as token separator module nfsd module drm* # both drm, drm_kms_helper =20 diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 0d603caadef8..5737f1b4eba8 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -299,6 +299,14 @@ static int ddebug_change(const struct ddebug_query *qu= ery, struct flag_settings return nfound; } =20 +static char *skip_spaces_and_commas(const char *str) +{ + str =3D skip_spaces(str); + while (*str =3D=3D ',') + str =3D skip_spaces(++str); + return (char *)str; +} + /* * Split the buffer `buf' into space-separated words. * Handles simple " and ' quoting, i.e. without nested, @@ -312,8 +320,8 @@ static int ddebug_tokenize(char *buf, char *words[], in= t maxwords) while (*buf) { char *end; =20 - /* Skip leading whitespace */ - buf =3D skip_spaces(buf); + /* Skip leading whitespace and comma */ + buf =3D skip_spaces_and_commas(buf); if (!*buf) break; /* oh, it was trailing whitespace */ if (*buf =3D=3D '#') @@ -329,7 +337,7 @@ static int ddebug_tokenize(char *buf, char *words[], in= t maxwords) return -EINVAL; /* unclosed quote */ } } else { - for (end =3D buf; *end && !isspace(*end); end++) + for (end =3D buf; *end && !isspace(*end) && *end !=3D ','; end++) ; if (end =3D=3D buf) { pr_err("parse err after word:%d=3D%s\n", nwords, @@ -601,7 +609,8 @@ static int ddebug_exec_queries(char *query, const char = *modname) if (split) *split++ =3D '\0'; =20 - query =3D skip_spaces(query); + query =3D skip_spaces_and_commas(query); + if (!query || !*query || *query =3D=3D '#') continue; =20 diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/too= ls/testing/selftests/dynamic_debug/dyndbg_selftest.sh index 465fad3f392c..c7bf521f36ee 100755 --- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh @@ -216,7 +216,7 @@ function check_err_msg() { function basic_tests { echo -e "${GREEN}# BASIC_TESTS ${NC}" if [ $LACK_DD_BUILTIN -eq 1 ]; then - echo "SKIP" + echo "SKIP - test requires params, which is a builtin module" return fi ddcmd =3D_ # zero everything @@ -238,8 +238,27 @@ EOF ddcmd =3D_ } =20 +function comma_terminator_tests { + echo -e "${GREEN}# COMMA_TERMINATOR_TESTS ${NC}" + if [ $LACK_DD_BUILTIN -eq 1 ]; then + echo "SKIP - test requires params, which is a builtin module" + return + fi + # try combos of spaces & commas + check_match_ct '\[params\]' 4 -r + ddcmd module,params,=3D_ # commas as spaces + ddcmd module,params,+mpf # turn on module's pr-debugs + check_match_ct =3Dpmf 4 + ddcmd ,module ,, , params, -p + check_match_ct =3Dmf 4 + ddcmd " , module ,,, , params, -m" # + check_match_ct =3Df 4 + ddcmd =3D_ +} + tests_list=3D( basic_tests + comma_terminator_tests ) =20 # Run tests --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f180.google.com (mail-il1-f180.google.com [209.85.166.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3464E1D86E8 for ; Wed, 2 Apr 2025 17:42:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615761; cv=none; b=sc/dnrBpG7jZzvxGE78IWJ67aIjDkWbomqIobm3RKbez/a8LJzdKnhEOnWdOo6ltetMQHoaJviJ/PR6YX9jVxFTMP/eQPPWMGHG5aWr+U9xUizhNcvWMSKcIzq5tm89nHXJasGac2I5HZWgp/eSiTqYSl2K+yZQfKoqGm8/+S0s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615761; c=relaxed/simple; bh=/S2Oq6yq/+UN+BPX+p8Yp3K51tuN+nu4aCUOQLAnb1w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fSdhBanFv/e9HS2maFpBaUx3yBRktcqp1DDITsZvyTfSaxAR/aBp0nlcpl5mQP8SANWPfan3Ysop08AEGl8oXVFo1VcBp4E3WDNd3iZ6+bgK+8DIN4TJv/U8lSgGNqC3+bG4dRWYEScp6r+p4VXthENl13KxW88IFpIBQ962WcM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nAYQxoR0; arc=none smtp.client-ip=209.85.166.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nAYQxoR0" Received: by mail-il1-f180.google.com with SMTP id e9e14a558f8ab-3d46ef71b6cso823445ab.3 for ; Wed, 02 Apr 2025 10:42:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615758; x=1744220558; 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=ucC/m8VvNwawJ172sGBJnoV5QJtRGG6wMlODfeStmbw=; b=nAYQxoR0uxv1VT3Bfcqgna79O6kmIHf6mr5FfinzIwRmeBIK+cAJhKKXNciTeno0or 3ekcq90mjXvr4XdnS/5qZU0YcHFge1cDjbmaBlLYzLuDEjDIvfnsno4+ChL6GsWqWZrB xmal+9796K/+ehCOrTXpgZXxGStKO7FwcV1FAGiIyjVFNxz8avcdj/avblZqeDOh9TId E3oWH3JlpuoAGNLDOZAyjiGPU7iKywl0up6TS9wkrM2We5Yrz3jzJ5ZwHJLTtS7hSQkW DaPedZnr0lYx8kfTw2aaRJK/NrLDzb4kem2MxJSvrFmBklnIDj6ApXHBQhNHJN9POe3i m0AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615758; x=1744220558; 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=ucC/m8VvNwawJ172sGBJnoV5QJtRGG6wMlODfeStmbw=; b=QiZ76CVc3cwzNAxNxSOpxWgDhZu9QPig2RzsOW5j5Fa397IwY7f1idjIoYMM6JyXgL CsnJKjmAxS395ohUrX9K1aVJROvXREoB5kwb1UIP1ZBjkqOdmxE5ohkSlCHugJ6lh4Rx FUfwfW2bdR5Zm9ivy65gFPnOQ0PaIahcb7PSgJKVKXzCPETlgnDq/IsdOwBm44i/ee1g b9MoVFy5H0h846yh9jp6YurBLxow/yw+IAxlkzWIHg27E2eUtd4eb6ThtsO4JYoKR7cb SUYJNFLx965HvgV9xT6l3yfVHeJgnCS6hEX9X5cEK6XzDoj66iqcI94Uy1z0iW3IhjtE 0y4A== X-Forwarded-Encrypted: i=1; AJvYcCUI+Orkd1EkE9f1LlQmCM3Bb+scLTuVA7h7w53uUWQtGrlgAFtn+54WtwEiWrnaRszpz//BEvhkrbm1T6A=@vger.kernel.org X-Gm-Message-State: AOJu0YzDwxfebVChwckrAhU4+dZ7EPvxWEHJKPtBWcXqGyfqQm02c+NA TD3TyA48nzxHswd4+yWn0YBi2aMls7z2IljzYs78dytt/lUNJ0Z0 X-Gm-Gg: ASbGnctpc1R+gaNo9ODZs7cpDSW6tqZmr6TCTp12orPQnHFe+okCMyDRtbms3TRu1Ft f3mmi8+bOzpUKil0JM13P9bJrIKlr/TSvpjZdGPKFzsMez0ZrdcPtPnvr8Zt6jIoGfHURm6ei7J iQ2Q1LZHVtsoAVqpsgh645jmtvcclsf81AE6e56s8j29rt2kZlroxUAc6sLYD7drD0PjU8d1WKx 5DXr7iPNm6ArClj0ht1IVfY/q5XVfreEvyGUL64mqWO25loEGt3K9/6jRU6QxgSoh/bnM+x94yZ 084ZX30fS6JQSy+p6eym/f1hHJW6BnmycUH3WqYCopja9JyO37cWY8w6/DSeK4tGElvBLr+bOQH 7vw== X-Google-Smtp-Source: AGHT+IF/XWq8cu039JozjszDLRHZIQvsUr2yI7oC7chl8Xer0eG1cUzokFxTUnVEktkBv7Bfp+A18w== X-Received: by 2002:a05:6e02:1849:b0:3d0:19c6:c9e1 with SMTP id e9e14a558f8ab-3d6ca5f84eemr79178055ab.13.1743615758138; Wed, 02 Apr 2025 10:42:38 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:37 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 24/54] dyndbg: split multi-query strings with % Date: Wed, 2 Apr 2025 11:41:26 -0600 Message-ID: <20250402174156.1246171-25-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Since commit 85f7f6c0edb8 ("dynamic_debug: process multiple debug-queries on a line") Multi-query commands have been allowed: modprobe drm dyndbg=3D"class DRM_UT_CORE +p; class DRM_UT_KMS +p" modprobe drm dyndbg=3D< [ 203.902703] dyndbg: query parse failed [ 203.902871] dyndbg: processed 2 queries, with 0 matches, 2 errs bash: echo: write error: Invalid argument The '%' splits the input into 2 queries, and both fail. Given the limited utility of matching against the working parts of a format string "foo: %d bar %s", nothing is actually lost here. selftests-dyndbg: test_percent_splitting This does basic testing of classmaps using '%' separated multi-queries. It modprobes test_dynamic_debug with several classes enabled, and counts to verify that the expected sites show the enablement in the control file. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- -v3 squash feature, test, doc together gate new test, which needs test-dynamic-debug.ko test-percent-escape --- .../admin-guide/dynamic-debug-howto.rst | 8 ++++--- lib/dynamic_debug.c | 2 +- .../dynamic_debug/dyndbg_selftest.sh | 24 +++++++++++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentat= ion/admin-guide/dynamic-debug-howto.rst index e2dbb5d9b314..1ceadf4f28f9 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -85,10 +85,12 @@ by spaces, tabs, or commas. So these are all equivalen= t:: :#> ddcmd ' file svcsock.c line 1603 +p ' :#> ddcmd file,svcsock.c,line,1603,+p =20 -Command submissions are bounded by a write() system call. -Multiple commands can be written together, separated by ``;`` or ``\n``:: +Command submissions are bounded by a write() system call. Multiple +commands can be written together, separated by ``%``, ``;`` or ``\n``:: =20 - :#> ddcmd "func pnpacpi_get_resources +p; func pnp_assign_mem +p" + :#> ddcmd func foo +p % func bar +p + :#> ddcmd func foo +p \; func bar +p + :#> ddcmd "func foo +p ; func bar +p" :#> ddcmd <<"EOC" func pnpacpi_get_resources +p func pnp_assign_mem +p diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 5737f1b4eba8..7a60088a1b5c 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -605,7 +605,7 @@ static int ddebug_exec_queries(char *query, const char = *modname) int i, errs =3D 0, exitcode =3D 0, rc, nfound =3D 0; =20 for (i =3D 0; query; query =3D split) { - split =3D strpbrk(query, ";\n"); + split =3D strpbrk(query, "%;\n"); if (split) *split++ =3D '\0'; =20 diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/too= ls/testing/selftests/dynamic_debug/dyndbg_selftest.sh index c7bf521f36ee..513f6cb1db1d 100755 --- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh @@ -256,9 +256,33 @@ function comma_terminator_tests { ddcmd =3D_ } =20 +function test_percent_splitting { + echo -e "${GREEN}# TEST_PERCENT_SPLITTING - multi-command splitting on= % ${NC}" + if [ $LACK_TMOD -eq 1 ]; then + echo "SKIP - test requires test-dynamic-debug.ko" + return + fi + ifrmmod test_dynamic_debug_submod + ifrmmod test_dynamic_debug + ddcmd =3D_ + modprobe test_dynamic_debug dyndbg=3Dclass,D2_CORE,+pf%class,D2_KMS,+p= t%class,D2_ATOMIC,+pm + check_match_ct =3Dpf 1 + check_match_ct =3Dpt 1 + check_match_ct =3Dpm 1 + check_match_ct test_dynamic_debug 23 -r + # add flags to those callsites + ddcmd class,D2_CORE,+mf%class,D2_KMS,+lt%class,D2_ATOMIC,+ml + check_match_ct =3Dpmf 1 + check_match_ct =3Dplt 1 + check_match_ct =3Dpml 1 + check_match_ct test_dynamic_debug 23 -r + ifrmmod test_dynamic_debug +} + tests_list=3D( basic_tests comma_terminator_tests + test_percent_splitting ) =20 # Run tests --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f171.google.com (mail-il1-f171.google.com [209.85.166.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D15F1F4CBE for ; Wed, 2 Apr 2025 17:42:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615762; cv=none; b=SGgB3UIwC4MXMOyMjD4dAVsyHYq6qlMkOXQ1tSiAelp8DymH72PvmslBgid50wr1ML5FCC8yPQKpcUMJebDwHd7XGGJ11+QbIlGgj/oPby3MsctD9unt1wjpUX6j+8v2sIKMM0BKLMFmMQhpGCthT23wfIOHqwPgHBjrADGMuwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615762; c=relaxed/simple; bh=FufqRHztesKUA9R7JaFyA9Iq+LLeP3mh04LhL5pR3Co=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TulIZkjcLHG+9/O5rRxWnkWF7Gx5v+5WPOPHw4mnIw5pnAB0Fj3iZ9tgFILGixpcGWzGsrvFOkK+YF90q486a4v36C3YyuVF91n8lw/eofg6j/OSAY5Mv/XAQsNlHWBKFYBhvbyffPSTRcItF0O6PNlqsVI6IPcu4JtMD6vAEkk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lfzZ4LQN; arc=none smtp.client-ip=209.85.166.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lfzZ4LQN" Received: by mail-il1-f171.google.com with SMTP id e9e14a558f8ab-3d589ed2b47so469725ab.2 for ; Wed, 02 Apr 2025 10:42:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615759; x=1744220559; 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=ImilXtuxs5UykdZVkLyjXnRTikwvIK4nE+zQcHkVhFU=; b=lfzZ4LQNXjrMetBt4Z5KW9sEIpLOJXjbe3CV54q5ipjdbDkc03y6t7MnJWVZJFmpFO XVHTMhjyfTjb2yC5dUqIsTj2DQzslPF6sIqy6108hm5mP3odbSga84tGB2o+4vDIiQc5 cHoOJLnZZBOFV0ZLYJoXrf8wyOVqmQdNGZTEg8b8VqszabRX1KWqHX+oeswR94X1AvXx 2vtSCvCY+kQ6/iRjhFOJyAiHfc9HKW2B3L2eqmAwPoEAy99226rDYFCfqNJcQjUs4wTS w1eYKIrxItf3jDzWkDrLHX2X5Y751+s9F6Hh4Jkf7LJV0CFnNHHZedE8szT9gKbcz2Pf 2SWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615759; x=1744220559; 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=ImilXtuxs5UykdZVkLyjXnRTikwvIK4nE+zQcHkVhFU=; b=Ipgwpbzc+xhhScABDmVow9VPPH/PpA4jAoF92uFFTAlo3qg+ftaaV28Ri5Hq49P/D+ X41RZtsYodfr/mdzLyRBaehLltT4ix5U4QnopuYvg/IMJxYL9RUqrVKughosvPOgfm7k EL7YVVtqyZN/32T2TllFvfQXexebOq1lZxhSyYDeRY5Qh9AzLdQfJE9XbZDGnnO6Bq74 E+p7sfznB+3fI3CYVjl7hvMfT02SqB07Yef1RJktt+z+glCURP4f/S2Vr+QIufdbTcVN 3i8jKokyqMGjXZU8JGEQ/EJekSmwIwOcALA7MZHfYYAl/CXyf5UXrVE//ks8QmIc4CfU YYig== X-Forwarded-Encrypted: i=1; AJvYcCXUmElskEAEaDMY96rT3we8kw7KW/HDjgKfpwp9ZaBqPi2tubWvDj1SxCCO24V7v3tpuHAt9redqTkp7A8=@vger.kernel.org X-Gm-Message-State: AOJu0YylsExaj7GP6NMCgvRydNgtg/xBH0EfsgOqMu8IXB0anuGHclbl u+DAxAiWmRVVuG5U82bNhBMajHqarTzRgsrLiei41aRrBaz1mEVk X-Gm-Gg: ASbGncvgPfWfaGW+10XPJ8Y8nteyRBmDTLW5fCm0+DGAsKdFSro0riVX2lgj3iCzBS5 RGFV2xNv6mE+YogIY3WxeBBn1GklCDZs983ofZmGwzXm422nC2/GB9zWA7w+bwuWbMtq1seNuBr RM9kEKx/5tUY8+b70OMFSeU2A0wdP/f1Y2eNHkPrT5yvQ4wXae7P+4pzpZM8R9WRc1xSac6KALV MHXIPS3AC+xXbuSM0ICEAVvVbCNTnTQlPCtYHONDtPXvDyiHkxC2Kr3DYQc/so7vbVFo79nenbx wEto6X86t4vTu/QRmK6xuuORdOlUzRd6H7yJ+YixOnh5cmhvhu9KN9UgynMkIHNs6rBeJzceC4g SOg== X-Google-Smtp-Source: AGHT+IE0+XTb679NRDlwHvBKShIbNYwOqIHu3Kb2Ud4uaIbrPaynJg2DfA762m7J7fFxbGsQC+M3Yw== X-Received: by 2002:a05:6e02:4401:20b0:3d6:d838:8ba9 with SMTP id e9e14a558f8ab-3d6d8389342mr21563885ab.1.1743615759159; Wed, 02 Apr 2025 10:42:39 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:38 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 25/54] selftests-dyndbg: add test_mod_submod Date: Wed, 2 Apr 2025 11:41:27 -0600 Message-ID: <20250402174156.1246171-26-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This new test-fn runs 3 module/submodule modprobe scenarios, variously using both the generic dyndbg=3D modprobe arg, and the test-module's classmap-params to manipulate the test-mod*'s pr_debugs. In all cases, the current flag-settings are counted and tested vs expectations. The 3rd scenario recapitulates the DRM_USE_DYNAMIC_DEBUG=3Dy failure. 1. 2 modprobes (super then sub), with separate dyndbg=3Dclass-settings check module specific flag settings 2. modprobe submod, supermod is auto-loaded set supermod class-params check expected enablements in super & submod 3. modprobe super, with param=3Dsetting (like drm.debug=3D0x1ef) modprobe submod validate submod's class'd pr_debugs get properly enabled The test uses multi-queries, with both commas and percents (to avoid spaces and quoting). This is the main reason the test wasn't earlier in the patchset, closer to the classmap patches its validating. With some tedium, the tests could be refactored to split out early tests which avoid multi-cmds, and test only the class-params. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- r3 - skip test if LACK_TMOD older drop -v used in test_mod_submod(). V=3D1 does it for whole test ifrmmod at test end (Lukasz) test-mod-tmod --- .../dynamic_debug/dyndbg_selftest.sh | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/too= ls/testing/selftests/dynamic_debug/dyndbg_selftest.sh index 513f6cb1db1d..09937dca3056 100755 --- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh @@ -279,10 +279,83 @@ function test_percent_splitting { ifrmmod test_dynamic_debug } =20 +function test_mod_submod { + echo -e "${GREEN}# TEST_MOD_SUBMOD ${NC}" + if [ $LACK_TMOD -eq 1 ]; then + echo "SKIP - test requires test-dynamic-debug.ko" + return + fi + ifrmmod test_dynamic_debug_submod + ifrmmod test_dynamic_debug + ddcmd =3D_ + + # modprobe with class enablements + modprobe test_dynamic_debug \ + dyndbg=3Dclass,D2_CORE,+pf%class,D2_KMS,+pt%class,D2_ATOMIC,+pm + + check_match_ct '\[test_dynamic_debug\]' 23 -r + check_match_ct =3Dpf 1 + check_match_ct =3Dpt 1 + check_match_ct =3Dpm 1 + + modprobe test_dynamic_debug_submod + check_match_ct test_dynamic_debug_submod 23 -r + check_match_ct '\[test_dynamic_debug\]' 23 -r + check_match_ct test_dynamic_debug 46 -r + + # no enablements propagate here + check_match_ct =3Dpf 1 + check_match_ct =3Dpt 1 + check_match_ct =3Dpm 1 + + # change classes again, this time submod too + ddcmd class,D2_CORE,+mf%class,D2_KMS,+lt%class,D2_ATOMIC,+ml "# add so= me prefixes" + check_match_ct =3Dpmf 1 + check_match_ct =3Dplt 1 + check_match_ct =3Dpml 1 + # submod changed too + check_match_ct =3Dmf 1 + check_match_ct =3Dlt 1 + check_match_ct =3Dml 1 + + # now work the classmap-params + # fresh start, to clear all above flags (test-fn limits) + ifrmmod test_dynamic_debug_submod + ifrmmod test_dynamic_debug + modprobe test_dynamic_debug_submod # get supermod too + + echo 1 > /sys/module/test_dynamic_debug/parameters/p_disjoint_bits + echo 4 > /sys/module/test_dynamic_debug/parameters/p_level_num + # 2 mods * ( V1-3 + D2_CORE ) + check_match_ct =3Dp 8 + echo 3 > /sys/module/test_dynamic_debug/parameters/p_disjoint_bits + echo 0 > /sys/module/test_dynamic_debug/parameters/p_level_num + # 2 mods * ( D2_CORE, D2_DRIVER ) + check_match_ct =3Dp 4 + echo 0x16 > /sys/module/test_dynamic_debug/parameters/p_disjoint_bits + echo 0 > /sys/module/test_dynamic_debug/parameters/p_level_num + # 2 mods * ( D2_DRIVER, D2_KMS, D2_ATOMIC ) + check_match_ct =3Dp 6 + + # recap DRM_USE_DYNAMIC_DEBUG regression + ifrmmod test_dynamic_debug_submod + ifrmmod test_dynamic_debug + # set super-mod params + modprobe test_dynamic_debug p_disjoint_bits=3D0x16 p_level_num=3D5 + check_match_ct =3Dp 7 + modprobe test_dynamic_debug_submod + # see them picked up by submod + check_match_ct =3Dp 14 + ifrmmod test_dynamic_debug_submod + ifrmmod test_dynamic_debug +} + tests_list=3D( basic_tests + # these require test_dynamic_debug*.ko comma_terminator_tests test_percent_splitting + test_mod_submod ) =20 # Run tests --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f179.google.com (mail-il1-f179.google.com [209.85.166.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBF361F560B for ; Wed, 2 Apr 2025 17:42:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615762; cv=none; b=uqzjcPTtdfo6e+RVMiTjdjh46o56JNmmypYzI6lyLWKQEAzSEpWHAdzmOoqV0WN8IzuioE10vn8EbmXeI9o3/i2af4mdV+F+XykCWCD6GC5l8ahXJzgSbwDOnVNn0t8v8Odxxf56wgZ+8b73R0mlYyV2L+Ly9V6qh8cxxmRKmX8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615762; c=relaxed/simple; bh=sQ4kybNcwJB+GUc/K15VQFyoC6KPj1ixL6Y1o7WcqE4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Bs+JKbgVuhAUYmw2w5GxgBuLFSenAmGPl0EDs0ysrd1p1geE9AeS025ymGHtmxCgM5qBxN8SJP9ZtDZqdA+3PBFRpIfTfj8LfrY1Vj7W+LloZCthHVCmPQcDVgKo9zvA9UVxm+KpGKPqf43NUF5Wvt1B6hBY+Lrzk8lNqyWbLOE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PF49KO6K; arc=none smtp.client-ip=209.85.166.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PF49KO6K" Received: by mail-il1-f179.google.com with SMTP id e9e14a558f8ab-3d5eb149914so755915ab.3 for ; Wed, 02 Apr 2025 10:42:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615760; x=1744220560; 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=/waPSOuN2eIL+7EriTAVG2KiDua5Tq+VfuPCwO/f/0I=; b=PF49KO6KxPibLyufRWxNUVmskRvlcSsUXF6y3QPjXZ42/+DSJz1TG2Ge0T7QWjacCB P2hRm3EYUvGCIzr6imV0mDFymy7woFwNoNzZXmy7l8qgsij3bVy4X4vxwsk+OXvFQNrf 7Iq5J/F5tk8NRwB+Q2j0+d9oX3ZMEFWKcgWaynkAJl8Z2xLK1WF5hJZ5X7XZzOSCTwUS XbzJ5rs6uf9XKBht4H4zriXf6KKwP5uON4XCpWQQkGu2M9cV4Ovk/iRDHnxygYCijUcC wgjnwxu+HuU1fOADuBIEFAIQ0aATApUDoUBtKmK1zTcbya1in27seLFqIPqSK2ShWmN+ ku1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615760; x=1744220560; 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=/waPSOuN2eIL+7EriTAVG2KiDua5Tq+VfuPCwO/f/0I=; b=lciiOclJ05M47yx0j3/kSxBI94vOTvMWE2FusCqB+eTQGRhEhaTx3Mc7MOL/cbBscH SF2WsLkFs9vPUQHucMS5YDr9lyovGkvnam/sPkPt/i6HFBw0YmVqg16kFJOBfdbzvPsF 5gW1u/1DkeZzLog1dNNu8wwg3l5w3eQLpbNj3j4dUspkjZBjyiffRH/gTKpz0WEgDHK+ 0zTq7uj8J+nOcibFbY21iSJ9dWN8OIWwZryM4vAYxN+uz3aIH/9wyQ7pG/RjdvBNpy9B 9CBzvNUMUxBhSli3OI1cxfJuUowxTmpMf9HabhFmM5VZk1dDA1MXfekGzOvC1sJUDdUW ai2w== X-Forwarded-Encrypted: i=1; AJvYcCXGxzsRx7oCSXRRzwwWUpZg9zkVyN19WCfoIEvhqkKaHjvf9dL7dU38LWGoO+SyY67yMKjdYApslj0E1g8=@vger.kernel.org X-Gm-Message-State: AOJu0YwnwCZU/3nKuMwNLr4Zdu8JZ6xzTrrHqI3zSmx/c5ceGalwLQBi dofmr41t/6SiyPfAtyHQd2RqZ4cFpGnX5+kUEslxYYJbXfN9Unjh X-Gm-Gg: ASbGnctYhJ0QUsxFGXLchQIns7FkUUAn5ss5k0fvnszUjCScXvus9T/t/aQIhnmfijU Rpr8in5DeAzojacac9J7l5UzYH2QZTh+GEgftcTfcra5zGORu++d1rowy0Q2c0qzWuf1bPVsZEE /hUoPHdPKCZwAwUrAjdrqfw5MkYolf9gEi+6mZxiztAlpiPTXsjfNJa8BJfGkaWU+EksvVcfz92 2gX/CORM+FCw/BHKDYnOt5BwXQqrXZmcqiOtJeviwvDxTuLl34wTxt1lm4BZyA0BTt41MVdKImE WOo9dObIgbf4zQYs+oH7lVqzh+902u+NtHfzzaXv/uv9PPCaBZpqhn+xg6WbfDewaO7bEwoCJJz 7bf0Fw1jqIM2y X-Google-Smtp-Source: AGHT+IG19in7YD9+mh+jCwJ3JHA6ycW6ni6Gib0Ldr3L9sgEpAkmq214gUIhXmK9w5BqErQZ9ZspIw== X-Received: by 2002:a05:6e02:2587:b0:3d4:337f:121b with SMTP id e9e14a558f8ab-3d6d54a305amr33630345ab.8.1743615759986; Wed, 02 Apr 2025 10:42:39 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:39 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 26/54] dyndbg: change __dynamic_func_call_cls* macros into expressions Date: Wed, 2 Apr 2025 11:41:28 -0600 Message-ID: <20250402174156.1246171-27-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The Xe driver's XE_IOCTL_DBG macro calls drm_dbg() from inside an if (expression). This breaks when CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy because the invoked macro has a do-while-0 wrapper. if (cond && (drm_dbg("expr-form"),1)) { ... do some more stuff } Fix for this usage by changing __dynamic_func_call_cls{,_no_desc} macros into expressions, by replacing the do-while-0s with a ({ }) wrapper. In the common usage, the trailing ';' converts the expression into a statement. drm_dbg("statement form"); Signed-off-by: Jim Cromie --- --- include/linux/dynamic_debug.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index ce221a702f84..2d87cca27544 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -337,20 +337,20 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, * (|_cls): adds in _DPRINT_CLASS_DFLT as needed * (|_no_desc): former gets callsite descriptor as 1st arg (for prdbgs) */ -#define __dynamic_func_call_cls(id, cls, fmt, func, ...) do { \ - DEFINE_DYNAMIC_DEBUG_METADATA_CLS((id), cls, fmt); \ +#define __dynamic_func_call_cls(id, cls, fmt, func, ...) ({ \ + DEFINE_DYNAMIC_DEBUG_METADATA_CLS(id, cls, fmt); \ if (DYNAMIC_DEBUG_BRANCH(id)) \ - func(&id, ##__VA_ARGS__); \ -} while (0) + func(&(id), ##__VA_ARGS__); \ +}) #define __dynamic_func_call(id, fmt, func, ...) \ __dynamic_func_call_cls(id, _DPRINTK_CLASS_DFLT, fmt, \ func, ##__VA_ARGS__) =20 -#define __dynamic_func_call_cls_no_desc(id, cls, fmt, func, ...) do { \ +#define __dynamic_func_call_cls_no_desc(id, cls, fmt, func, ...) ({ \ DEFINE_DYNAMIC_DEBUG_METADATA_CLS(id, cls, fmt); \ if (DYNAMIC_DEBUG_BRANCH(id)) \ func(__VA_ARGS__); \ -} while (0) +}) #define __dynamic_func_call_no_desc(id, fmt, func, ...) \ __dynamic_func_call_cls_no_desc(id, _DPRINTK_CLASS_DFLT, \ fmt, func, ##__VA_ARGS__) --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f172.google.com (mail-il1-f172.google.com [209.85.166.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F2AD1C6FF9 for ; Wed, 2 Apr 2025 17:42:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615764; cv=none; b=YX23Rqj/pUZlRpp4j03tm875AaLMDaqE/IRuMQoZw6IqPuE8TNZAPkX563nIKh8g6/2b0UvC/0hLYpZszIVnwvkui80CcH1ZibkX4UKgrSf6w9+IGpmfigQbQgTCyqPBo/qpDsKE+RPyJ3GlVTA4cwLQW8hUnzd8bbnrYASjn8c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615764; c=relaxed/simple; bh=8y5FRxD1+T+w6r55dWG7lx+dkgt3ZKNpLNKwX+6PAjY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W2QpD7d8wkmdZBHBRevK5KQffFzShjTvQlxsqPf1241ogG8nGpRvPHzrngcqXTLcb4WWhuKh4Q8RnBRHcJQubbEE3eZivdMhic6QhWGt+2OkIL6Kn3NMwCej9GnSLF9spSm92sTBB5JvVya6XQXr7+NITsr8BjpaT9YdIY2CR8Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VahWP4l7; arc=none smtp.client-ip=209.85.166.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VahWP4l7" Received: by mail-il1-f172.google.com with SMTP id e9e14a558f8ab-3d5eb0ec2bdso423205ab.2 for ; Wed, 02 Apr 2025 10:42:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615761; x=1744220561; 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=Ce6nXKcnJlQ1Sg4GeG36JJhoy7m7R7t/PayJp4ReXBg=; b=VahWP4l76iDfzVnP+oLxlHMgaPgCX1Rtjo6bxZs0+fMx9PkZqvJUAgsUKnq0iiFPyp 1KHUGsBIsNX37xuUFb5OCwySYNTd5/h7Fl+LyPJfMwP9Ot/lrMCBkX7H9Fx/WAetuefa z5HijMJJIH6VW3Vc3n2jk1NzlU6TlIr/eMO5a5BSPWe7SibPzqY3E2nlHzB5wmHePWyy /NOC72UP3ZuPSPJkY98ZSF5rGpcgjWn7VpTb2LrGA0StmMjFReU7YiHSKRd0tOdBPBmu bCRurl7tvMzRakqWwQcJ7syBT9rIWspCKwOyJ6RlkacMf58GMT+9ustO0fJe0bF1MxQP 2lxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615761; x=1744220561; 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=Ce6nXKcnJlQ1Sg4GeG36JJhoy7m7R7t/PayJp4ReXBg=; b=hLmwwbS8znQPUBYrzKI/ULfL51+75TW+FXbXuAa/e5rAIXUQQBAIOg9txRIxNWJ2Sc tHMHW0mVm4j7y+EbThJRkYEVOw6MQeaTOiJp8tKES4zGE614SqRGyr1vhX7YZEASzUO5 xdFB0Ootl8UzHUj/IgsASyAU5xqz9pKojyfoyRSZ9MWdpgx6QqMNcSfnQXhkwuAU5ySW Taw2vOZavA9uqo2dy622J8Gnl2N2uKQeYTZAN8g2+CWQPAfwYbQ3tnKo4Ks2lAz/mThR ZVPnU4R9wt+DMs2D0550eLAQjMTfZj0mNNfSZ57XbcyRKuSbf5hFEM32yvNxTftT1HpI yz4Q== X-Forwarded-Encrypted: i=1; AJvYcCVksODs4hzd/CNO3PXPACvVlmvxhbGInkBiIW/fJRWfIqaA2LvbGg+FMidXRjH18QXjd3khRbMpb9Cdu6Y=@vger.kernel.org X-Gm-Message-State: AOJu0Yx3sUXUCdUu2AVK//46rwtyyXU/v+FCGmZYVPDc3dV2i2dcfH8V PsUU3xKLcswJWpJM68bTuEf3O69GNFBsa+B4tyLyqJk/gjrLDh8j X-Gm-Gg: ASbGncsMfysh8krCwKZs6SJpwJQ5AWq/RiKi+RQNggbjbReOqd2w6N8JIqT0UqXu2Ve 3qI8WG3BlMPyKaKlo8HbrPTDh1NKCq6XNbRx7/i0CB3xdDH8bHHuwwQTGNa0AGnovWjA/72cb55 a2elabtjFQ/x00oPXgde7sn5p2NJwEbf7HdA9hTLO/0un0Peq9/kfqDkk6BmZlgqt2DYV/zZIxN 3xnHRQ2K9kB6WrGHtn1E3dn1yJ0Ufxl/Od4FjQQMkB3rasI2Bjtm05KZip33tV8oe0URLYfe8j3 wyV4SNhY8aZ5x/NOdlwh0Xhf7XigDaSmboejgp9kZTqHIYVHQmoHLzbAZ0cxuvLETLI3Q/PKuO/ 7fQ== X-Google-Smtp-Source: AGHT+IEd82/KaIrP4v3l/hIUqHB1vbL8Yns4imdfxbgbfiFn8gRA4XnyUTSvoiXRh5lRVoS9fxcz6Q== X-Received: by 2002:a05:6e02:1f0c:b0:3d3:f520:b7e0 with SMTP id e9e14a558f8ab-3d5e09094f8mr180509725ab.6.1743615761151; Wed, 02 Apr 2025 10:42:41 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:40 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 27/54] dyndbg: drop "protection" of class'd pr_debugs from legacy queries Date: Wed, 2 Apr 2025 11:41:29 -0600 Message-ID: <20250402174156.1246171-28-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Current classmap code protects class'd pr_debugs from unintended changes by "legacy" unclassed queries: # this doesn't disable all of DRM_UT_* categories echo "-p" > /proc/dynamic_debug/control # name the class to change it - protective but tedious echo "class DRM_UT_CORE +p" > /proc/dynamic_debug/control # or do it the (old school) subsystem way echo 1 > /sys/module/drm/parameters/debug This "name the class to change it" behavior gave a modicum of protection to classmap users (ie DRM) so their debug settings aren't trivially and unintentionally altered underneath them. And by "symmetry", if they're not picked by "class FOO", then they're excluded from adjustment. This allowed all previously conceived queries to work the way they always had; ie select the same set of pr_debugs, despite the inclusion of whole new classes of pr_debugs. That had 2 downsides: 1. "name the class to change it" means that every class must be individually modified, quickly becoming long-winded and tedious to adjust all the classes in a map via >control. 2. It made the class keyword special in some sense; the other keywords skip only on explicit mismatch, otherwise the code falls thru to adjust the pr-debug site. So this patch reverts to the traditional view, it drops protection of classes from default/legacy queries. But it also refactors the skip/continue choice to allow the module defining the classmap to protect its classes from unintended alterations by legacy/class-less queries. Next: Author choice: use of DYNAMIC_DEBUG_CLASSMAP_PARAM() means they want the drm.debug style control point. We should presume they want it to reflect whats set underneath, with only "class FOO" qualified queries changing the callsites beneath. CC: jbaron@akamai.com Signed-off-by: Jim Cromie -- v3- s/slctd_/selected_/ pitch the PARAM control of protection. --- lib/dynamic_debug.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 7a60088a1b5c..54f462cf41b0 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -197,6 +197,17 @@ ddebug_find_valid_class(struct _ddebug_info const *di,= const char *query_class, return NULL; } =20 +/* + * classmaps-v1 protected classes from changes by legacy commands + * (those selecting _DPRINTK_CLASS_DFLT by omission), v2 undoes that + * special treatment. State so explicitly. Later we could give + * modules the choice to protect their classes or to keep v2 behavior. + */ +static inline bool ddebug_client_module_protects_classes(const struct ddeb= ug_table *dt) +{ + return false; +} + /* * Search the tables for _ddebug's which match the given `query' and * apply the `flags' and `mask' to them. Returns number of matching @@ -211,7 +222,7 @@ static int ddebug_change(const struct ddebug_query *que= ry, struct flag_settings unsigned int nfound =3D 0; struct flagsbuf fbuf, nbuf; struct _ddebug_class_map *map =3D NULL; - int valid_class; + int selected_class; =20 /* search for matching ddebugs */ mutex_lock(&ddebug_lock); @@ -224,21 +235,25 @@ static int ddebug_change(const struct ddebug_query *q= uery, struct flag_settings =20 if (query->class_string) { map =3D ddebug_find_valid_class(&dt->info, query->class_string, - &valid_class); + &selected_class); if (!map) continue; } else { - /* constrain query, do not touch class'd callsites */ - valid_class =3D _DPRINTK_CLASS_DFLT; + selected_class =3D _DPRINTK_CLASS_DFLT; } =20 for (i =3D 0; i < dt->info.descs.len; i++) { struct _ddebug *dp =3D &dt->info.descs.start[i]; =20 - /* match site against query-class */ - if (dp->class_id !=3D valid_class) - continue; - + if (dp->class_id !=3D selected_class) { + if (query->class_string) + /* site.class !=3D given class */ + continue; + /* legacy query, class'd site */ + else if (ddebug_client_module_protects_classes(dt)) + continue; + /* allow change on class'd pr_debug */ + } /* match against the source filename */ if (query->filename && !match_wildcard(query->filename, dp->filename) && --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 376201DC198 for ; Wed, 2 Apr 2025 17:42:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615765; cv=none; b=nCBbwI7afi65GXcH7fKd9+ELWc3Z06b23+1K8s4JLOuBqeBzEJSQKOviIBMA5S7C39co/oz5qm62Y2RnfhzO1yqzyvz0z9q+CKibquMq2mZKXc79e32jWp469Vp6rkzSUIzwp9a8yFAgy3CRnmMI/1mUb4MCWGGpPq34oxOM7lQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615765; c=relaxed/simple; bh=QWPwid7hpL/peutynHlmEFY2BNpuX5WSWbRsMqjsljM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NGlL5RrX6xgy19c01jf67LeRq8hV6AwH2YKrvliUgf2azmKLFtyCg6h7PHnLxTjIgBlSxJAxLEqL/nygNZaXU4J/Ms73LvR84F7grxA6ak+cC9qfjodPGzY4RTh5fbhIYX1QW1qjhsD3hsCiHpFMol/BF3xmT9J+ms4YlmdvtjM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=klByVPA1; arc=none smtp.client-ip=209.85.166.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="klByVPA1" Received: by mail-il1-f181.google.com with SMTP id e9e14a558f8ab-3cfce97a3d9so563985ab.2 for ; Wed, 02 Apr 2025 10:42:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615762; x=1744220562; 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=3hWaDK0EyUbVT4OX3HvU/+LKgntx8pUOZGP1ac6BsDE=; b=klByVPA1X0+Eacw3IIU5g3bGfSYXjTTz6sSyNHFNZ7SHNwexdw4IMi7ZaWMiwZOgAI 22fnoOIC0koOJBRvBkb6NTkFm2J6DBspepI+QkwcS/EuDs6xUWIxMqeaNNUeHsYWuBRK lrPpl+KN5QOsQV/DsuL/QYYR9e6wOZI8cRzbb8rKAEwEximmMh+isF9Op5mKqBRIgtgC N9o95s9Tqm89s4CHorLNBByWfGjzNAMr575wby9q27TNpPhy2yeNSJH4u/iUvf2xr+vG 9ayg7Sw8J4zS8amKigqPx6OqxbXfESfMcFL0NTxqLjJUJl9lnrAEi808gEWfreEN0dOJ os2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615762; x=1744220562; 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=3hWaDK0EyUbVT4OX3HvU/+LKgntx8pUOZGP1ac6BsDE=; b=DQC3wtqJ1z97dtjbao7v0qeA3Qpucq0/9uLuvAYRwtY4/JyaZpQreqF2sDjhLuHTgH atnDX85Zf6Z9phBWXpu3vIbOJqTH6rzg9KKvhPavjY+36+pL7jjo0QGXSQea/7HJyHwx 1nOOUOE3G66amdrhJWBBVwci3hTELrG7iKBnJvTNHn4ApCPkpXN4dftLE+5N+4Nbush5 Ntc2fgfhVAGLpJl/zOkr1ODEBtHkdavll0ahfH3ZxNh0EXhqKuMGCPlE98aRrKKc98F+ kLPUz1tbvB9rWYncKpevAI9gmlcWy1jcl1zc2sGMJ1P2SrIUBGMq6RM2Jrf4G2pHTR+T 9X9w== X-Forwarded-Encrypted: i=1; AJvYcCWSQ7yHxHuMIxPw1alLsTWdWRutqYlap0dvklUcqS3/PNTxGYLRMrwqDIqdnCJjSHn5UIW9uI7QBSF2lUc=@vger.kernel.org X-Gm-Message-State: AOJu0YyU/UR4MAa36OSIZ9e6xbbTtxxqP/eyunGKJ7ceeg0uWcBVlfvr OHFi5K85MYz6/Tc8P2FytxIl38iHV6f/NTNlM524WZ/V9+2VlH69 X-Gm-Gg: ASbGncux0PgMOH/VijBsH2r4W0PlqRVmK3zxrmc26DGUz/vrptIUxQd6DGgIDAJTLki jIOlmrocmkweFYO20NPJOfC1HYRQaa5UY5Ej+vh5Yyux2pyUekKBAgmXeNPUsKIPTNQi1ET8tov +PrMsJVQy+Sr3eAFR6pgY/6A31YklfjsHDUFvrAex8MTllUIiIUWBPLp3nYe/3AmO++IBnzUP9/ caq2NzRphfvlBekwao2evrxZg/P9jNNPq9O88uk+2Rne4ugb+fBCq2iK3ZrWsSkLDBgmzd7pZve CRjea3Wqv/YeMDCNZU9Wt9ayPTkSRf22Nk/35cwFj0naCl+FW7lsmBrK95MRJXbLxbGGx26hh9V 4qg== X-Google-Smtp-Source: AGHT+IE26Lvgy1sz8+/s+cZ/TgAmF79C63fY2ih6ts7b4QxKP/HjJZzZedKoG0eLTxzU2s+MwTib5Q== X-Received: by 2002:a05:6e02:746:b0:3d3:f27a:9101 with SMTP id e9e14a558f8ab-3d5e08e9ec2mr217926285ab.1.1743615762203; Wed, 02 Apr 2025 10:42:42 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:41 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 28/54] dyndbg: restore classmap protection when theres a controlling_param Date: Wed, 2 Apr 2025 11:41:30 -0600 Message-ID: <20250402174156.1246171-29-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" DRM has always had /sys/module/drm/parameters/debug (ie drm.debug). Without dyndbg, this is their only control point. One could presume they like it - in any case its a system/user interface, ie ABI. With dyndbg enabled, drm calls DYNAMIC_DEBUG_CLASSMAP_PARAM() to create the drm.debug kparam, wired to our param-handler, which writes a "class FOO" query for each bit in the classmap. Since no new interface was ever contemplated, this is using >control. Since drm.debug is ABI, we should not allow class-less queries to alter our implementation of its settings. This patch provides that protection, *only* when theres a PARAM. This is the user, expressing their wish for easy control of their entire classmap. They also wish to trust its settings. Classes without a PARAM are unprotected, allowing admins their shortcuts. No such use-cases exist yet. Anyway, this patch does: 1. adds struct _ddebug_class_map.controlling_param 2. set it in ddebug_match_apply_kparam(), during modprobe/init, when options like drm.debug are handled. 3. ddebug_class_has_param() checks .controlling_param 4. ddebug_class_wants_protection() macro renames 3. 5. ddebug_change() calls 4 when needed. IE when applying a class-less query to a class'd pr_debug / drm_dbg_ Historical Summary: -v0 - before classmaps. no special case keywords -v1 - "class DEFAULT" is assumed if not mentioned. this protects classes from class-less queries -v2.pre-this-patch - protection macro'd to false -v2.with-this-patch - sysfs knob decides -v2.speculative - module decides wrt classmap protection seems unneeded now, TBD NOTE: protection is only against class-less queries, explicit "class FOO" adjustments are allowed (that is the mechanism). Signed-off-by: Jim Cromie --- v3 - new patch --- include/linux/dynamic_debug.h | 3 +- lib/dynamic_debug.c | 55 ++++++++++++++++++++++++++--------- 2 files changed, 44 insertions(+), 14 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 2d87cca27544..d34a44ff961a 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -89,8 +89,9 @@ enum ddebug_class_map_type { * usually by stringifying the enum-vals. Modules with multiple * classmaps must arrange to share the 0..62 class_id space. */ - +struct _ddebug_class_param; struct _ddebug_class_map { + struct _ddebug_class_param *controlling_param; const struct module *mod; /* NULL for builtins */ const char *mod_name; const char **class_names; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 54f462cf41b0..3eb4a8abeb33 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -198,16 +198,26 @@ ddebug_find_valid_class(struct _ddebug_info const *di= , const char *query_class, } =20 /* - * classmaps-v1 protected classes from changes by legacy commands - * (those selecting _DPRINTK_CLASS_DFLT by omission), v2 undoes that - * special treatment. State so explicitly. Later we could give - * modules the choice to protect their classes or to keep v2 behavior. + * classmaps-V1 protected classes from changes by legacy commands + * (those selecting _DPRINTK_CLASS_DFLT by omission). This had the + * downside that saying "class FOO" for every change can get tedious. + * + * V2 is smarter, it protects class-maps if the defining module also + * calls DYNAMIC_DEBUG_CLASSMAP_PARAM to create a sysfs parameter. + * Since they want the knob, we should assume they intend to use it + * (in preference to "class FOO +p" >control), and want to trust its + * settings. + * This gives protection when its useful, and not when its just tedious. */ -static inline bool ddebug_client_module_protects_classes(const struct ddeb= ug_table *dt) +static inline bool ddebug_class_has_param(const struct _ddebug_class_map *= map) { - return false; + return !!(map->controlling_param); } =20 +/* re-framed as a policy choice */ +#define ddebug_class_wants_protection(map) \ + ddebug_class_has_param(map) + /* * Search the tables for _ddebug's which match the given `query' and * apply the `flags' and `mask' to them. Returns number of matching @@ -250,7 +260,7 @@ static int ddebug_change(const struct ddebug_query *que= ry, struct flag_settings /* site.class !=3D given class */ continue; /* legacy query, class'd site */ - else if (ddebug_client_module_protects_classes(dt)) + else if (ddebug_class_wants_protection(map)) continue; /* allow change on class'd pr_debug */ } @@ -650,6 +660,7 @@ static int ddebug_exec_queries(char *query, const char = *modname) } =20 /* apply a new class-param setting */ + static int ddebug_apply_class_bitmap(const struct _ddebug_class_param *dcp, const unsigned long *new_bits, const unsigned long old_bits, @@ -1228,25 +1239,36 @@ static void ddebug_sync_classbits(const struct kern= el_param *kp, const char *mod } } =20 -static void ddebug_match_apply_kparam(const struct kernel_param *kp, - const struct _ddebug_class_map *map, - const char *mod_name) +static struct _ddebug_class_param * +ddebug_get_classmap_kparam(const struct kernel_param *kp, + const struct _ddebug_class_map *map) { struct _ddebug_class_param *dcp; =20 if (kp->ops !=3D ¶m_ops_dyndbg_classes) - return; + return false; =20 dcp =3D (struct _ddebug_class_param *)kp->arg; =20 - if (map =3D=3D dcp->map) { + return (map =3D=3D dcp->map) + ? dcp : (struct _ddebug_class_param *)NULL; +} + +static void ddebug_match_apply_kparam(const struct kernel_param *kp, + struct _ddebug_class_map *map, + const char *mod_name) +{ + struct _ddebug_class_param *dcp =3D ddebug_get_classmap_kparam(kp, map); + + if (dcp) { + map->controlling_param =3D dcp; v2pr_info(" kp:%s.%s =3D0x%lx", mod_name, kp->name, *dcp->bits); vpr_cm_info(map, " %s mapped to: ", mod_name); ddebug_sync_classbits(kp, mod_name); } } =20 -static void ddebug_apply_params(const struct _ddebug_class_map *cm, const = char *mod_name) +static void ddebug_apply_params(struct _ddebug_class_map *cm, const char *= mod_name) { const struct kernel_param *kp; #if IS_ENABLED(CONFIG_MODULES) @@ -1266,6 +1288,13 @@ static void ddebug_apply_params(const struct _ddebug= _class_map *cm, const char * } } =20 +/* + * called from add_module, ie early. it can find controlling kparams, + * which can/does? enable protection of this classmap from class-less + * queries, on the grounds that the user created the kparam, means to + * use it, and expects it to reflect reality. We should oblige him, + * and protect those classmaps from classless "-p" changes. + */ static void ddebug_apply_class_maps(const struct _ddebug_info *di) { struct _ddebug_class_map *cm; --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 321821F872D; Wed, 2 Apr 2025 17:42:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615766; cv=none; b=swqEbF6ScSWvnEyODwywp7Wu1D8dAvChpV3cC8TuN2nBvJHlDwQGsuLsPHiL/vUBpaztR4TwDSwby5KsiHxYASj4JVZFEJ8JRsYPuRlkHtPM3BZHyDMEZoaLyKFeakfc/0atnx9APF91Lvieq+/tHA9CgPGpndM1XrNMtGMsz34= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615766; c=relaxed/simple; bh=3hHSl94t/bITBPs3clvDM2F2NCjf/Zgf9AUYQfDspoM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sGPiJbFlm2dlV7l36FB0AQ4MzhBixNyyFpbgErJq8/t5SI93vh7pTfKbWBGOC8Qlnr669voi1q7nAtUzoYNbsc2etLBPmdiQJdnSHBB4AKL/JtaqfrhBbJA7R5lcRKQZW0s59Y0QQU45yieX6VWoI142JZQHhQF8qkBdpDVSrtg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dRn3QkmI; arc=none smtp.client-ip=209.85.166.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dRn3QkmI" Received: by mail-io1-f49.google.com with SMTP id ca18e2360f4ac-85dac9729c3so1001139f.2; Wed, 02 Apr 2025 10:42:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615763; x=1744220563; 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=PBFFM339JxjzZFE9F9mUGqskJ1T7S9VuqFHMSYzFpwo=; b=dRn3QkmIsJOOxHalxPhqWrKwOq/oDA2e8GQro6crcpbhHckrW+CqM81V9wawLPV2zr XnWNzUUaDY/dEuSQkz+xfPpqUjAFFNsOWOF3L58KnFf4zYEJNuiHrxDLvxXtDAd2q0IU 63hADY8Q1zZkwppNuv97T4WsmjrkQP4RjPKcfMlHF1lKvowfJKqXj+hasVj+VLmrDmBY fzeQ1x/T+J0hWqkja5zQf6AU5SercDhpUIJDGsyJ2635JJKHqPEHH850jPuQw7v468FE g3ccFxCpKujcuVylrN6cgVY5nJNMkQ+f/34Prfe7hhM6w9lmd1Xlt/5ONJ7I9oYnsVuo B6+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615763; x=1744220563; 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=PBFFM339JxjzZFE9F9mUGqskJ1T7S9VuqFHMSYzFpwo=; b=jbcG3guPJCprwF0R+MiVZ7UDaS7x15PqF+0vwFopZkUvvSeeJ8Y+uLDoPFtQPtEp5F fntEu7gtax1UOQTMVTKO1rA02IotyKiumYaXCfMGEFMuvxYJmIaH4seHW2uhFsIM4J5M +NMcUUNWcObWBU7DMYPFmX1OO64r942FG9j2QXk/n+yvzmbtU1Dt8DTx9bIhmegyyeVT F7nWyTPgYcRR4bhj+DGEpkdBpjqHZZ8yJTCzkGDAIDvVHk1/SF8/hKvQJ1NWuz5GSZEW Tb4EOVd6fj5TXO/6qMIUQEvwmnqGhnN+syRwWPefHXb5fYQuKFbxo6BoBocQ1eyKy19I b7EQ== X-Forwarded-Encrypted: i=1; AJvYcCWORHfmYTgPg4lHmtZ0R4Wg4MWr9fazRt6CVjHuAkSd7CEpHW5G6mNVl6ghRg+jgXSvvTE58PGXDZrVeoQq@vger.kernel.org, AJvYcCXVD2JWMDuTIP1IGc5vSf3retTO00Lmx8riITmfLHuDJ20Ts/oWyJlMyjzmdUGpVXBAAylNzSDIVek=@vger.kernel.org X-Gm-Message-State: AOJu0YwbI9sLjsL94piDbCt1vF/ra+5pE2k6nSetddoJh7h23R4rNCbB NpM51yr76AHAF1B8StcxWLxj16NvaZwRZTTAXu0D+HroqAUlDGMp+tB9vSed X-Gm-Gg: ASbGnctfUrIovHYREadm6FkyIOmb4HyjAoPy8qRyUiFqMzg+c8ncKzooTkMfumnV4I0 bLbYxR+VSByfiJPQZdYJF6fk2BCuABOXoiuBQ04M0McAO2JukGKyMqnx4H9xVP34ifyqM85vBsw lXSRRMf3L+u0lB1jMEB2cOp4/dsAyvKCJ3+cERlreJDznj4B11+w/Iwt4Vj4rgJGVJdqfUnCMoN zoOb932WrJIeHPhndVHtpvsvyKydh2Tlm7MFAXIwfqR2Yt7kw30owrl3mUTzQPvbBW57bJPTDUl ++DjMXYWOwfGxIkL7F0UyrcJ/wZvfcu2WdB9tU1+Cg93FdFII6gVTc8QYhtJnSZ7UnhKlcZGFW9 twg== X-Google-Smtp-Source: AGHT+IFhLqkbJE0UpVSJmNkM4dkx1ppVBJoKSeZT343o5h63VoCAKbsDpePVjKMaUIz6jLi9wx0olw== X-Received: by 2002:a05:6e02:1563:b0:3d6:cbc5:a102 with SMTP id e9e14a558f8ab-3d6d54ceea3mr34975145ab.13.1743615763162; Wed, 02 Apr 2025 10:42:43 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:42 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie , linux-doc@vger.kernel.org Subject: [PATCH v3 29/54] docs/dyndbg: add classmap info to howto Date: Wed, 2 Apr 2025 11:41:31 -0600 Message-ID: <20250402174156.1246171-30-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Describe the 3 API macros providing dynamic_debug's classmaps DYNDBG_CLASSMAP_DEFINE - create & export a classmap DYNDBG_CLASSMAP_USE - refer to exported map DYNDBG_CLASSMAP_PARAM - bind control param to the classmap DYNDBG_CLASSMAP_PARAM_REF + use module's storage - __drm_debug TBD: some of this might be over-specification, or just over-talked. NB: The _DEFINE & _USE model makes the user dependent on the definer, just like EXPORT_SYMBOL(__drm_debug) already does. cc: linux-doc@vger.kernel.org Signed-off-by: Jim Cromie --- v3- rework protection around PARAM v0.5 adjustments per Randy Dunlap v0.7 checkpatch fixes v0.8 more v0.9 rewords fixup-howto --- .../admin-guide/dynamic-debug-howto.rst | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentat= ion/admin-guide/dynamic-debug-howto.rst index 1ceadf4f28f9..5eb4ae3b2f27 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -394,3 +394,96 @@ just a shortcut for ``print_hex_dump(KERN_DEBUG)``. For ``print_hex_dump_debug()``/``print_hex_dump_bytes()``, format string is its ``prefix_str`` argument, if it is constant string; or ``hexdump`` in case ``prefix_str`` is built dynamically. + +Dynamic Debug classmaps +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The "class" keyword selects prdbgs based on author supplied, +domain-oriented names. This complements the nested-scope keywords: +module, file, function, line. + +The main difference from the others: classes must be named to be +changed. This protects them from generic overwrite: + + # IOW this cannot undo any DRM.debug settings + :#> ddcmd -p + +This protection is needed in order to honor the ABI, settings done +there must be respected: + + :#> echo 0x1ff > /sys/module/drm/parameters/debug + +So each class must be enabled individually (no wildcards): + + :#> ddcmd class DRM_UT_CORE +p + :#> ddcmd class DRM_UT_KMS +p + # or more selectively + :#> ddcmd class DRM_UT_CORE module drm +p + +That makes direct >control wordy and annoying, but it is a secondary +interface; it is not intended to replace the ABI, just slide in +underneath and reimplement it. + +However, since the param is the ABI, if a classmap DEFINEr doesn't +also add a _CLASSMAP_PARAM, there is no ABI, and no protection is +needed. In that case, class'd prdbgs would be enabled/disabled by +legacy (class-less) queries. + + +Dynamic Debug Classmap API +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D + +DRM.debug is built upon: + ABI in /sys/module/drm/parameters/debug + the bits set all DRM_UT_* together + ~23 categorized api macros: drm_dbg_() + all calling drm_{,dev}dbg(DRM_UT_*, ....) + ~5000 calls to the api macros across drivers/gpu/drm/* + +The const short ints are good for optimizing compilers; a primary +classmaps design goal was to preserve those opporunities for +optimization. So basically .classid =3D=3D=3D category. + +Then we use the drm_categories DRM_UT_* enum for both the classnames +(stringified enum symbols) and their numeric values. + +Its expected that future users will also use an enum-defined +categorization scheme like DRM's, and dyndbg can be adapted under them +similarly. + +DYNAMIC_DEBUG_CLASSMAP_DEFINE(var,type,_base,classnames) - this maps +classnames (a list of strings) onto class-ids consecutively, starting +at _base, it also maps the names onto CLASSMAP_PARAM bits 0..N. + +DYNAMIC_DEBUG_CLASSMAP_USE(var) - modules call this to refer to the +var _DEFINEd elsewhere (and exported). + +Classmaps are opt-in: modules invoke _DEFINE or _USE to authorize +dyndbg to update those classes. "class FOO" queries are validated +against the classes, this finds the classid to alter; classes are not +directly selectable by their classid. + +There are 2 types of classmaps: + + DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, like DRM.debug + DD_CLASS_TYPE_LEVEL_NUM: classes are relative, ordered (V3 > V2) + +DYNAMIC_DEBUG_CLASSMAP_PARAM - modelled after module_param_cb, it +refers to a DEFINEd classmap, and associates it to the param's +data-store. This state is then applied to DEFINEr and USEr modules +when they're modprobed. + +The PARAM interface also enforces the DD_CLASS_TYPE_LEVEL_NUM relation +amongst the contained classnames; all classes are independent in the +control parser itself; there is no implied meaning in names like "V4". + +Modules or module-groups (drm & drivers) can define multiple +classmaps, as long as they (all the classmaps) share the limited 0..62 +per-module-group _class_id range, without overlap. If a module +encounters a conflict between 2 classmaps its USEing, we can extend +the _USE macro with an offset to allow avoiding the conflicting range. + +``#define DEBUG`` will enable all pr_debugs in scope, including any +class'd ones. This won't be reflected in the PARAM readback value, +but the class'd pr_debug callsites can be forced off by toggling the +classmap-kparam all-on then all-off. --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f173.google.com (mail-il1-f173.google.com [209.85.166.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14D771F892E for ; Wed, 2 Apr 2025 17:42:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615767; cv=none; b=s/JdHlXHp3v3dxc/Hg4gx2UUe76SZt0yzx1hAhAt3bJwyQ/DVqHplGtPLHkmgESiwNwwRgKbiMwzNwF+ckTov6wyLH+x+96Tzv21W5LDbIo18sjKvTwqG8Ne+QbTrqQVb2YZn3nGffECoqkxV1+PWG+KknyP9/uCbGTo7XFg0/U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615767; c=relaxed/simple; bh=v325/R/096chjTXtqgrNRnSwmubhuU0T03Rv9PPtR4g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RDDBrdK1SYVf6HxzkTt1lEf5+DG9gqCIBzklq5YY5Ja/6XJ9UjlOsjjBKPBylx7iR7lk/SLOx39NrSwWkEd+SdIJmCqaFjf6lzXMpFy3rbrmgc93QR3tg+7FkyXLW0bzG6RiioOGG/XwEdu19qr6vjqD0scoSdcUsQt6srcbDI8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cQ3Dvp7Z; arc=none smtp.client-ip=209.85.166.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cQ3Dvp7Z" Received: by mail-il1-f173.google.com with SMTP id e9e14a558f8ab-3d5e43e4725so476305ab.1 for ; Wed, 02 Apr 2025 10:42:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615764; x=1744220564; 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=TtBnrd8yWB3oKPUJX24gJEUHr1Wu50+TDt3ZzWgKjdc=; b=cQ3Dvp7Zjai3xIWibsReYtIFWWADyUrVYMRY9qdeMJZpA/Ypr0kSUrTBHxgI6uxXmO E5baG7nAMYL4MZ0KV4bGWDP3Q3amDAhJP7PloF5j/xxgI9x+A+npDEcbkPY8RK7jAeTn KmDNmy8zg7CS6YvjiKm+07u0nq4lrmFPxOm4l28n/Mp3h2h5lGKQCBx8oGMBbBGFnjeG xIZJfT7Fe6V9lFfR7Wm2je4hOhsD3ncWQIrQzRkmE1DuYQYrqLABNfVUl6Wo5iIYQAzt 4x0VHK2UrLdo1OUZT4uXC9PCnD6RZ1BwPqZkO2oDXghAWGprnMkqNIZ3lYLEKWD39Wml H6Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615764; x=1744220564; 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=TtBnrd8yWB3oKPUJX24gJEUHr1Wu50+TDt3ZzWgKjdc=; b=XNpKYruuRdl1nqWHdTosXe9vqtRS15qNaExuyDfrw6AC7Al+PNivH0qUFeIaDllNvs Ep/Rz/2LGrR5DCckjzyPJu5gPnYK1YRgpry87Vvo3nGF4p/cuQdipLhQQS3b1pRPElWU rxLD+gUfF3nGC9j4n+D/rc9sbziAg+6PhiG+Bzv3i+C7BJ3r1LZzVhrPB1RkBvI/WvJS 4/7x0YrKrHajCf4EVaLoA6sRD+x6GFLt1btebO6GfLeBILSjUCEa+lwKTOegU3FCMTtm WnH95uP6h2DS16xVcKgBswBB4+TLL3QPZTUqby6ytY3IJ6jlyvp+/YS5qyHVrNR+aJd/ LCXQ== X-Forwarded-Encrypted: i=1; AJvYcCU3sv/sCTJ2D9TqRKmPRyBm5girxUwpj7SeZLvgiW7IYsVsV1PtNuSRRlMJ3gjCjQxKYaJSRe5haAITff8=@vger.kernel.org X-Gm-Message-State: AOJu0Yy47s5ZmUOIStXXmdUmAARzrk1e4GkyViEM5+8Y+KW1q0hpFCUc m2L3IKJVT9nA/BSkHYq1RzvuojhUrXJ4v33DUNViCEGJ/Ymg36e2 X-Gm-Gg: ASbGncs1hvpcAccubE+FGrok/hDyJIayIlaU405be+3hw6UNLx312nd4CcDyypgM+TT xex+qDmozTcoSA88gTSBUsLoHtLpiMWhGSbThCTTut8W9ane/g5HheI9VdPXfJXSglFrHCD3kox BhhPLA7PFxWD7LSImxB/zouE+QwovXkjVZwS/1h/4DS4LykKKtUFBAFl8a/OdB3At4eos3EzeEE PmMVDRi70e06aC1v8Qiv1EWBoFcqBujTzfkdeNb1it0BrZmMKrzLbnPMzoW85Rgj1++wO3vGPdA wu8HaIAAGwi522fNLP11QY5chdsT6s2Zt32CS6e2C8E/096AEXGLRpHlaonVZpR6DgzdgQdr2ve t0w== X-Google-Smtp-Source: AGHT+IGTBl3lbbr6SJDgP5PSLh5HQqCvYpL4DLPKQgcBrXs/j8ELoLu+4SyOVWtWqWN9s2TkWLcitA== X-Received: by 2002:a05:6e02:1a8f:b0:3d3:ff5c:287 with SMTP id e9e14a558f8ab-3d6d5535a0amr31636715ab.14.1743615764063; Wed, 02 Apr 2025 10:42:44 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:43 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 30/54] drm: use correct ccflags-y spelling Date: Wed, 2 Apr 2025 11:41:32 -0600 Message-ID: <20250402174156.1246171-31-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Incorrectly spelled CFLAGS- failed to add -DDYNAMIC_DEBUG_MODULE, which disabled dynamic-debug in modules built with: CONFIG_DYNAMIC_DEBUG=3Dn # 1 CONFIG_DYNAMIC_DEBUG_CORE=3Dy # 2 CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy # 3 NB: this adds the flag (when 3) more often than strictly needed; modules built with CONFIG_DYNAMIC_DEBUG=3Dy (!1) don't need the flag. Fixes: 84ec67288c10 ("drm_print: wrap drm_*_dbg in dyndbg descriptor factor= y macro") Signed-off-by: Jim Cromie --- drivers/gpu/drm/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 19fb370fbc56..704f94efc804 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -3,7 +3,8 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. =20 -CFLAGS-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) +=3D -DDYNAMIC_DEBUG_MODULE +ccflags-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) +=3D -DDYNAMIC_DEBUG_MODULE +subdir-ccflags-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) +=3D -DDYNAMIC_DEBUG_MODULE =20 # Unconditionally enable W=3D1 warnings locally # --- begin copy-paste W=3D1 warnings from scripts/Makefile.extrawarn --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f171.google.com (mail-il1-f171.google.com [209.85.166.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 969A11FF5F9 for ; Wed, 2 Apr 2025 17:42:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615779; cv=none; b=WNyWdxvGNSKHKvqBstcAI9ZbbxsXbanaXrWbkZvWj66hOMxPX0TDkb78CRs274NAxjw1t/eAGZMpuX2O5H5NeeiHQjc/CMWHHUcQlLnlTG7/IPtjgrj1B0uIkwOpBD5m8J/FMUBTdZ46zS913Gxq5TIF1j+keU+g38uG3L7kgkw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615779; c=relaxed/simple; bh=yjw36Byqp3KNEwgeFnOIp0bP1trgvdUfaThbZm1PYZM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ly+layNEeQS6weqwBQL9gk5Vnx2UlFb7PXgHV5qzieKmLj4h0tNocxtfS1moSXDmMMeVZjQjEqvX8JScDQWjRDvnrdu58+CBW7WEGv92KbwZPpW9V1yoOJghGyB8oFK1KdChjE8Gp/P+FdvR9p9HniGPsh43TnAvoCtwQRUH6/I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Z3yuLIka; arc=none smtp.client-ip=209.85.166.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Z3yuLIka" Received: by mail-il1-f171.google.com with SMTP id e9e14a558f8ab-3d45503af24so751855ab.2 for ; Wed, 02 Apr 2025 10:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615776; x=1744220576; 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=hj7/OLtj1fDw6OZs5+/lD0ex0mbib1oiHMYEMqtQMQs=; b=Z3yuLIka7zcwBBeX5aazanVrXAbb7Ia1GTVNsaWe9eYTmkPooU0oSzPFUkquwlO4v/ xO49qyWeuga1lqYuSLsKLdDaKYCbMDccfI1HljC3bnQGWU2f76fbv3FTBT3LFXoscm3I v0Zm05eWpGhNy6rOnE1pNsOwaMmgQEsyTRXlv98sCXHxI5GMt4pElm6C4bDMu901imyA eLQ53QWqwDbw1dbDVqY2aoIpJ7XoVtXH5VmjPp28/dXDBiWEPiylvieOQA0EQul/yEDq wazoV1K7UIgEdtAEwBmm6dy84bzHLAMk5zx/HjtWz6cQMLo9i8f8Y/a0212JohB13loL EaKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615776; x=1744220576; 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=hj7/OLtj1fDw6OZs5+/lD0ex0mbib1oiHMYEMqtQMQs=; b=YxUk1YKoCZOwQxtfrmFUEASkOfoxIl/ISPv/tTVPe4TtsqaVYUHG5j3JskpkxoRH9x r3LiNGmxFYua9KEwhrefzbPxzcwDQAHrqwMI/xaBmth/UoO38+Gbx9kT5pwXm0PogkSA o3VdgCzhomLcQkGwe0Q3pHxkoAs5xQAtu3D0C525ADQbkiKZUKfWe4EUxNdey0mmVuej kPXxw6YIoOvcrDmL0gU55wMVTnnXmyK9azL99V3AQ6KjqUEwT04MoyV1bsaKf83UTjNO OIi+2XdXuef9rK9N3Gi1Ns9Qe5QjGXf0vm2xKE6a/eHvpfKuWpIpQUIjjhAL+nlQilDT drUw== X-Forwarded-Encrypted: i=1; AJvYcCXxWWhS472rntMt4tPjOym0NnX8F98EDH0f7ZIpgCHdrU6pRlch4+cICscOW+Q6vmTj2/4EoJYc5xWxXMM=@vger.kernel.org X-Gm-Message-State: AOJu0Yzivyo5YR9aWFKM/ifGiV4ago9rZyW9EiXMgb4diCwsjkrR4qMT 1Or2fv+OMgK/+tNud3suTLaB9YT8MZnQXCJAERIkzvu9NfUUStV1sbPq9dUz X-Gm-Gg: ASbGncsTky2HE74acEYoynmt491ArmDZYibSzsLsV0aKfo5M9gLLUIylY33PjG/Wya5 37WaFDKPgcXWK83wlFGwtWNWF/Kqf+KRHxYpKgqxqomLGu69RnWd/ailzOHMnP37zn4JPgd/gjE cSh2VjyfqHYpbE5OmuttGlJNhisDaxIEzUhXFOWLjGsozG/jbHBN8mh1wYjuGnlI8RM6lMqS9oV n3qFt6rc7gG/k3l3qk+AiI1IzfO9/ePe+KA79FdnLmJnC5pwXjiMZoVoTk5w4Od6huUiOSh7OYD SdvfKhzWwxqV+K70OBF95D5yyJsxY3T4u5OiYBsKn7St7dB1Z0yY5HgUtU0Aqs5K1Q0z/fD6kqI 2hQ== X-Google-Smtp-Source: AGHT+IHkTdxrnWHVM3s8kzejMvdVLgstsz/xh978QvWvn7zXHfoIkU/4gG/Iemvf+jXbraofO9mW5w== X-Received: by 2002:a05:6e02:2703:b0:3d3:d28e:eae9 with SMTP id e9e14a558f8ab-3d6ca5d16efmr104731125ab.7.1743615765249; Wed, 02 Apr 2025 10:42:45 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:44 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 31/54] drm-dyndbg: adapt drm core to use dyndbg classmaps-v2 Date: Wed, 2 Apr 2025 11:41:33 -0600 Message-ID: <20250402174156.1246171-32-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" dyndbg's CLASSMAP-v1 api was broken; DECLARE_DYNDBG_CLASSMAP tried to do too much. Its replaced by DRM_CLASSMAP_DEFINE, which creates & EXPORTs a classmap (in DRM core), and DRM_CLASSMAP_USE which refers to the classmap defined elsewhere. The drivers still use DECLARE_DYNDBG_CLASSMAP for now, so they still redundantly re-declare the classmap, but we can convert the drivers later to DYNDBG_CLASSMAP_USE Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- this ignores a checkpatch WARNING: Argument 'name' is not used in function-like macro #70: FILE: include/drm/drm_print.h:148: +#define DRM_CLASSMAP_USE(name) the macro is empty, and correct. only 1 arg is expected. --- drivers/gpu/drm/drm_print.c | 25 +++++++++++++------------ include/drm/drm_print.h | 8 ++++++++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 79517bd4418f..a3b70d104afa 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -55,18 +55,19 @@ MODULE_PARM_DESC(debug, "Enable debug output, where eac= h bit enables a debug cat #if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) module_param_named(debug, __drm_debug, ulong, 0600); #else -/* classnames must match vals of enum drm_debug_category */ -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +/* classnames must match value-symbols of enum drm_debug_category */ +DRM_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, + DRM_UT_CORE, + "DRM_UT_CORE", + "DRM_UT_DRIVER", + "DRM_UT_KMS", + "DRM_UT_PRIME", + "DRM_UT_ATOMIC", + "DRM_UT_VBL", + "DRM_UT_STATE", + "DRM_UT_LEASE", + "DRM_UT_DP", + "DRM_UT_DRMRES"); =20 static struct ddebug_class_param drm_debug_bitmap =3D { .bits =3D &__drm_debug, diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 9732f514566d..e86ebb716b4c 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -141,6 +141,14 @@ enum drm_debug_category { DRM_UT_DRMRES }; =20 +#ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG +#define DRM_CLASSMAP_DEFINE(...) DYNAMIC_DEBUG_CLASSMAP_DEFINE(__VA_ARG= S__) +#define DRM_CLASSMAP_USE(name) DYNAMIC_DEBUG_CLASSMAP_USE(name) +#else +#define DRM_CLASSMAP_DEFINE(...) +#define DRM_CLASSMAP_USE(name) +#endif + static inline bool drm_debug_enabled_raw(enum drm_debug_category category) { return unlikely(__drm_debug & BIT(category)); --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20E071FAC4D for ; Wed, 2 Apr 2025 17:42:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615769; cv=none; b=a3jNPRMfQ56W++95yZRcATFMAJdSNDd7sTc/bFCdzjP0zRxGYYHmOPkHQva3EtOpUthzxGE03QHRwcM+keJtEHbTT1Oe95nf5Eh4diW9jAcJzHxd8QeKKnv/T8BYrnDsBtWBum+BenXqf2H8DXPrJ9RmxsdvE3MR1kbroM/KVXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615769; c=relaxed/simple; bh=JdhZz9HZKZI37pIDrFTiOEKOZseErQXYMwHr4BOJ360=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a0J7n5O/Awq057CGm/0B+qmtUKwFdz5Wr89/xbgbNq66vMPTnpNx3kI3kA5V08PUDiIeHXy2XgWpGtC3N4CbKZ92Pmo2d3uKRcEaO09h8d6zxIXeZNU+rj5xqRf6Y7ihtMPp+VZYyuV8T1/iENldkWDDEGUOWqsewZVv0vm4NXo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FyizNXjK; arc=none smtp.client-ip=209.85.166.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FyizNXjK" Received: by mail-io1-f41.google.com with SMTP id ca18e2360f4ac-85db3475637so36367739f.1 for ; Wed, 02 Apr 2025 10:42:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615766; x=1744220566; 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=GdzbEW9zH0UE5x9JfjsCyVhdiuYXlGo5WMhyJQ/maLs=; b=FyizNXjKPtp4FYuRkMk9HX0VI6MiNrePueewpbOZbHlqYh3VCMk3c1V59HAhSdS1Ns niuj0k46Zaq0xFsENuHP8OP8bfySE8aqS/0ISFPoMcsyDNdtcPanaNVAyT70ompCcaea 9f2foTWuzQjnC6kAr5eIeCJ+emM6B5Q65NfY6D4WZoYfTeEGiqYyRXYH8xoUzKms/0m4 yZAYi7Or6u+LhvCF1CY/ywCMxRsXBuw0f/stCJzGS3gGMLOuYSoRSwZt6+h7CnIIZSAW LEBZj0GXd1pHCX1m5eNLta5P+qzQI9qug0Nxns5v19Vfg9hoNG9ysLrAUnkBNkqMIze2 v8tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615766; x=1744220566; 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=GdzbEW9zH0UE5x9JfjsCyVhdiuYXlGo5WMhyJQ/maLs=; b=Pzj4haMlgEoRV/XfiVQ9dJy2f/3U78RoWvzqvv74g5TMg7wUJzTAPyZxBJ229P3xbq hYe8B7nMZHW4E1LMPjl7sq0qXFlht62azfe3uhbkysZKPJTQIEupJ7pWZf+xSknM3PzH P49eUz1Zj167phMhSsI2nXZ8+kOhMJ2r3iQF01yobpotmFfYE0f4bi21otmSTw2VVev+ ZZwkkjEGgUWxn+2d7pGdU5yPx73ilxfrDgDW3Rb7xZfaLpvTNo8X+i95CZyj2X5iTCR2 mPskhoZXV0Xu/TgNTt675NkjMUzboTWY48Sx48D+sGbU7W6s+pEvLcmDo1tfzDXbjuGn zgPg== X-Forwarded-Encrypted: i=1; AJvYcCXyk2wUG4j8ECKiu6pqnPk0x9d9Kb7l7h+ObKoauhEMJKxq7C/n/R9qqO/VyXnFD73D9LI+TtzTr4zbcLo=@vger.kernel.org X-Gm-Message-State: AOJu0YwdGbZZEpZtm2V/PtDzufZSdCcRtHrvQex1oYBsaE0q7jan7zDQ UU+z1oJ6UAnr0U7pyQf8bErNyNkgIuUBD5NwHCOhdWMRh6gq/eLE X-Gm-Gg: ASbGncsYsZ2nPtLx7OqA75ypN0bN4LBTRYiaW4y0AqVTI4A+N4BBSQm7sHxNEmPjb/F bUzyMM05Xv3NGgCxS6zVGsczW5f7NwBkWt/5UAZ7nSNx5mYz6NhTIrciT2Tg8rIjMm5D88puzfr LVwZ5g6te1jvnq5MUStvuRznngPYWdyHtpgjSHfm0SSwrMJCDgzcr0UcPAngFvRP1ZudiiekNI5 7zCS3xj7fsm3NnhvF61EYWyvRDeyY3uIprc7P4eD6pB05jcPd8+3+fqDWuJMLcLBySled0cjh5r l4V4ZaZ9ujO/vgIrjYUYNdmU3IPZR8UVv+SBIkoce3TPok21IKNSzJeYOxmOKojKSIiM88yo4Os vlA== X-Google-Smtp-Source: AGHT+IHM7tagESMun47M5HMS7lAKv6qUWexzrO14AcKjGRpEF7WGOj0nJoAxliwzZGovvAJef0zyEg== X-Received: by 2002:a05:6e02:1749:b0:3d4:6ed4:e0a with SMTP id e9e14a558f8ab-3d6dcb5e15emr6148965ab.4.1743615766244; Wed, 02 Apr 2025 10:42:46 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:45 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 32/54] drm-dyndbg: adapt DRM to invoke DYNAMIC_DEBUG_CLASSMAP_PARAM Date: Wed, 2 Apr 2025 11:41:34 -0600 Message-ID: <20250402174156.1246171-33-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Invoke DYNAMIC_DEBUG_CLASSMAP_PARAM to hook drm.debug (__drm_debug) to the DRM_UT_* classmap, replacing the ad-hoc wiring previously doing it. Add DRM_CLASSMAP_* adapter macros to selectively use DYNAMIC_DEBUG_CLASSMAP_* when DRM_USE_DYNAMIC_DEBUG=3Dy is configured. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- drivers/gpu/drm/drm_print.c | 8 ++------ include/drm/drm_print.h | 4 ++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index a3b70d104afa..46d53fe30204 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -69,12 +69,8 @@ DRM_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DIS= JOINT_BITS, "DRM_UT_DP", "DRM_UT_DRMRES"); =20 -static struct ddebug_class_param drm_debug_bitmap =3D { - .bits =3D &__drm_debug, - .flags =3D "p", - .map =3D &drm_debug_classes, -}; -module_param_cb(debug, ¶m_ops_dyndbg_classes, &drm_debug_bitmap, 0600); +DRM_CLASSMAP_PARAM_REF(debug, __drm_debug, drm_debug_classes, p); + #endif =20 void __drm_puts_coredump(struct drm_printer *p, const char *str) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index e86ebb716b4c..8758449491b8 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -144,9 +144,13 @@ enum drm_debug_category { #ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG #define DRM_CLASSMAP_DEFINE(...) DYNAMIC_DEBUG_CLASSMAP_DEFINE(__VA_ARG= S__) #define DRM_CLASSMAP_USE(name) DYNAMIC_DEBUG_CLASSMAP_USE(name) +#define DRM_CLASSMAP_PARAM_REF(...) DYNAMIC_DEBUG_CLASSMAP_PARAM_REF(__VA_= ARGS__) +#define DRM_CLASSMAP_PARAM(...) DYNAMIC_DEBUG_CLASSMAP_PARAM(__VA_ARGS= __) #else #define DRM_CLASSMAP_DEFINE(...) #define DRM_CLASSMAP_USE(name) +#define DRM_CLASSMAP_PARAM_REF(...) +#define DRM_CLASSMAP_PARAM(...) #endif =20 static inline bool drm_debug_enabled_raw(enum drm_debug_category category) --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f169.google.com (mail-il1-f169.google.com [209.85.166.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0396F1F91C5 for ; Wed, 2 Apr 2025 17:42:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615769; cv=none; b=K/+mXJbskmVMSLRxtcgA7fPHOfieYKQIcs9Ki7jJ9g0IKbAuxm9ls0aPu79IXT3ZyT46iIKGKtAQVgeezz6T/ZtJQrRKIyCC7Jy64GG3ypB/Eg1ftVdMYs562rwY8aqRdhCGu2tSEUGFtET5JpNAAAIqjBR9mB7WlnDqUl+d7lw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615769; c=relaxed/simple; bh=oxoKuUQUV2T3S87wJDy4o3Zv+jpF2cD2sTqsjNtu6ag=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mGPKkMzpAnZjOPu/HulBSBqoA0eu2GRr+hyvOIMxL3pm/X0rjT9j0VUzqFtJqL0gpgsOsfhJMFyRinKA7Z/EPFgQ8esdr+q8UfBZum9JHS0j/hlDRGWaL44bLGON8C15AQCN4Ajd59pkWMcyoizazsj7nwgCiAWFtwKEli7oCfU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HFy7vsKS; arc=none smtp.client-ip=209.85.166.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HFy7vsKS" Received: by mail-il1-f169.google.com with SMTP id e9e14a558f8ab-3d59c8f0979so3699705ab.0 for ; Wed, 02 Apr 2025 10:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615767; x=1744220567; 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=Jfz5L+gbGfT/xExPgo+08GeL0GIfXertlxd83qmdF8E=; b=HFy7vsKSELDzJ/UEO41+EaxaZuNMO0vlfsypgxf7MiGCm01rK/To2Wom4aGi9ve224 nFZGOilK6NbBQFn0LxUp/g24k6c2I7nBdPnA2mTcnWSYoUUanpApm+SP7VHlCpPGDyiS JaXIwrNDE9S+xVp9wWN06+eMExVmmi9i4AllFPjsyagFnDvN0VqYQv9gOzY2gTqFfpTp ic+qCJpW6l1IsmnMsmFcPmT/JUSVNi/W5f+M9zlUOWQNUAJXzZ6s2hY36Huu/P+NS3C+ z4LKC2vDPyG4FShNsTCzNGbVgY4jxz/a8d9zWXS858dCSYLMm+h4+suliMpogIKKqc80 yGZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615767; x=1744220567; 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=Jfz5L+gbGfT/xExPgo+08GeL0GIfXertlxd83qmdF8E=; b=qllwqgtmEevPR4TEXxC2qttjTad2UhcE8tx4goimBCxXAOK47OBT5Fw5ooilKNeyZv 5tJ3h2aYLTAGbh9G8JDQYC4fUDj2rd+AoAbeu+NU8rQT2feb8k9juHTsh8jM4j2kWovq lD69DY8bMqCaQdofZTZ4R3MWYZlaRFuI+5U2byRJPbsNOoEFTu35AM+BLsMaDDniBjZ0 xISQfASFVk1iWhkG0MUD7kcY3SGBiXnmRuK8DAC2vZz2BlLDfmKmCbHMub4I+WZzmKF7 1NpC5EZEO/9IkeR9xhx9xki28Q7RK/A54vs58iCP0JhRNgk6hP/XKiBkin4mDkTv/fh+ UnPQ== X-Forwarded-Encrypted: i=1; AJvYcCWFmaM/u1w4H7VfrE+yXlj6FMO6CrZxnZPo8UBv9hvy3+fhOMQKQ6q45REurEc3uCy0LwNkVpeIcXrKM6M=@vger.kernel.org X-Gm-Message-State: AOJu0Yw8sepjcS5Fn6DsFWKR/EQkhVJEUD82fas7ClFyfr8Bdv+te+Iu ThGyG9OcFnaBbpL7QBxcsMwiEw6UpVovMlI2JwS54sf3U2GgStIuF/t5/XYm X-Gm-Gg: ASbGnctBmICEPLjJNEo7sKqh1bOBX6OjBhl/xRXWk405MWrJTD1Azv43nOygN/sswjx Np+SSkUEjYiTUMJj/SrNVVDxZWzJZB9eDX38yHJdB3WEH3udizJYn2WXnCbyzQPHHBqviL74qO8 tRhJNMQgujCPuBmTwPx63jAhr2EEm/yxURf82p4p+vNT4aj2rCHGDUVU4zbXvTHJ+mPAX/C+l8m yY71d1+seU/X5Q0/O9Z25FDpaMgUwWWxta36KQSpwGh5waN7n+L8fMB9CmSnoUjPi4ReKp7u1Pg i57OP5LAQV8dQawzZbwPIYKn3uZu4MKQZPOnWiHCVFiwi6OXKhd/F5NtuYwE9TTRFSGMG7MCDsv yxQ== X-Google-Smtp-Source: AGHT+IH23Mb806SUSpux0H1ekpyWa2rzurl+V62I0zvWkX0PXGUg8/Ozal3zIS9c5pZxy7jQ85b1yw== X-Received: by 2002:a05:6e02:240d:b0:3d4:44:958a with SMTP id e9e14a558f8ab-3d6dcb5e21cmr6314435ab.3.1743615767041; Wed, 02 Apr 2025 10:42:47 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:46 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 33/54] drm-print: fix config-dependent unused variable Date: Wed, 2 Apr 2025 11:41:35 -0600 Message-ID: <20250402174156.1246171-34-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" With CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy, __drm_printfn_dbg() gets an unused variable warning/error on 'category', even though the usage follows immediately, in drm_debug_enabled(category). For static-key optimized dyndbg, the macro doesn't actually check the category var, since the static-key patches in the proper state. The compiler evidently sees this lack of reference and complains. So this drops the local var and refs the field directly in the macro-call, which avoids the warning/error. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- drivers/gpu/drm/drm_print.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 46d53fe30204..41ad11247b48 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -212,9 +212,8 @@ void __drm_printfn_dbg(struct drm_printer *p, struct va= _format *vaf) { const struct drm_device *drm =3D p->arg; const struct device *dev =3D drm ? drm->dev : NULL; - enum drm_debug_category category =3D p->category; =20 - if (!__drm_debug_enabled(category)) + if (!__drm_debug_enabled(p->category)) return; =20 __drm_dev_vprintk(dev, KERN_DEBUG, p->origin, p->prefix, vaf); --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f179.google.com (mail-il1-f179.google.com [209.85.166.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D31F61FBEAF for ; Wed, 2 Apr 2025 17:42:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615770; cv=none; b=Q8Cfb6M7CiA46nYi3pBAocV+Hbo6uFEMYo/HHkOhB4gLUwNsdJ8PGvlzongQgoltZRP00cvzImDwQPmm94ClhdKDBjik21k7BHB6hR6FeS/3/DURX4CIEbkNbP4VNZmEQur/RQtDHsIx5rZWRQwNMBUwPqP8G0pwDfneIOq+cEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615770; c=relaxed/simple; bh=z4vyrj+RoPLsf/4XIHodKfOKwm2p5okFB2+tsOyDjuY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vw7KvZyKQZGHseCA9moHGnDAKKYWWdAOI1kKa8MjC37scIivFIWSFW/QkN3DOI8EMRRTUamyNGj+Enjf2dmWhJ7kKEif/FQbPM0mnhnBGVQYklimB2zc+y9nkQKNAnplv0IKHw5VSyOremt7Ayj31O8FQO8u747XGr4onJiwGp8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bSsFCYnS; arc=none smtp.client-ip=209.85.166.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bSsFCYnS" Received: by mail-il1-f179.google.com with SMTP id e9e14a558f8ab-3cda56e1dffso522165ab.1 for ; Wed, 02 Apr 2025 10:42:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615768; x=1744220568; 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=w02wgtcHHGYOO+gmdOwu7/FsZrX0ILEdqRJTa3eES9s=; b=bSsFCYnSpuo1tHt1BpbUlI+unc3hLd+mBX8zjiirj++IEkTfEQV4UIAzTmSZayT8l6 VCP9geC4Cd0LTiGKxOh+o6Zy4Dct9eGqWBuB5EGpI3MIY/MMkMxAtYdpnZrdT2vFjNsV vtxfUTLARpDq+U4DxklASBHLxacL0isRyWCPqk9HmCdmsQKJ/fv6ynY6QRCepthqxb0G UJkw2nIifqE7LQRXTjCp0lxQURO3EHnyCFfc2VQH2/Z/CfQzib3IPBA7m5XjUBGf3aEg AILvQWMt7XIOBHapoUjYAb4nDTYi3dlTUzttiNTqJ95EYU8ju57w4rJOzgCWXeyi7oF3 /I4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615768; x=1744220568; 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=w02wgtcHHGYOO+gmdOwu7/FsZrX0ILEdqRJTa3eES9s=; b=rOB3sP4liysH2HZvDeu5F/b1QHhfQxMseN/X0jwswCF0eGIoLw3h0heO+SQcSHTM/P tuI+r2ZUEt11GuQ58ywDPYtwa038b6lU64vJTgU4JZpYODMO3X91E0yTFNtE7HdURaBT K2fQyNbjSoQHynIlCql2fsRS4GcvhTP04ks/gR485iiaxKJku+9o+4edQWNtyIXr3HIy Y1I3Ze1Ry66WLzrjksJv6c7jWOCFjwOPGzWXtpYS/6uOPxM1VDE+fxpQRdr3YKtPeJF/ aQkYwSt0W3qq7HWKZ0ZTWXXI4noTLuwItHk13bHKMW7Z/2PpjrwvwuV7VAhZd1Mt8ibO quUQ== X-Forwarded-Encrypted: i=1; AJvYcCWVphoBL7Qs+odAvM4WJy3uib0YJxzfITsYx42cb1XwLuLmXMx3uzcTGxLd9q8U+bNNLiq+gchkDJZleu8=@vger.kernel.org X-Gm-Message-State: AOJu0YxwWcLgU86SajfrbVMjW6m2rubxV2GE3GmPsbN0S+ONOJKUbnyG xAjY3RTpneAX5ATvvZeOJGai/Q3y+7qvSKZS6vmDH5Lujk8lLd+J X-Gm-Gg: ASbGnctGslzoSnmCg3HRdRc08c3EidWM3zyBXDDc7xmlCfdoaedxYm1NTjIKoKCzaDm U4oyNBY5Si7943ckRCzHaf8SIah7Xp+NUUrKTqVczH/gjkxG/sAyYg+lHoXFqo+V+H2wQ96Askq BvMvGZyOByb5c3NVk/439TmZvavaCzO6xMPD5CgyA5AVTQRBnXb/JiSYdcs08SWfNVkIV46ce1N 0jGL59VP2T4qweTIpUJTAZ8oYAkV4z9I0bNHyuRGXpSPHNlRxOh1Wjn3fbAkd8kfDO/X34nrB2e jrWPqDboWl0hFsbALSjIpv5F0p6MwITokieWrkn+K5nLOQTjcx/BTkyuTS9BT3cSemhstTXl7DH MDA== X-Google-Smtp-Source: AGHT+IF1HLIFdbvBCtWhlGzPwTstv1cbLvUICq16go06Bgug7/wjFdTjKb45EA502/WLzrR1pH3YCg== X-Received: by 2002:a05:6e02:3c82:b0:3cf:c7d3:e4b with SMTP id e9e14a558f8ab-3d5e0a09a11mr204521865ab.21.1743615767925; Wed, 02 Apr 2025 10:42:47 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:47 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 34/54] drm-dyndbg: DRM_CLASSMAP_USE in amdgpu driver Date: Wed, 2 Apr 2025 11:41:36 -0600 Message-ID: <20250402174156.1246171-35-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Following the dyndbg-api-fix, replace DECLARE_DYNDBG_CLASSMAP with DRM_CLASSMAP_USE. This refs the defined & exported classmap, rather than re-declaring it redundantly, and error-prone-ly. This resolves the appearance of "class:_UNKNOWN_" in the control file for the driver's drm_dbg()s. Fixes: f158936b60a7 ("drm: POC drm on dyndbg - use in core, 2 helpers, 3 dr= ivers.") Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_drv.c index c0ddbe7d6f0b..e1367f66c4d2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -234,17 +234,7 @@ int amdgpu_wbrf =3D -1; int amdgpu_damage_clips =3D -1; /* auto */ int amdgpu_umsch_mm_fwlog; =20 -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DRM_CLASSMAP_USE(drm_debug_classes); =20 struct amdgpu_mgpu_info mgpu_info =3D { .mutex =3D __MUTEX_INITIALIZER(mgpu_info.mutex), --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f180.google.com (mail-il1-f180.google.com [209.85.166.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C58E61FC7D1 for ; Wed, 2 Apr 2025 17:42:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615771; cv=none; b=O8j9eutkgW4Gk5tCXvRuNmlEEGnJDs3LUR2KuvFJ1wNX1Q/2bCPz/NAckKACmsjLFR7cebWjy92VdSnR1cmUhzeAoePJRIPoQjR8bae66BpuQJYDqXuiSCn/3nws1hcMaZrJSK0YmKkbCUsQZLKZ6L5b3IHT+jPINlZGXo5IIwQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615771; c=relaxed/simple; bh=eTgXCMSuJATKpfTpuzAijyJ89AI9F1a/QFA5ixRxZRU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VqBSTqLoTRnbTyCsFX3HZbO5mPhx21WfDrxy8ZtVDsqB9u1sC9DarhujdovTHg/phfC6dgGJt11XdcpKIS7bSkfr08lgBpRcfPeavxI/HE8WjYL5OSORCaVkCcvrsIuvzQmb1D2HRNrmDkEepgkKuAGZKopJVWGuStU0YZMwfFk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NOs4zeYA; arc=none smtp.client-ip=209.85.166.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NOs4zeYA" Received: by mail-il1-f180.google.com with SMTP id e9e14a558f8ab-3ce87d31480so493285ab.2 for ; Wed, 02 Apr 2025 10:42:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615769; x=1744220569; 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=UexT083kjVXSMtfjeXG2YLxPBGob4DA2kkNTE3v1uqE=; b=NOs4zeYACnKuLMdQZ24uRSyThSCCQnABjECCt79esBQ4+kjcSHuX0tc0dP5RhdNpdr nSAtSHEy+HAfarcjAjI0a+OSHd3TrwanUCwoPi35ydxNspFvPoFvxls9oyBb1XieRr3J E9W+03PdfMOeHUGDmFo85kmJTMBh/elJDoj3dt92BGOfnfRskFOxerpzWok5WSJNiyfT wA7cBuBJslvJbNlDSXOLG+sMdnnf9VBliEqb95dF3FLbSgJJ6nUXIDNKGahBghsl+iGD 0TLG45aM7UJsjn30z9UFF4m4PKX1cjCclEktoHTR9wMDbo2exfAdhDKAIzsajKDZZ3k0 GV3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615769; x=1744220569; 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=UexT083kjVXSMtfjeXG2YLxPBGob4DA2kkNTE3v1uqE=; b=v30s1cSC3cQ3Q6zeKRny6kORpG0xn0QULoorDSTo38TGz4hMGZ1kbyh/+U/8xbMFEI d9qHYMouiwa5ZBwUotBlGR+F2vc5NmNqeFGpbR4wHTBSzMYyVY+PlkDCodTpmQMNJVBv hOrvEqsGlOF+x1flkXpycnFkuKYyEUGC4s+rxxFF73uJR7sDoyJZGL8xmOwWIlWJuZgY y/5UCi8HN2wJfBm3/KrNeSyHYRhYlMFF8mdRpyWRJaZTC8X3i4PCDUxiJw/fSm7Jpoef Zz3z8jk75awqV1VWkwtVPTRkowdQLwLJFrGU0g8SkYdOKkZf+IYBPS+fvellXI5Ct4pu zgiw== X-Forwarded-Encrypted: i=1; AJvYcCUmweFvgUfbqwWSL3nQLFduHxwYwIecunwSYocft/2fTRn88sisD/lwRjpVqy0T1lJsE2TW1SCeOfNn0XU=@vger.kernel.org X-Gm-Message-State: AOJu0YzgZIqtUtOWWUDl2DnMx1fvu3RSEAlFE6LZXkFuP7SauZa+dvp2 oOvr4sdVEv/n+hltiqRo2+3uIduGNqlfA7CjgxO/8HbHyigPz8lg X-Gm-Gg: ASbGnctg6TXQhEqY5bRc/Z9G/j1XmbMggBV5ZdrisnCJOp721RUFIGhUFSc1OBCbPYu jiQi9KOf2Bm3ZqP6QWKY8tX90AVI/LOe5+CaOzimsoiSG0YtscXEL+wTQ398Uxwx9MkgfOL5PA1 B9UbeXUV5wGpUhxH8yhkJquzqKXu677STCnhB91MdZQijxAVEY91duj6YreYc0Ty2FZnIMuWNZg rCYQtVUSRjdENJABGLISGMq9DR759hxplCi8a1cDz5oIhnmXzjJP94Mx5k0g9e9t7PKkYQsoTT7 EqcNZ00DABD28WnexKRbkkK7rNAnhx3vJGbf/BE+btjElF5R+P5HgvALsWujJ/7Cd0hPYSxZlLO xTg== X-Google-Smtp-Source: AGHT+IG2+BK5PK9DVFs/ltNR0E73frvh29ivhJ5H3WwGU3GpDmZNKKN6o+UboVJzXIf7Z+nQdkxLrQ== X-Received: by 2002:a05:6e02:184e:b0:3d0:4e57:bbda with SMTP id e9e14a558f8ab-3d5e08eacfbmr222774665ab.1.1743615768727; Wed, 02 Apr 2025 10:42:48 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:48 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 35/54] drm-dyndbg: DRM_CLASSMAP_USE in i915 driver Date: Wed, 2 Apr 2025 11:41:37 -0600 Message-ID: <20250402174156.1246171-36-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Following the dyndbg-api-fix, replace DECLARE_DYNDBG_CLASSMAP with DRM_CLASSMAP_USE. This refs the defined & exported classmap, rather than re-declaring it redundantly, and error-prone-ly. This resolves the appearance of "class:_UNKNOWN_" in the control file for the driver's drm_dbg()s. Fixes: f158936b60a7 ("drm: POC drm on dyndbg - use in core, 2 helpers, 3 dr= ivers.") Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- drivers/gpu/drm/i915/i915_params.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915= _params.c index 37746dd619fd..2dc0e2c06e09 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -29,17 +29,7 @@ #include "i915_params.h" #include "i915_drv.h" =20 -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DRM_CLASSMAP_USE(drm_debug_classes); =20 #define i915_param_named(name, T, perm, desc) \ module_param_named(name, i915_modparams.name, T, perm); \ --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f173.google.com (mail-il1-f173.google.com [209.85.166.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 927031FCFDA for ; Wed, 2 Apr 2025 17:42:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615772; cv=none; b=oxWar7HmRsiWXQyUtIwxXpIUIgZcSzsSzz/UQu53BnPl72IrL784jEzoIf3zQ4QkkuWNl9ZAl7oh9rI4KBgXRlB8VwyVLTAGc3huBJ78Fr22qh6fIWbYuNDoJz4moSbfZKmDkh5O0T3qZJWWBd60/XZwgziU+1SR9UH3UvX8XwA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615772; c=relaxed/simple; bh=aKyMalRer1ldzt2wLGcKVF0D0GrZTYS4hXW1PO/f+rk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xu7sSNRAiPZZlAy54PE2Rq8HijNfmXjV8ZJknQYMuEqkktMYlUB1YEj9rT9MN4IC00loB7oFo7K1Q5g8ZbDrMHfq6uLvXkFVkMlO9SwZuEUAKEx9T9OykGzKqb/vjMo9rZYyF1ebAx40CnOg8x6Ow60I8wedmPePwqqHCO2uM+A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jyabwVR0; arc=none smtp.client-ip=209.85.166.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jyabwVR0" Received: by mail-il1-f173.google.com with SMTP id e9e14a558f8ab-3d5eb0ec2bdso423555ab.2 for ; Wed, 02 Apr 2025 10:42:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615770; x=1744220570; 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=l+xh63ngQpysf5TdioxYR9h/6SGMYGM5RCAWumi1pq0=; b=jyabwVR0x5RngAV4F49vLiXbw1ZgVLqV6yOxptQfZaAN4LQNrYElZLGi4MULwiO3wT 3XDpv4DnFVIgJc2cMYP0GaTP0qV0eKXScYnX8cQbWhpFySIT7H6pbfmVRYzC8qGdixLj pd0PNBmKDf+pKoesYL32R9w8/ZiUmKmDeCM8HIRtKua+MzKUjEEnZCpVweKpGA9gpTKL /TdnnVTMgN++0C8T1DIiYVbmDMIi48BomUfdRS8GRX3LOdcNkeqk7f/rfKdRZYk8NIZY u8z1EPSNgymwlZspPPdD0LtCP3sUPk01CALEm1pPACV30nD2X7fW3zkjyr4x6uEqTqsm A9Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615770; x=1744220570; 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=l+xh63ngQpysf5TdioxYR9h/6SGMYGM5RCAWumi1pq0=; b=HfWq5XTVwCHqr5ks9XBGqu0MOcrTDB40tiyim9d10iyXJfjxsmTsfp5jdVDJ54OlKJ wfN5KRBDvzWNHAAvSXKDTcZVlmSZwQz9bb0Z2zJGexiqkSIy/xRUGHLB/lieN59CsKIx A5VInzHpokhoIPkQykyE5Sn22z+hSb0e49lOjFBusuBa7NuOiYsdJBPE/VoMm4/0Cwzg lhjTwRb1LxmidgTd29yA5L8rOhRpIV9OSZtq9Z8I1hdb1Y4LNWQyIEr5vZ+mVSYDTlvx MKv2by4MebJiQ6X2OWdptn1pk71BNnF2UEmLRGfzhY11eG5Klu7kPgYFrreRkUyYRBQi svnw== X-Forwarded-Encrypted: i=1; AJvYcCXhirBPsHLjsjEt2VZz82O1xVbEgo9T4BOtrC5l9WvokoL+0u94uiA+JpjHBu2KOEndCumjXmYCGnbZtgs=@vger.kernel.org X-Gm-Message-State: AOJu0YzSSm4o5qb/M3DEB6ulvpYDyzYV4qySY3jv9RDmeM0NluR1O4jU x2DlEqGVjI3NVuA54yBzM8SM5lpvJmPaq6sAwsM/WkODXW03L6sT X-Gm-Gg: ASbGncuQe9kBdZiYvFArEN/kLuQCAXN4HjTMnPb1pFxI2epbeF2GmgZ0f2HktJfQBe5 hdKcLgb60cQ6Z8AcVHM1TqbWP+uStZsEdr+b5iNc64uiA1hWpwGLHaugBqXVoAVMMKtOeWcSnlQ IUBYXzV6Rr5kng6WibTCkIPm5jdQ5vghMX/0yY4fYNNN5JdsSpguZEhO4fKBZtYzEwCDn0zR/p2 6qLx+2OZkOJCyywnsDj0HUmaCDJoRt9LD7bZj+1ytVtKq14jwe1gWC6ZfiKpkSpKfkTU8a0Xs6w NXkr30GHYbhucUINdykdnkjmQsh7M4o5IsE4+UmIhRCZJMwfmQtqfcYl2Ta7xaiP0SUdPP99Ov5 Piw== X-Google-Smtp-Source: AGHT+IHfVFrzVXMnd2YBb1/YfvvBl5qCe+8rGWdMzMU5nSjNPKKxFlNTX09jmDed7K6kxVwAkyqtVg== X-Received: by 2002:a05:6e02:184e:b0:3d3:dcb8:1bf1 with SMTP id e9e14a558f8ab-3d5e08eb179mr230026675ab.3.1743615769662; Wed, 02 Apr 2025 10:42:49 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:49 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 36/54] drm-dyndbg: DRM_CLASSMAP_USE in drm_crtc_helper Date: Wed, 2 Apr 2025 11:41:38 -0600 Message-ID: <20250402174156.1246171-37-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Following the dyndbg-api-fix, replace DECLARE_DYNDBG_CLASSMAP with DRM_CLASSMAP_USE. This refs the defined & exported classmap, rather than re-declaring it redundantly, and error-prone-ly. This resolves the appearance of "class:_UNKNOWN_" in the control file for the driver's drm_dbg()s. Fixes: f158936b60a7 ("drm: POC drm on dyndbg - use in core, 2 helpers, 3 dr= ivers.") Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- drivers/gpu/drm/drm_crtc_helper.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_h= elper.c index 0955f1c385dd..1d08d759f238 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -50,17 +50,7 @@ =20 #include "drm_crtc_helper_internal.h" =20 -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DRM_CLASSMAP_USE(drm_debug_classes); =20 /** * DOC: overview --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f173.google.com (mail-il1-f173.google.com [209.85.166.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81D641FDA89 for ; Wed, 2 Apr 2025 17:42:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615773; cv=none; b=qx1TzDAejd7vfwzHB0CfDaXrd7OSWiI2wBbNz92jxHM+bhOGnYb6p64phs/VPKi0dV6VcbgiKhjMKxWp6XcQ0X56gzwkbNzMfGQNDa06DBTOQa80ucwErtSbEH2uP0TYhHNrJDzyAlOy9FuoAF3bAOGI8alrpIU4fVmR7VfHHhs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615773; c=relaxed/simple; bh=EYOCGZRsfaORcPeGdBLh7rR5Syjzpp11LjXTO0MrAog=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y4s86McJPO+XCyHt3nluOYUq8ad3XFk7j4aTcgApdukPDmKGqOHLsCXBieN1vaNOIxSsD4VYOtRsyvQRCHgya+WJe6ZAfZXPmiVaEQj+GgqiVrmlEb4MrVo4o05+8UpcyfXfK73Fn5ZgF//AKr1hvRplv2iIMtr2kMiR67raqgA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fYOLo40x; arc=none smtp.client-ip=209.85.166.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fYOLo40x" Received: by mail-il1-f173.google.com with SMTP id e9e14a558f8ab-3cda56e1dffso522365ab.1 for ; Wed, 02 Apr 2025 10:42:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615770; x=1744220570; 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=NiOyM3S4jOaHGGlz5AF/FsMWLYpHRqSO4fLf+H68uvk=; b=fYOLo40x4G4sCAPFiUAWaYGCqbTu9RqpG9OnYDK0UPx9hT7Y5PQokURnIEoA6beWZx e86oZJMkmIyLpB9Z7r7vDJdKG3bQ5/cln3DInI515r8YfSH+aekq3x0FSsKv1yvLutw0 CJDXQTEFmMMri71UFYYhdmD0XczF5bbu6N3kWtttn1Ba8aY5chr7Sq8qqXIYVFEVlabT Xzd7tFWX9rDx1rS/Gh76IWtxOSFuaqUi77+QcgyrDVTKY7AzDv78ajCtVS26xDKfEHYv zseaJr6EjhLuIUFxfN+kx1uJx6MFxFtFlmwWe3cvYndLlK3INoRqbssI0nrnML4effr9 7llg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615770; x=1744220570; 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=NiOyM3S4jOaHGGlz5AF/FsMWLYpHRqSO4fLf+H68uvk=; b=fLPSpI5AKrobzK0BCCEqnj+J0X00biy7id5JnPHMe8v8BY9SCYcRBQSMx/CgABo7ud F7w8fceordmTIaaO+16bcqbmVKWn3g3U4X0gNcLdqNULZJgCFsy0BMVQ0uKNtA9K+ssx xNm4zeFCv3iTeGMCjymMM0cj3CsZZD/uZI4qibKQXJm2Cb3CgfUdjnt4Kp+a7z0b+9jo ykO4733IrFjBQnOn16GKS8P/HB9EyVNnUISpSNy5t5L41p/zvpyCMKKM4ShZENhK0HW8 OlzJqwSgczliuU5pOSV1qkxv8KLcvWc7FxpuyKzsV0VlYihJzNRQqIpgX92nqfZJGSHM U+7Q== X-Forwarded-Encrypted: i=1; AJvYcCWF8jJxQQW7bl9LNZe0kp5N4bmrujR72F9JJSgh/0KFP+2ZT0p9Uk22VU4FJzTgbQrsPxroaO0ZWGNFjwI=@vger.kernel.org X-Gm-Message-State: AOJu0YwUDzNfmlf4rrgdpTsD4j3b+fx8C4OWLtcOTHaPJuR0vAVZDrHL Y5GHDOM/B82Ud6yUy/eOQQhEGFbF3p6N6KDvumG8LwwHSMiulJTy X-Gm-Gg: ASbGncsOeHB8kvN48kaeRvKFYe3MZtcC3k8kow3+0BglqtZXqpBWtEGylUUMisU3siu m/hsfXy7bm0Ysx9PpIspNbSVOR1qbNC6b/1bXucFgkCiqFs8+5mOjmZN+MTXhbBGdPFS3shzxj0 GEcFcyLCC1EihmWqXasJDQ1ZKOEZ/qjD2vTW5b+RWjuSWb5pycPjUJyZJI0+pmxlTZloz//0Uun wtUC+/8adCuLZswZ8GTgt6eIxLyAAbMZpnYobJksr05A6SbHIAsCtpD07QJyiSYSwEXcH+8+n+X dDf1re9w4TMCopM/cni0pfR3/yEJqU1xlT9kB67rv7d/V10HEPbmd51ZD5gmjLuTEWldbbpd67H 7Kw== X-Google-Smtp-Source: AGHT+IEmCAdxBmK0dq3RonyKvIJjIp5sHVor6eltDwW67xuLu5GGG8D2N9ixjYNq41QL7O0NfYR3PA== X-Received: by 2002:a05:6e02:4401:20b0:3d6:cb9b:cbd6 with SMTP id e9e14a558f8ab-3d6cb9bcef2mr55037985ab.13.1743615770553; Wed, 02 Apr 2025 10:42:50 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:50 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 37/54] drm-dyndbg: DRM_CLASSMAP_USE in drm_dp_helper Date: Wed, 2 Apr 2025 11:41:39 -0600 Message-ID: <20250402174156.1246171-38-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Following the dyndbg-api-fix, replace DECLARE_DYNDBG_CLASSMAP with DRM_CLASSMAP_USE. This refs the defined & exported classmap, rather than re-declaring it redundantly, and error-prone-ly. This resolves the appearance of "class:_UNKNOWN_" in the control file for the driver's drm_dbg()s. Fixes: f158936b60a7 ("drm: POC drm on dyndbg - use in core, 2 helpers, 3 dr= ivers.") Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- drivers/gpu/drm/display/drm_dp_helper.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/disp= lay/drm_dp_helper.c index 61c7c2c588c6..68ba17eb2541 100644 --- a/drivers/gpu/drm/display/drm_dp_helper.c +++ b/drivers/gpu/drm/display/drm_dp_helper.c @@ -43,17 +43,7 @@ =20 #include "drm_dp_helper_internal.h" =20 -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DRM_CLASSMAP_USE(drm_debug_classes); =20 struct dp_aux_backlight { struct backlight_device *base; --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f182.google.com (mail-il1-f182.google.com [209.85.166.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B3501FE463 for ; Wed, 2 Apr 2025 17:42:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615775; cv=none; b=lV3KUDhDtzl27XyE0GOxWxliPeBQOx8AO7zXunDfQRS//DIlvQeTGI3tpwcm5GKXpvjeLGd1R8G8IggkFwI1uNKRf5oTAnhlzC8hgflpe8iU9UrVHutYGc1a0l1Bt33BxDdWQ3y2UgyrxDo8aAWYjGIfO/bvf3XcTG9rYYreG68= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615775; c=relaxed/simple; bh=Sjq+8vveQ+GMspa86ZhuQnE/poHCKuBjtOobvctgQIg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZlISroMToH1cgFUs31g39RQuwYklsftyb/WMSOSFfcEImc6PLcU5Cooh01Evh0AaiL2kp3JRThvz8WF/AlXdWUi8YLgiN/XgujK5/0LCwFyTEQjg6N5vy3C3CMTQVzpv22H6tbR1nuB0XrrKkll9HxBRuDd12zvk0wOy69oIdb0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ShEKb9gC; arc=none smtp.client-ip=209.85.166.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ShEKb9gC" Received: by mail-il1-f182.google.com with SMTP id e9e14a558f8ab-3d6d162e516so932335ab.1 for ; Wed, 02 Apr 2025 10:42:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615772; x=1744220572; 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=PH1+tp+xqUGCykXZdLvGRvCsZKn18R+wsUvu6RBydR0=; b=ShEKb9gC3fjZRqXG/WcSB2q9Tzx8bN3JqA2JldJQFi7HOQdbXE0/E9a4Tq66OI50CW exBoymINCuNm68hrRT1rHBbXiF42CoUUw84uDUL+99pOzQzMKEKGSjT2E8TPdgiVuEgP WovODYPgYSDqiR9BSIXvzGtaqIoPV0ZpcoMiDj9N6j/0M7dTvhCc21duRb0XdycY8wwP lSGWC56LU5gRn9M4IOrRXUpMEQR7NbC2jQl/QT+lqn4upKMFPdqc/v1404/15m6usKZ9 Jo6K8Fdfflfa8KgitnJbS+HnkIdjDuHLdee8DGTQ3Do1HdKwlLTWMIVqrBAlSCA1vv6+ MOJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615772; x=1744220572; 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=PH1+tp+xqUGCykXZdLvGRvCsZKn18R+wsUvu6RBydR0=; b=hbg0CgxJfTpWJKS25BhYLzt1b8WVXn87EdhlnmmaQBIaEe2QTX0WsodiSjcS3VJNwr QtW/5hMzFZIF34vCGZhb4OqVDUMuPIWHRTIjVxRyJ5iSTRyaR9KhcstWoe2rQC8pXnwq Cy7TEd/LAvPITI4Rsa0fG3qwQrvQ/r12v0y/fpPK5reUXzJw+tW7Ze67gDdi7yXy5BeH 9xyJnPfatefqtux1oJXhQt7uKN6hE/BKJBmBQzyGfaHzx3UX6aAFubw6Vjozz9EOyG0i sYDNR7JSrRXCAnVZjYyHAPiKwfkHmCx1A95x5492E78GJRV7mSH0GSDYm2V4FSjLXYb5 nFTQ== X-Forwarded-Encrypted: i=1; AJvYcCXH8GFeeudIKIOaQWv8ClcVlGT3Gjgy/ZwxFBsVIKqez++jDvvTs6cWnExo9719EJ997ji8fSlO3cZHtx8=@vger.kernel.org X-Gm-Message-State: AOJu0Yyqb/29Q53WLrgG1s+wdnzAge1mIP6foDm4XAvkrylj38INNdDc RoqKSAVCnBjn3cugULSSOsT6fLXVMFVMpsJXr2/66gFxOUbffyCf X-Gm-Gg: ASbGncuHfpTJU0EAGoJo/IMxKxA7VNYWh425tVEyudA1eXl5uaQYL2YY5drTkRpw957 JpXy11ccHyGrb6j9SSqYwuLFgRhGJo5YAoXBepiYryWP6UGW+pvwLc5RfxcOL27SUmUhyaAI4lF +FEWxxVLli0aVgy6KsgKMaJCJuyxozUSBhPPlOEHsJGbVKdWLqs71a4EJf9EuZQRcsKehHr7gjf LOk7QVvLLFyWwrbIPIkOKyy8R/X9diyHwY5djbCwE3K8BBBr2tT/LzeFQ74cnHEv5Cz99LFNrJG npihd64JB8ZJ6Z2pZ8E5uHqrMPF+9zy/O6bE97SYt7gJpwPo2yDQQf1qrdzhWAsN2lqpU2xYfIv nEA== X-Google-Smtp-Source: AGHT+IFF0Xv42t006bgupPe2j5bd7+HXA5fzPJlKXda74vmLnmw3u7Z/scx8WHUoSwUy3lRWMoi1WQ== X-Received: by 2002:a05:6e02:1a24:b0:3d5:eb14:9c85 with SMTP id e9e14a558f8ab-3d6d54a1f71mr36768785ab.6.1743615771683; Wed, 02 Apr 2025 10:42:51 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:51 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 38/54] drm-dyndbg: DRM_CLASSMAP_USE in nouveau Date: Wed, 2 Apr 2025 11:41:40 -0600 Message-ID: <20250402174156.1246171-39-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Following the dyndbg-api-fix, replace DECLARE_DYNDBG_CLASSMAP with DRM_CLASSMAP_USE. This refs the defined & exported classmap, rather than re-declaring it redundantly, and error-prone-ly. This resolves the appearance of "class:_UNKNOWN_" in the control file for the driver's drm_dbg()s. Fixes: f158936b60a7 ("drm: POC drm on dyndbg - use in core, 2 helpers, 3 dr= ivers.") Signed-off-by: Jim Cromie --- drivers/gpu/drm/nouveau/nouveau_drm.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouvea= u/nouveau_drm.c index 5664c4c71faf..bdecd27efabf 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -74,17 +74,7 @@ #include "nouveau_uvmm.h" #include "nouveau_sched.h" =20 -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +DRM_CLASSMAP_USE(drm_debug_classes); =20 MODULE_PARM_DESC(config, "option string to pass to driver core"); static char *nouveau_config; --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f175.google.com (mail-il1-f175.google.com [209.85.166.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58B001FE462 for ; Wed, 2 Apr 2025 17:42:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615774; cv=none; b=jTXEn6GhAbIrL3Zp4BVrDEU72viV5ZN8Ho5fO5h/6mTJS3bwtD//R09CPsAYWbnq1py2Hg80k4qSwv6e+bRt9P4Hce0tI9VNjBEjHxkRiS3QrHjT/jd6vEa+VGAZdhavxj7DE9GjFRm8mLhyc6/MlV2vy563Yd1B3u2RaWooijg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615774; c=relaxed/simple; bh=CCbGtZN0MSaNezxNIEzBeKb+PPD7j4O1rDbBtijIoDI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I+XCw4nexTfCFEco7cUDOkJMrC06oPzOO3irEtmuWEgg3p+tmXhhGOc3szRReALluBpVcuApmca4I+3oPeiZwsa2gbel7rjQD6jejUa68+f1O6/tR9sWieqjBsJJu39rGDgnelI1xpV8bMj5G3uXHkd59eo37fh0g5sJsBxyAXo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TGS8HUwV; arc=none smtp.client-ip=209.85.166.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TGS8HUwV" Received: by mail-il1-f175.google.com with SMTP id e9e14a558f8ab-3d6d6d82633so491455ab.0 for ; Wed, 02 Apr 2025 10:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615772; x=1744220572; 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=FATfNmmYepyBuSsmf/EtXKQeipPGgu5dSGlE3AdOnp0=; b=TGS8HUwVqqL62Zrr85z42iN0u+AiSHWQcFwyXbMGDj6EAyM4tCTOIsC4COmOFn7gox 7R4rGUx0+exOCwr98h5Sw2Rq5vw3jAjPXUcToocaIPoIRXLWBq7zuFdkB8sit5ptEwos Ow7mim2Qsqn9brfiCUkzhq4xfSjjbPKTMAyrkJ+guiwHcgzlYH352yizWJIW5sGHqaDX VGeY7K0Vnmtrnjse+CnetpQVGUS147YlJeBceI4G5OZ1wBVG82R6lOZ4d2SVQWBaN40w wgmtSnXh8wWcgKx+059Im8qiFCstEWiewecSdFo5tjXRjbOzU+H+8Kk42OkmQvwW7JAf LS4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615772; x=1744220572; 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=FATfNmmYepyBuSsmf/EtXKQeipPGgu5dSGlE3AdOnp0=; b=kiq9v0avLl36X/1ogTRPbpA0cxNk+HjhVOYJg7Q8eFobAm+1XtiyLvLDVALa8vDU12 eLh7xm73BicpnjSihKVWzFcOSANX3CawLbaHbBkEN+ZUVwi9suwy8erwfiW1wY57OisZ na9oWCUDw1w4wEc8oLNk/aPgXophVO/oWzgyeM1oC6TOZDGDbXfVxKz+gRoiGjsK+XwW L+KxbX/1cJd3vkq9sTsrrYz29YSrmNzo1gUL3FoxptZ6XtGpm+PLMEjS6pX8cKYiLnu1 sZLIFR+Gt/Ky0QpsaVUyUNOCNKmrBgNNlfqGQo2wZHJCeGtv7nEYINuAbvTcU8uhDdCH +Whw== X-Forwarded-Encrypted: i=1; AJvYcCWTF4MXyzRmlsiLpRYHJpn0eedUxM8/+/OFs4noQUAd6wEd3Ro0Fdk+/1aDtVYZu9ZUOSeqZYkpbR1nX3k=@vger.kernel.org X-Gm-Message-State: AOJu0Yz6IZLHjI/5mIbtLhhJ5jpLatMmgJ1T4kepQhO5EioIRR29hwi8 Y0oiG0gmTpEQoq366EUaYM92aM4Xk86bzisyvlofH4okCjDaAEu4 X-Gm-Gg: ASbGncu6x2su4anHcrNfLSOSouNXMuZIx3r+Oa6dCq8kzHXW0ipv19G1RLIzR+vlGXr DPM4lBpi6Jamlp66LFMGCOCMZamKN1m6CDSOW/p0ABoI9LBKuL2eeCsz4vEhqrfK087xZY/VtGK SjYKmOsFVTjlH3wJsSyFutdNqD68vEWylKLCGGNNj9GGHIFgm4nHL1JFukBzw02N6DHtRxhIFl3 I79voKudXiZZJbvzO3tae/6YTQM++xo/y5CQqr/Ew3qbyBM+S3NgDKlez9i4P+OF+1pqWe9oJ8P iUeZEP3einL+/LaVWrSYnHuJSgmJou7WyrwiPKHBby1etw/Q1DKGMEApMprNA6fXoR7prCyffFV GWw== X-Google-Smtp-Source: AGHT+IGe4ZjeecOx7VkTalotPIU8Orb/rdY2ZWXpy2CrhIYZ0sCG25kLdKxcJbOn9Bsi7SG3UWODzQ== X-Received: by 2002:a05:6e02:b4a:b0:3d4:36da:19a9 with SMTP id e9e14a558f8ab-3d6d5535b1amr35121145ab.15.1743615772465; Wed, 02 Apr 2025 10:42:52 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:52 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 39/54] drm-dyndbg: add DRM_CLASSMAP_USE to Xe driver Date: Wed, 2 Apr 2025 11:41:41 -0600 Message-ID: <20250402174156.1246171-40-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Invoke DRM_CLASSMAP_USE from xe_drm_client.c. When built with CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy, this tells dydnbg that Xe has drm.debug callsites. Signed-off-by: Jim Cromie --- drivers/gpu/drm/xe/xe_drm_client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_drm_client.c b/drivers/gpu/drm/xe/xe_drm= _client.c index 2d4874d2b922..756dba5c88f8 100644 --- a/drivers/gpu/drm/xe/xe_drm_client.c +++ b/drivers/gpu/drm/xe/xe_drm_client.c @@ -21,6 +21,8 @@ #include "xe_pm.h" #include "xe_trace.h" =20 +DRM_CLASSMAP_USE(drm_debug_classes); + /** * DOC: DRM Client usage stats * --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f175.google.com (mail-il1-f175.google.com [209.85.166.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F27D1FECA0 for ; Wed, 2 Apr 2025 17:42:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615775; cv=none; b=uIFf6CPlez+zDh3GtLkSiyOgN0S66N7sfnIzP83/8MrOSnaEJ1b19vZ+vij2XBxUrFMXvlCzkU/NAojuT1MJI0GRijMOdCTa6z+TbpAzOQRU8ko8aK8uCKskG6YS+hhXqeigoF5TutP5pzKywEgzQNiCT0CIlGo61zKDiW9hgck= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615775; c=relaxed/simple; bh=rcrUkUCjB1xs0RhGIZDJqSoks92bVgXttXWRlrICL7w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OkuLPu0gmXuA/zVFpFSn5mqDzOZmtNJ2GKEe9c3MegemsUbVwJlykaTMhwrFtDvRQpAgNUQKX5Nu40NgwO+spfRjv2P14tcU/07qrlax8LCEdZeS7iGxQAdoDwLyEbqXr8OlWxJGbq8Bjo4mvMgpCJclTDAWaNoyT1/tak7jxKA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ARt16fSB; arc=none smtp.client-ip=209.85.166.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ARt16fSB" Received: by mail-il1-f175.google.com with SMTP id e9e14a558f8ab-3d5e68418b5so839395ab.2 for ; Wed, 02 Apr 2025 10:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615773; x=1744220573; 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=lmnUjD6NKJR963XR8Ej2QuH8oZFh+mV0bkdDgwQtC1c=; b=ARt16fSBZBzqmG4Ob6rTcYWvRwEmSdqOHHI1how5mBQrcM9oEEPdbjw/7s9ffeu0/w zdqO2e7spY1vGoG/dhI1XyAlwOP/YrvxmfaOhbMoykQOwkmJKbUNPNaDJ9P68undSy/d DVVHsGY7JbS4PODBPw+KYthp8sLZGWlyVXnl5Avf8sLTXdCnGuFQmjyjb1s2W8dcme+b X0e8YFF4aTua10rx/81qa4FP6a4Ozn0vjJtw1I9zia6KjZYdJ7SXskeYcJHTbMLB8mI9 xPvEFdDj08+rcQYqivpqO0FlHWBjmj+GFNJ/jhcO1AjqMfN7g10tjrBKwN9GGdZf9Gyf B8xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615773; x=1744220573; 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=lmnUjD6NKJR963XR8Ej2QuH8oZFh+mV0bkdDgwQtC1c=; b=cmMKU0wxGUfl0l/jzk9YgD5vZr1V6HOMclAOs+gFIcl6HzYpptrpyGkDR01dOYy5vS HnCSw6ZBpT/osOxOZtYvurtg0LtruaapUZKz1+dt6aWYUu2z37XpBmxWIDiQpjQun8Q+ 8HhTrL211zr4Td838ouECA4gG83530axekxx80/MQQwZVJOMLJl69WRPs0zBq9xHlU2/ W/WARMHHGSQcOfWXRN0R9uHwsSgdoVBlnyOGipCXOjoHHvEzUOrMr4O518KECfMermRw PXxwEiBwwPW/ji+8I/zoOC1vnpo+MDBBHf/ngCzau/cN+gNrjmA8D3u1MntgupYv8oYr fN8Q== X-Forwarded-Encrypted: i=1; AJvYcCX3Wl/LoSWfw587LgI4ReJw1i96PQ7RGmznka2TMaIHC38mpm2nGTAHOkrHKPoj7B+KD3IY2kKpxDMpXyM=@vger.kernel.org X-Gm-Message-State: AOJu0YxKwkuFUQPaF/k5rdXBFW2BRf3x26ADhJ6k/bVWxwilK1aLC060 DFrfi0Ncv7To71xVlYDtl+MGCenalyDMVQpd1giiyfVHCh71Zu8a X-Gm-Gg: ASbGncvGWoe2Y/Tizu+p6Xw3wsyBXMPQFCJ31wGCUyUX1u8mEHKXXq5WzaDoJqm2/DX BQG6v9bXmJSbpYczV9k4P/kYurFpLz5xziVRzsKemXnt8zjfcbc+hp5JN7xQ+gL+rr6iGEw+cAx WwHS+dzMBWmW03xQqf/IDaQuryBkL7CKfhcZQE8X6N9ujAUVgeH6eX9xjmKT8nnxBKdSMVOinST qiMePStS6fJXFjWSAUF9tLK0j5phUbDzy7/oeT02UiVeV6OdvrPeLn1W9WvVN1a8v3p+lgca4UM Kz/hljCGIs6kRGazSsCKakD6PDU/GSweJml1O8h8ePdggxbVdfQ5PIplyw6wZ3NAh+dgMzfNMVw LhQ== X-Google-Smtp-Source: AGHT+IEsoNgpLODjysSkI25oKJsaNZz7XSjHcm/Nhcv9gVki2+9S2pVoYAXgC+K6TNfR04N0YUf8TQ== X-Received: by 2002:a05:6e02:3981:b0:3d3:d823:5402 with SMTP id e9e14a558f8ab-3d6d54a1420mr42397655ab.7.1743615773292; Wed, 02 Apr 2025 10:42:53 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:52 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 40/54] drm-dyndbg: add DRM_CLASSMAP_USE to virtio_gpu Date: Wed, 2 Apr 2025 11:41:42 -0600 Message-ID: <20250402174156.1246171-41-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" virtio_gpu has 10 DRM_UT_CORE debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy by telling dyndbg that the module has class'd debugs. Signed-off-by: Jim Cromie --- drivers/gpu/drm/virtio/virtgpu_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/= virtgpu_drv.c index 6a67c6297d58..3bc4e6694fc2 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.c +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c @@ -45,6 +45,8 @@ static const struct drm_driver driver; =20 static int virtio_gpu_modeset =3D -1; =20 +DRM_CLASSMAP_USE(drm_debug_classes); + MODULE_PARM_DESC(modeset, "Disable/Enable modesetting"); module_param_named(modeset, virtio_gpu_modeset, int, 0400); =20 --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50B001FECC6 for ; Wed, 2 Apr 2025 17:42:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615776; cv=none; b=LYakmA9X/ERywSIhzx8SrgHih5hyznz+kzdaG9qONrVdDTBP7yF6C3Q7xr/+LGMMGkCX6zD7Kbg/cQWz3oYkqTdNEWH1fZDUDH3Nrt7AfPpnwffPFj5lLoQvTEgdcUN6SC7xJnrLIz8gM70rkfqluEFuOQ1mOAr2YGa0f3wa50E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615776; c=relaxed/simple; bh=9NtscGLERKvma6MVRefJ14MqvdE12lJjU+jsKPBV/DE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gG7/Hdt6MV+MKqdS0ASSC8HLMWrBWwMkMEt43H6bbR6XzZTYlYyslyBrE+/jeLqtbHOSPhmiXd2Z34Ow4ZeZMR7re8h2fXZ7OrK9gT45ljVk2wOrHBSQfMN2HJPLNDKV+BAyV1577ns20vz9mqdyMOkK+kBYnJS3S7dKn8cA9tc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ccfje/TA; arc=none smtp.client-ip=209.85.166.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ccfje/TA" Received: by mail-il1-f177.google.com with SMTP id e9e14a558f8ab-3d5e43e4725so476935ab.1 for ; Wed, 02 Apr 2025 10:42:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615774; x=1744220574; 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=/3ieg6OYf20TvXEjKUEioS2vPpvBZB2Yv38SKV0x07E=; b=Ccfje/TAscJ+rkVO9dLkXzXLWegm21kxoz1GcUvCFhDs1XV1e8us/wvRaJE91Tbu4z 1STvfYrYp1KresmZHjxTUJTYy/G/gIGYXaeln5wf1nNw+xU3ZkwCRt4K9Q5XSjJS3wmH DO3Y/arZ6xFJeqyY02cmGLum5yw1p5m1sDHmYERYkUtpAPo9nu9cEeZLUF7ygZJu0/PJ thCdEj6CFN7VI384zwbEt3HWWb0TDkAjpCkyIL6woFGkgSI43KnwGp7pLp+gOAFirD+N SBjA9MK6K6krjvXZrplJrcZL36OYuYrXJAUqbvnD6eDYr6l30Qo2ItZXRCQ+a9meEKg5 vV4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615774; x=1744220574; 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=/3ieg6OYf20TvXEjKUEioS2vPpvBZB2Yv38SKV0x07E=; b=iRCHsfBXjgZybrZlOiXJp9vhqebtbMgzGCuDs5xKI3Iu5PHtk8GprCNMj8NdTe/T+4 n4lAtDh1gtGks5jIA0RyvaLTAwL0wEBCJFM/Ul8B8mu+tQyayDJZoWBp13Kg+EEbxRfX 5R0yKioNBm1bPfW4fwav44+s9hglsibdGaQ9rvAlpLYuzghHK0fo5n60jvRpzkNRVzeo +dAMgeT7ApciKg+E9idEVBe/i1DKneQdPqpqY+kbzdivizxVnM/iv4lOXnP2GqRhFtdR 0vYkPCA6V9OMJNb2jYMInF/6try866b8XsVitsWHI1WLWJVRnMQzYtlUcM866L8vCxcv FFeg== X-Forwarded-Encrypted: i=1; AJvYcCV62oxC9ENp167auHxwmRXJQIBmh4NEm1tcZxa2dVTrE7f6B76ua+mIv6zfvqA/UWhLB6gXeO477wHWq3U=@vger.kernel.org X-Gm-Message-State: AOJu0Yy6zJgShWLPJfp5reE8dyb84kCJvflXMMFVc18a6bn149l8Q0+c gZJ9UnshH9tn8gWU08GfMsA0QbUEuqcf6xTJPRAA8DWD6G7nuPk5 X-Gm-Gg: ASbGncvBcMe384rGh2+1Ic2eXEUQqD+cMnl2Oy2NUSkYis+8PVxN81LRMpsa9Alaedk IAxVN7G1xCkqoLvOb6fc0V7KWiwDd+zUQh+PDlwHHpTzhF8rEHf0FA5s5Ad97u/dtmNbJFh6W9g STJN696yUqP9zb0dcTt7UBh/2GZ3d/FaYlvIzc2CqAmU2JHrkc92QEu3nQDFadwzC++ctichngp KCAy3dzpsgxljwMhZJD0c6eX/Cqw2z9OetBj+k2iR2KhsGXQ2czuuxyx5vBR/Dnn2EqTzE1sp+3 k5heSjvPzVsZBdWYacyMyaNL++Nb/4gPG6fBtxIl61s8zvj8f/WNZaIBqPrbJ5LpP4DbDw1EKkE lmw== X-Google-Smtp-Source: AGHT+IHe/pqeVfJKwU/w9Mu6w5oW6sxJF8LlG8OrV986EBMutyzx2qa4fxPX6enM0iFttCFAiE+Ekg== X-Received: by 2002:a05:6e02:1a8f:b0:3d3:ff5c:287 with SMTP id e9e14a558f8ab-3d6d5535a0amr31645515ab.14.1743615774357; Wed, 02 Apr 2025 10:42:54 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:53 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 41/54] drm-dyndbg: add DRM_CLASSMAP_USE to simpledrm Date: Wed, 2 Apr 2025 11:41:43 -0600 Message-ID: <20250402174156.1246171-42-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" tiny/simpledrm has 3 DRM_UT_DRIVER debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy by telling dyndbg that the module has class'd debugs. Signed-off-by: Jim Cromie --- drivers/gpu/drm/tiny/simpledrm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simple= drm.c index 5d9ab8adf800..bcf2cccac0ec 100644 --- a/drivers/gpu/drm/tiny/simpledrm.c +++ b/drivers/gpu/drm/tiny/simpledrm.c @@ -34,6 +34,8 @@ #define DRIVER_MAJOR 1 #define DRIVER_MINOR 0 =20 +DRM_CLASSMAP_USE(drm_debug_classes); + /* * Helpers for simplefb */ --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2EDC51FF1B0 for ; Wed, 2 Apr 2025 17:42:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615777; cv=none; b=u2gy9tU6AZs1sNeBVMZbsf80Pxfox/Gg3gMMt91pg8MAMzCIRoNYKId1fpxyj7dzVVA1qlZ6FSlBxLT+41gfC4pPyzr0lLGg4VQTGdX+w08FJnpYNMgSKFLl71/dz5Apqi4wcUC+snFuXD7lNPefgX9ikQkujbTvbBcN4W2Hww0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615777; c=relaxed/simple; bh=KCHO3lLH7dI4RY8+BKa/OQC7CPvk4Z4wABHEVsW8A4k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QNMomY9M/EFhORwE+JX65TzituFnRQBePSQLKYJONowoE0mwrjiYh7ulfQdD8ZhOcV6BMBtybZcDx+eBHBcqWv5dMlNNfTumeNREiW1Btg7/RfTMNyPAMSDNvhF/VyEJKbbRJkcTBMIleBdxkz4FXd3lDgbLYvb3VqG73ELZMf8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gyPJo6pI; arc=none smtp.client-ip=209.85.166.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gyPJo6pI" Received: by mail-io1-f54.google.com with SMTP id ca18e2360f4ac-85b515e4521so908139f.1 for ; Wed, 02 Apr 2025 10:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615775; x=1744220575; 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=Ck+/k2kUl1gxvAy57O83XENj4jmXSLh8yxG6/aZ/GV4=; b=gyPJo6pIIDoiogYhQiGc0ImL3tcvtBayqtMuHLqZCdcFcjcTAOFoJOaq1fPTy1ySZZ aWc/cj6Gn7p3EDvGNz8MeSsse1+KCwkjNZr8BP5of8cNvduphbwrbL7iTDU/0m8deqe0 UtD4h+7fLcrWAARF9JWWZS8NBmeutZWEtf0ZK7oyF+oxUAhAh6QRVQNU9oa9CBREOjg7 yoDmRdwCVU77rfmx3UkkGtNKMF5MX3XUKmGNgl5tOH60UhCZ2QqM6qLxxzyb/PoixEYL CvordBiKHfCI//V+GuTyCDyIEpo/IQ+dfs8nybMX/XHgLg8oJw3eYdhoCleBbs8tV9US ArrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615775; x=1744220575; 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=Ck+/k2kUl1gxvAy57O83XENj4jmXSLh8yxG6/aZ/GV4=; b=TJ9nRLDirUac/T/f/PWvzbKEhJsA00E6KUYdsERkKcQ9fJwygnJ3rvhiRZfwVHddv/ vhkg6DneAlCUjYFXtGXdPTFq5wxq/VMKpjY43fpLPGhkeRtjZHfSxv4Cf/FGiwenjRpg 4pg7xS7WV+2vmqGNqw9wuz6WC+kyKlkpN+CTyS01I5cmQV2LmsgIajbvhsff7BXQdJjx jKSOWle8wHlaPp2vN2WfG5JbLDzhQXDtoi5N5yuNva2K2vXrGBXd6YTwQ18dBHftFm8O Jz/ZqxwUo5CMWsmZd3OUDF5j7bL8xZW8shRcb61QWJ3Ab+Lf/ZKK2kaYEOalcC6NyrI3 e8Ew== X-Forwarded-Encrypted: i=1; AJvYcCWBbSQXdKjBeS1xEswjgnHzE/qDbfO2oNXIpBMN8yo1A86jlDdkiaXa4hiaWE+tdHUgzxrs1wRHfiCDip4=@vger.kernel.org X-Gm-Message-State: AOJu0Yzxe+fTM24jUCkuqz+PQ2igA+FzlOgJmtG3YF7Grv/cqF61nn+2 dU4OHMNvJZqBkdWwK+JwC2E80GUHAif21ltE+bgcybpBF8+IQ7iC X-Gm-Gg: ASbGncuzX+BzvNdjdgyLVKF4z+pD/fvnooOkHrjP4q2sUHkIcSP5YNGD+EdYU7CckMM gV84j2Ecx3UuNYwqg013ZwQj2uIb09J4p2qusasBELDs22Njyx+Uk75FhuC5PNI356eV6ZG1Itu gk+P/V6vQLqJKPW8JaFYAd0vcM0HA9PGCfS09xIyD26kbfDDv55qc/hpF32beh4P9kCRL4wR994 8R+NhmHV0U/Jw7FE53sZiCt8Utb8b4w7BZM3BaCbHZ637VpfDsjilGpLkwvSmZm3wvmKUhOYV+v iqW7OGbYYHhL8W4Iz2jgjDUe13PRtuI2tbDJDQYpX1QikHlpZ9bjo8vZUSOaRYSgXqgHWlTuoYM akA== X-Google-Smtp-Source: AGHT+IHOrTfoglNfhTLG8b2lwZ1DeIxr9/rPRHu/zfzN/2T0Ub79/SVMCDvXhpVtgwBAHBV2XSusPA== X-Received: by 2002:a05:6e02:1a67:b0:3d0:21aa:a752 with SMTP id e9e14a558f8ab-3d5e08eaf0emr82506525ab.2.1743615775316; Wed, 02 Apr 2025 10:42:55 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:54 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 42/54] drm-dyndbg: add DRM_CLASSMAP_USE to bochs Date: Wed, 2 Apr 2025 11:41:44 -0600 Message-ID: <20250402174156.1246171-43-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" tiny/bochs has 5 DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy by telling dyndbg that the module has class'd debugs. Signed-off-by: Jim Cromie --- drivers/gpu/drm/tiny/bochs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c index 8706763af8fb..dbcc8ba70dfa 100644 --- a/drivers/gpu/drm/tiny/bochs.c +++ b/drivers/gpu/drm/tiny/bochs.c @@ -59,6 +59,8 @@ static int bochs_modeset =3D -1; static int defx =3D 1024; static int defy =3D 768; =20 +DRM_CLASSMAP_USE(drm_debug_classes); + module_param_named(modeset, bochs_modeset, int, 0444); MODULE_PARM_DESC(modeset, "enable/disable kernel modesetting"); =20 --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f180.google.com (mail-il1-f180.google.com [209.85.166.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 067E91FF7A5 for ; Wed, 2 Apr 2025 17:42:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615779; cv=none; b=kqFjB+JJsFFGVva3NAgPq2146OEBTrSDQuLzDdAYGQoP+VWNvfROF/uU8xcm8XsuR3msAFwtZ5aVcTL/zstbc4WypkTsOKAQ3AjflTUTel0/as8UQJEP/o5ZcxqE49gQD5X2qn9Q/oCNQmN5dS4AR02LtKPb4HLKpL9gtH4Zqng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615779; c=relaxed/simple; bh=8uJoalDz4gUJ4A+Uu9pLqeleSfN8jtRQc+WX9rk4RaY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VoOGgQztrxS9440snArzvuueUPvSiQacBoLKVT8+ZjKhesrHosYRv/CMv4XmSNpC9ygg0xshVR9bhINnXP49QRu+Vt4n7lKboIcwL+Bnzpfiowp2ekJXvYYImXmiXxua24XDUyUR6AZzjG2IMTGrl6rl6u6NhMejR515zkHpUs0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=apPb7lAT; arc=none smtp.client-ip=209.85.166.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="apPb7lAT" Received: by mail-il1-f180.google.com with SMTP id e9e14a558f8ab-3ce87d31480so493805ab.2 for ; Wed, 02 Apr 2025 10:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615776; x=1744220576; 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=mR3GZQ988EXrhdMWSVSfrBHjk8VugzTeXVmkAtrRrJY=; b=apPb7lATbPmPJLS/ETVL25SZN4v+ahzKEOBsLxQ4TWyHyt+Da9f7CoMW6zuYMPTihq //fE6MAfs72Lq7keRed6M9xziX1WxCTkdUmnEGPFOHdTJTXm57r2DYyskkLZD/xSuz2/ JoxNiDSS0oJp8gJyPufmhNwvwu9ogmNOMKyVlWNU/yQqxxMqbqINEOmmwCUJkNO8tGlE jK82LQ20JS2Ifi1kQKuzLIGZOVP1Um3gccbD8jE/WIyxhc11v/Kd6a6KiZbPnDDLChmZ 3rMYZXAGacwYfCfNp3LTotenCyjNsVd13UptV+PmqqEPxtD5D+PwCezvEmF+OgYzj7wC 0TeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615776; x=1744220576; 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=mR3GZQ988EXrhdMWSVSfrBHjk8VugzTeXVmkAtrRrJY=; b=xQv3BvnpYWbEuIbynPlqVeLuOisuJCatZ6Iia8O86JVefQkhZPyq9b1Z7jJ6ICHSud X+sDcMnhCLteICHp9hG64KfL/FkMrmwy0/0rXx5meei03PBSYQG8XtCVa/GnJ0nPQXxJ bbSvzO9prOl7pfsZH9UNo1ChXzFqEQtz6WdSCxUIGdr9rLHy5JFkIVsc8sfziKM/VRvp Qs7XhufSlkQhKqHvMGfNwpqLU9NzwNyDfW7MccyR7DztQ4wAs7zUpJuh7oeKanHzpK7X uw4vRpXpeQDyBx15iIy1dka6EexQn6q/GKkv9FJ+NHUwpR0YvVAGwObSvuPyZsWtR2BE ocRA== X-Forwarded-Encrypted: i=1; AJvYcCXCmybx9qpkKBTU5LxxLW0R8JlXnL7dz9bwLDwBq3MvlXceHSa8S5BBMj33xEBdt5jKDNaRiYRXtXj9k/4=@vger.kernel.org X-Gm-Message-State: AOJu0YzTT9pfLsF3JzyjmwpfdRQ3I1q/InMneUoUJVAFwP2KzyrvDmk6 i05dpuFQvFeGUfODbSrQwoKjGE0oHYQKXPWaubEecb30bcXevRN3 X-Gm-Gg: ASbGncvcXfkzmF5doDbOcLqzU1xahdtksT+qm7zyMcAyiqirXF0aVOXO5KtY7sCPr/N gYZfxBHMOUtBpVM2GlFkNK48mbwv3jxVc31thbPMr6RFLNPm6LMVgqkAGcsajTZswsrqn9DwUMF oWIhVVGD2wM3cfkH50oaeBuGcz94gkN4BQ183VqK6fNRVrAYiftTcb/BzEBqxU1hrEdzvyyU/UI jSYewqKbUPL9l+k2rPqPltHnEao4JHr9bXW9NkIABs4BCJJJ/h5pXNWyvbq7+RaOsl0Af3VyWl+ jV4Ngy7aKx0LS2cKfG3nrQHF5dRdbAtRn0DZ/U24tcSmMF8a5SAje8f+J3oKrFn+TqZJI0iP4PK XgA== X-Google-Smtp-Source: AGHT+IGz0mzs+hYYK7NGp1ygOapy1Xtg2pb7btBR9FttZE3xaY/IeRPzMzWa7VzATtwuhacGo5/EtA== X-Received: by 2002:a05:6e02:c:b0:3d1:a34b:4d01 with SMTP id e9e14a558f8ab-3d5e09090famr201390495ab.8.1743615776107; Wed, 02 Apr 2025 10:42:56 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:55 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 43/54] drm-dyndbg: add DRM_CLASSMAP_USE to etnaviv Date: Wed, 2 Apr 2025 11:41:45 -0600 Message-ID: <20250402174156.1246171-44-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" etnaviv has 5 DRM_UT_CORE debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy by telling dyndbg that the module has class'd debugs as well as plain-old pr_debug()s Signed-off-by: Jim Cromie --- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnavi= v/etnaviv_drv.c index 3e91747ed339..70759b7d338f 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c @@ -25,6 +25,8 @@ #include "etnaviv_mmu.h" #include "etnaviv_perfmon.h" =20 +DRM_CLASSMAP_USE(drm_debug_classes); + /* * DRM operations: */ --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f173.google.com (mail-il1-f173.google.com [209.85.166.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 380ED1FE462 for ; Wed, 2 Apr 2025 17:42:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615779; cv=none; b=SSJZR/lGj8H0EkTxLljerFe28fzP1MbMsdHtoxxVaXxXvONKBJAOLNO1Sz7mQGOrjEwmjXDvv971RM/B5DumFL0FDcKtekyz9jmAfIYdTK5I8z/Pt2U3Qf9JEGmyefvYlL1rMQ2hMbvK1D3PIA+ZP6buyxZVEswv4LNalTrkA+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615779; c=relaxed/simple; bh=pnykpLg2nT1btqisiOtnE7+yyT4IxmtHkmEzKH03RVs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZqPOdvkLgVnCZ49jl6VUrtEeE7jQeQ5xwYD1R6uelhokgSmYf30d/1k3R1XTeu7LQa44y45rY+McwSjiIlTXeebk3hb94SSO2dy2T/YCCDUeuyK7zkR2DoYQ3IxCBWm7dWrHOqmNYhWLs6ZFV62uzsgwl7H1iRXvqj4xsmHyPrY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GjEA/rsB; arc=none smtp.client-ip=209.85.166.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GjEA/rsB" Received: by mail-il1-f173.google.com with SMTP id e9e14a558f8ab-3d442a77a03so429835ab.1 for ; Wed, 02 Apr 2025 10:42:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615777; x=1744220577; 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=XVuxeJKKK9Rs+v9Dxb1+k9xlxA6UW5kge7MRPvzoPYI=; b=GjEA/rsB9Zdd6W40n6htA2oc/AJi6eCnxhu0HLnhxh3pSxvhOATc7z7+brWifGAH8k MsMD5vsDICPMlpUw8zaCmVVPGuueRcoaodo9T9L07ErNMjwav6thk0Y4yolXMKWN+tq5 j/wgVHoGw77rE+F59R+O2+ol68qp+rUHhUojlW5phoSlvEV7M+WKamQ5COUJmSxgFFP9 8Gqj3Wcw3N8JXLQGeXmGWy39naRYd0dHJ6XDihMUKvyHAp35BICY3Sv5JqcbQ4K8hLPk HviCoL0zBpmpJyfKRL7iBfcozqJ44k8hQY8nyILpoOfDVi2WYI2kl8lFsPjMEP6LWIWh UrFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615777; x=1744220577; 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=XVuxeJKKK9Rs+v9Dxb1+k9xlxA6UW5kge7MRPvzoPYI=; b=e2E1ZDcO/4oPuzKqPHPCTaQADfCj50N8+ZPW7lbJauqMmdPE7B0uscyQSkQizrsur9 MHnk+t+eeFR5tg9bkFgFZLAitxuGYUcACtnDfWDkgizjN5Zj08Ldf6cCxMZ1XmBxG5f3 wglAbbjODKOmd/k9clpbTv1v4pCUnb3JAy34OkkNNBOfE7daIJc/gVArdXUKpBHkjEox CIcA32JYmCAhhCjNgMuVyn+ih6jFmni0hd5vyBWljjekwbXtF51LbKIMbAIpeusUD38/ +3hutJAU4kmp0NJZQE+wq+bMY+WRXr6RkjEE1+20iSNqjKAXWasK7Y0oeMkZMCB0u6Ex z/Jg== X-Forwarded-Encrypted: i=1; AJvYcCXO2k7gmt1zOXqG6k0742ejZowDHUpJznquGHFaN/aMMK6YJJyS/z9sFEJ4Cax4iosQLQBrRjsDTfNDTvI=@vger.kernel.org X-Gm-Message-State: AOJu0YzuFZoQ5zkTjfpdt8obqBiPvXdfPrCSRkily4ZiVRcUcgPueV/3 foQK9N/DIn08AP0JC6uz/CuhSlsmPz42+kztNh3pPymM7MYIXiVG X-Gm-Gg: ASbGncsOatHIa1V8DvmXdm2gOvG01GuHoSbSY3A/xkZe0BWaJubEI9mb+W3T4M+ErZC ptby8QbmzQVclKeLrFAgYVTjkrrBWn+vTCWLhN4uRbeEWwRHBi9+62RQ28iZisPglX62k8M79FV 9xDNcx0Fvzq8lXrZxgtt1cNyXzFnmDxGbqTIKR+0r4PLgKGFU+mQaOvULblWnEPyH4dRJSwcE/s A/ePe71j3xzDJwl4UVxPYtpuKL63JftHHNlgFQUMi+2P+5f94sv7UgMrYEFAbGUfdlnErujHF0w 8AAiXHlP9SJ4Y0FVlELuwnDyS8dJTJMVECknjiNspw95+R8nboKlK9w9IuCbA4kaFw/jzkDPyNS 4Jw== X-Google-Smtp-Source: AGHT+IHC7Ea8gqOI7SUhdkIs0stRkMgjiR8iRe4Z1Hury5vPgr/hHoKAmFAKEUAuImZWm4ZQOlbLag== X-Received: by 2002:a05:6e02:2504:b0:3d4:6f37:3724 with SMTP id e9e14a558f8ab-3d5e09e467emr214829515ab.18.1743615777081; Wed, 02 Apr 2025 10:42:57 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:56 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 44/54] drm-dyndbg: add DRM_CLASSMAP_USE to gma500 driver Date: Wed, 2 Apr 2025 11:41:46 -0600 Message-ID: <20250402174156.1246171-45-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The gma500 has 126 DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy by telling dyndbg that the module has class'd debugs. Signed-off-by: Jim Cromie --- drivers/gpu/drm/gma500/psb_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_= drv.c index 85d3557c2eb9..dc72388ed08d 100644 --- a/drivers/gpu/drm/gma500/psb_drv.c +++ b/drivers/gpu/drm/gma500/psb_drv.c @@ -40,6 +40,8 @@ static const struct drm_driver driver; static int psb_pci_probe(struct pci_dev *pdev, const struct pci_device_id = *ent); =20 +DRM_CLASSMAP_USE(drm_debug_classes); + /* * The table below contains a mapping of the PCI vendor ID and the PCI Dev= ice ID * to the different groups of PowerVR 5-series chip designs --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f169.google.com (mail-il1-f169.google.com [209.85.166.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E5AC1DF975 for ; Wed, 2 Apr 2025 17:42:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615780; cv=none; b=iQ2hZM4oIoG09bgbDB2oDSiFOUTQ9eUyyb/Y79gfvHK4jW0i1AvL9jwm/8JmlfEuqbrqphQ2YrRAiQ8BeojaOUDWSbWvRsR7mI2BatnETrM9ZC+4QERW+8ODFtJGfrdhpIosXrNPfu7DHIkDhTsTKzXCpy4qmIzryBO8HgreCGA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615780; c=relaxed/simple; bh=SMOgUl5f5Hv4lntfLvuEDqMGTbyJ1k0zKXfBEdqoVtE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ogo9mrBaCID5tD7f4ibljdN1nGGVLOEscHXyDXSUamIMEp1roTaAFqrOSyfIrKzIm4eFfihxXh9wx5onaHel8dMXdalJKcRFG3Dh3RLlHJymZP5Venc0dw2GIWWrPP9MYOqTf4YoLH5Z9OUMcZFInFjp3rohYKzd6AcGWT6HDyY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Bc9VsBzz; arc=none smtp.client-ip=209.85.166.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Bc9VsBzz" Received: by mail-il1-f169.google.com with SMTP id e9e14a558f8ab-3d59c8f0979so3700215ab.0 for ; Wed, 02 Apr 2025 10:42:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615778; x=1744220578; 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=Tgy450ZES2ez3J/XkWzr8/KGFStO5bXfg+gAZCZdzzk=; b=Bc9VsBzz7lVoHldAp+lA1LEr2EPH4zDcFIOqzMb8ZzPJxrItzB4XlKjDpgxaRjQkEF Z7/a61Y5+lhLSWWt3uFEuU1o4QVST4HaLlyRAEvLhpzipNPEaWnVnHSZwpycxgZEKwGx aiTYMFYrgnUjGTX0F7rBtIcV1B1xT0oKv65mhvo9bIKxktYFV5bZFL6TCpIEbWvjemVq 4iIEcK8g5+zyp1ChJht27v3Pd8HV8DwPVPbe+E0SenNhi3An6VGizGsdpZN+imIHa2AN MxeaWybAA+NchMKjxJ+GlL/xWUuy6iqYtAYJng90goLCXITYJTmG3AhIDCFPVIfwOV9c 3Edw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615778; x=1744220578; 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=Tgy450ZES2ez3J/XkWzr8/KGFStO5bXfg+gAZCZdzzk=; b=BTc8MQv5ntv/q/YCQ9L4Pqb/UtA1duNap2iJfVZ1SlxXjabcclt0NkEwGxsV7rX90H bFZ3G8ux/Pd0l4Ub0/0K+ZzN1uYBeEjRXQtV+dohOuDgtxAsFkjRUZofT0rl61Y4K/T6 TogwvaiVjPrlCO8IzHEWVBJ4IJpBfnW+xZZIE+h+VpftYysToohW/uNbNfMjgX7GN204 4+y8dE5bdyjCGYB5D0PQFzfqGvuPZryhmy8loj3VaKwQM8Pfuj5khfs8OLs14nptt+SA AKma7PNb13VZyHa10LlrjvlW8FUtNJvBQRIBxBqsuZIBQXAhnZjNKoUQD5rAeI3J0y9i PQKQ== X-Forwarded-Encrypted: i=1; AJvYcCWsaM84j//UEBJpTcpaTjkc4plKQ42G21Djv9L4DSJmF67NyBxeHnXlzqkTwhOMjx1iqYVPAv98VJV+/b4=@vger.kernel.org X-Gm-Message-State: AOJu0YwkJdflUwXgKwMvuVox3/j0SXk6V/Ula2P3sX/XjNjJXqCo1UoZ //ojytbN4JX1zOjWkZbAIhd4Gi/0cgsoH0QbYVHzDWfIVeQdSTFb X-Gm-Gg: ASbGncuo/PMUSHnAaIcEXTt8BrOd9dz5TqJSHIJ2WnMCnIqiOL+S+/D4i3mfViGWnuk 2CRXgHceEAbgI3J5TorohmvVJ9+48BvgFJwlGZ1JzDQalfplGH/Xfp7l5/SiNWTYirMYHKGaOd0 3+82tJcuStU9a7EQB35+iuHNf8vF2UFe0NIkHn0Z/5BmgvnAxxE7r6d95FeWKxalpduUrN3CsgS yYphXnMUrKub73A64JSOM8v5GDiNL+e1g3nztR8p1hvLCSY2D6M2i8ZuRvXhDrZEzb7Cdji45ZK MI3a6oA15ujtO/dFUyO2vLa1BCo+F9+HOPeOAHXdCUzGNXBUkLgvZD2rCaHGdZioPtPA1yytckU Zcw== X-Google-Smtp-Source: AGHT+IGOn5uIZhYGkruQeCbC1f+WjkFMEGOf33zX/XAEqkxeDsXMZ4VsYrJ+aFa+RIq7clpGvTTA5w== X-Received: by 2002:a05:6e02:1d9d:b0:3d4:2acc:81fa with SMTP id e9e14a558f8ab-3d6dcb49685mr7363055ab.2.1743615778123; Wed, 02 Apr 2025 10:42:58 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:57 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 45/54] drm-dyndbg: add DRM_CLASSMAP_USE to radeon Date: Wed, 2 Apr 2025 11:41:47 -0600 Message-ID: <20250402174156.1246171-46-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" radeon has some DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy by telling dyndbg about its use of the class'd debugs. Signed-off-by: Jim Cromie --- drivers/gpu/drm/radeon/radeon_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/r= adeon_drv.c index 267f082bc430..6eaac728e966 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -253,6 +253,8 @@ static const struct pci_device_id pciidlist[] =3D { }; MODULE_DEVICE_TABLE(pci, pciidlist); =20 +DRM_CLASSMAP_USE(drm_debug_classes); + static const struct drm_driver kms_driver; =20 static int radeon_pci_probe(struct pci_dev *pdev, --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEB28200BBB for ; Wed, 2 Apr 2025 17:42:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615782; cv=none; b=jktHOS+JHrCAcDHYkOhc2F6lQyvpzJdfcKT4gfIpagiN3GifRfHMkM0Egswbpy0Fdli8NVEBykvI8BCyKhPbpxIYqbb7wzBWEVwTUVxv/Vw2XEjGmbB5IXLXTBNPb0JlvzW+Da+jEkcgskYoRvB3DNiBQmX+Qy6TZE/LGU5n6tc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615782; c=relaxed/simple; bh=106XxGOuAhdnmay00WQENaLHjezUM4Q8dwXi2xfOFYw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ppwapBkG1Zz2o2pnwNd/+ri3hA1CbHkV7xeLQUUVV/0bZNuvo6uppgAWJhIxYyP1IVutVWrBnECawBnie4jxSY2QLs5fYP2RjEbZBwJbY7OtLgjjx7d1lEIDoRQMyEw7s5C37SC4yf4/8Kb5U8JkOQjXHBtfC9mKpX3Z5NaVm3g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MB4fh197; arc=none smtp.client-ip=209.85.166.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MB4fh197" Received: by mail-il1-f181.google.com with SMTP id e9e14a558f8ab-3d589ed2b47so471285ab.2 for ; Wed, 02 Apr 2025 10:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615779; x=1744220579; 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=JTbNTI64Sdb94F5FeGTeZQmx91wNwlAKHYCBLiEXOdM=; b=MB4fh197wASE/KUCsVYm98dHz0MNwfCam9pT4+TIHF50KQq8+qujHgDFGPQZMfueC/ GyHKXUcSrS5heAe2T5qFi0BxaUWVfHkrI7NSd06lgYgdsUX0kvhyKgbu+r4noCODB6W5 UjrnL1yr0YiQueKxPTfMQvSzndWCDpBw3TCUMCbPhcziSI+9Ba315wir0cr/0njlDoPN X6KlNeyNDvWNR5nwTS7Vwwk5nJG77cSuIErU9TD106T8kqc+ZEduccbBWAjdTCuURCuz z+uRcKmJZbdLhUdw8G1w9NKQ/mnJF9SIfEVFesLPTh+VO5UvBKToDQVVJ2UBHkxyR+MC jP3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615779; x=1744220579; 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=JTbNTI64Sdb94F5FeGTeZQmx91wNwlAKHYCBLiEXOdM=; b=om4t0udgpxyrbZbCSvGLCP7oJZKh9QCrrE+qMJ4WAVQmNK7r7Yv0vsdLed1VE9m+nk mxugyoFjJ00FaiM4HEpH6bfStRQAT/rfpw95A8J5rKO7D+FGksCaXpXFPBgXgwtyTU3e dvR7pzq+OogTC8Khhvsr6IEgQ8AM55ADET21uTG/3AIdGoROeV7X4tvj+QIsFOfmrThZ G6Xff6FPIuEw1/bQW/79bPKmdtSXm9j3EJQJtj1Bqpjl0aCuN2jXy7mEUeevarPjj/CM iiofuTZcsiWGhiyMq2CiEVY8I7qPT9qUAuGKWXdtE8Zwt2rlbO6KabfLymZ3iC2fKxlQ qK4w== X-Forwarded-Encrypted: i=1; AJvYcCVVG9JyOxN2OdEJhA0wf7OO3CU93+Sq/0LOMFW3QuhmLrTwI8VQCqUF3a989z0azmxrnk1GZBTtHsZXJJw=@vger.kernel.org X-Gm-Message-State: AOJu0YyV/vN4AWwQ1nBqZzjg2BkeohB+RnyV45EgHloXMbRoXaLVpXWR mus+nbZI1fFRhZw0igqGJcH9g5O0eBU6xW/J0vAPcvdDIID4wDd2 X-Gm-Gg: ASbGncsx+3+7yBvbsSs4rant9of73+dI9VaPiwFDftHqjwW0HecJGJSB1Q3slL3/1VZ 21SX+ceFg4e9ozoOUVWf2xudCKdQzXb2ZYb3pZFsZGrhMm+J6bY6M95lIV0vB2GYC+oJakS52EN zYqfJ88Hf2T5SHlYS8VQEGKYFRvNWXMn1RQgotVT3H8FHuculBisrINkAgSrCt46I76EyRKSZd8 9XlD0XOuv984JludgTiXyPATlo8BiMVPcl3KObKkrQb4Wg/OaeFRM4c1m+6w8n7yohEAtrxR4Xb 82lil87OSV8bgK6pqZtVCXyUcxVm7vZCNwW6UoT3fm7dYO9L/eJpIqd7w5Q+nHOPZXgFsSXY1aT yow== X-Google-Smtp-Source: AGHT+IF3u0H+oGQ2/wIhP84jzTNGBP4fVHIk9OQhmyCTNULQcvXR/2W1nzJq7bC541uOcFJorl3+xw== X-Received: by 2002:a05:6e02:198f:b0:3d3:fbae:3978 with SMTP id e9e14a558f8ab-3d6d548bc33mr33323115ab.9.1743615779091; Wed, 02 Apr 2025 10:42:59 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:58 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 46/54] drm-dyndbg: add DRM_CLASSMAP_USE to vmwgfx driver Date: Wed, 2 Apr 2025 11:41:48 -0600 Message-ID: <20250402174156.1246171-47-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The vmwgfx driver has a number of DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy by telling dyndbg that the module uses them. Signed-off-by: Jim Cromie --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/v= mwgfx_drv.c index 0f32471c8533..2b4f862fe5d4 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -279,6 +279,8 @@ static int vmw_probe(struct pci_dev *, const struct pci= _device_id *); static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, void *ptr); =20 +DRM_CLASSMAP_USE(drm_debug_classes); + MODULE_PARM_DESC(restrict_iommu, "Try to limit IOMMU usage for TTM pages"); module_param_named(restrict_iommu, vmw_restrict_iommu, int, 0600); MODULE_PARM_DESC(force_coherent, "Force coherent TTM pages"); --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-io1-f42.google.com (mail-io1-f42.google.com [209.85.166.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA2B8200BA1 for ; Wed, 2 Apr 2025 17:43:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615782; cv=none; b=m3k7iO6iDgFD4n4suSj8foMr9ekv71mWpKPjbmfAuTNFhQ4GZwMz8CwlnOrWW+gTKn2KwPEuvosqjaGIiHC6EchUOjYQzazS9rBGEEQowYnojxlAX9JtGS5JjHuGdX98Lgx+sKZ/sScKd7/kE9jtCdzOrZ0KasuhfwAeKUP0tqw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615782; c=relaxed/simple; bh=SjSejjyZ/55nTJ9bgxnHE6PQ8OHS1Xh0Xc0rMHnptQc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L4Ch2sntrufCWshDCJkgiUnzI4C8ICP5//6QqFGK2eX2SgP4V2veMxBCebqlQlEoJXJnHJK4Kx+iaRwSBG7z9jdxxcolStxi/1FR4fHAZI5N7rb0f5JKSJqYN076aE1DFDBLqwfR5KZcgPbqF64NSya8rOBCNLnlMfX9zfIvUjs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=H7m0kKhU; arc=none smtp.client-ip=209.85.166.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H7m0kKhU" Received: by mail-io1-f42.google.com with SMTP id ca18e2360f4ac-85b3f92c8dfso541839f.2 for ; Wed, 02 Apr 2025 10:43:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615780; x=1744220580; 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=JhoA9XaTmEGFO/43twqabJw5GWuyyTcgJpDDhp+La9k=; b=H7m0kKhU+SfsDs3TeHOXEGZvzByoS8n51ySi+4muthzrJkCrK+DrQBjJfYOmA7Gm6Z JnTHBgFjjAyw/kOdX92jOd07OEN+HxfOSYunmwjkyeGprgU3uDUxPRlzPWP6J5E7eQYQ YbBry6Frz2It3pSnnDY4tF9ztkojm1xuwVD/NczrarWjv+L3WJzpfdblzdCEoypA1mCi Gi/o0nL6KogmZ2KUJ7Jn8oCrkApnPEkpck/sn/F8expXAkrHHZW3aXQbUuYIenc38xPy jiGsc72paYlDQsy+i37rxhCGZpSWbZ7+rV+H8A0jGWuPRPHw5uiApS1xhJzLDuI1Y6MP lcrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615780; x=1744220580; 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=JhoA9XaTmEGFO/43twqabJw5GWuyyTcgJpDDhp+La9k=; b=mPXMQedN70fpqJ2Pe1fxeYYt8pGBUAmaWwhLmyj9HmodKWNaolWzPrC2GSdV1jIfj/ dj8K9yE1dBdTc6OXqJjafOZPt3/CfdxNmjcb9WG0bOoCrM9j69HnF/adwe4KZjdx3J96 kIl7Jz5DgV7M0zHBycDTIEgXyuz0bb3ygAS2lAB4oEGmji7XagcXWttBkLNfmfW6+jeo LnnlN99ol44qNnBO51wMn0n2DC1zkHpb8gdUsNpSgdX09ur6NseC4e72y5e64FyizOYh aiIa4kz1oJFHwSw88zH39h+tuhgc0bCQ5StNQ3prFM1S3flm2JvToQJlfOSiQf38oSdT dLyA== X-Forwarded-Encrypted: i=1; AJvYcCWRtWrfh9pLFUjVrAjiSS4s+R3D+If9rQzPwhQN/ijSW4pirTipd4CUq0WdMHESqlglDmjtjkumLoDAWoA=@vger.kernel.org X-Gm-Message-State: AOJu0Yx7vHT9aQJPUL4oS8v+2eIlHMQ4EwdTmOW4emyJVhw98aDsmMO/ mmPN2u+d4z8Vz7/qigUws0F83Uv6nkIj38CE0E7S9IyEbAz6lKJV X-Gm-Gg: ASbGncsj3jDxO/+bCkrwLPFe8J0vR7lEtZ1qd87qbLJ8y+fyVr4QwGKbRHB0Ibm8XqD jzNJi7U3w0f1YzESRvuG73kb0TNj4fM/l4upuUUwh+jBHYtS8f7doXk7Ocw7wk7XNZP2UFPFDV6 belLqgyKzWzArV3lBC9rjndrgt5a4dVzXeSY4CcRRh32/C9P5+JdczvhSjLdqJBoHtYno5wLPaf J4vK//4/94/K6gvLFYbCezOAKB+wIkFFe25Ijom9E/OMIib4nmgMfRriIuu5vWVllwbtCbWrjd5 1eWym/gGHzr1lUKrUid8FZeaFGtwYkPVJn+GC+bZXZkm/CpLxd0UTg3LXtU4cTCfmRgMpK4soZ7 XJg== X-Google-Smtp-Source: AGHT+IFlUifTRIdBdJrWmohJtGkz5j2ZAgmAXuJf+hqwzf5FhiZ9fS2SCZmP2KeBUmNu/DQKgqx/aQ== X-Received: by 2002:a05:6e02:1787:b0:3d5:893a:93ea with SMTP id e9e14a558f8ab-3d5e0934a71mr183638485ab.13.1743615779885; Wed, 02 Apr 2025 10:42:59 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.42.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:42:59 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 47/54] drm-dyndbg: add DRM_CLASSMAP_USE to vkms driver Date: Wed, 2 Apr 2025 11:41:49 -0600 Message-ID: <20250402174156.1246171-48-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The vkms driver has a number of DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy by telling dyndbg that the module uses them. Signed-off-by: Jim Cromie --- drivers/gpu/drm/vkms/vkms_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_dr= v.c index e0409aba9349..4b9da64661fb 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -39,6 +39,8 @@ =20 static struct vkms_config *default_config; =20 +DRM_CLASSMAP_USE(drm_debug_classes); + static bool enable_cursor =3D true; module_param_named(enable_cursor, enable_cursor, bool, 0444); MODULE_PARM_DESC(enable_cursor, "Enable/Disable cursor support"); --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAC8A201032 for ; Wed, 2 Apr 2025 17:43:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615783; cv=none; b=LMqhDd1aZLUrR1RmQP/FGVObL7YFj2xGkyo08dcZ1rzmFUKMpuzgFybf5jfpI4bUGC7kbZ4yC9UjwAbOnWXEq8QLMDC7eNj+sfoqWETBpM1IQ7rUcinu6RA2q3niCcRY7uHH8ulLx23I9XEOoyRszhq08041GHzbNao0s09oMlo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615783; c=relaxed/simple; bh=CwWS1tqqtSrGX5l/zPl5jVAGna1ng5cXDDz/wrrMCME=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HGWTuPZMnab4M2MMcvYVg+QLlRBQTC7+DmeiEgWRx8KTBwNwKlIqHZbth5nH6uH/T2282pOTLLnaNJi/UVrnYnzMMu7/qnFnmNQ0LzY6bWoXCswEY0/+uvsZtIACP3JVSTFbpNv/p0wm4am4YWP5/JCbVj/93soBjsbYLD31N+Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XLm1pLQB; arc=none smtp.client-ip=209.85.166.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XLm1pLQB" Received: by mail-io1-f53.google.com with SMTP id ca18e2360f4ac-85e15dc801aso1021639f.2 for ; Wed, 02 Apr 2025 10:43:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615781; x=1744220581; 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=phnE7T3rE82X9afYdUepg2ZaVnfZbBYGopazv1dsHzc=; b=XLm1pLQBftX1nwCQ6QzViTEbPhHsh5vuxd2jGAzfEXghRzPICftIYczlguEp1YTYAM t6SVfCL/EUhyoK/pc4F6kcvCARmjYlo7TLKkmQwLgkkPbSqBHpccLYXrPD0tfLS/BQtF 8rKmWcWRnhUFE8EM1V5b69/Vq6YliCfsoSirxLz+UbCmP3Zq7YyL8KxeaT71ab+2hkr6 40vcV73iw6KOrFnz88gy8STHLXUrPbkUF8uAPzxlGnFMwhKc5v38dh8hJbLSh1lApv3T YKALShViaO/fOYdYWqmh6DzUTyrglGmOaL6S+kMmVau/KVYvJyVsWK8bOD14oHnE0Mtv ZbQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615781; x=1744220581; 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=phnE7T3rE82X9afYdUepg2ZaVnfZbBYGopazv1dsHzc=; b=QLBSS75HJQW4W9P4z6ltohA2OWxDheCF3k94fqejeAyk5VSWgPEoOG9mT0ayZhNl1G LbEMCFN/VPVvQQrI8KV0S/jtZmVLQqrub+iolxesZfPaDpfijNfBR7I1mIxe/67YWTTo tVe4Vl+Il7G1r1aALFEdz4oHG4WehhbEw7QBznht9PRUnK3mH18AN7pUfDIB+g5gQhNp 8GoxIKRl1I7hUDE8+bg2bgSJ8xjCZOMJAg7axX2iZ36gBv2QOTu/yxgX+VQzJiQ4TsAe sos4YfuDhcRCcN5FM0EGRqv5rskCFWdE+uMFPfKk0efVnYYfz0G5NhbJlWu5CzGKGTbo DPzg== X-Forwarded-Encrypted: i=1; AJvYcCUMfuh8Y7g9UrqCS8RmUHheup3GDFai/tcwoeSOtY4XTX1JWIula82D3DJ8ANrII6Xz7XrJKF4E8s7AgL4=@vger.kernel.org X-Gm-Message-State: AOJu0Yz8bk82Dda+4MQjIZwIOfvjH+cjRVfv56+7ANryCcL9Bun0W90q SJx/bBRzkLkTAcjLzwj8GP5Vd6yjiKGftRVE1wgR9mL3xIsxIejo X-Gm-Gg: ASbGnctRDZBKo946jjZno1zc30tyAPG9ENrJZUfNn/smKDtvtJ+XTVUx2oTS0xuRBGH YEZrGEqicruP2rPGozR9X9+uc5hijfuZ81mNITi7sgj1R+9oL/yNtKfOs6DVx3napHiBnmLaNJX eiwNy2KmPjSB0wk+eQEsiF+1D+OVD5bSJOes1kISAfVTacmUbiKSjjXybJ9G+IhrxA3yuZaemtA RNwh5xVoPKdzQZPzAJ+j3TAJYsse5crLuySMqfA+RrCS1K0dp06Ks8mbg3I5awsrum7rPf5StS4 K9a8a6YPB5FCtgIPZuhNS/nA/MasBXL4Hq8sG5HqhuTmYpVbPuRdJBWtkwLB/TOtyFJjcELgrxl CZQ== X-Google-Smtp-Source: AGHT+IFuJV2A3WyeGyRKkWOVHXtPxLV1+Mi2JNfQFD+IYZFzlTa+4ZUBb0ebsjuh3kRTyYLqlLO2Zw== X-Received: by 2002:a05:6e02:180a:b0:3d0:4bce:cfa8 with SMTP id e9e14a558f8ab-3d6ca5b1d53mr103006025ab.3.1743615780941; Wed, 02 Apr 2025 10:43:00 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.43.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:43:00 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 48/54] drm-dyndbg: add DRM_CLASSMAP_USE to udl driver Date: Wed, 2 Apr 2025 11:41:50 -0600 Message-ID: <20250402174156.1246171-49-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The udl driver has a number of DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy by telling dyndbg that the module uses them. Signed-off-by: Jim Cromie --- drivers/gpu/drm/udl/udl_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c index 3ebe2ce55dfd..ba57c14454e5 100644 --- a/drivers/gpu/drm/udl/udl_main.c +++ b/drivers/gpu/drm/udl/udl_main.c @@ -19,6 +19,8 @@ =20 #define NR_USB_REQUEST_CHANNEL 0x12 =20 +DRM_CLASSMAP_USE(drm_debug_classes); + #define MAX_TRANSFER (PAGE_SIZE*16 - BULK_SIZE) #define WRITES_IN_FLIGHT (20) #define MAX_VENDOR_DESCRIPTOR_SIZE 256 --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f169.google.com (mail-il1-f169.google.com [209.85.166.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54257201100 for ; Wed, 2 Apr 2025 17:43:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615783; cv=none; b=UIGK25MCDv2Y0cLD4AaI/IWq5JkENyThpu1YE8mg9b4oUK8rkz5VgWMV1ENjtR3gNhwf3hw2fsmw3EeZa4V1Rxx+Q0S2Z48aYIIKHU92EByNC92tPiil3FFfASyrx44FFkZZANnbF1LgDn2yDQ2ajT+G2m+hitCByx2Wz7s973k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615783; c=relaxed/simple; bh=N9BDlQuttJ/CG7/8erFPoatDdgkmwr3Xfmvi/9L/ya8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m5ewr8sNS+pjWcjXurgwPi+KaqaVI7mcWeh6tX68Llr+FCRGiKkP0xEUJjLB/fCh4OFNx6r3R6aFNHiI9KKEMObNvuZCOT3oFE9HWrjYiPGNlqYjad5E0een9WuD8iBNM/S2ZTjZCQkXO7/fdE4dymmVejHvjAgpEFewdvqNsMc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MR86VPva; arc=none smtp.client-ip=209.85.166.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MR86VPva" Received: by mail-il1-f169.google.com with SMTP id e9e14a558f8ab-3d5ebc2459fso907485ab.0 for ; Wed, 02 Apr 2025 10:43:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615781; x=1744220581; 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=av5O5WnsuBn1uC/IGfMHk77btJQzrlTi1UNrBIeIfGA=; b=MR86VPvaJbCmDmY0iC9fnTLi0JW2rdE18L5K7/RhZHI2+jg9KCeg9pR7gyblkyzG4/ TnSCIEGi0nHdVczY6HL+cxZyzlR0DyIJVqg0hUA+rbHNYTD7vILrC1OZVCexeaw7yHUe HvZvT9qnUcgXSMOCD+aPlsZVnCrfBnuGQS/0lhv9G81DbgLveXVQUTrK2zyyK6fMorKa kTPdPEghjNxMsj4PHCoUe2NemTq3vUK7wn9sWJYYf3Z57J4l253R263yKT+2nelDboQ7 g+5UV4s7wIRKraOd6E+Y4mU3UwuLKF5ux8LnS3Jrk9XvKViIyQTZR2Hs5q/jO28o4pnw B2Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615781; x=1744220581; 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=av5O5WnsuBn1uC/IGfMHk77btJQzrlTi1UNrBIeIfGA=; b=MMK2DNgYsvFzq8yiwBDnT8sgLtjIRuTuL3Zf1u8oTu/XS3HVQPnT1ndN1JgZfZ5jCO UD4TR06sxd8l5iwhJy1gC/abxitUCHlIP5bw1goeiTts7U5r7QIvH8Lv18u+6wkfgqJ7 MiQ123TiNvuEEKyLI+gz/EIIGkUA7SRNR5lsjrw1S1QyuNt43Jqzvf5xNyPACoAGZQMg G/PFsiLEbq4cJ3+8Vtgdq5CLgCBu3vDIm8i6m6xl2ooocWFAYcA4Rp+hPFJj749c/5io CU3aRSciMZMqTvOehp+ZsuIWAQbi8eALWyEOCCUmSzVHkRV9U1yNa3yJx9shPXCH2edh fUGg== X-Forwarded-Encrypted: i=1; AJvYcCW8xzViJ2MNlrwIA2EIEexesHMSmNpA0QHMfJgTzUcfR3r5giQyBRJumy+XsX6QFAL+z9dTEyiOm63aLEA=@vger.kernel.org X-Gm-Message-State: AOJu0Yx2dfrhacic64hBtO6XlSKqPHmg9hlXhvX/W6+Ohtgj/bV89UJz JgJJAn1Jj7bYBU+Y2bruCXNozOKgW9CYRhVojn9HJ/PnTFGs2+MY X-Gm-Gg: ASbGnct04n012pH1P+RwWjWU4ce3cK4zUq+dao70f4Nf3tASr5QolacH0irft7/4HwW 96aNEBBCczdX2B2TNh5cFFyV1TKf0f2l6HCFWn8s7FLZi74YKETaYhR7DVpwQ0PAweMZlrZx+HA 89UkMPfo3JQlblbXcQV5prUd4qW+emm5QsFV9x4dYcQfzDBTTb/xrgJZ2h71IvcWvBznxKli9nI b9+56DxfTp4JTCJIQv9W9CoGGZnCfCj/ECHMPHHYDhwGUqrz2Zpu1fsK9nREJ7s5d6IIUNEHn3H GvuJ80nSF6k3f4QnbCZc8D7i5vkD5gNwZEg03UEG9ePQHGsgXz1JTxhISeO2f4QT6YugW36oNz8 FOQ== X-Google-Smtp-Source: AGHT+IG8XSmNVp+q/PMUM7nI1VXleBCEFjeSE8gGJHee5Xa3olHDY+LWA8eCwUT1fL6HdiRQkmnU2w== X-Received: by 2002:a05:6e02:12cd:b0:3d5:deaf:b443 with SMTP id e9e14a558f8ab-3d5e08e251emr222409015ab.3.1743615781696; Wed, 02 Apr 2025 10:43:01 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.43.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:43:01 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 49/54] drm-dyndbg: add DRM_CLASSMAP_USE to mgag200 driver Date: Wed, 2 Apr 2025 11:41:51 -0600 Message-ID: <20250402174156.1246171-50-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The mgag200 driver has a number of DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy by telling dyndbg that the module uses them. Signed-off-by: Jim Cromie --- drivers/gpu/drm/mgag200/mgag200_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag20= 0/mgag200_drv.c index 069fdd2dc8f6..5b6ec1550da3 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -27,6 +27,8 @@ static int mgag200_modeset =3D -1; MODULE_PARM_DESC(modeset, "Disable/Enable modesetting"); module_param_named(modeset, mgag200_modeset, int, 0400); =20 +DRM_CLASSMAP_USE(drm_debug_classes); + int mgag200_init_pci_options(struct pci_dev *pdev, u32 option, u32 option2) { struct device *dev =3D &pdev->dev; --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58DA3202982 for ; Wed, 2 Apr 2025 17:43:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615784; cv=none; b=bKkBl833KCWSBTSr/Ng07D3kYQwlTlUWAWlnxnHAvPrAh+WEVS8SrEKQy2WDXVmLl/b5bTFt20yPsf8riOTEJAE9TdYjenawpGOxxE/RMuV0UGww2+BvFzTwZiX5uhQ+rIK7T+90SoUnox9wthvxhln0L2Pe3iRkkHaul0sTUw0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615784; c=relaxed/simple; bh=HYMxLPoXW6Y1QIruiib9Zo9L+bclQU5xJEqbXk6UmFk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JZtbir6FvfYiRKprc0kR1U2/DUc9ChJsEK8xHjkDHP5VQv5qS3Eck12KuYJCtvZYYo41uC6TRpXQAWnqb2fA8iIivtuakAJAT6MezuRjdkjV+qHDU6FdhBQuHCMlE35Ns16vxBh9OE2+GnLc++OqegTOFyCcn3NurSRn8DCWn8A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JA3wSddJ; arc=none smtp.client-ip=209.85.166.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JA3wSddJ" Received: by mail-io1-f52.google.com with SMTP id ca18e2360f4ac-85b4170f1f5so417239f.3 for ; Wed, 02 Apr 2025 10:43:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615782; x=1744220582; 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=/NT2KOV5clgY+fvBVb0kMabH8vqyg2O7PfGhDz8vOzc=; b=JA3wSddJW56pecr4Ys5faL8XAZSu0VMoOeU2O8dHKnTNQ0tgaE9PemxKCoE+KX+u4A l0xAx7oO/k7Cz0zT/fIMYT/FawAvoKbLEyDpLj2OGg6sPvLhZRzVL0VytD18AJYfVqFW /lPTKtumnTkdOw50KYeHYdwPGUpylutze9CfMSuIZ997SjDiQy4su3emzTqgRliNI0vJ IK2gmhecTiOppKgLSs+SPRC7Rx1GX3A+KpxutlWcRrwJzXqIHa3GK6jlqCjYB53O6xn5 WydL5JzieUBtooLE7VKWWW18FxV/lvEkd36QhNkN8T6aw02Y3MHUa+9aZOKsEGuaHHig ChQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615782; x=1744220582; 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=/NT2KOV5clgY+fvBVb0kMabH8vqyg2O7PfGhDz8vOzc=; b=uOIhAvS+WuZ0r0kj5i/zAdBGQ+hn08jx3PLxmkHcqeWFOUl50RYL++ebzO6NMh9l0x ek9R2dabDdtZHcwjRJKMPQvQJcaQgO7TIa6wsaRVr1CqlOaVsPxBVmVjjZ0pYvZOdQUu kD89Y75VO3b5sf0agHLHoZ7ZYlrttG2rEVln4ecphNMpJ1uehd+4RPuaSKUHGayKAQWt 8wlkwg/siKspQAJ3EZSgHAb1To/YhimjswFg4Oxuh8zz52oLrrUoTTn3y32bb40P3DLv nVX2ujcH0+tOzZJs9oNarKnfRr+MGcIjm+KZO+GopgZIaHdTaSkhB3NQiUFBfoJSBG/a tsgg== X-Forwarded-Encrypted: i=1; AJvYcCUV5iUEiGEE63jms9UBgnr7FwnjW7zAT3XTvD3qd2HaMuhR2Qojk5CCnSeinyrLA66a6+68aZPWnvJcMko=@vger.kernel.org X-Gm-Message-State: AOJu0Yy/YYSCzvKGEob2GxxkQoXhPI3ufk+YryTQZMSNP7R0WcjP/tIw kczjrbvKtVJysEE03le9hOHPeeTYkvNcXzD2ow0FoFSdNwjEF+hU X-Gm-Gg: ASbGncuve2CopKbq/7wShY943ApCvxVqCQiOafjcotNODCkBu59HnICbBLNbGc03DJd 06NkU2y/MV/hw9LAv0DbCm9xEyQCnol2tpAzlFZ77PnZ7yHQ/b3SzZY5U+LR1nDJjVon2Mdk1R5 cX6pVmx7X7jCWFWD0NhvwIPNw/gJSZ8lLuZ59c/q2BOjksjzdAiXcnCcATW9wC8JTvhAOWtTFLt hm3iCie9Kw4uD3KOQxon1LpuQvTb/qmuHNIu+4RkD/oogwMRRA5BOpIRY2UONtxMA1yCU5Djs5u t3m94M9b/e/ogNRyD1q1MLD8I/KdPo+k+LWorCmwjNNN6Tv1eJ4mbtyQBcdZYy5qk+dq3y7He4O q3KbMij/LIuMK X-Google-Smtp-Source: AGHT+IHugLKyVSM4152JdpDyO0IyiqFWhgdr4RcjxQiNgdLiEazciacIDXztJ7jfLMjeFRlO1pAg2Q== X-Received: by 2002:a05:6e02:1a21:b0:3d5:d6ad:286a with SMTP id e9e14a558f8ab-3d6d54bba56mr37037015ab.13.1743615782473; Wed, 02 Apr 2025 10:43:02 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.43.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:43:02 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 50/54] drm-dyndbg: add DRM_CLASSMAP_USE to the gud driver Date: Wed, 2 Apr 2025 11:41:52 -0600 Message-ID: <20250402174156.1246171-51-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The gud driver has a number of DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy by telling dyndbg that the module uses them. Signed-off-by: Jim Cromie --- drivers/gpu/drm/gud/gud_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/gud/gud_drv.c b/drivers/gpu/drm/gud/gud_drv.c index cb405771d6e2..3843c0e47169 100644 --- a/drivers/gpu/drm/gud/gud_drv.c +++ b/drivers/gpu/drm/gud/gud_drv.c @@ -32,6 +32,8 @@ =20 #include "gud_internal.h" =20 +DRM_CLASSMAP_USE(drm_debug_classes); + /* Only used internally */ static const struct drm_format_info gud_drm_format_r1 =3D { .format =3D GUD_DRM_FORMAT_R1, --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f176.google.com (mail-il1-f176.google.com [209.85.166.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7099C202F90 for ; Wed, 2 Apr 2025 17:43:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615786; cv=none; b=Ug1Q+U5R1R11HxXltFNuYw1TO1l/5lDWvFYyCPZgGxGBIV4cygRBgU5viRVKJQIaNJ5XwERfOuJ7sVr+bAlPDTgFBv3x5tuKjfFb5ZFFmapxyvWVpkFtV7+Bi5NRRAdPQQuOEd8X5ilD4ecGd7rNoL+zW4/e07Mskvu89w8nDCw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615786; c=relaxed/simple; bh=jtmuGtEYcaPHI+wbnujDHwf0zLuAr7ob6sebW7yeKAM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ModTSL3JYleEqG16YC4FA4/EX8uKsFmQ+2mMpKi3gka03NvWmtsvhASv7f+27+cnpE4ahQlZqlP395hVOBH2xNc1rU8XQGE8iSgWJPu1a5n2uz7n1BOhrnHWFEwu6z8AS7ppcHPvVjJcUZ1pyl7ZxJFt7GvgIL6R2z36GFZ1jlk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HmpX38z7; arc=none smtp.client-ip=209.85.166.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HmpX38z7" Received: by mail-il1-f176.google.com with SMTP id e9e14a558f8ab-3d46fddf357so513745ab.2 for ; Wed, 02 Apr 2025 10:43:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615783; x=1744220583; 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=v1ua5S//H69kDLjZ/ereYDRSGWaurp/ZUyrfcdHp8ig=; b=HmpX38z72OWvTZXS2vnOqABuRbVsZOTHqr2kKuaV3fnmzdaOI1Q4zZMssww6A6GJk+ LHCZhTHFjyEAfr6mj0Y6ixH+AsV3u9Gp7jATxbb+gczjuHi/9gxvjGzH+P5cJ9xPyBvm DekP6Uv0NG63OTQDOLd8iGIQ4IC0ppC9+cjgCQL9u+dEMHvbBAvhM0aySc6fDic4/HoV zXwaP2yB5tKbjfSv0OIfGqqWNE/VOu/DvoD416L4V79dZn+9VkLNKPQ2KOhmFVh7M9e/ 08hh2R6+VPxfChRD7jnsRd0FrjHpSnEW9wjldpU7Lwlk/7s/BNy2dFkOP1OF/gtg/xKq e6Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615783; x=1744220583; 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=v1ua5S//H69kDLjZ/ereYDRSGWaurp/ZUyrfcdHp8ig=; b=DX7G0O2TALWLz4kPxV0ASRDgGOXUEWq1JwAurQkL48dL5rzdERa/SnTJXcSnBRw6b/ UpsZu0fWBJuT6PpONrIAonB17d7e3N6lPg1FkdxgdglrAd0WbET2UabXps0RetshEg/L ZIfNUwdK/4e1nBF9/hZfhFAKCgs4hyIU9dtVfgoYR+RA6iztMvfTT4YUDahjXl7CL4QS mhrpdFaEZqPflMpS6K8I9n/YM/eSh853FepH6CEilceo3B8apAg+6aQIieRx7WhCBWq5 YMfVItx3OK104McDT4zR42st1J/lMWC9MXW9cWQ/69GRufv5CeP3F6Y8emQCHe6/sAHV 9GIw== X-Forwarded-Encrypted: i=1; AJvYcCWCPoCOpbaR+E2Vi/hIqZo5ypod7kGPo1ocvhANivwoA2Kp7HPJEZBsmLL7OLxwlxB8RZkBs/kVuksZWJ4=@vger.kernel.org X-Gm-Message-State: AOJu0YzdLhjAGodmPlKaHlMNeCdiN7NFdUYwcrJARXfW+XUYDWGVG7+E BE1V18g1LmCX4W4mrX2F7PVup92Eer7bH0a1TH+QlZ4Vbg68xkTA X-Gm-Gg: ASbGncuCFKk6WRQn8+91Zu52ONkK6kbKPiTSONiv+fojFIVwDNoNTNUQOvcCVrNiqWp LVO1uonS7UA3xyTPADgepZH37fFyKbhEOCAWzjZZ1EgKSPicTUG6re0w4P5BiASpxz3+HBCcBut k3GxVyaqVVSK1GY9tszx/8V1DDV1fos7lVfTqKhgn57IEKYpAv49OGnF2N/YZ1HpZ1DxO4ZLTTB P8YpSBfIE+CDWwP55AGyqBYmrSnPP522hS/DOam/B4qYM/uVmvxEKAqrXfKBB9ivQ3rJchvLBTb h6zLyZOpn5f5yv53PRfmoMko4CqeKRsmgrH+6GHXNCEu7sGjL859Be8Dm++lhhuq9SMeXQedjp/ zCw== X-Google-Smtp-Source: AGHT+IFNbSL/mGRZnpcJ5fpN82ueS3a1gUICe3xx8i7wsRjblgimnfxJciryAt1b8LRjBn5RrhWasA== X-Received: by 2002:a05:6e02:12cf:b0:3d5:8937:f419 with SMTP id e9e14a558f8ab-3d5e093c0e0mr170520315ab.13.1743615783315; Wed, 02 Apr 2025 10:43:03 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.43.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:43:03 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 51/54] drm-dyndbg: add DRM_CLASSMAP_USE to the qxl driver Date: Wed, 2 Apr 2025 11:41:53 -0600 Message-ID: <20250402174156.1246171-52-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The qxl driver has a number of DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy by telling dyndbg that the module uses them. Signed-off-by: Jim Cromie --- drivers/gpu/drm/qxl/qxl_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c index 417061ae59eb..c18577a3153d 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.c +++ b/drivers/gpu/drm/qxl/qxl_drv.c @@ -66,6 +66,8 @@ module_param_named(modeset, qxl_modeset, int, 0400); MODULE_PARM_DESC(num_heads, "Number of virtual crtcs to expose (default 4)= "); module_param_named(num_heads, qxl_num_crtc, int, 0400); =20 +DRM_CLASSMAP_USE(drm_debug_classes); + static struct drm_driver qxl_driver; static struct pci_driver qxl_pci_driver; =20 --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 146F5204096 for ; Wed, 2 Apr 2025 17:43:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615786; cv=none; b=Ek7r9w6576YLazCCUJeA2K1rpK5jOgCwjmQAz5bSxjFZ3TORU1qqUaTZYRTU7Tj4dABkJSMKfmByRQoY6Sfj1u6lfCgKB1ZOg4vugJnogMWC2vMhEnBfeBGVOw+bQFPDKRCn/vY9oT2z26MalmyvlpEyuQmxBHefXNbAgUdH/pk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615786; c=relaxed/simple; bh=jo1ydT2hB6u1cx8n6xgWYmM/1GUAUgZV4IauZsWcOk0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B6WhBAi92zKvl+yyWlHxnaK9FhyL+WZIQH2q+tzPPzGgmqb9EJJhvGR+4BbAN6to4ZnfoKrOYiGLZ1QiUrjWYd4bGJz1hg1kAGSB0oLnQISbaPD5stlZ9iLvALUEdlvzbCx0hDbMbruEPCL/N6LARNr8frSiTyRNACq/Wad6uFI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NvZlZ72N; arc=none smtp.client-ip=209.85.166.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NvZlZ72N" Received: by mail-il1-f181.google.com with SMTP id e9e14a558f8ab-3cda56e1dffso523045ab.1 for ; Wed, 02 Apr 2025 10:43:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615784; x=1744220584; 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=riXSD1tORrHtkttiQwAlqFF38I5b7O133kwF8VYREw8=; b=NvZlZ72NmsuTsLlOegeIF+4KJ4p24yWGl14KmWoUBRi+tpC6DO9L7+Lj4MckNhwXEb FvFDOBvoAoHbYo7tLvU8dTVj9BXIV5JIBXiIvMgwETac6Gctnxci8LV2el+/W/M5U3lh HGUCSK2IS+rmixu5NfBHyuUYjQVOgAPxNzgQ1orSXz0OvA9bKw12yvAsH7nll9mN2OPS bXdyey/hp2Hg3YCYApBB3p38gL2pwIL45yRD21ejmI2kDdZ/HYWiXhKeflth4gyqaaTH T2EGs19VKRHKqkiNQUOIgB4bh19PxbPkuIkcGOEtFt3kJUi3ClCa99OlfrLOujXSR312 Fp9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615784; x=1744220584; 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=riXSD1tORrHtkttiQwAlqFF38I5b7O133kwF8VYREw8=; b=Twy8pVitNg7jpGdVhxbG4Pqg/njPY1COmMkGvBFPZc/c/ZZtfMyGfD30cgKxjF5fkz aynuM3VXRAmxsYI8yhFk8qgBj75h4ubm/+Jge7Hfuv1O77tb3XkfOYxPmnr07r7aupko h2odxakfbOxiRcxPDR7YrOuLVToyT63sHXyrvFeoF1msRfHiar+W/y+g/d28v41L4RcV yAuQw6AFWMm9v8VD11AA+BRPp77FeQXtaFycVSlzEu87zcmrQH749W+ABbADLls9WvzJ 7WRrmw2N9OJL99Lv0aIZcvvAdZHYdlvM9BuAl0K3u+cO1898QDK6sG63z/aVyheFK7eQ 3Zww== X-Forwarded-Encrypted: i=1; AJvYcCXKMdcQVX5drxLZkn526GkgA0xYSQIVYcL/L7bZk7WRHdUz/XAcZSS5ObAJSx+Tklud+RHRdATBiYLNThM=@vger.kernel.org X-Gm-Message-State: AOJu0Yzp2CtQysgIDaW6S2WQyjf8PK5XA0bfpGx+QNzU5sq+H67PJIQw XV1PQsMmUDKmFrSffxuMLcKOyInGfqEYHbxP7PW2VyCIV0/tOWnv X-Gm-Gg: ASbGnctzjyeQxJU9dwptnp7juW2a8dDXoxfBpMa3lGMVs2G1UBP8r0c+AfUWnWRmdnk XGDiOuGiRTAlmEFKkpD57N0vA4iGe+vMMJyZYuJgcPHkoT87EyOAuOIR6NFNSy/VcATEW+H6J44 5VfjxKKbOhty3F1WORDsLzs5m0B9EPS1whM3mff+8Jalibr6uJWFefSbX2hxm+eAUDvexkbmsRj hPfq6jOuw8wxYz5cBnBQLSPBUQ6SBm1iFenv/MUA1JSvkHmSbc4dj8YGQjEBXSz6ou6OiEI3IUi 427o5s1ZKHIdoUUWUgv+K6YhZZE3qdQuk9RcJvPCVUYPScfy5GIW+OUDRtSDHMetWCSCnMyWgpV FPg== X-Google-Smtp-Source: AGHT+IEbSBP+B3xptDWbc/1upPiI0aJgKHmWB2BUQakR8KahNUKIycomB71fjze7DtGkXTxHa/MFtA== X-Received: by 2002:a05:6e02:2612:b0:3d4:3d63:e070 with SMTP id e9e14a558f8ab-3d5e09d9fb0mr177162865ab.16.1743615784292; Wed, 02 Apr 2025 10:43:04 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.43.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:43:03 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 52/54] drm-dyndbg: add DRM_CLASSMAP_USE to the drm_gem_shmem_helper driver Date: Wed, 2 Apr 2025 11:41:54 -0600 Message-ID: <20250402174156.1246171-53-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The drm_gem_shmem_helper driver has a number of DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy by telling dyndbg that the module uses them. Signed-off-by: Jim Cromie --- drivers/gpu/drm/drm_gem_shmem_helper.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_g= em_shmem_helper.c index 5ab351409312..481d18561688 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -23,6 +23,7 @@ #include =20 MODULE_IMPORT_NS("DMA_BUF"); +DRM_CLASSMAP_USE(drm_debug_classes); =20 /** * DOC: overview --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D09F6204C36 for ; Wed, 2 Apr 2025 17:43:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615789; cv=none; b=Sgj9Xhlo/QyDuRGTL6UiFv2A8kfgwCC+Lm8pLHPewjmLA6Qyme23+4wgWuStTPsC72S45WnUYheKORmRe851MhYTVDfT8Nh8W7FrdHMWndJgzPipVNpm07wf2Jp2KNGwr0A0Vxlr4HlL0mDhdlBZI3qlRPHTuX+rGMaH1u+y2EU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615789; c=relaxed/simple; bh=2hj07UwdhkVjVMyzWoCwFWPShBiCLBIyGVcsL78LCFs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uFuEfw4boQWazZT4P0z2cwwDuMJUxyBrbS6cJSm4TzkOpM6G7cH3qwaoUGaWL37JEhe90s24ooa9gO7VT7qZrTKqA0oJBAYyxtp7LN0dFYN9MwnKtbv5nYWHc/XkV/BHGXvBp7hkA6+e0d34DXz7p2LwITQfyzml54iHsEm+HK4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NykwBUYs; arc=none smtp.client-ip=209.85.166.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NykwBUYs" Received: by mail-io1-f52.google.com with SMTP id ca18e2360f4ac-85da5a3667bso588439f.1 for ; Wed, 02 Apr 2025 10:43:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615785; x=1744220585; 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=/+QMYU6kMnFOETa/gyjW3XwbPIpROUU0JSPdCI4eHHw=; b=NykwBUYs0P1Tz61qhf0CFYOCZLu3IFyOUAvkedKo+6f4SIbuEhRAfT/EJrMs++GKnn 6zfLr7DJTY+f3gGp1dd2td7WhVwIKv8X2r9RcfFiCLDde8CUkfGncAMrfE46q5MNaaLp Do6/wDircetaktyl2ffqeHdrD0xwDmBijlXpLqaAV8XMBx5tSoXnAlI0ZXrtI7zrgyt0 uSn43J6/2Efj4jA2ns1DN/9rx5AKaicgT5pzCJ5YacFvbDmrLdGzOXqfLKfh/ahtCY4g wzWbsJ7StaBEpRbeplYuX6L+yKaS4glxM+DHw+dex03XoKa+wowgV5uv4aMZtDnUXarV Y4sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615785; x=1744220585; 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=/+QMYU6kMnFOETa/gyjW3XwbPIpROUU0JSPdCI4eHHw=; b=GGVA7Xll5TkiTkKxGrBsm4SmWu62m4xg02PkfyjRX2D2RslSH3SgUh30opIBmtOm6t vaV98PY2T4PfbMyq1ioPa2iOj+Y9EqT3qSMNnHFONgnCh7MjXtoqfpoPhG7EwgLk/his qApoajYgBP13qShbmWdBAsaJ/iaKK/X8OvmQt0hTv9BHlwo+NLxPsItJSk/sVdQ+VfU7 2KfTRs7oZgpA2Q+hS+6Ca3X8GRTHw4GIbmbDxMbWuREBrdpL0HqNGBA6MB9s70ynZvn9 DK2KKSHAC8oWshLNWRXcoWaaFF1cac2KY3k3VdEPyf+d+qL+6knCtGoQS++F+/6JJrD2 fd7A== X-Forwarded-Encrypted: i=1; AJvYcCW4GVfzXTwofqXcL7Zty7bLDkjyFYkyKry31A53DXR38jaVOWfmj9a7j8CpzKJh82vG9hXIXCTABdWXFIY=@vger.kernel.org X-Gm-Message-State: AOJu0YxtdfhFcIGnIBy6qI0ZRklUE/6gxBRV6iTZtutOE73I5yGnQwX9 qbmi9RipnbQxAL+nuPBd/7QNq4ASJNTBGREwFeZeXXZDjCoJL1pY X-Gm-Gg: ASbGnctcqd25820yZ2MfN6/Vnb20Rkp9KGvRplKzWE4J1u/NE6TB837Suk0U7IqaPs+ zJQ+zhFpvvIH3j7+Q5pFafDN3FxJcgD8L7wOOIIO3DRNftu0sSAv5qU5rlT2Sva9jILaFSVs8vD 6Qz14mcudEvA1RF4XO9C7NZIv3Dvd8J9gvwVg27dM6T4YLR8k4XFD4WKC0Ca3mwzif4i4FFGn6t G89t6KjgcteE/sivxhgDughxyaj3WdO70TQJYhJbGLh4nF6TCkXSNlIKbiQ8WTkY1YIWU6w5JHv LN65mZQ4SdA9HsU5R5VrzW8aSof5tiUT30JDUwsrb/CvwqrewuF6csQ4QFAMxxtgnc3V8eLzvOi niQ== X-Google-Smtp-Source: AGHT+IH6nE+1RRyptl+hnFIsnD98qBIE2DJ5GwLkp49MBABtaplmtxYAgbpkZKesyp6M7QVsZiqFPg== X-Received: by 2002:a05:6e02:144a:b0:3d2:aa73:7b7a with SMTP id e9e14a558f8ab-3d5e0939424mr211440705ab.12.1743615785077; Wed, 02 Apr 2025 10:43:05 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.43.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:43:04 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 53/54] drm: restore CONFIG_DRM_USE_DYNAMIC_DEBUG un-BROKEN Date: Wed, 2 Apr 2025 11:41:55 -0600 Message-ID: <20250402174156.1246171-54-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Time for some thorough CI. Also, the previous 18 patches could perhaps be replaced by a single invocation of DYNDBG_CLASSMAP_USE, from a C-file linked into all drm drivers & helpers. I didn't find such a file, nor a drm-client linkage item in the Makefile. Signed-off-by: Jim Cromie --- drivers/gpu/drm/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index fbef3f471bd0..c7d6adbe17eb 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -53,8 +53,7 @@ config DRM_DEBUG_MM =20 config DRM_USE_DYNAMIC_DEBUG bool "use dynamic debug to implement drm.debug" - default n - depends on BROKEN + default y depends on DRM depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE depends on JUMP_LABEL --=20 2.49.0 From nobody Fri Apr 4 11:43:54 2025 Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE1DA204879 for ; Wed, 2 Apr 2025 17:43:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615788; cv=none; b=RWZ2oeeODDgLyddzi4/DLDS/Fdho4NlEuqmC7Tx3XiMzOj8TKSdKmWvdcan8rEVRET2o+D1B3i6Y8tabYLatRM8KIl2jCXazSxaVAX2tEJDJVI381h0RbFPk1EgNB1DdhgbgoW/zyXHuAMJXL9b8BsQoxkHoo9lvBMXQp4/XJK0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743615788; c=relaxed/simple; bh=ysvtgpv8Lzoof+7How0DiBM+y+vEotUTIOC5+Z4md5Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=avpDpsvS7n7Kt54xykmGpXhtQt7TglDd/F5YufOTp+KgyBlhE0TX0wcQCSrROtZcEmxa+2LUjRuPp+EZY0+E5ahspwayQYPz1dhPLDuy+o0wG0GdrBCQaj1v8ixdtWU9LOxh7JTb3XIe/nnGtenID8IaW3NHODEGcy8nR/xkBlk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SK0KPq/8; arc=none smtp.client-ip=209.85.166.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SK0KPq/8" Received: by mail-io1-f52.google.com with SMTP id ca18e2360f4ac-85de3e8d0adso699239f.1 for ; Wed, 02 Apr 2025 10:43:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743615786; x=1744220586; 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=dmamZMwYgFpi0j7+3VuOLzPrfkXXmhZ2avEG64/SS20=; b=SK0KPq/8lzN1xP4A0eGHF6g6jBQed9be97AJmLpXKjDrbURr468AYGHvplfsfqLBSm 9hfFEQfbtKObA/AM7XikXWkinuxHhjjEYvTS6lFI2tbwZfTkLadULXLQD04ObKwSuGS6 pYPQ3ppfyWgtji+dFtdUyvGgj/rQxC30Un1U5/atffPa/bhFZuytAaXaNagJ3q8pflw8 Edq0KVo0fbjzFAKNd4jeJbv5mmh+MWVRtEBdClXN6v4x6WNdwd6TJlACbpU0p9AXsdCQ duhY2wYqqKq6RAg2Z/Znbh0hresPImiJkpvwWal1o1RX7624WkLG59keIOqpSIVxGKt4 vQOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743615786; x=1744220586; 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=dmamZMwYgFpi0j7+3VuOLzPrfkXXmhZ2avEG64/SS20=; b=R49vjGzzFBDPZKoTtYmMFvqd/txt9uZPVWvtjMbz39OCfiZCdnW3KB6LemYW/Ko5YV oyTmuYq6bCXH0vhfIxPNsDBZMJ+md4CmU/QcRoe6MB3UNv+jj3sSVW6SYFMbovbHCTv1 ZlTdyKUMuS+hh0ugLQAuWtXnDBDQNWK+dpPac+KGFijFTMFaOl88NeJuJmYmFAQlks0u XesSQkZ+ni3YrL9wsT9xfyumzUWBrE83pRQ1yH7/lJBXCnOMv95OQK8s+dEtVZiqtVRq C5hf8axLOjYZ7SaptCbO0BREai3m/XE6y5UObtG5JfeOpdfm832Svihq7qiKfwP9+k2r 9cZg== X-Forwarded-Encrypted: i=1; AJvYcCUAJn6t7Rm0uUrgheU0Sm83QsdAj3drSArGboPBskHA02VijblcNsnOS7wNck91vKHg6Z6gqLjXWqLYUb4=@vger.kernel.org X-Gm-Message-State: AOJu0Yyro+TtFzWc0d88Yaju/Z3ARuOGHjaFvIMpG4WuAJnUulkhUW4+ TAtvW3PStvToORvYbemCvI5ZUc3Y74GkXI0sUoD5IXtupHSonUSu X-Gm-Gg: ASbGnctxHRFVl3PJEHzJGFZbTdfRioGbgWtHVAU93GgdThhQQ1AzMV2klnxXJ8JyHAP ynqH1xG54zB+Ud04lRAZ3TcB87+EMns/skp+Fm3wF3LuOph21z2/l92Pt1oHFsXU8SE7Dz8DjUF LngWRkGvWdInqQM0iQMC8b3gSLdN5hODqPh+LiSiWmgLmN8ubRaF5sSOg+72hmcD+QCOCSqrNYR PIEURWM7tJixn0haNMz2/GISij3/u4Dw1vLFtO5vKIMtvE6xbTZqxdtVc5wPiPIRYYfhqqo4KDs /O34ckOgMcLcadyfCQtbBadNqgvUPyuykVjb1FcW3bewEQTYKMLWsJ0iShjg1AIS6UGWtDNv892 XCw== X-Google-Smtp-Source: AGHT+IHals0Ha6Jbgxu6ZrP/iyj69ILFezhPsXy3WvO7TTJBtm+wHjVRufglAOrxetkFLageXKmqeg== X-Received: by 2002:a92:cda4:0:b0:3d3:fcff:edae with SMTP id e9e14a558f8ab-3d5e08eb18amr200191655ab.3.1743615785891; Wed, 02 Apr 2025 10:43:05 -0700 (PDT) Received: from gandalf.. (c-67-165-245-5.hsd1.co.comcast.net. [67.165.245.5]) by smtp.googlemail.com with ESMTPSA id e9e14a558f8ab-3d5d5af8369sm33439725ab.71.2025.04.02.10.43.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 10:43:05 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org, louis.chauvet@bootlin.com, linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, Jim Cromie Subject: [PATCH v3 54/54] drm: RFC - make drm_dyndbg_user.o for drm-*_helpers, drivers Date: Wed, 2 Apr 2025 11:41:56 -0600 Message-ID: <20250402174156.1246171-55-jim.cromie@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402174156.1246171-1-jim.cromie@gmail.com> References: <20250402174156.1246171-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add new drm_dyndbg_user.c with a single call to DYNDBG_CLASSMAP_USE(drm_debug_classes). This creates a _class_user record (and a linkage dependency). If a driver adds this object to its Makefile target, it gets the record, which authorizes dyndbg to enable the module's class'd pr_debugs, such as DRMs _dbg() macros. So Id like to automatically inject this object into drivers. I tried subdir-objs-y, but thats not a thing. In drm/Makefile: Add object dependency to drm_*_helper-y targets: $targ-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) +=3D drm_dyndbg_user.o Attempt a foreach: to add $driver-y +=3D ../drm_dyndbg_user.o this appears to be a train-wreck for impl reasons, but it describes a want/need reasonably well. It might not be a good maintainble idea. Explicitly adding to radeon/Makefile worked: $radeon-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) +=3D ../drm_dyndbg_user.o But doing this is just as per-module as just adding the _USE() explicitly to the main .c file, which is less magical than make-fu. Also, it appears to cause make && make rebuilds. and try to link it to helpers and everything Signed-off-by: Jim Cromie --- drivers/gpu/drm/Makefile | 9 +++++++++ drivers/gpu/drm/drm_dyndbg_user.c | 11 +++++++++++ 2 files changed, 20 insertions(+) create mode 100644 drivers/gpu/drm/drm_dyndbg_user.c diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 704f94efc804..1adb5a262180 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -74,10 +74,12 @@ drm-y :=3D \ drm_vblank_work.o \ drm_vma_manager.o \ drm_writeback.o + drm-$(CONFIG_DRM_CLIENT) +=3D \ drm_client.o \ drm_client_event.o \ drm_client_modeset.o + drm-$(CONFIG_DRM_LIB_RANDOM) +=3D lib/drm_random.o drm-$(CONFIG_COMPAT) +=3D drm_ioc32.o drm-$(CONFIG_DRM_PANEL) +=3D drm_panel.o @@ -111,20 +113,25 @@ obj-$(CONFIG_DRM_BUDDY) +=3D drm_buddy.o drm_dma_helper-y :=3D drm_gem_dma_helper.o drm_dma_helper-$(CONFIG_DRM_FBDEV_EMULATION) +=3D drm_fbdev_dma.o drm_dma_helper-$(CONFIG_DRM_KMS_HELPER) +=3D drm_fb_dma_helper.o +drm_dma_helper-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) +=3D drm_dyndbg_user.o obj-$(CONFIG_DRM_GEM_DMA_HELPER) +=3D drm_dma_helper.o =20 drm_shmem_helper-y :=3D drm_gem_shmem_helper.o drm_shmem_helper-$(CONFIG_DRM_FBDEV_EMULATION) +=3D drm_fbdev_shmem.o +drm_shmem_helper-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) +=3D drm_dyndbg_user.o obj-$(CONFIG_DRM_GEM_SHMEM_HELPER) +=3D drm_shmem_helper.o =20 drm_suballoc_helper-y :=3D drm_suballoc.o +drm_suballoc_helper-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) +=3D drm_dyndbg_user.o obj-$(CONFIG_DRM_SUBALLOC_HELPER) +=3D drm_suballoc_helper.o =20 drm_vram_helper-y :=3D drm_gem_vram_helper.o +drm_vram_helper-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) +=3D drm_dyndbg_user.o obj-$(CONFIG_DRM_VRAM_HELPER) +=3D drm_vram_helper.o =20 drm_ttm_helper-y :=3D drm_gem_ttm_helper.o drm_ttm_helper-$(CONFIG_DRM_FBDEV_EMULATION) +=3D drm_fbdev_ttm.o +drm_ttm_helper-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) +=3D drm_dyndbg_user.o obj-$(CONFIG_DRM_TTM_HELPER) +=3D drm_ttm_helper.o =20 # @@ -149,11 +156,13 @@ drm_kms_helper-y :=3D \ drm_simple_kms_helper.o drm_kms_helper-$(CONFIG_DRM_PANEL_BRIDGE) +=3D bridge/panel.o drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) +=3D drm_fb_helper.o +drm_kms_helper-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) +=3D drm_dyndbg_user.o obj-$(CONFIG_DRM_KMS_HELPER) +=3D drm_kms_helper.o =20 # # Drivers and the rest # +subdir-obj-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) +=3D drm_dyndbg_user.o =20 obj-y +=3D tests/ =20 diff --git a/drivers/gpu/drm/drm_dyndbg_user.c b/drivers/gpu/drm/drm_dyndbg= _user.c new file mode 100644 index 000000000000..9e4aa87d4b58 --- /dev/null +++ b/drivers/gpu/drm/drm_dyndbg_user.c @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "drm/drm_print.h" +/* + * if DRM_USE_DYNAMIC_DEBBUG: + * DYNDBG_CLASSMAP_USE(drm_debug_classes); + * + * dyndbg classmaps are opt-in, so modules which call drm:_*_dbg must + * link this to authorize dyndbg to change the static-keys underneath. + */ +DRM_CLASSMAP_USE(drm_debug_classes); --=20 2.49.0