Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp4511587imj; Tue, 12 Feb 2019 18:11:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IbhAH5mPNhEP75dB8ipWKvP78tohAEvGwZJJKJrPSzdIg7cROGKsh5qEzVkse6jWGWA1Sk7 X-Received: by 2002:a17:902:12e:: with SMTP id 43mr7232465plb.31.1550023910960; Tue, 12 Feb 2019 18:11:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550023910; cv=none; d=google.com; s=arc-20160816; b=OtKBq98bbBlKPA/o64PVgHTtYHMj2uf0+APKFwwFuccBHIRuNygnN7xS7noWHwf4Hg 6F0BqCbNJIHfQtESh8jh8EFD+Ohj9jRURuolB7NSD708G4bJ19wLlBC5xnMtbuqZV11s u/htbstFbzkZmVXwf4Ba31gn4ZDvssaWox7aIyP49kCycmxedTzg0MRG9BIbLO+DcH93 Q7I1eWkLKQI+WDVxlHdhEPV9dHX5XXvCVfbOw3fFfEnMrHwprRJnT/dnX2e2Gc8LHpW8 zNFXh3FsCcVRkU7WCCNZIFpGeqiY96NJbPLuFlhcO6g6xAm2J/8nZiiB7VHRlXEg0P4m RraA== 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; bh=fWArCI7C+5nivi0a7pqjzCyFSu69XO4s81+B9KJwjKs=; b=agN3/8BNxlMUPakVMFv+pRQfZLjKK2BCG1A5dU9ooHEKuD8yab+5gjAS07YqGwSSXt TWeqG2ZxhjVQ/zCf2rgCnwmEAIV3vfmg7UNjV92/pN2dsVlDWKfdRrE3mtR4fCpxCcBo H6w2waXiX+WjU0u7J1qMPzTk+9e9TVAk1DSinGQFmSaTtBWHLyxIOS0rfTR4uoKJG532 vLHkrAQWDEUXVc8rcDROzcCc1aeQYtRJhTDtkiyLd2X4qjTM+FVf1pQLO9UaDThHku3q 3jkC8eXw+kA5fh6ZaeCoDk/6UpsEzYACgQTmZD2P3s3Q8tuYkHVKw8SFiuGix9FMr0ii 17TA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7si8341105pga.296.2019.02.12.18.11.35; Tue, 12 Feb 2019 18:11:50 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729651AbfBLXBa (ORCPT + 99 others); Tue, 12 Feb 2019 18:01:30 -0500 Received: from mail-ot1-f66.google.com ([209.85.210.66]:38286 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727511AbfBLXBa (ORCPT ); Tue, 12 Feb 2019 18:01:30 -0500 Received: by mail-ot1-f66.google.com with SMTP id m1so739247otf.5; Tue, 12 Feb 2019 15:01:29 -0800 (PST) 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=fWArCI7C+5nivi0a7pqjzCyFSu69XO4s81+B9KJwjKs=; b=nrg/3QXqS6w0xFTgnGVnvduqUAChiYa7CUQRFZg0cdUBKMrT5b/4nK+ltdj9cMi9WW 5wY63Xj0Oskzbk+ZYn+ZPHRNHPyA4JMV0EshGgzkmZGhDH8ETrQybrM4z6u8SE94eP3P QSG1C/+8yvVUJNhHexvw7EjxQXiJJcR49GHepxUGdF3iPJltD4JeFxkLsY6huOgiQg5Y h4uoEbnRrmQV+NSxt/kS1HU5Hzcc/ltsB0Guu3otaU6SIYyOkt15LnhAKhYQ6yJtZpaY VYnStN7RX+thQsbB36W8lBI+LmLApEvHX6nnljkzdK58ziYL9em13Anb6v5Dwz1WQgOe 4Kyw== X-Gm-Message-State: AHQUAua6bbAmITDAcNfTEpzXJNSZBLq2JoGbE4yUAIqKCea/ZLzOLDzQ rn+1r+Tnfg7AWAjHMwLoJ32rmYyLxPAYq3yFeBMCUg== X-Received: by 2002:a9d:60b:: with SMTP id 11mr6095853otn.200.1550012489348; Tue, 12 Feb 2019 15:01:29 -0800 (PST) MIME-Version: 1.0 References: <20190212070839.25981-1-e.velu@criteo.com> In-Reply-To: <20190212070839.25981-1-e.velu@criteo.com> From: "Rafael J. Wysocki" Date: Wed, 13 Feb 2019 00:01:18 +0100 Message-ID: Subject: Re: [PATCH v4] cpufreq: intel_pstate: Reporting reasons why driver prematurely exit To: Erwan Velu Cc: Erwan Velu , Srinivas Pandruvada , Len Brown , "Rafael J. Wysocki" , Viresh Kumar , "open list:INTEL PSTATE DRIVER" , open list 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 Tue, Feb 12, 2019 at 8:09 AM Erwan Velu wrote: > > The init code path has several exceptions where the module can decide not to load. > As CONFIG_X86_INTEL_PSTATE is generally set to Y, the return code is not reachable. > The initialization code is neither verbose of the reason why it did choose to prematurely exit. > > This situation leads to a situation where its difficult for a user to determine, > on a given platform, why the driver didn't load properly. > > This patch is about reporting to the user the reason/context of why the driver failed to load. > That is a precious hint when debugging a platform. > > Signed-off-by: Erwan Velu Newline characters are missing in all of your messages. > --- > drivers/cpufreq/intel_pstate.c | 27 +++++++++++++++++++++------ > 1 file changed, 21 insertions(+), 6 deletions(-) > > diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c > index dd66decf2087..eb62e5555dcc 100644 > --- a/drivers/cpufreq/intel_pstate.c > +++ b/drivers/cpufreq/intel_pstate.c > @@ -2475,6 +2475,7 @@ static bool __init intel_pstate_no_acpi_pss(void) > kfree(pss); > } > > + pr_debug("Cannot detect ACPI PSS"); "ACPI _PSS not found\n" > return true; > } > > @@ -2484,10 +2485,15 @@ static bool __init intel_pstate_no_acpi_pcch(void) > acpi_handle handle; > > status = acpi_get_handle(NULL, "\\_SB", &handle); > - if (ACPI_FAILURE(status)) > + if (ACPI_FAILURE(status)) { > + pr_debug("Cannot detect ACPI SB"); This is very unlikely to happen, I wouldn't bother to print anything here. > return true; > + } > > - return !acpi_has_method(handle, "PCCH"); > + status = acpi_has_method(handle, "PCCH"); > + if (!status) > + pr_debug("Cannot detect ACPI PCCH"); This message can be printed by the caller and, again, I would prefer something like "ACPI PCCH not found". > + return !status; > } > > static bool __init intel_pstate_has_acpi_ppc(void) > @@ -2502,6 +2508,7 @@ static bool __init intel_pstate_has_acpi_ppc(void) > if (acpi_has_method(pr->handle, "_PPC")) > return true; > } > + pr_debug("Cannot detect ACPI PPC"); "ACPI _PPC not found\n" > return false; > } > > @@ -2539,8 +2546,10 @@ static bool __init intel_pstate_platform_pwr_mgmt_exists(void) > id = x86_match_cpu(intel_pstate_cpu_oob_ids); > if (id) { > rdmsrl(MSR_MISC_PWR_MGMT, misc_pwr); > - if ( misc_pwr & (1 << 8)) > + if (misc_pwr & (1 << 8)) { > + pr_debug("MSR_MISC_PWR_MGMT reports enabled HW coordination"); IIRC this means that the platform is managing P-states on systems without HWP, so I would print something like "P-states managed by the platform\n". > return true; > + } > } > > idx = acpi_match_platform_list(plat_info); > @@ -2606,22 +2615,28 @@ static int __init intel_pstate_init(void) > } > } else { > id = x86_match_cpu(intel_pstate_cpu_ids); > - if (!id) > + if (!id) { > + pr_warn("CPU ID is not in the list of supported devices\n"); Why not pr_debug()? And analogously below? > return -ENODEV; > + } > > copy_cpu_funcs((struct pstate_funcs *)id->driver_data); > } > > - if (intel_pstate_msrs_not_valid()) > + if (intel_pstate_msrs_not_valid()) { > + pr_warn("Cannot enable driver as per invalid MSRs\n"); > return -ENODEV; > + } > > hwp_cpu_matched: > /* > * The Intel pstate driver will be ignored if the platform > * firmware has its own power management modes. > */ > - if (intel_pstate_platform_pwr_mgmt_exists()) > + if (intel_pstate_platform_pwr_mgmt_exists()) { > + pr_warn("Platform already taking care of power management\n"); > return -ENODEV; > + } > > if (!hwp_active && hwp_only) > return -ENOTSUPP; > --