From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f52.google.com (mail-oo1-f52.google.com [209.85.161.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 397D13161A1 for ; Fri, 6 Mar 2026 01:50:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772761841; cv=none; b=baaeWI4041kjjHUwXe0CxuxFkb77jveHC/YiCC9jYdZ2yP+67CAUKLy7ZrAxPlKAzkPthwFy5CQ8eA7zoPpCzQafzy1bX4xpigLCuKTbOp7AxvB9sd+dyumVBNulhX/BMIGeiNB3Bdpmxt2AzZbrdCmZy00MQU3ggktIecnVVl8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772761841; c=relaxed/simple; bh=AazBds1w9liw2aSzTdmml76gTkYyKFEbxIGetHyrLwk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=YFdxrdDG0PVTDv8Ew1R2Pu0B9BCMjHx1WvlgMTlRmdSANY1uCjExy26ipI33qTiY7hmg+METitOf77hRntnPombfVQG1VqSGNFbfXOtvQDv9Oq7J8nQk4CQVD/HdcSyx0E5qNFg6S7DQy2lIEtR1xhXGLtlAaaF0I+/BkLjDTMM= 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=ekH/vmvY; arc=none smtp.client-ip=209.85.161.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="ekH/vmvY" Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-6729292dcd7so5007911eaf.0 for ; Thu, 05 Mar 2026 17:50:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772761839; x=1773366639; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=bkFWDNzYpAaNf6nKTX9X2HQLMlJtuGjLEa5TVIf/IA4=; b=ekH/vmvYSR3zNLG9QaIKC3TjGPpO8ZDYUB7P126XkviyvBH2wEGWChUitnRa774U1r jBi+6Pr51XZ1Rz9S0dePXZUFh32LgHpZLNhL79ZqyCVmVKLmbvDEeTIcCvTt3Ks2wwGS gijG13dGq5zKPia3VMn//T+TmdsOhLTHMKfNW2AllKvJH/jUa6shKVBDzPf5yq8Luub0 xOXT4iMxsrF4C5Mf7BcTgfG0a8ywW87Ax7QHuRY6B8MePctwujC8N6XOD/q1qRJ7wnOZ ZzR2Io0SeC76q9uBp3vOfQCFfbesdWc1kuxUGNmgSCB8OPT/dz+KJXHLGVqF2QOZ0uAX yHNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772761839; x=1773366639; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=bkFWDNzYpAaNf6nKTX9X2HQLMlJtuGjLEa5TVIf/IA4=; b=pMIVuF38wuzrTLGg0kPNfefVQQa37kx9zOo1K159Hlmf2sAiarf5az6l0TID4KOFkc 0pT3+QlbbP8610lupGT1iwtMW8fWXyKjkeU4h0FBuKAFzbPLU20RwvSDs59QuB7L7VCE 155XhpJgw/LonGuA54AwFdBKnUZ1yY//VmAMotEnv3V0JGWF9dIIPo+9xK73eLcgrVoy GRHiLHf/MvndiqF+aYq9fj0Qg8YbrWU2uawTJB9hqJ25LFnRHXdepBVht/NBDe5fyBRw W1TjwesC9PJ/3qe15ngtW4W2WurrkIL9zHIb6SD+zSSLLHZkv4Nf4AgI9/x8VBphSzZd eU+Q== X-Gm-Message-State: AOJu0YxmOcc4sYD/um6vUtA5iIkUIHygo4EsLsec8RXjPHGOALtbyCMC E5iTR6Lv6qIDThvhSiD/RDmMJbdOKIbxITdd2EnF/8+ddF57tE7LBFUfp7tq4w== X-Gm-Gg: ATEYQzxrXnKDp7mHKnlM/zEgAq4jTpKlQOjeG9wY1sGGT1YY1T/h4HsKdQ3kEwVZLO7 kBchcG9jZYvalDjVKIcZnRgt2VNeXGiztxon8CfqU7U7uJudvTQL33CYmp4oOTRoHP6bYUr97tQ WJ56d5TJB8WEA7NiOCelA+fmoWXoI3zRiyg8WDXE28hPP7Ees6/inkIdURFfwi1Ofe/WVoxyNP3 baKb4FEFPizcID4GIK1YbWaZ5SfLnlEBeJ5fwSZcCNrhS3PwAu+0cgrZbS/AsB/+vkQF7Cozk+I q8p444xIfJL3Bw5Rzs/P43SP4enbpvKQKvc/jJ1g3yEXxp0nC30+y5odqFapYz/6QpC+a2iQMuE jXZT50LeC4jkO9xpkocs5MHWC86dATpIrpCPBkVnAOgMBsgy2hCKwW6oOyH09TktAj1m10npgHF RzsE6LwqPyXRtfvOC5yS8rvIh8j9SZcLDc5d4tQkp2+IMgZ0pJ X-Received: by 2002:a05:6820:4487:b0:679:96f:3f11 with SMTP id 006d021491bc7-67b9bd4c44bmr385436eaf.64.1772761838800; Thu, 05 Mar 2026 17:50:38 -0800 (PST) Received: from frodo (c-98-38-17-99.hsd1.co.comcast.net. [98.38.17.99]) by smtp.googlemail.com with ESMTPSA id 006d021491bc7-67b9cc1a627sm115245eaf.6.2026.03.05.17.50.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2026 17:50:38 -0800 (PST) From: Jim Cromie To: 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: Jim Cromie Subject: [RFC PATCH 0/7] queued static-key API reduces IPIs to 134/16154 in dyndbg Date: Thu, 5 Mar 2026 18:50:03 -0700 Message-ID: <20260306015022.1940986-1-jim.cromie@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This patchset formalizes and exposes the internal architecture-specific arch_jump_label_transform_queue API as a public kernel interface (static_key_*_queued). Currently, dynamic_debug toggles static keys individually, which triggers a machine-wide synchronization (IPI) for every callsite. This causes $O(N)$ overhead. By using the new queued API, (which also adds an insert-sort to the queue) dynamic_debug can now toggle up to 256 sites (x86 queue length) with a single IPI. Without the sort, dyndbg saw a far more modest IPI reduction; ~6k/16k. Ordered descriptors does not insure ordered patch-addresses. Currently, only x86 has the sort. I tested on virtme-ng, using: echo +p > /proc/dynamic_debug/control echo -p > /proc/dynamic_debug/control With this patch and test, IPIs reduced to 134 from 16154. Patchset also changes virtio.c to use pr_debug_ratelimited() instead of pr_debug(), which otherwise flooded my test-setup, obscuring results. serial_core.c also gets 1 _ratelimited() change, though I didnt see them in my setup, and likely missed a few conversion candidates. Patchset also includes a new query-cmd syntax for dyndbg: echo 'module !virtio* +p' > /proc/dynamic_debug/control echo -p > /proc/dynamic_debug/control It further reduced the console output, so might have sufficient utility for eventual inclusion, despite lacking and/or logic. The patch hoisting the static_key_apply_queued() out of ddebug_change() up to ddebug_exec_queries() does nothing in this case, and would only affect multi-queries: echo 'module !virtio* +p ; module serial -p' > /proc/dynamic_debug/control ISTM such queries are currently rare, but could be leveraged in classmap-params, to optimize drm.debug=0x1ff, which currently would get one query-command per bit (12+ IPIs). DRM is the biggest potential beneficiary of this: root@drm-misc-fixes-2026-02-26-78-g535e886b182f:/home/jimc/projects/lx/wk-D/b0-dd-drm-all# modprobe i915 [ 20.405557] dyndbg: 25 debug prints in module i2c_core [ 20.459373] dyndbg: 340 debug prints in module drm [ 20.459851] ACPI: bus type drm_connector registered [ 20.471366] dyndbg: 89 debug prints in module drm_kms_helper [ 20.482336] dyndbg: 155 debug prints in module drm_display_helper [ 20.496153] dyndbg: 2 debug prints in module ttm [ 21.136619] dyndbg: 1801 debug prints in module i915 root@drm-misc-fixes-2026-02-26-78-g535e886b182f:/home/jimc/projects/lx/wk-D/b0-dd-drm-all# modprobe amdgpu [ 32.907485] dyndbg: 4532 debug prints in module amdgpu Jim Cromie (7): jump_label: expose queueing API for batched static key updates virtio: use pr_debug_ratelimited to avoid flooding drivers/tty/serial/serial_core: ratelimit uart_wait_until_sent dyndbg: use static-key queueing API in dynamic-debug dyndbg: hoist static_key_apply_queued up lib/dynamic_debug: add negation support to queries dyndbg-test: test keyword !value negation arch/Kconfig | 3 + arch/x86/Kconfig | 1 + arch/x86/kernel/alternative.c | 50 ++++--- arch/x86/kernel/jump_label.c | 13 +- drivers/tty/serial/serial_core.c | 4 +- drivers/virtio/virtio_ring.c | 12 +- include/linux/jump_label.h | 24 ++++ kernel/jump_label.c | 125 ++++++++++++++++-- lib/dynamic_debug.c | 88 ++++++++---- .../dynamic_debug/dyndbg_selftest.sh | 35 +++++ 10 files changed, 290 insertions(+), 65 deletions(-) -- 2.53.0