Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5665878imm; Wed, 12 Sep 2018 09:15:49 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbS+KpfcxXuO4CBApVG8KoFAuYy6xoLZsi1qz6wNXi1QufWgjOkpG121pcj4paMxigqBqi1 X-Received: by 2002:a17:902:2804:: with SMTP id e4-v6mr3046308plb.327.1536768949719; Wed, 12 Sep 2018 09:15:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536768949; cv=none; d=google.com; s=arc-20160816; b=MTIruF1rX9N15RmnKGaJNcM2eP2je5ebRFNkloC0ObMzYMqxPX24KVsoyQ3wEKxe7I Dw+8ebOsFeNsvw2Ilcyw87bwN5YKSjF/78ZEJYPJLIfaR3zUSm3mFArDbBCkSopaa1nz y5gZetoIqeOcr7GILlRxCJ8RlDPnH+8oMbvguGZoojvys2oE2MTiWh3mv9C566TZPh9j QfEQZKWOG6YpqwPvZSr/DNTc6RS1dRcw5YKUPHvsPChQ5IomFa2MYTr/MegKMuC1LORM r7Q22PXgvqXQBm/oAjFTgOYTlRdD8HEG5t8LwGSV3inMMQC3Ik3hCfZBTqlVaccezD5l TEmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=6Hu3/qiXRoWtogLgowDJdOhCNYfUvJED0s8l0PJSQMw=; b=PqjJpN2N1VfXqcpFZqw6M5WgE2v2Lw+FQaSz2iS3t2EafY+9I8oPix4GfVm7QlrXUQ vHcAqYD1Ke8XHCe1+5FqI7gmD4C+c/arkw9PNSTOzcB47w+L17d97voMiVZxyiUCCwnh OluK1eUYedEMoVyMgiYGL+PM7Ty+YqoWaSB+YLRV6ltF2zuy5hoKzo0VpB7uz2QAXHTl Pr8sldzkqU9Zkx7ZqiiI2l2imDOOlFmXrr3vivcfUX/N6nayLys8lMrkJV1aFLRdiPF5 rZnOs/D4jEySAYszSMStbhgWb6zXY//ebPESDoLCUWWNtDVFQRyAoLtIuhYG8JDGFF6W EBmw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p126-v6si1464346pgp.685.2018.09.12.09.15.23; Wed, 12 Sep 2018 09:15:49 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727441AbeILVUd (ORCPT + 99 others); Wed, 12 Sep 2018 17:20:33 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:34870 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726792AbeILVUd (ORCPT ); Wed, 12 Sep 2018 17:20:33 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3E58E7A9; Wed, 12 Sep 2018 09:15:19 -0700 (PDT) Received: from e107155-lin (e107155-lin.emea.arm.com [10.4.12.116]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DCF903F557; Wed, 12 Sep 2018 09:15:17 -0700 (PDT) Date: Wed, 12 Sep 2018 17:15:09 +0100 From: Sudeep Holla To: Jeffrey Hugo Cc: Jeremy Linton , rjw@rjwysocki.net, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, vkilari@codeaurora.org, Sudeep Holla Subject: Re: [PATCH] ACPI/PPTT: Handle architecturally unknown cache types Message-ID: <20180912161509.GA24181@e107155-lin> References: <1536694334-5811-1-git-send-email-jhugo@codeaurora.org> <98e2e6fa-7256-b5ac-7d2e-42c858c6e57c@codeaurora.org> <2873c62f-1bf9-5aa0-b3a2-07980ef61d35@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 12, 2018 at 09:57:14AM -0600, Jeffrey Hugo wrote: > On 9/12/2018 9:38 AM, Sudeep Holla wrote: > > > > > >On 12/09/18 16:27, Sudeep Holla wrote: > >> > >> > >>On 12/09/18 15:41, Jeffrey Hugo wrote: > > > >[...] > > > >>> > >>>Correct.? However, what if you have a NOCACHE (not architecturally > >>>specified), that is fully described in PPTT, as a non-unified cache > >>>(data only)?? Unlikely?? Maybe.? Still seem possible though, therefore I > >>>feel this assumption is suspect. > >>> > >> > >>Yes, we have other issues if the architecturally not specified cache is > >>not unified irrespective of what PPTT says. So we may need to review and > >>see if that assumption is removed everywhere. > >> > >>Until then why can't a simple change fix the issue you have: > >> > >>-->8 > >> > >>diff --git i/drivers/acpi/pptt.c w/drivers/acpi/pptt.c > >>index d1e26cb599bf..f74131201f5e 100644 > >>--- i/drivers/acpi/pptt.c > >>+++ w/drivers/acpi/pptt.c > >>@@ -406,7 +406,8 @@ static void update_cache_properties(struct cacheinfo > >>*this_leaf, > >> * update the cache type as well. > >> */ > >> if (this_leaf->type == CACHE_TYPE_NOCACHE && > >>- valid_flags == PPTT_CHECKED_ATTRIBUTES) > >>+ (valid_flags == PPTT_CHECKED_ATTRIBUTES || > >>+ found_cache->flags & ACPI_PPTT_CACHE_TYPE_VALID)) > > > >Looking at this again, if we are supporting just presence of cache type > >and size(may be), then we can drop the whole valid_flags thing here. > > > >> this_leaf->type = CACHE_TYPE_UNIFIED; > >> } > >> > > Yes, this change fixes my usecase. I think it invalidates the comment, and > really, the comment should probably mention that we assume unified type > because there are other issues in supporting architecturally not specified > inst/data only caches. > Agreed. > Do you want a V2 with this? If so, do you want the fixes tag removed since > you seem to view this as not a bug? > Yes please, I am fine to retain fixes tag but that's my opinion. > I don't think I clearly understand the purpose of the valid flags, therefore > I feel as though I'm not sure if it can be dropped or not. Is it fair to > say that what the valid flags is accomplishing is identifying if we have a > sufficient level of information to support this cache? If not, then should > the cacheinfo driver not expose any sysfs information about the cache? > I don't see the use of the flag if we *have to* support the case where all the cache geometry is not present but just cache type (and maybe size?) is present. If that's the case we can drop valid flags entirely. I really don't like the idea of supporting that, but I don't have strong reasons to defend my idea, so I am fine with that. Further, I think in your case with NOCACHE type set, sysfs dir shouldn't have been created at the first place ideally. I think we need something like below to fix that. -->8 diff --git i/drivers/base/cacheinfo.c w/drivers/base/cacheinfo.c index 5d5b5988e88b..cf78fa6d470d 100644 --- i/drivers/base/cacheinfo.c +++ w/drivers/base/cacheinfo.c @@ -615,6 +615,8 @@ static int cache_add_dev(unsigned int cpu) this_leaf = this_cpu_ci->info_list + i; if (this_leaf->disable_sysfs) continue; + if (this_leaf->type == CACHE_TYPE_NOCACHE) + break; cache_groups = cache_get_attribute_groups(this_leaf); ci_dev = cpu_device_create(parent, this_leaf, cache_groups, "index%1u", i);