Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.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 3E8CB44999A for ; Fri, 10 Jul 2026 09:00:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783674053; cv=none; b=bstnQMW3IWSVFgn7SNigQuPzWKhe39RZKBa93X7DPsopSMkdxL1JaMQyqVcuuqeReOrtx2rXYgg+Ih6VUzbi8kgrjoDgRwq7Khhq+nJuGeSHojjyrWJ/hhZtJLUPcq2/eARr+FnuH5bs+sSyKZbknI8RBKg36SOC4TJN3/FCz9A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783674053; c=relaxed/simple; bh=s7DjeQSTeyDCXeUT2DYAZAd9KxeDfnPoXtbndQB/TlQ=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=f0wiO8PWzFS0QApIkxIacd5iS8OUNJ6DDDTHh6Z55D/Wledub2CVJysIqeeER21HsvAJNn0WNdMcM4L4oPVfTZX/LKLHx8o52BFasvj0sTCElFPBzz4GRsGzn3oFobzmu2ATHbSmorJV8s/ArSO+H/TTzH7nXGZ6/XEW0rDv8yE= 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=dP58smRQ; arc=none smtp.client-ip=209.85.221.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="dP58smRQ" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-4720d22c94aso671019f8f.1 for ; Fri, 10 Jul 2026 02:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783674050; x=1784278850; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:content-type:mime-version :message-id:date:subject:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=Qt+LaAqPvwUm1y0oFk6gJUAvHbxtXN/0WfCUetMYAYg=; b=dP58smRQFHpFtH4/tR2geOj83iW9X3s4kCvm4oEgav79XJAIl6FLnowKlOULGrUFIC rlRBig46oaUdqIXP5A9QWFRicb1Sh5weCjiZVDpC2hQrv6h1i5quxSTNus7iyEgC82ox DRNR+1479qiwUwOF99SJ8HxDZGkZpxdUetMKGmdzmGYR7mSzRRk6183la/qDfAmctpeA vxizfAm8Qq32MdjEv455VdwnQgluAYGPTU868yAxuqF/nWXEBWMsVjOhttWVzf1gFGoA eWPAFd6iGIQYSRb0E6wGuuDZf4l2Y4P3YhS/i3FdCdIcXBiwpVUlRF+B0sSz35E7miFz 4Hsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783674050; x=1784278850; h=cc:to:content-transfer-encoding:content-type:mime-version :message-id:date:subject:from:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=Qt+LaAqPvwUm1y0oFk6gJUAvHbxtXN/0WfCUetMYAYg=; b=oSbgxteWVE4raXVuuBlE15rbD+Ry38F9QZmKROnAhg60QETDAZ/O1avB8CaNsNUzwF kBTNvUyJAfkP6npSV5Ygf+pKzDEetN8uEWFo5VjZSa7dSesoALjnk5HR4pPU5Tor+b2M C68XlRd1FwxD1JsaYAE+oQsYc+fzAFsyXEiifyM1YwyyHTVixGGq1CcawDloFGqwDsLU leWsZ4ZT2cXP/duGn7gUVxrggAHKzuP49vgBBawM7s9Ms53exEesuTKXg1mHoHlshUeX gM/1vNg+TggDs1LQ1Ejw/rrfooFAsypG0zC/v/HzG9RgNzoQ1lYZ/vbVpXcGfpm5R+Ur fE8w== X-Forwarded-Encrypted: i=1; AHgh+RqScDRQO9UAyKQLWrli2+8GaqNK2Es3HFYbdJmadmB/Epb1XyDs8++vhGWsVQSFEFdNOKZ8Wzx9khI7Wn4=@vger.kernel.org X-Gm-Message-State: AOJu0YxSd60X9jXHDnzs0x6B2RAmWCYwF+Bv0G4+vQgPQzNyXbNTaKVY 6ymWPgfMqkB3SqMb9dgl9hFsPY8zatzfwPGdyKaHrhxPSVhff9j5Zt1y X-Gm-Gg: AfdE7clF9VwBrKDR9+Paj20xGTBszc+4ki6gKci3UrQoEwWBQQQ4d0GSvSrK6zm6PmN y/NWunasWVCELfQS8hK3dFqh3OsbeGpke7f62VaRQAJENavltiouHCpTXGGP9+Ukp29KcGgv2p0 etdg36rQXxsZZ0wXMqu0A6pdragP8QCnMNabiQ06v1NCmrKCu4puy1athd/GDdpNxlB61h5+aqz /8AqdoXXaMqlyU2CMsj0qKH/nOZlJx0+nyThPBeKNloOY73wIMshi3Eb4v4lvfsDcGWdGp4dtcS H5blraNwtHrr+cqsNi4YZH6qjhVyoOTPtKnr6el8GeG9CBtrmR6EiC+N2XLb7vBSuwh4lanG2Su 1qF3XTrrPIBkC1LUtxwbajmEaGdf/JeEfzXuie5yR7UVD2GCu1Qe1ZK/6S7Wk4kC0FtyxRBt0fg tOj5k/4IBM1tlGES89RzDrBYk8RAzCUnAwSmln7AVZtetTA9uin5TSW1oBb5ASEOk4urSqUl0vg oUM9F7uuNzKhaa9vj9ZZFqvCYl5EWKeYQ== X-Received: by 2002:a5d:588a:0:b0:475:cd6f:721e with SMTP id ffacd0b85a97d-47df07a2965mr11282514f8f.44.1783674049819; Fri, 10 Jul 2026 02:00:49 -0700 (PDT) Received: from localhost.localdomain (62-178-82-42.cable.dynamic.surfer.at. [62.178.82.42]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47aa039b0cesm59386076f8f.22.2026.07.10.02.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 02:00:48 -0700 (PDT) From: Christian Gmeiner Subject: [PATCH v2 0/2] drm/etnaviv: Add GPU reset counters for robustness Date: Fri, 10 Jul 2026 11:00:45 +0200 Message-Id: <20260710-etnaviv-reset-notification-v2-0-90cfebcf22a2@igalia.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: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/33NTQrCMBCG4auUrB1J+pO2rryHdDGN03ZAk5KEo JTe3Vhw6/L9YJ7ZRCDPFMSl2ISnxIGdzVGeCmEWtDMB33OLUpZatrIDihYTJ/AUKIJ1kSc2GPM ZjLJqVVOhQhxFBlZPE78O/DbkXjhE59/Hr6S+64/t/7FJgQRdG63autd90115xgfj2binGPZ9/ wBudgQ0xQAAAA== X-Change-ID: 20260708-etnaviv-reset-notification-b037153a1aab To: Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Simona Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-dev@igalia.com, Christian Gmeiner X-Mailer: b4 0.14.3 The OpenGL robustness extensions (GL_KHR_robustness) and Vulkan (VK_ERROR_DEVICE_LOST) let an application detect a GPU reset and check whether its own context caused it, so it can throw away the broken context and build a new one. etnaviv already resets the GPU after a hang, but userspace has no way to learn about it. This series adds two counters and a RESET_QUERY ioctl that returns both in one call: - a global counter that counts every reset of a GPU core. - a context counter that only counts the resets the calling context was guilty of. Userspace samples both values and compares them later: if the context counter moved the context was guilty, if only the global counter moved the context was an innocent victim. That is all that is needed to implement glGetGraphicsResetStatus() and Vulkan device loss. The global counter is kept per GPU core and not per device, so a hang on one pipe does not look like an innocent reset to contexts that only use another pipe. The first patch is preparation: the counters are updated from the scheduler timeout worker, which can race with the DRM file being closed, so struct etnaviv_file_private becomes reference counted and every submit holds a reference. Link to the Mesa MR implementing the userspace side: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42826 Signed-off-by: Christian Gmeiner --- Changes in v2: - Replace the two GET_PARAM values with a dedicated RESET_QUERY ioctl that returns both counters in one call. The ioctl has a flags field that must be zero for now, so the query can later be extended to name a specific context once a DRM file can hold more than one context (Lucas). - Make the reset counters plain u32 instead of atomics (Lucas). - Use __u32 for the ioctl counter fields to match the internal counters, following i915 GET_RESET_STATS. - Link to v1: https://lore.kernel.org/r/20260709-etnaviv-reset-notification-v1-0-64c617496958@igalia.com --- Christian Gmeiner (2): drm/etnaviv: Reference count struct etnaviv_file_private drm/etnaviv: Add GPU reset counters drivers/gpu/drm/etnaviv/etnaviv_drv.c | 44 ++++++++++++++++++++++++++-- drivers/gpu/drm/etnaviv/etnaviv_drv.h | 12 ++++++++ drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 5 +++- drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 2 ++ drivers/gpu/drm/etnaviv/etnaviv_sched.c | 3 ++ include/uapi/drm/etnaviv_drm.h | 19 +++++++++++- 6 files changed, 81 insertions(+), 4 deletions(-) --- base-commit: 8cdeaa50eae8dad34885515f62559ee83e7e8dda change-id: 20260708-etnaviv-reset-notification-b037153a1aab Best regards, -- Christian Gmeiner