Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4637150yba; Wed, 17 Apr 2019 16:07:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhIa3E10WsWzo3JyyWVhxyYySxTKVzSF9D4BSisU7F3HykP3lozBlRbxz1uKEP1vfLjtch X-Received: by 2002:a63:115c:: with SMTP id 28mr56545881pgr.270.1555542444191; Wed, 17 Apr 2019 16:07:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555542444; cv=none; d=google.com; s=arc-20160816; b=I61JWBiAE0theqvH0d9Po6JGxf9sWLAs9zEtC6L4/8pAAhRh1CeHEVhFA9j2KDFJpQ GhcQ/j5OQR4nyDRSntnizb4ApRXVEkpiRQKCGHuYV3e/GEQ/0MfgLHwTOhhKkeR8LBOl QT9U4TO9yUeNjYcv7oe1MEmc2jIKCK3PywiDqnBtWqYMtYBkTeOXM9PpdJyT+3v3Gvk1 rLBBpZ75jUuZSbyUH1OSssgCmifNtA0F7evudzVwUw24pQg0H6atm9AymbryZUsb7igS gUmwRtORYQPdx+yCAKDUNpBzKfAWapHUvhEmoR4xF0lt9t2LmJ+xI/oxSZ6b0/pi1Uo7 /xsQ== 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=lsbUj33t0gvsr22SOjy5oOx+euNA0zyjnMbm0MoFT28=; b=FhXa4NmvLeAQPwiSoXADMtaFH3oSZSQBL6cmhgaY8wgDuFLpET0XRXP27BQVRz94AZ T2dpyi1gbJICXNn0O5KNCcle2i9+5+T2yr9NV8SFM5GMQ4TUVvos9XUmqX6+Pku2K58Y oEs4bWMQ7Y0yfo1WcrxtkBUln5iNzzzpHhSIwrWWKEAiZNf4DDWo9NqO6Z1Umzofmh1V qSo8nu9Z1DXKQ2FGmq940pvPX+QVkYNKCRPiRPlbdAQPBR3qV+SER6Ae2Q9/R4FfC0TE yjD8NBBV0NG0Xad9fL9GdZekw47fadwD+8J0ruOVrM40nXlPjYhr7OT9vW6xj0xu6+jD /goQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Lm6m18D7; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8si130845pgj.502.2019.04.17.16.07.08; Wed, 17 Apr 2019 16:07:24 -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=@google.com header.s=20161025 header.b=Lm6m18D7; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387707AbfDQXFh (ORCPT + 99 others); Wed, 17 Apr 2019 19:05:37 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:42672 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387678AbfDQXFg (ORCPT ); Wed, 17 Apr 2019 19:05:36 -0400 Received: by mail-lf1-f68.google.com with SMTP id w23so68307lfc.9 for ; Wed, 17 Apr 2019 16:05:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lsbUj33t0gvsr22SOjy5oOx+euNA0zyjnMbm0MoFT28=; b=Lm6m18D7DDLxGW4pE/oVKUWBxtkwVpAhoiG0u+nt2CWjHjnCRil59cTQhP7ctWxWfB llpokaf87CTT/uuVnY2BfjPG5EMdVTf6PynjKbcGVLLJmRA5Am1sPG+vL9CrhOjEATHF upZAjB4Cy8U+D1qKKaVLfffEDCi9sl9MPO0kXlaxzYSsME79qLHkjuelCL4qbh5yzo1r shMoJ27CpZN1unYrM/1yWDBOHRYEYcri09mleCpaiL9ODAMEjFeMISI/j1UsY0DlZ9Uu pQBq+RmtKdZjyq8Xc+8CEDSh+YUz7AzGfOTrySfiw5uc/UQAPBL3qI89MUsjyccCN1YR oGvA== 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=lsbUj33t0gvsr22SOjy5oOx+euNA0zyjnMbm0MoFT28=; b=qW/jvG1EBnmx6W6J2xIOoPRtjzUPq7Jj1x3/ic4nxS7qrKDAHMnePcOD49tnMeu52O Wn6EBCyyStiIvh9zcEUR8tuGr7HVzMcoy2DG9z0zfB2TolwYHNdQWKyOMVBDc7NP2EA2 dObVFgHN8NWvP5Ze5qXcVHhILFbbmTFIEX36CmwRWkwtyhrUvD4vXaWGoGX5kCe6RP/7 5wuFYVUCMBGUsSTPyCNcvOGU/7x+RmB10zNPl7fio/Bj6wWYl9st0/XDC+s04wOKjwec +t/d17SnjRTaioM6QSbqeP+VQA8lNaKNG6mlHntQ1Vc6FUVQlL1ihGURArbboHDnGMTQ jdbA== X-Gm-Message-State: APjAAAWAci3FgE1SAMg0mOMzLKUKD5qjUpXlCkiObmHEOQD/gk+pg+EQ Z1upIhn2yWJoTmBfeFkgedlDNiRvY2kuMntq96HldQ== X-Received: by 2002:a19:e619:: with SMTP id d25mr21178562lfh.66.1555542333025; Wed, 17 Apr 2019 16:05:33 -0700 (PDT) MIME-Version: 1.0 References: <20190313222124.229371-1-rajatja@google.com> <20190411003738.55073-1-rajatja@google.com> <20190411003738.55073-2-rajatja@google.com> In-Reply-To: From: Rajat Jain Date: Wed, 17 Apr 2019 16:04:56 -0700 Message-ID: Subject: Re: [PATCH v5 2/3] platform/x86: intel_pmc_core: Allow to dump debug registers on S0ix failure To: Andy Shevchenko Cc: Rajneesh Bhardwaj , Vishwanath Somayaji , Darren Hart , Andy Shevchenko , Platform Driver , Linux Kernel Mailing List , Rafael J Wysocki , Srinivas Pandruvada , Furquan Shaikh , Evan Green , Rajat Jain 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 Thu, Apr 11, 2019 at 6:40 AM Andy Shevchenko wrote: > > On Thu, Apr 11, 2019 at 3:38 AM Rajat Jain wrote: > > > > Add a module parameter which when enabled, will check on resume, if the > > last S0ix attempt was successful. If not, the driver would warn and provide > > helpful debug information (which gets latched during the failed suspend > > attempt) to debug the S0ix failure. > > > > This information is very useful to debug S0ix failures. Specially since > > the latched debug information will be lost (over-written) if the system > > attempts to go into runtime (or imminent) S0ix again after that failed > > suspend attempt. > > > +static int pmc_core_suspend(struct device *dev) > > +{ > > + struct pmc_dev *pmcdev = dev_get_drvdata(dev); > > + > > + pmcdev->check_counters = false; > > + > > + /* No warnings on S0ix failures */ > > + if (!warn_on_s0ix_failures) > > + return 0; > > + > > + /* Check if the syspend will actually use S0ix */ > > + if (pm_suspend_via_firmware()) > > + return 0; > > + > > + /* Save PC10 and S0ix residency for checking later */ > > > + if (!rdmsrl_safe(MSR_PKG_C10_RESIDENCY, &pmcdev->pc10_counter) && > > + !pmc_core_dev_state_get(pmcdev, &pmcdev->s0ix_counter)) > > Split it. done > > > + pmcdev->check_counters = true; > > + > > + return 0; > > +} > > + > > +static inline bool pmc_core_is_pc10_failed(struct pmc_dev *pmcdev) > > +{ > > + u64 pc10_counter; > > + > > + if (!rdmsrl_safe(MSR_PKG_C10_RESIDENCY, &pc10_counter) && > > + pc10_counter == pmcdev->pc10_counter) > > + return true; > > Split this as well. done > > > + > > + return false; > > +} > > + > > +static inline bool pmc_core_is_s0ix_failed(struct pmc_dev *pmcdev) > > +{ > > + u64 s0ix_counter; > > + > > + if (!pmc_core_dev_state_get(pmcdev, &s0ix_counter) && > > + s0ix_counter == pmcdev->s0ix_counter) > > + return true; > > And this. done > > > + > > + return false; > > +} > > + > > +static int pmc_core_resume(struct device *dev) > > +{ > > + struct pmc_dev *pmcdev = dev_get_drvdata(dev); > > + > > + if (!pmcdev->check_counters) > > + return 0; > > + > > + if (pmc_core_is_pc10_failed(pmcdev)) { > > + dev_info(dev, "PC10 entry had failed (PC10 cnt=0x%llx)\n", > > + pmcdev->pc10_counter); > > + } else if (pmc_core_is_s0ix_failed(pmcdev)) { > > > + > > Redundant. I did not quite understand the comment, but I have restructured this and I think this concerned will be addressed. > > > + const struct pmc_bit_map **maps = pmcdev->map->slps0_dbg_maps; > > + const struct pmc_bit_map *map; > > + int offset = pmcdev->map->slps0_dbg_offset; > > + u32 data; > > + > > + dev_warn(dev, "S0ix entry had failed (S0ix cnt=%llu)\n", > > + pmcdev->s0ix_counter); > > + while (*maps) { > > + map = *maps; > > + data = pmc_core_reg_read(pmcdev, offset); > > + offset += 4; > > + while (map->name) { > > + dev_warn(dev, "SLP_S0_DBG: %-32s\tState: %s\n", > > + map->name, > > + data & map->bit_mask ? "Yes" : "No"); > > > + ++map; > > map++; done > > > + } > > + ++maps; > > maps++; done > > > + } > > This is quite noisy. You need to print only what is important. I don't > think polluting dmesg with piles of these kind of messages is a good > idea. > Also, it is more likely should be done on debug level (except may be > one or two messages with really important information). Changed it to dev_dbg in my latest patch. I do not know if a subset of this information will be helpful to Intel to debug S0ix failures. This is something I'd like to defer to Rajneesh. I'd be happy to cut it short if it can still get the info Intel needs to debug S0ix failures. > > > + } > > + return 0; > > +} > > + > > +#endif > > -- > With Best Regards, > Andy Shevchenko