From mboxrd@z Thu Jan 1 00:00:00 1970 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 438FEC7619A for ; Mon, 27 Mar 2023 12:48:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1EDE710E5A5; Mon, 27 Mar 2023 12:48:51 +0000 (UTC) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id B141710E59E for ; Mon, 27 Mar 2023 12:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679921329; x=1711457329; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w/UxaSunqw9CsvstEIGwRp8TDQffAMF4kJSz7uNzVfg=; b=L7iCGI77zOcEWCqOEtLE2HKdt3kGR0chZEWEn44uTSrUDgFKhr5OmFKS bweZ/u3nNA+VmNyR37Ww0Zqm6k1emB/lWkjXhdvCcRVxCcUJcrrtb9Hsy JUp2SLnzeUc5Vmhls55MH67aD4B6loQSTnbZI5gFOo85i9yErHdQ9V+/C 7U6h10PXG18ooAF/MkN93X6or9G9MJ7fe3D1wNJp8DAOchKiTmlpC+j+6 lCVXsILGSL1LB+pk1+lygogRglR1JjGSuDRLC7+xhdrnII/vulxWaD2cT wkHaYZ35SNtwK39VKefQuayeGinqLQ3KMB2i/KvAJR9FzsxCJQzNEK8o3 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10661"; a="342654371" X-IronPort-AV: E=Sophos;i="5.98,294,1673942400"; d="scan'208";a="342654371" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2023 05:48:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10661"; a="660832412" X-IronPort-AV: E=Sophos;i="5.98,294,1673942400"; d="scan'208";a="660832412" Received: from ababushk-mobl1.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.252.3.24]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2023 05:48:47 -0700 From: Matthew Auld To: intel-xe@lists.freedesktop.org Date: Mon, 27 Mar 2023 13:48:03 +0100 Message-Id: <20230327124807.54459-2-matthew.auld@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327124807.54459-1-matthew.auld@intel.com> References: <20230327124807.54459-1-matthew.auld@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Intel-xe] [PATCH v3 1/5] drm/xe/uapi: restrict system wide accounting X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Filip Hazubski , Lucas De Marchi , Effie Yu , Carl Zhang Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" Since this is considered an info leak (system wide accounting), rather hide behind perfmon_capable(). Signed-off-by: Matthew Auld Cc: Maarten Lankhorst Cc: Thomas Hellström Cc: Gwan-gyeong Mun Cc: Lucas De Marchi Cc: José Roberto de Souza Cc: Filip Hazubski Cc: Carl Zhang Cc: Effie Yu Cc: Gwan-gyeong Mun Reviewed-by: José Roberto de Souza Reviewed-by: Gwan-gyeong Mun --- drivers/gpu/drm/xe/xe_query.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c index dd64ff0d2a57..c134450dd0b0 100644 --- a/drivers/gpu/drm/xe/xe_query.c +++ b/drivers/gpu/drm/xe/xe_query.c @@ -128,7 +128,10 @@ static int query_memory_usage(struct xe_device *xe, usage->regions[0].min_page_size = PAGE_SIZE; usage->regions[0].max_page_size = PAGE_SIZE; usage->regions[0].total_size = man->size << PAGE_SHIFT; - usage->regions[0].used = ttm_resource_manager_usage(man); + if (perfmon_capable()) + usage->regions[0].used = ttm_resource_manager_usage(man); + else + usage->regions[0].used = usage->regions[0].total_size; usage->num_regions = 1; for (i = XE_PL_VRAM0; i <= XE_PL_VRAM1; ++i) { @@ -145,8 +148,16 @@ static int query_memory_usage(struct xe_device *xe, SZ_1G; usage->regions[usage->num_regions].total_size = man->size; - usage->regions[usage->num_regions++].used = - ttm_resource_manager_usage(man); + + if (perfmon_capable()) { + usage->regions[usage->num_regions].used = + ttm_resource_manager_usage(man); + } else { + usage->regions[usage->num_regions].used = + man->size; + } + + usage->num_regions++; } } -- 2.39.2