From patchwork Thu Sep 14 17:24:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 139861 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp647168vqi; Thu, 14 Sep 2023 14:55:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFXPIIvulW3DhjtwPZjyLaJGTAq1TjTHnHnh+KRT3lfe1xQzBDT5+h7Qzue56kVAGcyyORp X-Received: by 2002:a17:90b:3689:b0:262:ff1c:bc33 with SMTP id mj9-20020a17090b368900b00262ff1cbc33mr6255364pjb.13.1694728550296; Thu, 14 Sep 2023 14:55:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694728550; cv=none; d=google.com; s=arc-20160816; b=O0DZaecLyCkfEfnlxVctOW8sFfvS7hppRQvM7+8oy1yRu9Pio7zvuS7QhLfNmcs1fZ qoDdk74nFOKWk3cFgBQ2TGZprBtuqNO13cbk1QXOdThqIwxstdIAVhJ9LcdLVT+ekX57 /CEOBDqdWxCORhA3DD2FFWa1gI4AplPdyei/XtuBD0M0tF8b92bx04uUcoUiZ7IfEka6 cKAYgmye4oNm49g+yzBwwFjldKW1e8FLh/ZgOqmfEc+HX0tRtUiJHxnLGoKfTW305A4X 1jhYKuGYfcH01RY1vkYQsmT+PZqD2pLpGE/g1D92Op/SvfT7TcloBMd9/mbS8iE+5z+V zztg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+79uOjNcwbPpa9/kVCOKluSz7c5JO5jNMvatVqMKNmk=; fh=JP5tz/KpkPy+7dJPz4kGAlOxHUw30O30vGHxn+0J2EI=; b=Vm2nVibZb2Qb52AET1qmKERbsb+dUY3EveUDfjrzSTcE04uNZjf+uLDEnpkLNQXUck 8vwx5riPBNwUxE3lzOf7LThCH9QLXjhXQY71b0Zj44/qg8OJ9aq9sZHVFDGemGtqplZY fGDPKb0ShTaBEK9k/zbO//NDJqrIV4+O28UzjhBhlO0MMY8rmfUDWPq+6W6RNrhntNYl ltWNpmRptoasQlQh3uoKKZg/u35JvxI1fi+rq4y/Pae+OquarNwyJo9arZyZi3hy1liD /B1xnOey5q091939D3Cli4FJ2bMGB9JFppASJVr9nceVmwr45p6ImFg6yfMqhxeLslhe cJUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=le9eYzac; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id m3-20020a170902c44300b001b6ae9f8bb1si2199624plm.75.2023.09.14.14.55.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 14:55:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=le9eYzac; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 245A58186535; Thu, 14 Sep 2023 10:26:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240724AbjINR0m (ORCPT + 33 others); Thu, 14 Sep 2023 13:26:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241646AbjINR0Y (ORCPT ); Thu, 14 Sep 2023 13:26:24 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4B38270C; Thu, 14 Sep 2023 10:25:00 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-68fb85afef4so1135248b3a.1; Thu, 14 Sep 2023 10:25:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694712300; x=1695317100; 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=+79uOjNcwbPpa9/kVCOKluSz7c5JO5jNMvatVqMKNmk=; b=le9eYzacaYfaC8ENloAqRPWLaeUZS49RijAY68gSuZVVv+34Vg+A+6uhGmRswDi6xU ydMWojRBuRME0iO9UzuznxwV5CwpprXuAZopjehw6MYSJdTvuycoYEWThjOrOBiQTeCU 64arN+xnRyjrWshoV8Qywwii3X4qu4p7Lhth06U5zp87A6ibcVpllMsZcyI7AprEKp25 8RfrsmeibiaEVWgQzwahcFGpdJQFik26o41yuNRPX8HyqzLZtlxPYmeiuZVXZZq3j7o1 qB6IGyZvgSUkmzGLogRALiFIV2hoCKXLnBrDM07YydtCUoiSIX1zUpgoEAQVzQP1Ux84 rGiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694712300; x=1695317100; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+79uOjNcwbPpa9/kVCOKluSz7c5JO5jNMvatVqMKNmk=; b=LnI+UD2Dh22cW4TkY20PJ/pLFR8i4MasWaCxV+zYbz2SX+MxJatP8ysJ6JQaTv/ztm Y99E9VTSqSAV410L6oMjsLS0MVtwtWJg+YuE46fJAGhgO1dGPXaIavRtDBt4umdz//NY C2ILQXNXXjH6O9iNAC52IYGOOgRzGd5nlj2rmxSwc3GDVG4k3/21cUowyb7r1WWgJ5Ci BZayy295yqOsDNDCuVvAh8JD2KQSk7jL4/VNt172KUNGFuxrZiuYUYb8CFsqp/P/Fb6m LKvrbG1U1e+/P+RtujN+9X9d2QkkA+i0CMSzAEpQcYqyFHwEfBPFbg8l54eop8zIyzQ/ ePMQ== X-Gm-Message-State: AOJu0Yw/XvPKchPAAV8/c5ZeJ1t1RGhqf0gP358+tIfma7gqDD4BdWc5 X5KkIQKbj4vjQzcUG447xVU= X-Received: by 2002:a05:6a21:998b:b0:13d:df16:cf29 with SMTP id ve11-20020a056a21998b00b0013ddf16cf29mr6980311pzb.15.1694712300117; Thu, 14 Sep 2023 10:25:00 -0700 (PDT) Received: from localhost ([2a00:79e1:abd:4a00:69d1:d8aa:25be:a2b6]) by smtp.gmail.com with ESMTPSA id p22-20020aa78616000000b0068aca503b9fsm1587905pfn.114.2023.09.14.10.24.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 10:24:59 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: freedreno@lists.freedesktop.org, Rob Clark , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org (open list:DRM DRIVER FOR MSM ADRENO GPU), linux-kernel@vger.kernel.org (open list) Subject: [RFC] drm/msm/rd: Check PT_PTRACED for cmdstream dumping Date: Thu, 14 Sep 2023 10:24:53 -0700 Message-ID: <20230914172453.9707-1-robdclark@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 14 Sep 2023 10:26:55 -0700 (PDT) X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777051683992808072 X-GMAIL-MSGID: 1777051683992808072 From: Rob Clark So, when you want to get a cmdstream trace of some deqp or piglit test, but you happen to be running it on the same laptop with full desktop env, the current dump-everything firehose of `cat $debugfs/dri/n/rd` is quite a bit too much. Ptrace seemed kind of a natural way to control it, ie. either run what you want to trace under gdb or hack in a ptrace(PTRACE_TRACEME) call. Signed-off-by: Rob Clark Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_gem_submit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c index a908373cf34b..a105ca1f2102 100644 --- a/drivers/gpu/drm/msm/msm_gem_submit.c +++ b/drivers/gpu/drm/msm/msm_gem_submit.c @@ -979,7 +979,8 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, /* The scheduler owns a ref now: */ msm_gem_submit_get(submit); - msm_rd_dump_submit(priv->rd, submit, NULL); + if (current->ptrace & PT_PTRACED) + msm_rd_dump_submit(priv->rd, submit, NULL); pm_runtime_get_sync(&gpu->pdev->dev);