From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1ED51C433FE for ; Mon, 16 May 2022 22:57:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349915AbiEPW5p (ORCPT ); Mon, 16 May 2022 18:57:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350016AbiEPW53 (ORCPT ); Mon, 16 May 2022 18:57:29 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A33C942EF0; Mon, 16 May 2022 15:57:22 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id z26so17596745iot.8; Mon, 16 May 2022 15:57:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NVvP6ii8T54t9tBCAwTvz1dz4MZixkOISs4Qo1GSsZ8=; b=KaaEEVL/0Fno1HcfyHEf4z/GuhJ9D5azg/OjAEcSM6DLHTTuis6Xccyy1ycBgsKvpc yABcTngNZ6IB03n9FcCx+x5tr0OGamuH26VwGNrMjTbOMMi3HONtobw/Fogsnt465ByI FqVV8k8b/C02uYoFKxmplXXpTfBsJRhKRWbwMypPmFFywgnvDLRfylUFScGzQrVHxrQQ quJrCJ+HWHexPzKsRTX4u7w9PgYJi+eoJzechmdTsbGzUZEhZ3M67srd2/FZnTHT4wAL 5GKOiLS5DBwinLdgp5CUnslbZp4lzqFBT2wT+LC84PQkn2+HOK4+oLgm9CfIPrV9vv7K DzZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NVvP6ii8T54t9tBCAwTvz1dz4MZixkOISs4Qo1GSsZ8=; b=0yG8N5wXiwgLDV9WI9VwH0Xqg5pzvNRgnlf8Z0R+Dl5QsaGjoXpU0eyba/8uDpDIbz Hls6D4wRl9fN4SPGb01Jo98O/LbgvUVBgpym6ayqrnp1qhTPqRP336VjvSPDHIhgh9h6 Hyzridk+lI6keR0zpmWJRzbup80ZtZgt/OW58AAfhX14cTfOuo3Jav0hbM3N3BPJZSxl brtgdtLqIo0qtQD7rBaN4EXdhkOcJdqcjkduEKp+zcotxA6TR4WQau8PNDgRcHQwXVbS FRmwHtV8mrxqpcbRVPb5HR5hFwf6aCzafy96q0cJuxad9fGCZMY1DeVYzNCmo/Zd/yED gBYA== X-Gm-Message-State: AOAM531ULnYtOoEpDXjBnxfVKdfkdt324NPO0ujLuilRhsTG9Yb91mhk 9A/9T0w9YmeOOLrwEOTV6Mg= X-Google-Smtp-Source: ABdhPJz8lyov+C1KJqzppIklQpEs/1gCdUKmcwNab/OloZ1fJ1162ay06ESiwgFyboGG2TdJ0eSyzw== X-Received: by 2002:a5d:9f42:0:b0:654:9a2b:cab1 with SMTP id u2-20020a5d9f42000000b006549a2bcab1mr9039211iot.89.1652741841822; Mon, 16 May 2022 15:57:21 -0700 (PDT) Received: from frodo.hsd1.co.comcast.net ([2601:284:8204:2010::dd9f]) by smtp.googlemail.com with ESMTPSA id k26-20020a02661a000000b0032b74686763sm3133949jac.76.2022.05.16.15.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 15:57:21 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: gregkh@linuxfoundation.org, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v2 17/27] drm_print: condense enum drm_debug_category Date: Mon, 16 May 2022 16:56:30 -0600 Message-Id: <20220516225640.3102269-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220516225640.3102269-1-jim.cromie@gmail.com> References: <20220516225640.3102269-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org enum drm_debug_category has 10 categories, but is initialized with bitmasks which require 10 bits of underlying storage. By using natural enumeration, and moving the BIT(cat) into drm_debug_enabled(), the enum fits in 4 bits, allowing the category to be represented directly in pr_debug callsites, via the ddebug.class_id field. While this slightly pessimizes the bit-test in drm_debug_enabled(), using dyndbg with JUMP_LABEL will avoid the function entirely. NOTE: this change forecloses the possibility of doing: drm_dbg(DRM_UT_CORE|DRM_UT_KMS, "weird 2-cat experiment") but thats already strongly implied by the use of the enum itself; its not a normal enum if it can be 2 values simultaneously. Signed-off-by: Jim Cromie --- include/drm/drm_print.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 0597137bac75..a157485bf573 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -284,49 +284,49 @@ enum drm_debug_category { * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, * drm_memory.c, ... */ - DRM_UT_CORE = 0x01, + DRM_UT_CORE, /** * @DRM_UT_DRIVER: Used in the vendor specific part of the driver: i915, * radeon, ... macro. */ - DRM_UT_DRIVER = 0x02, + DRM_UT_DRIVER, /** * @DRM_UT_KMS: Used in the modesetting code. */ - DRM_UT_KMS = 0x04, + DRM_UT_KMS, /** * @DRM_UT_PRIME: Used in the prime code. */ - DRM_UT_PRIME = 0x08, + DRM_UT_PRIME, /** * @DRM_UT_ATOMIC: Used in the atomic code. */ - DRM_UT_ATOMIC = 0x10, + DRM_UT_ATOMIC, /** * @DRM_UT_VBL: Used for verbose debug message in the vblank code. */ - DRM_UT_VBL = 0x20, + DRM_UT_VBL, /** * @DRM_UT_STATE: Used for verbose atomic state debugging. */ - DRM_UT_STATE = 0x40, + DRM_UT_STATE, /** * @DRM_UT_LEASE: Used in the lease code. */ - DRM_UT_LEASE = 0x80, + DRM_UT_LEASE, /** * @DRM_UT_DP: Used in the DP code. */ - DRM_UT_DP = 0x100, + DRM_UT_DP, /** * @DRM_UT_DRMRES: Used in the drm managed resources code. */ - DRM_UT_DRMRES = 0x200, + DRM_UT_DRMRES }; static inline bool drm_debug_enabled(enum drm_debug_category category) { - return unlikely(__drm_debug & category); + return unlikely(__drm_debug & BIT(category)); } /* -- 2.35.3 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C84A4C433FE for ; Mon, 16 May 2022 22:58:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 084F610F054; Mon, 16 May 2022 22:57:27 +0000 (UTC) Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2D4C810EE55; Mon, 16 May 2022 22:57:22 +0000 (UTC) Received: by mail-io1-xd32.google.com with SMTP id m6so17635914iob.4; Mon, 16 May 2022 15:57:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NVvP6ii8T54t9tBCAwTvz1dz4MZixkOISs4Qo1GSsZ8=; b=KaaEEVL/0Fno1HcfyHEf4z/GuhJ9D5azg/OjAEcSM6DLHTTuis6Xccyy1ycBgsKvpc yABcTngNZ6IB03n9FcCx+x5tr0OGamuH26VwGNrMjTbOMMi3HONtobw/Fogsnt465ByI FqVV8k8b/C02uYoFKxmplXXpTfBsJRhKRWbwMypPmFFywgnvDLRfylUFScGzQrVHxrQQ quJrCJ+HWHexPzKsRTX4u7w9PgYJi+eoJzechmdTsbGzUZEhZ3M67srd2/FZnTHT4wAL 5GKOiLS5DBwinLdgp5CUnslbZp4lzqFBT2wT+LC84PQkn2+HOK4+oLgm9CfIPrV9vv7K DzZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NVvP6ii8T54t9tBCAwTvz1dz4MZixkOISs4Qo1GSsZ8=; b=2lq59r48ksiUyJ2advAFElH5C4zjjPSx3JbP7kNaHYSG1UyBMSl7RUZ+zpHbmhHc8D WyufyK+6FySxAz0rMsdayqofZHEQ5HNHkPqbmHnONZQPQUPhpa23rnykRcF3xSpzqHQV bX8LUKlgjapBkcBPPQqJfFq8kB1nM1aftJsvU3t1qVbeKVm1GD2I+arLngZcfTvejcnZ xm3Jimpn1mja0KBTfR/bFRFz1Et8w4Ch0yyfTRyoRlBkufGGZAqV3OIH7WbjLJu6rjkU rVzo48FtsNEp/E1dkAAUjABOXKtIQH/ySy8SSKUmzXx4VPcqhy9fbpvKVbl1inX5XAZv PzvQ== X-Gm-Message-State: AOAM532lg6CJ+Rn83t6KtEO3vQeYjoRLpL+kOsboujg0QeBVsTgS4jOj zeVjspnl63hXf+vbuAvK0ujiq1fVL24= X-Google-Smtp-Source: ABdhPJz8lyov+C1KJqzppIklQpEs/1gCdUKmcwNab/OloZ1fJ1162ay06ESiwgFyboGG2TdJ0eSyzw== X-Received: by 2002:a5d:9f42:0:b0:654:9a2b:cab1 with SMTP id u2-20020a5d9f42000000b006549a2bcab1mr9039211iot.89.1652741841822; Mon, 16 May 2022 15:57:21 -0700 (PDT) Received: from frodo.hsd1.co.comcast.net ([2601:284:8204:2010::dd9f]) by smtp.googlemail.com with ESMTPSA id k26-20020a02661a000000b0032b74686763sm3133949jac.76.2022.05.16.15.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 15:57:21 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: [PATCH v2 17/27] drm_print: condense enum drm_debug_category Date: Mon, 16 May 2022 16:56:30 -0600 Message-Id: <20220516225640.3102269-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220516225640.3102269-1-jim.cromie@gmail.com> References: <20220516225640.3102269-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: maz@kernel.org, quic_saipraka@quicinc.com, catalin.marinas@arm.com, arnd@arndb.de, gregkh@linuxfoundation.org, linux-arm-msm@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, mathieu.desnoyers@efficios.com, quic_psodagud@quicinc.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, will@kernel.org, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" enum drm_debug_category has 10 categories, but is initialized with bitmasks which require 10 bits of underlying storage. By using natural enumeration, and moving the BIT(cat) into drm_debug_enabled(), the enum fits in 4 bits, allowing the category to be represented directly in pr_debug callsites, via the ddebug.class_id field. While this slightly pessimizes the bit-test in drm_debug_enabled(), using dyndbg with JUMP_LABEL will avoid the function entirely. NOTE: this change forecloses the possibility of doing: drm_dbg(DRM_UT_CORE|DRM_UT_KMS, "weird 2-cat experiment") but thats already strongly implied by the use of the enum itself; its not a normal enum if it can be 2 values simultaneously. Signed-off-by: Jim Cromie --- include/drm/drm_print.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 0597137bac75..a157485bf573 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -284,49 +284,49 @@ enum drm_debug_category { * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, * drm_memory.c, ... */ - DRM_UT_CORE = 0x01, + DRM_UT_CORE, /** * @DRM_UT_DRIVER: Used in the vendor specific part of the driver: i915, * radeon, ... macro. */ - DRM_UT_DRIVER = 0x02, + DRM_UT_DRIVER, /** * @DRM_UT_KMS: Used in the modesetting code. */ - DRM_UT_KMS = 0x04, + DRM_UT_KMS, /** * @DRM_UT_PRIME: Used in the prime code. */ - DRM_UT_PRIME = 0x08, + DRM_UT_PRIME, /** * @DRM_UT_ATOMIC: Used in the atomic code. */ - DRM_UT_ATOMIC = 0x10, + DRM_UT_ATOMIC, /** * @DRM_UT_VBL: Used for verbose debug message in the vblank code. */ - DRM_UT_VBL = 0x20, + DRM_UT_VBL, /** * @DRM_UT_STATE: Used for verbose atomic state debugging. */ - DRM_UT_STATE = 0x40, + DRM_UT_STATE, /** * @DRM_UT_LEASE: Used in the lease code. */ - DRM_UT_LEASE = 0x80, + DRM_UT_LEASE, /** * @DRM_UT_DP: Used in the DP code. */ - DRM_UT_DP = 0x100, + DRM_UT_DP, /** * @DRM_UT_DRMRES: Used in the drm managed resources code. */ - DRM_UT_DRMRES = 0x200, + DRM_UT_DRMRES }; static inline bool drm_debug_enabled(enum drm_debug_category category) { - return unlikely(__drm_debug & category); + return unlikely(__drm_debug & BIT(category)); } /* -- 2.35.3 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E81A4C433FE for ; Mon, 16 May 2022 22:58:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 36A9E10F1DB; Mon, 16 May 2022 22:57:27 +0000 (UTC) Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2D4C810EE55; Mon, 16 May 2022 22:57:22 +0000 (UTC) Received: by mail-io1-xd32.google.com with SMTP id m6so17635914iob.4; Mon, 16 May 2022 15:57:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NVvP6ii8T54t9tBCAwTvz1dz4MZixkOISs4Qo1GSsZ8=; b=KaaEEVL/0Fno1HcfyHEf4z/GuhJ9D5azg/OjAEcSM6DLHTTuis6Xccyy1ycBgsKvpc yABcTngNZ6IB03n9FcCx+x5tr0OGamuH26VwGNrMjTbOMMi3HONtobw/Fogsnt465ByI FqVV8k8b/C02uYoFKxmplXXpTfBsJRhKRWbwMypPmFFywgnvDLRfylUFScGzQrVHxrQQ quJrCJ+HWHexPzKsRTX4u7w9PgYJi+eoJzechmdTsbGzUZEhZ3M67srd2/FZnTHT4wAL 5GKOiLS5DBwinLdgp5CUnslbZp4lzqFBT2wT+LC84PQkn2+HOK4+oLgm9CfIPrV9vv7K DzZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NVvP6ii8T54t9tBCAwTvz1dz4MZixkOISs4Qo1GSsZ8=; b=2lq59r48ksiUyJ2advAFElH5C4zjjPSx3JbP7kNaHYSG1UyBMSl7RUZ+zpHbmhHc8D WyufyK+6FySxAz0rMsdayqofZHEQ5HNHkPqbmHnONZQPQUPhpa23rnykRcF3xSpzqHQV bX8LUKlgjapBkcBPPQqJfFq8kB1nM1aftJsvU3t1qVbeKVm1GD2I+arLngZcfTvejcnZ xm3Jimpn1mja0KBTfR/bFRFz1Et8w4Ch0yyfTRyoRlBkufGGZAqV3OIH7WbjLJu6rjkU rVzo48FtsNEp/E1dkAAUjABOXKtIQH/ySy8SSKUmzXx4VPcqhy9fbpvKVbl1inX5XAZv PzvQ== X-Gm-Message-State: AOAM532lg6CJ+Rn83t6KtEO3vQeYjoRLpL+kOsboujg0QeBVsTgS4jOj zeVjspnl63hXf+vbuAvK0ujiq1fVL24= X-Google-Smtp-Source: ABdhPJz8lyov+C1KJqzppIklQpEs/1gCdUKmcwNab/OloZ1fJ1162ay06ESiwgFyboGG2TdJ0eSyzw== X-Received: by 2002:a5d:9f42:0:b0:654:9a2b:cab1 with SMTP id u2-20020a5d9f42000000b006549a2bcab1mr9039211iot.89.1652741841822; Mon, 16 May 2022 15:57:21 -0700 (PDT) Received: from frodo.hsd1.co.comcast.net ([2601:284:8204:2010::dd9f]) by smtp.googlemail.com with ESMTPSA id k26-20020a02661a000000b0032b74686763sm3133949jac.76.2022.05.16.15.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 15:57:21 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Mon, 16 May 2022 16:56:30 -0600 Message-Id: <20220516225640.3102269-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220516225640.3102269-1-jim.cromie@gmail.com> References: <20220516225640.3102269-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Intel-gfx] [PATCH v2 17/27] drm_print: condense enum drm_debug_category X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: maz@kernel.org, quic_saipraka@quicinc.com, catalin.marinas@arm.com, arnd@arndb.de, jim.cromie@gmail.com, gregkh@linuxfoundation.org, linux-arm-msm@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, mathieu.desnoyers@efficios.com, quic_psodagud@quicinc.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, will@kernel.org, linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" enum drm_debug_category has 10 categories, but is initialized with bitmasks which require 10 bits of underlying storage. By using natural enumeration, and moving the BIT(cat) into drm_debug_enabled(), the enum fits in 4 bits, allowing the category to be represented directly in pr_debug callsites, via the ddebug.class_id field. While this slightly pessimizes the bit-test in drm_debug_enabled(), using dyndbg with JUMP_LABEL will avoid the function entirely. NOTE: this change forecloses the possibility of doing: drm_dbg(DRM_UT_CORE|DRM_UT_KMS, "weird 2-cat experiment") but thats already strongly implied by the use of the enum itself; its not a normal enum if it can be 2 values simultaneously. Signed-off-by: Jim Cromie --- include/drm/drm_print.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 0597137bac75..a157485bf573 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -284,49 +284,49 @@ enum drm_debug_category { * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, * drm_memory.c, ... */ - DRM_UT_CORE = 0x01, + DRM_UT_CORE, /** * @DRM_UT_DRIVER: Used in the vendor specific part of the driver: i915, * radeon, ... macro. */ - DRM_UT_DRIVER = 0x02, + DRM_UT_DRIVER, /** * @DRM_UT_KMS: Used in the modesetting code. */ - DRM_UT_KMS = 0x04, + DRM_UT_KMS, /** * @DRM_UT_PRIME: Used in the prime code. */ - DRM_UT_PRIME = 0x08, + DRM_UT_PRIME, /** * @DRM_UT_ATOMIC: Used in the atomic code. */ - DRM_UT_ATOMIC = 0x10, + DRM_UT_ATOMIC, /** * @DRM_UT_VBL: Used for verbose debug message in the vblank code. */ - DRM_UT_VBL = 0x20, + DRM_UT_VBL, /** * @DRM_UT_STATE: Used for verbose atomic state debugging. */ - DRM_UT_STATE = 0x40, + DRM_UT_STATE, /** * @DRM_UT_LEASE: Used in the lease code. */ - DRM_UT_LEASE = 0x80, + DRM_UT_LEASE, /** * @DRM_UT_DP: Used in the DP code. */ - DRM_UT_DP = 0x100, + DRM_UT_DP, /** * @DRM_UT_DRMRES: Used in the drm managed resources code. */ - DRM_UT_DRMRES = 0x200, + DRM_UT_DRMRES }; static inline bool drm_debug_enabled(enum drm_debug_category category) { - return unlikely(__drm_debug & category); + return unlikely(__drm_debug & BIT(category)); } /* -- 2.35.3 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5546FC433FE for ; Mon, 16 May 2022 22:58:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4C02E10E819; Mon, 16 May 2022 22:57:28 +0000 (UTC) Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2D4C810EE55; Mon, 16 May 2022 22:57:22 +0000 (UTC) Received: by mail-io1-xd32.google.com with SMTP id m6so17635914iob.4; Mon, 16 May 2022 15:57:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NVvP6ii8T54t9tBCAwTvz1dz4MZixkOISs4Qo1GSsZ8=; b=KaaEEVL/0Fno1HcfyHEf4z/GuhJ9D5azg/OjAEcSM6DLHTTuis6Xccyy1ycBgsKvpc yABcTngNZ6IB03n9FcCx+x5tr0OGamuH26VwGNrMjTbOMMi3HONtobw/Fogsnt465ByI FqVV8k8b/C02uYoFKxmplXXpTfBsJRhKRWbwMypPmFFywgnvDLRfylUFScGzQrVHxrQQ quJrCJ+HWHexPzKsRTX4u7w9PgYJi+eoJzechmdTsbGzUZEhZ3M67srd2/FZnTHT4wAL 5GKOiLS5DBwinLdgp5CUnslbZp4lzqFBT2wT+LC84PQkn2+HOK4+oLgm9CfIPrV9vv7K DzZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NVvP6ii8T54t9tBCAwTvz1dz4MZixkOISs4Qo1GSsZ8=; b=2lq59r48ksiUyJ2advAFElH5C4zjjPSx3JbP7kNaHYSG1UyBMSl7RUZ+zpHbmhHc8D WyufyK+6FySxAz0rMsdayqofZHEQ5HNHkPqbmHnONZQPQUPhpa23rnykRcF3xSpzqHQV bX8LUKlgjapBkcBPPQqJfFq8kB1nM1aftJsvU3t1qVbeKVm1GD2I+arLngZcfTvejcnZ xm3Jimpn1mja0KBTfR/bFRFz1Et8w4Ch0yyfTRyoRlBkufGGZAqV3OIH7WbjLJu6rjkU rVzo48FtsNEp/E1dkAAUjABOXKtIQH/ySy8SSKUmzXx4VPcqhy9fbpvKVbl1inX5XAZv PzvQ== X-Gm-Message-State: AOAM532lg6CJ+Rn83t6KtEO3vQeYjoRLpL+kOsboujg0QeBVsTgS4jOj zeVjspnl63hXf+vbuAvK0ujiq1fVL24= X-Google-Smtp-Source: ABdhPJz8lyov+C1KJqzppIklQpEs/1gCdUKmcwNab/OloZ1fJ1162ay06ESiwgFyboGG2TdJ0eSyzw== X-Received: by 2002:a5d:9f42:0:b0:654:9a2b:cab1 with SMTP id u2-20020a5d9f42000000b006549a2bcab1mr9039211iot.89.1652741841822; Mon, 16 May 2022 15:57:21 -0700 (PDT) Received: from frodo.hsd1.co.comcast.net ([2601:284:8204:2010::dd9f]) by smtp.googlemail.com with ESMTPSA id k26-20020a02661a000000b0032b74686763sm3133949jac.76.2022.05.16.15.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 15:57:21 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: [PATCH v2 17/27] drm_print: condense enum drm_debug_category Date: Mon, 16 May 2022 16:56:30 -0600 Message-Id: <20220516225640.3102269-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220516225640.3102269-1-jim.cromie@gmail.com> References: <20220516225640.3102269-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: maz@kernel.org, quic_saipraka@quicinc.com, catalin.marinas@arm.com, arnd@arndb.de, jim.cromie@gmail.com, gregkh@linuxfoundation.org, linux-arm-msm@vger.kernel.org, rostedt@goodmis.org, robdclark@gmail.com, mingo@redhat.com, mathieu.desnoyers@efficios.com, quic_psodagud@quicinc.com, daniel.vetter@ffwll.ch, seanpaul@chromium.org, will@kernel.org, linux-arm-kernel@lists.infradead.org Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" enum drm_debug_category has 10 categories, but is initialized with bitmasks which require 10 bits of underlying storage. By using natural enumeration, and moving the BIT(cat) into drm_debug_enabled(), the enum fits in 4 bits, allowing the category to be represented directly in pr_debug callsites, via the ddebug.class_id field. While this slightly pessimizes the bit-test in drm_debug_enabled(), using dyndbg with JUMP_LABEL will avoid the function entirely. NOTE: this change forecloses the possibility of doing: drm_dbg(DRM_UT_CORE|DRM_UT_KMS, "weird 2-cat experiment") but thats already strongly implied by the use of the enum itself; its not a normal enum if it can be 2 values simultaneously. Signed-off-by: Jim Cromie --- include/drm/drm_print.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 0597137bac75..a157485bf573 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -284,49 +284,49 @@ enum drm_debug_category { * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, * drm_memory.c, ... */ - DRM_UT_CORE = 0x01, + DRM_UT_CORE, /** * @DRM_UT_DRIVER: Used in the vendor specific part of the driver: i915, * radeon, ... macro. */ - DRM_UT_DRIVER = 0x02, + DRM_UT_DRIVER, /** * @DRM_UT_KMS: Used in the modesetting code. */ - DRM_UT_KMS = 0x04, + DRM_UT_KMS, /** * @DRM_UT_PRIME: Used in the prime code. */ - DRM_UT_PRIME = 0x08, + DRM_UT_PRIME, /** * @DRM_UT_ATOMIC: Used in the atomic code. */ - DRM_UT_ATOMIC = 0x10, + DRM_UT_ATOMIC, /** * @DRM_UT_VBL: Used for verbose debug message in the vblank code. */ - DRM_UT_VBL = 0x20, + DRM_UT_VBL, /** * @DRM_UT_STATE: Used for verbose atomic state debugging. */ - DRM_UT_STATE = 0x40, + DRM_UT_STATE, /** * @DRM_UT_LEASE: Used in the lease code. */ - DRM_UT_LEASE = 0x80, + DRM_UT_LEASE, /** * @DRM_UT_DP: Used in the DP code. */ - DRM_UT_DP = 0x100, + DRM_UT_DP, /** * @DRM_UT_DRMRES: Used in the drm managed resources code. */ - DRM_UT_DRMRES = 0x200, + DRM_UT_DRMRES }; static inline bool drm_debug_enabled(enum drm_debug_category category) { - return unlikely(__drm_debug & category); + return unlikely(__drm_debug & BIT(category)); } /* -- 2.35.3 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 81EEEC433F5 for ; Mon, 16 May 2022 23:15:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Xr72/oPHAMshqBOB9Yy5P5z4twbFMIA3UGHTJuqtIr0=; b=fh1U7VXRBdILT8 Nj2Ngz2Oz3ErovpqClFl2ZyE6/Ss3BLiy40HYwFT6Dbtey08nyUEhz05hr+ZGWzfEY159jXtwTID+ /sIFQ2dzO0C7R5t8fiYkFg4afDlNN8IwzcG9xOL9SE95OZO4CGIMvKoDLeaTadiih/LMg3XEfctVS /Bjf3B+rJts5YhS5U6pm4B9w0WkSYkLR2AWtaGh/LUSUl2zO+tF7p+vTY3J3rylYouJu2JzlPRuH+ atwDjYkU+fMcWmh1YgwYhqddllsX57e/sdt46xG6F7hfVVLFyKIFvTp5Lz7uMQD8Z5uwOoHehtDuT +Dj2DB7VRvJ5aT9RXeRQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqjuv-00AhMp-JK; Mon, 16 May 2022 23:14:23 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqjec-00AZfP-V5 for linux-arm-kernel@bombadil.infradead.org; Mon, 16 May 2022 22:57:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=NVvP6ii8T54t9tBCAwTvz1dz4MZixkOISs4Qo1GSsZ8=; b=kFbgm6OMdFmxu4zk078RIw9AJS V/s/Fq8QmgL1CLo33x8G+n9jbTJmSH6KIcBUzw1E6mMS0kNygqxQ638/5lPHAD6uwisEsxiwC0NLi h/QInuRttaQYtk3n0n5Qa+8Fh0oRmQt9kuRFIjtK8qgCaw23t80ArE1CVnz6qJCyisoOeEAJsv5GC 65Y5EDGbW+LVmRn4Ac47bLlyuedkUGzjtaEO7wAi3SEozYQObDdq5GcOBsaBC7CUvTvDdMJ1omBhY W1xhBJWzPkXq3tW+Mq3oQUZ735/ibe/Hn/eAHLYlo9g0YNuWjT6thM2FRGJH4s42UhzMLN/6ZjKYB zNjHfP0A==; Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqjeX-0012uL-K7 for linux-arm-kernel@lists.infradead.org; Mon, 16 May 2022 22:57:28 +0000 Received: by mail-io1-xd2c.google.com with SMTP id h85so17602260iof.12 for ; Mon, 16 May 2022 15:57:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NVvP6ii8T54t9tBCAwTvz1dz4MZixkOISs4Qo1GSsZ8=; b=KaaEEVL/0Fno1HcfyHEf4z/GuhJ9D5azg/OjAEcSM6DLHTTuis6Xccyy1ycBgsKvpc yABcTngNZ6IB03n9FcCx+x5tr0OGamuH26VwGNrMjTbOMMi3HONtobw/Fogsnt465ByI FqVV8k8b/C02uYoFKxmplXXpTfBsJRhKRWbwMypPmFFywgnvDLRfylUFScGzQrVHxrQQ quJrCJ+HWHexPzKsRTX4u7w9PgYJi+eoJzechmdTsbGzUZEhZ3M67srd2/FZnTHT4wAL 5GKOiLS5DBwinLdgp5CUnslbZp4lzqFBT2wT+LC84PQkn2+HOK4+oLgm9CfIPrV9vv7K DzZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NVvP6ii8T54t9tBCAwTvz1dz4MZixkOISs4Qo1GSsZ8=; b=56NgtS5UvePOvpqOBcOZr+LUNvsfYgcQp6NNiT305mTKTYZiM/NOzNpFV076gAasXV NnZe5IDM/AGkoH/oYZAGQSEfAdCaz8JhQb+auxcdAm/eQQB5rFJPa9GuI3WQggrdBwfa HTh9M6uRLEQHxbq/2V3YhBTz4CUxCetGMyD+VJFzfPlMjGo6KmCmgxlRr6TMEdTvHatz zYFcsCEYbxCPknBKkl+GPZ2SONBnG+c9inVuhcPsq/gSvqpu6MJQ0VdwjJ7wzdp+/zia NlBrOtb57uA8BFnCi57JaRz69MVPzMGcu4edRcyI0moAfcLuoJjOHmg2cz3UTOL9A8kd wo5A== X-Gm-Message-State: AOAM530g/AMHLTDHVMOvH+9NISqVBn42udeivv2NoNsfJpEBYeK+Bpi4 Nj8LhUdGTwLUz2m/I9Us5Go= X-Google-Smtp-Source: ABdhPJz8lyov+C1KJqzppIklQpEs/1gCdUKmcwNab/OloZ1fJ1162ay06ESiwgFyboGG2TdJ0eSyzw== X-Received: by 2002:a5d:9f42:0:b0:654:9a2b:cab1 with SMTP id u2-20020a5d9f42000000b006549a2bcab1mr9039211iot.89.1652741841822; Mon, 16 May 2022 15:57:21 -0700 (PDT) Received: from frodo.hsd1.co.comcast.net ([2601:284:8204:2010::dd9f]) by smtp.googlemail.com with ESMTPSA id k26-20020a02661a000000b0032b74686763sm3133949jac.76.2022.05.16.15.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 15:57:21 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: gregkh@linuxfoundation.org, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v2 17/27] drm_print: condense enum drm_debug_category Date: Mon, 16 May 2022 16:56:30 -0600 Message-Id: <20220516225640.3102269-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220516225640.3102269-1-jim.cromie@gmail.com> References: <20220516225640.3102269-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220516_235725_919362_2A248D8F X-CRM114-Status: GOOD ( 13.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org enum drm_debug_category has 10 categories, but is initialized with bitmasks which require 10 bits of underlying storage. By using natural enumeration, and moving the BIT(cat) into drm_debug_enabled(), the enum fits in 4 bits, allowing the category to be represented directly in pr_debug callsites, via the ddebug.class_id field. While this slightly pessimizes the bit-test in drm_debug_enabled(), using dyndbg with JUMP_LABEL will avoid the function entirely. NOTE: this change forecloses the possibility of doing: drm_dbg(DRM_UT_CORE|DRM_UT_KMS, "weird 2-cat experiment") but thats already strongly implied by the use of the enum itself; its not a normal enum if it can be 2 values simultaneously. Signed-off-by: Jim Cromie --- include/drm/drm_print.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 0597137bac75..a157485bf573 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -284,49 +284,49 @@ enum drm_debug_category { * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, * drm_memory.c, ... */ - DRM_UT_CORE = 0x01, + DRM_UT_CORE, /** * @DRM_UT_DRIVER: Used in the vendor specific part of the driver: i915, * radeon, ... macro. */ - DRM_UT_DRIVER = 0x02, + DRM_UT_DRIVER, /** * @DRM_UT_KMS: Used in the modesetting code. */ - DRM_UT_KMS = 0x04, + DRM_UT_KMS, /** * @DRM_UT_PRIME: Used in the prime code. */ - DRM_UT_PRIME = 0x08, + DRM_UT_PRIME, /** * @DRM_UT_ATOMIC: Used in the atomic code. */ - DRM_UT_ATOMIC = 0x10, + DRM_UT_ATOMIC, /** * @DRM_UT_VBL: Used for verbose debug message in the vblank code. */ - DRM_UT_VBL = 0x20, + DRM_UT_VBL, /** * @DRM_UT_STATE: Used for verbose atomic state debugging. */ - DRM_UT_STATE = 0x40, + DRM_UT_STATE, /** * @DRM_UT_LEASE: Used in the lease code. */ - DRM_UT_LEASE = 0x80, + DRM_UT_LEASE, /** * @DRM_UT_DP: Used in the DP code. */ - DRM_UT_DP = 0x100, + DRM_UT_DP, /** * @DRM_UT_DRMRES: Used in the drm managed resources code. */ - DRM_UT_DRMRES = 0x200, + DRM_UT_DRMRES }; static inline bool drm_debug_enabled(enum drm_debug_category category) { - return unlikely(__drm_debug & category); + return unlikely(__drm_debug & BIT(category)); } /* -- 2.35.3 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel