Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp71283pxu; Thu, 3 Dec 2020 19:58:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVTwI0JrFxR/8bQofTQg/jAHvHgWZA9iq0beFNwZln7sqL9Hb6M5f2bNrBVQDgiM82ce6f X-Received: by 2002:a50:cd84:: with SMTP id p4mr5608861edi.81.1607054285171; Thu, 03 Dec 2020 19:58:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607054285; cv=none; d=google.com; s=arc-20160816; b=zhU1dENtoTH4OwBBXm8+W5LLdqDdFtVpBFjQAeIYBtnTsegEgTFs44rNzX9trQT0Au HWojTrSDgLP0XdbA8NpGIOqJcFLmHOjozs4ymRzqiYY3cuBnb2lkx7ZP6L6M8NJ7FYGQ HK02NsB04NOO+A3D1aeOecgTiB3tGwPGkTolJjqNBTUtSwwSUlj/RwGjujzFyhUgz27o DVfP8vtIYoezyMxkEJFMLsRv1hwIqolEaZIa/HGQwrJdc8geTCuO0bO/xqqPZ+R29L2m vPZwiZo2t9nBVlSlgkj+HnMTj8rzwZOUgECYKV/P3ZNFtnoyL8lsat261x0NPf7tPkyk PIgA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ULTmDl5ODAp5+pGiMlfRgGgqG7bhEVtrrqJo/V0Wv5o=; b=tT0Yev4zvBVYsCKocbPlUtemGQABCvpKTD0HyYtRUVFfSouQjOyAKnZ/14b4DSHfhp 6jZEYR6Id3zD+pDetNlKi8mM+53PImmHKAByltH64kbjxrn6ijMV3g79Uy/L3ueNxrfH TnRqetNLz1RGhzdBpCJmrlpBd7CGLncvIwRs8aFUNPFHFLIjhrSiiPJ3iqECIsBZ7gde s8MF1Eani4xO9o/EiCZ7cV3T3amVsVo6CGZhJ/18wYaVPG3u6dAI2omzQl9Qt/YLazpx EjVM4R03SOOp/2vRXI4zB2uM6qhaIHoBN9r5gBMmmhNS7B2s3w2j4meV7aZqEwOlw+Rs vYTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="IqWzw/7L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gf18si661774ejb.202.2020.12.03.19.57.43; Thu, 03 Dec 2020 19:58:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="IqWzw/7L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727908AbgLDDyW (ORCPT + 99 others); Thu, 3 Dec 2020 22:54:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726469AbgLDDyW (ORCPT ); Thu, 3 Dec 2020 22:54:22 -0500 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BAF8C061A52 for ; Thu, 3 Dec 2020 19:53:36 -0800 (PST) Received: by mail-il1-x141.google.com with SMTP id p5so4002405iln.8 for ; Thu, 03 Dec 2020 19:53:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ULTmDl5ODAp5+pGiMlfRgGgqG7bhEVtrrqJo/V0Wv5o=; b=IqWzw/7LhLKatX2EcMZ7gPXa4FX987fJvD2fIX7S33kmZPPX9/QQhdFXd18ExVQsKP sW/pxBbVFcILY5G+8C0Hd7JrF91UtzuNPSkxy9+moOonfKdGEv38ehQddV13jPK8qZhS 5lgBjYtrCsgneZH6Ityt0+U1RYuwDszWp9fQnAf5y1EYCsqnlcy3PHp6yiKYVItjFZc1 z1/aSSLurV/FbaOfmjYkWwRXL6Mg0jbQ/ow+kszM5s5wHf8YGqfOt8ACPLi+LzM/USzM f/rrzkzNiPg2zE2ul+Jwmp2Cfb7HbEMQCOV+sQcBxl9WYyd8o1Y3Ng1IRztDmYk/EqS1 Ahfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ULTmDl5ODAp5+pGiMlfRgGgqG7bhEVtrrqJo/V0Wv5o=; b=hqqvvkArqzn0dgsve+oXpT0dHSb2Xv7EtUBfYup8BBzyUndHsej9ToiZz1rEgjSNY2 Me+cJIL9+txsKdvn2oasMbYXnBYSKCBqlM0qqU7HQd6rH1Sp1gqhqxBA8DM/7fGEyGeQ 5XDFMJ26J2OZwnDScZwnuxx0lowMMretvWKW1t8swkUTLn2R5eDw+a6NDwtbZBVchLcO +G8uE8XkIxG5fTJuA+KytADtLIWSKsvja5pDCiiuRtaVsqDNFVx+u+SnSHw1EfF4r797 uqV6fCCnvff+ppJvgW/vjQiznYoU5bnUmg8GcqJKDhWacVWIFdpCjwwZhnPZ5EjXJtS1 XTYg== X-Gm-Message-State: AOAM530GbxdBVuuyAyjY4YQN2qFrOnPUeIT9kfaHI5odwYlCwVlLC9cY gxBlQMAo/wD33KCkYNhEewk= X-Received: by 2002:a92:58cb:: with SMTP id z72mr3406498ilf.104.1607054015671; Thu, 03 Dec 2020 19:53:35 -0800 (PST) Received: from frodo.mearth (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id o12sm671361ilj.55.2020.12.03.19.53.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 19:53:35 -0800 (PST) From: Jim Cromie To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: jbaron@akamai.com, Jim Cromie , Zhenyu Wang , Zhi Wang , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: [RFC PATCH 2/2] i915: POC use dynamic_debug_exec_queries to control pr_debugs in gvt Date: Thu, 3 Dec 2020 20:53:18 -0700 Message-Id: <20201204035318.332419-3-jim.cromie@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201204035318.332419-1-jim.cromie@gmail.com> References: <20201204035318.332419-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The gvt component of this driver has ~120 pr_debugs, in 9 "classes". Following model of drm.debug, add a parameter to map bits to these classes. In Makefile, add DYNAMIC_DEBUG_MODULE. This converts gvt's pr_debugs, even if the rest of drm is not using CONFIG_DRM_USE_DYNAMIC_DEBUG. Signed-off-by: Jim Cromie --- drivers/gpu/drm/i915/gvt/Makefile | 1 + drivers/gpu/drm/i915/i915_params.c | 74 ++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/drivers/gpu/drm/i915/gvt/Makefile b/drivers/gpu/drm/i915/gvt/Makefile index ea8324abc784..e38a1eb618bd 100644 --- a/drivers/gpu/drm/i915/gvt/Makefile +++ b/drivers/gpu/drm/i915/gvt/Makefile @@ -6,4 +6,5 @@ GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o firmware.o \ fb_decoder.o dmabuf.o page_track.o ccflags-y += -I $(srctree)/$(src) -I $(srctree)/$(src)/$(GVT_DIR)/ +ccflags-y += -DDYNAMIC_DEBUG_MODULE i915-y += $(addprefix $(GVT_DIR)/, $(GVT_SOURCE)) diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index 7f139ea4a90b..ecc825558e00 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -260,3 +260,77 @@ void i915_params_free(struct i915_params *params) I915_PARAMS_FOR_EACH(FREE); #undef FREE } + +/* POC for callback -> dynamic_debug_exec_queries */ +unsigned long __gvt_debug; +EXPORT_SYMBOL(__gvt_debug); + +static char *format_prefix_classes[] = { + "gvt: cmd: ", + "gvt: core: ", + "gvt: dpy: ", + "gvt: el: ", + "gvt: irq: ", + "gvt: mm: ", + "gvt: mmio: ", + "gvt: render: ", + "gvt: sched: " +}; +#define NUM_CLASSES ARRAY_SIZE(format_prefix_classes) +#define OUR_QUERY_SIZE 128 /* we need about 20 */ + +#include + +static int param_set_dyndbg(const char *instr, const struct kernel_param *kp) +{ + unsigned int val; + unsigned long changes, result; + int rc, chgct = 0, totct = 0, bitpos; + char query[OUR_QUERY_SIZE]; + + rc = kstrtouint(instr, 0, &val); + if (rc) { + pr_err("set_dyndbg: failed\n"); + return -EINVAL; + } + result = val; + pr_info("set_dyndbg: result:0x%lx from %s\n", result, instr); + + changes = result ^ __gvt_debug; + + for_each_set_bit(bitpos, &changes, NUM_CLASSES) { + + sprintf(query, "format '^%s' %cp", format_prefix_classes[bitpos], + test_bit(bitpos, &result) ? '+' : '-'); + + chgct = dynamic_debug_exec_queries(query, "i915"); + + pr_info("%d changes on: %s\n", chgct, query); + totct += chgct; + } + pr_info("total changes: %d\n", totct); + __gvt_debug = result; + return 0; +} +static int param_get_dyndbg(char *buffer, const struct kernel_param *kp) +{ + return scnprintf(buffer, PAGE_SIZE, "%u\n", + *((unsigned int *)kp->arg)); +} +static const struct kernel_param_ops param_ops_dyndbg = { + .set = param_set_dyndbg, + .get = param_get_dyndbg, +}; + +MODULE_PARM_DESC(debug_gvt, " gvt debug categories:" + "\n\t0x1\t gvt: cmd:" + "\n\t0x2\t gvt: core:" + "\n\t0x4\t gvt: dpy:" + "\n\t0x8\t gvt: el:" + "\n\t0x10\t gvt: irq:" + "\n\t0x20\t gvt: mm:" + "\n\t0x40\t gvt: mmio:" + "\n\t0x80\t gvt: render:" + "\n\t0x100\t gvt: sched:" "\n"); + +module_param_cb(debug_gvt, ¶m_ops_dyndbg, &__gvt_debug, 0644); -- 2.28.0