Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp503463yba; Fri, 5 Apr 2019 10:53:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjgvsvZMpZTCM9C4Otzr1fdtVXZEo1Dzr9O/d9U4IFVV69k4HbZ5BNPd1LK/5VCPbsPiBq X-Received: by 2002:a17:902:7084:: with SMTP id z4mr13892378plk.305.1554486823637; Fri, 05 Apr 2019 10:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554486823; cv=none; d=google.com; s=arc-20160816; b=1AxOgTJy7JOkgjGwWpXUIVeOb+HjreBrjHzCwRPolPd/y5wN+/f8T5cK+4qzKc7sdm Q0fKQiXMd6tjC/uCNCu0kukkegFxx8Xq72dYbzI8ccKx2OR6sIgztHH17VkOzjzgVrKE MMwS0d8QAYBLQ3wvMtyHtx8Y5nINGrVNbWZOq11ftaMznKlW7GVUmiakb3zlESGaTywR +4gRAZ6hyLtqTwmJJSf1IpoI5owVLGO17p5M7rv+uGMBChXDzjAuzUfAD/C7E4knBDgB eGgkAiC3YS8dnyAXASwOPLDZ2mF8nDJHgo+Bfr3QYBAySekVDrFkPcESps085QArZeIu m2Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=FSpSosZdFZRPfx7A8yR39RXqE1Cn94GDH5CixHI+5eY=; b=OLJpj/NZ5wBjTlJu0el6Tca2Ioo8pcqxpl0fBDg3F0VzOOLr8tD07oxelBaYl+WWYk JmhRFtEswgJzXDzQJiTMnb//DsXowoNfRnJgVjQLeKNLmewilVv+um8mnXuqSmHiPVvw 9QdJKNOlY94sUMQLoSyxyLJVeQm/nm5T7aG/hmIiLFPpFm+XXu8gbqjRKd0Hc1rqBkcj 1RpMIC7TQyXEhC9yPSkt4GpsMWW+OCH6ixObEsNCH6wKWfAcTCjwxQL+toxVVegVNFPG I61UpQVDdmJzxSl2f0AlT8M8VqerHpi8uKgsU2xmLwZYPT2lN1RDQrxHiIzWoNaJ4zzd f3/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=UskltlgP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r184si18767547pgr.24.2019.04.05.10.53.27; Fri, 05 Apr 2019 10:53:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=UskltlgP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731628AbfDERwp (ORCPT + 99 others); Fri, 5 Apr 2019 13:52:45 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:44087 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731597AbfDERwo (ORCPT ); Fri, 5 Apr 2019 13:52:44 -0400 Received: by mail-lf1-f65.google.com with SMTP id v71so4963566lfa.11 for ; Fri, 05 Apr 2019 10:52:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FSpSosZdFZRPfx7A8yR39RXqE1Cn94GDH5CixHI+5eY=; b=UskltlgPf+BwYotFvqC2/ydUItpjQpa9y4u9m9TblPK8dZIhVlyO+s52wNOUCGM3La 4YAkhP95kbBc7k/dp21l3Z6lvxJXEEnTs5O/N58kVFR+1rSYQzXEwKpihyIP0zWF6XJL wus9F6ve3lBUVedtoH5pRra+oJ0jymNw86kL8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FSpSosZdFZRPfx7A8yR39RXqE1Cn94GDH5CixHI+5eY=; b=TH4VmFf6Qru6eZQt+etgQCN5oRoYJ1lRXJAmEr+SFKjivAHeoOr/fqMu8X7PZ5Slhg yfqXS10YvO/NeG5nU+CB/STzCaZoVJr1OfHBG+HiXl+W47FPH4eFmkNHaqSQtbOUfw35 Dq9eJrgkvOKerEFs280tlyDGR4cmAJUttFOB/w5f6bEd4jOM6QScfFnQxAQa4LstWRAX CH7i4W3e+YiaWPDgtBdCmwOSDN20LboUX4gK1nHwE5xDLGcw2TOb2ZL7x9xONZ4oEn8W 62EymbRPnxky4W6OJ/+cNPwrYLr/i2wC2ujnwCQMiRfkTDJfgty5rjvgIkAxz0h3sd+r nR5w== X-Gm-Message-State: APjAAAXYUST8xekHtmL8nv9vPHxdZqJYRRpmlYir5e+4aAPG+hvRjO4+ 2+Nv4wwTEPMN8eFfuh/pFRtMpgDUhZU= X-Received: by 2002:ac2:5285:: with SMTP id q5mr7303854lfm.37.1554486762267; Fri, 05 Apr 2019 10:52:42 -0700 (PDT) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id d3sm4829729ljc.15.2019.04.05.10.52.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Apr 2019 10:52:41 -0700 (PDT) Received: by mail-lj1-f169.google.com with SMTP id j89so6035225ljb.1 for ; Fri, 05 Apr 2019 10:52:41 -0700 (PDT) X-Received: by 2002:a2e:9a49:: with SMTP id k9mr8195155ljj.84.1554486760470; Fri, 05 Apr 2019 10:52:40 -0700 (PDT) MIME-Version: 1.0 References: <20190401180505.6621-1-evgreen@chromium.org> <20190405071455.GA30194@raj-desk2.iind.intel.com> In-Reply-To: <20190405071455.GA30194@raj-desk2.iind.intel.com> From: Evan Green Date: Fri, 5 Apr 2019 10:52:04 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] platform/x86: intel_pmc_core: Report slp_s0 residency range To: Rajneesh Bhardwaj Cc: Rajat Jain , Furquan Shaikh , Ravi Chandra Sadineni , Vishwanath Somayaji , Andy Shevchenko , LKML , platform-driver-x86@vger.kernel.org, Darren Hart Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 5, 2019 at 12:28 AM Rajneesh Bhardwaj wrote: > > On Mon, Apr 01, 2019 at 11:05:04AM -0700, Evan Green wrote: > > The PMC driver performs a 32-bit read on the sleep s0 residency counter, > > followed by a hard-coded multiplication to convert into microseconds. > > The maximum value this counter could have would be 0xffffffff*0x64 > > microseconds, which by my calculations is about 4.9 days. This is well > > within a reasonable time period to observe an overflow. > > > > Usermode consumers watching slp_s0_residency_usec need to be aware of > > overflows, but have no idea what the maximum value of this counter is, > > given the hardcoded multiply of a 32-bit value by > > SPT_PMC_SLP_S0_RES_COUNTER_STEP. > > This register is a 32 bit register untill ICL generation and a recent patch > from Rajat fixed the overflow https://patchwork.kernel.org/patch/10816103/ > already so i am not sure how this will help userspace. I think the userspace > can still take care of any overflow concerns based on the information > available about this register in EDS so i feel exposing a new debugfs entry > just for the sake of knowing range is probably not needed. So you don't anticipate reusing this driver for other models where the factor of 100 might change, or the counter might be a different width? We can hardcode the multiply in usermode in order to detect when we've exceeded the 4.9 day rollover range, but it seemed brittle, and would break if this hardware implementation detail ever changed. -Evan