Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp64139ybl; Fri, 17 Jan 2020 18:19:42 -0800 (PST) X-Google-Smtp-Source: APXvYqx+ifMlRrk9nbN3UhWxvbQTlWlfHp/w9/woy3xAEkwLZIlOff/Jsf0I8Lsen6RydtQ21uky X-Received: by 2002:a05:6808:a11:: with SMTP id n17mr5612226oij.94.1579313982754; Fri, 17 Jan 2020 18:19:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579313982; cv=none; d=google.com; s=arc-20160816; b=Jm/IdOEzVf3yXnvTRYlOqNeHpHX4C3tJluV1rwoTcAhJxRQzppjcBwnc8h1VQ9BO6+ nB70uRDfb7lz/eMv1WjYpfV6ufxLgl0/NOKS/hABDPXIsicoNHfAJcE0bFDcbm4iQPXu fC+fWMQP+UAgcNr4pkXGe53SNjwpORdRwFTKruO+4Ldb7h3KbOG+TAi+/vFVA58GAS3f LCVYAnbShZoJC49TN8K0WKEOEGc2j+9YYB+WrHg/FKlCgFnvpdVsm/bt53oIcYuwvTXr MUIEMXQKkuKLJU+kjqecbTJIqLllgodIL8HVWYPerw+zuqx9bL9KypP5uPvMtOi8lz/+ rz/w== 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=O3ROApJiqfPasV8mTJcEaIuNNVCje7S6TyNNVTPhS3o=; b=oXuVszYJVf5Irp5JxhHMcYHT916cWGQk9kDQkmoQiEzkKKm/i4CywXpqf+i4t6fDL2 C2eIdw+YGFUyVeYxVRZ++USQqsRxcfMvgBIXY84i9B1tDf21Y9Xc+g85p0UBT4S4qgB8 x1mMP9Y2KWzP4QlSyv8uwqgxTD4GsnSfAvgvdsJHK6pFf5sjNz8Q+3iMlWXXm8Cxmrz8 RPrqe37QEQm82ZEA7oiVOaq+uDv7fjqGmT3TgAB3xtkBPcm5ORsTymhllwJMNspL6/BB V3P5Ku6zes8MpVgq51KS0hA+znf6m7lDKB0b55qWUFUAfvxSNi6kM82eN4mqicJ8xK6A DxAQ== 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 w18si17406066otl.54.2020.01.17.18.19.30; Fri, 17 Jan 2020 18:19:42 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730624AbgARCSN (ORCPT + 99 others); Fri, 17 Jan 2020 21:18:13 -0500 Received: from ZXSHCAS1.zhaoxin.com ([203.148.12.81]:22444 "EHLO ZXSHCAS1.zhaoxin.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727033AbgARCSN (ORCPT ); Fri, 17 Jan 2020 21:18:13 -0500 Received: from zxbjmbx1.zhaoxin.com (10.29.252.163) by ZXSHCAS1.zhaoxin.com (10.28.252.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1261.35; Sat, 18 Jan 2020 10:18:05 +0800 Received: from [10.32.64.11] (10.32.64.11) by zxbjmbx1.zhaoxin.com (10.29.252.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1261.35; Sat, 18 Jan 2020 10:18:01 +0800 Subject: Re: [PATCH] x86/cpu: remove redundant cpu_detect_cache_sizes To: Borislav Petkov CC: , , , , , , , , References: <1579075257-6985-1-git-send-email-TonyWWang-oc@zhaoxin.com> <20200117184720.GB31472@zn.tnic> From: Tony W Wang-oc Message-ID: Date: Sat, 18 Jan 2020 10:18:29 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20200117184720.GB31472@zn.tnic> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.32.64.11] X-ClientProxiedBy: zxbjmbx1.zhaoxin.com (10.29.252.163) To zxbjmbx1.zhaoxin.com (10.29.252.163) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/01/2020 02:47, Borislav Petkov wrote: > On Wed, Jan 15, 2020 at 04:00:57PM +0800, Tony W Wang-oc wrote: >> Before call cpu_detect_cache_sizes get l2size from CPUID.80000006, >> these CPUs have called init_intel_cacheinfo get l2size/l3size from >> CPUID.4. > > Questions: > > * Does CPUID(4) give the same result as CPUID(80000006) on those CPUs? Yes. On these CPUs, CPUID(80000006).EBX for x86_tlbsize is reserved, CPUID(80000006).ECX for l2size has the same result as CPUID(4). > > * cpu_detect_cache_sizes() sets c->x86_tlbsize while > init_intel_cacheinfo() would set it only when it calls the former > function - cpu_detect_cache_sizes() - at the end: > > if (!l2) > cpu_detect_cache_sizes(c); > > Does that happen on those CPUs? No. On these CPUs, will not call the function cpu_detect_cache_sizes(c). l2size will get from CPUID(4) and c->x86_tlbsize remain its default value of 0. Sincerely TonyWWang-oc