From nobody Tue Feb 10 23:53:35 2026 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 887ED156F2D for ; Thu, 16 May 2024 17:44:12 +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=1715881453; cv=none; b=eRanZ0biQ9m4Wtbk+fCv7a6cgAetqO0s/n7wu/n0Ueo9ue+C0edsVNegMR6nSvV4M0cbNlcsfj89porGM/PYw9iHBijxs8Hf1MCg9vPxRFLpKAL7gBC2pM+ZgZY3pCr8ijOioTUelgVFmipYvrHBZVdeuZnBZxabIsJQkUHK7Ek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881453; c=relaxed/simple; bh=gtzS+9DVjEwLK3/WiQ+05m1QNOhyl608HV7VX6s6saM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tzLVj3rVAly9sveI+1QrCtvd9jp0gke0YEfex/uODz/C+WasZOGghQ7IZbcaCaKrTWmiSfkGbazRlywJAjDWe1qQhtV81HaoD9iLE78JC1D8y/DaLeczJXLGD+OmNCVZHFzUEwwfOleTlS4ef7OK8OP8gMemCDa3eueA2C2C9iQ= 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=IrtyXGoC; 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="IrtyXGoC" Received: by mail-io1-f51.google.com with SMTP id ca18e2360f4ac-7e201ab539eso62866439f.1 for ; Thu, 16 May 2024 10:44:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881451; x=1716486251; 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=Q8BXT8qH3+7khMh8QnRF/zRHf6x/WRU2V0wJ49wwPss=; b=IrtyXGoCD/lYM8IWFoJzY9GKGPvBey7ugmgBaEjCiHkMy83CthBO7C38csN+/XcGXU OAGONlir/2ySu3k6OmTLiUhSdZeQ1Qg24Uo/1JZZQtIdyA2Anv1NxrlqU0vRutQo+leI lNila8LY9VNrJhry75+AuIkB9qQ3URclO0Oe8FjWy9fZFzSAPQqJBOzKc+xIj14+4cHw 3GrCL0spAo74rxOpaJrszx90T4y0EE0Yk5zQ/iCX9ymRvQ4QA7X1g5W8TDuajiGCBUji ArXPLRylDGnA5RPPEuu8oLTH5ai/2H82g2r5FXey+w0r43cqRzqmiyKHr3IG5Xest1EF UCFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881451; x=1716486251; 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=Q8BXT8qH3+7khMh8QnRF/zRHf6x/WRU2V0wJ49wwPss=; b=FSm8hCFuVOpEQ+hBoTUJQ74Phxlt7ZY+kKprzIi4ihxb7wetvkWq7P/StZFgNL+Q1D H88814HcGlfNVU2sllPE/LzzA2mgOn55+tIqneHDttdjn+fd3C4/ysM8gH+84pS9wzod YYwSPC56k9FcNAC94K9PjGS5JCMBd3EGaajCFaVD9uwh4dNoawqVZ+7MhX+ooIBsiAxY ZypzhRXODzRbLjMfKEmMHXcw63zLOKWaMA+noSvn8CShm6q5AE7R4XTXfeGZQHRdWlQQ EWAyY+EJFJOSR/Tbc5YXL2vig7kS81uXEZfgwmbLi1FUUinJHMPwEyJuEDYAFg4EDfqG cfPQ== X-Forwarded-Encrypted: i=1; AJvYcCWE/wNOOeMjrRHoi7/9kPJzKTcn3Q2vtZQPcziuLbmuYqshoiMKJSZbBPBKG+hVYT3l/JYeSOHPzAEOl8yNzougD3SfIZ3Ty3ssVDJj X-Gm-Message-State: AOJu0YxB+EQ1yg552QaRPBgI+XNqPJKXu/1HQPMwLJ/lJmW6hQW7p3iA Cl8jLaWnpl9OQz7UK0Ie4ZFo2GSjXXCDUzP2F6vf4KE+eSs1qgO0 X-Google-Smtp-Source: AGHT+IHjMgBSXwNq6mqpRnowlCGNcQiMuzRsRtbWlS8L8L4MT5tGo9g4QZMenLcqK0ZLy7AMDf8D/A== X-Received: by 2002:a05:6602:2492:b0:7e1:b3f5:bae6 with SMTP id ca18e2360f4ac-7e1b51b6596mr2127032339f.6.1715881450207; Thu, 16 May 2024 10:44:10 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:09 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 01/33] docs/dyndbg: update examples \012 to \n Date: Thu, 16 May 2024 11:43:25 -0600 Message-ID: <20240516174357.26755-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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 --- Documentation/admin-guide/dynamic-debug-howto.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentat= ion/admin-guide/dynamic-debug-howto.rst index 0e9b48daf690..6a8ce5a34382 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -52,12 +52,12 @@ query/commands to the control file. Example:: # grease the interface :#> alias ddcmd=3D'echo $* > /proc/dynamic_debug/control' =20 - :#> ddcmd '-p; module main func run* +p' + :#> ddcmd '-p; module main func run* +p' # disable all, then enable main :#> 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.45.0 From nobody Tue Feb 10 23:53:35 2026 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 36CE8156F26 for ; Thu, 16 May 2024 17:44: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=1715881453; cv=none; b=hJsR/5G1EBGMM4ST/xmcsduiLSFuZPMTAQjqSybbycyfW7GqH3VJvh/v4IGCZBNJHXKj3jTlsKsCBDuvrIjb/k5Th98huutpeETQFVO6cfrUC8GK7KtTa0EkZCfS7RQ/cXyrG+JMfAYWyxcJ76alCFbgp5wldmBOcsQTLJkE5Ic= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881453; c=relaxed/simple; bh=PRtI3uGezhrYV9s9WiYgJnFl7QwWMmeEdWT7WD3z0BE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OWtQtyAvtYX+rZX35wUfPbepLSK9LbjQyMGwUvv/Cz9Np68OcQR5UcYWWrD6VNRcLgJuQanyVR7Pvh7esX1veWrfZ5dWKJKF8R90nlmhbRgK8jCDA5x2LLlelUPZX1YHNGaSrk9xOUE1rOiDy3ywOqtjwbvm6DuSqzVeYh8X5Tc= 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=PNyd3/YA; 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="PNyd3/YA" Received: by mail-io1-f44.google.com with SMTP id ca18e2360f4ac-7e1b547cf45so70128639f.3 for ; Thu, 16 May 2024 10:44:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881451; x=1716486251; 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=sd7QmDozimr8RZwLQJ2vCKHFTMMILyamLzpg7/VsK8E=; b=PNyd3/YATlEWTIg4kw6tZ1YMnrUQOjPT51jcwFO6wFp4831ZRjx9SJ2hNmc1XwZ09X YSguopQFba+XwFf61TTW/mxJyyZxfkeycPmCeoQ/Nl8K1L7bYRr1t7WmjY246eI4i5TA 45caTuoGERPzRkCTWT3k35DWFUsQWRw49sIeLYNJE6D8eIUiQKfRZO0SXWiiDhrhFtzo E0uQOtzEKyfoN1SdrmvnjMAYQpJR7NK2//9sYsbvs4xdcdE1w8GMoqBOrjw8KsCuy0Mb wRlQDGS9VFhdJlWV37fMAXg/yL6wyjcnuxtvDwBXimSYLmLIi+tT9qZGf2vgKG8u3fhq uYlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881451; x=1716486251; 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=sd7QmDozimr8RZwLQJ2vCKHFTMMILyamLzpg7/VsK8E=; b=KlbrZZdHmhwyKeGKxIDBjJFfD17HeJoAm9ANUOqbr+eB+0cVacpLVx3WwAOpuCP30W eeHY46uRIbb3jCG2dpjubXNyUGv7w3nX7d6sAP5KIE2rDdOKAWaiAZMn0+3JZ/nyMDP6 P8GM89dDGAwBz7qGRHsCe6viIfaKAb7UX5VesDWi4IFzfmTOtySRWMUqkZVOf9nPem65 q7MNB2QkvtOEEyLjDknswlMbfNjRf1r6+7qKjSsy4BFqPsbjaDr7Bng2mvgy/GpWckJ4 WdjaeVtM5hSffc/HVB0TLwwVSXJlEPDTuXrRDJv0L9OcPt6UXVinM1rzTzh++AQOa7xI ShPA== X-Forwarded-Encrypted: i=1; AJvYcCV/hTzZFDavtC+auPa8Qb32UcNZKILrhujDy/Y6s3oa0WCxzyPKtkEnbVcZ/MsIEf65tdWBj9rEjYrKy5144C6twq4BxWsjC9ycSShT X-Gm-Message-State: AOJu0Yz+FvLveO1QZotZ8iUwDbM8Q1mlNkRv9UNdwdpq5TIwH+ANAqwg E9DqJhGpWPZ+I3vgeibYWD38/oq+KXXsTMFblYiCmyDUyX2S7q1h X-Google-Smtp-Source: AGHT+IHAUaygKtHrQqYy/60d3WIbEspDA/Q7I3eKfqRRXXKohhEp0d0DUBm6o3mOEQOFq8wGlv7kDg== X-Received: by 2002:a92:870b:0:b0:36d:bddc:2fb3 with SMTP id e9e14a558f8ab-36dbddc3217mr27213995ab.7.1715881451314; Thu, 16 May 2024 10:44:11 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:10 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 02/33] test-dyndbg: fixup CLASSMAP usage error Date: Thu, 16 May 2024 11:43:26 -0600 Message-ID: <20240516174357.26755-3-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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" A more careful reading of logging output from test_dynamic_debug.ko reveals: lib/test_dynamic_debug.c:103 [test_dynamic_debug]do_cats =3Dpmf "doing cate= gories\n" 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, 105,106 have LOW/MID and MID/HI skew. The enum's 1st val (explicitly initialized) was wrong; it must be _base, not _base+1 (a DECLARE_DYNDBG_CLASSMAP param). So the last enumeration exceeded the range of mapped class-id's, which triggered the "class unknown" report. I coded in an error, intending to verify err detection, then forgot, and missed that it was there. So this patch fixes a bad usage of DECLARE_DYNDBG_CLASSMAP(), showing that it is too error-prone. As noted in test-mod comments: * 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-62 class_id space !! Signed-off-by: Jim Cromie --- 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 8dd250ad022b..a01f0193a419 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.45.0 From nobody Tue Feb 10 23:53:35 2026 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 AF239156862 for ; Thu, 16 May 2024 17:44:13 +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=1715881455; cv=none; b=Izv/2yZv39Pd58HXZCws6DiQvrUCjTID7t29r95xFfpIf6xKy0aqIeiLPfGrcUEZ9b1i9k+1ZOjk+BBlCyz0zIXkhuu1EnS8yqnghdeYk8XEFNdHu03l9HNZ3rx4YbfDUTR6dgLW41UiCrfesZMZjpUh8QKhO/hV2y80pOwXIy4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881455; c=relaxed/simple; bh=ZXhuDL5iIMt9rsPdhO1mxJVUwD3pwrVShJ9CSDPP6+o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qrbrnIAlmD+ebPcoEbUq11duXq1/tOVRx365ADKVsoUeHWX3He2+FBYX/HWqQ88zw8dlA8MyV5X7KdQ3ge4H/G26fHYEBZgMinacV/6ItSIdyITa5uxTWwfg7cdDpaOfXPEDqRxbQ73QjemIaTYRBFICyOhwaz4iIMbip9Kxj+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=lBA59cNo; 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="lBA59cNo" Received: by mail-io1-f50.google.com with SMTP id ca18e2360f4ac-7dad81110cfso63435339f.1 for ; Thu, 16 May 2024 10:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881453; x=1716486253; 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=J3jkEN2lvr8AQ7hFLPVcKhBqkSuaqnJkQBzyL1liDm8=; b=lBA59cNoe8xrch+z4OskxqlYuFYnxH+KWVubnsrPn6YfLhVOm3spaoM7i5BulfHeNw ZwAiygp2yFdj9iP6mtUVGL75VVGmwJE6ODV21P/8j+z7egZoYby03Kedfnw8skYgreHp w4OmjLeHuQECPmZYaIzrDTIKMQ9EevlKTvKQvAnJWd0DmMexALI5+mBtFyFf+FAsavQo dq8g8iriGUgCTtDZtCfih/fUdQAgx6gH401SZC//Uf+UBvjOiEKu/p3qFV0zlEIpmQqe ZOE6V4LyFDbK1U8wORmi8RxeLfEB2TeEZd3o2PmCgEh018du6UieNG+CwegBHU/noZge KK5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881453; x=1716486253; 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=J3jkEN2lvr8AQ7hFLPVcKhBqkSuaqnJkQBzyL1liDm8=; b=c4tQLanNfY1engWsUM2ErAzaIWFuV9/wQJ/C9LTMepJLHxCwOjgfcYsGxAGke4oiaf yCv5DPYW5wR1TXBeiaFZpepHGvUB4l95s/wQ4EjKfU18La0gE/qygQaNc48ioItEOHvz b1hyTLoiZbkbPyYziF2MvQaHVgWziC+1jd2vtwqXtZwtgKo4DUApzBx6UFecNQ+XNvFt OBC1sPAllcY8jAzZTnY6HmK2Pgtt/7pkxUu21fQJG9/5zCe7YM3QkLHlo0gQz04n3qfX NEQ1B5fAa6R0rD8PRLZS1baz1zI2CjaNrlJw8KajvUPMQpYJo5N3hllcoA/Wlw5DMV03 5wyw== X-Forwarded-Encrypted: i=1; AJvYcCU1xAR1fwxdwsCn+gHTiNgqLueFtyIcIRuFWV9AcjoVdbK5ButvfIPP9Dvn3nIQWthwphFcX23rTfzbpAdmmdu5FtgoGFPgM5Z18Mle X-Gm-Message-State: AOJu0YyMgnRLnJva9LHsZt0I8EMUxMfHmy3u8GCABCiddZWylR2SGYEL 8MqBZ1DO8JDo6L3AGoi2YeEPqXUKGpca2OqZouri6Mfkw61bJuVP X-Google-Smtp-Source: AGHT+IFz4usrZY3qDynwGeLrK+pO8sKyO9l3hH6ryzb2bPM6HcQI6YFG4ZZBc2EBHW4DKC86KU+PAw== X-Received: by 2002:a5e:c702:0:b0:7e1:7b55:ad28 with SMTP id ca18e2360f4ac-7e1b51a2218mr2195390139f.3.1715881452835; Thu, 16 May 2024 10:44:12 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:11 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 03/33] dyndbg: reword "class unknown," to "class:_UNKNOWN_" Date: Thu, 16 May 2024 11:43:27 -0600 Message-ID: <20240516174357.26755-4-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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, so change it to "class:_UNKNOWN_" to loudly announce the erroneous situation, and to make it exceedingly greppable. Signed-off-by: Jim Cromie --- 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 f2c5e7910bb1..73ccf947d4aa 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_puts(m, "\n"); =20 --=20 2.45.0 From nobody Tue Feb 10 23:53:35 2026 Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (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 A78E7156F4A for ; Thu, 16 May 2024 17:44:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881456; cv=none; b=Rg33QKOj6XKRsku86F6yzEwAtidPTrR3WOOMRGhrLfqpK2IzL69SxivMT4hcQwldsUk4f8M0Mbm6IyV9X+bh7kyw9eKFjLOIEkLL+2gS4+2i/iIJ7Gwnoai2+HORoxy1FCjkIEGHhLmJZTnSQO1Ir8pzn+8MrHw/wvXQvilC4GA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881456; c=relaxed/simple; bh=ulmiXgsd906reEU5mkxZmxamZrST13sJiESSIufQs24=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cSj7dNO1RLJe0VWheaCVaGwfLqfUGbTsRxrqICOZ8qxADVJZFiRu499DI84IU3ZqKq1f9GC9DT8AEaUoGGI1K+yTwXM6b8g7N3qeY+xDh0GeiIEHXYTdJTETllNK3ARuXm4EAZkkmhdUeeYP6f80XziAy/lHTRS/IbCXfuEFOzg= 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=iK+Hqie3; arc=none smtp.client-ip=209.85.166.46 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="iK+Hqie3" Received: by mail-io1-f46.google.com with SMTP id ca18e2360f4ac-7e1b887c488so29571739f.0 for ; Thu, 16 May 2024 10:44:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881454; x=1716486254; 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=tZuRS8IeAScp8y/gysB1rc+IyuJyj3IoD2Z9IwMDBuQ=; b=iK+Hqie3Bm7+gyhSFegedtjsEPIgudiEyfHO27PYuqV/6UIupKsmMZwHyK7STQgxhR aoZ8uUPTYTi/oRtkuVGGhUmmF1hRnN3s5GDayi+f5It+D9rpESP5mrzD1RGGVkf10vWE fytGiHO98nm3Ghiq5tRAJbyuofqA8YWRrTh0Iaw+UBQBWOTy264wctkjWOBVeVtRTixN nZcbWQeEQwR4rybGB1VabTCbVxrcR+IHr7waOwjaFoHaxyxaDRhS7QJvyYhsDYGpIZga 1C44HGs+cTQQ12Ziq9aSgi+dcGylPPpaf4ILRq0WBmTRuCu0y3U/pQhf14BQweGrwH+M S9ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881454; x=1716486254; 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=tZuRS8IeAScp8y/gysB1rc+IyuJyj3IoD2Z9IwMDBuQ=; b=VP1tj23HKJ8Mc0XHNN5/HdGHnosE435YUMocxjoOh/MJwK2Vzmfo6GiG7isiLpnAUg rX/8J59b4CWeKNo1VO2FeAlX4LjDHVm1PtgCsCJuHmLTf0OuQFJzL2OPKLcdn+W87ThH 8KwtBN2aMc6rU14XyWHWXiukwXkVK8kjroOLjvoQw4VSKZBt7u4KAPDVDDIsddIdYjyh cf0bOiZvvtU7tVf8S7nMEdR+xWWFvo+7p/CAFFQgHok7hRw52qKBdq0UFppLxncXh+79 UP10INdlqOSas78YAZ/dcSoQ2drra1+Bl5o82tRrI05TQipaGu5FiVjlj6BSiBMmD0xC eqaQ== X-Forwarded-Encrypted: i=1; AJvYcCVNAavsxhHo1/J0f/5eFQnyshnMmzY5ZxXGUpCYEBkYaLvxfzsa67SRZvkWvCg+5Y4i1kGYYecfwZCeELq6QZUW0sTXUZY2CUgSRXk+ X-Gm-Message-State: AOJu0YwgmijXWn4xQ2wwKuETE7CC8rc1IhYVBZxVxOy8FsFVXIYF6ZtD iasWV5yatG94C8c5zCeSVL3PQZyDc+6J7uOA32sb1r1uxloXqzgd X-Google-Smtp-Source: AGHT+IF+TqjjE+8WXcXliVtf1uF9wKonO4QRNRhZ4eL8CQDDFSHt7vzGJL5dtU20RMRcP3PWxxYg4w== X-Received: by 2002:a6b:dd0b:0:b0:7e1:be36:ac5a with SMTP id ca18e2360f4ac-7e1be36aea3mr1352182039f.10.1715881453884; Thu, 16 May 2024 10:44:13 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:13 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 04/33] dyndbg: make ddebug_class_param union members same size Date: Thu, 16 May 2024 11:43:28 -0600 Message-ID: <20240516174357.26755-5-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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. Signed-off-by: Jim Cromie --- 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 4fcbf4d4fd0a..5231aaf361c4 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 73ccf947d4aa..152b04c05981 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.45.0 From nobody Tue Feb 10 23:53:35 2026 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 E4A18157470 for ; Thu, 16 May 2024 17:44:15 +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=1715881457; cv=none; b=kp9LOQF7r2/6Os/i4xFn0/2ejhT/RnVheiN6xxbggNxkf1usT00vG08T6CS/McPEQBKpWhiLMxqUjaKF/bBfHkuI0lfSUBWvLgvPiBPIBYFB4yZHpzTc8b/cmwrKzr+/3VCxQPQCM1n9CYbrPaBtrNQ/4g2+dDmhAe1us3N6vTk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881457; c=relaxed/simple; bh=ntlEMLmTT3GKxdWMvXvLjjYoIasMg2Z9d/4Z4RLRF6k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E8Su6+5J4HXeiBTjMevleNm9dNDlkFL+R+VWvHUo/s6nxjcLhykJNj7tstyBQ0K8TAgzsspDxlK8KKirSkADLVIYeebwG7pap53Jtr5Ai58JI2Xb35gEBnLEjKJ5y5tMqK7khMZ9bisGh6AtGq/cyVCu9G1c2wfpVwoQpi9noQw= 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=GDOB5QGU; 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="GDOB5QGU" Received: by mail-io1-f52.google.com with SMTP id ca18e2360f4ac-7e1d924b0b0so62355339f.1 for ; Thu, 16 May 2024 10:44:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881455; x=1716486255; 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=4g5CKbHMZ7wHQleUE8G2Jo73R4WSY99H0174ziTVcvE=; b=GDOB5QGUlCSjFdVMvkFwFHcLhTp1Phk2WoDHVqIXB32/9wDkuFP9apoge0m8inunaC QtcbgVJnc3rkV9RoEsJlVZ5isHZOsAlnenVa15yeSQ7kdjNgKtr8AOjtQKNkhnK1K/in cii7i2RMp5NjumvOzt11EVfZIuXGKru3cC2pa21pCEgFUh1jfZFzh+fi8mxscHjLbiwg phHcvRW8wqlyFPiOPQDgtiO9x4WZBMCCRryCEBu8MAQnClB59Kg6ryLMvbTZhfcXtNYi 3FXjy53doMLZWD05dw4jaDAH/B5iMdRtYKYonNvZJCNezf2+/VmhCFKvTZTP8Irws6oZ yYag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881455; x=1716486255; 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=4g5CKbHMZ7wHQleUE8G2Jo73R4WSY99H0174ziTVcvE=; b=Rtv3fSxo4uJDM7/nIjCys5c/amxhaMBxI2d3UakSXGzc4C1S2d2AUjWRjFCnNByrtg uJ3c51RWEdBY9T8ak7ABsncgP8+6D0NKJOQ4bKwht1uKXcTeRtNfVuI2wiyUjij+VofK wa7g/AQ5qlITrOi3+oUtwmEdRby0xXKHkSXL3gJYX9RpKIzrHwn9z+gEI2PXTF6nD3cM FuYm+9af+rEIE9vwTrTlwHJfwTmP0D2dkOyYSh1rTQEMnjz9yFl96Dok7HmlQ6WIVENf o0Uzh0T06jOpUtjvLLRr2MOHQz+5sUcZ75dtLRJ6ibdY9fduNFm5EUka9uT365OdNM0u 1YjA== X-Forwarded-Encrypted: i=1; AJvYcCXCXPk+CUJZjefnaGTZt6b2+sZ0DUmF5ZtUr1CqB0v5SVBXVEkf1tHAgB4lYRTa52xFAMCcfsemmf2g7wENsrdr1F53VmPjym44T9oI X-Gm-Message-State: AOJu0YwU6QuFh3qLZAoKFA1Meehn3Gwovo8AexYNXIfMmu9kHvAxzKG0 BzzMG9Oq5INruGrECCvmef4mV4ZvB01I6JglIpyDonzBc1pSbezO X-Google-Smtp-Source: AGHT+IGK1XWGhvYAXE19qd7204RoipTQ+tiIB8Lv3aQ8KFeTci6df9p5MK/8RYSfeYjILj4i3Z+Zzg== X-Received: by 2002:a5e:d517:0:b0:7de:c8c4:74d4 with SMTP id ca18e2360f4ac-7e1b51d09c5mr2049084639f.11.1715881455063; Thu, 16 May 2024 10:44:15 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:14 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 05/33] dyndbg: replace classmap list with a vector Date: Thu, 16 May 2024 11:43:29 -0600 Message-ID: <20240516174357.26755-6-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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 are individually list-linked onto dyndbg's per-module ddebug_table for operation. This is unnecessary; even when ddebug_attach_classmap() is handling the builtin section (with classmaps for multiple builtin modules), its contents are ordered, so a module's possibly multiple classmaps will be consecutive in the section, and could be treated as a vector/block, since both start-addy and subrange length are in the ddebug_info arg. IOW, this treats classmaps similarly to _ddebugs, which are already kept as vector-refs (address+len). So this changes: struct ddebug_class_map drops list-head link. struct ddebug_table drops the list-head maps, and gets: classes & num_classes for the start-addy and num_classes, placed to improve struct packing. The loading: in ddebug_attach_module_classes(), replace the for-the-modname list-add loop, with a forloop that finds the module's subrange (start,length) of matching classmaps within the possibly builtin classmaps vector, and saves those to the ddebug_table. The reading/using: change list-foreach loops in ddebug_class_name() & ddebug_find_valid_class() to walk the array from start to length. Also: Move #define __outvar up, above an added use in a fn-prototype. Simplify ddebug_attach_module_classes args, ref has both addy,len. no functional changes Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 1 - lib/dynamic_debug.c | 61 ++++++++++++++++++----------------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 5231aaf361c4..b53217e4b711 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 152b04c05981..46e4cdd8e6be 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 { @@ -147,13 +148,15 @@ static void vpr_info_dq(const struct ddebug_query *qu= ery, const char *msg) query->first_lineno, query->last_lineno, query->class_string); } =20 +#define __outvar /* filled by callee */ 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, + __outvar 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 +167,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 @@ -1114,9 +1116,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 @@ -1200,30 +1203,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 /* @@ -1256,10 +1260,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); @@ -1372,8 +1375,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.45.0 From nobody Tue Feb 10 23:53:35 2026 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 155A715749C for ; Thu, 16 May 2024 17:44:16 +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=1715881458; cv=none; b=YG9075PF+m0XP4360SFWigtKEB0n7/D5CYetnSAq0nEi8YzoN4QXqg+988Z9CcEg6OFxx18LgFRuSFiRk8NWuOPnNOHqDf++WCbax1biFIJuBSQSHAr4HdhgQupn+AYU8E8IMQX8NUk5F1l1WUCqxYsxK83PLoNHHR1dT5wtxTs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881458; c=relaxed/simple; bh=Nt65keRmpZDv8bRmjvL3/GSbT4bx+qc+RUCALuerzkw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OaSLbR2FZlOyY+S8159GX/3e0p4TOcnbIQ5xQe9rmYDgei27slVKISSuqWP/obsqsdAYu7NmuRpMjtMWV08QnzaleEJN0MTzVBM3ESxq6HuHZPFsjC61DvwAfs3kCL2VxmnNJcx3GSmj6c17/q/A8U97Ngc2PxxfpfDiF/sQXsA= 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=cekmB5B6; 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="cekmB5B6" Received: by mail-io1-f52.google.com with SMTP id ca18e2360f4ac-7e1f984312cso63458239f.2 for ; Thu, 16 May 2024 10:44:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881456; x=1716486256; 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=I+DOksUhXvdVEsoG4IsyAg8S9S+luDW/WoR3/bPFU7A=; b=cekmB5B6IueRaGjXPXytbWp9tBawF8TNDhMYEfXA+U52wKbXS8xhKWGqxA2y87AaE1 LWR05HPhm1THQm063InyrzpTZ5dz+f6ecwx5R+JvZP22rSCXJf2DICYxyStMJwYS81qR viBgzL9Qi7ZQkx0p6IW2TK8TMw8oV4W8snmcO/2iPoQzOXmdxoofk94EzFZRosZTrjcN MHQVFTB2oMZONu5aw5guShoVuBQYazsO4t1waWrMog/EouViRbIE7dL4q0/eKzK/2b6R 1SlWleURqDKdPGA7tTm3e8n7j5futXLyz5fIYgOImrPJRk++KudrIMuYvHD+bwaRipey 9sww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881456; x=1716486256; 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=I+DOksUhXvdVEsoG4IsyAg8S9S+luDW/WoR3/bPFU7A=; b=qr6n+t9GkNt4fhyYMejIBSiqyDlY3AeTenoO9e6KIPd2/GHoYKaDfQeSd8kpJ9Bpq1 4IwvRjkORhCEk/3UPE199mwARlF59viAxCpB9+qZHv5V0cETUYxpwIiabfZFkgWGFC+k 1PpvW+0JvWGdzuYUKEDP4FDWZAeyKxaqVYTyMExi9bmBm0Sfw9drNyTuzL3izsmTqpSK DPQvYesvdp6nxnC5+971hCkz46kn1BGvTIWxNsM6wEIMXBvy5dxSVmB5EE3gxWYt8/PO hAVV5fgBXUmDpAJ3apZMZ+RuRHG2V7qd9gdT9b0Qxj67jltj7Ydcv6fkdQKz9PxkjOX3 kWng== X-Forwarded-Encrypted: i=1; AJvYcCURtrsA9ioZ9OOPionp0pVGyA3Lf7kgKpck2AF2TBOqLH2KVavtHcNVLCWc96R3wsS5OpsDbvtMiE4TH/5IjnCnAElQ/f0bE0mOOPUf X-Gm-Message-State: AOJu0YzXyb0bEo6MPipQt+daGPqSTNPQK8U5xWw1eoRMdG0hYwbWLiFG OfFf600KC1UFDEKTcmhYFZLr5HN2IqmAQYdxqRD0fbgulJjIMogaVKQsY5d9 X-Google-Smtp-Source: AGHT+IHcBxJkN6uEQZ6STlgd+VfIFQxSOSwIQkkZfJjLLUFzr4pi0YI95jI1BP5k7Bw3eele8hAssg== X-Received: by 2002:a05:6602:18f:b0:7da:109d:1b84 with SMTP id ca18e2360f4ac-7e1b51c6243mr2064289339f.12.1715881456166; Thu, 16 May 2024 10:44:16 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:15 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 06/33] dyndbg: ddebug_apply_class_bitmap - add module arg, select on it Date: Thu, 16 May 2024 11:43:30 -0600 Message-ID: <20240516174357.26755-7-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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 param: query_module to ddebug_apply_class_bitmap(), and pass it thru to _ddebug_queries(), replacing NULL with query_module. This allows its caller to update just one module, or all (as currently). We'll use this later to propagate drm.debug to each USEr as they're modprobed. No functional change. Signed-off-by: Jim Cromie --- after `modprobe i915`, heres the module dependencies, though not all on drm.debug. bash-5.2# lsmod Module Size Used by i915 3133440 0 drm_buddy 20480 1 i915 ttm 90112 1 i915 i2c_algo_bit 16384 1 i915 video 61440 1 i915 wmi 32768 1 video drm_display_helper 200704 1 i915 drm_kms_helper 208896 2 drm_display_helper,i915 drm 606208 5 drm_kms_helper,drm_display_helper,drm_buddy= ,i915,ttm cec 57344 2 drm_display_helper,i915 --- lib/dynamic_debug.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 46e4cdd8e6be..a1fd2e9dbafb 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -605,7 +605,8 @@ static int ddebug_exec_queries(char *query, const char = *modname) =20 /* apply a new bitmap to the sys-knob's current bit-state */ 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]; @@ -613,7 +614,8 @@ 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); + 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)) @@ -622,12 +624,15 @@ 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); } + v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, *old_bit= s, + query_modname ?: ""); + return matches; } =20 @@ -682,7 +687,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]); @@ -692,7 +697,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); @@ -755,7 +760,7 @@ int param_set_dyndbg_classes(const char *instr, const s= truct kernel_param *kp) 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); + totct +=3D ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, NULL); *dcp->bits =3D inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -768,7 +773,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, NULL); *dcp->lvl =3D inrep; break; default: --=20 2.45.0 From nobody Tue Feb 10 23:53:35 2026 Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (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 2DC35157A74 for ; Thu, 16 May 2024 17:44:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881459; cv=none; b=CL/aNn1ePWKDv+CFaDV332hyhdQQ7TocyETv5GWt5p57rPQxHc/dSRMVG5s7HsqFIKT9sLdlSSjRnCPJye0IpTzaXWdGkJrMEoa9arI0nZlgI7OikNKcAXMolDGNRUDhBzs36TzrucolqTzdZ6MwDtvw+6wtsRvBumJAkrpThWU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881459; c=relaxed/simple; bh=vWHueNHym1y38hL4VQt3Hm0HOaNKFSlXmaKD6E18tGk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JiIDkz64VksP5pbv2WBkpWzdrPXA/P2PBoouOf83ZeckRgDZ4ijdT6ro3dxfGnqdJ3oflW3TN4r4UPEGXNqeBsI+12YWCHb6dm0qe6eFstbqB8zzHgYwSM7WON/MzdVbyWthyhhlzGIVC/AREJfqQXiIMqKrIIqfcHlWHP7M79Y= 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=BfXlW3dM; arc=none smtp.client-ip=209.85.166.47 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="BfXlW3dM" Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-7e1c06191d0so26161039f.1 for ; Thu, 16 May 2024 10:44:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881457; x=1716486257; 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=Yr3n6uiG4JNkms4eZuQ6L/2AOxbSXY48bgOgRcB/ufk=; b=BfXlW3dM6lEACshMD31B0VTWgoK45OljwrFK+lnwmzurFMabR6DPMcuBo3AqOYFfQJ pph/JCDuGEdnWX4tjVXA9s8hFtRydFtlwUYDv5MTorpA6NAH2kldEbScQrM8TMfF/vMB pevMGIyB0qiys2BJdTAJYKQyn4ler/bqJXFXUs7nhT8zBdgFv3wM+u6OeUns7i/iaX1i 7UKEXupqZj90dDceuz/aY0OHuolUkOccz/KYl6uSYiJE27NJuLicSOrK349Vr4PlalFY xcqBVuiVDF+OK3MhDWYnqT4Po5u5CjMkX1baDe/lJ5vh+W2oq0r20eRW7sYAcgS8Ez04 nIyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881457; x=1716486257; 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=Yr3n6uiG4JNkms4eZuQ6L/2AOxbSXY48bgOgRcB/ufk=; b=JakQJLnoqbi12qDWFDEDjqCwIycv3yaM0yMjl2k1CZtGef5tVTj/tuB4XLG1xoOy/Q tTRfpHj8t9JhSW/UR+gyu/nytEAg9nhDhkqGF/nYhdSFrfJ25TNcMs0Dy3YxYa+4lGsu Wc26x4p5A412+vBLZFvoy33xH83IobAvzmp4IxPlDAiDVI2JuNHmbzfof6oF3DAFKvhV jW34t5dCklMZojyV1aCW8ssFrOxAXR2Yqzd+CrGrdxFSRI9istP2Hzmertk/hF4eq57v nsLDXMA7V3aKLqw3tYfSAQHyVqJ3ZOqGeTqhhutm3l9FLID00XrCFzq/vAgwh2MPMgKn KSZw== X-Forwarded-Encrypted: i=1; AJvYcCUVaNZnIDMJQQsT6RH3EVG+XO3Mw5DF85JLKj89mpWUHSkuLY6EOzu1LTbLeZ9HaPLD/ev0hplZ7pB/3RwQLcOORGNtl3IhxTRYSYbm X-Gm-Message-State: AOJu0Yypu0eh7uIzhCnoGfdTe2ABtTPnzl35u+N2Kgmj1rnNg22viKsO nJAEyoL4c9dwkgsSZ0l/2r7/ym4xJ5sQsHHcapfGVR7TehANWcGt X-Google-Smtp-Source: AGHT+IHbttR7dFYK3sq2VJen5StaG2QPJnfpnPF7J5AJb/2lRHedsqSOUOgclet1Vsxjxvc/R/g/pQ== X-Received: by 2002:a5d:88c6:0:b0:7de:f134:4c8c with SMTP id ca18e2360f4ac-7e1a337f27bmr1849855139f.2.1715881457357; Thu, 16 May 2024 10:44:17 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:17 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 07/33] dyndbg: split param_set_dyndbg_classes to _module & wrapper fns Date: Thu, 16 May 2024 11:43:31 -0600 Message-ID: <20240516174357.26755-8-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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" Split api-fn: param_set_dyndbg_classes(), adding modname param and passing NULL in from api-fn. The new arg allows caller to specify that only one module is affected by a prdbgs update. This selectivity will be used later to narrow the scope of changes made. no functional change. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index a1fd2e9dbafb..4a48f830507f 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -711,18 +711,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 *modnm) { const struct ddebug_class_param *dcp =3D kp->arg; const struct ddebug_class_map *map =3D dcp->map; @@ -759,8 +750,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, NULL); + v2pr_info("bits:0x%lx > %s.%s\n", inrep, modnm ?: "*", KP_NAME(kp)); + totct +=3D ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, modnm); *dcp->bits =3D inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -773,7 +764,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, NULL); + totct +=3D ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, modnm); *dcp->lvl =3D inrep; break; default: @@ -782,6 +773,22 @@ 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 - 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) +{ + return param_set_dyndbg_module_classes(instr, kp, NULL); +} EXPORT_SYMBOL(param_set_dyndbg_classes); =20 /** --=20 2.45.0 From nobody Tue Feb 10 23:53:35 2026 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 1FAAB157E78 for ; Thu, 16 May 2024 17:44:19 +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=1715881460; cv=none; b=SRk0jUO67jJM/ozJ2U0oG23JFNC2007P0AoyVw1G7JO5sRyIxXrAwx1YBEaxWeOSWctYDe+UwEGekOc/zxeYJFhLZbGDqIZasLvn5FGrqcPlhHP29GoTUrtr+NxXvkZn+TAFUPUJGQa5RYYAvN4oZKEhiJp6lAjS+CNd7cN42iM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881460; c=relaxed/simple; bh=qhaSWleYG+r3n9pGZPTsZ6CKG0mS38934T1f4hN35uc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mLFpatWBFvJO9s7Bsb636oGghqLQ0VoChf+a7TSPK04E+pce0lUxvqUJzulI8vAy5qk62TAiReDkDvsbAQMTKlIXqW9H55jnGgQSgwqw+rnWgwDAUXBz8+8kDnu/kXgy9vu0oaVrxk8Kl4yXQEM5IcGme/Jrdh7QIkPvCIg9QjI= 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=Isq9LXxu; 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="Isq9LXxu" Received: by mail-io1-f41.google.com with SMTP id ca18e2360f4ac-7e1b887c488so29574439f.0 for ; Thu, 16 May 2024 10:44:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881458; x=1716486258; 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=/0mUDwLsKTvN+KYpp0nKUCtynM6CNCM+YNZSzAF3Qbg=; b=Isq9LXxuLwRfNKIQYfhVHtfQMI0yjnZRL+WNsPAyhet39lZDvXImPGw30D/XIgHI2p E3PwCHueAGfKvGKHQDdzHowe3d1VgUeELYZ2IfE9JIWPGausjvs9I1QCfQyHt8hjq4Dz soFz6ELnHeIYtYZdj66tTlO+CxjWXoi1P+iCEnjcyJrfL0It9qDVTOl4hgQqPJ3Ls1IA OLVBGVANPGlcEgWR3mjtkvxRe2QbbhMhBJLhuFERotXl5PGm6Da6NNnUGKaIl3vXStgQ zPKP11HTrTu+sKfBC8++k51sb5LZR1CL/jvRVqX0rxVkitGIOy8I5KcpE7VkibDtpoJt oLmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881458; x=1716486258; 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=/0mUDwLsKTvN+KYpp0nKUCtynM6CNCM+YNZSzAF3Qbg=; b=H2TyJDVbHVZ0oVY8jUf5MmXM2hkcU4rlmWqlIAGPr5H/rkfh1h/Kmp8a50qMJcvq+C l5Gk+qfuRN6lXQ34BPAyc1hH2DdHVAMTHXEj9LAbnoeV+jLFwphy71GBB0G/SJH4ttvo /SxSR9RpYsZbGZmLXl6UPwoBjyscBSxZlJYLaxJmYGhpcsLFDb1+ws/NaWviKWI9JVFI c2ix6gUL2rADMpG/WwdTkvyqyy2fqV8RIGQvqD/97N4YhEMSpS9tZqcCgCynpBjl4IgB lYC1ILEP1ZXffK0h6HexjNdK9ysk49eFVGIi52JMOD4VRambNFHcdtbAKF5D2eYdWf/I zYUA== X-Forwarded-Encrypted: i=1; AJvYcCXfFj84ox5vggXSfLhwZmjEvYVUvQlWL3qimPKfTf1/L7bPe0Zr00e4oO9LssMqa+q+/KVXmFz2Qb8ju5WK/TkYow78NX4yFglKDKn4 X-Gm-Message-State: AOJu0YyYeHNEgoiVWVoGyKHGthHHmJT4ktr3pPvL/e1odND6g+QGZnKm E1rk1Z5oySHUDKLaSR8dPF61w7kHREDJUqVRUTT6ScieGhuzt8pA X-Google-Smtp-Source: AGHT+IGIOrAefexRX5iLZLVQpG/mCdV8Mzhuo1qT7J0aV4gPdaHlwEYUam8FNXCpbVmmpbDjB/83qQ== X-Received: by 2002:a5d:8358:0:b0:7de:cb34:98ad with SMTP id ca18e2360f4ac-7e1a337fa7dmr1822853239f.1.1715881458411; Thu, 16 May 2024 10:44:18 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:18 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 08/33] dyndbg: drop NUM_TYPE_ARRAY Date: Thu, 16 May 2024 11:43:32 -0600 Message-ID: <20240516174357.26755-9-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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 --- 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 b53217e4b711..8116d0a0d33a 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -106,11 +106,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.45.0 From nobody Tue Feb 10 23:53:35 2026 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 4C659156C74 for ; Thu, 16 May 2024 17:44:20 +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=1715881461; cv=none; b=AJYuY/LLd0+sTP1wEcOBJsZmoo61jS8IbdFJ9moDIVH+pOktjFwfe2WrWQ2rc72pzW3yMyub0UBDxUBTeyqD3D7DEgJvqL82XRtZcl+PNYbwWsBYxCCwD0HpntPifMVaqQ83+HXITA/kT4Lg/J84Hdo0FZl86bfiymPXxTEBwDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881461; c=relaxed/simple; bh=zRw7b4KxY6XwSKZoRGW1l0s8wJscpuoS2KwZ+Arhbyc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Csqd/0hvat50Q2H20b1jcqo3HASgUcIVr9l4HuEU5O8bYoqk+3QP+T3rbwQqGfJSNkhUpWQp4HppELKUZPmdZm6fkrdg8QG0+0WM2ZGI9mqfAunQ6f/cp65lNQNAbdm65MMtF6KcuglUIn3J09T94Xjk7UZ3fG0fzg88hBtN0pY= 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=gA0tAO5O; 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="gA0tAO5O" Received: by mail-io1-f50.google.com with SMTP id ca18e2360f4ac-7e2025c3651so62759139f.3 for ; Thu, 16 May 2024 10:44:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881459; x=1716486259; 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=IQuNI/VL3/Itw4aJGKYcYvYUzx59qbXu6ruzCspuP/A=; b=gA0tAO5OytNtZ89he8x72sobhp9+pnpCyqivVFCut5NA1ebXrgHDy/LknpMxVz7xJa xxSIrpYS1jPcopE4Gj5Wk3R85PzV9EUXIlwnoTduROaTRTgRGwGXOwt1zu/aom/IA1K0 BHJJqZvdr+0GNK9xchatp6D/Pg2I8D4p1aaqIuPkl/AtpjQPaksSs+7cm2Al1xFuWSjV Zhk1OPN1eYQJayp2AuxV3YFJelr7Hg8/7GZdrSc2nvkmA8q93u+ws6iGPZRl+dL1mFNN d8T4hcbcoM32unrcMksEApbxR4NiX8EA1XSa3YWTU4INvey/HTOrhWAOxDbnjBXtZrQW rjWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881459; x=1716486259; 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=IQuNI/VL3/Itw4aJGKYcYvYUzx59qbXu6ruzCspuP/A=; b=OuUtYx1hqJ5vexj0jmQ97oBReaopyRmijGFwbyyvDnc2/DtkVOu1LoMmX4swk8aBQj 77qNk6ByKJ8v2590UpUpeQWzpAANpDFt/xbdJQ4Z8HRKaU9Rvou9SXJdryLqtmGC8LYI 9TyZbTgaHhF2xzl3jEtDOccHQP6jO4m0sJRohvPZrngeJSi8Aq31A/OO5KZX/itRrY4H UqnF7wA9mTBW9JYyUHuXBXblPx4xohLU5KwvF+eV537Pky0idJ3WNC3rPth/hD98o6iM HyLtRjxVK4NlYYhqdJW/3/o0JsrCb7nX0F5J7rRQioF+OXmjtFThlR73uBWJjN7wW58T l2IA== X-Forwarded-Encrypted: i=1; AJvYcCWYw/Ayti3uFD6eWytFxqK+C6qK/2f7xp/O+5GXHhT1dOR06sYxV6s1f+3knFL22jdDz8QemO1HJJoHB5OZSxQoxDZqS8CUIXqAZ+gB X-Gm-Message-State: AOJu0YzEnLd29/ZVUt23d9T6IwP5gpXJW+/NNqQlvurRdN31KzEidXr8 WaIBXsHbo6aL8qBmoLGJXU9hIBUy5VwnW6P193I258h5inLBIT4c X-Google-Smtp-Source: AGHT+IEf7CGzZ4PWnr6XB/a/3ybomaaf+WvBUPxqjK+CuOxKiIR+I0SpD/Ou7m4w3zDhAPmCoe+f8w== X-Received: by 2002:a5e:8a46:0:b0:7d9:a53a:c9bc with SMTP id ca18e2360f4ac-7e1b51c7b16mr2196661039f.10.1715881459466; Thu, 16 May 2024 10:44:19 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:19 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 09/33] dyndbg: reduce verbose/debug clutter Date: Thu, 16 May 2024 11:43:33 -0600 Message-ID: <20240516174357.26755-10-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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 no functional change. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 4a48f830507f..368381dbd266 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -266,9 +266,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 @@ -501,7 +498,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--) { @@ -515,7 +511,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) { @@ -531,7 +526,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; } @@ -541,7 +536,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); @@ -559,10 +554,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 --=20 2.45.0 From nobody Tue Feb 10 23:53:35 2026 Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (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 58F07158201 for ; Thu, 16 May 2024 17:44:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881462; cv=none; b=VDJInATOiGewG+OXXjkLt2hCygR8cp2AK+lnEARibgIVFla368viYqQ2T4VUoJXWJXrHsxxbXlXV9xuzfQlUk+XDSTTaA0aFmZTeK0jE8z7sLzoP852xvJe9AZrI+1bylxWtdxbjzFBHmGlNls+FrbCbpktjZ4T3Y5WVdTTzDmg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881462; c=relaxed/simple; bh=9XiOjohp1hYJYfm2iFjvfUXyGkHh7anpuGPbKPE4nT0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l/PVLg6VOCEVHCICnu+KbhgW+U8AGhpuAb18Rqw87Sgot9dE3vz2ffn1/SSt3lIfovYABlEZcPY79zE1QkygPfXv6JsMQxdSRM+9PDrS7j9JI/4ZwwPU5BazvwQM/Agqeh/Pz6Mp7oBVPZILRFrfF2NjJpcjxpDNLC6Fy7N6XsU= 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=HJtJ/iFY; arc=none smtp.client-ip=209.85.166.46 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="HJtJ/iFY" Received: by mail-io1-f46.google.com with SMTP id ca18e2360f4ac-7e1e06c9a10so67174339f.3 for ; Thu, 16 May 2024 10:44:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881460; x=1716486260; 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=qrAtiNlsGgy2mJ/VgmedHbqkrfkDf3H48YRHd61EFag=; b=HJtJ/iFYqAXIBGWex8NOCqZAM5Nkv9BSAcn+kqGVRDJBgd4wKvUQecmOaF+Da/6OJj vmfoofYyahFFupzihDKp0oGAcStoabncIZoaCl8DTob/RaS0pdnGjqCntREq1OmZ6wvL HKbiDsOjJihYMyjH8G5V34tln9kzGbtORqLgeIlYCcdIBCejbqiI94514kkpqiU6BA1+ imcex4EueTjvPIThnIb4c0qKFpI6SIlda4wEa7vezetzO+c2LU0O1dJCmUO/Fq3kMwHI z8L0ChKfd9g7KgVTN6sj7xgnYKGn2yJYWEKLzM/sAvCdr9TSM9vnWgiPtaIgVAZTgxub PnMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881460; x=1716486260; 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=qrAtiNlsGgy2mJ/VgmedHbqkrfkDf3H48YRHd61EFag=; b=gzMdb5u5DmxndFsowR0CZuxbDYiwtnY2+bfzyh6F4eHpgvwvPySQQL+ndBf6k060Q9 Mn5eL5CbhG3hW2brBVogJK7vm7/+79LvMUmAQdXBvnxFRz95pEoZ3CfxHRWL1hJMp8k/ gQJrpj8h9b6m1fc/azC81LWpcK/vAyCPYbjBhcYOHWWAse259EYSRT6r1hWxF3ZyEhrv PaPAiku3jjWF0rN8Tt9t8S+omad2VOFNCfHv38MmwUcHEb0AR/MLiblItR+D3gCp4hY5 +8Jk3nI84gWE/MNY0hturlQQ/mNGHXw/6RJwkOmnoilP6nJtaVsJUw+tlJdmisZLwZqi FM9A== X-Forwarded-Encrypted: i=1; AJvYcCUeOMzyAwcn6huiBQnKec2FcDPHDyDwkiEE5B9vyDwVBw0+6bK4uCuJS62l49NaEG1zffT/y2Je2AbSa+qlcUo1TScyBj4JGyEWdDeC X-Gm-Message-State: AOJu0Yxg96+nowgtSO0wyLX8rtsz8bUm+6X+yCXTh51PeaXIhRvQfzdf Z3NogIgjma6GRkGTF4BJvqH/eMuuCjfAWW7Qn6bKzloOo38AxfjA X-Google-Smtp-Source: AGHT+IFMd1pg5rsL5/HOW38BU5NB/dLpvbMDich2MsVqx7QRoTD72I08NOTev2lFylCy2uQZMmwNZQ== X-Received: by 2002:a6b:6a19:0:b0:7de:cb15:1b17 with SMTP id ca18e2360f4ac-7e1b51cdac0mr2038560639f.9.1715881460566; Thu, 16 May 2024 10:44:20 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:20 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 10/33] dyndbg: silence debugs with no-change updates Date: Thu, 16 May 2024 11:43:34 -0600 Message-ID: <20240516174357.26755-11-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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" In ddebug_apply_class_bitmap(), check for actual changes to the bits before announcing them, to declutter logs. no functional change. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 368381dbd266..8320cadeb251 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -595,7 +595,7 @@ 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, const char *query_modname) @@ -606,8 +606,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 bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, *old_bits, - query_modname ?: ""); + 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)) @@ -622,8 +623,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); } - v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, *old_bit= s, - query_modname ?: ""); + if (*new_bits !=3D *old_bits) + v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, + *old_bits, query_modname ?: "'*'"); =20 return matches; } --=20 2.45.0 From nobody Tue Feb 10 23:53:35 2026 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 955C01586D5 for ; Thu, 16 May 2024 17:44:22 +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=1715881464; cv=none; b=RGIiUaJT1L8gRs5pjQfrma2shRt44/tsof1RRet/2Sh3+r+Vaw/w4hZdG9VQEFlbIsumQuKTMPBKyw2XUYvLb2sE6ZmQEqgup/k+X806Mb+cUx0rgpgTxmbhcUM/wrHd4m4zRrNNEi+pcZq8ABd9vUSPes+tW1MrbQ5hiIjgyP4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881464; c=relaxed/simple; bh=iO0MZt52UGy5H1+g6AWhRjkXHqyP+g8jdyAnsD2e2M8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Uyr2Ny3vb36m/qiFa89Z0gy99S8s0mOlmEEfYHNRNfE10ZQSdJuPyvEXdpEUQ7UPcb3ZVK4XdBo6FM1ozmxAqDXeNspy8PjDKx+O6bXo9xn+6IMdkuogreQytO49f/pM/sRfhTT555LpBZqwa5ArKvdmkja31YRPKLj1vGtHIvI= 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=Aa28q5C7; 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="Aa28q5C7" Received: by mail-io1-f54.google.com with SMTP id ca18e2360f4ac-7e1b8e3070aso63224339f.3 for ; Thu, 16 May 2024 10:44:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881462; x=1716486262; 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=mt/Bqz8yq2vitOa6vLYoJ1/uTqX72QPUfR10FKnlVc4=; b=Aa28q5C7i1EdG1586w6ZiwgREwPAO4yUqq4XbOCFj4S0zdv6UneMw3kIuV9aGIgp4p GVd3YX1nvNFEDBWigtsTTgn+Nx8Qycpg0lWprl5hkMnBBL3iKuWCAhiPegecGR83jqAh JUv1VgsMxrugS1QbZIYMbcihBWrZwsPnQ9UgP/oEYC+zMoZclAtblaeDGcdiPUMt0Vh9 qDeW0EtPjoT98te5EHYBYLHsGfUu9rkhNxP5DD+SrYRhremSLO3oQHODhxUDYlQ0CeMX Oy8HdjzHMx+3Y3A3flJl7FlauaBrdtv3EDHCooTz/6rtPsVLXJDDaMGnKga+T1l3YU6m cPTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881462; x=1716486262; 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=mt/Bqz8yq2vitOa6vLYoJ1/uTqX72QPUfR10FKnlVc4=; b=QL7zupvN6m3/qCRcPEm+OeLIogl0R3+tK5Nv3kh52ZsINUcfdmKDDFpJJe6AuDDoFd aG/fTd5X4XL/dd37lg/THMl6IAth8erSWOV2HbUfAdM+wdWwhor7EIr1dDJUu97TwSVM zdbIMjC+PDeCsBZCpGuDJtHKW/fYTPobyZo2oNLkBBto8xH4M2sV2ffOzvEQ6oF3jRRJ aWoIGSN2FfUbb/d/TaLXHqd+4QGVidB67HKcT2PH7zew8tpi6BD+xGIpkq9qQBMkzK7R rxaxdc6v6iHBt2p/zt2UCTtEkZ3bHKrYUk7JBgSH5IUQDpHAjggPHweDylT7DAALJSap 37Yg== X-Forwarded-Encrypted: i=1; AJvYcCUY5eTfRjgEoOsX5xhlPe63enZyOz8PSqfgykhBvkT92p2TRP5OyPniht8Bi3zv3v7FcFicG4Qdq74reXOsIQpohunFslBx4FumdeWa X-Gm-Message-State: AOJu0YymjfTNJ++Wp3oD7GDPDm9gmpfBQsc+izF3aVYuMPggiLQ+/mvZ lr4SdWLibOe+mhT9WCqFqB9xvnZdPGcgrUgrvvZbq9jfSNE8ijWO X-Google-Smtp-Source: AGHT+IGdYGsd3uiXdSUv74wkg3MOKXq35Pa4NZvpFjNk3CNfp7BjHn5hkIKln1xsbsv61dHhk4cSGw== X-Received: by 2002:a05:6602:97:b0:7da:303c:b056 with SMTP id ca18e2360f4ac-7e1b51e331cmr2129969839f.10.1715881461680; Thu, 16 May 2024 10:44:21 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:21 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 11/33] dyndbg: tighten ddebug_class_name() 1st arg type Date: Thu, 16 May 2024 11:43:35 -0600 Message-ID: <20240516174357.26755-12-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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" Change function's 1st arg-type, and deref in the caller. The fn doesn't need any other fields in the struct. no functional change. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 8320cadeb251..882354e1e78f 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1120,12 +1120,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 =3D dt->classes; + int i; =20 - for (i =3D 0; i < nc; i++, map++) + for (i =3D 0; i < dt->num_classes; i++, map++) if (class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; =20 @@ -1159,7 +1159,7 @@ static int ddebug_proc_show(struct seq_file *m, void = *p) seq_puts(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 --=20 2.45.0 From nobody Tue Feb 10 23:53:35 2026 Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) (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 9D0F7158853 for ; Thu, 16 May 2024 17:44:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881465; cv=none; b=n6yixIZT/5LyzzhBVcc7gSeyu+fywUG38tkFUkHEtNe/qUFP52RGCQREANBoFXnjxcUAIWcDLIkQybA5AghCud7gS9Hc8Edm060unYU/xbKRofxvqTj/ra6EB2hp7YuXMpm8ebIi7bSLO+UfZgc+oMnOZtCrfuv+ObX5jZYQ4JQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881465; c=relaxed/simple; bh=DES3NQVjSftPoIo/YZX4J19NesczPszboxMHXTH93go=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I1m8R1vX020q+oXiL9envoGF40Top4tD2LwvmAzhbhXVmI6h4DEGLt+lJH6pY22w4hx3PeOpg382ze/cXgIlwMUD+QBub9HX5PXouBaPU6kEwWaBS4I//ba8feYlRC0/v+qE8QpNHgaYoKnEmW4hDPdCCb0B5N9ipMGTMF3QhYw= 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=bdGVBjrJ; arc=none smtp.client-ip=209.85.166.48 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="bdGVBjrJ" Received: by mail-io1-f48.google.com with SMTP id ca18e2360f4ac-7e1b4f96994so66976439f.2 for ; Thu, 16 May 2024 10:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881463; x=1716486263; 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=+/+BGhbOz9ThsBPVSV0xCuQLzG1RnkW6Je60rnbWJXc=; b=bdGVBjrJT+4CUC+aVefLyvB5s7PHofoJPwlAG3TZ59vyiiywI162CCYK0UpCOn/6Ls 4PCrAPBZbO4XvLq4+shIa/Un/omaRVh55B+T2708txQixFSSmnSRNAVxWlw8aBwbVrDG k/La9LV28B77nNuIGWX2W4Uca2F5Mk8HV1e88HwypPofjDPxNit5Gzlwkos7tn8iXcIk 6aJaphsR/hArRwZl3JJch3D3ks2x3TF8H+GQeAkILx5VnI0Au2FwabOX+LOUWr8KTp5B pDIQ7H8ZUUADsl9zMHiroV/VAIKG7+Ij1A3FaSerLmz2DkefkTJL7sJA5XHLuGnurfx0 N8xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881463; x=1716486263; 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=+/+BGhbOz9ThsBPVSV0xCuQLzG1RnkW6Je60rnbWJXc=; b=cQLiIQ6xPlZrhkLqVCbO4xYdHXLBhM0fDm8p7Q1Q7Uwh5K7rTQFwcIYBcQWBMIL1wi EYxDq+3uTERcpBp+LGf2qZEYmhy/zdTx+r8TXrNXaWVGSaBywmpwocKDX9JJF4WDeifx AtvthcvUD6uDQqi/u1tKLwWuGEDvFg7kANnv4KUHzfbIi5c9jAsmwG+eO3SlRbXczuoz p81a+9DPTBOAt3k3H6pfIWbB1iA5I9+lYuy4/Lh7P2IwfNDOnNHp+Rv3Gzt/AFF9AG2p /+sVia4iljnZuLA5S2953zHmFBzDlKyRkdkUoQe7R7Ui3PuwtnB/fg36nV8vawuAwubJ Yn2Q== X-Forwarded-Encrypted: i=1; AJvYcCWB+56V0W7AS5dZWkvEjKsM9CfQDjexXWekQ2qC11O43zEtO8b3c/3pMFFixZmmEVdPu42nW3VL1/3WJKOaE9TInzLQ/rSWUUCJmisQ X-Gm-Message-State: AOJu0YxJCQ0fC+bbX6XOakuxvGgo/CnlT6qDrDZ8T7j4Veb5kham6TYC aQ/DLSjRpgggdntIIWsGc0Kig85VSUic/lS6UxmcbZIiUz+D6U61 X-Google-Smtp-Source: AGHT+IEO8piBRBYI+ag8uXzaA691Zk/hAKmJ0I9kwSMmOeM7ZW8xidVBF2U7n3baRxAblkrJqSJrnQ== X-Received: by 2002:a05:6e02:1c23:b0:36c:4c02:f172 with SMTP id e9e14a558f8ab-36cc1465d9amr217350185ab.17.1715881462782; Thu, 16 May 2024 10:44:22 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:22 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 12/33] dyndbg: tighten fn-sig of ddebug_apply_class_bitmap Date: Thu, 16 May 2024 11:43:36 -0600 Message-ID: <20240516174357.26755-13-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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 --- 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 882354e1e78f..d4a0ae31d059 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -597,7 +597,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 @@ -606,12 +607,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], @@ -623,9 +624,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; } @@ -681,7 +682,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]); @@ -691,7 +692,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); @@ -745,7 +746,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, modnm ?: "*", KP_NAME(kp)); - totct +=3D ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, modnm); + totct +=3D ddebug_apply_class_bitmap(dcp, &inrep, *dcp->bits, modnm); *dcp->bits =3D inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -758,7 +759,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, modnm); + totct +=3D ddebug_apply_class_bitmap(dcp, &new_bits, old_bits, modnm); *dcp->lvl =3D inrep; break; default: --=20 2.45.0 From nobody Tue Feb 10 23:53:35 2026 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 9A72015886B for ; Thu, 16 May 2024 17:44:24 +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=1715881465; cv=none; b=qZ1xbqOdQOQ4zSczsW8mNV+Qm8XrQ5pFOB89p+xRVcgsIZlih5DwYQR8jiwimBqMcUOGsf2O6gaAA6dYjumIzzjjKa2YIo19c/gtErLJ2+OedF3trE5URhryjrzj+RP1ayLzqiFaC5hBJJ8YOn+TZ0yxPoD4RXTOg+inVWQ4uvc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881465; c=relaxed/simple; bh=1zJyuDbvdt76ut8RigK/vWcBb0NOz4ONeWxuQgM86HI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cW5GyN+nZwPKCe5b57LzWJ6h6StA9AVhwb4LddXVeueV9NnSJ3FxhM2uvKBGpSlUl1W3pLCSs4khIE0QEZkOZc3gbltjShFaC2TpMckWaYMvMXrvO62zAMYHK/2RmikiGcOO57NyYxMn4GB9CiIwbsuh1MT94nqeb4ldM78IgyI= 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=GV4huTzr; 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="GV4huTzr" Received: by mail-io1-f50.google.com with SMTP id ca18e2360f4ac-7e1fcd2e6a4so68406739f.0 for ; Thu, 16 May 2024 10:44:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881464; x=1716486264; 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=CW/yUhWkDFIutai+S2266F3/sOkg2CArhcP/x13Dl2Q=; b=GV4huTzrrrhJbSWh+zN/Vn85oPShISKxvljFVMmAUiiGAaoy8hL+jRf6+VdBfKIjuJ 67PKX+WVJ0IKTMRMTZNhWAj0vfAfmAvtszP32p4Tk5MWc5CalBDt/A68tBxxyIEozl0k cEWod84McIZw7fiyojeRu1KAt3v5Tvzr5xO29lSFWlE1KlMDmV/x2/I3rbJCy5AiVZe4 ukGwxy8YGt3fyx24XZgppzsuiHFXlkprSxqg2VMt5aLg2bhK3J7I93ZG4gDfjczB1eCw Nc2PWSZu1Cup0nkDqqmEuGRJkyzhdOP2oNI2jnxK2wGAIWhKh3nIXpROCz3Le83WaTcT 9VTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881464; x=1716486264; 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=CW/yUhWkDFIutai+S2266F3/sOkg2CArhcP/x13Dl2Q=; b=I+8NqLH5sLUOS2ZDXfReqNQ3EMyIB1mKh8uHWzgaRQmOOVSyf048T/X3ueVMaeXm0Q nGHxMkK+a9073pwFjf5/mVr6m7CtZJTvPgnDy0FUG35F7fSKzmrdUJjMIXy2Qe1ThhGB AsIrZoN6HvsUGA7p04O1uC655y/+N3MTjAttg4YyIMvTRyS3hJWFWxt6ZfE4evSTZ5rw +pBvQ5f2EDfnLIUKPPahT1nDFEiiubqPMMX9jsFX41s3PJmPaCkMvThsiXQq+f/YwYhy fFvNykPI0rej6RIahh29irLLIj5WZSf/lBNanrJn5ByaVgLe0CZBZbyrYeitxWKnmJge 3Alw== X-Forwarded-Encrypted: i=1; AJvYcCWbFWm1A1DhI/6jufqC7F3n5kLvHnaOM09f+DEswSEFe0w2fo8FxvZZROLPEtprxsh6gka+MneWx5pM7tUm9s7kj9v0H1go6pKCjPzM X-Gm-Message-State: AOJu0YwznYjWeDs28SJCQcioUtaCrvHuFzFWjawxdyUviC6MHFYWNrrf /7nSG54IKM7/hZ+iLPrxE5zSUXSYl50StKWH+uDaAWbKOgeM0QIq X-Google-Smtp-Source: AGHT+IGKvXM7HiYApge8E9iHu3CPKE8EAuEa+F+s+rWEqnJnm+wJU4zHZoweXZYq2tnSMwYjgjJAHg== X-Received: by 2002:a05:6602:21c2:b0:7e1:839e:5ab1 with SMTP id ca18e2360f4ac-7e1b520c50bmr2909385539f.18.1715881463929; Thu, 16 May 2024 10:44:23 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:23 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 13/33] dyndbg: reduce verbose=3 messages in ddebug_add_module Date: Thu, 16 May 2024 11:43:37 -0600 Message-ID: <20240516174357.26755-14-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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 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 --- lib/dynamic_debug.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index d4a0ae31d059..43a8e04b8599 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1245,11 +1245,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.45.0 From nobody Tue Feb 10 23:53:35 2026 Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) (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 A6D11158A05 for ; Thu, 16 May 2024 17:44:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881467; cv=none; b=qHi2sXt/TbnJREN+ToqJwCuosnRe/xNM9ueJ6LU+KvQZuomWi/c1uMCGhgUAWXHizJPQOynMf/lHGef3MwsFYAuE3GWx8av6Ko8E2O85sZZf7O+u5228a5kf5PHcMDkerPNUiQa4MNgDInhc8y7R21woNuGJD59VBVi63r8xLi8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881467; c=relaxed/simple; bh=JY2yY+h26ili0Jqs8gRO2SBW5HCtmd5r2LSI6QRCJ3E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LZDDnfShDdN7jMSTOWvRqz+Q2tC+CNelnjWtMd+sQPwJ8lWvpGG5BUbqTmKu5ncQoYaGEfC7YBfYNOCbCnGmGLHOeZ8RDkOI3X0KVBQjUFV5pIWjv2pIYqtjrZiVu41tfUYIUlCLAMfbb+RmvcwZmwJlacFeO63SwCFBeJzT/ls= 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=l92o7HQY; arc=none smtp.client-ip=209.85.166.43 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="l92o7HQY" Received: by mail-io1-f43.google.com with SMTP id ca18e2360f4ac-7e1ec659c40so65670439f.2 for ; Thu, 16 May 2024 10:44:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881465; x=1716486265; 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=prZ79tM37p2QTeMTU4JJC7mhNcimc2YYRVfFXE/u4UQ=; b=l92o7HQY5L0eSSoYNkJCAV9e6lplBQ/riEGViNRGkfLo2+sjgNqpygtLZ3+aNjSXLI X3QMX6T/KwCqDIxr0Aga7/X4ia843aYaWP8eOsAB7/H5NpnBIdgfM3uOx0Sc6nffshwG zUv/nd6iZQXZOYsm++Q2w3MH2WgUVSE6eqVDt6tAVNIm/EVuExZkrPrE0W0ouoTT/nDG OHvMGTDJOZDvzzugfEY2W5hGU0/VURQC4Xeui1191GkLY/C8VnZDcL3IXRIoYAGY/35k yhao15Hg2hMybmES+UF7bscZRt4/bDVc58eGKxu3QOcjEa+JuwlwxX/RZxkHTO4ylLAc S26w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881465; x=1716486265; 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=prZ79tM37p2QTeMTU4JJC7mhNcimc2YYRVfFXE/u4UQ=; b=IJ+iXJYWkrznkNaNQIU77l9oLzNKzXkPArk9s30peeykT5anOW+cSWcmUjE9U69m9C 3j3G8qT7gv5QntlN4nma6KipG3afQ3nyU5+FolncCULDqKYXk08Nf9NvDWP7o2prJbfB kR3eSgtZlfDqjk+Ox/BVK1WUm0d6cHM5TZCW6PgGeoC9ADEmmfR8Nf8pV3cY/5MK/wrE HO5isQhdMJnq11NurJJWUOige2QD7/OZ6T2vlIkTzbBWN8y/D6GgPWmEwqGjVbSJs203 VjFkOMLAF0DrcqU8MM+95hZg+aCk1rc9qhx3Ww8udmiTPUX/lSosJp6W7A35AZ0ZdK8A qOuA== X-Forwarded-Encrypted: i=1; AJvYcCUpKPXZcQgvUq9feDrMdFX1QmOcbEbXHF/n7mYjuc2bkOrCQsnJqUAr1gwf0voQ1b67A8NMtWoURkVUiafvlaxl1ts37q/qGdBsHBZG X-Gm-Message-State: AOJu0YzrOUUpbORcm6z44HtWlaHa3N6DWN52sonjo7vNb1czuBlwUEE0 Ph1aabFlxASUA2kJZKZCTyOsGL/NTuaUlBTyqPeXOnL6OD3kX771 X-Google-Smtp-Source: AGHT+IFNIkc3Pdk6mdTmUFcxDYp9qI4dQMBsVlDM/zqu5GpQjK54TeuxCOKPjzGFm8ZgjGovqIYdUQ== X-Received: by 2002:a05:6602:27c1:b0:7e1:89ca:3b5d with SMTP id ca18e2360f4ac-7e1b51bdae1mr2844590539f.8.1715881464943; Thu, 16 May 2024 10:44:24 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:24 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 14/33] dyndbg-API: remove DD_CLASS_TYPE_(DISJOINT|LEVEL)_NAMES and code Date: Thu, 16 May 2024 11:43:38 -0600 Message-ID: <20240516174357.26755-15-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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 NAMED class types; 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 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 8116d0a0d33a..dd304e231f08 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 43a8e04b8599..d5701207febc 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -636,76 +636,6 @@ static int ddebug_apply_class_bitmap(const struct ddeb= ug_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 *modnm) @@ -714,29 +644,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 */ @@ -801,12 +719,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 a01f0193a419..9e950a911b6c 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.45.0 From nobody Tue Feb 10 23:53:35 2026 Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) (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 482D1156F2E for ; Thu, 16 May 2024 17:44:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881499; cv=none; b=h5CHY4ZpbIim5s0eiaeAlEY96oiF9R8ouwwMX0jVR54iMouST5InaswakPaV4D32SpgoOTeezpGex8dHMGGWymj+XIcP9gjOvJfWxyWJBv0yumy4dEKp032IXz633pwum7NQyDTJSUKpr20rlyyZhy6LHER2Oia2qn2TABs+d/s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881499; c=relaxed/simple; bh=DmuEyVJ3zel7Cwxdtu87fI+7DT91cMlo8/zBIf1rGS0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lvcOPNACIwLuvn8uDYMviK/2K7OuRQOE2w08rtLa1FyOfyyOx9kuMzkKKbrznXo+lSVl2lIJ0Rk0WhBBckVmHaU+tkRo3R9mL/+cUzlq83DhIUBFiyi9F7zFgN/TqTwt4llIgJsQ9ws8lIwqA9WXqbPD9vxbmhwt6uJL0ltRyLY= 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=TSznOMxD; arc=none smtp.client-ip=209.85.166.43 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="TSznOMxD" Received: by mail-io1-f43.google.com with SMTP id ca18e2360f4ac-7e1d1caa7ffso66180339f.2 for ; Thu, 16 May 2024 10:44:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881496; x=1716486296; 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=xQHGvdgUCHSxovfidm0O/na0VA5e10K5IsIXdN/i1OY=; b=TSznOMxD7Lhrf9W7hWcYGJmPr7ItsH+5d8OrHGgvt+XxNVWhcknSVXmcftpxy5xGPK yuU1o0rhPMZlhbX2mplhqh00FbmGtNO2gv2ARRs3L6SBIDiwtfcQNNrtg5Y046Y7Wegr nwLo70GCroVpaLHvnZ+x+sdxqi8cxW9Xg5K3YdsV3aSHUxEOEfvvn8ntHNFEqOXOhHSg JOxCiaJYqEjlaw27U80RM3b/VUzfqnm2bzkm55t+sSJlbj2w6sbMjy06N8ztv/mqOBxj WW930oGLxbN9ApuaGJ+8JZC37s9NAvPAMjDxpQjZ7q5fN+OND6Kj1tT9dCcLpqqpyEp4 1NuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881496; x=1716486296; 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=xQHGvdgUCHSxovfidm0O/na0VA5e10K5IsIXdN/i1OY=; b=WQWjP0Azv4BlvqvhpRLAwsj+4Okfu6yVML64eJhin1t+HjZv4cJq+2fQ8Bm2XFS01X WwfpI84EEN0M6H7TrI3zwZHHUXEmRjx0ui+yRTdahkSa1RGEtxNym79aeqUEGGzJ8jAI EriGAa7VQv5j7k3tveL3DaAye2tgSbFVRZIKhJksAPRUHGgYjGxhJSRu7MY1/3rAmtOC PKcWtziRRcB9aYzlj+pbzeOaH6TETUOKlbM+YRRcsZHuWoKqkm2+RrPxfEekN79Wgad5 QaAlj7CQLP7KmAkml/gVggq3kJntmVAD8Qcnk0Yj3sCahhvwS5T16enpjp875lyedHXO H35g== X-Forwarded-Encrypted: i=1; AJvYcCWJvQz75bDKB1JxVXpaOYehwGup+zEXZX+gS/wFf4AJVt/nfo4vZXktcpx2VslXnEwrcV1m9vOFM8elZ/AM2eYQRCixYnekbozlpycO X-Gm-Message-State: AOJu0YwypzFcNiQc+Zky2QIcn3TKdJo4+AQ5I9z0cREmFMZdGi4ey13f 9f0iAAysyalkZjd/dMmrSBCwSDC3/X2odNGxaSSqskQKg2f1F1IK X-Google-Smtp-Source: AGHT+IF3J9qunfV5Hl9YSCSV9Vj3MWBiWGCtp8gSrxp9EVJskpjSwoGTy2auojWkGcwvP8ieiQs9kw== X-Received: by 2002:a05:6602:24d7:b0:7e1:8191:f59a with SMTP id ca18e2360f4ac-7e1b51ba7fdmr1879079139f.5.1715881466117; Thu, 16 May 2024 10:44:26 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:25 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 15/33] dyndbg-API: fix DECLARE_DYNDBG_CLASSMAP Date: Thu, 16 May 2024 11:43:39 -0600 Message-ID: <20240516174357.26755-16-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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". It is used across DRM core & drivers, each use re-defines the classmap understood by that module; and all must match for the modules to respond together when DRM.debug categories are enabled. This is brittle; a maintenance foot-gun. Worse, it causes the CONFIG_DRM_USE_DYNAMIC_DEBUG=3DY regression; 1st drm.ko loads, and dyndbg initializes its DRM.debug callsites, then a drm-driver loads, but too late - it missed the DRM.debug enablement. So replace it with 2 macros: DYNDBG_CLASSMAP_DEFINE - invoked once from core - drm.ko DYNDBG_CLASSMAP_USE - from all drm drivers and helpers. DYNDBG_CLASSMAP_DEFINE: it reuses a renamed DECLARE_DYNDBG_CLASSMAP to construct the struct classmap variable, but it drops the static qualifier, and exports it instead. DYNDBG_CLASSMAP_USE: then refers to the exported var by name: * used from drivers, helper-mods * lets us drop the repetitive "classname" args * fixes 2nd-defn problem * creates a ddebug_class_user record in new __dyndbg_class_users section this allows ddebug_add_module(etal) to handle them per-module. DECLARE_DYNDBG_CLASSMAP is preserved temporarily, to decouple DRM adaptation work and avoid compile-errs before its done. IOW, DRM gets fixed when they commit the adopt-new-api patches. The DEFINE,USE distinction, and the separate usage record, allows dyndbg to initialize the drivers & helpers DRM.debug callsites separately after each is modprobed. Basically, the classmap init-scan repeated for classmap-users. To review, dyndbg's existing __dyndbg_classes[] section does: . catalogs the classmaps defined by a module (or builtin modules) . authorizes dyndbg to >control those class'd prdbgs for the module. . DYNDBG_CLASSMAP_DEFINE creates classmaps in this section. This patch adds __dyndbg_class_users[] section: . catalogs uses/references to the classmap definitions. . authorizes dyndbg to >control those class'd prdbgs in ref'g module. . DYNDBG_CLASSMAP_USE() creates classmap-user records in this new section. Now ddebug_add_module(etal) can handle classmap-uses similar to (and after) classmaps; when a dependent module is loaded, its parent's kernel params are scanned to find if a param is wired to dyndbg's param-ops, whose classmap ref is the one being looked for. 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 to contain the new section: 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() already calls ddebug_attach_module_classes() to handle classmaps DEFINEd by a module, now it also calls ddebug_attach_user_module_classes() to handle USEd classmaps. To avoid this work when possible, 1st scan the module's descriptors and count the number of class'd pr_debugs. ddebug_attach_user_module_classes() scans the module's class_users section, follows the refs to the parent's classmap, and calls ddebug_apply_params() on each. It also avoids work by checking the module's class-ct. ddebug_apply_params(new fn): It scans module's/builtin kernel-params, calls ddebug_match_apply_kparam for each to find the 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. DYNDBG_CLASSMAP_DEFINE(.. DRM_UT_{CORE,KMS,...}) 3. DYNDBG_CLASSMAP_PARAM* (classmap) 4. DYNDBG_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 DYNDBG_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/N). 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. DEBUG details: ``#define DEBUG`` in src enables all pr_debugs after it, including any class'd pr_debugs; its not necessarily all-or-nothing, unless you do the define in a header. Also, the only way to disable a class'd pr_debug is via the classmap-kparam or using "class foo" in control queries, to address the classes by name. NB: this patch ignores a checkpatch do-while warning; which is wrong for declarative macros like these: arch/powerpc/platforms/cell/spu_base.c 48:static DEFINE_SPINLOCK(spu_lock); 62:static DEFINE_SPINLOCK(spu_full_list_lock); 63:static DEFINE_MUTEX(spu_full_list_mutex); Fixes: aad0214f3026 ("dyndbg: add DECLARE_DYNDBG_CLASSMAP macro") Signed-off-by: Jim Cromie --- v8 - split drm parts to separate commits. preserve DECLARE_DYNDBG_CLASSMAP to decouple DRM, no flag day. fixup block comment v7 - 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 --- MAINTAINERS | 2 +- include/asm-generic/vmlinux.lds.h | 1 + include/linux/dynamic_debug.h | 62 ++++++++-- kernel/module/main.c | 3 + lib/Kconfig.debug | 24 +++- lib/Makefile | 3 + lib/dynamic_debug.c | 183 ++++++++++++++++++++++++++---- lib/test_dynamic_debug.c | 111 ++++++++++++------ lib/test_dynamic_debug_submod.c | 10 ++ 9 files changed, 331 insertions(+), 68 deletions(-) create mode 100644 lib/test_dynamic_debug_submod.c diff --git a/MAINTAINERS b/MAINTAINERS index 28e20975c26f..c9ed48109ff5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7526,7 +7526,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 f7749d0f2562..f1d8e64b244c 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -365,6 +365,7 @@ /* implement dynamic printk debug */ \ . =3D ALIGN(8); \ BOUNDED_SECTION_BY(__dyndbg_classes, ___dyndbg_classes) \ + BOUNDED_SECTION_BY(__dyndbg_class_users, ___dyndbg_class_users) \ BOUNDED_SECTION_BY(__dyndbg, ___dyndbg) \ LIKELY_PROFILE() \ BRANCH_PROFILE() \ diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index dd304e231f08..2c6944c0d6cd 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -72,8 +72,8 @@ enum ddebug_class_map_type { }; =20 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 +81,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 + * DYNDBG_CLASSMAP_DEFINE - define a set of debug-classes used by a module. + * @_var: name of the classmap, exported for other modules coordinated u= se. + * @_type: enum ddebug_class_map_type, chooses bits/verbose, numeric/name= s. + * @_base: offset of 1st class-name, used to share 0..62 classid space + * @classes: vals are stringified enum-vals, like DRM_UT_* + * + * Defines and exports a struct ddebug_class_map whose @classes are + * used to validate a "class FOO .." >control command on the module + */ +#define __DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ + const char *_var##_classnames[] =3D { __VA_ARGS__ }; \ + struct ddebug_class_map __aligned(8) __used \ + __section("__dyndbg_classes") _var =3D { \ + .mod =3D THIS_MODULE, \ + .mod_name =3D KBUILD_MODNAME, \ + .base =3D _base, \ + .map_type =3D _maptype, \ + .length =3D ARRAY_SIZE(_var##_classnames), \ + .class_names =3D _var##_classnames, \ + } +#define DYNDBG_CLASSMAP_DEFINE(_var, ...) \ + __DYNDBG_CLASSMAP_DEFINE(_var, __VA_ARGS__); \ + EXPORT_SYMBOL(_var) + +/* + * XXX: keep this until DRM adapts to use the DEFINE/USE api, it + * differs from __DYNDBG_CLASSMAP_DEFINE only in the static on the + * struct decl. */ #define DECLARE_DYNDBG_CLASSMAP(_var, _maptype, _base, ...) \ static const char *_var##_classnames[] =3D { __VA_ARGS__ }; \ @@ -99,12 +122,37 @@ struct ddebug_class_map { .class_names =3D _var##_classnames, \ } =20 +struct ddebug_class_user { + char *user_mod_name; + struct ddebug_class_map *map; +}; + +/** + * DYNDBG_CLASSMAP_USE - refer to a classmap, DEFINEd elsewhere. + * @_var: name of the exported classmap var + * + * This registers a module's use of another module's classmap defn, so + * dyndbg can authorize "class DRM_CORE ..." >control commands upon + * this module. + */ +#define DYNDBG_CLASSMAP_USE(_var) \ + DYNDBG_CLASSMAP_USE_(_var, __UNIQUE_ID(ddebug_class_user)) +#define DYNDBG_CLASSMAP_USE_(_var, _uname) \ + extern struct ddebug_class_map _var; \ + static struct ddebug_class_user __aligned(8) __used \ + __section("__dyndbg_class_users") _uname =3D { \ + .user_mod_name =3D KBUILD_MODNAME, \ + .map =3D &(_var), \ + } + /* encapsulate linker provided built-in (or module) dyndbg data */ struct _ddebug_info { struct _ddebug *descs; struct ddebug_class_map *classes; + struct ddebug_class_user *class_users; unsigned int num_descs; unsigned int num_classes; + unsigned int num_class_users; }; =20 struct ddebug_class_param { diff --git a/kernel/module/main.c b/kernel/module/main.c index e1e8a7a9d6c1..9f7ce0f0e6e5 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2217,6 +2217,9 @@ static int find_module_sections(struct module *mod, s= truct load_info *info) mod->dyndbg_info.classes =3D section_objs(info, "__dyndbg_classes", sizeof(*mod->dyndbg_info.classes), &mod->dyndbg_info.num_classes); + mod->dyndbg_info.class_users =3D section_objs(info, "__dyndbg_class_users= ", + sizeof(*mod->dyndbg_info.class_users), + &mod->dyndbg_info.num_class_users); #endif =20 return 0; diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 291185f54ee4..7acca866bb22 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2797,12 +2797,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 exersizes/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 ffc6b2341b45..d3e6a48f202b 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -82,6 +82,7 @@ obj-$(CONFIG_TEST_USER_COPY) +=3D test_user_copy.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 @@ -240,6 +241,8 @@ obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) +=3D syscall.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 d5701207febc..f0a274a3cc9e 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -43,13 +43,16 @@ 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_class_user __start___dyndbg_class_users[]; +extern struct ddebug_class_user __stop___dyndbg_class_users[]; =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_class_user *class_users; + unsigned int num_ddebugs, num_classes, num_class_users; }; =20 struct ddebug_query { @@ -148,21 +151,39 @@ static void vpr_info_dq(const struct ddebug_query *qu= ery, const char *msg) query->first_lineno, query->last_lineno, query->class_string); } =20 +#define vpr_dt_info(dt_p, msg_p, ...) ({ \ + struct ddebug_table const *_dt =3D dt_p; \ + v2pr_info(msg_p " module:%s nd:%d nc:%d nu:%d\n", ##__VA_ARGS__, \ + _dt->mod_name, _dt->num_ddebugs, _dt->num_classes, \ + _dt->num_class_users); \ + }) + #define __outvar /* filled by callee */ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_tabl= e const *dt, const char *class_string, __outvar int *class_id) { struct ddebug_class_map *map; + struct ddebug_class_user *cli; int i, idx; =20 - for (map =3D dt->classes, i =3D 0; i < dt->num_classes; i++, map++) { + for (i =3D 0, map =3D dt->classes; 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; + vpr_dt_info(dt, "good-class: %s.%s ", map->mod_name, class_string); return map; } } + for (i =3D 0, cli =3D dt->class_users; i < dt->num_class_users; i++, cli+= +) { + idx =3D match_string(cli->map->class_names, cli->map->length, class_stri= ng); + if (idx >=3D 0) { + *class_id =3D idx + cli->map->base; + vpr_dt_info(dt, "class-ref: %s.%s ", + cli->user_mod_name, class_string); + return cli->map; + } + } *class_id =3D -ENOENT; return NULL; } @@ -559,7 +580,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) { @@ -688,12 +709,12 @@ static int param_set_dyndbg_module_classes(const char= *instr, } =20 /** - * param_set_dyndbg_classes - class FOO >control + * param_set_dyndbg_classes - set all classes in a classmap * @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 prdbgs by their class, as given in the arguments to - * DECLARE_DYNDBG_CLASSMAP. For LEVEL map-types, enforce relative + * For all classes in the classmap, enable/disable them per the input + * (depending on map_type). For LEVEL map-types, enforce relative * levels by bitpos. * * Returns: 0 or <0 if error. @@ -1038,12 +1059,17 @@ static void *ddebug_proc_next(struct seq_file *m, v= oid *p, loff_t *pos) static const char *ddebug_class_name(struct ddebug_table *dt, struct _ddeb= ug *dp) { struct ddebug_class_map *map =3D dt->classes; + struct ddebug_class_user *cli =3D dt->class_users; int i; =20 for (i =3D 0; i < dt->num_classes; i++, map++) if (class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; =20 + for (i =3D 0; i < dt->num_class_users; i++, cli++) + if (class_in_range(dp->class_id, cli->map)) + return cli->map->class_names[dp->class_id - cli->map->base]; + return NULL; } =20 @@ -1124,31 +1150,133 @@ static const struct proc_ops proc_fops =3D { .proc_write =3D ddebug_proc_write }; =20 +static const char * const ddebug_classmap_typenames[] =3D { + "DISJOINT_BITS", "LEVEL_NUM" +}; + +#define vpr_cm_info(cm_p, msg_p, ...) ({ \ + struct ddebug_class_map const *_cm =3D cm_p; \ + v2pr_info(msg_p " module:%s base:%d len:%d type:%s\n", ##__VA_ARGS__, \ + _cm->mod_name, _cm->base, _cm->length, \ + ddebug_classmap_typenames[_cm->map_type]); \ + }) + +static void ddebug_sync_classbits(const struct ddebug_class_param *dcp, co= nst char *modname) +{ + /* 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 *modnm) +{ + 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("found kp:%s =3D0x%lx", kp->name, *dcp->bits); + vpr_cm_info(map, "mapped to:"); + ddebug_sync_classbits(dcp, modnm); + } +} + +static void ddebug_apply_params(const struct ddebug_class_map *cm, const c= har *modnm) +{ + const struct kernel_param *kp; +#if IS_ENABLED(CONFIG_MODULES) + int i; + + if (cm->mod) { + vpr_cm_info(cm, "loaded class:"); + for (i =3D 0, kp =3D cm->mod->kp; i < cm->mod->num_kp; i++, kp++) + ddebug_match_apply_kparam(kp, cm, modnm); + } +#endif + if (!cm->mod) { + vpr_cm_info(cm, "builtin class:"); + for (kp =3D __start___param; kp < __stop___param; kp++) + ddebug_match_apply_kparam(kp, cm, modnm); + } +} + +/* + * Find this module's classmaps in a sub/whole-range of the builtin/ + * modular classmap vector/section. Save the start and length of the + * subrange at its edges. + */ static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _= ddebug_info *di) { struct ddebug_class_map *cm; int i, nc =3D 0; =20 - /* - * 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++) { + for (i =3D 0, cm =3D di->classes; i < di->num_classes; i++, cm++) { =20 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); + vpr_cm_info(cm, "classes[%d]:", i); + if (!nc++) dt->classes =3D cm; - } - nc++; } } - if (nc) { - dt->num_classes =3D nc; - vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); + if (!nc) + return; + + vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); + dt->num_classes =3D nc; + + for (i =3D 0, cm =3D dt->classes; i < dt->num_classes; i++, cm++) + ddebug_apply_params(cm, cm->mod_name); +} + +/* + * propagates class-params thru their classmaps to class-users. this + * means a query against the dt/module, which means it must be on the + * list to be seen by ddebug_change. + */ +static void ddebug_attach_user_module_classes(struct ddebug_table *dt, + const struct _ddebug_info *di) +{ + struct ddebug_class_user *cli; + int i, nc =3D 0; + + /* + * For builtins: scan the array, find start/length of this + * module's refs, save to dt. For loadables, this is the + * whole array. + */ + for (i =3D 0, cli =3D di->class_users; i < di->num_class_users; i++, cli+= +) { + + if (WARN_ON_ONCE(!cli || !cli->map || !cli->user_mod_name)) + continue; + + if (!strcmp(cli->user_mod_name, dt->mod_name)) { + + vpr_cm_info(cli->map, "class_ref[%d] %s -> %s", i, + cli->user_mod_name, cli->map->mod_name); + if (!nc++) + dt->class_users =3D cli; + } } + if (!nc) + return; + + dt->num_class_users =3D nc; + + /* now iterate dt */ + for (i =3D 0, cli =3D dt->class_users; i < dt->num_class_users; i++, cli+= +) + ddebug_apply_params(cli->map, cli->user_mod_name); + + vpr_dt_info(dt, "attach-client-module: "); } =20 /* @@ -1158,6 +1286,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 *iter; + int i, class_ct =3D 0; =20 if (!di->num_descs) return 0; @@ -1181,13 +1311,20 @@ static int ddebug_add_module(struct _ddebug_info *d= i, const char *modname) =20 INIT_LIST_HEAD(&dt->link); =20 - if (di->classes && di->num_classes) + for (i =3D 0, iter =3D di->descs; i < di->num_descs; i++, iter++) + if (iter->class_id !=3D _DPRINTK_CLASS_DFLT) + class_ct++; + + if (class_ct && di->num_classes) ddebug_attach_module_classes(dt, di); =20 mutex_lock(&ddebug_lock); list_add_tail(&dt->link, &ddebug_tables); mutex_unlock(&ddebug_lock); =20 + if (class_ct && di->num_class_users) + ddebug_attach_user_module_classes(dt, di); + vpr_info("%3u debug prints in module %s\n", di->num_descs, modname); return 0; } @@ -1337,8 +1474,10 @@ static int __init dynamic_debug_init(void) struct _ddebug_info di =3D { .descs =3D __start___dyndbg, .classes =3D __start___dyndbg_classes, + .class_users =3D __start___dyndbg_class_users, .num_descs =3D __stop___dyndbg - __start___dyndbg, .num_classes =3D __stop___dyndbg_classes - __start___dyndbg_classes, + .num_class_users =3D __stop___dyndbg_class_users - __start___dyndbg_clas= s_users, }; =20 #ifdef CONFIG_MODULES diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 9e950a911b6c..ff9b879286d5 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -6,11 +6,15 @@ * Jim Cromie */ =20 -#define pr_fmt(fmt) "test_dd: " fmt +#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 +33,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 DYNDBG_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 DYNDBG_CLASSMAP_PARAM(_model, _flags) DYNDBG_CLASSMAP_PARAM_(_mod= el, _flags, ~0) +#else +#define DYNDBG_CLASSMAP_PARAM(_model, _flags) DYNDBG_CLASSMAP_PARAM_(_mod= el, _flags, 0) +#endif + +/* + * Demonstrate/test all 4 class-typed classmaps with a sys-param. + * + * Each is 3 part: client-enum decl, _DEFINE, _PARAM. + * Declare them in blocks to show patterns of use (repetitions and + * changes) within each. + * + * 1st, dyndbg expects a client-provided enum-type as source of + * category/classid truth. DRM has DRM_UT_. + * + * Modules with multiple CLASSMAPS must have enums with distinct + * value-ranges, arranged below with explicit enum_sym =3D X inits. + * + * Declare all 4 enums now, for different types + */ =20 /* numeric input, independent bits */ enum cat_disjoint_bits { @@ -60,26 +79,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); =20 /* 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); + +/* recapitulate DRM's parent(drm.ko) <-- _submod(drivers,helpers) */ +#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. + */ +DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, + D2_CORE, + "D2_CORE", + "D2_DRIVER", + "D2_KMS", + "D2_PRIME", + "D2_ATOMIC", + "D2_VBL", + "D2_STATE", + "D2_LEASE", + "D2_DP", + "D2_DRMRES"); + +DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, + V0, "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7"); + +/* + * now add the sysfs-params + */ + +DYNDBG_CLASSMAP_PARAM(disjoint_bits, p); +DYNDBG_CLASSMAP_PARAM(level_num, p); + +#else /* TEST_DYNAMIC_DEBUG_SUBMOD */ + +/* + * in submod/drm-drivers, use the classmaps defined in top/parent + * module above. + */ + +DYNDBG_CLASSMAP_USE(map_disjoint_bits); +DYNDBG_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 +159,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..9a893402ce1a --- /dev/null +++ b/lib/test_dynamic_debug_submod.c @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Kernel module for testing dynamic_debug + * + * Authors: + * Jim Cromie + */ + +#define TEST_DYNAMIC_DEBUG_SUBMOD +#include "test_dynamic_debug.c" --=20 2.45.0 From nobody Tue Feb 10 23:53:35 2026 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 0B7CC156F45 for ; Thu, 16 May 2024 17:44:58 +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=1715881500; cv=none; b=muMGi3f8z+gS84XSScIUsAKkfIEc3KJT0Dzi49SEWJuXqoT8EVpquzXS7aFuj4kEuRbpdpQatRtx940WXh7iFhvGukbmHpbWPgnMbrCNTZDlRU3tjO41WgqVwLbtVH2bhnzHpYYF8DSMbW6y/c/rLutrmWUPwSsHaeU4LjQZqJY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881500; c=relaxed/simple; bh=2T0K3P7RgHb5q+6ga8SL94wRECDXjObTMhudakl+Nv0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QF5+keC4ElmzNQ36O7SeN+iaRD19ZXqCXBsGQPkmnSTju27EXMpV3+c5NsqMAWAzSWsecRRftoBamOIuqbzorDq8ajNi/eyBn9xCs08y+7ivv8mOuwEbw8hLvANp0bMLZ/XXbflyEVYAsGN5ZYnyo5Wmgj+OLMvTU9vjj1GFEck= 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=N8h2fWEd; 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="N8h2fWEd" Received: by mail-io1-f52.google.com with SMTP id ca18e2360f4ac-7e1ec659c40so65719939f.2 for ; Thu, 16 May 2024 10:44:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881497; x=1716486297; 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=mznYbRVX+ERs9BGDvlLJlhrHWczwtZaUbuYAdXQxV1A=; b=N8h2fWEdbckBXFeRPp4yAli/7VpQuqku68luZvp5bYHRAR87e5GTKn0U8UitCu1y8G M08jCrpcE01/dSglQ2DYiG9GpyjJY5dUK2u6yqTheUW4MpkJJOE3orgB0qBYc1XudwDS Ti5+WSg4Is12bz64rPjr4kjm4OFo4HJTN3ghvMKyot2qSGZMDX+HNOiFSK6mVKKDYbL4 Aq97t/ZWNMCmlFiKoIVRWCcSpBI0eIFV7ig70UrUM8kNFgyBFC6OZ5MkjyevY7/aKI3F WK7WHPJQgTpZI35cnlF8jceLJAVQ+YNnmkiY+mLQUOOrK2Elv8vpeGyvfdLpRNtfxu9V 9Fbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881497; x=1716486297; 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=mznYbRVX+ERs9BGDvlLJlhrHWczwtZaUbuYAdXQxV1A=; b=tWGPSK6vMyHLdKyAelMxX0F+/IQNZ5X9fNFUlcz/Znr68ppe9OYwNW82VqwRZj06B8 yjyGrfG9tURzVVyPNQ59rM+6Ff9d8/KrZC9w7gYl+WO9xwFsxUuLubQYgJPPZPzW+5NO vps5iDbcWuq72ZjZerXCSOktf58yJXVNHEBd57UTE/BeAcORrFJ2wv2lJRXZJI8s5SoN dxUWXZSRpRy8nPeue5coKkDGO73Mh3fM74DCSUOCRqfRA5DfS1J4b0FypCE8uyXx8mR0 3NaCA/JyKSHuvT4KpXDnh/rrz9BnXVnYCztwSALwG9Ydg7zftA4Be17GfCJk8mPPKsvb V7Vg== X-Forwarded-Encrypted: i=1; AJvYcCXRFk/iGZhBuS32l/V/Daxj8daj36Sde+dPeXtsJlxXaYLxDp/KqH922KhVaAeQp424d8qtvMXkY35zGpq8H2rMFz0t0U+7FyfXJQVQ X-Gm-Message-State: AOJu0YwnmYLj72jxNq1dku9v/vAzoFtI7/ApbbDLCfperOrwl0Bj8WnT izZogLCqstxmDrT1ZT+IjzMmSe2VugkXTtv7r0TSrGYKm6+hZ0ba X-Google-Smtp-Source: AGHT+IEWc50TDLzIJ0P9Q3THHTDaOM5PF0uQslxFuXo0gcGk1PhULSyDv4kXUAfU2f8dsUOnsl1Xaw== X-Received: by 2002:a6b:f412:0:b0:7e1:8f55:9860 with SMTP id ca18e2360f4ac-7e1b521fb9amr1963940939f.19.1715881497154; Thu, 16 May 2024 10:44:57 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:56 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 16/33] selftests-dyndbg: add tools/testing/selftests/dynamic_debug/* Date: Thu, 16 May 2024 11:43:40 -0600 Message-ID: <20240516174357.26755-17-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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(), it modifies pr_debug flags in a few builtins (init/main, params), counts the callsite flags changed, and verifies against expected values. 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: $> vng --verbose --name v6.8-32-g30d431000676 --user root \ --cwd ../.. -a dynamic_debug.verbose=3D2 -p 4 \ ./tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh virtme: waiting for virtiofsd to start virtme: use 'microvm' QEMU architecture ... [ 4.136168] virtme-init: Setting hostname to v6.8-32-g30d431000676... [ 4.240874] virtme-init: starting script test_dynamic_debug_submod not there test_dynamic_debug not there ... [ 4.474435] virtme-init: script returned {0} Powering off. [ 4.529318] ACPI: PM: Preparing to enter system sleep state S5 [ 4.529991] kvm: exiting hardware virtualization [ 4.530428] reboot: Power down 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 ... TLDR: This selftest is slightly naive wrt the init state of call-site flags. In particular, it fails if class'd pr_debugs have been set $ cat /etc/modprobe.d/drm-test.conf options drm dyndbg=3Dclass,DRM_UT_CORE,+mfslt%class,DRM_UT_KMS,+mf By Contract, class'd pr_debugs are protected from alteration by default (only by direct "class FOO" queries), so the "=3D_" logged above (TAP version 13) cannot affect the DRM_UT_CORE,KMS pr_debugs. These class'd flag-settings, added by modprobe, alter the counts of flag-matching patterns, breaking the tests' expectations. Signed-off-by: Jim Cromie Co-developed-by: =C5=81ukasz Bartosik Signed-off-by: =C5=81ukasz Bartosik --- MAINTAINERS | 1 + tools/testing/selftests/Makefile | 1 + .../testing/selftests/dynamic_debug/Makefile | 9 + tools/testing/selftests/dynamic_debug/config | 2 + .../dynamic_debug/dyndbg_selftest.sh | 231 ++++++++++++++++++ 5 files changed, 244 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 c9ed48109ff5..e7bb7b1c44c8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7527,6 +7527,7 @@ S: Maintained F: include/linux/dynamic_debug.h F: lib/dynamic_debug.c F: lib/test_dynamic_debug*.c +F: tools/testing/selftest/dynamic_debug/* =20 DYNAMIC INTERRUPT MODERATION M: Tal Gilboa diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Mak= efile index e1504833654d..84edf0bd8e80 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -20,6 +20,7 @@ TARGETS +=3D drivers/s390x/uvdevice TARGETS +=3D drivers/net/bonding TARGETS +=3D drivers/net/team 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..d080da571ac0 --- /dev/null +++ b/tools/testing/selftests/dynamic_debug/config @@ -0,0 +1,2 @@ +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..1be70af26a38 --- /dev/null +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh @@ -0,0 +1,231 @@ +#!/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"" + +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 || echo $1 not there + 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}" + ddcmd =3D_ # zero everything (except class'd sites) + check_match_ct =3Dp 0 + # there are several main's :-/ + ddcmd module main file */module/main.c +p + check_match_ct =3Dp 14 + ddcmd =3D_ + check_match_ct =3Dp 0 + # multi-cmd input, newline separated, with embedded comments + cat <<"EOF" > /proc/dynamic_debug/control + module main +mf # multi-query + module main file init/main.c +ml # newline separated +EOF + # the intersection of all those main's is hard to track/count + # esp when mixed with overlapping greps + check_match_ct =3Dmf 21 + check_match_ct =3Dml 0 + check_match_ct =3Dmfl 6 + 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 --=20 2.45.0 From nobody Tue Feb 10 23:53:35 2026 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 24FA4156871 for ; Thu, 16 May 2024 17:44:59 +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=1715881500; cv=none; b=sbCAQUKgX6jWYjVoTc4EnQvQFRJ58P8KQwZ7YeXnXKd+0BqLMjkv8lfdKyuBZE+jfHviSnHeHtLYb3zB1ZAwPX3EkYE5uE9vp53ShQEX7I8fxHWzyLNtK7MiBb3Bdx1HMnVHMkFlhdm75+4DD2/5HGpkTNiDtvO+b68oX55I+Ok= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881500; c=relaxed/simple; bh=W/ixAni8SUOXaOT3Pv81/RNqnJOi7m94kvHfKRq5YLc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ScS8qPb5NPL/VghrGlzGODG/ZIzNPfZIoPURKebnds1U9lby3yBpiI0FyY9mYZ2V6QeEYsTowgGcJwkvViJI4AFaXJj3x6P/vDaJE9BqtY7l9bNkFd/+YxWGOMhxnDDsKczSvvA/DKh4f/ylx1UQdMr6K6tIIcS9cKTqAB2yx0w= 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=AFx7Uqoz; 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="AFx7Uqoz" Received: by mail-io1-f52.google.com with SMTP id ca18e2360f4ac-7e1f984312cso63551639f.2 for ; Thu, 16 May 2024 10:44:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881498; x=1716486298; 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=4LvzjOZ0xVdD8uYH97G1FDu1gcEeUac6frsU7264pgw=; b=AFx7Uqozwfk+rVCjww3FdQL95H/A1dIBABpiIyokuSkGZ1ljq1Hxz30/sYzQ3yIjZ1 wHBYUsiIaQ5v9HI5Zomgm8f0tQJkDqdl3PL0i5vRuxjNoz5+6oCNKcAxFz1xatYPCda9 LxQXpczECasua1H+GomRGBzj0hlinfr/QHClVIN4SDL8GTcj16p/5idVHV4kWQcSAOd3 1occz3VQ7b2laRYnmkcUZxtZ4C0A/hBkktmT/zYAby3HE1Z3nRoLxwDNmrsRz3K2s8xe QTNsHFtqOkVSuAUZ4UrVu3KD5YCVQpuKCPVfS6Fw2m7Z5y1Wxroydoum1xpJJrBt4ZwO LZVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881498; x=1716486298; 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=4LvzjOZ0xVdD8uYH97G1FDu1gcEeUac6frsU7264pgw=; b=iL250IHir0NotaKGbML/N6g4ZtUKTJNoL5YlJZNZj6qSmaQPmHb8LgGPrh8R1R7ylq 30+D6HGf94r3dFj9GlWzVtLzOABzsjSxwtzWnIf8KxpcBVl159Wm8vW1aUdcR4ZOu6Zy HyesP7kWyHsWuYpwm8CVgm9qvKvHWXSzKrJMu8idk+QDmZPmC0xRM/YvkScIf8ctg7Rs oB3l8P3SZ+bJnCrmdo55hvM06HhISwKcqwRsybJEbYVnCG/TpEgEFvkQBtvhOR0kfZof qzHJUysGjbj11IsF5x1jEP1PVPd63ctLGVmX23hR2EDUea3NM9dRUfaH6AAV9k3X4pHi E6Mg== X-Forwarded-Encrypted: i=1; AJvYcCX9lOTW7ZIsNeOyryRMm6HMC+pZ8mgojOy/oHJ+iJQ9GkajezS0a2WNTxg+iX4fcxd5JHsNIzx7iY4EPi0/a3A/GL2lWhH7ddZXfVt8 X-Gm-Message-State: AOJu0YypB1fRRGCyL+jmDcp+H/FuU2Pn75RoqPzUK7CO5v8Ig8mXL1zr WXV3SN/oRDFLswg/GlwizMa1Hjwbk9Y0PVWH2sPD7MF3W0MiBwsm X-Google-Smtp-Source: AGHT+IG2t3CLzVhccHNFJALnZQQF9jN79yA0Fk1BHpJAX96dBY38lPOcN56wRktBOzE/GeIKvSUx7g== X-Received: by 2002:a6b:7b08:0:b0:7e1:8633:5a80 with SMTP id ca18e2360f4ac-7e1b521b447mr2122214339f.19.1715881498384; Thu, 16 May 2024 10:44:58 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:57 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 17/33] selftests-dyndbg: exit 127 if no facility Date: Thu, 16 May 2024 11:43:41 -0600 Message-ID: <20240516174357.26755-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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" Test if /proc/dynamic_debug/control exists, exit 127 otherwise. This distinguishes an untestable config from both pass & fail. The 127 choice is pretty arbitrary, but imitating bisect. That control file's presense guarantees that dynamic-debugging is configured (unless /proc is off, unusually), without dealing with the mount. Signed-off-by: Jim Cromie --- tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/too= ls/testing/selftests/dynamic_debug/dyndbg_selftest.sh index 1be70af26a38..cb77ae142520 100755 --- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh @@ -11,6 +11,11 @@ CYAN=3D"\033[0;36m" NC=3D"\033[0;0m" error_msg=3D"" =20 +[ -e /proc/dynamic_debug/control ] || { + echo -e "${RED}: kernel not configured for this test ${NC}" + exit 127 +} + function vx () { echo $1 > /sys/module/dynamic_debug/parameters/verbose } --=20 2.45.0 From nobody Tue Feb 10 23:53:35 2026 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 5F013156F5E for ; Thu, 16 May 2024 17:45:00 +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=1715881502; cv=none; b=oYUqi/EdO5MjQpx3+7XZlj9tzESZejc1yEq4CcbVvoGGDYXiDjaJoJBKUSdVy2qsZ7nTJPpO8ruUIvvxqJ+wbiVs1+MZKhx9FchzXRlQbXAIxcsyZyHSRy1pDA5XAiK6KaEEKWhzDCkoQL3blbXymxoTeHqJzj6vOFKjl1xtdUM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881502; c=relaxed/simple; bh=B+pEGd2QbRDJSWVmz7z9bS0gEUdwSk2IVsZxGBk49M4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RIWoiqt911/3ay1cn/IyVLeTZC7cVvgrvcN1PEl9rWMuNhn1mYU7bDefEXueTBqZVG5ncbWpax1a1rVZOWcWf87b/v0FXxemjytrANblbn76zLXhNVzAMuTCP0Lm1DTZ9P5NX8SzXoFveNIXKMSGKXcMjf9McERz8HnSE82IQyU= 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=c3dOWoE2; 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="c3dOWoE2" Received: by mail-io1-f52.google.com with SMTP id ca18e2360f4ac-7e1bf0e9ab5so62816039f.3 for ; Thu, 16 May 2024 10:45:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881499; x=1716486299; 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=NESQaoc+e4asVOZHibldjBrMVUIxMvrm5sYzbLNA0UI=; b=c3dOWoE2wfSQ+a2Xc19k3te0j9YM7apFTasVfMrzqm8nxtTTs/VnFyIXYE+WFSPKh0 K/7iK0dbIjEAWuj+88QP3DUBuEQB1HyUbvGBqlrBmbV6G2M30vB1oSnDnevsisSp2AvP 8XxG7RYDt/ik6CDshfbR0cs48abIpYuCdPWdRQEgUK6ZLuRfMmXSWWIy8VPAas0CN6v1 1K1L8xAxm4MXAndrzAH9INW6qTQ4UrGX/Ebiv/2GwKwrj5jkywxXS6HX42ORYxFN5oU9 n+V//XVLg1Rxh/019fu05VbwOoGBTlqA/UoDkIc+yjebc4A8clnBcDeVvojdCFQ/cd3D w02g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881499; x=1716486299; 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=NESQaoc+e4asVOZHibldjBrMVUIxMvrm5sYzbLNA0UI=; b=QJ/luGDgLtmgy43xI9Agwwc3WJAuzYrf/Q+hDgfbZuVvoY9QKmZ43g9deLH/sbqqNW rloS7WkW1f4PCBgSHgflAuPekxf+X66uvJSyP4vTi79HKZ2s7qzKdrVmqtqG9+jG+GnJ +7oCku4GF/7JCO+vIe7Pokyb+/jMFjMtlIgKj8C5F4NV2p87OXWNWGrjqJsSdhfCHSza h35Ybe49c8z/RwwsMTGp4qezI2iEr1x4UZidYQfYFX2CGz+W5MhuCiu3HEdpoewzR2O/ Kw/XI+H8nlCFv/U18yl9AcQ4DJrAg/ZU63yMUOFn2TIb2dY47LXNB20R/wjMah+KlwQ5 LzWA== X-Forwarded-Encrypted: i=1; AJvYcCXr/D0Y2h0OBTLw4CYYDHP8rCm8XiLLwiAzT2fZOrilrpt4b6+X8xOrY+yF0GrC1ftkgFp1GtyLGAGWtD7ULFbfjwPtWzCzTiIKwa4V X-Gm-Message-State: AOJu0YyndH0zS8Yfc2MgEDi9X0KkVq3PgCV0BwFzQl6dqDbmkcJ2qqY9 Z4LIR0oGWgAEnXqgPi14CjGh7xzl1gmCpf4K7qxur4ouV1tj7HR1 X-Google-Smtp-Source: AGHT+IEOBhaPb3/pxEH93gSrh90kEsd62GeJugR1fKsWVvrzIjE52gHylwlp5Ehxh864QgoT7LH1XQ== X-Received: by 2002:a05:6e02:1905:b0:36c:7eb2:50d7 with SMTP id e9e14a558f8ab-36cc14a72c1mr242204815ab.14.1715881499409; Thu, 16 May 2024 10:44:59 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:44:59 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 18/33] dyndbg-API: promote DYNDBG_CLASSMAP_PARAM to API Date: Thu, 16 May 2024 11:43:42 -0600 Message-ID: <20240516174357.26755-19-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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 DYNDBG_CLASSMAP_PARAM macro from test-dynamic-debug.c into the header, and refine it, by distinguishing the 2 use cases: 1.DYNDBG_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.DYNDBG_CLASSMAP_PARAM new user (test_dynamic_debug) doesn't need to share state, decls a static long unsigned int to store the bitvec. __DYNDBG_CLASSMAP_PARAM bottom layer - allocate,init a ddebug-class-param, module-param-cb. Also clean up and improve comments in test-code, and add MODULE_DESCRIPTIONs. Signed-off-by: Jim Cromie --- fixup drm-print.h add PARAM_REF forwarding macros with DYNDBG_CLASSMAP_PARAM_REF in the API, add DRM_ variant --- include/linux/dynamic_debug.h | 37 ++++++++++++++++- lib/dynamic_debug.c | 70 ++++++++++++++++++++++----------- lib/test_dynamic_debug.c | 50 +++++++++-------------- lib/test_dynamic_debug_submod.c | 9 ++++- 4 files changed, 110 insertions(+), 56 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 2c6944c0d6cd..19f959f9a6b4 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -91,7 +91,7 @@ struct ddebug_class_map { * used to validate a "class FOO .." >control command on the module */ #define __DYNDBG_CLASSMAP_DEFINE(_var, _maptype, _base, ...) \ - const char *_var##_classnames[] =3D { __VA_ARGS__ }; \ + static const char *_var##_classnames[] =3D { __VA_ARGS__ }; \ struct ddebug_class_map __aligned(8) __used \ __section("__dyndbg_classes") _var =3D { \ .mod =3D THIS_MODULE, \ @@ -164,6 +164,41 @@ struct ddebug_class_param { const struct ddebug_class_map *map; }; =20 +/** + * DYNDBG_CLASSMAP_PARAM - wrap a dyndbg-classmap with a controlling sys-p= aram + * @_name sysfs node name + * @_var name of the struct classmap var defining the controlled classes + * @_flags flags to be toggled, typically just 'p' + * + * Creates a sysfs-param to control the classes defined by the + * classmap. Keeps bits in a private/static + */ +#define DYNDBG_CLASSMAP_PARAM(_name, _var, _flags) \ + static unsigned long _name##_bvec; \ + __DYNDBG_CLASSMAP_PARAM(_name, _name##_bvec, _var, _flags) + +/** + * DYNDBG_CLASSMAP_PARAM_REF - wrap a dyndbg-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 struct classmap var defining the controlled classes + * @_flags flags to be toggled, typically just 'p' + * + * Creates a sysfs-param to control the classmap, keeping bitvec in user @= _bits. + * This lets drm use __drm_debug elsewhere too. + */ +#define DYNDBG_CLASSMAP_PARAM_REF(_name, _bits, _var, _flags) \ + __DYNDBG_CLASSMAP_PARAM(_name, _bits, _var, _flags) + +#define __DYNDBG_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 f0a274a3cc9e..31fd67597928 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -657,6 +657,30 @@ static int ddebug_apply_class_bitmap(const struct ddeb= ug_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 *modnm) @@ -675,26 +699,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, modnm ?: "*", KP_NAME(kp)); totct +=3D ddebug_apply_class_bitmap(dcp, &inrep, *dcp->bits, modnm); *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)); @@ -1161,16 +1174,27 @@ static const char * const ddebug_classmap_typenames= [] =3D { ddebug_classmap_typenames[_cm->map_type]); \ }) =20 -static void ddebug_sync_classbits(const struct ddebug_class_param *dcp, co= nst char *modname) +static void ddebug_sync_classbits(const struct kernel_param *kp, const cha= r *modname) { - /* 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); + struct ddebug_class_param *dcp =3D kp->arg; + unsigned long new_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, @@ -1185,9 +1209,9 @@ static void ddebug_match_apply_kparam(const struct ke= rnel_param *kp, dcp =3D (struct ddebug_class_param *)kp->arg; =20 if (map =3D=3D dcp->map) { - v2pr_info("found kp:%s =3D0x%lx", kp->name, *dcp->bits); - vpr_cm_info(map, "mapped to:"); - ddebug_sync_classbits(dcp, modnm); + v2pr_info(" found kp:%s =3D0x%lx", kp->name, *dcp->bits); + vpr_cm_info(map, " mapped to:"); + ddebug_sync_classbits(kp, modnm); } } =20 diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index ff9b879286d5..b3c6f90b9fe8 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 @@ -35,24 +36,8 @@ 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 DYNDBG_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 DYNDBG_CLASSMAP_PARAM(_model, _flags) DYNDBG_CLASSMAP_PARAM_(_mod= el, _flags, ~0) -#else -#define DYNDBG_CLASSMAP_PARAM(_model, _flags) DYNDBG_CLASSMAP_PARAM_(_mod= el, _flags, 0) -#endif - /* - * Demonstrate/test all 4 class-typed classmaps with a sys-param. + * Demonstrate/test both types of classmaps, each with a sys-param. * * Each is 3 part: client-enum decl, _DEFINE, _PARAM. * Declare them in blocks to show patterns of use (repetitions and @@ -64,7 +49,7 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 06= 00); * Modules with multiple CLASSMAPS must have enums with distinct * value-ranges, arranged below with explicit enum_sym =3D X inits. * - * Declare all 4 enums now, for different types + * Declare all enums now, for different types */ =20 /* numeric input, independent bits */ @@ -83,12 +68,15 @@ enum cat_disjoint_bits { /* numeric verbosity, V2 > V1 related */ enum cat_level_num { V0 =3D 14, V1, V2, V3, V4, V5, V6, V7 }; =20 -/* recapitulate DRM's parent(drm.ko) <-- _submod(drivers,helpers) */ +/* + * 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. */ DYNDBG_CLASSMAP_DEFINE(map_disjoint_bits, DD_CLASS_TYPE_DISJOINT_BITS, D2_CORE, @@ -107,19 +95,18 @@ DYNDBG_CLASSMAP_DEFINE(map_level_num, DD_CLASS_TYPE_LE= VEL_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. */ - -DYNDBG_CLASSMAP_PARAM(disjoint_bits, p); -DYNDBG_CLASSMAP_PARAM(level_num, p); +DYNDBG_CLASSMAP_PARAM(p_disjoint_bits, map_disjoint_bits, p); +DYNDBG_CLASSMAP_PARAM(p_level_num, map_level_num, p); =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. */ - DYNDBG_CLASSMAP_USE(map_disjoint_bits); DYNDBG_CLASSMAP_USE(map_level_num); =20 @@ -180,5 +167,6 @@ 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_LICENSE("GPL"); diff --git a/lib/test_dynamic_debug_submod.c b/lib/test_dynamic_debug_submo= d.c index 9a893402ce1a..0d15f3ffe466 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 @@ -8,3 +11,7 @@ =20 #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.45.0 From nobody Tue Feb 10 23:53:35 2026 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 60E0115746B; Thu, 16 May 2024 17:45: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=1715881506; cv=none; b=IgmGUyol2KfCczcs98WNRwxLO1xPx3VrZ2u4ofoGsD68aEkgufh4YVwjV7LODEHQSCuIWK68xPxAVQtvPC0nbK2ntI7zrJABOe6UNs3eUpO2+iCHWrjQlSzooyfPwpIWivrYyrIBH7bngiVrFVWqw67Udh5yUnGKr2pp7sRo3z4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881506; c=relaxed/simple; bh=GM9N2LrlUL8U0wq9Ag+waTG9Hi+B5LIi7b+LNnW+GLI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FZ7DplCWVo6Cm8VwxIOtFpAFXpju7yHwSRqXyJBRTegX64TgCOyb8BDwwKp6M/CJmx1juPBb9YYJoYBuW9bLAuHWDAwBhqa63JOUhQkxA7ucvp3oOKd+93RiD8RYHG0yxerohLa7ktGRWKqJMTySP6q1oJGV8kJYC9OwYpy5cG4= 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=E2hDBwrL; 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="E2hDBwrL" Received: by mail-io1-f53.google.com with SMTP id ca18e2360f4ac-7e1d1caa7ffso66187339f.2; Thu, 16 May 2024 10:45:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881500; x=1716486300; 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=eLBKzxxH2pRFwxzcdRvJn2RLwMnUnuSXZFAsD4xZDeo=; b=E2hDBwrLAYygAlVFudvFcuC7ZX7tGfj4Gp4fPjAde8EYfSVK7zYsXKmXYcnb9pbiRS yEc1Fy+GSGpdljCbZ3d6RDbRfeX7DRDfzdM/r2lgnpGdobGhCHihARWsJfUQ/2Wpy+A3 DKP4eRgeBrhE47r0QqcR7w4GePt5o4mhEJM2WY9eoXqsGt+8lMMeS4eybkoKMRKVa5Uz ju3EPBwk4sWgCfzB8DeeHabIEWHHWKLsre9CBK2iKn6Cvipf51ApJW+xBoUVsEFdPMNG pqDXAU6ScaI5u7ApnXx6VjT7dt2s0fOOMaXztsjScPHcgeYss5twQ6EfZgKHwyfcDXZU p96g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881500; x=1716486300; 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=eLBKzxxH2pRFwxzcdRvJn2RLwMnUnuSXZFAsD4xZDeo=; b=UP9wgnDEoZKQBxTBkIfjl/r3mQwcVWH4zaYLPsfk4PUEvYedsqCdGAzj3lCGwVckRj UXBmY0VdrSXmrSix6NXpCDjLJK59TY5ymYVSVjpfybcFI1IXTWFnPKFf/+gpUlilbhe4 c/A+ry4aEGtWaYXhzGPlcJb3BSJpjmK1Xko/5EdElh+0RaJ68EeZqSmU2vLOF02sImRC i9a0UA+uhJ0KwqP+4PkLa328DTI5qzUXg14vJ4XIMlO3g35uwBidbBGtm8Gw2+lW9Cco IhYAklUCFRN15ijOUTQvTpO6FBQMLJiEhGrO4Xf0keGrAw+Bx/dpLFHfjPMveD615Vlc U9+A== X-Forwarded-Encrypted: i=1; AJvYcCUKm9jyrUVrzlOaXtsv6s+dZV0ee2tBQj/6IcWVQcIpNhDCs4BN69KxxRKs4RyBwqhCG3U1z8Bp1jGBGMB6sVJ/soaeILtNChBFvaSCKpuLH19YB+vuGE9ExwX0WJcT/tF3gxFjAOn1 X-Gm-Message-State: AOJu0YzGqM4lGwK84TGoMF22Be5leZBi462MgYXRwAPwjWHuGmI+puQ1 tKO4aqwIPxo2SzYrcofX11B2UCIHvlGJrcfDEKToBXHA1dOZE7Ew6F+rYfwO X-Google-Smtp-Source: AGHT+IF/+eG2qtE07kKJaVQnO9f66GBm40WERaL8uTXj4qQUQvXwvu2VIwG8Q36c5154c75Shh3DSg== X-Received: by 2002:a6b:600c:0:b0:7e1:79ef:b78a with SMTP id ca18e2360f4ac-7e1b522a828mr2069164039f.21.1715881500524; Thu, 16 May 2024 10:45:00 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.44.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:45:00 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie , linux-doc@vger.kernel.org Subject: [PATCH v8-RESEND 19/33] dyndbg-doc: add classmap info to howto Date: Thu, 16 May 2024 11:43:43 -0600 Message-ID: <20240516174357.26755-20-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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, exports a module's 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 cc: linux-doc@vger.kernel.org Signed-off-by: Jim Cromie --- v5 adjustments per Randy Dunlap v7 checkpatch fixes v8 more --- .../admin-guide/dynamic-debug-howto.rst | 63 ++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentat= ion/admin-guide/dynamic-debug-howto.rst index 6a8ce5a34382..742eb4230c6e 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -225,7 +225,6 @@ the ``p`` flag has meaning, other flags are ignored. Note the regexp ``^[-+=3D][fslmpt_]+$`` matches a flags specification. To clear all flags at once, use ``=3D_`` or ``-fslmpt``. =20 - Debug messages during Boot Process =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=3D=3D=3D=3D=3D=3D=3D=3D =20 @@ -375,3 +374,65 @@ 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 + +Dyndbg allows selection/grouping of *prdbg* callsites using structural +info: module, file, function, line. Classmaps allow authors to add +their own domain-oriented groupings using class-names. Classmaps are +exported, so they referencable from other modules. + + # enable classes individually + :#> ddcmd class DRM_UT_CORE +p + :#> ddcmd class DRM_UT_KMS +p + # or more selectively + :#> ddcmd class DRM_UT_CORE module drm +p + +The "class FOO" syntax protects class'd prdbgs from generic overwrite:: + + # IOW this doesn't wipe any DRM.debug settings + :#> ddcmd -p + +To support the DRM.debug parameter, DYNDBG_CLASSMAP_PARAM* updates all +classes in a classmap, mapping param-bits 0..N onto the classes: +DRM_UT_<*> for the DRM use-case. + +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 + +DYNDBG_CLASSMAP_DEFINE - modules use this to create classmaps, naming +each of the classes (stringified enum-symbols: "DRM_UT_<*>"), and +type, and mapping the class-names to consecutive _class_ids. + +By doing so, modules tell dyndbg that they have prdbgs with those +class_ids, and they authorize dyndbg to accept "class FOO" for the +module defining the classmap, and its contained classnames. + +DYNDBG_CLASSMAP_USE - drm drivers invoke this to ref the CLASSMAP that +drm DEFINEs. This shares the classmap definition, and authorizes +dyndbg to apply changes to the user module's class'd pr_debugs. It +also tells dyndbg how to initialize the user's prdbgs at modprobe, +based upon the current setting of the parent's controlling param. + +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) + +DYNDBG_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. + +This interface also enforces the DD_CLASS_TYPE_LEVEL_NUM relation +amongst the contained classnames; all classes are independent in the +control parser itself. + +Modules or module-groups (drm & drivers) can define multiple +classmaps, as long as they share the limited 0..62 per-module-group +_class_id range, without overlap. + +``#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.45.0 From nobody Tue Feb 10 23:53:35 2026 Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (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 6310515747D for ; Thu, 16 May 2024 17:45:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881504; cv=none; b=M6yFSeg1Fanq3OY9m90ZOgzZWyw+DAW1NhhiKczsxQ6606y9/alkyVnL/pR5gQ9FYJdk5DwJLSx4Rp1xGr4B7/igbc8ThztgOreYtN0T4M+W1TlGUURL2Ykoagd/eDnHq+eK1dj3vtC+U34uIC7VHUksTYdEetPLBTm8nFcS3xQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881504; c=relaxed/simple; bh=itcV+24asaVC3KYa/U3kpaJGYMkp9GjyLqWBirFU8Us=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WpY34MrgqsfNGs58tUrRie0kqpxfbAKwrg0MS59YKAWgiaXblv0MeIA0DRY4rP2BhwaHfsu6O4RKz82YZBFNvn+QtH7VyZyDgBX/hJKK9xd3hi/JENstikzbyoEBe0zR9y4mK44fT1Eyi6RWXtqPjZg78hZN0KEARKnKh6aUlDU= 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=CByamTHe; arc=none smtp.client-ip=209.85.166.47 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="CByamTHe" Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-7e1cd52db2eso60617039f.0 for ; Thu, 16 May 2024 10:45:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881501; x=1716486301; 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=PKt9z1FjU1g7BjHL+/GNBbUF+urWK9jMB07KelneGxw=; b=CByamTHeXl4xlO0U9qbWizxCAtiBj5Brpj130fd2oPdXCMa4MQx8fwPncC7CkZLRtz 8Dp9upuZLwirmS5u2HpTSKpuh1xeBtn8d6bfDOeNSNQ6Ad5k0NTiICtuuFZVzx/afI6i ur+4qK5Ycs8hhVBfjSwiocZnnkdlmHTM9G+FAKJz0iSWSMVfo4I4i3Hs72LTsY7RSD1c ZKMDtjSzr8S0lLIdYtMAOxBwRqRuo+mkOS/vpos4GlC3VsMNaU5fzQ2dJUOy2+MsyKLu rDpNzKXJLj2iI55B3LvbHrljwJK71cpjgamO5MLhu7X5rvEDHIyDzAZfEUPQx5h3ecpw jDCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881501; x=1716486301; 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=PKt9z1FjU1g7BjHL+/GNBbUF+urWK9jMB07KelneGxw=; b=W3W9Hf/LFuRI9oWT9gGbIUZg+vXEIMx+z7Navp2yRly23JPl3LqfC5gTKDoeINWrh/ 6WcfGROPd+Mt8Jx9+GXoNy/u666yslCafOucPLHA6/u16LmXdvN+gkcYhhDw22zr867v durOJyiOoQiOeujqLX6iEqCvz2CfLxUetghNWh6T0ooh2apT0KGD/tdhC4lPOiIEiwIh fjMCI4G4S2VvOjeSc/a6uFS5LBv53C5oRITssJNfCFssBWgKnN9xHEEv1zIMTD4wLj5B On7E1WlY2oqYniS8pMWAQtic3vXDVJkDAObueG7g0sxypwlupC9XY2MPB8qY+Rn2o6l4 G/3A== X-Forwarded-Encrypted: i=1; AJvYcCVO0uHEYgKLF5k89L9i5WC5O6h1J6Va7SA0HbEBgiLgZkUSiLws+QS3/UvmkUJUEioLobABJVtXzZdpdpOYZWVUNiwvXzC/qoNBxMD7 X-Gm-Message-State: AOJu0YyG9bNrSWbXe+Fox/8AsN4kO9iLoimd4x0LlB33Zl5J2x6xT4XF wU+veuZRzLDVgcfu1Bf/kyNNjat7wHeXfELiQogeMuqqbDu0DbW+vU3AaQB+ X-Google-Smtp-Source: AGHT+IG59BWQ/oedgZTxz2VCoG+HjvX3ctlv+HY2oKfQVsj56oPniv1hwb6cN8gHAHFhxE1NthOfQw== X-Received: by 2002:a5d:88c7:0:b0:7e2:1e0:3350 with SMTP id ca18e2360f4ac-7e201e033d5mr837924039f.12.1715881501632; Thu, 16 May 2024 10:45:01 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.45.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:45:01 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 20/33] dyndbg: treat comma as a token separator Date: Thu, 16 May 2024 11:43:44 -0600 Message-ID: <20240516174357.26755-21-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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 Signed-off-by: Jim Cromie Co-developed-by: =C5=81ukasz Bartosik Signed-off-by: =C5=81ukasz Bartosik --- lib/dynamic_debug.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 31fd67597928..c1bc728cb050 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -290,6 +290,14 @@ static int ddebug_change(const struct ddebug_query *qu= ery, 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, @@ -303,8 +311,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 '#') @@ -320,7 +328,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, @@ -592,7 +600,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 --=20 2.45.0 From nobody Tue Feb 10 23:53:35 2026 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 EE9E0157493 for ; Thu, 16 May 2024 17:45:03 +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=1715881505; cv=none; b=akqqeUp28MavWzwNgkC8BJ6qjoVDo2/dhISBK2Uc5jkiYztG260PyzDdNhOANmu05fXGJ7U8osr43BTHyo68cpJasc5E5v28H5LQ7x//guwUZisNWAbLkdUg8zcE0TLFoPWO0D6105d3cJbNTsS0UtS5lFBjKLX90yk35qkgvTQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881505; c=relaxed/simple; bh=0irpvrqeB6Py5kRKUz04f3K7f5Hu0Xmr2mVRw8vEvIg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tYAOO4o7TLr9s+dOuycK8IyMhtILsMTVZe9tLh5YyCa3v/Oocl5mdCRQNDVgQ4yc0wnTK9IR1TgyOguaOAheB93qIpm6xGU7U6FBRnKCgwBy9C/kCLpc/h74vd+CdIqYhVQA/nfIueBblk5rhWzR2dAOsESv6tgtQQC14WbAsm0= 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=BvyFImDQ; 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="BvyFImDQ" Received: by mail-io1-f49.google.com with SMTP id ca18e2360f4ac-7e1e06c9a10so67242439f.3 for ; Thu, 16 May 2024 10:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881503; x=1716486303; 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=os60IxUAXzHe/fTlflAC3Fj1jqSlC7haOycCU11kmOQ=; b=BvyFImDQlbkLrJPn6prrdt1lOh/NmkMRETmmWTXWwvuo7bkp9RJGmgSwUakRhegrQn 6DdLadYDfCoAf8ECzWF7t0+B0XtSuItDo64DaJMNGe6LPjzI02bT1gzp5iD6e/uKXGNt 2KqydRqSonPWWMQ2KFHDZsvdu7AHf8gBYHj2N205CpLYGQMBiHgdFDPJizOekmg2BgW3 zwm3tzczJUa5MzR1HlDuzEuiVTm0emXisE64PvXjTCkIvoM+T9YLtk8h4bcQT8dcYwyW 6MK7B7d5h1dDLTmNZOpuHaObryxr4+Rh2nFMA/42ep35OPtU4Zwt01wXrRC7oO0w6W4+ URuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881503; x=1716486303; 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=os60IxUAXzHe/fTlflAC3Fj1jqSlC7haOycCU11kmOQ=; b=HfShzYpkDM1vmJC/EYHrkzyGnRAzCmBAjJNfL0lG+u6hWOshSy6KNzwSSLKjnk2dWz mCp3mEPvZ8M1mei7v+8ba03HCnQl0/LL57vLs7LOaNUKpc/+AGY5fLubb07loLm7l4zT fzoaFMmvj3Wz3XXP2fleNHiyMuntefJ4J9x067mvHE98212xgapjLGipkdDPJqeWWwu6 T9aQEzh5bcOPdl5KpyQfCxktF0enrOSUiv+lf6d78VkauNJD9TU/JYy1K0c6L8XlrszT 95da7CCwtW1sPyUz2l8V5npY2Uq/WWNTQcgABZly8EusROmhyysi0SjNhaltzceVzXLU NOXg== X-Forwarded-Encrypted: i=1; AJvYcCX2dYF0DukuhcuWGufbtdPE9TEJ88/e/lQXd6TyT4z07Df/feigGt51nsy/z4bx+tsqofOVGwa0br1d5v4UIijcwOQEofn86M9CvhxG X-Gm-Message-State: AOJu0Yxh7DXLix25Dl88W+vpWcGyXti9BoiARIlTTX/LXSuXQlRGofQy MQUR1NnFHkcUV/PBNxd4HKnrdX0j1rf8xbceRjI2YEsHLDZxrcMw X-Google-Smtp-Source: AGHT+IH/AdAKh0AUT8xpOtIlGPCk9LyCwKm+GIHOnGXHY+nCmScPvI++ujvn+rdLlykHquBtuW1rRQ== X-Received: by 2002:a6b:6a19:0:b0:7de:cb15:1b17 with SMTP id ca18e2360f4ac-7e1b51cdac0mr2038774139f.9.1715881503054; Thu, 16 May 2024 10:45:03 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.45.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:45:02 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 21/33] selftests-dyndbg: add comma_terminator_tests Date: Thu, 16 May 2024 11:43:45 -0600 Message-ID: <20240516174357.26755-22-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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" 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 --- .../selftests/dynamic_debug/dyndbg_selftest.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/too= ls/testing/selftests/dynamic_debug/dyndbg_selftest.sh index cb77ae142520..7a7d437e948b 100755 --- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh @@ -217,9 +217,23 @@ EOF ddcmd =3D_ } =20 +function comma_terminator_tests { + echo -e "${GREEN}# COMMA_TERMINATOR_TESTS ${NC}" + # 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_ +} =20 tests_list=3D( basic_tests + comma_terminator_tests ) =20 # Run tests --=20 2.45.0 From nobody Tue Feb 10 23:53:35 2026 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 8418D158DBF for ; Thu, 16 May 2024 17:45:05 +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=1715881507; cv=none; b=B8ubNGxj46IlYekLav3xZN0YZmtvde4w/fXa8tLIfWoCD9AUknY+uWpgULVJHuMgdf12rTAf3Xlv7KP+0czI2RQm2mP9ASp6CEK2ZLv7opNofUy2D4IlSFXI7P+oujlLXikIkHanATGRqocImEvWdhb61TK84thtnzCBYQ+F0SM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881507; c=relaxed/simple; bh=8iUlHoA18CODHTvP01/7nn44Fu6mfDtGqRxAHN6bArU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j+8PKB9IlHuc648EVTFpiig0ODTdOfiuUSvzZqsU5NrFGReyYnNjWQtGQLn6Xf+9wyni+PR21ghhnM3Kq6ru8qQP7wxWEOG2ozukbaugSVoyQzZOcNTY9D3GLMENfPu4fCwLenn7mubvln4o+B0x5MVG5o8PnRUur72vIGUVveQ= 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=VaiZWjn/; 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="VaiZWjn/" Received: by mail-io1-f42.google.com with SMTP id ca18e2360f4ac-7e1c2ea8481so29715239f.0 for ; Thu, 16 May 2024 10:45:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881505; x=1716486305; 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=v1/6ZyOjyDKXy+eVnlQt6M6tqfLK/4vR0B+QR44xbZ0=; b=VaiZWjn/Ugl+HtgfbTjxCTcR60NkI872PlG19/eap16EkassUA6+uNFYZOudAJU7GL YE1PijxtSb5BTMtemqLazeJInz3lRGZljDrQvwZ0ePqL4tS9qWyTCIE/XCuvZa3ZpH5G UygyHS36slN9bs7zCLN5lufoZWq3gpo7pSxwsTQ5KoLnJmK8VVIMhBtrcGcki6ZCgf84 93sK0GSaZvBNDSHNYwjWJ1LGUjLwu7xMIlqLiL2GKOmW58Qgf/UAb+H2aKbV0XBGccKf 55iXAsA6pNiVa2Oifri7QmFaenbOUxiz/kIw4TQyt6Yobn+5FA/o8IcSfYK2TSH5Q5pK TOzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881505; x=1716486305; 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=v1/6ZyOjyDKXy+eVnlQt6M6tqfLK/4vR0B+QR44xbZ0=; b=om3d/ld5hfFWGUNIKUlAABy4sYYIB0AVvjqQ+uXKFHZfLMdVbnkoVB+015UkL5OaJg Dd7CbrbbiHtXYXeXJuRw2ZBe0Xd8d5ddYtec3APK82rtHiH+gYHeMmCU5vt41IzNrIMv 3JEArPaXQn7hxIboka+XRAjrsomz3FK0aZ//LQKm7t+Fb5NRFHdewQyNZ9YJl88iU29A 24NmouM7vnW8f4pfI5RKAck4X0jfQwrTKQk50/5KKteFe1T93OIzJMWK800BVgHNvjNE oBVSHkk3ILtBqvbosOIpQgbbhzSmwLVQe/fMGCY+v8hGyiPtfXwpOy0sIJ2BJmf7VW6r cbTg== X-Forwarded-Encrypted: i=1; AJvYcCVkjkUzx0P2GzNc7U5NmCIl5FCyquIaiy13SsD7g8UYnhPzraY/Bc3mjyBaX7x0UfQ9fWpBgC/u9sVeXvJ9NWvMytfpA4On1/UCKITF X-Gm-Message-State: AOJu0YwQAl6QFQHOuLQ2/I8HVSsz9C+rZTyS7tQHWDtWXDV7heIlswen amoRmb+IGmHQGwmex5Uvn6P9TdqHhNTsO8vp3ukczT+h5LIZ0VDJ X-Google-Smtp-Source: AGHT+IGDMUhFkxe4ntEiFSPM7Sg4FIARBDM6OgYtOIZyFR+kdTX8zSD97dTtznse244WRGROvCyurQ== X-Received: by 2002:a05:6602:3049:b0:7e1:d5cc:84bf with SMTP id ca18e2360f4ac-7e1d5cc851dmr1109118639f.6.1715881504096; Thu, 16 May 2024 10:45:04 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.45.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:45:03 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 22/33] dyndbg: split multi-query strings with % Date: Thu, 16 May 2024 11:43:46 -0600 Message-ID: <20240516174357.26755-23-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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" Multi-query strings have long 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. Signed-off-by: Jim Cromie --- 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 c1bc728cb050..625838bd74aa 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -596,7 +596,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 --=20 2.45.0 From nobody Tue Feb 10 23:53:35 2026 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 E48B9158DD4 for ; Thu, 16 May 2024 17:45:05 +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=1715881507; cv=none; b=C94SGupvozwr6VZT31JWPMhxlWYWC4/X71cQpUk3+s+FzYTYhA0S0A+j1lPPDyomlsNRLr/nqDS1EGdHrOMQQiun/RszPIOThzo5UREjFNZ0J07NaWRcwZwufk+WR12M2C1GYI7zabCfSm3FCgdhrKxPWa1g42dwmwJvSsHEz3E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881507; c=relaxed/simple; bh=5RXdrrebCLyRNRu/PswOiPBlRFFX/KYQGPs3XeSm0zM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XRu91sby6zoxnxdTp8UOevgs/+I1060lhgQMht51nOFlTqZ5fhudnIxaZchDYr5KE9C5VXIuFADOKjIq01esJF0RknaIs/YKnykzNsncJcnWOiqxBHXBep2eLGriDDdZLsSuba1+tJ3RcTEjpPmNkovEZVc7IyUkAGMrpz894xQ= 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=Y/yufmPy; 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="Y/yufmPy" Received: by mail-io1-f42.google.com with SMTP id ca18e2360f4ac-7e1bb4abfcfso64732739f.1 for ; Thu, 16 May 2024 10:45:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881505; x=1716486305; 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=zPvugwzLWUwzXXCLLOQaHatMSlMOb9JzZ40gA0iDEDg=; b=Y/yufmPyw9qfNiAInVCzekWz+achx7L8B2LBzhRPI8cC9wJovI8F7L1kZQeYUCKgzr rQN7v7UNX3Tvt9K3nWm+pDR12D56deLP4kDDkrxtSWwKJrIMYEucG8IqJvF6VZn2lozi 3WdJePPlrvZ+UsOcbL+QflTqEJBqdEiIrVkL2dMBDeVhD8BhrxvdNO9pmPRHGESC9HgG c892v7PqJ6TMfXh4fvzC3FIT1DF0nqK5HWgQuvWf8dCZlBbTX/9agZ2+A/+tu2qFggAy X1W3xJKohkl5qQnj2ZbHegzQ4azVxQ1ya2le1fzbp2VoGOMrpay9BJ5W7oz4EfC5n8PT FetQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881505; x=1716486305; 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=zPvugwzLWUwzXXCLLOQaHatMSlMOb9JzZ40gA0iDEDg=; b=YJg6JBsDMK6dyR+cPQzK1KvPJrwu05Uvts0z6Wt9SCTtlngtnEwRGXOMgKaBaGKuHe LnJGLz81GUgBAxsYYpIUfL5t+5VJ4fNRpYLmCIXmlLulA062StPpTKfR/RzrlAIu8xAe vHMg+W0NT0AqMZfd1RSrqb+bX/Vp8Fthwr+B83rQQGv8D8uzYF9R1j89VM4dPSTF7Ac4 X9mB1gjdNBB7ufgnMygvp9GWFh7ZYrze/xGMdelJW6M1AmlGSLql5jU+r0/oWUAg/EsC KMdRyxdMDvJW8lxuxci1B8jipEa9eD79NW1qgJ47Vv5Ah61X+Ruzuqwcm5IMT6tIOf5O /AZQ== X-Forwarded-Encrypted: i=1; AJvYcCX3fL6YjwJFOufD5hCZnoIoECmL4JXJbe/TeWvaAER5aNF0IWPSmWG7JZY8ycfVbMGIp+fh4Ej/Y7W4BohwvBcikkvvpvuShJXC/N3x X-Gm-Message-State: AOJu0YzNyAyL+EAnQEeM91+lHiXe95OFIBTlKdDjdn7Ti/3wuQQEgnXv acNo94W/OL0ShxDEzJBxuo/MdYzr7/lzw8fk0GbCqwK0D8ra3dbt2q4xSi6+ X-Google-Smtp-Source: AGHT+IFLNKeTaw9iXVo5cxXFbdAHesMIZkS5AmGLUXUNEYlNOXHJW3I4DpYnys/G9UM+IcGgvUqZag== X-Received: by 2002:a05:6e02:1a6a:b0:36c:d52:e969 with SMTP id e9e14a558f8ab-36cc1476080mr241739195ab.6.1715881505054; Thu, 16 May 2024 10:45:05 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.45.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:45:04 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 23/33] selftests-dyndbg: test_percent_splitting multi-cmds on module classes Date: Thu, 16 May 2024 11:43:47 -0600 Message-ID: <20240516174357.26755-24-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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" New fn tests multi-queries composed with % splitters. It uses both test_dynamic_debug and test_dynamic_debug_submod, and manipulates several classes at once. So despite the syntactic-oriented name, it also tests classmaps. Signed-off-by: Jim Cromie --- .../dynamic_debug/dyndbg_selftest.sh | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/too= ls/testing/selftests/dynamic_debug/dyndbg_selftest.sh index 7a7d437e948b..ddb04c0a7fd2 100755 --- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh @@ -231,9 +231,29 @@ function comma_terminator_tests { ddcmd =3D_ } =20 +function test_percent_splitting { + echo -e "${GREEN}# TEST_PERCENT_SPLITTING - multi-command splitting on= % ${NC}" + 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.45.0 From nobody Tue Feb 10 23:53:35 2026 Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) (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 43585159917 for ; Thu, 16 May 2024 17:45:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881509; cv=none; b=fL6AP3N8HCwPE7jyh8qK6E6mydhztvCmHf8vnwSXtoP+BwIR3IIJ6vGk3ShjeDKLDfg65IjWMn947w88OV331hk1vZIlZYyPwYZ9S/cvXq5t1hRKw7W8vVEySK0tVHZ4yMhD3lIT5K5D4x+4RHPA4UKTYGFP+B84DtGQb1Z0fbQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881509; c=relaxed/simple; bh=wyt5TeuMHVxw0kvBQCXwTOsU2/UU1RQiOPIBUMKdca0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jB5X0Jmd/gy235IGakWqJoikwKWsCNRee6t8mGC0mJixM0eExrBFUQQ1WSls14lhdM3MU39vXWOzMnR12RVkMxjGr3mBzDsEJ6vEXMKrCIQK4cOOdBrC2Lmg+FhPORF1BaVkOVuyxOs94gjFbJoEhMyaerC892MSVxlZ9Mh3IMQ= 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=R2s9qS9s; arc=none smtp.client-ip=209.85.166.43 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="R2s9qS9s" Received: by mail-io1-f43.google.com with SMTP id ca18e2360f4ac-7e1e06c9a10so67248239f.3 for ; Thu, 16 May 2024 10:45:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881506; x=1716486306; 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=P6B0otVk+eOeb6hk65r7u/cdtYXtppvakvgUuU81roA=; b=R2s9qS9sF8HcsXfbEuFi44o3qK7+zHrBtqML5CNsQhK6MniDuazdbjBXMqwIDowekk DMIgFybVgoTnRIFhe3rUvI0PP0iBhO/3V8VoSFNlyEqoBk+Hr7oEFxkZZxOBvB0cTYLY /BNQ1JMC3Q8nNOjnCj+SX51g5c4DBFpVqCU1pn23Z+edHchbiHCTldDsFto0A5fk4Ks2 iUJriNgIg5eU1yrZGvDC0/AWQ7yNJNTojIjkc9pZSz9NVQbS2UcLnB5hK5ayEmEuZpdI MtO2dEjEVSRfWAf1H2PXBpep6YJaxiRrCUfmnUY4nezuhWIQOxhiPO2fSvTIVCTLSAqI VMSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881506; x=1716486306; 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=P6B0otVk+eOeb6hk65r7u/cdtYXtppvakvgUuU81roA=; b=DaVRsfr/0OuFlwJWzKBpfreB1DrAXDzMcWodLxmKHI8muXSTMN1cfY5i/KPG8Jp4wu /hYusVBBTMY13Kt7yByd9lEE3lMaDbnusx643GuXxCkTc6BisFz0pIzDHVxjGeQ+NO4t dx2DZNtxJ5dZHAuJ+W02I1m6iyLCZmJRcC4HnIvkOk6MJVpKz8KXp1FFSapybFbGS1+X pY5yZUfMjW1mC42Y5FrPVoLfig7mK7P7xzThHGLt34B8HLddxNOa30kD0pYVB8JMZIoZ /PPzz8RYj4ylbDVkll152syLLf0NZ7SMy6SsXvesEItzUiycB74gRUUrnXOu5+R5HlyI XCow== X-Forwarded-Encrypted: i=1; AJvYcCUwQCrYZ4R+awcbSTYoi7kIrYGYAHVXjtAzSHFP4SLCX2JY1LyPLjFBTead2m71/8TLLhwC3cSvInU+p5MmMDNF2Bq00I5O4kfp9uue X-Gm-Message-State: AOJu0YyVwe83KcAsG+zUoDtxq22cSzWOu+G66guya+TttHXLvgwhl9XH I37xhiEd0SsEgLiHINQ9sAlQgaW+Tv7khcXb3mVmxOdvGuBnQjJF X-Google-Smtp-Source: AGHT+IFfNKxOu0YMJf8LIdPkkjzcglQuoJNP/OgNxbJXyxVYC2axWflxm1HjwNIxuW2cTmt4VSSykg== X-Received: by 2002:a05:6e02:1543:b0:36b:26df:ccec with SMTP id e9e14a558f8ab-36cc1447afemr229618225ab.16.1715881506442; Thu, 16 May 2024 10:45:06 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.45.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:45:06 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 24/33] docs/dyndbg: explain new delimiters: comma, percent Date: Thu, 16 May 2024 11:43:48 -0600 Message-ID: <20240516174357.26755-25-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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 mention of comma and percent delimiters into the respective paragraphs describing their equivalents: space and newline. Signed-off-by: Jim Cromie --- .../admin-guide/dynamic-debug-howto.rst | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentat= ion/admin-guide/dynamic-debug-howto.rst index 742eb4230c6e..7b570f29ae98 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -73,16 +73,18 @@ 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``:: +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 <<"EOC" func pnpacpi_get_resources +p func pnp_assign_mem +p @@ -104,7 +106,6 @@ The match-spec's select *prdbgs* from the catalog, upon= 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 keywords are::: @@ -128,7 +129,6 @@ keywords are::: ``line-range`` cannot contain space, e.g. "1-30" is valid range but "1 - 30" is not. =20 - The meanings of each keyword are: =20 func @@ -153,9 +153,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 ``_``. + + Examples:: =20 - module sunrpc + module,sunrpc # with ',' as token separator module nfsd module drm* # both drm, drm_kms_helper =20 --=20 2.45.0 From nobody Tue Feb 10 23:53:35 2026 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 9D36715ADA7 for ; Thu, 16 May 2024 17:45:08 +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=1715881510; cv=none; b=cA8oN+jMH/9/AZnKlzwQUUFpV4MQyqVmlOUGHk3DX2V1oMnbzey96WzhCmjkEjhahJjCBlqy9Z0Oeg/RtCucX36t0utVJpvcDkBdM0etFZra38+0vYW2tMYtye8WRJUOjYMIJNhUGFz7YbWUd/pZUE/JTDxgeAeFnkpl6DTgzCY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881510; c=relaxed/simple; bh=S0YULHTm+fjM0qLnB/V2U6Y8Gar8z1QmhDis3HrZlsE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VpMV/+b+W51CBCLfs8GSfEmeTPlTHDshfyU6666HP6OgmiQVgVJDOK2GZbRLP6t7VwXI31L0nKur0ocuIHxVQfX4CZTElQiKz/D1OH7UH1KzHlvxb5M4bW0aUfbn3jf4fIM+695XrsGbyyZ9BWmicwbkjl1uEvX/APZpuj6naMU= 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=WmOw5eVQ; 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="WmOw5eVQ" Received: by mail-io1-f50.google.com with SMTP id ca18e2360f4ac-7e1bb4abfcfso64738739f.1 for ; Thu, 16 May 2024 10:45:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881508; x=1716486308; 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=o7zHUfeGi4mVPiBP6D9isopkhhYt9FN8vIOW8+G9xg4=; b=WmOw5eVQmo+Rw0nj/6Y8FM45ya1GB3cIA8EwFPugvVUlTVOoQXAss5NsF21EmrcSYu IX89yrluz7A/ieLof5JjIGR5G18yEzX+wuNvwRlf41R/vCXDwAR8vMtsPJO+L4BL0Hf8 agxxlCAaJoYIfIVF4MiI9RWe7JdPWfBxXoB6vLHt2YP61i5xonzvZDKPDHB0ZE2atYAI cDj1uIYJUtgd8Xrl4YsLL1dZ9NtHwzTKBzVXB72nX5F7h2x/caI/P+MeFP2aFkj76N6q wEzoBa0A7dn4qY0f0hYsKEV1ApMFE7OxliPdBK1+6By08HazRNhJWw5WEpjKopKDGoGR yf2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881508; x=1716486308; 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=o7zHUfeGi4mVPiBP6D9isopkhhYt9FN8vIOW8+G9xg4=; b=Biv9o0V1E2PvSeUteQHewaJCSYFILrJRum15JJLV2wFyAuuGINSaKn1Ocy7+SOHbG6 1ixCM/1PLirGVtC5Z3twN5/b/E5mNfzfMS/aMGg3AwQCIysNBvO9PBhO2mUvDSkCmdPc E0wt9J9YyYU/PuMUzt/YDaiyNoFYbWlE2gzQbX+yFDsW1Cc0kEisLAP/CS7EKie3yRNV xTWiqPy4F+BQxiwuk8yQCPe3bph8gJmougWnE4hV4YKGB2FZdQC+hZC6D/n/26o8ah0D sl/tlpTHA3gnBMfWOJL3mCuyyqPgL2RylP39d+IhQe9wOOnH+2LjETrqjlJP9Gavt9PX qLLw== X-Forwarded-Encrypted: i=1; AJvYcCX+kXtifG1qfZZWIDy0MwVP3AuThCGqIomYwIt9rXVI1dyFmjrzYMTNNWdFbFYMXDPex1Vnogia9dY/lQubnVAr28bEzd0LQwCAw6nf X-Gm-Message-State: AOJu0Yw7ahPAA8QYyThjxgFeecrcSHe1uIbizYCDaldIzNLRuQHQXAXs JrG2Hoo2c7Hj8Z2OjoVO06uguGwLXEbfpuFK2trUN5k4gsyvcsf6 X-Google-Smtp-Source: AGHT+IHY0hMb0HEeGBuUW18LZaLggFg/c3EURAhCr+m5emvlajDgZNchOQOmEQ+M02mvD5cudyMHIA== X-Received: by 2002:a05:6602:1d5a:b0:7e1:80d7:96e0 with SMTP id ca18e2360f4ac-7e1b52054afmr2149986239f.14.1715881507373; Thu, 16 May 2024 10:45:07 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.45.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:45:07 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 25/33] selftests-dyndbg: add test_mod_submod Date: Thu, 16 May 2024 11:43:49 -0600 Message-ID: <20240516174357.26755-26-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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 --- .../dynamic_debug/dyndbg_selftest.sh | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/too= ls/testing/selftests/dynamic_debug/dyndbg_selftest.sh index ddb04c0a7fd2..54acee58cb4e 100755 --- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh @@ -250,10 +250,70 @@ function test_percent_splitting { ifrmmod test_dynamic_debug } =20 +function test_mod_submod { + echo -e "${GREEN}# TEST_MOD_SUBMOD ${NC}" + 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,+p= t%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 + + # 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 -v + check_match_ct =3Dplt 1 -v + check_match_ct =3Dpml 1 -v + # submod changed too + check_match_ct =3Dmf 1 -v + check_match_ct =3Dlt 1 -v + check_match_ct =3Dml 1 -v + + # 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 -v + 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 -v + 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 -v + + # 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 -v + modprobe test_dynamic_debug_submod + # see them picked up by submod + check_match_ct =3Dp 14 -v +} + 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.45.0 From nobody Tue Feb 10 23:53:35 2026 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 CC3AA15B128 for ; Thu, 16 May 2024 17:45:09 +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=1715881512; cv=none; b=Y8/DN+RoRvBQLMLFtoi1ioctUEA84W1mzp8WO71TNeJJoMtri5kL/mAMYBDnQbTE4oBXLgDFp+sjR8OItksTU9QnBYBN5MBzHW/PUjk44IXaBZ1Zv1SmE/OEkvqLAirKKoxk1MJO042Cqv2jXSSCgApMgDTgnd1PzYpDpLosdBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881512; c=relaxed/simple; bh=zk0FpkXNzqEU6+hdkM4mtB3nxolyva27iHEVE5qQYEM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BbwTJNKMslD+SDfqYUpwhADx3vfUsiaVGj4eH9aPRHDGlaL5F6Mx39VTd92zr9ryuFVUhmBVt+5lAEAdNN2oEehP9eDm/GstDl+3ZRj9WQFCUubwpB1EzIlEy3xK7WsbIy6++QVNUhyXthH5aoLNWZFvmJjAx71FgzvG9fnnBkg= 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=bT/Btldx; 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="bT/Btldx" Received: by mail-io1-f44.google.com with SMTP id ca18e2360f4ac-7e21b6e98bdso47424039f.0 for ; Thu, 16 May 2024 10:45:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881509; x=1716486309; 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=kQclGL1ogQugraKRSVgZd3GtxTAEOo7GMTSerjU8loE=; b=bT/BtldxibIl458txGpQ2Z+mp23Uo4NX1uGh5ZCVUBMRKzQ6oNMyrhaX15mcs5bzXT sL4e0Bsepux8K8JsJkoNA+NOMQwhoXXDkinMfPB2gwuiiyXrkRIdNur9VliA3MY9FacG +UAvGCbfYvLTU2dmgrgYDwlA5xnblC22IV0024DFYGX1K7WxiwZaD9vhEig1bB4CsCCs XMNDP+CmCiMfiuqx++2OFZxL673HJM1Zg1azyso/iArnwxnyVCYGxqW30P2UGRneIpco nYUe30r8zPAkVyLeGy4QdfvY86iyhupdsZSAS/IWK5MwvXuB7hNzi9iR3sp+YQjZE6sm Mguw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881509; x=1716486309; 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=kQclGL1ogQugraKRSVgZd3GtxTAEOo7GMTSerjU8loE=; b=vCde7Vep1FaWYNRVxM+81YPJd88xAeC8bHiB8rNgGjaztcdm2Nfx7XM6E70etzGDMZ dGxh6j8aD2N/f83514xed9W7duIyJoqIEA9ZZAWvqFM4agjFfzwkA4bCEwz06bz+2P7P QhHHhJhF0qjj5NrcQDCNHL4OpYIdZIv73jgJNWsSv0tYs+RcZfcyKhGPTf4cqPKkw/FG WM6oNQ4mjaq7+ekZSmw+ckdmw9r8sEI9EeLZoc3zQefDSqw5X/42CubofqCWS6FK3g9/ DwdHt38VnCgfXHvGlGCLjiS1gR8Lxl89TKNTugxN9FxiTpdAaUUsb8DwTM+51wOl4Bha jjhg== X-Forwarded-Encrypted: i=1; AJvYcCVbomVRTldrskMNxQPIIZJx9RXY/4OsZeMiEjY/N4ZOY3kRAA7KtwtM1BQPVfOVYnip5CQJipnnJoaPkB8fsAhAMco8PfByR1JW+Idx X-Gm-Message-State: AOJu0Yyd63ZnmlelOFMj1Hz3xECcsTp+UVLGjyg4PNfrMQXP4hKHhZIb nRegWP3u8vLwh4c5sxl13dJalLz6HlNUsaVztREQqWZQoJQ/jS0e X-Google-Smtp-Source: AGHT+IGhFCXE4CPUhn515zPeodHPI1MuFHobA9OrWMOi3cG54Po+wyygQgf8YGe43OEzYYQ+ev6DGw== X-Received: by 2002:a05:6602:12:b0:7e1:542d:7b09 with SMTP id ca18e2360f4ac-7e1b501a196mr2117867339f.0.1715881508874; Thu, 16 May 2024 10:45:08 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.45.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:45:08 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 26/33] selftests-dyndbg: test dyndbg-to-tracefs Date: Thu, 16 May 2024 11:43:50 -0600 Message-ID: <20240516174357.26755-27-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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 series of trace-tests: test_actual_trace() etc, to validate that the dyndbg-to-tracefs feature (using +T flag) works as intended. The 1st test uses the global tracebuf, the rest use/excercise private tracebufs. These tests are currently optional, via "TRACE" arg1, because the feature code is in-the-lab. But its an objective test, and pretty user-interface oriented. IOW this passes: :#> ./tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh but this fails: :#> ./tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh TRACE So its won't break selftests success. This allows the patch to be committed now w/o inducing selftest failures, and the tests enabled later, with the promised code. Signed-off-by: Jim Cromie Co-developed-by: =C5=81ukasz Bartosik Signed-off-by: =C5=81ukasz Bartosik --- .../dynamic_debug/dyndbg_selftest.sh | 435 ++++++++++++++++++ 1 file changed, 435 insertions(+) diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/too= ls/testing/selftests/dynamic_debug/dyndbg_selftest.sh index 54acee58cb4e..65f31418870f 100755 --- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh @@ -308,6 +308,405 @@ function test_mod_submod { check_match_ct =3Dp 14 -v } =20 +# tests below here are all actually using dyndbg->trace, +# and verifying the writes + +function test_actual_trace { + echo -e "${GREEN}# TEST_ACTUAL_TRACE ${NC}" + ddcmd =3D_ + echo > /sys/kernel/tracing/trace + echo 1 >/sys/kernel/tracing/tracing_on + echo 1 >/sys/kernel/tracing/events/dyndbg/enable + modprobe test_dynamic_debug dyndbg=3Dclass,D2_CORE,+T:0 + search_trace "D2_CORE msg" + search_trace_name 0 1 "D2_CORE msg" + check_match_ct =3DT 1 + tmark "trace-mark" + search_trace "trace-mark" + doprints + search_trace "D2_CORE msg" + ifrmmod test_dynamic_debug +} + +function self_start { + echo \# open, modprobe +T:selftest + ddcmd open selftest + check_trace_instance_dir selftest 1 + is_trace_instance_opened selftest + modprobe test_dynamic_debug dyndbg=3D+T:selftest.mf + check_match_ct =3DT:selftest.mf 5 +} + +function self_end_normal { + echo \# disable -T:selftest, rmmod, close + ddcmd module test_dynamic_debug -T:selftest # leave mf + check_match_ct =3D:selftest.mf 5 -v + ddcmd module test_dynamic_debug +:0 + ddcmd close selftest + is_trace_instance_closed selftest + ifrmmod test_dynamic_debug +} + +function self_end_disable_anon { + echo \# disable, close, rmmod + ddcmd module test_dynamic_debug -T + check_match_ct =3D:selftest.mf 5 + ddcmd module test_dynamic_debug +:0 + ddcmd close selftest + is_trace_instance_closed selftest + ifrmmod test_dynamic_debug +} + +function self_end_disable_anon_mf { + echo \# disable, close, rmmod + ddcmd module test_dynamic_debug -Tf + check_match_ct =3D:selftest.m 5 + ddcmd module test_dynamic_debug +:0 + ddcmd close selftest + is_trace_instance_closed selftest + ifrmmod test_dynamic_debug +} + +function self_end_nodisable { + echo \# SKIPPING: ddcmd module test_dynamic_debug -T:selftest + ddcmd close selftest fail # close fails because selftest is still bein= g used + check_err_msg "Device or resource busy" + check_match_ct =3DT:selftest.mf 5 + rmmod test_dynamic_debug + ddcmd close selftest # now selftest can be closed because rmmod removed + # all callsites which were using it + is_trace_instance_closed selftest +} + +function self_end_delete_directory { + del_trace_instance_dir selftest 0 + check_err_msg "Device or resource busy" + ddcmd module test_dynamic_debug -mT:selftest + check_match_ct =3D:selftest.f 5 + del_trace_instance_dir selftest 0 + check_err_msg "Device or resource busy" + ddcmd module test_dynamic_debug +:0 + ddcmd close selftest + check_trace_instance_dir selftest 1 + is_trace_instance_closed selftest + del_trace_instance_dir selftest 1 + check_trace_instance_dir selftest 0 +} + +function test_early_close () { + ddcmd open kparm_stream + ddcmd module usbcore +T:kparm_stream.mf + check_match_ct =3DT:usb_stream.mf 161 + echo ":not-running # ddcmd module usbcore -T:kparm_stream.mf" + ddcmd close kparm_stream +} + +function self_test_ { + echo "# SELFTEST $1" + self_start + self_end_$1 +} + +function cycle_tests_normal { + echo -e "${GREEN}# CYCLE_TESTS_NORMAL ${NC}" + self_test_ normal # ok + self_test_ disable_anon # ok + self_test_ normal # ok + self_test_ disable_anon_mf # ok +} + +function cycle_not_best_practices { + echo -e "${GREEN}# CYCLE_TESTS_PROBLEMS ${NC}" + self_test_ nodisable + self_test_ normal + self_test_ delete_directory +} + +# proper life cycle - open, enable:named, disable:named, close +function test_private_trace_simple_proper { + echo -e "${GREEN}# TEST_PRIVATE_TRACE_1 ${NC}" + # ddcmd close kparm_stream + ddcmd open kparm_stream + ddcmd module params +T:kparm_stream.mf + check_match_ct =3DT:kparm_stream.mf 4 + ddcmd module params -T:kparm_stream.mf + check_match_ct =3DT:kparm_stream.mf 0 + is_trace_instance_opened kparm_stream + ddcmd module params +:0 + ddcmd close kparm_stream + is_trace_instance_closed kparm_stream + ddcmd =3D_ + check_trace_instance_dir kparm_stream 1 + is_trace_instance_closed kparm_stream + del_trace_instance_dir kparm_stream 1 + check_trace_instance_dir kparm_stream 0 +} + +function test_private_trace_2 { + echo -e "${GREEN}# TEST_PRIVATE_TRACE_2 ${NC}" + ddcmd =3D_ + echo > /sys/kernel/tracing/trace + echo 1 >/sys/kernel/tracing/tracing_on + echo 1 >/sys/kernel/tracing/events/dyndbg/enable + ddcmd open foo + is_trace_instance_opened foo + check_trace_instance_dir foo 1 + + modprobe test_dynamic_debug + ddcmd class,D2_CORE,+T:foo.l,%class,D2_KMS,+fT:foo.ml + check_match_ct =3DT:foo.l 1 + check_match_ct =3DT:foo.mfl 1 + + # purpose ? + echo 1 >/sys/kernel/tracing/tracing_on + echo 1 >/sys/kernel/tracing/events/dyndbg/enable + + tmark test_private_trace about to do_prints + search_trace "test_private_trace about to do_prints" + search_trace_name "0" 1 "test_private_trace about to do_prints" + + doprints + ddcmd class,D2_CORE,-T:foo + ddcmd close foo fail + check_err_msg "Device or resource busy" + ddcmd class,D2_KMS,-T:foo + ddcmd close foo + check_trace_instance_dir foo 1 + is_trace_instance_closed foo + ddcmd close bar fail + check_err_msg "No such file or directory" + ifrmmod test_dynamic_debug + search_trace_name foo 2 "D2_CORE msg" + search_trace_name foo 1 "D2_KMS msg" + del_trace_instance_dir foo 1 + check_trace_instance_dir foo 0 +} + +function test_private_trace_3 { + echo -e "${GREEN}# TEST_PRIVATE_TRACE_3 ${NC}" + ddcmd =3D_ + echo > /sys/kernel/tracing/trace + echo 1 >/sys/kernel/tracing/tracing_on + echo 1 >/sys/kernel/tracing/events/dyndbg/enable + ddcmd open foo \; open bar + is_trace_instance_opened foo + is_trace_instance_opened bar + modprobe test_dynamic_debug + ddcmd class,D2_CORE,+T:foo + ddcmd class,D2_KMS,+T:foo + ddcmd class D2_CORE +T:foo \; class D2_KMS +T:foo + ddcmd "class,D2_CORE,+T:foo;,class,D2_KMS,+T:foo" + ddcmd class,D2_CORE,+T:foo\;class,D2_KMS,+T:foo + check_match_ct =3DT 2 -v + check_match_ct =3DTl 0 + check_match_ct =3DTmf 0 + echo 1 >/sys/kernel/tracing/tracing_on + echo 1 >/sys/kernel/tracing/events/dyndbg/enable + tmark test_private_trace_2 about to do_prints + doprints + rmmod test_dynamic_debug + ddcmd "close bar;close foo" + is_trace_instance_closed bar + is_trace_instance_closed foo + search_trace_name foo 2 "D2_CORE msg" + search_trace_name foo 1 "D2_KMS msg" + del_trace_instance_dir foo 1 + check_trace_instance_dir foo 0 + search_trace "test_private_trace_2 about to do_prints" + del_trace_instance_dir bar 1 + check_trace_instance_dir bar 0 +} + +function test_private_trace_4 { + echo -e "${GREEN}# TEST_PRIVATE_TRACE_4 ${NC}" + ddcmd =3D_ + echo > /sys/kernel/tracing/trace + echo 1 >/sys/kernel/tracing/tracing_on + echo 1 >/sys/kernel/tracing/events/dyndbg/enable + + ddcmd open foo + modprobe test_dynamic_debug dyndbg=3Dclass,D2_CORE,+T:foo%class,D2_KMS= ,+T:foo + check_match_ct =3DTl 0 + check_match_ct =3DTmf 0 + check_match_ct =3DT 2 + + # are these 2 doing anything ? + echo 1 >/sys/kernel/tracing/tracing_on + echo 1 >/sys/kernel/tracing/events/dyndbg/enable + + tmark should be ready + search_trace_name "0" 0 "should be ready" # in global trace + + doprints + search_trace_name foo 2 "D2_CORE msg" # in private buf + search_trace_name foo 1 "D2_KMS msg" + + # premature delete + del_trace_instance_dir foo 0 + check_trace_instance_dir foo 1 # doesn't delete + ifrmmod test_dynamic_debug + + ddcmd "close foo" + is_trace_instance_closed foo + del_trace_instance_dir foo 1 # delete works now + + check_trace_instance_dir foo 0 + search_trace "should be ready" +} + +# $1 - trace-buf-name (or "0") +# $2 - reference-buffer +function search_in_trace_for { + bufname=3D$1; shift; + ref=3D$2; + ref2=3D$(echo $ref | cut -c20-) + echo $ref2 +} + +function test_private_trace_mixed_class { + echo -e "${GREEN}# TEST_PRIVATE_TRACE_5 ${NC}" + ddcmd =3D_ + ddcmd module,params,+T:unopened fail + check_err_msg "Invalid argument" + is_trace_instance_closed unopened + check_trace_instance_dir unopened 0 + + ddcmd open bupkus + is_trace_instance_opened bupkus + check_trace_instance_dir bupkus 1 + modprobe test_dynamic_debug \ + dyndbg=3Dclass,D2_CORE,+T:bupkus.mf%class,D2_KMS,+T:bupkus.mf%class,= V3,+T:bupkus.mf + + # test various name misses + ddcmd "module params =3DT:bupkus1" fail # miss on name + check_err_msg "Invalid argument" + ddcmd "module params =3DT:unopened" fail # unopened + check_err_msg "Invalid argument" + + ddcmd "module params =3DmlfT:bupkus." # we allow dot at the end of fl= ags + ddcmd "module params =3DT:bupkus." + ddcmd "module params =3D:bupkus." + ddcmd "module params =3D:0." + + check_match_ct =3DT:bupkus.mf 3 # the 3 classes enabled above + # enable the 5 non-class'd pr_debug()s + ddcmd "module test_dynamic_debug =3DT:bupkus" + check_match_ct =3DT:bupkus 8 -r # 8=3D5+3 + + doprints + ddcmd close,bupkus fail + check_err_msg "Device or resource busy" + ddcmd "module * -T:0" # misses class'd ones + ddcmd close,bupkus fail + + ddcmd class,D2_CORE,-T:0%class,D2_KMS,-T:0%class,V3,-T:0 # turn off cl= ass'd and set dest to 0 + ddcmd close,bupkus + is_trace_instance_closed bupkus + + # check results + eyeball_ref=3D<; Thu, 16 May 2024 17:45:11 +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=1715881512; cv=none; b=Kp07iUM8728WUgSr+QA2PQUBxek4L34tWbjjBdzgFR5b8W/C71M25fq3VGqkKuZsOj++iILDZSQBpLvUM6Ev1azb4uTC5qov9sUfaL8jRbgR8cXQEqJN03OhFQRDLf0k6wEPjECCBOeFrnlbOvLY70PugjjupTt+Zt8sh+FnRu4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881512; c=relaxed/simple; bh=iEWH7zvmoluQNd3cpiL4vVd8VXHqKLc5fjTMhj4nCus=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KoFwmLc2CJHsnwlud2Clm8QkBz+MtDiyD9jZKwAkPOItajxThwEaBPzzl7oU7aZhE5PHEALrDOVI+w3pTBukqh/eE2WngC6in0I5fnwgyx/xzDSKodrUME4fpZH4p3dKEFMoEZnFue/Os03MaddLSkJAdCBiC20NUJ2QOM3hmXU= 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=FFNXW8jZ; 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="FFNXW8jZ" Received: by mail-io1-f51.google.com with SMTP id ca18e2360f4ac-7e1e06c9a10so67254039f.3 for ; Thu, 16 May 2024 10:45:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881510; x=1716486310; 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=jYLAhiYI1/roEBWDhbogtJUk4/pmxUifIXzFJQa7vcs=; b=FFNXW8jZtev1UWPeOUYF2YLVRKY+ljBzqPM2uNV4rML/VqmzGYrP0iTDo2szDKMADx 8SsMJdHkVTa7ikQBiOCNZjSLB3UBWv7A8i1Hcl3ysLH2ztOLgnRM5q5pMyqc9mgJyRjg kIH3BauyEQ5VjX/Rf8Zrz71OiCBT+LzFFKWHjDuOuYMDzbVQyTxs/zPZJC1RaUt0Cb7d /ClNiIdVj6IPLvtf5/+5o+oeM55oa4wZ1NgVsq42uttSh/RJWR3qNHcTdcxahNmUOkhJ On1Yj4ZGInZS5+zkCJjKsfY3hAwwAvkVyQH673H/sPbTwcBSvsKDIjH/UqUA/G2ODLdj siCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881510; x=1716486310; 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=jYLAhiYI1/roEBWDhbogtJUk4/pmxUifIXzFJQa7vcs=; b=mIkeQc8VOlAGgqipVe8MrRXY/d5OKBW8jQ3luwQhtMw1DiLOsM2lG7UOIJHHmrZLve BxFPX3J74skC581iP4lHTkVK0dCJx0quPtjEuijLO8W4RJHzzFU59DoT1xH8VpSyFMwY jtBpa3xojwWd93t67xH7Tz04Qcx9KICm8SOTo8ZAYGG8kixh7m6h8jp8X8LBcs2OrnTn 4kb96Kpdqi+c6yGJIsiB/kkV27gq7mZe10/uX+rR+vE/2hTSnu15mHDBuhkiok18nJlN 1Yy5iK96bk7LmD4ZvTv9/DfoqjLEjnNJMi92tJKINSXiXnsSXX5eHcOfJjdMhjKVdlUN MOUQ== X-Forwarded-Encrypted: i=1; AJvYcCW2ZfaRfDLnZgb+zZvFCfFHkg30N9m4xntPREgWhd9K1l61mhf40b11O+Z7ev0DC7P0DhkPT1mEl14ZCtgZY9G+CEBBcvf2JncOkW31 X-Gm-Message-State: AOJu0YzA2hvvAtWZPd0giwD0L7hKqlTfhcQ7FYsZVIZEvMrO3ODE+VMp sjeyEb5CoznldOinSsXoXCzcQohFMTmr3bemmDLN/54VewrL/Aht X-Google-Smtp-Source: AGHT+IGIdTPbyslC01Cdbd1cvSyv9qr4G4n7N4xFnyRNiv7RzxcT944yQoZm9BlEp5dprYc/0AZU1A== X-Received: by 2002:a6b:5b0e:0:b0:7da:4135:89be with SMTP id ca18e2360f4ac-7e1b521f9b3mr2248352639f.17.1715881510432; Thu, 16 May 2024 10:45:10 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.45.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:45:09 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 27/33] dyndbg-doc: explain flags parse 1st Date: Thu, 16 May 2024 11:43:51 -0600 Message-ID: <20240516174357.26755-28-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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. So if the flags draw an error, then keyword errors aren't reported. This can be mildly confusing/annoying, so explain it instead. This note could be moved up to just after the grammar id's the flags, and before the match-spec is detailed. Opinions ? Signed-off-by: Jim Cromie --- Documentation/admin-guide/dynamic-debug-howto.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentat= ion/admin-guide/dynamic-debug-howto.rst index 7b570f29ae98..ccf3704f2143 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -106,6 +106,16 @@ 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 +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 + A match specification is a keyword, which selects the attribute of the callsite to be compared, and a value to compare against. Possible keywords are::: --=20 2.45.0 From nobody Tue Feb 10 23:53:35 2026 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 068D315B984 for ; Thu, 16 May 2024 17:45:12 +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=1715881514; cv=none; b=nARgMjNRflz85K3tQQhLbirmp4sCcZWnNjl2L1RMsX+VHTLxub2M6RDM3wNt+D/PtemvohiKXDj+65NZDChF7/+qkM/Pq53bE03iGuwhpu+4KY/0EMIzLrND+Xzzt7GYjfHIUvLfV1aAemQEAMghal89x++q11JKWwd1CVaXAlE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881514; c=relaxed/simple; bh=tj1Mp5UhAkYzKU/KHXaAEzHkSgdCDNeOpeIZ26q5o+o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iWLQHHLGLOOFvAn+DwAa/H3GxFjvRzjUyfhPfddhlozB+A2WMBtWcuazrKZZpqtZPH9U5WoAWV0eGN8uyCXsK+EZoWU6zIGT8CJWpx2xY4LKJ3qlJRf+gcRfEbDD+49BGAHf5dFC/0utNlYpcP1uYtl9xRm7DURp3npCa8l3Ews= 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=WCo9qeYb; 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="WCo9qeYb" Received: by mail-io1-f42.google.com with SMTP id ca18e2360f4ac-7e18adf7268so67634239f.0 for ; Thu, 16 May 2024 10:45:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881512; x=1716486312; 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=SZaxVfUByIKje02NDRyo2utcDiv4Cpn+Dvf4S+u3Lag=; b=WCo9qeYbSUq7ADsNlZKl1WcFVVduEIuRJi7Jb6FIHN6Nc1Pt2LKHvjeMr8QGI2XcNQ /OJJsEb4rYUsgD4Es4jVj1F4A1Kpcta7yMsyFOaUTd7zj9+A2pcWNWkyZHQcLqpKW3J9 NVJCQI+spsN+CvazhRbpP+PdyvUC8ZnQ3lC94TCNG5dStpfn2tCSEzyO1KppBGRJgvwc NRj9CmYWcK9sWKW9k0b+CRPa0meIeDL5S2vn3UisqPYyYoWZ3qd20AOW0es8CgtD/EVT REW7XjTPmvq7NjOA40gcH7XHKkFsDvsoBff+sOmZGcbLw5TixCtaLK4lX9a3ieyntWHH vjRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881512; x=1716486312; 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=SZaxVfUByIKje02NDRyo2utcDiv4Cpn+Dvf4S+u3Lag=; b=r3K39jQEBQ5OhrrjBmxPgTwHptCDe3JXstOLWCv1f+tIXHyNUz7fCZpFGCCoWtlqby GvRPqU1axJN3oPrZzz/SqdY/SeKmMBs3uGsed16Oys45kxg/JbYH7LRTMQukuCrK947V Ljnk8BNUTByZ/+oH/xYq8rDMyFWDZ7YdmqDGSXtczlW3tNgwpIJaiB3Hwxu6u1ujvwnk jNPd68sVwWsStnuNEjON1oYUASEjVRudNEWQlhaye2wSp3LgwWW9bSdGHW90qjVAW/hc 3algoBrnpfa+t4f961Y/4nAFl30GJXCi6wfEMQNQBfurGMPX8M6MxFPpZA3FQav7urlU y2Dg== X-Forwarded-Encrypted: i=1; AJvYcCWUAg95mvbSWKF0Y+VPBUI8y+17VRYx0oJKXSWLoEiwkvoXXG6XF7n1jWgEW0tB+7f9KAi1Oq7QuE5SDmdR7lxruo2wxhSrPlMWeDzF X-Gm-Message-State: AOJu0Yz5lh09UdvmMTzibnK9c1wh4EfW2N8UKN4ntc4JGi+MM0TjXqpS 8LwhyXGIQiaiLBiUp/3iGFENL4MgEwoTKbMkccDl4mGqYD5iyp/f X-Google-Smtp-Source: AGHT+IFjXltfJJYEhbIhtN+UbkVmrGNvRprw4HxrT2v7xxl57ROeDU+91mlv88XsKHbSX5kAjJAPDg== X-Received: by 2002:a5d:8c8f:0:b0:7e1:b4b2:d708 with SMTP id ca18e2360f4ac-7e1b51aad7bmr2182833439f.4.1715881512238; Thu, 16 May 2024 10:45:12 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.45.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:45:11 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 28/33] drm+drivers: adapt to use DYNDBG_CLASSMAP_{DEFINE,USE} Date: Thu, 16 May 2024 11:43:52 -0600 Message-ID: <20240516174357.26755-29-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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" Follow dynamic_debug API change from DECLARE_DYNDBG_CLASSMAP to DYNDBG_CLASSMAP_{DEFINE,USE}. Prior to this, we used DECLARE_DYNDBG_CLASSMAP, which was preserved to decouple DRM conversion. I'm unsure of the full functionality in-between, a round of lkp-testing will help. Fixes: f158936b60a7 ("drm: POC drm on dyndbg - use in core, 2 helpers, 3 dr= ivers.") Signed-off-by: Jim Cromie --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 12 +----------- drivers/gpu/drm/display/drm_dp_helper.c | 12 +----------- drivers/gpu/drm/drm_crtc_helper.c | 12 +----------- drivers/gpu/drm/drm_print.c | 25 +++++++++++++------------ drivers/gpu/drm/i915/i915_params.c | 12 +----------- drivers/gpu/drm/nouveau/nouveau_drm.c | 12 +----------- include/drm/drm_print.h | 8 ++++++++ 7 files changed, 26 insertions(+), 67 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_drv.c index e4277298cf1a..b287f0cfd8fa 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -217,17 +217,7 @@ int amdgpu_damage_clips =3D -1; /* auto */ =20 static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work= ); =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), diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/disp= lay/drm_dp_helper.c index f5d4be897866..d3a7df09846f 100644 --- a/drivers/gpu/drm/display/drm_dp_helper.c +++ b/drivers/gpu/drm/display/drm_dp_helper.c @@ -41,17 +41,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; diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_h= elper.c index 2dafc39a27cb..e9d229a393f4 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 diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 699b7dbffd7b..4a5f2317229b 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/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915= _params.c index de43048543e8..dccf12d05105 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); \ diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouvea= u/nouveau_drm.c index a947e1d5f309..27995c0c9b31 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -72,17 +72,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; diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 9cc473e5d353..905fc25bf65a 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -140,6 +140,14 @@ enum drm_debug_category { DRM_UT_DRMRES }; =20 +#ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG +#define DRM_CLASSMAP_DEFINE(...) DYNDBG_CLASSMAP_DEFINE(__VA_ARGS__) +#define DRM_CLASSMAP_USE(name) DYNDBG_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.45.0 From nobody Tue Feb 10 23:53:35 2026 Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) (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 7E96315CD41 for ; Thu, 16 May 2024 17:45:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881515; cv=none; b=SaSqDaV2d++6yq8Q7d5RuaQAUI4ocIPHL5Oh8t/DVXt4JHSmSdmuYM0dV5SF5bJQW2Vb58N/gqLRU6k8sUZIH/3Vncxh+TZKild5t7wkpudN+0IydRNa7Yo3PLnqqQ99J50CVC3t1//uzz7ZRDbtSacT0iGfG+BtJqCl3NNy/ic= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881515; c=relaxed/simple; bh=aTQGGNmi0yNbpQJeet+hYQWWfGCVSXpdCjm4Gt7I6+w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a8TwQQumFzHrwYc9PNSOS34mqg4tLOEfu0agoBiOzbLUCOPvahkXE1s2PTx8V771+TXFoPgeNNh1Ihfk8MZGGirXdXF61Hjx89V964T0ZyDlUH7+XnMo3C05bQapxdYkxAJBXW+J0N9Bb42GDPCEWoQkhuEpEBC5JhpO0x43Oaw= 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=XpV+K0Nd; arc=none smtp.client-ip=209.85.166.48 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="XpV+K0Nd" Received: by mail-io1-f48.google.com with SMTP id ca18e2360f4ac-7e1bf0e9ab5so62841039f.3 for ; Thu, 16 May 2024 10:45:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881513; x=1716486313; 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=MttqmCnvGJ5H20CP+TVSJnxFzBK+hVVV1LSH1eFSpC4=; b=XpV+K0Nd9Xm5w5omW9FQBzaM/MlgFpFeTVCVc1FhuLP69FTzl1p6G2Xa3I9+x338Vf gReUFON8ASAb37FIYs+n6KliYY3UX2U+lQUodRPXdgkqMKwd2Q1/rhIwGp1bVIQguCZ2 u2VPsrCKrWdeLs+9W2YMP+x5GvsRK0zOT3svqyBpiQENYDKjqKIS869aTtYitCToBNYI KXBrl5Kya4s5d5jq+GtmTsaEYErEJGvmjzn6ARPeJUpekjNX9gZdxkjILTieH7qKWgWf q2Gdp0pemhujpUWR9ccyOB8ZXE2XrMLmwfqld865eUJH263/i4a75N2MMl08/bu4KLdB BkjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881513; x=1716486313; 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=MttqmCnvGJ5H20CP+TVSJnxFzBK+hVVV1LSH1eFSpC4=; b=FlKeQOdJsA/QwZrY2hFa9B/nSvbfL57uV0Du2MObr56jv3KF3Qux67Fk8Dh6DLHiIb anQz41nt6fOuB0BSyXyGif0V69PHT7jjSHBHjSt7P1uWwbbY0eelx5MiGQ3bsQEd8koq qdXGSF7MspxzN5CZOMzjfY/mdwZFeQTBhvlSiIz1LtPngTs6Kli/3b4tXKrVPwWiHiuC g67T4W0pdw/8apTiRkpa0mvsDGbQpb0CQofFZioY4pHm2LtwQ4h5RfpvC3os1EPAvTiY c0oOgc0EdB9pHPosOtU1x2kqshMlgMVgfbUjm1OeOS2nZRIghKoMhkaFNPQdyj9G8HOe 5QKA== X-Forwarded-Encrypted: i=1; AJvYcCVm4GSNTZRM+J4odLMOkufTK1uVXDOaqpKvAnPTtr21idLHoHIOeyxmtJif33wZUVLdh6Dul6eqhOl3HQCBCZ1f+EzIgPl26dqcElK2 X-Gm-Message-State: AOJu0YxC5dVkqpNf4V1A+tcTDRGVEhiuVWEY8Rkkqke1E7LjCKUBHHCQ V6qBTTJ7IrmT+9it+iuaE8sJk/IjxCCtd+537T1ZPO1oaVseBLgs X-Google-Smtp-Source: AGHT+IG7d02P9XnjdK+dzFg+syAJa4w9AKg+W40iJ5EGJYG4XmNlNZUvjMDb2oNR6+4+x9AeQtZWQg== X-Received: by 2002:a05:6e02:15c8:b0:36c:42a0:7abb with SMTP id e9e14a558f8ab-36cc1503191mr234788725ab.31.1715881513583; Thu, 16 May 2024 10:45:13 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.45.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:45:13 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 29/33] drm-dyndbg: adapt to use DYNDBG_CLASSMAP_PARAM Date: Thu, 16 May 2024 11:43:53 -0600 Message-ID: <20240516174357.26755-30-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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" use new export Signed-off-by: Jim Cromie --- drivers/gpu/drm/drm_print.c | 8 ++------ include/drm/drm_print.h | 6 ++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 4a5f2317229b..efdf82f8cbbb 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 905fc25bf65a..95c667934bbb 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -141,11 +141,13 @@ enum drm_debug_category { }; =20 #ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG -#define DRM_CLASSMAP_DEFINE(...) DYNDBG_CLASSMAP_DEFINE(__VA_ARGS__) -#define DRM_CLASSMAP_USE(name) DYNDBG_CLASSMAP_USE(name) +#define DRM_CLASSMAP_DEFINE(...) DYNDBG_CLASSMAP_DEFINE(__VA_ARGS__) +#define DRM_CLASSMAP_USE(name) DYNDBG_CLASSMAP_USE(name) +#define DRM_CLASSMAP_PARAM_REF(...) DYNDBG_CLASSMAP_PARAM_REF(__VA_ARGS__) #else #define DRM_CLASSMAP_DEFINE(...) #define DRM_CLASSMAP_USE(name) +#define DRM_CLASSMAP_PARAM_REF(...) #endif =20 static inline bool drm_debug_enabled_raw(enum drm_debug_category category) --=20 2.45.0 From nobody Tue Feb 10 23:53:35 2026 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 7796C15CD56 for ; Thu, 16 May 2024 17:45:15 +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=1715881517; cv=none; b=FVhWCLZqhmggbec/y0skOQ+u793srSN2uG7yVLf/7egN+bcmoEyBn5rw4AUJrRFWe1jJ1JvDRFRp+KmfoWtiK3My3ljLUuSHZbkgqs57bPbuaRlCmaNlzHv5uu6+6+4W7MWg4uU9tyNoCvuDIgpwHDDFYtSl1IRF7BSiF+ywb7U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881517; c=relaxed/simple; bh=dol2TAYNaHy3v5RXCjk5z/RHVtAbbNOuKkU0xUy+nzY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cMKQWLXyYUQqNl2PzzBkw3oZ77baCXffnWkSMsEdtBXrZ2IS4haZhQQWKIrYWAurCS7Rog1LnQOGsHcb1QIKoPZzyb7UyvKD0pyJzMAzkaMrKu6SZwPlBC0F5soXn4tqdqfp9VwDrvq089pFI3aoyUXivhFY1nS8Efr8z68oyoY= 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=QAZ6TclW; 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="QAZ6TclW" Received: by mail-io1-f41.google.com with SMTP id ca18e2360f4ac-7e21742025aso56619139f.2 for ; Thu, 16 May 2024 10:45:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881514; x=1716486314; 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=jl2/Ekkc0gIYxP3JBOEuP8Bqn0lwP5M2pjaV/0iFu70=; b=QAZ6TclWCokdpcW87i0Sy6OEuCTp0KKYO1huHTeIGQWPMLb4NdlzG8h4ffETlaVMmj SoWqZjlLiAbNbibGxtFNg1sxWiQ8qpJw1mRNAmI/fsVvwHxOwvb1UaqQypzATOH6RWyF JegB0x/AC/r41DaOHaDP+qW7swq5wqgu5McO/5cdmeesJO2mFumBzMBfHjuNVgeIx4eU uh/sWJcMydOSuADCcjG4szoIM6kRLo+kl9ZjYPoUjOUllwkeQ+zSmMVR45c763/DT2PO oNShJU9yp8CAZ4HlbZZupw2tLqpZNaJdEz1zXQQkcYukqx4/jl9xyTHslHjbGmlPUmpI Ilag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881514; x=1716486314; 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=jl2/Ekkc0gIYxP3JBOEuP8Bqn0lwP5M2pjaV/0iFu70=; b=aFU0r4efhmXLYNe29bXV/5Ya2DGFxLb5BKZiLv9RN6tKcb7a3gjpbppvzJjMjDc1op Vu+mzQQJbwHA9xCZx2bvzg5cfZa8mzWsrq2WaT/KBNHV4xx5Pk+RkviqHtxXrlfMcDK8 bRlj3+ciN3p6tUAWJuJOB0NUbdJ3aDMZlf3A6RQUxEbEH6gDh2xPGSkJt8l2MEgeIvoH qGNRfdcPOQjGJFuV6GtfOa6VFLIJYluXPh2hxKks1b9hC+LITViYfUVgXsOZL829av9n Hc/GIRC8CMuXl/olwhcJxLs9DgKknQvCyoFlx6C4uaZku6c0oL4tKObJr+GCYM80lFWF MbIA== X-Forwarded-Encrypted: i=1; AJvYcCXzhAkeG4hmxw6f+ofFW+UZcIIWBSRgX2EcnTbtuv37VOvL6CNkJRDPzOutwkUtlWBbTMyEx3yyEq+9VhRH3X7MbTgP1bxt71CTNWaT X-Gm-Message-State: AOJu0YzS4GKC4MxsQ57fyI1RRl6umCLINIPI6KlKbIwNa/BecHRdiMVd Za50EdOLGCeOLL/y9L+Q072BMPIuMuWjuVaDjY2P585EE499vVDo X-Google-Smtp-Source: AGHT+IHLWIMLTxaxiwrLGgTR5IbAiakpruN98t/nSP5zdmkwOFP7Mt62Ea/19Rla0vBDPeiZ3C9XfA== X-Received: by 2002:a6b:7207:0:b0:7de:acfe:5b70 with SMTP id ca18e2360f4ac-7e1b51a5750mr2324516439f.2.1715881514628; Thu, 16 May 2024 10:45:14 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.45.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:45:14 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 30/33] drm: use correct ccflags-y spelling Date: Thu, 16 May 2024 11:43:54 -0600 Message-ID: <20240516174357.26755-31-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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 broke builds with: CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy CONFIG_DYNAMIC_DEBUG_CORE=3Dy CONFIG_DYNAMIC_DEBUG=3Dn Also add subdir-ccflags so that all drivers pick up the addition. 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 104b42df2e95..313516fc2ad5 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 drm-y :=3D \ drm_aperture.o \ --=20 2.45.0 From nobody Tue Feb 10 23:53:35 2026 Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (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 6DA80157A5B for ; Thu, 16 May 2024 17:45:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881518; cv=none; b=ng35Lpr4pmpA7+zQ09V72N8wGBq6YyDBXxKdLgkDoqSRcqrebWWSaFMpixftDQrb/U/DiHMy4VOb4AJqSCTMtAYIOM1pX9MZL+OubLxMwclhFfNgko/uxoiT0EQitieku0PDxNMPsq2NgpIaHHIxPR7qhu5GCeKWpKlI6fqFk3k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881518; c=relaxed/simple; bh=IDW+XAqzMf2JCNQNrwCf4kX29FMhjfrpqeWwIrdLGXw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lir6PDukoDbInN99JOSeVs+eFGUMNEfFikFm27VBJswk6mWiGduvWkwbFnvDK+umpzthzgHZi19dVwBtg4TgAZUzVkYWblKzOoMky728SYZQ5ElXpGNu5A2L5MDm1uoqcBvtQ3XGPTHMmYgm3j5VHWpsQa96OnT0X/YofYK3xps= 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=ffW58sF5; arc=none smtp.client-ip=209.85.166.47 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="ffW58sF5" Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-7dad81110cfso63558039f.1 for ; Thu, 16 May 2024 10:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881515; x=1716486315; 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=zFPdE+F/gD/56eOR4FxQzgtphE4VEmnkP/G8x8J3yzs=; b=ffW58sF5bH3pR/yElTjFcLkA1Q7GTgBhbZgEjGZywS4+Bb87uExvmyzhiGWn6dg8rm MiMuR8H4nxkiSD/7biMMkelbltPaOwoU2Nj9VtU5LgrHWGCqnk4/N6Xxf/QUNK/E4dIW VaNst4KKUGVKT+KLc9x401rcLgzWo4cOlsBWsbXqs+VFHryPOmbXYLcH3jh+IeJK3t3l ETuQ33c78GWwJ6d3ll1mp3TPbMou9jfO+7NKT3Gnas3Qz++1GcAM62FsDu/PhBpFU3CJ HnOllbA4WbzDDp55tS6YiCWT8rHFC2LFl/I6jykzAT37jTzo+TaD9H7M7MC9OTdV7yko 74HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881515; x=1716486315; 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=zFPdE+F/gD/56eOR4FxQzgtphE4VEmnkP/G8x8J3yzs=; b=ropVBblINczPoS1ZKaEMk+AS+2q+dTML3Y9NGnDz3tgBJELg28LC7SQ8j2mTAvc1jb bLJiuFdAmIr+MYgUZSlgsponFJSJ/cBai1t5hyKps6LwX89wQuUX7/l1lijIlHuTHrgY zuLks1vlhLNvqFsKuUs8FKz/dWWvltDpE6sf1927rsAKZaWxgeR/miGMUg7CeJyxmX+i MMHFO2MHPP7GIOR7Gc9aTwTzAB0T6FJKZfrkc3nS6jvTGOP2pv15DAlFVCKO28vWk//V MPGHVaFKlMVy98eWibExrNV7lGIgBXFGqyeRBjSjg9733QiL5wGxdZoGnSD0AT20asTq 8Xgg== X-Forwarded-Encrypted: i=1; AJvYcCUGDPCr0IJWv8qA4W3s0gSzNqIYZAhDfrAHPrxiglHmRRyByG+47iMBLgRz+Z0jhS3yTdX05wThX10uL5knB1gaAlrIaCXdUQ295Xgn X-Gm-Message-State: AOJu0Yyb5uia2LOanBwpbfWaBr4uqZmZGwCnflp93Uzt0KcSuRs0JD0M EAU7sWrUarBfeSpRv5vjm7N6R9Xyh8GZrotALnFG34HXRjV0lArO X-Google-Smtp-Source: AGHT+IHhwjPcza3cjyisMDtn6nSQ17rVOTRJT6FgHoSbsSj7BNYjtNHxIZaN5zg722Q4Ov58DRyqwQ== X-Received: by 2002:a05:6e02:218a:b0:368:efa4:bdf8 with SMTP id e9e14a558f8ab-36cc14c0c98mr242198095ab.21.1715881515664; Thu, 16 May 2024 10:45:15 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.45.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:45:15 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 31/33] drm-drivers: DRM_CLASSMAP_USE in 2nd batch of drivers, helpers Date: Thu, 16 May 2024 11:43:55 -0600 Message-ID: <20240516174357.26755-32-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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 a DRM_CLASSMAP_USE declaration to 2nd batch of helpers and *_drv.c files. For drivers, add the decl just above the module's PARAMs, since it identifies the "inherited" drm.debug param. Note: with CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy, a module not also declaring DRM_CLASSMAP_USE will have its class'd prdbgs stuck in the initial (disabled, but for DEBUG) state. The stuck sites are evident in /proc/dynamic_debug/control as: class:_UNKNOWN_ _id:N # control's last column rather than a proper "enumeration": class:DRM_UT_CORE TLDR: This set of updates was found by choosing M for all DRM-config items I found (not allmodconfig), building & modprobing them, and grepping "class unknown," control. There may yet be others. Signed-off-by: Jim Cromie --- drivers/gpu/drm/drm_gem_shmem_helper.c | 2 ++ drivers/gpu/drm/gud/gud_drv.c | 2 ++ drivers/gpu/drm/mgag200/mgag200_drv.c | 2 ++ drivers/gpu/drm/qxl/qxl_drv.c | 2 ++ drivers/gpu/drm/radeon/radeon_drv.c | 2 ++ drivers/gpu/drm/udl/udl_main.c | 2 ++ drivers/gpu/drm/vkms/vkms_drv.c | 2 ++ drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 ++ 8 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_g= em_shmem_helper.c index e435f986cd13..066d906e3199 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -23,6 +23,8 @@ #include #include =20 +DRM_CLASSMAP_USE(drm_debug_classes); + MODULE_IMPORT_NS(DMA_BUF); =20 /** diff --git a/drivers/gpu/drm/gud/gud_drv.c b/drivers/gpu/drm/gud/gud_drv.c index 9d7bf8ee45f1..5b555045fce4 100644 --- a/drivers/gpu/drm/gud/gud_drv.c +++ b/drivers/gpu/drm/gud/gud_drv.c @@ -31,6 +31,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, diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag20= 0/mgag200_drv.c index 573dbe256aa8..88c5e24cc894 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -25,6 +25,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; diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c index beee5563031a..1971bfa8a8a6 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.c +++ b/drivers/gpu/drm/qxl/qxl_drv.c @@ -65,6 +65,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 diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/r= adeon_drv.c index 7bf08164140e..d22308328c76 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -247,6 +247,8 @@ int radeon_cik_support =3D 1; MODULE_PARM_DESC(cik_support, "CIK support (1 =3D enabled (default), 0 =3D= disabled)"); module_param_named(cik_support, radeon_cik_support, int, 0444); =20 +DRM_CLASSMAP_USE(drm_debug_classes); + static struct pci_device_id pciidlist[] =3D { radeon_PCI_IDS }; 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 diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_dr= v.c index dd0af086e7fa..086797c4b82b 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"); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/v= mwgfx_drv.c index 58fb40c93100..c159f4d186a3 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -275,6 +275,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.45.0 From nobody Tue Feb 10 23:53:35 2026 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 728A915D5A3 for ; Thu, 16 May 2024 17:45:17 +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=1715881518; cv=none; b=HUIjEDXtsREgEIhwn6FYfTC5FZDHn6vCqZxKlfL4sk+ln98auPdlXbUyrN7fonSKeW+ljdipng8lWdGJW3dx7oV9QouRh+A8hUgMZ/ibIFP7XJYyY1H+a1UrFjlpa1KgmElCSqRgq5zGmOSwr5Co5ATASDA2zXrZ/lb7i6Dwveg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881518; c=relaxed/simple; bh=qzdZmDPP6M1aO8K9TyO1qKHrRlVGT2yqxw1T+9OS14c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X7va37zBJdJXtfVQRqCcqEvbCbBhgVEhLt1GjhMklz0E/U+YVKOFiiVMhpBMB10hW1y4Kt6L9ECRmZMZdLgQAVQbTIFtiLDf5DYHlvt7eG4Htngcp9l1v0wI1LGx7GiKgJ52f6L5rtjiyHKqccjPgkmCZHfr7Oan7Sqkvs8X9P8= 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=kUX0mTup; 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="kUX0mTup" Received: by mail-io1-f45.google.com with SMTP id ca18e2360f4ac-7e1fcd2662cso65731939f.2 for ; Thu, 16 May 2024 10:45:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881517; x=1716486317; 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=umW2ohU1UkA0RFXV0PRie5tCM7KJ6Ljf1jyfGlyoHPI=; b=kUX0mTupvf33c5dTRduwRNxGcD1irPC/odVAgOZ0osBT9nAAgwl1idg3wx5rXT31EY +fNeVjo3peDbpMHHTHSpv0YUHlGsp/fy/p0CFqmPJq6XV5PcvHrNtp/MTRQzfgLfzIBL n9U0k+xqUcWB+l8ULcY12SHlgeDA0CkSF0FOTOvQp47ThpNqWh74kYE4p60GBjnVPLcE nqgjv5qfcueyUoBDSE4n/yOihnVHufc8vqreVZt0WlwL9aygaWOUSQcPEga2qY05ekH+ feytPWk/RCeaWl2EO4H4u1x7D/o+reyEYmCe93KF64TbCpuAUK+L8fUK/SI4EmkGovnr /mzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881517; x=1716486317; 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=umW2ohU1UkA0RFXV0PRie5tCM7KJ6Ljf1jyfGlyoHPI=; b=pOgKIzqepzn9cN3+MJkPvRcyfU1whQFEJG3R/Qr3mS688bfvJsPsywEg+/26GzpoQ4 50ZJ+KRQBzOP9eex3vJeLgrOVQrSbf/5hqxN2yk+eDf7ULvxRV4sCFmOzVCjo94ttO7h 9yfTFypw4ToLURUwvFZgj3SEAJa8amGrAzO4io5KRu/o3Pg2RTF0pAVe/byoTstVYYTx XKoGqZ9JbPY+0dJMpBvz3SED+kQgfdcZM11LYuWzAQ7GYC+Gf0R/47h/ICcUUPZjhyKo WqqT5Y1fIFS/jk83/a0zdEO/+ZHO25lJU2SQBQmT12IOE3bMT95z/swAKqWW3wmy8ILj Tckw== X-Forwarded-Encrypted: i=1; AJvYcCXNX7+pEWgHEAO3YuFrWK4NzIy3imtKBSiLWAKL4onRKlWyL4zjQM2rkBWmSVb0GniHwVSUqUng+/rRoPPJT1Op9BD/7eSGg3+TqLlU X-Gm-Message-State: AOJu0YwdHVGDBc/XnR2gkt5+beibAI94hIDWwaM4+dbim+8Ri/BXV9px 5YVQxEiCPc8CLH8kjUl1KHHGKYOdTPftjGZbkkzFd+YjccvQfW4y X-Google-Smtp-Source: AGHT+IGI0+lqQOeQnQX/2hVkZUduClO6F81d4lh4jwHt3miuorVA7EdliDmmlizmSbrVis0FmBe97g== X-Received: by 2002:a05:6e02:1988:b0:36c:4348:35d7 with SMTP id e9e14a558f8ab-36cc1473f49mr218076905ab.9.1715881516680; Thu, 16 May 2024 10:45:16 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.45.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:45:16 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 32/33] drm: restore CONFIG_DRM_USE_DYNAMIC_DEBUG un-BROKEN Date: Thu, 16 May 2024 11:43:56 -0600 Message-ID: <20240516174357.26755-33-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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 quality CI 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 5a0c476361c3..b2ea73ae48f0 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -54,8 +54,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.45.0 From nobody Tue Feb 10 23:53:35 2026 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 71E6415D5C3 for ; Thu, 16 May 2024 17:45:18 +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=1715881519; cv=none; b=Y77/TJLi2+FONQGZVmCShd0Yfv3PJr0W6By1bbZzjfwJRtdouMQyLU7bTKESke4VNiRlFJnj5ixOZXQETNTIguOcbsVBi3pIrK2aE6QRNJfGpfCfnID7wdPtI6ViSwzn4xHpeOzr+LY4NlRdK0k+aOn6qAgv7+/sFofo0zriQJ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715881519; c=relaxed/simple; bh=hGQelBUkaq/JZLSbxTsxKeLUlq22tohYzqKCLBLJTiU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lvT3mgftc57JQP0fQk2k3yBTcQVGIDmTUviUNn4yNZUcz/BPgMOm6/vfXycikY95F6b05aTwIpNJiird2CV0FbAg3uSgxK1DkdJSF9qj6s+glD54MXXTHl2GeZ7pPXROfFhU01U5jiq5T/Xc2sYdvlTMqBCwgzI0zUgMqYqhX74= 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=kSTI7V4D; 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="kSTI7V4D" Received: by mail-io1-f41.google.com with SMTP id ca18e2360f4ac-7e1b4f96994so67090839f.2 for ; Thu, 16 May 2024 10:45:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715881517; x=1716486317; 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=ukR4HOtDmG+aiLIkXxjNBu5JDcDw31zQRKh9uhizZeM=; b=kSTI7V4DRLIQmmsPw/LcgWQ47FyLVY+4h07wKV6oSS5LEH+TV2jQxk47sgwm7eNOEC JVbTlNT0jyXxXLI519Mg6E6TS1qSfmabmUsVEZHVpkxqxRI+MsDWWDjVbuEQFmRQuvcQ fF6IUVdhwCd+Wdt08cc52Zu883kiQ8YeQyEqO2fBONJBJFI7VqqyGMapWhMU0CX6MR3B tyaeZn6a6s9V4OWLfJ0T6pKuD1B21b3g6R/+Sy7qWfYrtADDOo3J2hmdjFsRFRroe5rE VJpbzEvBUx5HIvNdwlSwYdJWKXpbRR536rKXVu3YFUmGD9jwj75nyGySY5piuCfRCsH2 8MBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881517; x=1716486317; 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=ukR4HOtDmG+aiLIkXxjNBu5JDcDw31zQRKh9uhizZeM=; b=oTexwPdo1PVUT9ajhuXvjnOZCCgUvfRqe/woNEMV6KT5ooo3iheGAds0enEs4HOTJ9 ECFZ4Ufzcg+kqv3RJLyKRK2s01bW9/hWZuVXCR2IuGjMVzjpVpf34cz82iQuJRo29nzt +hu44fE/+v9n6lRHk40PrXZoc9bJZGljsCKRgvZTK8+8EKILCyYtOE0vwo7g+HCLzP0j XiRl6t34jhtKEsuSr3mlXZ+O3uvH4Ob3maN4amb+dvDk9ika7433wwODLezl2iw1Xxxu DYOk2KwoI+4e8E4uhdVcrWIE02jbRcaMJj3HbcaXmydOmM5/8RqNQYPEa9hfyO51zyHW palA== X-Forwarded-Encrypted: i=1; AJvYcCX9PiuKsHI00L2nO2m9d0yyuCyPWUNPsildwOtGW5qs0jhbYjMEk2YktlZ93XZhCzoLzzNS0wCc4VSZqOIP5dJ7RO4YVK0jpRwBI7rF X-Gm-Message-State: AOJu0YycCtuOxbG7jhY8GuQUvRoijpYq20khTUpCPXfUWTe273vdbItO RRydfNqZ3XUql6RCHPEdyDsvVBSx8KZ7s+6sHV9XZYs/YLusTt9P X-Google-Smtp-Source: AGHT+IF+loahpwgX1qQzZzX7o852RXgHf2TH/P0vy4pdFWNAsBt/Ni5cQCu5Kzr6tBou3N9C6Q+Msw== X-Received: by 2002:a05:6602:1311:b0:7e1:896e:5065 with SMTP id ca18e2360f4ac-7e1b520203amr2097824439f.14.1715881517661; Thu, 16 May 2024 10:45:17 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 8926c6da1cb9f-4893715057csm4273595173.80.2024.05.16.10.45.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:45:17 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: ukaszb@chromium.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, Jim Cromie Subject: [PATCH v8-RESEND 33/33] drm-print: workaround compiler meh Date: Thu, 16 May 2024 11:43:57 -0600 Message-ID: <20240516174357.26755-34-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516174357.26755-1-jim.cromie@gmail.com> References: <20240516174357.26755-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" For some reason I cannot grok, I get an unused variable 'category' warning/error, though the usage follows immediately. This drops the local var and directly derefs in the macro-call, which somehow avoids the warning. commit 9fd6f61a297e ("drm/print: add drm_dbg_printer() for drm device speci= fic printer") CC: Jani Nikula Signed-off-by: Jim Cromie --- 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 efdf82f8cbbb..c400441cd77e 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -183,11 +183,10 @@ 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; const char *prefix =3D p->prefix ?: ""; const char *prefix_pad =3D p->prefix ? " " : ""; =20 - if (!__drm_debug_enabled(category)) + if (!__drm_debug_enabled(p->category)) return; =20 /* Note: __builtin_return_address(0) is useless here. */ --=20 2.45.0