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 1FE94E732C8 for ; Thu, 28 Sep 2023 12:47:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A203B10E637; Thu, 28 Sep 2023 12:47:19 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0AF7D10E637; Thu, 28 Sep 2023 12:47:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695905238; x=1727441238; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=oqSTRmcjCYqRw0sfeiy8ehQSNUX+X8drzSf7sahkeqQ=; b=mOESQrQ1X7Ydb/FlusnKdVSwJP2KfY3c75UeOmoXZFeb01ZHNL2KumWl 8cI8BEUOm80hET56pyi2Jd2OhvsduPVYPVPoFrfE4irQtL1pk+nSiiwtK 3dufRiqY8dK/sG1GiapBs7+F6/CtHMuM3oo7BsnV+v7tW431nsPhADkNV gUMA5/E5+HYtVTmUWeudtPjtD4fsM0Ml+xmhvcyTHIrfROVrA9dn4yG8y uihzP4/ulO5ELIK7Fndfx65aLSG3vGLumQjmHR3de0xAr8kLGMYwbiVcg b/KEkmG++tcaK2XKKupwKPyYf8lgy/taNrZnFYk9llRsQlL4LsbV7fxqa A==; X-IronPort-AV: E=McAfee;i="6600,9927,10846"; a="361419475" X-IronPort-AV: E=Sophos;i="6.03,184,1694761200"; d="scan'208";a="361419475" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2023 05:47:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10846"; a="893001088" X-IronPort-AV: E=Sophos;i="6.03,184,1694761200"; d="scan'208";a="893001088" Received: from nlachman-mobl.ger.corp.intel.com (HELO [10.213.204.130]) ([10.213.204.130]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2023 05:46:06 -0700 Message-ID: Date: Thu, 28 Sep 2023 13:47:14 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Content-Language: en-US To: Steven Price , Intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org References: <20230927133843.247957-1-tvrtko.ursulin@linux.intel.com> <20230927133843.247957-2-tvrtko.ursulin@linux.intel.com> <3344d3cf-2883-27d1-424e-d33b739dceb5@arm.com> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc In-Reply-To: <3344d3cf-2883-27d1-424e-d33b739dceb5@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Intel-gfx] [PATCH 1/7] drm: Do not round to megabytes for greater than 1MiB sizes in fdinfo stats X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?Q?Adri=c3=a1n_Larumbe?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 27/09/2023 14:48, Steven Price wrote: > On 27/09/2023 14:38, Tvrtko Ursulin wrote: >> From: Tvrtko Ursulin >> >> It is better not to lose precision and not revert to 1 MiB size >> granularity for every size greater than 1 MiB. >> >> Sizes in KiB should not be so troublesome to read (and in fact machine >> parsing is I expect the norm here), they align with other api like >> /proc/meminfo, and they allow writing tests for the interface without >> having to embed drm.ko implementation knowledge into them. (Like knowing >> that minimum buffer size one can use for successful verification has to be >> 1MiB aligned, and on top account for any pre-existing memory utilisation >> outside of driver's control.) >> >> But probably even more importantly I think that it is just better to show >> the accurate sizes and not arbitrary lose precision for a little bit of a >> stretched use case of eyeballing fdinfo text directly. >> >> Signed-off-by: Tvrtko Ursulin >> Cc: Rob Clark >> Cc: Adrián Larumbe >> Cc: steven.price@arm.com > > Reviewed-by: Steven Price Thanks! Rob? Can we have your blessing? Could you live with KiBs? :) Regards, Tvrtko >> --- >> drivers/gpu/drm/drm_file.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c >> index e692770ef6d3..ecb5038009e7 100644 >> --- a/drivers/gpu/drm/drm_file.c >> +++ b/drivers/gpu/drm/drm_file.c >> @@ -913,7 +913,7 @@ static void print_size(struct drm_printer *p, const char *stat, >> unsigned u; >> >> for (u = 0; u < ARRAY_SIZE(units) - 1; u++) { >> - if (sz < SZ_1K) >> + if (sz == 0 || !IS_ALIGNED(sz, SZ_1K)) >> break; >> sz = div_u64(sz, SZ_1K); >> } >