From patchwork Wed Nov 1 00:26:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442445 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 769B5C4332F for ; Wed, 1 Nov 2023 00:29:34 +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=OAArnDkhjo7aoM/e94Yh3lehYkerSDtqC086MPSthlg=; b=GO/M5B8oJ2VJrz J2N0MSJD9HQbOv0ve9W3IKj3j8Kf6Cau3hfcWzP8GQWAF7dpbxEKSuYpZMwZ9glc4JPo/9KhQPojg mCqRqQxvQTV+oy4kzcHbNdPLOIJxmg2I4J9Twc+hnuJOqMA3nfpqjOzWtMnfcAva0Y7fTdoICfXl9 TWqRZffNjKTZw3vB0wU2ry6ZHf5tkG/PwcAZ5xlx97VE3a89xhNU9oRsGtkXskFkcG9J4w46+w3YQ TJZcR+L21UnxwEEFRqOupzURmlYpH0FUsHDmoUtaHY2lc+YgyO8sOjhRniCzmynmq2Pkl+w70l3ZQ xjDZsDvh6arH7vUzDnTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz6Y-006Q34-1y; Wed, 01 Nov 2023 00:29:06 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4V-006Otn-3D for linux-arm-kernel@bombadil.infradead.org; Wed, 01 Nov 2023 00:27:00 +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=2r2Xy/LUqkHG59xFuO4NDcaCnT0VxXpDLDYMeh9aWn8=; b=VGmJn8qebjcASJviHUOS/KgaUo KdxCie4udrbKJACA7SuGn6oK8zfTbgSkySLs2Xgvh4Stxe3gs/zb2Vsz766AeWkIj6MXSu+wfQQQN 6FrSRlpSUtshPUh5Y3gaEiwYsKNfddKTktzIrpe3Boe43ASV6dmkyYk0O5PcbOJGKhPEMIGWkSc9G tKYfmIImpIfCifbf/eGYoxcJkFqlbDqjp9xaLeCCkMEkDiqLm8HCVJKQxZVT3ajcTyQ9z4sMfsmQX CjE/1JCD2pgQq4ncFXp57hkMtGCmyl9Amb354pO4KQY2rJcjb9o6q2NAozwgsi5wOwsql0TMkqk9/ QQUhgtug==; Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4I-005CW1-1D for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:56 +0000 Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-35748b32d73so24405595ab.0 for ; Tue, 31 Oct 2023 17:26:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798404; x=1699403204; darn=lists.infradead.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=2r2Xy/LUqkHG59xFuO4NDcaCnT0VxXpDLDYMeh9aWn8=; b=gAhsz+FT1dXNmfrBtbEXE7oBWkVqgngfwaJauOTTXd4VKkvg8B9g52l96bFhjqbzRC pTpAZuatRfi0tefJsAVxTxrprTmvqFGA75if/gCFusfXJVRluUZ+Zb0jOJFidV4Jdgmo znvS/uI/tDcCt8UaJsxAgzJv4oBoryUJvRBQ7yKcmxKJb2yFrai2mxT7UCwM5/jRObrK KKFxAEn8VTNWsYd5K+ZUNpbeHqn+9uHdEBqZnDHGTIH+Ypu0p2XYsQoKMm7TBtdxtArE bi4zXZbqvn47cLNj35VJ1hTkLOWFEU0gpu99opG/+8fK+ToOG2C07M1ZmOfhqjNBRisd QW+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798404; x=1699403204; 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=2r2Xy/LUqkHG59xFuO4NDcaCnT0VxXpDLDYMeh9aWn8=; b=ssgyv17333WUyhmD+dUm4Ufq7o8OSGJ9nd3QUtcUthB+J1L7vucRCpKGaG22kaDoaw Y05uwl2gVPGX1XnWhTnEaQHin8erUx4M8pJR2oe2oYaY/c6WKuB9loQ/4P49xbRJjmBU CehPGLe7iKI2JWNQa0yBbufdoQlnPvVRc6WsagHqNqjMHKj+ub8IL2bMNDztOsAsKCJP DtDXY1Y3YT0zHC4TiT0TkLhtlQRBUCJv1x03xfmyvX3vGCUQXFNQOPa5BAWMMos01B18 bqT6qCvDxcp2TEpL57NKdQpfxizodxblzw7U3aJPSHZn+h/2eFKQys2RLRofd+2QdmLU k3pA== X-Gm-Message-State: AOJu0Yww3c3Y92nmnTULe6N1yby6HV10tUrF3EefY8bJOllZfbj6vgSM 032y919uFBDg7GlX1/xP+ik= X-Google-Smtp-Source: AGHT+IFJ+EO25MFzuh5tK6lN7VgLWzxSfGJvEw3xuzQxhOciZy5mpoFNsIJKMGKNq9pPh0T4ilf3hg== X-Received: by 2002:a05:6e02:330d:b0:359:3754:e6bb with SMTP id bm13-20020a056e02330d00b003593754e6bbmr3823026ilb.21.1698798404300; Tue, 31 Oct 2023 17:26:44 -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 t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:43 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, 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 v7d 19/23] dyndbg: add _DPRINTK_FLAGS_INCL_LOOKUP Date: Tue, 31 Oct 2023 18:26:05 -0600 Message-ID: <20231101002609.3533731-20-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-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-20231101_002647_604250_375F9E0E X-CRM114-Status: GOOD ( 14.27 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org dyndbg's dynamic prefixing (by +tmfsl flags) is needlessly expensive. When an enabled (with +p) pr_debug is called, _DPRINTK_FLAGS_INCL_ANY prefix decorations are sprintf'd into stack-mem for every call. This string (or part of it) could be cached once its 1st generated, and retrieved thereafter, as long as its deleted any time the callsite's flags are changed afterwards. So consider the prefix/decoration flags: 'tmfsl', and what should be in the cache: -t thread-id. not part of the "callsite" info, derived from current. doesn't belong in the cache. it would be wrong. can be done in outer: dynamic_emit_prefix() -l line number this could be part of the prefix, but would bloat the cache can also be done in outer: dynamic_emit_prefix() -mfs module, function, source-file we cache these, composed into a sub-string. they are "lookups", currently to descriptor fields, could be accessor macros to "compressed" tables. cache saves more access work. All enabled together, they compose a prefix string like: # outer -----inner---------- outer "[tid] module:function:sourcfile:line: " So this patch extracts _DPRINTK_FLAGS_INCL_LOOKUP macro out of _DPRINTK_FLAGS_INCL_ANY macro, then redefs latter. Next re-refactor dynamic_emit_prefix inner/outer fns accordingly. Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 4ffddf5e9152..b4550f80cfd5 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -40,10 +40,12 @@ struct _ddebug { #define _DPRINTK_FLAGS_INCL_SOURCENAME (1<<5) #define _DPRINTK_FLAGS_PREFIX_CACHED (1<<7) -#define _DPRINTK_FLAGS_INCL_ANY \ - (_DPRINTK_FLAGS_INCL_MODNAME | _DPRINTK_FLAGS_INCL_FUNCNAME |\ - _DPRINTK_FLAGS_INCL_LINENO | _DPRINTK_FLAGS_INCL_TID |\ +#define _DPRINTK_FLAGS_INCL_LOOKUP \ + (_DPRINTK_FLAGS_INCL_MODNAME | _DPRINTK_FLAGS_INCL_FUNCNAME | \ _DPRINTK_FLAGS_INCL_SOURCENAME) +#define _DPRINTK_FLAGS_INCL_ANY \ + (_DPRINTK_FLAGS_INCL_LINENO | _DPRINTK_FLAGS_INCL_TID | \ + _DPRINTK_FLAGS_INCL_LOOKUP) #if defined DEBUG #define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT