Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5116680ybl; Tue, 10 Dec 2019 00:21:48 -0800 (PST) X-Google-Smtp-Source: APXvYqzSgAuYrkyx+XqK7m9C2jKsqlKsaV3eE/l6uNqYESh+ej9hqdlLbgd2yRsyCT4pvfIGuH1D X-Received: by 2002:a05:6830:1b78:: with SMTP id d24mr12721041ote.174.1575966108246; Tue, 10 Dec 2019 00:21:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575966108; cv=none; d=google.com; s=arc-20160816; b=JHofro0Bq4dzlbrvcUeEZBvAHabNZJDhmS4lidk/+4QxOf/FG/Kh22en92Yir0tnW3 VMNTcq2yr78352VEMHM24bUzKCYDEmHyhHi4LZ1chXrVmqOt8a1iMJnaFvhekx+dFCso +XuzlIi6FXFk18DvPvDuralxlx22X42mZuT8BnbHxIX7XqeoQ1bm+4t1P/3csHCqCf4p y/7n+Ne/CPOGW8Vd+opEaBJlgmNksCpnMWwi90ll1LxY2eN2/2GhPGFTKuLApa7yr5qk Dv4qXHABZknYyf0j90FQYFWpO8ttdzrqgRyrO6w7M3S60GMdkMp/6hU+hox6JXmeCq5E 1zpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=7A/0Qsu2a5YAdf68a+vNsMzsJtSeDLWA/CzaFQMz2Ss=; b=0sEKsVqIofTcwqWhAyoCeGQ//oTitZ0E0ZrN/a712ybyEFH7+oMXbEERGZg5bMHpxC KcfiyZgGkVe3qK8UlQYAAYjikongyRX9nAEUkDTPrVBLKoqjFfFXlHGm7+ThOPVNAvCB cJyWsKXYA0FJVHovL6ktnUEav4cvLrP30VK36nuGlMzCCBBv40yizuIEbtcVK3Nkp7Xa ObnP6K18FvSch5ZBENyEV5PTPJhsJXbRyYbVoiKNZCyOiXsRPDKGIxqY8tlObKcmo00u XaXdza/njKQ3v/FxzVxOcyPUaZbBHmcTsY1wwDUZehb9IzTJVJjuyGRUnfHQ7vPrJybc tElQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9si1493375oic.251.2019.12.10.00.21.35; Tue, 10 Dec 2019 00:21:48 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726890AbfLJIT6 (ORCPT + 99 others); Tue, 10 Dec 2019 03:19:58 -0500 Received: from mga04.intel.com ([192.55.52.120]:34973 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726248AbfLJIT6 (ORCPT ); Tue, 10 Dec 2019 03:19:58 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Dec 2019 00:19:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,299,1571727600"; d="scan'208";a="387516160" Received: from txu2-mobl.ccr.corp.intel.com (HELO [10.239.197.115]) ([10.239.197.115]) by orsmga005.jf.intel.com with ESMTP; 10 Dec 2019 00:19:56 -0800 Subject: Re: [PATCH] ACPI/HMAT: Fix the parsing of Cache Associativity and Write Policy To: "Rafael J. Wysocki" Cc: Rafael Wysocki , Len Brown , Greg Kroah-Hartman , Dan Williams , Dave Hansen , ACPI Devel Maling List , Linux Kernel Mailing List References: <20191202070348.32148-1-tao3.xu@intel.com> <6dbcdaff-feae-68b9-006d-dd8aec032553@intel.com> From: Tao Xu Message-ID: <0e4219c3-943a-e416-e5eb-723bed8c9383@intel.com> Date: Tue, 10 Dec 2019 16:19:55 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/10/2019 4:06 PM, Rafael J. Wysocki wrote: > On Tue, Dec 10, 2019 at 2:04 AM Tao Xu wrote: >> >> On 12/9/2019 6:01 PM, Rafael J. Wysocki wrote: >>> On Mon, Dec 2, 2019 at 8:03 AM Tao Xu wrote: >>>> >>>> In chapter 5.2.27.5, Table 5-147: Field "Cache Attributes" of >>>> ACPI 6.3 spec: 0 is "None", 1 is "Direct Mapped", 2 is "Complex Cache >>>> Indexing" for Cache Associativity; 0 is "None", 1 is "Write Back", >>>> 2 is "Write Through" for Write Policy. >>> >>> Well, I'm not sure what the connection between the above statement, >>> which is correct AFAICS, and the changes made by the patch is. >>> >>> Is that the *_OTHER symbol names are confusing or something deeper? >>> >> >> Because in include/acpi/actbl1.h: >> >> #define ACPI_HMAT_CA_NONE (0) >> >> ACPI_HMAT_CA_NONE is 0, but in include/linux/node.h: >> >> enum cache_indexing { >> NODE_CACHE_DIRECT_MAP, >> NODE_CACHE_INDEXED, >> NODE_CACHE_OTHER, >> }; >> NODE_CACHE_OTHER is 2, and for otner enum: >> >> case ACPI_HMAT_CA_DIRECT_MAPPED: >> tcache->cache_attrs.indexing = NODE_CACHE_DIRECT_MAP; >> break; >> case ACPI_HMAT_CA_COMPLEX_CACHE_INDEXING: >> tcache->cache_attrs.indexing = NODE_CACHE_INDEXED; >> break; >> in include/acpi/actbl1.h: >> >> #define ACPI_HMAT_CA_DIRECT_MAPPED (1) >> #define ACPI_HMAT_CA_COMPLEX_CACHE_INDEXING (2) >> >> but in include/linux/node.h: >> >> NODE_CACHE_DIRECT_MAP is 0, NODE_CACHE_INDEXED is 1. This is incorrect. > > Why is it incorrect? Sorry I paste the wrong pre-define. This is the incorrect line: case ACPI_HMAT_CA_DIRECT_MAPPED: tcache->cache_attrs.indexing = NODE_CACHE_DIRECT_MAP; ACPI_HMAT_CA_DIRECT_MAPPED is 1, NODE_CACHE_DIRECT_MAP is 0. That means if HMAT table input 1 for cache_attrs.indexing, kernel store 0 in cache_attrs.indexing. But in ACPI 6.3, 0 means "None". So for the whole switch codes: switch ((attrs & ACPI_HMAT_CACHE_ASSOCIATIVITY) >> 8) { case ACPI_HMAT_CA_DIRECT_MAPPED(1): tcache->cache_attrs.indexing = NODE_CACHE_DIRECT_MAP(0); break; case ACPI_HMAT_CA_COMPLEX_CACHE_INDEXING(2): tcache->cache_attrs.indexing = NODE_CACHE_INDEXED(1); break; case ACPI_HMAT_CA_NONE(0): default: tcache->cache_attrs.indexing = NODE_CACHE_OTHER(2); break; }