public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev,
	Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>,
	John Harrison <John.C.Harrison@Intel.com>,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.1 47/83] i915/guc: Ensure busyness counter increases motonically
Date: Mon, 23 Dec 2024 16:59:26 +0100	[thread overview]
Message-ID: <20241223155355.453771248@linuxfoundation.org> (raw)
In-Reply-To: <20241223155353.641267612@linuxfoundation.org>

6.1-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>

[ Upstream commit 59a0b46788d58fdcee8d2f6b4e619d264a1799bf ]

Active busyness of an engine is calculated using gt timestamp and the
context switch in time. While capturing the gt timestamp, it's possible
that the context switches out. This race could result in an active
busyness value that is greater than the actual context runtime value by a
small amount. This leads to a negative delta and throws off busyness
calculations for the user.

If a subsequent count is smaller than the previous one, just return the
previous one, since we expect the busyness to catch up.

Fixes: 77cdd054dd2c ("drm/i915/pmu: Connect engine busyness stats from GuC to pmu")
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241127174006.190128-3-umesh.nerlige.ramappa@intel.com
(cherry picked from commit cf907f6d294217985e9dafd9985dce874e04ca37)
Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/i915/gt/intel_engine_types.h      | 5 +++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_engine_types.h b/drivers/gpu/drm/i915/gt/intel_engine_types.h
index 107f465a27b9..458320d28e27 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_types.h
+++ b/drivers/gpu/drm/i915/gt/intel_engine_types.h
@@ -339,6 +339,11 @@ struct intel_engine_guc_stats {
 	 * @start_gt_clk: GT clock time of last idle to active transition.
 	 */
 	u64 start_gt_clk;
+
+	/**
+	 * @total: The last value of total returned
+	 */
+	u64 total;
 };
 
 struct intel_engine_cs {
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
index 4bfc1131b4f0..2cd1f43f8a3c 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
@@ -1346,9 +1346,12 @@ static ktime_t guc_engine_busyness(struct intel_engine_cs *engine, ktime_t *now)
 		total += intel_gt_clock_interval_to_ns(gt, clk);
 	}
 
+	if (total > stats->total)
+		stats->total = total;
+
 	spin_unlock_irqrestore(&guc->timestamp.lock, flags);
 
-	return ns_to_ktime(total);
+	return ns_to_ktime(stats->total);
 }
 
 static void __reset_guc_busyness_stats(struct intel_guc *guc)
-- 
2.39.5




  parent reply	other threads:[~2024-12-23 16:18 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-23 15:58 [PATCH 6.1 00/83] 6.1.122-rc1 review Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 01/83] net: sched: fix ordering of qlen adjustment Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 02/83] PCI/AER: Disable AER service on suspend Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 03/83] PCI: Use preserve_config in place of pci_flags Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 04/83] PCI: vmd: Create domain symlink before pci_bus_add_devices() Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 05/83] usb: cdns3: Add quirk flag to enable suspend residency Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 06/83] ASoC: Intel: sof_sdw: fix jack detection on ADL-N variant RVP Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 07/83] ASoC: Intel: sof_sdw: add quirk for Dell SKU 0B8C Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 08/83] PCI: Add ACS quirk for Broadcom BCM5760X NIC Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 09/83] MIPS: Loongson64: DTS: Fix msi node for ls7a Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 10/83] usb: dwc2: gadget: Dont write invalid mapped sg entries into dma_desc with iommu enabled Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 11/83] PCI: Introduce pci_resource_n() Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 12/83] platform/x86: p2sb: Make p2sb_get_devfn() return void Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 13/83] p2sb: Factor out p2sb_read_from_cache() Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 14/83] p2sb: Introduce the global flag p2sb_hidden_by_bios Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 15/83] p2sb: Move P2SB hide and unhide code to p2sb_scan_and_cache() Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 16/83] p2sb: Do not scan and remove the P2SB device when it is unhidden Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 17/83] i2c: pnx: Fix timeout in wait functions Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 18/83] cxl/region: Fix region creation for greater than x2 switches Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 19/83] net/smc: protect link down work from execute after lgr freed Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 20/83] net/smc: check sndbuf_space again after NOSPACE flag is set in smc_poll Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 21/83] net/smc: check iparea_offset and ipv6_prefixes_cnt when receiving proposal msg Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 22/83] net/smc: check smcd_v2_ext_offset " Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 23/83] net/smc: check return value of sock_recvmsg when draining clc data Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 24/83] net: mscc: ocelot: fix incorrect IFH SRC_PORT field in ocelot_ifh_set_basic() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 25/83] netdevsim: prevent bad user input in nsim_dev_health_break_write() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 26/83] ionic: Fix netdev notifier unregister on failure Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 27/83] ionic: use ee->offset when returning sprom data Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 28/83] net: hinic: Fix cleanup in create_rxqs/txqs() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 29/83] net: ethernet: bgmac-platform: fix an OF node reference leak Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 30/83] netfilter: ipset: Fix for recursive locking warning Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 31/83] net: mdiobus: fix an OF node reference leak Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 32/83] mmc: sdhci-tegra: Remove SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC quirk Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 33/83] KVM: x86: Cache CPUID.0xD XSTATE offsets+sizes during module init Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 34/83] chelsio/chtls: prevent potential integer overflow on 32bit Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 35/83] i2c: riic: Always round-up when calculating bus period Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 36/83] efivarfs: Fix error on non-existent file Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 37/83] hexagon: Disable constant extender optimization for LLVM prior to 19.1.0 Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 38/83] USB: serial: option: add TCL IK512 MBIM & ECM Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 39/83] USB: serial: option: add MeiG Smart SLM770A Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 40/83] USB: serial: option: add Netprisma LCUK54 modules for WWAN Ready Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 41/83] USB: serial: option: add MediaTek T7XX compositions Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 42/83] USB: serial: option: add Telit FE910C04 rmnet compositions Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 43/83] thunderbolt: Improve redrive mode handling Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 44/83] drm/modes: Avoid divide by zero harder in drm_mode_vrefresh() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 45/83] drm/panel: novatek-nt35950: fix return value check in nt35950_probe() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 46/83] i915/guc: Reset engine utilization buffer before registration Greg Kroah-Hartman
