Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp177196pxa; Tue, 18 Aug 2020 20:26:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfEcjSmOF/XoS0jMxixi9bZlPNFnX7359FRb0Bf3zTNrONBLRuzGdgjQHVAn84683QNPkP X-Received: by 2002:a17:907:2805:: with SMTP id eb5mr22761002ejc.139.1597807577433; Tue, 18 Aug 2020 20:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597807577; cv=none; d=google.com; s=arc-20160816; b=wJheRcil60wS/d8k5Mby4MZPAX/WGSj/cOIH54bZ2ib45s2m6JKN8PoPRACIfDNDz2 B2+O+FKMunvtMVUABYp3GTZjGYzrP4aGQoFjpQV3bz3I2UUc9nhxpnyL39PvkrWJlboN zbI9tGQsl31KS0xL+GI/iOUiXF9mh5AWoCaJJkkzFGrtS0GG0dkEcnlbgiTrB/3FBrch ZqW2fbqc6D4FOmYz6CIuRMSbX4CnmxsnoHvaSv2s28E+9jGViLkdp55/GXCIEipvzjbg 7qA+8Xi670Dt4RESGT+efF88I6VQB6BBZvvCU6Uih5YpVPHBz4+98pox6ktqInmH+/Xz HaOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=3cpBW9KCxHn/rV6sutEKdbngtzJNJsKdtFFe+nxtXfQ=; b=LnH1eW971E4LsozICBt5QsaO6cfXznSWwD4dR+uxXJwVZBq2JhjrNZiW23b6dsKaB9 zi0lmmI8HDSICSFPPN0Gkfu0yAcKyNCY3iK+WNTDfQ++r9UAWMVlYb2YP1oJJ3GB+4k7 eG16Gc/RVb+Avyy8hdqvJaFvmXCuaOkme7imZRsMraL2gt1GC58Rj4xt0OUI65wtlay0 qo3QFrY6mb3BvrNYzwsDR2J13XcqdjhcUcs9KhM2PvFP/uqKsaH12b8yY1CJvAmQBU11 xSDFua6Cej89Ma24mPswvUIZFGLjef4ZBzfnW+1c6qeqdBSmA9SI8sPaojoiWxbVx+lH tI4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x7si14327903eds.105.2020.08.18.20.25.53; Tue, 18 Aug 2020 20:26:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727969AbgHSDWq (ORCPT + 99 others); Tue, 18 Aug 2020 23:22:46 -0400 Received: from mga02.intel.com ([134.134.136.20]:17561 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726803AbgHSDWp (ORCPT ); Tue, 18 Aug 2020 23:22:45 -0400 IronPort-SDR: /ya+HZU058Vq46pjpK4qAuJGFJI2p7t41McJ/WlbWu5LnkwHLuMM5mxIkVMpjpn876CWRekDX/ WQafulJ+YDjg== X-IronPort-AV: E=McAfee;i="6000,8403,9717"; a="142857183" X-IronPort-AV: E=Sophos;i="5.76,329,1592895600"; d="scan'208";a="142857183" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2020 20:22:44 -0700 IronPort-SDR: Senj1BZqyIx7QEhJtx3MgP2EuF3Z3mhgVvhZsvD6NczpUCw8/+zSa9uXt8XUGAkoRlr9dTq78T 6wwpQwyDiuIg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,329,1592895600"; d="scan'208";a="329189501" Received: from chenyu-office.sh.intel.com ([10.239.158.173]) by fmsmga002.fm.intel.com with ESMTP; 18 Aug 2020 20:22:43 -0700 From: Chen Yu To: "Rafael J. Wysocki" , Len Brown Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Rui , Chen Yu Subject: [PATCH][v2] ACPI: processor: Print more information when acpi_processor_evaluate_cst() failed Date: Wed, 19 Aug 2020 11:23:54 +0800 Message-Id: <20200819032354.30234-1-yu.c.chen@intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some platforms have bogus _CST which might cause expectd behavior in the cpu idle driver. Some bogus _CST might be unable to be disassembled by acpica-tools due to broken format. Print extra log if the _CST extraction/verification failed. This can be used to help the user narrow down why the cpu idle driver fails to behave as expected. Suggested-by: Zhang Rui Signed-off-by: Chen Yu --- v2: According to Rafael's suggestion, change the log level from "warn" to "info" --- drivers/acpi/acpi_processor.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index b51ddf3bb616..412a9725cc1e 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -798,22 +798,34 @@ int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu, memset(&cx, 0, sizeof(cx)); element = &cst->package.elements[i]; - if (element->type != ACPI_TYPE_PACKAGE) + if (element->type != ACPI_TYPE_PACKAGE) { + acpi_handle_info(handle, "_CST C%d type(%x) is not package, skip...\n", + i, element->type); continue; + } - if (element->package.count != 4) + if (element->package.count != 4) { + acpi_handle_info(handle, "_CST C%d package count(%d) is not 4, skip...\n", + i, element->package.count); continue; + } obj = &element->package.elements[0]; - if (obj->type != ACPI_TYPE_BUFFER) + if (obj->type != ACPI_TYPE_BUFFER) { + acpi_handle_info(handle, "_CST C%d package element[0] type(%x) is not buffer, skip...\n", + i, obj->type); continue; + } reg = (struct acpi_power_register *)obj->buffer.pointer; obj = &element->package.elements[1]; - if (obj->type != ACPI_TYPE_INTEGER) + if (obj->type != ACPI_TYPE_INTEGER) { + acpi_handle_info(handle, "_CST C[%d] package element[1] type(%x) is not integer, skip...\n", + i, obj->type); continue; + } cx.type = obj->integer.value; /* @@ -850,6 +862,8 @@ int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu, cx.entry_method = ACPI_CSTATE_HALT; snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI HLT"); } else { + acpi_handle_info(handle, "_CST C%d declares FIXED_HARDWARE C-state but not supported in hardware, skip...\n", + i); continue; } } else if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { @@ -857,6 +871,8 @@ int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu, snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI IOPORT 0x%x", cx.address); } else { + acpi_handle_info(handle, "_CST C%d space_id(%x) neither FIXED_HARDWARE nor SYSTEM_IO, skip...\n", + i, reg->space_id); continue; } @@ -864,14 +880,20 @@ int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu, cx.valid = 1; obj = &element->package.elements[2]; - if (obj->type != ACPI_TYPE_INTEGER) + if (obj->type != ACPI_TYPE_INTEGER) { + acpi_handle_info(handle, "_CST C%d package element[2] type(%x) not integer, skip...\n", + i, obj->type); continue; + } cx.latency = obj->integer.value; obj = &element->package.elements[3]; - if (obj->type != ACPI_TYPE_INTEGER) + if (obj->type != ACPI_TYPE_INTEGER) { + acpi_handle_info(handle, "_CST C%d package element[3] type(%x) not integer, skip...\n", + i, obj->type); continue; + } memcpy(&info->states[++last_index], &cx, sizeof(cx)); } -- 2.17.1