From patchwork Wed Dec 15 17:45:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 524630 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 85199C433EF for ; Wed, 15 Dec 2021 17:49:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238179AbhLORtY (ORCPT ); Wed, 15 Dec 2021 12:49:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237968AbhLORtY (ORCPT ); Wed, 15 Dec 2021 12:49:24 -0500 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EE2AC061574; Wed, 15 Dec 2021 09:49:24 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id mj19so3181689pjb.3; Wed, 15 Dec 2021 09:49:24 -0800 (PST) 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=IUVtrCNnk8frIGlEAr3SuG1vPO7+KGLAqJYvYc4iy+A=; b=oR3XGnx9gCRa5TXzS6XuouNT73Q+DQrbcvCbV+G11ig8CVDwOJmo44XZdAbLNw0aNf VbzyawLm6ABNu32UCmSm+FxcnJhbuZveJN17i59QPevj5udq/Ea6lt5T18nayrzHVk2M nTjMH6TFuRjPZPbJq/pbceH8JyKyUoOcqUSKde+39Z1qMGG1/6CEsy2FVD/hn2jF2tEP 5TLoAj2lfj05JdJZ5fQpsfVZLgG01gaWfrqETAYPUrCY/mbmwrR5C5mHTRvsq1OeMxkl ZTh2TOZUWgfKKFJYLWvya0K6lm/veHmka8g/NY09MeOLLKjURMEc9qFMNXQIufSIaGK4 1Shw== 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=IUVtrCNnk8frIGlEAr3SuG1vPO7+KGLAqJYvYc4iy+A=; b=wDU7+CJ54uPWVRD2+Qj+D2ZAotxraxTgJc/aEZSahWcv6iWcYp6LoxyJUQvf5wp8ml 4qWoczGhbIPWiqi7Uwf1UrzKi0MkBl62ns9OIo+mWRQ0+1us0i1IZnF4BAjl4rIf81i/ s+UDYqncBFJE+EmpxRRoeuEJwAVdo/uoMC6+oj8CyPU444d1gcaAV1xWN3bLhnjZEAMn Kg25dmxqZ8fK8LS52ow61UumUSQA4R9P1NfdACkt+VLoCuPRoRBmcjLPlrF4ndwT1JMG +b/BPK+lCcK0WWo2I5+vBIX8ou+B1McBt59vK6Z0nN5Yd0KCqRPMm4R4eIIRWqX2yOH8 QpLg== X-Gm-Message-State: AOAM532mHnJd5LVva2ChelrJcELMDjSl9Q5sFbNyhm05VDxNd6hgyTQQ W+3bjhPzsuiNtTitQo4aDDs= X-Google-Smtp-Source: ABdhPJwqNMBqOZRqgL+tKj9rMhgWUHk026wb4PMY2y1lsuvGhmFoFrvfA0flILUcmfYhaUC1gPLJTw== X-Received: by 2002:a17:90a:ac0b:: with SMTP id o11mr933541pjq.143.1639590563579; Wed, 15 Dec 2021 09:49:23 -0800 (PST) Received: from localhost (c-73-25-156-94.hsd1.or.comcast.net. [73.25.156.94]) by smtp.gmail.com with ESMTPSA id y31sm3892176pfa.92.2021.12.15.09.49.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 09:49:22 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Stephen Boyd , Doug Anderson , Dmitry Baryshkov , Rob Clark , Rob Clark , Sean Paul , Abhinav Kumar , David Airlie , Daniel Vetter , Guo Zhengkui , Alexey Dobriyan , Bjorn Andersson , Fernando Ramos , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 1/3] drm/msm/disp: Tweak display snapshot to match gpu snapshot Date: Wed, 15 Dec 2021 09:45:06 -0800 Message-Id: <20211215174524.1742389-2-robdclark@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211215174524.1742389-1-robdclark@gmail.com> References: <20211215174524.1742389-1-robdclark@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Rob Clark Add UTS_RELEASE and show timestamp the same way for consistency. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/disp/msm_disp_snapshot.h | 4 ++-- drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h index 4c619307612c..31ad68be3391 100644 --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.h @@ -39,7 +39,7 @@ * @dev: device pointer * @drm_dev: drm device pointer * @atomic_state: atomic state duplicated at the time of the error - * @timestamp: timestamp at which the coredump was captured + * @time: timestamp at which the coredump was captured */ struct msm_disp_state { struct device *dev; @@ -49,7 +49,7 @@ struct msm_disp_state { struct drm_atomic_state *atomic_state; - ktime_t timestamp; + struct timespec64 time; }; /** diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c b/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c index 2e1acb1bc390..5d2ff6791058 100644 --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c @@ -5,6 +5,8 @@ #define pr_fmt(fmt) "[drm:%s:%d] " fmt, __func__, __LINE__ +#include + #include "msm_disp_snapshot.h" static void msm_disp_state_dump_regs(u32 **reg, u32 aligned_len, void __iomem *base_addr) @@ -79,10 +81,11 @@ void msm_disp_state_print(struct msm_disp_state *state, struct drm_printer *p) } drm_printf(p, "---\n"); - + drm_printf(p, "kernel: " UTS_RELEASE "\n"); drm_printf(p, "module: " KBUILD_MODNAME "\n"); drm_printf(p, "dpu devcoredump\n"); - drm_printf(p, "timestamp %lld\n", ktime_to_ns(state->timestamp)); + drm_printf(p, "time: %lld.%09ld\n", + state->time.tv_sec, state->time.tv_nsec); list_for_each_entry_safe(block, tmp, &state->blocks, node) { drm_printf(p, "====================%s================\n", block->name); @@ -100,7 +103,7 @@ static void msm_disp_capture_atomic_state(struct msm_disp_state *disp_state) struct drm_device *ddev; struct drm_modeset_acquire_ctx ctx; - disp_state->timestamp = ktime_get(); + ktime_get_real_ts64(&disp_state->time); ddev = disp_state->drm_dev; From patchwork Wed Dec 15 17:45:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 524629 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 58362C433EF for ; Wed, 15 Dec 2021 17:49:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238264AbhLORtg (ORCPT ); Wed, 15 Dec 2021 12:49:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238305AbhLORtf (ORCPT ); Wed, 15 Dec 2021 12:49:35 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46070C061401; Wed, 15 Dec 2021 09:49:35 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id co15so1617800pjb.2; Wed, 15 Dec 2021 09:49:35 -0800 (PST) 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=EcfVA2uBNe/X9h6wuhZ5EuU1xWQlNWZCg+pNTH+2meY=; b=kIp4kYBkdDDru9e4HJrZZx1Mqq/lPJBOIQxaWAsqiDdm5RVCVoj8s/WNVOAt2apkEx ehoLvfo0+fBHvEsFhC0tCoKyHUtmWXT/Ecsn1nSwftN1qUFJmUuEAQZ1jKtM3Xd3WTwa cnM8BMDTbbYcRQt61uaFQrp/TA68fpZv5INyMdhWf5322Jf/2TfxfXaTvCdmk4gU0Jpv ljXrNLt8ooqMdRZS95G+BM7KKfsmaGofA29Yl+FKKidVMQNBD7a7NtwUD1ePxcgFqOm2 0EHLFM7xvi/1la+RR5HsxUEyIY+XvK32s/BtNI7ijOH5ufs2fpUvG8OntcmSw9UURLuy V9iQ== 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=EcfVA2uBNe/X9h6wuhZ5EuU1xWQlNWZCg+pNTH+2meY=; b=61sE/vDM7tLLIN7OgCdzin72QdH6NR+gcQSy3T9pXUF5Ka8A1lBWAYhXBeAUbse5R6 wHo/UO9v0az2Ni3NY+Zn+o3YIzyYdE5iE4vtQPbug+xXOCKsgOIVq7JUCAiZ/TtW0iA5 gJyXyJvx2TX76JEHgRqIPEiJm2b6c+ssRCMo4DvPYB+voKnf4JLkc0gdJaIVOuRnUF/N BNXN+KpfDtMO62EnI2JNarYHPYJnW7gemKpx9UMummiRpGFaq6LLmeOPC27gp/tkbC9S xgvPwzc76JKpo28s/GrzuzKZ63SuzK758cgoDbytoB/h4JKu9pN64u14kegwpGWWxZtI W8dg== X-Gm-Message-State: AOAM530izj2Xng7VgGa3a5OASxBGPgi8YjIiY8l26iiwNM2hgPM47Ovd EkxlSDSMB1PAfL4SjzNlU5E= X-Google-Smtp-Source: ABdhPJx1Bx8yaUPuKlzM1Tz2ZDpWlyHvRiqC3BiqYmeoSCToMSDaurYg6b8JjJUEdJA2daCWrJD6wQ== X-Received: by 2002:a17:902:e54d:b0:148:a2e8:278a with SMTP id n13-20020a170902e54d00b00148a2e8278amr5386218plf.145.1639590574740; Wed, 15 Dec 2021 09:49:34 -0800 (PST) Received: from localhost (c-73-25-156-94.hsd1.or.comcast.net. [73.25.156.94]) by smtp.gmail.com with ESMTPSA id n3sm2976279pgc.76.2021.12.15.09.49.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 09:49:33 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Stephen Boyd , Doug Anderson , Dmitry Baryshkov , Rob Clark , Rob Clark , Sean Paul , Abhinav Kumar , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 3/3] drm/msm/debugfs: Add display/kms state snapshot Date: Wed, 15 Dec 2021 09:45:08 -0800 Message-Id: <20211215174524.1742389-4-robdclark@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211215174524.1742389-1-robdclark@gmail.com> References: <20211215174524.1742389-1-robdclark@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Rob Clark Signed-off-by: Rob Clark --- v2: Drop unneeded msm_kms_show_priv [Dmitry B] drivers/gpu/drm/msm/msm_debugfs.c | 75 +++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/drivers/gpu/drm/msm/msm_debugfs.c b/drivers/gpu/drm/msm/msm_debugfs.c index 956b1efc3721..0804c31e8962 100644 --- a/drivers/gpu/drm/msm/msm_debugfs.c +++ b/drivers/gpu/drm/msm/msm_debugfs.c @@ -15,6 +15,11 @@ #include "msm_gpu.h" #include "msm_kms.h" #include "msm_debugfs.h" +#include "disp/msm_disp_snapshot.h" + +/* + * GPU Snapshot: + */ struct msm_gpu_show_priv { struct msm_gpu_state *state; @@ -109,6 +114,73 @@ static const struct file_operations msm_gpu_fops = { .release = msm_gpu_release, }; +/* + * Display Snapshot: + */ + +static int msm_kms_show(struct seq_file *m, void *arg) +{ + struct drm_printer p = drm_seq_file_printer(m); + struct msm_disp_state *state = m->private; + + msm_disp_state_print(state, &p); + + return 0; +} + +static int msm_kms_release(struct inode *inode, struct file *file) +{ + struct seq_file *m = file->private_data; + struct msm_disp_state *state = m->private; + + msm_disp_state_free(state); + + return single_release(inode, file); +} + +static int msm_kms_open(struct inode *inode, struct file *file) +{ + struct drm_device *dev = inode->i_private; + struct msm_drm_private *priv = dev->dev_private; + struct msm_disp_state *state; + int ret; + + if (!priv->kms) + return -ENODEV; + + ret = mutex_lock_interruptible(&priv->kms->dump_mutex); + if (ret) + return ret; + + state = msm_disp_snapshot_state_sync(priv->kms); + + mutex_unlock(&priv->kms->dump_mutex); + + if (IS_ERR(state)) { + return PTR_ERR(state); + } + + ret = single_open(file, msm_kms_show, state); + if (ret) { + msm_disp_state_free(state); + return ret; + } + + return 0; +} + +static const struct file_operations msm_kms_fops = { + .owner = THIS_MODULE, + .open = msm_kms_open, + .read = seq_read, + .llseek = seq_lseek, + .release = msm_kms_release, +}; + +/* + * Other debugfs: + */ + static unsigned long last_shrink_freed; static int @@ -239,6 +311,9 @@ void msm_debugfs_init(struct drm_minor *minor) debugfs_create_file("gpu", S_IRUSR, minor->debugfs_root, dev, &msm_gpu_fops); + debugfs_create_file("kms", S_IRUSR, minor->debugfs_root, + dev, &msm_kms_fops); + debugfs_create_u32("hangcheck_period_ms", 0600, minor->debugfs_root, &priv->hangcheck_period);