2024-12-23 15:59 ` Greg Kroah-Hartman [this message]
2024-12-23 15:59 ` [PATCH 6.1 48/83] i915/guc: Accumulate active runtime on gt reset Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 49/83] drm/amdgpu: dont access invalid sched Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 50/83] hwmon: (tmp513) Dont use "proxy" headers Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 51/83] hwmon: (tmp513) Simplify with dev_err_probe() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 52/83] hwmon: (tmp513) Use SI constants from units.h Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 53/83] hwmon: (tmp513) Fix interpretation of values of Shunt Voltage and Limit Registers Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 54/83] hwmon: (tmp513) Fix Current Register value interpretation Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 55/83] hwmon: (tmp513) Fix interpretation of values of Temperature Result and Limit Registers Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 56/83] sh: clk: Fix clk_enable() to return 0 on NULL clk Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 57/83] zram: refuse to use zero sized block device as backing device Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 58/83] zram: fix uninitialized ZRAM not releasing " Greg Kroah-Hartman
2025-01-08  3:57   ` Sergey Senozhatsky
2024-12-23 15:59 ` [PATCH 6.1 59/83] btrfs: tree-checker: reject inline extent items with 0 ref count Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 60/83] Drivers: hv: util: Avoid accessing a ringbuffer not initialized yet Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 61/83] KVM: x86: Play nice with protected guests in complete_hypercall_exit() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 62/83] tracing: Fix test_event_printk() to process entire print argument Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 63/83] tracing: Add missing helper functions in event pointer dereference check Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 64/83] tracing: Add "%s" check in test_event_printk() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 65/83] selftests/bpf: Use asm constraint "m" for LoongArch Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 66/83] io_uring: Fix registered ring file refcount leak Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 67/83] io_uring: check if iowq is killed before queuing Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 68/83] NFS/pnfs: Fix a live lock between recalled layouts and layoutget Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 69/83] of/irq: Fix interrupt-map cell length check in of_irq_parse_imap_parent() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 70/83] of/irq: Fix using uninitialized variable @addr_len in API of_irq_parse_one() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 71/83] nilfs2: fix buffer head leaks in calls to truncate_inode_pages() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 72/83] nilfs2: prevent use of deleted inode Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 73/83] udmabuf: also check for F_SEAL_FUTURE_WRITE Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 74/83] of: Fix error path in of_parse_phandle_with_args_map() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 75/83] of: Fix refcount leakage for OF node returned by __of_get_dma_parent() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 76/83] ceph: validate snapdirname option length when mounting Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 77/83] udf: Fix directory iteration for longer tail extents Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 78/83] epoll: Add synchronous wakeup support for ep_poll_callback Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 79/83] io_uring/rw: split io_read() into a helper Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 80/83] io_uring/rw: treat -EOPNOTSUPP for IOCB_NOWAIT like -EAGAIN Greg Kroah-Hartman
2024-12-23 16:00 ` [PATCH 6.1 81/83] io_uring/rw: avoid punting to io-wq directly Greg Kroah-Hartman
2024-12-23 16:00 ` [PATCH 6.1 82/83] dt-bindings: net: fec: add pps channel property Greg Kroah-Hartman
2024-12-23 16:00 ` [PATCH 6.1 83/83] drm/amdgpu: Handle NULL bo->tbo.resource (again) in amdgpu_vm_bo_update Greg Kroah-Hartman
2024-12-23 21:14 ` [PATCH 6.1 00/83] 6.1.122-rc1 review SeongJae Park
2024-12-23 22:45 ` Shuah Khan
2024-12-24 10:24 ` Peter Schneider
2024-12-24 10:30 ` Ron Economos
2024-12-24 13:26 ` Jon Hunter
2024-12-24 19:49 ` Naresh Kamboju
2024-12-25  1:50 ` Zhao Mengmeng
2024-12-26 10:20 ` Muhammad Usama Anjum
2024-12-26 16:49 ` Florian Fainelli
2024-12-26 19:25 ` [PATCH 6.1] " Hardik Garg
2024-12-26 20:20 ` [PATCH 6.1 00/83] " Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241223155355.453771248@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=John.C.Harrison@Intel.com \
    --cc=patches@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tursulin@ursulin.net \
    --cc=umesh.nerlige.ramappa@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox