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 D6456C4332F for ; Thu, 13 Oct 2022 15:54:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7EBBA10E8CE; Thu, 13 Oct 2022 15:54:49 +0000 (UTC) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8FD3E10E2A9; Thu, 13 Oct 2022 15:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665676476; x=1697212476; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=y9h7dWxaLMtLHek9iwwT/Jn7s8FHGzbL1rkeVrMjrCQ=; b=KTZMR7a/bGnqM0S4dzwlV8EiS85Iy2TLQ3rK3Gm3FeMFSDzPbu8Ujaie H0Bv5Qfrhip/FNcmvKvmV39aDEU+oDuA8yQGXlW8fnw1Bp/zuStSM32WG rn2fdsxMjoaxGr7Ql1zVGXE1krPbjOKVO67o0jSTu8YYPEn6APajRLf8P yyH+N2Oceir4cHNDMpMCra2YO3RmcWkz5GKlxnW30eRvh+n7lhQgY4UJz 5GEZw/1fs1ecl29R4G7/4wP+lDF1QGX0I+4Tf9BNlWbVouoA9AzzdMxfM eauPp8mUCT2aqY4QatiJflqTVUeU/xoTJPKFEiFLicE1DHSuGGgvpYAR5 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10499"; a="306765076" X-IronPort-AV: E=Sophos;i="5.95,182,1661842800"; d="scan'208";a="306765076" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2022 08:54:35 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10499"; a="578282922" X-IronPort-AV: E=Sophos;i="5.95,182,1661842800"; d="scan'208";a="578282922" Received: from adixit-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.212.216.120]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2022 08:54:34 -0700 Date: Thu, 13 Oct 2022 08:54:34 -0700 Message-ID: <87a65zsoqt.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Andi Shyti In-Reply-To: References: <20220927055020.3499420-1-badal.nilawar@intel.com> <20220927055020.3499420-5-badal.nilawar@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Subject: Re: [Intel-gfx] [PATCH 4/7] drm/i915/hwmon: Show device level energy usage 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: linux-hwmon@vger.kernel.org, Jani Nikula , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Rodrigo Vivi Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Mon, 03 Oct 2022 14:13:10 -0700, Andi Shyti wrote: > Hi Andi, > [...] > > > > diff --git a/Documentation/ABI/testing/sysfs-driver-intel-i915-hwmon b/Documentation/ABI/testing/sysfs-driver-intel-i915-hwmon > > > index 16e697b1db3d..7525db243d74 100644 > > > --- a/Documentation/ABI/testing/sysfs-driver-intel-i915-hwmon > > > +++ b/Documentation/ABI/testing/sysfs-driver-intel-i915-hwmon > > > @@ -25,3 +25,11 @@ Contact: dri-devel@lists.freedesktop.org > > > Description: RO. Card default power limit (default TDP setting). > > > > > > Only supported for particular Intel i915 graphics platforms. > > > + > > > +What: /sys/devices/.../hwmon/hwmon/energy1_input > > > +Date: February 2023 > > > +KernelVersion: 6.2 > > > +Contact: dri-devel@lists.freedesktop.org > > > > I'm sorry for being late on the review here, and I know that others > > already looked at the date and other details here in this doc. > > So I'm curious why we have decided for the dri-devel mailing list > > and not for the intel-gfx since intel-gfx is the only one we have > > listed for i915 dir in the MAINTAINERS file: > > L: intel-gfx@lists.freedesktop.org > > same question here. These have all been changed to intel-gfx. > > > > +Description: RO. Energy input of device in microjoules. > > > + > > > + Only supported for particular Intel i915 graphics platforms. > > [...] > > > > +/* > > > + * hwm_energy - Obtain energy value > > > + * > > > + * The underlying energy hardware register is 32-bits and is subject to > > > + * overflow. How long before overflow? For example, with an example > > > + * scaling bit shift of 14 bits (see register *PACKAGE_POWER_SKU_UNIT) and > > > + * a power draw of 1000 watts, the 32-bit counter will overflow in > > > + * approximately 4.36 minutes. > > > + * > > > + * Examples: > > > + * 1 watt: (2^32 >> 14) / 1 W / (60 * 60 * 24) secs/day -> 3 days > > > + * 1000 watts: (2^32 >> 14) / 1000 W / 60 secs/min -> 4.36 minutes > > > + * > > > + * The function significantly increases overflow duration (from 4.36 > > > + * minutes) by accumulating the energy register into a 'long' as allowed by > > > + * the hwmon API. Using x86_64 128 bit arithmetic (see mul_u64_u32_shr()), > > > + * a 'long' of 63 bits, SF_ENERGY of 1e6 (~20 bits) and > > > + * hwmon->scl_shift_energy of 14 bits we have 57 (63 - 20 + 14) bits before > > > + * energy1_input overflows. This at 1000 W is an overflow duration of 278 years. > > > + */ > > > +static int > > > +hwm_energy(struct hwm_drvdata *ddat, long *energy) > > This function can just be void. Done. Thanks. -- Ashutosh